@arcgis/core 6.0.0-next.30 → 6.0.0-next.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00d1c99779bd91b1d10e.js +1 -0
- package/assets/esri/core/workers/chunks/0694c7bcfe71692e2ccf.js +1 -0
- package/assets/esri/core/workers/chunks/{e2c6cd8dac01e129ccfe.js → 0e445ec3523de9f2dfa2.js} +1 -1
- package/assets/esri/core/workers/chunks/0f6c0d42100c21367e5c.js +1 -0
- package/assets/esri/core/workers/chunks/16cda273927ab0a39544.js +1 -0
- package/assets/esri/core/workers/chunks/1a3f71c4d97c36050030.js +1 -0
- package/assets/esri/core/workers/chunks/{0b4481b57a611b15f65c.js → 1eaf8bfdd3765a90ccc2.js} +1 -1
- package/assets/esri/core/workers/chunks/{8ca2bb3c0551bb1898b6.js → 3fdcc383bbd9cf0d274c.js} +1 -1
- package/assets/esri/core/workers/chunks/{fefdd10bdd5a4c8d8ed0.js → 4741fac6b6b4202a97c5.js} +1 -1
- package/assets/esri/core/workers/chunks/{ad21757d78e372fa2ed6.js → 4a979fce1c971b614a18.js} +1 -1
- package/assets/esri/core/workers/chunks/4d8833f48348cbbcc947.js +1 -0
- package/assets/esri/core/workers/chunks/{865cebc5c982c040ab6f.js → 55a9eaeb152a3abada67.js} +1 -1
- package/assets/esri/core/workers/chunks/572aec57593a08b8045b.js +1 -0
- package/assets/esri/core/workers/chunks/6029773458ab98600f67.js +1 -0
- package/assets/esri/core/workers/chunks/6b5c073dddd89d06ed80.js +1 -0
- package/assets/esri/core/workers/chunks/7cc9d7a88b64e25fce14.js +1 -0
- package/assets/esri/core/workers/chunks/7e211d8a8ad6c6a7cf3e.js +1 -0
- package/assets/esri/core/workers/chunks/{64b360625c68cb863a08.js → 84940d8e14caf5a27e04.js} +1 -1
- package/assets/esri/core/workers/chunks/{c90388932a7825d9d933.js → 85de980c5b296ec69323.js} +1 -1
- package/assets/esri/core/workers/chunks/89dc49e784f7ba3b93ea.js +1 -0
- package/assets/esri/core/workers/chunks/{9d40786c5ceface786ba.js → 8a485130781b49dbf608.js} +1 -1
- package/assets/esri/core/workers/chunks/8d13f11d0bcc8d3a4bdf.js +1 -0
- package/assets/esri/core/workers/chunks/8da2a10318f49d0dc73a.js +1 -0
- package/assets/esri/core/workers/chunks/8e6276ddd8d094c61f08.js +1 -0
- package/assets/esri/core/workers/chunks/{1dc6f093028530a492e6.js → 90ba0af9690dc32b2958.js} +1 -1
- package/assets/esri/core/workers/chunks/{71f792a20077aa739f87.js → a607541959169741a943.js} +1 -1
- package/assets/esri/core/workers/chunks/b2d6b1ac9fbb50c7c8ab.js +1 -0
- package/assets/esri/core/workers/chunks/b657363113f4a37e634b.js +1 -0
- package/assets/esri/core/workers/chunks/b9cb92858a576eb6aa06.js +1 -0
- package/assets/esri/core/workers/chunks/{4419732baf3459a80e6d.js → ceb2d5b0a23f0ab81f68.js} +1 -1
- package/assets/esri/core/workers/chunks/{7030a4d0714a35995a58.js → d09d8cd43e846d467827.js} +1 -1
- package/assets/esri/core/workers/chunks/{12b84262dedc6b393136.js → d9a240a3c6bf85124474.js} +1 -1
- package/assets/esri/core/workers/chunks/{8f008eedb11685ee2048.js → e096c1d9d53af74d3207.js} +1 -1
- package/assets/esri/core/workers/chunks/e30fdde253e5521473a2.js +1 -0
- package/assets/esri/core/workers/chunks/e4e2edfdc85dd14e66d4.js +1 -0
- package/assets/esri/core/workers/chunks/{ba4520ddcb6a49988da6.js → f21edbfdcab111d8a6cd.js} +1 -1
- package/assets/esri/core/workers/chunks/f4d91d470ca5fea0bd26.js +1 -0
- package/assets/esri/core/workers/chunks/f717005e14a7e9141df7.js +1 -0
- package/assets/esri/core/workers/chunks/f75eec2cbc541eec9712.js +1 -0
- package/assets/esri/core/workers/chunks/{b5eff28cf482d920b9ea.js → f7fb6cb7f08c16384443.js} +1 -1
- package/assets/esri/core/workers/chunks/fcc3902d6d9eda6f09f5.js +1 -0
- package/assets/esri/core/workers/chunks/{28a821de9dbf10324033.js → fd031150d3a7f896e6b3.js} +1 -1
- package/assets/esri/core/workers/chunks/{cc97e4fd0dacad970a23.js → ffaaa388773e60869df0.js} +1 -1
- package/config.js +1 -1
- package/core/scheduling.js +1 -1
- package/geometry/Mesh.d.ts +2 -125
- package/geometry/Mesh.js +1 -1
- package/geometry/support/meshErrors.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/geometry/support/polygonUtils.js +1 -1
- package/interfaces.d.ts +0 -3
- package/kernel.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/raster/functions/rasterProjectionHelper.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/package.json +2 -2
- package/support/arcadeUtils.js +1 -1
- package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightConfiguration.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
- package/views/3d/environment/SunLighting.d.ts +10 -8
- package/views/3d/environment/VirtualLighting.d.ts +10 -8
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/support/renderInfoUtils/polygon.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PlanarPatch.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/webgl-engine/lib/Path.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
- package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
- package/views/support/TextureCompressionWorker.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/webscene/Environment.d.ts +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/assets/esri/core/workers/chunks/02335385b1476fe322eb.js +0 -1
- package/assets/esri/core/workers/chunks/07b726a46864501b90a0.js +0 -1
- package/assets/esri/core/workers/chunks/189321d88026bd7e6d3e.js +0 -1
- package/assets/esri/core/workers/chunks/18d47ab571b613fbe719.js +0 -1
- package/assets/esri/core/workers/chunks/1967b9c96045a5802d08.js +0 -1
- package/assets/esri/core/workers/chunks/199a7f97916679e0257c.js +0 -1
- package/assets/esri/core/workers/chunks/1d96fbad881a7d14a950.js +0 -1
- package/assets/esri/core/workers/chunks/2cd60fd062d954322c1f.js +0 -1
- package/assets/esri/core/workers/chunks/2d3e0e4442dbc6ec6def.js +0 -1
- package/assets/esri/core/workers/chunks/2f5d014d6a72108b0b3a.js +0 -1
- package/assets/esri/core/workers/chunks/3105336a05f38a95ebea.js +0 -1
- package/assets/esri/core/workers/chunks/4fb2fcc95f852bf8f86c.js +0 -1
- package/assets/esri/core/workers/chunks/59bc55880e6fd8ce20c0.js +0 -1
- package/assets/esri/core/workers/chunks/5f787809b74eed7b9a91.js +0 -1
- package/assets/esri/core/workers/chunks/6a7de221cea4426cb490.js +0 -1
- package/assets/esri/core/workers/chunks/7a0b4dc0cda190367a39.js +0 -1
- package/assets/esri/core/workers/chunks/7d3f7940815fa5dc244e.js +0 -1
- package/assets/esri/core/workers/chunks/999c23da883eb11cb29e.js +0 -1
- package/assets/esri/core/workers/chunks/9bc3afe7013ef4ae737b.js +0 -1
- package/assets/esri/core/workers/chunks/bab1d010970d98c25470.js +0 -1
- package/assets/esri/core/workers/chunks/c4f78a481f43cfae7b63.js +0 -1
- package/assets/esri/core/workers/chunks/dcf6024dc19428ff2b9d.js +0 -1
- package/assets/esri/core/workers/chunks/ee0dc906cc7979080329.js +0 -1
- package/assets/esri/core/workers/chunks/f0d0ed155275c2e6d3da.js +0 -1
package/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const t={apiKey:void 0,apiKeys:{scopes:[]},applicationName:``,applicationUrl:globalThis.location?.href,assetsPath:``,fontsUrl:`https://static.arcgis.com/fonts`,geometryServiceUrl:`https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer`,geoRSSServiceUrl:`https://utility.arcgis.com/sharing/rss`,kmlServiceUrl:`https://utility.arcgis.com/sharing/kml`,userPrivilegesApplied:!0,portalUrl:`https://www.arcgis.com`,respectPrefersReducedMotion:!0,routeServiceUrl:`https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World`,workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:[`arcgis.com`,`arcgisonline.com`,`esrikr.com`,`premiumservices.blackbridge.com`,`esripremium.accuweather.com`,`gbm.digitalglobe.com`,`firstlook.digitalglobe.com`,`msi.digitalglobe.com`],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:`high`,proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};globalThis.esriConfig&&(e(t,globalThis.esriConfig,!0),delete t.has),t.assetsPath||(t.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@6.0.0-next.
|
|
2
|
+
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const t={apiKey:void 0,apiKeys:{scopes:[]},applicationName:``,applicationUrl:globalThis.location?.href,assetsPath:``,fontsUrl:`https://static.arcgis.com/fonts`,geometryServiceUrl:`https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer`,geoRSSServiceUrl:`https://utility.arcgis.com/sharing/rss`,kmlServiceUrl:`https://utility.arcgis.com/sharing/kml`,userPrivilegesApplied:!0,portalUrl:`https://www.arcgis.com`,respectPrefersReducedMotion:!0,routeServiceUrl:`https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World`,workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:[`arcgis.com`,`arcgisonline.com`,`esrikr.com`,`premiumservices.blackbridge.com`,`esripremium.accuweather.com`,`gbm.digitalglobe.com`,`firstlook.digitalglobe.com`,`msi.digitalglobe.com`],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:`high`,proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};globalThis.esriConfig&&(e(t,globalThis.esriConfig,!0),delete t.has),t.assetsPath||(t.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@6.0.0-next.31/assets`,t.defaultAssetsPath=t.assetsPath);export{t as default};
|
package/core/scheduling.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{nextTick as e}from"./nextTick.js";import{recordPerformance as t}from"./performance.js";import n from"./PerformanceSampler.js";import r from"./PooledArray.js";import{isAborted as i,createAbortError as a}from"./promiseUtils.js";import{Milliseconds as o}from"./time.js";class s{constructor(e){this.phases=e,this.paused=!1,this.ticks=-1,this.removed=!1}}class c{constructor(e){this.callback=e,this.isActive=!0}remove(){this.isActive=!1}}let l=0,u=0;const d={time:o(0),deltaTime:o(0),elapsedFrameTime:o(0),frameDuration:o(0)},f=[`prepare`,`preRender`,`render`,`postRender`,`update`,`finish`],p=[],m=new r;class h{constructor(e){this._task=e}remove(){this._task.removed=!0}pause(){this._task.paused=!0}resume(){this._task.paused=!1,_()}}function g(){
|
|
2
|
+
import{nextTick as e}from"./nextTick.js";import{recordPerformance as t}from"./performance.js";import n from"./PerformanceSampler.js";import r from"./PooledArray.js";import{isAborted as i,createAbortError as a}from"./promiseUtils.js";import{Milliseconds as o}from"./time.js";class s{constructor(e){this.phases=e,this.paused=!1,this.ticks=-1,this.removed=!1}}class c{constructor(e){this.callback=e,this.isActive=!0}remove(){this.isActive=!1}}let l=0,u=0;const d={time:o(0),deltaTime:o(0),elapsedFrameTime:o(0),frameDuration:o(0)},f=[`prepare`,`preRender`,`render`,`postRender`,`update`,`finish`],p=[],m=new r;class h{constructor(e){this._task=e}remove(){this._task.removed=!0,process.env.NODE_ENV===`test`&&!m.some(e=>!e.removed)&&(y(),b())}pause(){this._task.paused=!0}resume(){this._task.paused=!1,_()}}function g(){w!=null&&(process.env.NODE_ENV===`test`?y():cancelAnimationFrame(w),w=process.env.NODE_ENV===`test`?v():requestAnimationFrame(O))}function _(){w??=(l=performance.now(),process.env.NODE_ENV===`test`?v():requestAnimationFrame(O))}function v(){return T=cancelAnimationFrame,requestAnimationFrame(O)}function y(){w!=null&&(T(w),w=null)}function b(){Promise.resolve().then(j)}const x={frameTasks:m,willDispatch:!1,clearFrameTasks:E,dispatch:N,executeFrameTasks:k,reschedule:g};function S(t){let n=new c(t);return p.push(n),x.willDispatch||(x.willDispatch=!0,e(N)),n}function C(e){let t=new s(e);return m.push(t),_(),new h(t)}let w=null,T;function E(e=!1){m.forAll(e=>{e.removed=!0}),process.env.NODE_ENV===`test`&&(y(),e||b()),e&&j()}function D(e){u=Math.max(0,e)}function O(){let e=performance.now();w=null,w=m.some(e=>!e.paused&&!e.removed)?process.env.NODE_ENV===`test`?v():requestAnimationFrame(O):null,x.executeFrameTasks(e)}function k(e){let n=o(e-l);l=e;let r=u>0?u:1e3/60,i=Math.max(0,n-r);d.time=e,d.frameDuration=o(r-i);for(let r=0;r<f.length;r++){let i=performance.now(),a=f[r];m.forAll(t=>{t.paused||t.removed||(r===0&&t.ticks++,!t.phases[a])||(d.elapsedFrameTime=o(performance.now()-e),d.deltaTime=t.ticks===0?o(0):n,t.phases[a]?.call(t,d))});let s=performance.now();R[r].push(s-i),t(a,i,s,`Maps SDK`,`Scheduling`)}j();let a=performance.now();z.push(a-e),t(`Animation Frame`,e,a,`Maps SDK`,`Scheduling`)}const A=new r;function j(){m.forAll(e=>{e.removed&&A.push(e)}),m.removeUnorderedMany(A.data,A.length),A.clear()}function M(){process.env.NODE_ENV===`test`&&y(),m.prune(),A.prune()}function N(){for(;p.length;){let e=p.shift();e.isActive&&e.callback()}x.willDispatch=!1}function P(t=1,n){let r=Promise.withResolvers(),o=()=>{i(n)?r.reject(a()):t===0?r.resolve():(--t,e(()=>o()))};return o(),r.promise}function F(e){return P(1,e)}function I(){let e=Promise.withResolvers(),t=C({postRender:()=>{t.remove(),S(()=>e.resolve())}});return e.promise}async function L(e){await F(e),await new Promise(t=>requestAnimationFrame(()=>{e?.aborted||t()}))}const R=f.map(e=>new n(e)),z=new n(`total`);export{C as addFrameTask,M as cleanupScheduling,x as debug,R as performanceInfo,z as performanceTotal,S as schedule,D as setFrameDuration,L as waitAnimationFrame,I as waitRender,F as waitTick,P as waitTicks};
|
package/geometry/Mesh.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type Extent from "./Extent.js";
|
|
2
2
|
import type BaseGeometry from "./Geometry.js";
|
|
3
3
|
import type Point from "./Point.js";
|
|
4
|
-
import type Polygon from "./Polygon.js";
|
|
5
4
|
import type MeshComponent from "./support/MeshComponent.js";
|
|
6
5
|
import type MeshTransform from "./support/MeshTransform.js";
|
|
7
6
|
import type MeshVertexAttributes from "./support/MeshVertexAttributes.js";
|
|
@@ -10,8 +9,7 @@ import type { LoadableMixin, LoadableMixinProperties } from "../core/Loadable.js
|
|
|
10
9
|
import type { EsriPromiseMixin } from "../core/Promise.js";
|
|
11
10
|
import type { MeshVertexSpaceUnion } from "./types.js";
|
|
12
11
|
import type { MeshComponentProperties } from "./support/MeshComponent.js";
|
|
13
|
-
import type {
|
|
14
|
-
import type { CreateBoxParameters, CreateCylinderParameters, CreateSphereParameters, CreatePlaneParameters, RotateParameters, CenterAtParameters, ScaleParameters, CreateFromGLTFParameters, ExportGLTFOptions } from "./support/meshUtils/types.js";
|
|
12
|
+
import type { RotateParameters, CenterAtParameters, ScaleParameters, ExportGLTFOptions } from "./support/meshUtils/types.js";
|
|
15
13
|
import type { MeshLocalVertexSpaceProperties } from "./support/MeshLocalVertexSpace.js";
|
|
16
14
|
import type { MeshGeoreferencedVertexSpaceProperties } from "./support/MeshGeoreferencedVertexSpace.js";
|
|
17
15
|
import type { MeshTransformProperties } from "./support/MeshTransform.js";
|
|
@@ -401,121 +399,6 @@ export interface MeshProperties extends BaseGeometryProperties, LoadableMixinPro
|
|
|
401
399
|
* @see [Sample - Low poly terrain using mesh geometry](https://developers.arcgis.com/javascript/latest/sample-code/geometry-mesh-elevation/)
|
|
402
400
|
*/
|
|
403
401
|
export default class Mesh extends MeshSuperclass {
|
|
404
|
-
/**
|
|
405
|
-
* Creates a mesh representing a box. The spatial reference of the resulting mesh is the same
|
|
406
|
-
* as the location where it is placed.
|
|
407
|
-
*
|
|
408
|
-
* #### Box UV coordinate space
|
|
409
|
-
*
|
|
410
|
-
* The box geometry will have UV coordinates generated according to the following scheme:
|
|
411
|
-
*
|
|
412
|
-
* <img src="https://developers.arcgis.com/javascript/latest/assets/references/core/geometry/mesh-box-uv.avif" width="300" height="300"/>
|
|
413
|
-
*
|
|
414
|
-
* @deprecated since version 5.1. Use [createBox()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/meshUtils/#createBox) instead.
|
|
415
|
-
* @param location - The location bottom center of the box.
|
|
416
|
-
* @param parameters - Parameters to configure the box creation.
|
|
417
|
-
* @returns The resulting mesh.
|
|
418
|
-
* @example
|
|
419
|
-
* let mesh = Mesh.createBox(point, {
|
|
420
|
-
* size: {
|
|
421
|
-
* width: 10,
|
|
422
|
-
* height: 100,
|
|
423
|
-
* depth: 20
|
|
424
|
-
* },
|
|
425
|
-
* material: {
|
|
426
|
-
* color: "green"
|
|
427
|
-
* }
|
|
428
|
-
* });
|
|
429
|
-
* @example
|
|
430
|
-
* let mesh = Mesh.createBox(point, {
|
|
431
|
-
* imageFace: "top",
|
|
432
|
-
* material: {
|
|
433
|
-
* colorTexture: new MeshTexture({ url: "./url-to-image.png" })
|
|
434
|
-
* }
|
|
435
|
-
* });
|
|
436
|
-
*/
|
|
437
|
-
static createBox(location: Point, parameters?: CreateBoxParameters): Mesh;
|
|
438
|
-
/**
|
|
439
|
-
* Creates a mesh representing a cylinder. The spatial reference of the resulting mesh is the same
|
|
440
|
-
* as the location where it is placed.
|
|
441
|
-
*
|
|
442
|
-
* #### Cylinder UV coordinate space
|
|
443
|
-
*
|
|
444
|
-
* The cylinder geometry will have UV coordinates generated according to the following scheme
|
|
445
|
-
* (example is shown for 8 vertices cylinder):
|
|
446
|
-
*
|
|
447
|
-
* <img src="https://developers.arcgis.com/javascript/latest/assets/references/core/geometry/mesh-cylinder-uv.avif" width="300" height="300"/>
|
|
448
|
-
*
|
|
449
|
-
* @deprecated since version 5.1. Use [createCylinder()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/meshUtils/#createCylinder) instead.
|
|
450
|
-
* @param location - The location of the bottom center of the cylinder.
|
|
451
|
-
* @param parameters - Parameters to configure the cylinder creation.
|
|
452
|
-
* @returns The resulting mesh.
|
|
453
|
-
*/
|
|
454
|
-
static createCylinder(location: Point, parameters?: CreateCylinderParameters): Mesh;
|
|
455
|
-
/**
|
|
456
|
-
* Creates a new mesh geometry from a glTF model referenced by the `url` parameter. The spatial reference of the
|
|
457
|
-
* resulting mesh is the same as the spatial reference of the `location` parameter.
|
|
458
|
-
*
|
|
459
|
-
* See section [Supported GLTF features](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/meshUtils/#supported-gltf-features)
|
|
460
|
-
* for details.
|
|
461
|
-
*
|
|
462
|
-
* @deprecated since version 5.1. Use [createFromGLTF()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/meshUtils/#createFromGLTF) instead.
|
|
463
|
-
* @param location - The location of the origin of the model. If the location does not
|
|
464
|
-
* contain a z-value, z is assumed to be `0`.
|
|
465
|
-
* @param url - The URL of the glTF model. The URL should point to a glTF file (.gltf or .glb) which can
|
|
466
|
-
* reference additional binary (.bin) and image files (.jpg, .png).
|
|
467
|
-
* @param parameters - Parameters to configure the mesh from glTF creation.
|
|
468
|
-
* @returns A promise that resolves to a mesh geometry representing the loaded
|
|
469
|
-
* glTF model.
|
|
470
|
-
* @since 4.11
|
|
471
|
-
*/
|
|
472
|
-
static createFromGLTF(location: Point, url: string, parameters?: CreateFromGLTFParameters): Promise<Mesh>;
|
|
473
|
-
/**
|
|
474
|
-
* Creates a new mesh geometry from a polygon geometry. The resulting mesh contains only
|
|
475
|
-
* a position vertex attribute and a single component with faces. The default shading will be
|
|
476
|
-
* set to `flat`. The spatial reference of the resulting mesh is the same
|
|
477
|
-
* as the input polygon. The resulting mesh will not contain any UV nor normal vertex attributes.
|
|
478
|
-
*
|
|
479
|
-
* @deprecated since version 5.1. Use [createFromPolygon()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/meshUtils/#createFromPolygon) instead.
|
|
480
|
-
* @param polygon - The input polygon.
|
|
481
|
-
* @param parameters - Optional parameters.
|
|
482
|
-
* @returns A new mesh representing the triangulated polygon.
|
|
483
|
-
*/
|
|
484
|
-
static createFromPolygon(polygon: Polygon, parameters?: CreateFromPolygonParameters): Mesh;
|
|
485
|
-
/**
|
|
486
|
-
* Creates a mesh representing a plane. The spatial reference of the resulting mesh is the same
|
|
487
|
-
* as the location where it is placed. A plane consists of two triangles and may be conveniently
|
|
488
|
-
* oriented at creation time.
|
|
489
|
-
*
|
|
490
|
-
* #### Plane UV coordinate space
|
|
491
|
-
*
|
|
492
|
-
* The plane geometry will have UV coordinates generated according to the following scheme:
|
|
493
|
-
*
|
|
494
|
-
* <img src="https://developers.arcgis.com/javascript/latest/assets/references/core/geometry/mesh-plane-uv.avif" width="300" height="300"/>
|
|
495
|
-
*
|
|
496
|
-
* @deprecated since version 5.1. Use [createPlane()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/meshUtils/#createPlane) instead.
|
|
497
|
-
* @param location - The location of the bottom center of the plane.
|
|
498
|
-
* @param parameters - Parameters to configure the plane creation.
|
|
499
|
-
* @returns The resulting mesh.
|
|
500
|
-
*/
|
|
501
|
-
static createPlane(location: Point, parameters?: CreatePlaneParameters): Mesh;
|
|
502
|
-
/**
|
|
503
|
-
* Creates a mesh representing a sphere. The spatial reference of the resulting mesh is the same
|
|
504
|
-
* as the location where it is placed.
|
|
505
|
-
*
|
|
506
|
-
* #### Sphere UV coordinate space
|
|
507
|
-
*
|
|
508
|
-
* The sphere geometry will have UV coordinates generated according to the following scheme
|
|
509
|
-
* (example is shown for 8x8 vertices sphere):
|
|
510
|
-
*
|
|
511
|
-
* <img src="https://developers.arcgis.com/javascript/latest/assets/references/core/geometry/mesh-sphere-uv.avif" width="300" height="300"/>
|
|
512
|
-
*
|
|
513
|
-
* @deprecated since version 5.1. Use [createSphere()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/meshUtils/#createSphere) instead.
|
|
514
|
-
* @param location - The location of the bottom center of the sphere.
|
|
515
|
-
* @param parameters - Parameters to configure the sphere creation.
|
|
516
|
-
* @returns The resulting mesh.
|
|
517
|
-
*/
|
|
518
|
-
static createSphere(location: Point, parameters?: CreateSphereParameters): Mesh;
|
|
519
402
|
constructor(properties?: MeshProperties);
|
|
520
403
|
/**
|
|
521
404
|
* An array of mesh components that can be used to apply materials
|
|
@@ -727,10 +610,4 @@ export default class Mesh extends MeshSuperclass {
|
|
|
727
610
|
*/
|
|
728
611
|
vertexAttributesChanged(): void;
|
|
729
612
|
}
|
|
730
|
-
declare const MeshSuperclass: typeof BaseGeometry & typeof EsriPromiseMixin & typeof LoadableMixin & typeof ClonableMixin
|
|
731
|
-
|
|
732
|
-
/** @deprecated since version 5.1. Use [CreateFromPolygonParameters](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/meshUtils/#CreateFromPolygonParameters) in `meshUtils` instead. */
|
|
733
|
-
export interface CreateFromPolygonParameters {
|
|
734
|
-
/** The material to be used for the mesh. */
|
|
735
|
-
material?: MeshMaterialProperties;
|
|
736
|
-
}
|
|
613
|
+
declare const MeshSuperclass: typeof BaseGeometry & typeof EsriPromiseMixin & typeof LoadableMixin & typeof ClonableMixin
|
package/geometry/Mesh.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{ClonableMixin as t}from"../core/Clonable.js";import{LoadableMixin as n}from"../core/Loadable.js";import r from"../core/Logger.js";import{EsriPromiseMixin as i}from"../core/Promise.js";import{throwIfAborted as a
|
|
2
|
+
import{__decorate as e}from"tslib";import{ClonableMixin as t}from"../core/Clonable.js";import{LoadableMixin as n}from"../core/Loadable.js";import r from"../core/Logger.js";import{EsriPromiseMixin as i}from"../core/Promise.js";import{throwIfAborted as a}from"../core/promiseUtils.js";import{watch as o}from"../core/reactiveUtils.js";import{property as s,subclass as c}from"../core/accessorSupport/decorators.js";import{fromValues as l}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import u from"./Geometry.js";import d from"./Point.js";import{create as f,zero as p,fromBuffer as m}from"./support/aaBoundingBox.js";import{composeAxes as h,create as g}from"./support/axisAngleDegrees.js";import _ from"./support/MeshComponent.js";import{componentNotFoundMessage as v,meshNotLoadedMessage as y}from"./support/meshErrors.js";import b from"./support/MeshGeoreferencedVertexSpace.js";import x from"./support/MeshLocalVertexSpace.js";import S from"./support/MeshTransform.js";import C from"./support/MeshVertexAttributes.js";import{vertexSpaceOriginToPoint as w,isRelativeVertexSpace as T}from"./support/meshVertexSpaceUtils.js";import{centerAt as E}from"./support/meshUtils/centerAt.js";import{computeMeshExtent as D}from"./support/meshUtils/extent.js";import{loadExternal as O}from"./support/meshUtils/loadExternal.js";import{addMeshMaterialCloneContext as k,addMeshTextureCloneContext as A,getMeshCloneContext as j}from"./support/meshUtils/meshCloneUtils.js";import{Metadata as M}from"./support/meshUtils/Metadata.js";import{rotate as N}from"./support/meshUtils/rotate.js";import{scale as P}from"./support/meshUtils/scale.js";var F;const I={base:null,key:`type`,defaultKeyValue:`georeferenced`,typeMap:{georeferenced:b,local:x}};let L=F=class extends t(n(i(u))){constructor(e){super(e),this.components=null,this.vertexSpace=new b,this.transform=null,this.metadata=new M,this.hasZ=!0,this.hasM=!1,this.vertexAttributes=new C,this.type=`mesh`}initialize(){(this.metadata.externalSources.length===0||this.vertexAttributes.position.length)&&(this.loadStatus=`loaded`),this.when(()=>{this.addHandles(o(()=>({vertexAttributes:this.vertexAttributes,components:this.components?.map(e=>e.clone())}),()=>this._clearSources(),{once:!0,sync:!0}))}).catch(()=>{})}get hasExtent(){return this.loaded?this.vertexAttributes.position.length>0&&(!this.components||this.components.length>0):this.metadata.displaySource?.extent!=null}get _transformedExtent(){let{spatialReference:e,vertexSpace:t}=this,n=this;return D({get transform(){return n.transform},vertexSpace:t,spatialReference:e,untransformedBounds:this._untransformedBounds})}get _untransformedBounds(){let{vertexAttributes:{position:e},components:t}=this;return e.length===0||t?.length===0?f(p):m(e)}get origin(){let e=w(this.vertexSpace,this.spatialReference);if(e!=null)return e;let{center:t,zmin:n}=this._transformedExtent;return new d({x:t.x,y:t.y,z:n,spatialReference:this.spatialReference})}get extent(){return!this.loaded&&this.metadata?.displaySource?.extent!=null?this.metadata.displaySource.extent.clone():this._transformedExtent}addComponent(e){this._checkIfLoaded(`addComponent()`)&&(this.components||=[],this.components.push(_.from(e)),this.notifyChange(`components`))}removeComponent(e){if(this._checkIfLoaded(`removeComponent()`)){if(this.components){let t=this.components.indexOf(e);if(t!==-1){this.components.splice(t,1),this.notifyChange(`components`);return}}r.getLogger(this).error(`removeComponent()`,v)}}rotate(e,t,n,r){return h(e,t,n,R),N(this,R,r),this}offset(e,t,n){if(!this._checkIfLoaded(`offset()`))return this;let{vertexSpace:r,vertexAttributes:i}=this,a=i?.position;if(!a)return this;if(T(r)){let[i,a,o]=r.origin;r.origin=l(i+e,a+t,o+n)}else{for(let r=0;r<a.length;r+=3)a[r]+=e,a[r+1]+=t,a[r+2]+=n;this.vertexAttributesChanged()}return this}scale(e,t){return this._checkIfLoaded(`scale()`)&&P(this,e,t),this}centerAt(e,t){return this._checkIfLoaded(`centerAt()`)&&E(this,e,t),this}load(e){let{metadata:{displaySource:t}}=this;return t&&this.addResolvingPromise(O(this,t,e)),Promise.resolve(this)}addExternalSources(e){this.metadata.externalSources.addMany(e)}updateDisplaySource(e){this.metadata.displaySource=e}clone(e){return super.clone(k(A(e)))}cloneShallow(){return new F({components:this.components,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes,vertexSpace:this.vertexSpace.clone(),transform:this.transform,metadata:this.metadata})}vertexAttributesChanged(){this.notifyChange(`vertexAttributes`)}async toBinaryGLTF(e){let[{toBinaryGLTF:t}]=await Promise.all([import(`./support/meshUtils/exporters/gltf/gltfexport.js`),this.load(e)]);return a(e),await t(this,e)}get usedMemory(){return this.components?this.components.reduce((e,t)=>e+t.memoryUsage,this.vertexAttributes.usedMemory):this.vertexAttributes.usedMemory}_clearSources(){this.metadata.clearSources()}_checkIfLoaded(e){return this.loaded?!0:(r.getLogger(this).error(e,y),!1)}};e([s({type:[_],json:{write:!0}})],L.prototype,`components`,void 0),e([s({nonNullable:!0,types:I,constructOnly:!0,json:{write:!0},clonable:(e,t)=>j(t)?.vertexSpace??e.clone(t)})],L.prototype,`vertexSpace`,void 0),e([s({type:S,clonable:(e,t)=>{let n=j(t);return n&&`transform`in n?n.transform:e?.clone()??e},json:{write:!0}})],L.prototype,`transform`,void 0),e([s({constructOnly:!0,type:M,clonable:(e,t)=>j(t)?.metadata??e.clone()})],L.prototype,`metadata`,void 0),e([s()],L.prototype,`hasExtent`,null),e([s()],L.prototype,`_transformedExtent`,null),e([s()],L.prototype,`_untransformedBounds`,null),e([s()],L.prototype,`origin`,null),e([s({readOnly:!0,json:{read:!1}})],L.prototype,`extent`,null),e([s({readOnly:!0,json:{read:!1,write:!0,default:!0}})],L.prototype,`hasZ`,void 0),e([s({readOnly:!0,json:{read:!1,write:!0,default:!1}})],L.prototype,`hasM`,void 0),e([s({type:C,nonNullable:!0,json:{write:!0},clonable:(e,t)=>j(t)?.vertexAttributes??e.clone(t)})],L.prototype,`vertexAttributes`,void 0),L=F=e([c(`esri.geometry.Mesh`)],L);const R=g();export{L as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
|
|
2
|
+
const e=`Mesh must be loaded before applying operations`,t=`Provided component is not part of the list of components`;export{t as componentNotFoundMessage,e as meshNotLoadedMessage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{clamp as e}from"../../core/mathUtils.js";import{
|
|
2
|
+
import{clamp as e}from"../../core/mathUtils.js";import{lerp as t,copy as n,dot as r,add as i,scale as a,subtract as o,cross as s,exactEquals as c,normalize as l,set as u,scaleAndAdd as d}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{equals as p,exactEquals as m}from"../../core/libs/gl-matrix-2/math/vec4.js";import{projectPointSignedLength as h}from"./vector.js";import{sv3d as g,sv4d as _}from"./vectorStacks.js";import{tangentFrame as ee}from"../../views/3d/support/mathUtils.js";function v(e=Z){return[e[0],e[1],e[2],e[3]]}const te=m,ne=p;function re(e=Z[0],t=Z[1],n=Z[2],r=Z[3]){return x(e,t,n,r,_.get())}function y(e,t){return x(t[0],t[1],t[2],t[3],e)}function b(e){return e}function x(e,t,n,r,i=v()){return i[0]=e,i[1]=t,i[2]=n,i[3]=r,i}function S(e,t,r){return n(r,e),r[3]=t,r}function C(e,t,n){let r=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=Math.abs(r-1)>1e-5&&r>1e-12?1/Math.sqrt(r):1;return n[0]=t[0]*i,n[1]=t[1]*i,n[2]=t[2]*i,n[3]=-(n[0]*e[0]+n[1]*e[1]+n[2]*e[2]),n}function w(e,t,n,r=v()){let i=n[0]-t[0],a=n[1]-t[1],o=n[2]-t[2],s=e[0]-t[0],c=e[1]-t[1],l=e[2]-t[2],u=a*l-o*c,d=o*s-i*l,f=i*c-a*s,p=u*u+d*d+f*f,m=Math.abs(p-1)>1e-5&&p>1e-12?1/Math.sqrt(p):1;return r[0]=u*m,r[1]=d*m,r[2]=f*m,r[3]=-(r[0]*e[0]+r[1]*e[1]+r[2]*e[2]),r}function T(e,t,n,i=0,a=Math.floor(1/3*n),s=Math.floor(2/3*n)){if(n<3)return!1;t(D,i);let u=a,d=!1;for(;u<n-1&&!d;)t(O,u),u++,d=!c(D,O);if(!d)return!1;for(u=Math.max(u,s),d=!1;u<n&&!d;)t(k,u),u++,o(A,D,O),l(A,A),o(j,O,k),l(j,j),d=!c(D,k)&&!c(O,k)&&Math.abs(r(A,j))<ie;return d?(w(D,O,k,e),!0):i===0&&a===1&&s===2?!1:T(e,t,n,0,1,2)}function E(e,t,n=!0){let r=t.length/3;return T(e,(e,n)=>u(e,t[n*3+0],t[n*3+1],t[n*3+2]),n?r-1:r)}const ie=.99619469809,D=f(),O=f(),k=f(),A=f(),j=f();function ae(e,t,n){return t!==e&&y(e,t),e[3]=-r(b(e),n),e}function oe(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function se(e,t,n,r){return s(k,t,e),C(n,k,r)}function M(e,t,n,r){return Y(X(e,t,o(g.get(),n,t),ue,r))}function N(e,t,n){return t!=null&&Y(X(e,t.origin,t.direction,de,n))}function P(e,t,n){return Y(X(e,t.origin,t.vector,0,n))}function F(e,t,n){return Y(X(e,t.origin,t.vector,1,n))}function I(e,t){return q(e,t)<=0}function L(e,t){return q(e,t)>=0}function R(e,t){return V(e,t.ray.origin,t.ray.direction,t,!1,!1,!0,1e-6)}function z(e,t){return V(e,t.ray.origin,t.ray.direction,t,!1,!1,!1,1e-6)}function B(e,t){return t.c0<=t.c1&&V(e,t.ray.origin,t.ray.direction,t,!1,!0,!1,0)}function V(e,t,n,i,a,o,s,c){let l=r(b(e),n),u=q(e,t);if(l>=-c&&l<=c)return H(u,a,o);let d=-u/l,f=H(l,a,!1);return s&&!f&&!H(u,a,o)?!1:(f?d>i.c0&&(i.c0=d):d<i.c1&&(i.c1=d),i.c0<=i.c1)}function H(e,t,n){return n?t?e>=0:e<=0:t?e>0:e<0}function U(e,r,i,a=!1){let o=r.at(-1),s=q(e,o),c=a?s>0:s<=0;for(let l=0;l<r.length;l++){let u=r.at(l),d=q(e,u),f=a?d>0:d<=0;c!==f&&t(i(),o,u,s/(s-d)),f&&n(i(),u),o=u,s=d,c=f}}function W(e,t,n,r,i,a=!1){return o(Q,n,t),$.c0=0,$.c1=1,V(e,t,Q,$,a,!a,!1,1e-6)?(d(r,t,Q,$.c0),d(i,t,Q,$.c1),!0):!1}function G(e,t,n){let r=a(g.get(),b(e),-e[3]),s=K(e,o(g.get(),t,r),g.get());return i(n,s,r),n}function ce(e,t,n,r){let i=b(e),a=g.get(),s=g.get();ee(i,a,s);let c=o(g.get(),n,t),l=h(a,c),d=h(s,c),f=h(i,c);return u(r,l,d,f)}function K(e,t,n){let i=a(g.get(),b(e),r(b(e),t));return o(n,t,i),n}function le(e,t){return Math.abs(q(e,t))}function q(e,t){return r(b(e),t)+e[3]}function J(e,t,n){for(let r=0;r<n;++r)if(I(e,t[r]))return!1;return!0}function Y(e){return e===0||e===1}function X(t,n,o,s,c){let l=r(b(t),o),u=q(t,n);if(l===0)return u>=0?2:3;let d=-u/l;return s&1&&(d=e(d,0,1)),!(s&4)&&d<0||!(s&8)&&d>1?u>=0?2:3:(i(c,n,a(c,o,d)),u>=0?0:1)}const Z=[0,0,1,0],ue=12,de=8,Q=f(),$={c0:0,c1:1};export{J as areAllPointsOutside,R as clip,B as clipClosedNegativeHalfspace,z as clipInfinite,W as clipLineSegment,U as clipPolygon,y as copy,v as create,le as distance,ne as equals,te as exactEquals,E as fromArray,T as fromManyPoints,S as fromNormalAndOffset,w as fromPoints,C as fromPositionAndNormal,x as fromValues,se as fromVectorsAndPoint,b as getNormal,M as intersectLine,X as intersectLineOrRay,P as intersectLineSegment,F as intersectLineSegmentClamp,N as intersectRay,L as isPointInClosedPositiveHalfspace,I as isPointInside,oe as negate,G as projectPoint,ce as projectPointLocal,K as projectVector,ae as setOffsetFromPoint,q as signedDistance,Z as up,re as wrap};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{deg2rad as e}from"../../core/mathUtils.js";import{getMetersPerUnitForSR as t,getMetersPerVerticalUnitForSR as n}from"../../core/units.js";import{set as r}from"../../core/libs/gl-matrix-2/math/vec3.js";import{
|
|
2
|
+
import{deg2rad as e}from"../../core/mathUtils.js";import{getMetersPerUnitForSR as t,getMetersPerVerticalUnitForSR as n}from"../../core/units.js";import{set as r}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as i,getNormal as a,fromManyPoints as o}from"./plane.js";function s(t,n,r){let i=c(l,t,n,r)?a(l):[0,0,1];return Math.abs(i[2])>Math.cos(e(80))?2:+(Math.abs(i[1])>Math.abs(i[0]))}function c(e,i,a,s){let c=(e=>!Array.isArray(e[0]))(i)?(e,t)=>i[e*3+t]:(e,t)=>i[e][t],l=t(s)/n(s);return o(e,(e,t)=>r(e,c(t,0)*l,c(t,1)*l,c(t,2)),a)}const l=i();export{c as fitPlane,s as leastSignificantAxis};
|
package/interfaces.d.ts
CHANGED
|
@@ -2297,9 +2297,6 @@ declare namespace __esri {
|
|
|
2297
2297
|
export type Mesh = import("./geometry/Mesh.js").default;
|
|
2298
2298
|
export const Mesh: typeof import("./geometry/Mesh.js").default;
|
|
2299
2299
|
|
|
2300
|
-
/** @deprecated since 5.0. Refactor using \@arcgis/codemod */
|
|
2301
|
-
export type MeshCreateFromPolygonParameters = import("./geometry/Mesh.js").CreateFromPolygonParameters;
|
|
2302
|
-
|
|
2303
2300
|
/** @deprecated since 5.0. Refactor using \@arcgis/codemod */
|
|
2304
2301
|
export type MultipointProperties = import("./geometry/Multipoint.js").MultipointProperties;
|
|
2305
2302
|
|
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=`5.2`;let n=`5.2`;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=`5.2`;let n=`5.2`;n=`6.0.0-next.31`;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/SceneLayer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../Graphic.js";import n from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import i from"../core/Collection.js";import a from"../core/Error.js";import{abortHandle as o}from"../core/handleUtils.js";import s from"../core/Logger.js";import{destroyMaybe as c}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as u,throwIfAborted as d,isAbortError as f,throwIfNotAbortError as p}from"../core/promiseUtils.js";import{whenOnce as m}from"../core/reactiveUtils.js";import{property as h,subclass as g}from"../core/accessorSupport/decorators.js";import{getProperties as _}from"../core/accessorSupport/utils.js";import v from"../geometry/Point.js";import{projectAsync as y}from"../geometry/projectionUtils.js";import b from"../graphic/SceneGraphicOrigin.js";import x from"./Layer.js";import{NoModelError as ee,MultipleModelsError as S}from"./graphics/sources/support/uploadAssetErrors.js";import{APIKeyMixin as C}from"./mixins/APIKeyMixin.js";import{ArcGISService as w}from"./mixins/ArcGISService.js";import{CustomParametersMixin as te}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as ne}from"./mixins/EditBusLayer.js";import{OperationalLayer as re}from"./mixins/OperationalLayer.js";import{PortalLayer as ie}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as ae}from"./mixins/ScaleRangeLayer.js";import{SceneService as oe}from"./mixins/SceneService.js";import{useViewTimeProperty as se}from"./mixins/TemporalLayer.js";import{isHostedAgolService as T}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as ce}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as le}from"./support/capabilities.js";import{elevationInfo as E,labelsVisible as D,legendEnabled as O,popupEnabled as k,attributeTableTemplate as A,screenSizePerspectiveEnabled as j,timeInfo as M}from"./support/commonProperties.js";import{getFieldDomain as N,computeEffectiveEditingEnabled as P,getGlobalIdToObjectIdMap as F}from"./support/featureLayerUtils.js";import I from"./support/FeatureReductionSelection.js";import{defineFieldProperties as L}from"./support/fieldProperties.js";import R from"./support/FieldsIndex.js";import{fixRendererFields as z,fixTimeInfoFields as B,unpackFieldNames as V}from"./support/fieldUtils.js";import{I3SNodePageDefinition as H,I3SMaterialDefinition as U,I3STextureSetDefinition as W,I3SGeometryDefinition as ue}from"./support/I3SLayerDefinitions.js";import{isFileEditFormat as de,isFileSupported as fe}from"./support/infoFor3D.js";import pe from"./support/LabelClass.js";import{reader as G}from"./support/labelingInfo.js";import me from"./support/LayerFloorInfo.js";import{layersLoaderMap as he}from"./support/layersLoader.js";import{getMeshTransformForMetersToSpatialReference as ge}from"./support/meshSpatialReferenceScaleUtils.js";import{RangeInfo as _e}from"./support/RangeInfo.js";import ve from"./support/SceneFilter.js";import{cacheIsOutOfSync as K}from"./support/sceneLayerCacheUtils.js";import{fetchStatistics as ye}from"./support/sceneLayerStatistics.js";import{SceneServiceTimeInfo as be}from"./support/SceneServiceTimeInfo.js";import xe from"./support/TimeInfo.js";import{loadStyleRenderer as Se}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Ce}from"../renderers/support/typeUtils.js";import we from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as q,elevationModeUnsupportedMessage as Te,featureExpressionUnsupportedMessage as Ee}from"../support/elevationInfoUtils.js";import{createPopupTemplate as De}from"../support/popupUtils.js";import{extractZipFiles as Oe}from"../support/zipUtils.js";import J from"../time/TimeExtent.js";import ke from"../time/TimeInterval.js";import{queryAttributesFromCachedAttributesId as Ae}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as je,getFetchPopupTemplate as Me}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as Ne}from"../webdoc/support/opacityUtils.js";import{reader as Y}from"../core/accessorSupport/decorators/reader.js";const X=new Set([`3DObject`,`Point`]),Z=L();let Q=class extends ne(oe(w(re(ie(ae(l(te(C(r(x)))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType=`ArcGISSceneServiceLayer`,this.type=`scene`,this.fields=null,this.graphicOrigin=new b(this),this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new i,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.attributeTableTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0,this.serviceTimeInfo=null}normalizeCtorArgs(e,t){return typeof e==`string`?{url:e,...t}:e}destroy(){this._set(`renderer`,null),this.associatedLayer=c(this.associatedLayer)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){let n=this.getField(e)?.domain??null;return this.associatedLayer?N(this.associatedLayer,e,t,n):n}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new R(this.fields)}readNodePages(e,t,n){return t.layerType===`Point`&&(e=t.pointNodePages),typeof e!=`object`||!e?null:H.fromJSON(e,n)}set elevationInfo(e){this._set(`elevationInfo`,e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return this.associatedLayer!=null&&P(this.associatedLayer)}get geometryType(){return Pe[this.profile]||`mesh`}set renderer(e){z(e,this.fieldsIndex),this._set(`renderer`,e)}readCachedDrawingInfo(e){return typeof e==`object`&&e||(e={}),e.color??(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e??=le;let{query:t,queryRelated:n,editing:{supportsGlobalId:r,supportsRollbackOnFailure:i,supportsUploadWithItemId:a,supportsGeometryUpdate:o,supportsReturnServiceEditsInSourceSpatialReference:s},data:{supportsZ:c,supportsM:l,isVersioned:u,supportsAttachment:d},operations:{supportsEditing:f,supportsAdd:p,supportsUpdate:m,supportsDelete:h,supportsQuery:g,supportsQueryAttachments:_,supportsAsyncConvert3D:v},attachment:y}=e,b=e.operations.supportsChangeTracking,x=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:n,editing:{supportsGlobalId:r,supportsReturnServiceEditsInSourceSpatialReference:s,supportsRollbackOnFailure:i,supportsGeometryUpdate:x&&o,supportsUploadWithItemId:a},data:{supportsAttachment:d,supportsZ:c,supportsM:l,isVersioned:u,queryFormats:e.data.queryFormats,sourceFormats:e.data.sourceFormats},operations:{supportsQuery:g,supportsQueryAttachments:_,supportsEditing:f&&b,supportsAdd:x&&p&&b,supportsDelete:x&&h&&b,supportsUpdate:m&&b,supportsAsyncConvert3D:v},attachment:y}}get editingEnabled(){return this._isOverridden(`editingEnabled`)?this._get(`editingEnabled`):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome(`editingEnabled`,e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some(t=>(t.type===`esriFieldTypeOID`&&(e=t.name),!!e)),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some(t=>(t.type===`esriFieldTypeGlobalID`&&(e=t.name),!!e)),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){let n=t.store.profile;return n!=null&&$[n]?$[n]:(s.getLogger(this).error(`Unknown or missing profile`,{profile:n,layer:this}),`mesh-pyramids`)}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override(`useViewTime`,e)}get timeInfo(){let e=this.associatedLayer?.timeInfo;if(e==null)return null;let t=e.clone();return B(t,this.fieldsIndex),t}set timeInfo(e){B(e,this.fieldsIndex),this._override(`timeInfo`,e)}get timeExtent(){return this.associatedLayer?.timeExtent}set timeExtent(e){this._override(`timeExtent`,e)}get timeOffset(){return this.associatedLayer?.timeOffset}set timeOffset(e){this._override(`timeOffset`,e)}get datesInUnknownTimezone(){return this.associatedLayer?.datesInUnknownTimezone??!1}set datesInUnknownTimezone(e){this._override(`datesInUnknownTimezone`,e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){let t=e?.signal;await this.loadFromPortal({supportedTypes:[`Scene Service`]},e).catch(u),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await Se(this,{origin:`service`},t),z(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){this.filter!=null&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){s.getLogger(this).error(`#_loadFilterGeometries()`,this,`Failed to load filter geometries. Geometry filter will not be applied for this layer.`,{error:e}),this.filter=null}}createQuery(){let e=new we;this.geometryType===`mesh`?this.capabilities.query.supportsReturnMesh&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0);let{timeOffset:t,timeExtent:n}=this;return e.timeExtent=t!=null&&n!=null?n.offset(-t.value,t.unit):n||null,e.where=this.definitionExpression||`1=1`,e.sqlFormat=`standard`,e.outFields=[`*`],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryExtent(e||this.createQuery(),t))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryFeatureCount(e||this.createQuery(),t))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryFeatures(e||this.createQuery(),t)).then(e=>{if(e?.features)for(let t of e.features)t.layer=this,t.sourceLayer=this,t.origin=this.graphicOrigin;return e})}async queryModels(e,t){let[n,{queryModels:r}]=await Promise.all([this._getAssociatedLayerForQuery(),import(`./scene/modelQuerySupport.js`)]);return r(this,n,e,t)}async queryModel(e,t){let[n,{queryModel:r}]=await Promise.all([this._getAssociatedLayerForQuery(),import(`./scene/modelQuerySupport.js`)]);return r(this,n,e,t)}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){let n=V(this.fieldsIndex,await je(this,Me(this)));return Ae(this.parsedUrl?.path??``,this.attributeStorageInfo??[],e,t,n,this.apiKey,this.customParameters)}async queryCachedFeature(e,n){let r=await this.queryCachedAttributes(e,[n]);if(!r||r.length===0)throw new a(`scenelayer:feature-not-in-cached-data`,`Feature not found in cached data`);let i=new t;return i.attributes=r[0],i.layer=this,i.sourceLayer=this,i.origin=this.graphicOrigin,i}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryObjectIds(e||this.createQuery(),t))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryAttachments(e,t))}getFieldUsageInfo(e){let t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(s.getLogger(this).error(`#getFieldUsageInfo()`,`Unavailable until layer is loaded`),t)}createPopupTemplate(e){return De(this,e)}_getAssociatedLayerForQuery(){let e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});try{await this.associatedLayer.load()}catch(e){throw new a(`scenelayer:query-not-available`,`SceneLayer associated feature layer could not be loaded`,{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return this.statisticsInfo!=null&&this.statisticsInfo.some(t=>t.name===e)}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(1,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:`scene`},e)}async save(){return this._debouncedSaveOperations(0,{getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:`scene`})}async applyEdits(e,t){let{applyEdits:n}=await import(`./graphics/editingSupport.js`),r=t;await this.load();let i=this.associatedLayer;if(!i)throw new a(`${this.type}-layer:not-editable`,`Service is not editable`);await i.load();let{globalIdField:o}=i,s=!!i.infoFor3D,c=r?.globalIdUsed??!0;if(s&&o==null)throw new a(`${this.type}-layer:not-editable`,`Valid globalIdField expected on editable SceneLayer`);if(s&&!c)throw new a(`${this.type}-layer:globalid-required`,`globalIdUsed must not be false for SceneLayer editing as globalIds are required.`);return T(i.url)&&s&&e.deleteFeatures!=null&&o!=null&&(r={...r,globalIdToObjectId:await F(i,e.deleteFeatures,o)}),n(this,i.source,e,r)}async uploadAssets(e,t){if(await this.load(),this.associatedLayer==null)throw new a(`${this.type}-layer:not-editable`,`Service is not editable`);return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}async convertMesh(e,t){t??={};let n=e=>{throw s.getLogger(this).error(`.convertMesh()`,e.message),e};await this.load(t),this.infoFor3D||n(new a(`invalid:layer`,`SceneLayer has no capability for mesh conversion`));let r=await this.extractAndFilterFiles(e);d(t);let i=r.reduce((e,t)=>de(this.infoFor3D,t)?e+1:e,0);i===0&&n(new ee),i>1&&n(new S);let o=this.spatialReference,c=t.origin,l=await y(c??t.defaultOrigin??new v({x:0,y:0,z:0,spatialReference:o}),o,t),u=o.isGeographic?`local`:`georeferenced`,{createWithExternalSource:f}=await import(`../geometry/support/meshUtils.js`);d(t);let p=f(l,{type:`client`,files:r},{vertexSpace:u,transform:ge(o),unitConversionDisabled:!0}),[m]=await this.uploadAssets([p],{...t,useAssetOrigin:!c});return m}async extractAndFilterFiles(e){await this.load();let t=this.infoFor3D;return t?(await Oe(e)).filter(e=>fe(t,e)):e}validateLayer(e){if(e.layerType&&!X.has(e.layerType))throw new a(`scenelayer:layer-type-not-supported`,`SceneLayer does not support this layer type`,{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new a(`layer:service-version-not-supported`,`Service version is not supported.`,{serviceVersion:this.version.versionString,supportedVersions:`1.x, 2.x`});if(this.version.major>2)throw new a(`layer:service-version-too-new`,`Service version is too new.`,{serviceVersion:this.version.versionString,supportedVersions:`1.x, 2.x`});t(this.normalReferenceFrame,this.spatialReference);function t(e,t){let n=!1,r=!1;if(e==null)n=!0,r=!0;else{let i=t&&t.isGeographic;switch(e){case`east-north-up`:case`earth-centered`:n=!0,r=i;break;case`vertex-reference-frame`:n=!0,r=!i;break;default:n=!1}}if(!n)throw new a(`scenelayer:unsupported-normal-reference-frame`,`Normal reference frame is invalid.`);if(!r)throw new a(`scenelayer:incompatible-normal-reference-frame`,`Normal reference frame is incompatible with layer spatial reference.`)}}get isUsedAsGroundLayer(){return!1}_getTypeKeywords(){let e=[];if(this.profile===`points`)e.push(`Point`);else if(this.profile===`mesh-pyramids`)e.push(`3DObject`);else throw new a(`scenelayer:unknown-profile`,`SceneLayer:save() encountered an unknown SceneLayer profile: `+this.profile);return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(let e of this.fields){let t=!!this.attributeStorageInfo?.some(t=>t.name===e.name),n=!!this.associatedLayer?.fields?.some(t=>t&&e.name===t.name),r={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||n,supportsLayerQuery:n};this._fieldUsageInfo[e.name]=r}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPropertyOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(let t of this.associatedLayer.fields){let n=this.getField(t.name);n?(!n.domain&&t.domain&&(n.domain=t.domain.clone()),n.editable=t.editable,n.nullable=t.nullable,n.length=t.length):(e||=this.fields?this.fields.slice():[],e.push(t.clone()))}e&&this._set(`fields`,e)}_applyAssociatedLayerPropertyOverrides(){if(!this.associatedLayer)return;let e=[`popupTemplate`,`popupEnabled`,`attributeTableTemplate`],t=_(this);for(let n=0;n<e.length;n++){let r=e[n],i=this.originIdOf(r),a=this.associatedLayer.originIdOf(r);i<a&&(a===2||a===3)&&t.setAtOrigin(r,this.associatedLayer[r],a)}}_applyAssociatedLayerExtentOverride(){let e=this.associatedLayer?.getAtOrigin(`fullExtent`,`service`);this.associatedLayer?.infoFor3D!=null&&e&&T(this.associatedLayer?.url)&&K(this)&&_(this).setAtOrigin(`fullExtent`,e.clone(),2)}_applyAssociatedLayerPrivileges(){let e=this.associatedLayer;e&&(this._set(`userHasEditingPrivileges`,e.userHasEditingPrivileges),this._set(`userHasFullEditingPrivileges`,e.userHasFullEditingPrivileges),this._set(`userHasUpdateItemPrivileges`,e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if([`mesh-pyramids`,`points`].includes(this.profile))try{let{serverUrl:t,layerId:n,portalItem:r}=await ce(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),i=await he.FeatureLayer();this.associatedLayer=new i({url:t,customParameters:this.customParameters,apiKey:this.apiKey,layerId:n,portalItem:r}),await this.associatedLayer.load()}catch(e){f(e)||this._logWarningOnPopupEnabled().catch(()=>{})}}async _logWarningOnPopupEnabled(){let e=new AbortController;this.addHandles(o(e));try{await m(()=>this.popupEnabled&&this.popupTemplate!=null,e.signal)}catch(e){p(e);return}let t=`this SceneLayer: ${this.title}`;this.attributeStorageInfo==null?s.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${t}`):s.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${t}`)}_validateElevationInfo(){let e=this.elevationInfo;this.profile===`mesh-pyramids`&&q(s.getLogger(this),Te(`Mesh scene layers`,`relative-to-scene`,e)),q(s.getLogger(this),Ee(`Scene layers`,e))}async fetchStatistics(e,t){return await ye({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:`scenelayer`,fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??``,customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}async loadTimeInfoFromService(e){let{serviceTimeInfo:t}=this;if(t==null)return;let{startTimeField:n,endTimeField:r}=t;if(n==null&&r==null||K({associatedLayer:this.associatedLayer,serviceUpdateTimeStamp:this.serviceUpdateTimeStamp}))return;let i=async t=>{let r=null;try{r=(await this.fetchStatistics(t,e))?.stats}catch{}if(r==null)return null;let{minTimeStr:i,min:a,maxTimeStr:o,max:s}=r,c=t===n?i??a:o??s;return c==null?null:new Date(c)},[a,o]=await Promise.all([i(n),i(r)]);if(n!=null&&a==null||r!=null&&o==null)return;let s=new J({start:a,end:o});this.setAtOrigin(`timeInfo`,new xe({endField:r,startField:n,fullTimeExtent:s}),`service`)}};e([h({types:{key:`type`,base:null,typeMap:{selection:I}},json:{origins:{"web-scene":{name:`layerDefinition.featureReduction`,write:{allowNull:!0}},"portal-item":{name:`layerDefinition.featureReduction`,write:{allowNull:!0}}}}})],Q.prototype,`featureReduction`,void 0),e([h({type:[_e],json:{read:!1,origins:{"web-scene":{name:`layerDefinition.rangeInfos`,write:!0},"portal-item":{name:`layerDefinition.rangeInfos`,write:!0}}},clonable:!1})],Q.prototype,`rangeInfos`,void 0),e([h({json:{read:!1}})],Q.prototype,`associatedLayer`,void 0),e([h({type:[`show`,`hide`]})],Q.prototype,`listMode`,void 0),e([h({type:[`ArcGISSceneServiceLayer`]})],Q.prototype,`operationalLayerType`,void 0),e([h({json:{read:!1},readOnly:!0})],Q.prototype,`type`,void 0),e([h({...Z.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`fields`,void 0),e([h()],Q.prototype,`types`,null),e([h()],Q.prototype,`typeIdField`,null),e([h()],Q.prototype,`templates`,null),e([h()],Q.prototype,`formTemplate`,null),e([h({readOnly:!0})],Q.prototype,`graphicOrigin`,void 0),e([h({readOnly:!0,clonable:!1})],Q.prototype,`fieldsIndex`,null),e([h({type:me,json:{read:{source:`layerDefinition.floorInfo`},write:{target:`layerDefinition.floorInfo`}}})],Q.prototype,`floorInfo`,void 0),e([h(Z.outFields)],Q.prototype,`outFields`,void 0),e([h({type:H,readOnly:!0,json:{read:!1},clonable:!1})],Q.prototype,`nodePages`,void 0),e([Y(`service`,`nodePages`,[`nodePages`,`pointNodePages`])],Q.prototype,`readNodePages`,null),e([h({type:[U],readOnly:!0,clonable:!1})],Q.prototype,`materialDefinitions`,void 0),e([h({type:[W],readOnly:!0,clonable:!1})],Q.prototype,`textureSetDefinitions`,void 0),e([h({type:[ue],readOnly:!0,clonable:!1})],Q.prototype,`geometryDefinitions`,void 0),e([h({readOnly:!0})],Q.prototype,`serviceUpdateTimeStamp`,void 0),e([h({readOnly:!0})],Q.prototype,`attributeStorageInfo`,void 0),e([h({readOnly:!0})],Q.prototype,`statisticsInfo`,void 0),e([h({type:i.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:`layerDefinition.excludeObjectIds`,write:{enabled:!0}}})],Q.prototype,`excludeObjectIds`,void 0),e([h({type:String,json:{origins:{service:{read:!1,write:!1}},name:`layerDefinition.definitionExpression`,write:{enabled:!0,allowNull:!0}}})],Q.prototype,`definitionExpression`,void 0),e([h({type:ve,json:{name:`layerDefinition.polygonFilter`,write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],Q.prototype,`filter`,void 0),e([h({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Q.prototype,`path`,void 0),e([h(E)],Q.prototype,`elevationInfo`,null),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`effectiveCapabilities`,null),e([h({readOnly:!0})],Q.prototype,`effectiveEditingEnabled`,null),e([h({type:String})],Q.prototype,`geometryType`,null),e([h(D)],Q.prototype,`labelsVisible`,void 0),e([h({type:[pe],json:{origins:{service:{name:`drawingInfo.labelingInfo`,read:{reader:G},write:!1}},name:`layerDefinition.drawingInfo.labelingInfo`,read:{reader:G},write:!0}})],Q.prototype,`labelingInfo`,void 0),e([h(O)],Q.prototype,`legendEnabled`,void 0),e([h({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:[`opacity`,`layerDefinition.drawingInfo.transparency`],reader(e,t){if(typeof e==`number`&&e>=0&&e<=1)return e;let n=t.layerDefinition?.drawingInfo?.transparency;return n===void 0?void 0:Ne(n)}}},"portal-item":{write:!0},service:{read:!1}}}})],Q.prototype,`opacity`,void 0),e([h({type:[`Low`,`High`],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`priority`,void 0),e([h({type:[`Labels`],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`semantic`,void 0),e([h({types:Ce,json:{origins:{service:{read:{source:`drawingInfo.renderer`}}},name:`layerDefinition.drawingInfo.renderer`,write:!0},value:null})],Q.prototype,`renderer`,null),e([h({json:{read:!1}})],Q.prototype,`cachedDrawingInfo`,void 0),e([Y(`service`,`cachedDrawingInfo`)],Q.prototype,`readCachedDrawingInfo`,null),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`capabilities`,null),e([h({type:Boolean,json:{read:!1}})],Q.prototype,`editingEnabled`,null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Q.prototype,`infoFor3D`,null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Q.prototype,`relationships`,null),e([h(k)],Q.prototype,`popupEnabled`,void 0),e([h({type:n,json:{name:`popupInfo`,write:!0}})],Q.prototype,`popupTemplate`,void 0),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`defaultPopupTemplate`,null),e([h(A)],Q.prototype,`attributeTableTemplate`,void 0),e([h({type:String,json:{read:!1}})],Q.prototype,`objectIdField`,void 0),e([Y(`service`,`objectIdField`,[`objectIdField`,`fields`])],Q.prototype,`readObjectIdField`,null),e([h({type:String,json:{read:!1}})],Q.prototype,`globalIdField`,void 0),e([Y(`service`,`globalIdField`,[`globalIdField`,`fields`])],Q.prototype,`readGlobalIdField`,null),e([h({readOnly:!0,type:String,json:{read:!1}})],Q.prototype,`displayField`,null),e([h({type:String,json:{read:!1}})],Q.prototype,`profile`,void 0),e([Y(`service`,`profile`,[`store.profile`])],Q.prototype,`readProfile`,null),e([h({readOnly:!0,type:String,json:{origins:{service:{read:{source:`store.normalReferenceFrame`}}},read:!1}})],Q.prototype,`normalReferenceFrame`,void 0),e([h(j)],Q.prototype,`screenSizePerspectiveEnabled`,void 0),e([h({json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`serviceItemId`,void 0),e([h(se)],Q.prototype,`useViewTime`,null),e([h(M({disableServiceOrigin:!0,webDocumentOrigin:`web-scene`}))],Q.prototype,`timeInfo`,null),e([h({type:J,json:{read:!1,write:!1}})],Q.prototype,`timeExtent`,null),e([h({type:ke,json:{read:!1,write:!1}})],Q.prototype,`timeOffset`,null),e([h({type:Boolean,nonNullable:!0,json:{read:!1,write:!1}})],Q.prototype,`datesInUnknownTimezone`,null),e([h({type:be,readOnly:!0,json:{read:{source:`timeInfo`}},clonable:!1})],Q.prototype,`serviceTimeInfo`,void 0),e([h()],Q.prototype,`isUsedAsGroundLayer`,null),Q=e([g(`esri.layers.SceneLayer`)],Q);const $={"mesh-pyramids":`mesh-pyramids`,meshpyramids:`mesh-pyramids`,"features-meshes":`mesh-pyramids`,points:`points`,"features-points":`points`,lines:`lines`,"features-lines":`lines`,polygons:`polygons`,"features-polygons":`polygons`},Pe={"mesh-pyramids":`mesh`,points:`point`},Fe=Q;export{Fe as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../Graphic.js";import n from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import i from"../core/Collection.js";import a from"../core/Error.js";import{abortHandle as o}from"../core/handleUtils.js";import s from"../core/Logger.js";import{destroyMaybe as c}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as u,throwIfAborted as d,isAbortError as f,throwIfNotAbortError as p}from"../core/promiseUtils.js";import{whenOnce as m}from"../core/reactiveUtils.js";import{property as h,subclass as g}from"../core/accessorSupport/decorators.js";import{getProperties as _}from"../core/accessorSupport/utils.js";import v from"../geometry/Point.js";import{projectAsync as y}from"../geometry/projectionUtils.js";import b from"../graphic/SceneGraphicOrigin.js";import x from"./Layer.js";import{NoModelError as ee,MultipleModelsError as S}from"./graphics/sources/support/uploadAssetErrors.js";import{APIKeyMixin as C}from"./mixins/APIKeyMixin.js";import{ArcGISService as w}from"./mixins/ArcGISService.js";import{CustomParametersMixin as te}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as ne}from"./mixins/EditBusLayer.js";import{OperationalLayer as re}from"./mixins/OperationalLayer.js";import{PortalLayer as ie}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as ae}from"./mixins/ScaleRangeLayer.js";import{SceneService as oe}from"./mixins/SceneService.js";import{useViewTimeProperty as se}from"./mixins/TemporalLayer.js";import{isHostedAgolService as T}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as ce}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as le}from"./support/capabilities.js";import{elevationInfo as E,labelsVisible as D,legendEnabled as O,popupEnabled as k,attributeTableTemplate as A,screenSizePerspectiveEnabled as j,timeInfo as M}from"./support/commonProperties.js";import{getFieldDomain as N,computeEffectiveEditingEnabled as P,getGlobalIdToObjectIdMap as F}from"./support/featureLayerUtils.js";import I from"./support/FeatureReductionSelection.js";import{defineFieldProperties as L}from"./support/fieldProperties.js";import R from"./support/FieldsIndex.js";import{fixRendererFields as z,fixTimeInfoFields as B,unpackFieldNames as V}from"./support/fieldUtils.js";import{I3SNodePageDefinition as H,I3SMaterialDefinition as U,I3STextureSetDefinition as W,I3SGeometryDefinition as ue}from"./support/I3SLayerDefinitions.js";import{isFileEditFormat as de,isFileSupported as fe}from"./support/infoFor3D.js";import pe from"./support/LabelClass.js";import{reader as G}from"./support/labelingInfo.js";import me from"./support/LayerFloorInfo.js";import{layersLoaderMap as he}from"./support/layersLoader.js";import{getMeshTransformForMetersToSpatialReference as ge}from"./support/meshSpatialReferenceScaleUtils.js";import{RangeInfo as _e}from"./support/RangeInfo.js";import ve from"./support/SceneFilter.js";import{cacheIsOutOfSync as K}from"./support/sceneLayerCacheUtils.js";import{fetchStatistics as ye}from"./support/sceneLayerStatistics.js";import{SceneServiceTimeInfo as be}from"./support/SceneServiceTimeInfo.js";import xe from"./support/TimeInfo.js";import{loadStyleRenderer as Se}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Ce}from"../renderers/support/typeUtils.js";import we from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as q,elevationModeUnsupportedMessage as Te,featureExpressionUnsupportedMessage as Ee}from"../support/elevationInfoUtils.js";import{createPopupTemplate as De}from"../support/popupUtils.js";import{extractZipFiles as Oe}from"../support/zipUtils.js";import J from"../time/TimeExtent.js";import ke from"../time/TimeInterval.js";import{queryAttributesFromCachedAttributesId as Ae}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as je,getFetchPopupTemplate as Me}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as Ne}from"../webdoc/support/opacityUtils.js";import{reader as Y}from"../core/accessorSupport/decorators/reader.js";const X=new Set([`3DObject`,`Point`]),Z=L();let Q=class extends ne(oe(w(re(ie(ae(l(te(C(r(x)))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType=`ArcGISSceneServiceLayer`,this.type=`scene`,this.fields=null,this.graphicOrigin=new b(this),this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new i,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.attributeTableTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0,this.serviceTimeInfo=null}normalizeCtorArgs(e,t){return typeof e==`string`?{url:e,...t}:e}destroy(){this._set(`renderer`,null),this.associatedLayer=c(this.associatedLayer)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){let n=this.getField(e)?.domain??null;return this.associatedLayer?N(this.associatedLayer,e,t,n):n}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new R(this.fields)}readNodePages(e,t,n){return t.layerType===`Point`&&(e=t.pointNodePages),typeof e!=`object`||!e?null:H.fromJSON(e,n)}set elevationInfo(e){this._set(`elevationInfo`,e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return this.associatedLayer!=null&&P(this.associatedLayer)}get geometryType(){return Pe[this.profile]||`mesh`}set renderer(e){z(e,this.fieldsIndex),this._set(`renderer`,e)}readCachedDrawingInfo(e){return typeof e==`object`&&e||(e={}),e.color??(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e??=le;let{query:t,queryRelated:n,editing:{supportsGlobalId:r,supportsRollbackOnFailure:i,supportsUploadWithItemId:a,supportsGeometryUpdate:o,supportsReturnServiceEditsInSourceSpatialReference:s},data:{supportsZ:c,supportsM:l,isVersioned:u,supportsAttachment:d},operations:{supportsEditing:f,supportsAdd:p,supportsUpdate:m,supportsDelete:h,supportsQuery:g,supportsQueryAttachments:_,supportsAsyncConvert3D:v},attachment:y}=e,b=e.operations.supportsChangeTracking,x=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:n,editing:{supportsGlobalId:r,supportsReturnServiceEditsInSourceSpatialReference:s,supportsRollbackOnFailure:i,supportsGeometryUpdate:x&&o,supportsUploadWithItemId:a},data:{supportsAttachment:d,supportsZ:c,supportsM:l,isVersioned:u,queryFormats:e.data.queryFormats,sourceFormats:e.data.sourceFormats},operations:{supportsQuery:g,supportsQueryAttachments:_,supportsEditing:f&&b,supportsAdd:x&&p&&b,supportsDelete:x&&h&&b,supportsUpdate:m&&b,supportsAsyncConvert3D:v},attachment:y}}get editingEnabled(){return this._isOverridden(`editingEnabled`)?this._get(`editingEnabled`):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome(`editingEnabled`,e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some(t=>(t.type===`esriFieldTypeOID`&&(e=t.name),!!e)),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some(t=>(t.type===`esriFieldTypeGlobalID`&&(e=t.name),!!e)),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){let n=t.store.profile;return n!=null&&$[n]?$[n]:(s.getLogger(this).error(`Unknown or missing profile`,{profile:n,layer:this}),`mesh-pyramids`)}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override(`useViewTime`,e)}get timeInfo(){let e=this.associatedLayer?.timeInfo;if(e==null)return null;let t=e.clone();return B(t,this.fieldsIndex),t}set timeInfo(e){B(e,this.fieldsIndex),this._override(`timeInfo`,e),this.associatedLayer&&(this.associatedLayer.timeInfo=e)}get timeExtent(){return this.associatedLayer?.timeExtent}set timeExtent(e){this._override(`timeExtent`,e)}get timeOffset(){return this.associatedLayer?.timeOffset}set timeOffset(e){this._override(`timeOffset`,e)}get datesInUnknownTimezone(){return this.associatedLayer?.datesInUnknownTimezone??!1}set datesInUnknownTimezone(e){this._override(`datesInUnknownTimezone`,e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){let t=e?.signal;await this.loadFromPortal({supportedTypes:[`Scene Service`]},e).catch(u),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await Se(this,{origin:`service`},t),z(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){this.filter!=null&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){s.getLogger(this).error(`#_loadFilterGeometries()`,this,`Failed to load filter geometries. Geometry filter will not be applied for this layer.`,{error:e}),this.filter=null}}createQuery(){let e=new we;this.geometryType===`mesh`?this.capabilities.query.supportsReturnMesh&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0);let{timeOffset:t,timeExtent:n}=this;return e.timeExtent=t!=null&&n!=null?n.offset(-t.value,t.unit):n||null,e.where=this.definitionExpression||`1=1`,e.sqlFormat=`standard`,e.outFields=[`*`],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryExtent(e||this.createQuery(),t))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryFeatureCount(e||this.createQuery(),t))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryFeatures(e||this.createQuery(),t)).then(e=>{if(e?.features)for(let t of e.features)t.layer=this,t.sourceLayer=this,t.origin=this.graphicOrigin;return e})}async queryModels(e,t){let[n,{queryModels:r}]=await Promise.all([this._getAssociatedLayerForQuery(),import(`./scene/modelQuerySupport.js`)]);return r(this,n,e,t)}async queryModel(e,t){let[n,{queryModel:r}]=await Promise.all([this._getAssociatedLayerForQuery(),import(`./scene/modelQuerySupport.js`)]);return r(this,n,e,t)}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){let n=V(this.fieldsIndex,await je(this,Me(this)));return Ae(this.parsedUrl?.path??``,this.attributeStorageInfo??[],e,t,n,this.apiKey,this.customParameters)}async queryCachedFeature(e,n){let r=await this.queryCachedAttributes(e,[n]);if(!r||r.length===0)throw new a(`scenelayer:feature-not-in-cached-data`,`Feature not found in cached data`);let i=new t;return i.attributes=r[0],i.layer=this,i.sourceLayer=this,i.origin=this.graphicOrigin,i}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryObjectIds(e||this.createQuery(),t))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryAttachments(e,t))}getFieldUsageInfo(e){let t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(s.getLogger(this).error(`#getFieldUsageInfo()`,`Unavailable until layer is loaded`),t)}createPopupTemplate(e){return De(this,e)}_getAssociatedLayerForQuery(){let e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});try{await this.associatedLayer.load()}catch(e){throw new a(`scenelayer:query-not-available`,`SceneLayer associated feature layer could not be loaded`,{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return this.statisticsInfo!=null&&this.statisticsInfo.some(t=>t.name===e)}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(1,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:`scene`},e)}async save(){return this._debouncedSaveOperations(0,{getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:`scene`})}async applyEdits(e,t){let{applyEdits:n}=await import(`./graphics/editingSupport.js`),r=t;await this.load();let i=this.associatedLayer;if(!i)throw new a(`${this.type}-layer:not-editable`,`Service is not editable`);await i.load();let{globalIdField:o}=i,s=!!i.infoFor3D,c=r?.globalIdUsed??!0;if(s&&o==null)throw new a(`${this.type}-layer:not-editable`,`Valid globalIdField expected on editable SceneLayer`);if(s&&!c)throw new a(`${this.type}-layer:globalid-required`,`globalIdUsed must not be false for SceneLayer editing as globalIds are required.`);return T(i.url)&&s&&e.deleteFeatures!=null&&o!=null&&(r={...r,globalIdToObjectId:await F(i,e.deleteFeatures,o)}),n(this,i.source,e,r)}async uploadAssets(e,t){if(await this.load(),this.associatedLayer==null)throw new a(`${this.type}-layer:not-editable`,`Service is not editable`);return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}async convertMesh(e,t){t??={};let n=e=>{throw s.getLogger(this).error(`.convertMesh()`,e.message),e};await this.load(t),this.infoFor3D||n(new a(`invalid:layer`,`SceneLayer has no capability for mesh conversion`));let r=await this.extractAndFilterFiles(e);d(t);let i=r.reduce((e,t)=>de(this.infoFor3D,t)?e+1:e,0);i===0&&n(new ee),i>1&&n(new S);let o=this.spatialReference,c=t.origin,l=await y(c??t.defaultOrigin??new v({x:0,y:0,z:0,spatialReference:o}),o,t),u=o.isGeographic?`local`:`georeferenced`,{createWithExternalSource:f}=await import(`../geometry/support/meshUtils.js`);d(t);let p=f(l,{type:`client`,files:r},{vertexSpace:u,transform:ge(o),unitConversionDisabled:!0}),[m]=await this.uploadAssets([p],{...t,useAssetOrigin:!c});return m}async extractAndFilterFiles(e){await this.load();let t=this.infoFor3D;return t?(await Oe(e)).filter(e=>fe(t,e)):e}validateLayer(e){if(e.layerType&&!X.has(e.layerType))throw new a(`scenelayer:layer-type-not-supported`,`SceneLayer does not support this layer type`,{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new a(`layer:service-version-not-supported`,`Service version is not supported.`,{serviceVersion:this.version.versionString,supportedVersions:`1.x, 2.x`});if(this.version.major>2)throw new a(`layer:service-version-too-new`,`Service version is too new.`,{serviceVersion:this.version.versionString,supportedVersions:`1.x, 2.x`});t(this.normalReferenceFrame,this.spatialReference);function t(e,t){let n=!1,r=!1;if(e==null)n=!0,r=!0;else{let i=t&&t.isGeographic;switch(e){case`east-north-up`:case`earth-centered`:n=!0,r=i;break;case`vertex-reference-frame`:n=!0,r=!i;break;default:n=!1}}if(!n)throw new a(`scenelayer:unsupported-normal-reference-frame`,`Normal reference frame is invalid.`);if(!r)throw new a(`scenelayer:incompatible-normal-reference-frame`,`Normal reference frame is incompatible with layer spatial reference.`)}}get isUsedAsGroundLayer(){return!1}_getTypeKeywords(){let e=[];if(this.profile===`points`)e.push(`Point`);else if(this.profile===`mesh-pyramids`)e.push(`3DObject`);else throw new a(`scenelayer:unknown-profile`,`SceneLayer:save() encountered an unknown SceneLayer profile: `+this.profile);return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(let e of this.fields){let t=!!this.attributeStorageInfo?.some(t=>t.name===e.name),n=!!this.associatedLayer?.fields?.some(t=>t&&e.name===t.name),r={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||n,supportsLayerQuery:n};this._fieldUsageInfo[e.name]=r}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPropertyOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(let t of this.associatedLayer.fields){let n=this.getField(t.name);n?(!n.domain&&t.domain&&(n.domain=t.domain.clone()),n.editable=t.editable,n.nullable=t.nullable,n.length=t.length):(e||=this.fields?this.fields.slice():[],e.push(t.clone()))}e&&this._set(`fields`,e)}_applyAssociatedLayerPropertyOverrides(){if(!this.associatedLayer)return;let e=[`popupTemplate`,`popupEnabled`,`attributeTableTemplate`],t=_(this);for(let n=0;n<e.length;n++){let r=e[n],i=this.originIdOf(r),a=this.associatedLayer.originIdOf(r);i<a&&(a===2||a===3)&&t.setAtOrigin(r,this.associatedLayer[r],a)}}_applyAssociatedLayerExtentOverride(){let e=this.associatedLayer?.getAtOrigin(`fullExtent`,`service`);this.associatedLayer?.infoFor3D!=null&&e&&T(this.associatedLayer?.url)&&K(this)&&_(this).setAtOrigin(`fullExtent`,e.clone(),2)}_applyAssociatedLayerPrivileges(){let e=this.associatedLayer;e&&(this._set(`userHasEditingPrivileges`,e.userHasEditingPrivileges),this._set(`userHasFullEditingPrivileges`,e.userHasFullEditingPrivileges),this._set(`userHasUpdateItemPrivileges`,e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if([`mesh-pyramids`,`points`].includes(this.profile))try{let{serverUrl:t,layerId:n,portalItem:r}=await ce(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),i=await he.FeatureLayer();this.associatedLayer=new i({url:t,customParameters:this.customParameters,apiKey:this.apiKey,layerId:n,portalItem:r}),await this.associatedLayer.load(),this._isOverridden(`timeInfo`)&&(this.associatedLayer.timeInfo=this.timeInfo)}catch(e){f(e)||this._logWarningOnPopupEnabled().catch(()=>{})}}async _logWarningOnPopupEnabled(){let e=new AbortController;this.addHandles(o(e));try{await m(()=>this.popupEnabled&&this.popupTemplate!=null,e.signal)}catch(e){p(e);return}let t=`this SceneLayer: ${this.title}`;this.attributeStorageInfo==null?s.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${t}`):s.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${t}`)}_validateElevationInfo(){let e=this.elevationInfo;this.profile===`mesh-pyramids`&&q(s.getLogger(this),Te(`Mesh scene layers`,`relative-to-scene`,e)),q(s.getLogger(this),Ee(`Scene layers`,e))}async fetchStatistics(e,t){return await ye({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:`scenelayer`,fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??``,customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}async loadTimeInfoFromService(e){let{serviceTimeInfo:t}=this;if(t==null)return;let{startTimeField:n,endTimeField:r}=t;if(n==null&&r==null||K({associatedLayer:this.associatedLayer,serviceUpdateTimeStamp:this.serviceUpdateTimeStamp}))return;let i=async t=>{let r=null;try{r=(await this.fetchStatistics(t,e))?.stats}catch{}if(r==null)return null;let{minTimeStr:i,min:a,maxTimeStr:o,max:s}=r,c=t===n?i??a:o??s;return c==null?null:new Date(c)},[a,o]=await Promise.all([i(n),i(r)]);if(n!=null&&a==null||r!=null&&o==null)return;let s=new J({start:a,end:o});this.setAtOrigin(`timeInfo`,new xe({endField:r,startField:n,fullTimeExtent:s}),`service`)}};e([h({types:{key:`type`,base:null,typeMap:{selection:I}},json:{origins:{"web-scene":{name:`layerDefinition.featureReduction`,write:{allowNull:!0}},"portal-item":{name:`layerDefinition.featureReduction`,write:{allowNull:!0}}}}})],Q.prototype,`featureReduction`,void 0),e([h({type:[_e],json:{read:!1,origins:{"web-scene":{name:`layerDefinition.rangeInfos`,write:!0},"portal-item":{name:`layerDefinition.rangeInfos`,write:!0}}},clonable:!1})],Q.prototype,`rangeInfos`,void 0),e([h({json:{read:!1}})],Q.prototype,`associatedLayer`,void 0),e([h({type:[`show`,`hide`]})],Q.prototype,`listMode`,void 0),e([h({type:[`ArcGISSceneServiceLayer`]})],Q.prototype,`operationalLayerType`,void 0),e([h({json:{read:!1},readOnly:!0})],Q.prototype,`type`,void 0),e([h({...Z.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`fields`,void 0),e([h()],Q.prototype,`types`,null),e([h()],Q.prototype,`typeIdField`,null),e([h()],Q.prototype,`templates`,null),e([h()],Q.prototype,`formTemplate`,null),e([h({readOnly:!0})],Q.prototype,`graphicOrigin`,void 0),e([h({readOnly:!0,clonable:!1})],Q.prototype,`fieldsIndex`,null),e([h({type:me,json:{read:{source:`layerDefinition.floorInfo`},write:{target:`layerDefinition.floorInfo`}}})],Q.prototype,`floorInfo`,void 0),e([h(Z.outFields)],Q.prototype,`outFields`,void 0),e([h({type:H,readOnly:!0,json:{read:!1},clonable:!1})],Q.prototype,`nodePages`,void 0),e([Y(`service`,`nodePages`,[`nodePages`,`pointNodePages`])],Q.prototype,`readNodePages`,null),e([h({type:[U],readOnly:!0,clonable:!1})],Q.prototype,`materialDefinitions`,void 0),e([h({type:[W],readOnly:!0,clonable:!1})],Q.prototype,`textureSetDefinitions`,void 0),e([h({type:[ue],readOnly:!0,clonable:!1})],Q.prototype,`geometryDefinitions`,void 0),e([h({readOnly:!0})],Q.prototype,`serviceUpdateTimeStamp`,void 0),e([h({readOnly:!0})],Q.prototype,`attributeStorageInfo`,void 0),e([h({readOnly:!0})],Q.prototype,`statisticsInfo`,void 0),e([h({type:i.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:`layerDefinition.excludeObjectIds`,write:{enabled:!0}}})],Q.prototype,`excludeObjectIds`,void 0),e([h({type:String,json:{origins:{service:{read:!1,write:!1}},name:`layerDefinition.definitionExpression`,write:{enabled:!0,allowNull:!0}}})],Q.prototype,`definitionExpression`,void 0),e([h({type:ve,json:{name:`layerDefinition.polygonFilter`,write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],Q.prototype,`filter`,void 0),e([h({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Q.prototype,`path`,void 0),e([h(E)],Q.prototype,`elevationInfo`,null),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`effectiveCapabilities`,null),e([h({readOnly:!0})],Q.prototype,`effectiveEditingEnabled`,null),e([h({type:String})],Q.prototype,`geometryType`,null),e([h(D)],Q.prototype,`labelsVisible`,void 0),e([h({type:[pe],json:{origins:{service:{name:`drawingInfo.labelingInfo`,read:{reader:G},write:!1}},name:`layerDefinition.drawingInfo.labelingInfo`,read:{reader:G},write:!0}})],Q.prototype,`labelingInfo`,void 0),e([h(O)],Q.prototype,`legendEnabled`,void 0),e([h({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:[`opacity`,`layerDefinition.drawingInfo.transparency`],reader(e,t){if(typeof e==`number`&&e>=0&&e<=1)return e;let n=t.layerDefinition?.drawingInfo?.transparency;return n===void 0?void 0:Ne(n)}}},"portal-item":{write:!0},service:{read:!1}}}})],Q.prototype,`opacity`,void 0),e([h({type:[`Low`,`High`],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`priority`,void 0),e([h({type:[`Labels`],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`semantic`,void 0),e([h({types:Ce,json:{origins:{service:{read:{source:`drawingInfo.renderer`}}},name:`layerDefinition.drawingInfo.renderer`,write:!0},value:null})],Q.prototype,`renderer`,null),e([h({json:{read:!1}})],Q.prototype,`cachedDrawingInfo`,void 0),e([Y(`service`,`cachedDrawingInfo`)],Q.prototype,`readCachedDrawingInfo`,null),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`capabilities`,null),e([h({type:Boolean,json:{read:!1}})],Q.prototype,`editingEnabled`,null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Q.prototype,`infoFor3D`,null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Q.prototype,`relationships`,null),e([h(k)],Q.prototype,`popupEnabled`,void 0),e([h({type:n,json:{name:`popupInfo`,write:!0}})],Q.prototype,`popupTemplate`,void 0),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`defaultPopupTemplate`,null),e([h(A)],Q.prototype,`attributeTableTemplate`,void 0),e([h({type:String,json:{read:!1}})],Q.prototype,`objectIdField`,void 0),e([Y(`service`,`objectIdField`,[`objectIdField`,`fields`])],Q.prototype,`readObjectIdField`,null),e([h({type:String,json:{read:!1}})],Q.prototype,`globalIdField`,void 0),e([Y(`service`,`globalIdField`,[`globalIdField`,`fields`])],Q.prototype,`readGlobalIdField`,null),e([h({readOnly:!0,type:String,json:{read:!1}})],Q.prototype,`displayField`,null),e([h({type:String,json:{read:!1}})],Q.prototype,`profile`,void 0),e([Y(`service`,`profile`,[`store.profile`])],Q.prototype,`readProfile`,null),e([h({readOnly:!0,type:String,json:{origins:{service:{read:{source:`store.normalReferenceFrame`}}},read:!1}})],Q.prototype,`normalReferenceFrame`,void 0),e([h(j)],Q.prototype,`screenSizePerspectiveEnabled`,void 0),e([h({json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`serviceItemId`,void 0),e([h(se)],Q.prototype,`useViewTime`,null),e([h(M({disableServiceOrigin:!0,webDocumentOrigin:`web-scene`}))],Q.prototype,`timeInfo`,null),e([h({type:J,json:{read:!1,write:!1}})],Q.prototype,`timeExtent`,null),e([h({type:ke,json:{read:!1,write:!1}})],Q.prototype,`timeOffset`,null),e([h({type:Boolean,nonNullable:!0,json:{read:!1,write:!1}})],Q.prototype,`datesInUnknownTimezone`,null),e([h({type:be,readOnly:!0,json:{read:{source:`timeInfo`}},clonable:!1})],Q.prototype,`serviceTimeInfo`,void 0),e([h()],Q.prototype,`isUsedAsGroundLayer`,null),Q=e([g(`esri.layers.SceneLayer`)],Q);const $={"mesh-pyramids":`mesh-pyramids`,meshpyramids:`mesh-pyramids`,"features-meshes":`mesh-pyramids`,points:`points`,"features-points":`points`,lines:`lines`,"features-lines":`lines`,polygons:`polygons`,"features-polygons":`polygons`},Pe={"mesh-pyramids":`mesh`,points:`point`},Fe=Q;export{Fe as default};
|
|
@@ -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._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;if(t===0&&!this._index.useNodeAsHole(e.index))return!0;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{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};
|