@arcgis/core 5.2.0-next.68 → 5.2.0-next.69

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.
Files changed (96) hide show
  1. package/arcgisGlobal.d.ts +2 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/7dd672c25beb8813cc75.js +2 -0
  4. package/assets/esri/core/workers/chunks/{d7267f429a051943187b.js → 873d8332e2149eb1b36a.js} +1 -1
  5. package/assets/esri/core/workers/chunks/b526055794e64b0227ca.js +256 -0
  6. package/assets/esri/core/workers/chunks/be291d920ebc68fde02b.js +2 -0
  7. package/assets/esri/core/workers/chunks/c10a0eebd935472d8fae.js +1 -0
  8. package/assets/esri/core/workers/chunks/d198ecb1fe3690d6092f.js +2 -0
  9. package/assets/esri/core/workers/chunks/d303621c902330be5035.js +1 -0
  10. package/assets/esri/core/workers/chunks/f4e813ead56d963b16b8.js +1 -0
  11. package/assets/esri/core/workers/chunks/{8a12bb50b3ac9e651625.js → f6f1122bed931f1d960b.js} +1 -1
  12. package/assets/esri/core/workers/chunks/f82cd34a79c8aa58d40c.js +2 -0
  13. package/chunks/GaussianSplat.glsl.js +10 -9
  14. package/chunks/GaussianSplatDepth.glsl.js +11 -0
  15. package/chunks/GaussianSplatShadow.glsl.js +7 -16
  16. package/config.js +1 -1
  17. package/kernel.js +1 -1
  18. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  19. package/networks/RulesTable.js +1 -1
  20. package/networks/UtilityNetwork.js +1 -1
  21. package/networks/support/utils.js +1 -1
  22. package/package.json +2 -2
  23. package/support/revision.js +1 -1
  24. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  25. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  26. package/views/2d/layers/support/MediaLayerInteraction.js +1 -1
  27. package/views/2d/layers/support/MediaLayerInteractionOptions.d.ts +46 -0
  28. package/views/2d/layers/support/MediaLayerInteractionOptions.js +1 -1
  29. package/views/2d/layers/support/MediaLayerInteractionReshapeOptions.d.ts +22 -0
  30. package/views/2d/layers/support/MediaLayerInteractionReshapeOptions.js +2 -0
  31. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  32. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  33. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  34. package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
  35. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  36. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  37. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  38. package/views/3d/layers/I3SMeshView3D.js +1 -1
  39. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  40. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  41. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  42. package/views/3d/layers/i3s/SweptSphereVolume.js +2 -0
  43. package/views/3d/layers/support/MediaLayerInteractionReshapeOptions.d.ts +0 -1
  44. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  45. package/views/3d/support/hitTest.js +1 -1
  46. package/views/3d/webgl/RenderCamera.js +1 -1
  47. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  48. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  49. package/views/3d/webgl-engine/collections/Component/ComponentObjectFixedBVH.js +1 -1
  50. package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
  51. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  52. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  53. package/views/3d/webgl-engine/lib/GaussianSplatDepthRenderer.js +2 -0
  54. package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
  55. package/views/3d/webgl-engine/lib/GaussianSplatShadows.js +1 -1
  56. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  57. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  58. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  59. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  60. package/views/3d/webgl-engine/shaders/GaussianSplatDepth.glsl.js +2 -0
  61. package/views/3d/webgl-engine/shaders/GaussianSplatDepthPolicy.js +2 -0
  62. package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +2 -0
  63. package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +97 -0
  64. package/views/3d/webgl-engine/shaders/GaussianSplatShadow.glsl.js +1 -1
  65. package/views/3d/webgl-engine/shaders/GaussianSplatShadowTechnique.js +1 -1
  66. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  67. package/views/3d/webgl.js +1 -1
  68. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  69. package/widgets/Editor/AddAssociationWorkflowData.js +1 -1
  70. package/widgets/Editor/legacy/AddAssociationWorkflow.js +1 -1
  71. package/widgets/Editor/legacy/AddAssociationWorkflowData.js +1 -1
  72. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/AssociationDetails.js +1 -1
  73. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  74. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  75. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  76. package/widgets/OrientedImageryViewer/support/panConstraint.js +1 -1
  77. package/widgets/Search/support/locatorUtils.js +1 -1
  78. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  79. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  80. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  81. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  82. package/widgets/support/UtilityNetworkAssociations/utils/createAssociation.js +1 -1
  83. package/widgets/support/UtilityNetworkAssociations/utils/isFromElement.js +1 -1
  84. package/assets/esri/core/workers/chunks/2426601b8cae7f06af4d.js +0 -256
  85. package/assets/esri/core/workers/chunks/45de90b78485d9326791.js +0 -1
  86. package/assets/esri/core/workers/chunks/581318d4d3b3152fd93f.js +0 -2
  87. package/assets/esri/core/workers/chunks/7bd3a11d3ade0b948db7.js +0 -1
  88. package/assets/esri/core/workers/chunks/8a9d782aee5ab47ba07f.js +0 -2
  89. package/assets/esri/core/workers/chunks/c270b29307e04c4dafae.js +0 -2
  90. package/assets/esri/core/workers/chunks/f276c6f5cbc1aaec0403.js +0 -1
  91. package/assets/esri/core/workers/chunks/fac8add42aa317f8f514.js +0 -2
  92. package/views/3d/layers/i3s/SphereCone.js +0 -2
  93. /package/assets/esri/core/workers/chunks/{8a9d782aee5ab47ba07f.js.LICENSE.txt → 7dd672c25beb8813cc75.js.LICENSE.txt} +0 -0
  94. /package/assets/esri/core/workers/chunks/{fac8add42aa317f8f514.js.LICENSE.txt → be291d920ebc68fde02b.js.LICENSE.txt} +0 -0
  95. /package/assets/esri/core/workers/chunks/{c270b29307e04c4dafae.js.LICENSE.txt → d198ecb1fe3690d6092f.js.LICENSE.txt} +0 -0
  96. /package/assets/esri/core/workers/chunks/{581318d4d3b3152fd93f.js.LICENSE.txt → f82cd34a79c8aa58d40c.js.LICENSE.txt} +0 -0
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as e}from"../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{RejectBySlicePass as i}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{positionOutsideClipSpace as n}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PositionOutsideClipSpace.js";import{GaussianSplatCovariance as r}from"../views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatCovariance.glsl.js";import{GaussianSplatEvaluation as o}from"../views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatEvaluation.glsl.js";import{GaussianSplatTextureFetch as c}from"../views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatTextureFetch.glsl.js";import{GaussianSplatUnpacking as s}from"../views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js";import{QuaternionToRotationMatrix as t}from"../views/3d/webgl-engine/core/shaderLibrary/util/QuaternionToRotationMatrix.glsl.js";import{Float2BindUniform as l}from"../views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js";import{Float3PassUniform as v}from"../views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js";import{FloatPassUniform as d}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as p,If as u}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as f}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Texture2DUintPassUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Texture2DUintPassUniform.js";import{ShaderBuilder as x}from"../views/webgl/ShaderBuilder.js";function g(a){const{clippingEnabled:g,hasSlicePlane:h}=a,S=new x,{fragment:P,varyings:j,vertex:y}=S;j.add("conic","vec3"),j.add("gaussianLogAlphaCutoff","float"),j.add("offsetFromCenter","vec2"),y.uniforms.add(new m("splatOrderTexture",e=>e.splatOrder),new m("splatAtlasTexture",e=>e.splatAtlas),new m("splatHeaderTexture",e=>e.splatHeader),new d("minSplatRadius",e=>e.minSplatRadius),new l("inverseScreenSize",({camera:a})=>e(w,1/a.fullWidth,1/a.fullHeight)),new f("proj",e=>e.camera.projectionMatrix),new f("view",e=>e.camera.viewMatrix),new l("nearFar",e=>e.camera.nearFar)),g&&y.uniforms.add(new v("clipMin",e=>e.clipMinCameraRelative),new v("clipMax",e=>e.clipMaxCameraRelative)),y.include(s),y.include(c),y.include(t),y.include(r),y.include(o),y.include(i,a),y.code.add(p`float safeClipW(float clipW) {
2
+ import{FloatPassUniform as e}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as a}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{gaussianSplatDepthPolicy as i}from"../views/3d/webgl-engine/shaders/GaussianSplatDepthPolicy.js";import{GaussianSplatPass as n,gaussianSplatUnpackCovariance3D as r,gaussianSplatComputeQuad as o,gaussianSplatCullAndTransformVertex as c,gaussianSplatComputeEllipse as t}from"../views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js";import{GaussianSplatRenderParameters as l}from"../views/3d/webgl-engine/shaders/GaussianSplatPassParameters.js";import{ShaderBuilder as s}from"../views/webgl/ShaderBuilder.js";class p extends l{constructor(){super(...arguments),this.alphaCutoff=i.direct.alphaCutoff,this.depthBias=i.direct.depthBias}}function v(i){const l=new s,{vertex:p}=l;return l.include(n,i),p.uniforms.add(new e("alphaCutoff",e=>e.alphaCutoff),new e("depthBias",e=>e.depthBias)),p.code.add(a`float safeClipW(float clipW) {
3
3
  return abs(clipW) < 1e-7 ? (clipW < 0.0 ? -1e-7 : 1e-7) : clipW;
4
- }`),y.code.add(p`vec3 computeProjectivePixelGradient(
4
+ }`),p.code.add(a`vec3 computeProjectivePixelGradient(
5
5
  vec3 clipGradient,
6
6
  vec3 clipWGradient,
7
7
  float clipValue,
@@ -10,13 +10,13 @@ float invWSquared,
10
10
  float halfScreenSize
11
11
  ) {
12
12
  return (clipGradient * safeW - clipValue * clipWGradient) * invWSquared * halfScreenSize;
13
- }`),y.code.add(p`vec3 multiplyCovariance3D(float[6] covariance3D, vec3 value) {
13
+ }`),p.code.add(a`vec3 multiplyCovariance3D(float[6] covariance3D, vec3 value) {
14
14
  return vec3(
15
15
  covariance3D[0] * value.x + covariance3D[1] * value.y + covariance3D[2] * value.z,
16
16
  covariance3D[1] * value.x + covariance3D[3] * value.y + covariance3D[4] * value.z,
17
17
  covariance3D[2] * value.x + covariance3D[4] * value.y + covariance3D[5] * value.z
18
18
  );
19
- }`),y.code.add(p`vec3 computeProjectiveCovariance2D(vec3 pixelXGradient, vec3 pixelYGradient, float[6] covariance3D, mat4 view) {
19
+ }`),p.code.add(a`vec3 computeProjectiveCovariance2D(vec3 pixelXGradient, vec3 pixelYGradient, float[6] covariance3D, mat4 view) {
20
20
  mat3 worldToView = transpose(mat3(view));
21
21
  vec3 axisX = worldToView * pixelXGradient;
22
22
  vec3 axisY = worldToView * pixelYGradient;
@@ -27,15 +27,6 @@ float covarianceXX = dot(axisX, covarianceAxisX) + regularization;
27
27
  float covarianceXY = dot(axisX, covarianceAxisY);
28
28
  float covarianceYY = dot(axisY, covarianceAxisY) + regularization;
29
29
  return vec3(covarianceXX, covarianceXY, covarianceYY);
30
- }`),y.code.add(p`float biasDepth(float linearDepth) {
31
- const float bias = 80.0 * .000015259;
32
- return min(linearDepth + bias, 1.0);
33
- }`);const G=.25,D=Math.log(G);return y.main.add(`\n uint gaussianIndex = fetchOrderedGaussianIndex(uint(gl_InstanceID));\n uvec4 packedGaussian = fetchPackedGaussian(gaussianIndex);\n\n float opacity = unpackOpacity(packedGaussian);\n\n gl_Position = ${n};\n\n if (opacity < ${G}) {\n return;\n }\n\n vec3 cameraRelativePosition = fetchGaussianCameraRelativePosition(gaussianIndex, packedGaussian);\n\n ${u(g,p`if (cameraRelativePosition.x < clipMin.x || cameraRelativePosition.y < clipMin.y || cameraRelativePosition.z < clipMin.z ||
34
- cameraRelativePosition.x > clipMax.x || cameraRelativePosition.y > clipMax.y || cameraRelativePosition.z > clipMax.z) {
35
- return;
36
- }`)}\n\n ${u(h,p`if (rejectBySlice(cameraRelativePosition)) {
37
- return;
38
- }`)}\n\n vec4 viewPos = vec4(mat3(view) * cameraRelativePosition, 1.0);\n\n if (viewPos.z > -nearFar.x || viewPos.z < -nearFar.y) {\n return;\n }\n\n vec3 covarianceA;\n vec3 covarianceB;\n computePackedGaussianCovariance3D(packedGaussian, covarianceA, covarianceB);\n\n float covariance3D[6] = float[6](covarianceA.x, covarianceA.y, covarianceA.z, covarianceB.x, covarianceB.y, covarianceB.z);\n\n vec4 projPos = proj * viewPos;\n float safeW = safeClipW(projPos.w);\n float invWSquared = 1.0 / (safeW * safeW);\n vec2 halfScreenSize = 0.5 / inverseScreenSize;\n float maxShadowSplatRadius = max(halfScreenSize.x, halfScreenSize.y);\n\n // Projection matrix columns are the clip-space derivatives with respect to view-space xyz.\n vec3 clipWGradient = vec3(proj[0][3], proj[1][3], proj[2][3]);\n vec3 pixelXGradient = computeProjectivePixelGradient(\n vec3(proj[0][0], proj[1][0], proj[2][0]),\n clipWGradient,\n projPos.x,\n safeW,\n invWSquared,\n halfScreenSize.x\n );\n vec3 pixelYGradient = computeProjectivePixelGradient(\n vec3(proj[0][1], proj[1][1], proj[2][1]),\n clipWGradient,\n projPos.y,\n safeW,\n invWSquared,\n halfScreenSize.y\n );\n vec3 covariance2D = computeProjectiveCovariance2D(pixelXGradient, pixelYGradient, covariance3D, view);\n\n float determinant = computeGaussianCovarianceDeterminant(covariance2D);\n if (determinant <= 0.0) {\n return;\n }\n\n vec2 eigenvalues = computeGaussianCovarianceEigenvalues(covariance2D);\n\n gaussianLogAlphaCutoff = ${D} - log(opacity);\n float gaussianEllipseThreshold = computeGaussianEllipseThreshold(gaussianLogAlphaCutoff);\n vec2 axisLengths = computeGaussianAxisLengths(eigenvalues, gaussianEllipseThreshold);\n float maxRadius = max(axisLengths.x, axisLengths.y);\n\n // Avoid invalid/extremely large footprints.\n if (maxRadius < 0.0 || maxRadius > maxShadowSplatRadius) {\n return;\n }\n\n if (rejectGaussianByMinimumRadius(maxRadius, opacity, minSplatRadius)) {\n return;\n }\n\n vec3 ndcPos = projPos.xyz / safeW;\n vec2 clipSpacePixelScale = 2.0 * inverseScreenSize;\n\n if (rejectGaussianByScreenBounds(ndcPos.xy, maxRadius, clipSpacePixelScale)) {\n return;\n }\n\n offsetFromCenter = computeGaussianQuadOffset(covariance2D, eigenvalues, axisLengths, gl_VertexID);\n conic = computeGaussianConic(covariance2D, determinant);\n float linearDepth = (-viewPos.z - nearFar.x) / (nearFar.y - nearFar.x);\n float biasedDepth = biasDepth(linearDepth);\n\n vec2 clipPos = ndcPos.xy + offsetFromCenter * clipSpacePixelScale - inverseScreenSize;\n gl_Position = vec4(clipPos, biasedDepth * 2.0 - 1.0, 1.0);\n `),P.include(o),P.main.add(p`float gaussianExponent = evaluateGaussianExponent(conic, offsetFromCenter);
39
- if (gaussianExponent > 0.0 || gaussianExponent < gaussianLogAlphaCutoff) {
40
- discard;
41
- }`),S}const w=a(),h=Object.freeze(Object.defineProperty({__proto__:null,build:g},Symbol.toStringTag,{value:"Module"}));export{h as G,g as b};
30
+ }`),p.code.add(a`float biasDepth(float linearDepth) {
31
+ return min(linearDepth + depthBias, 1.0);
32
+ }`),p.main.add(`\n uint gaussianIndex = fetchOrderedGaussianIndex(uint(gl_InstanceID));\n uvec4 packedGaussian = fetchPackedGaussian(gaussianIndex);\n\n float opacity = unpackOpacity(packedGaussian);\n\n ${c(i,"alphaCutoff")}\n\n ${r}\n\n vec4 projPos = proj * viewPos;\n float safeW = safeClipW(projPos.w);\n float invWSquared = 1.0 / (safeW * safeW);\n vec2 halfScreenSize = 0.5 / inverseScreenSize;\n float maxShadowSplatRadius = max(halfScreenSize.x, halfScreenSize.y);\n\n // Projection matrix columns are the clip-space derivatives with respect to view-space xyz.\n vec3 clipWGradient = vec3(proj[0][3], proj[1][3], proj[2][3]);\n vec3 pixelXGradient = computeProjectivePixelGradient(\n vec3(proj[0][0], proj[1][0], proj[2][0]),\n clipWGradient,\n projPos.x,\n safeW,\n invWSquared,\n halfScreenSize.x\n );\n vec3 pixelYGradient = computeProjectivePixelGradient(\n vec3(proj[0][1], proj[1][1], proj[2][1]),\n clipWGradient,\n projPos.y,\n safeW,\n invWSquared,\n halfScreenSize.y\n );\n vec3 covariance2D = computeProjectiveCovariance2D(pixelXGradient, pixelYGradient, covariance3D, view);\n\n ${t("log(alphaCutoff) - log(opacity)")}\n\n // Avoid invalid/extremely large footprints.\n if (maxRadius < 0.0 || maxRadius > maxShadowSplatRadius) {\n return;\n }\n\n vec3 ndcPos = projPos.xyz / safeW;\n ${o}\n float linearDepth = (-viewPos.z - nearFar.x) / (nearFar.y - nearFar.x);\n float biasedDepth = biasDepth(linearDepth);\n\n vec2 clipPos = ndcPos.xy + offsetFromCenter * clipSpacePixelScale - inverseScreenSize;\n gl_Position = vec4(clipPos, biasedDepth * 2.0 - 1.0, 1.0);\n `),l}const d=Object.freeze(Object.defineProperty({__proto__:null,GaussianSplatShadowPassParameters:p,build:v},Symbol.toStringTag,{value:"Module"}));export{p as G,d as a,v as b};
package/config.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={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}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.68";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
2
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={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}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.69";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.68",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
2
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.69",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import r from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as n,sync as o,initial as l}from"../../../core/reactiveUtils.js";import{property as h,subclass as u}from"../../../core/accessorSupport/decorators.js";import{runUntracked as _}from"../../../core/accessorSupport/tracking.js";import{exactEquals as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{UpdatingHandles as p}from"../../../core/support/UpdatingHandles.js";import{projectBoundingRect as g}from"../../../geometry/projection/projectBoundingRect.js";import{create as m}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as y}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as f}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{I3SDataRequester as x}from"../../../views/3d/layers/i3s/I3SDataRequester.js";import{addCallback as N}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as b}from"../../../views/3d/layers/i3s/I3SIndex.js";import v from"../../../views/3d/layers/i3s/I3SLodHandling.js";import w from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{getVertexCrs as L,getIndexCrs as D,findIntersectingNodes as C}from"../../../views/3d/layers/i3s/I3SUtil.js";import V from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{toBoundingRect as A}from"../../../views/3d/support/extentUtils.js";import{minQuality as I}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as M}from"../../../views/support/PromiseQueue.js";import{noBudget as F}from"../../../views/support/Scheduler.js";const O=100,q=2,P=1e4,R=1e-4,S=1.2,G=500,U=1.5;let H=class extends(a(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexRequester(){return new x(this.layer.customParameters,this.layer.apiKey)}get dataRequester(){return new x(this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return L(this.layer)}get crsIndex(){return D(this.layer)}get layer(){return this.layerView.layer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){return _(()=>{if(this._index){const 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 p,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 r({deallocator:null}),this._modificationsNodeFilteringArray=new r,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new M,this._elevationUpdateNodes=new r({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new v(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(([s])=>{if(this.destroyed||!e||e.destroyed||!s)return;const{view:r,clientGeometry:a}=e;if(this._setClippingArea(r.clippingArea),this.addHandles([this._updatingHandles.add(()=>r?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:c}),n(()=>r.quality,()=>this._setCameraDirty(),o),this._updatingHandles.add(()=>2===r.state.mode,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),N(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>r.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e),o),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>null!=this._index&&(this._index.holeFilling=e))]),this._viewportQueries=new V(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?r.groundView:r.elevationProvider,y(r.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new f(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:r.renderCoordsHelper.spatialReference},r.resourceController.memoryController,this.worker),this._index=new b(y(r.viewingMode),t,s,this.indexRequester,this._clientNodeLoader,this._viewportQueries,i.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),null!=a){for(const e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on("change",e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)}),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._updatingHandles.destroy(),this._nodeLoader=null,Q.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),null!=j&&(j.hide(),j=null),this._index=null,this._lodHandling=s(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set("worker",null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map(i=>{const s=T(e,i),r=T(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null}).filter(e=>null!=e&&e.name!==i)}_requiredFieldsChange(){const e=this._getRequiredAttributes();E(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=m();A(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&this._index.requestUpdate())}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateRunning(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null!=t){if(null==this._index)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}}updateElevationChanged(e,t){const i=this._index;if(null==i?.rootNode||null==t)return null;this.crsIndex.equals(t)||(g(e,t,k,this.crsIndex),e=k);const s=this._elevationUpdateNodes;return s.clear(),C(e,i.rootNode,i,e=>s.push(e.index)),s.length&&(s.forAll(e=>i.updateElevationChanged(e)),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.calculateServiceMbsInRenderSRElevationAdjusted(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){const i=this._idleQueue.push(e,t);return this._evaluateRunning(),i}reschedule(e,t){const i=this._idleQueue.unshift(e,t);return this._evaluateRunning(),i}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get unloadedMemoryEstimate(){return null!=this._index&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,i){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,i)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData?this._disableMemCache=e:this._disableMemCache=!0}runTask(e,t){return this.layerView.contentVisible?this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(s){this._errorCount<50?i.getLogger(this).error(`Error during processing: ${s} at ${s.stack}`):50===this._errorCount&&i.getLogger(this).error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(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(null==this._index)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));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>G){if(this._featureLOD<=R)return;this._featureLOD/=U,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=P||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*S||e&&i.estimate>t))return;if(this._featureLOD<=R)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(P,Math.max(R,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&!this.layerView.isNodeLoaded(s.index);s=t.getParent(s.index))if(this._enableFromGPUCache(s,0)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?O:q)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(null==r||2!==r.cacheState&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),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){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=q)&&(null==this.index||!this.dataRequester.isFull(this._index.urlPrefix))}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(this.layerView.contentVisible){const i=(this._index?.indexMissing??0)+3*(this._index?.updates.add.length??0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}else e=this._cameraDirty,t=e?0:1;this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this._viewportQueries.updateCamera(t,!i||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(){const e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;return(Math.min(this.layerView.view.quality,.5)-I)/(.5-I)}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))&&!(null==this._index||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenterAndUpdateMinmax(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new w(this.layer,this.dataRequester,i.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 null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexRequester.cancelAll(),this.dataRequester.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;Q.clear(),this.layerView.getLoadedNodeIndices(Q);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return Q.filterInPlace(e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)}),Q.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(Q,e,0),!(i&&this._lodDropFactor<1)&&(0===Q.length||(Q.clear(),!1))}markNodeToRemove(e){Q.push(e)}removeMarkedNodes(){this._removeNodes(Q,F,0)}_removeNodes(e,t,i){if(0!==e.length&&!t.done)for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;1===i&&this.layerView.nodeFadeoutEnabled&&null!=r&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,1,!0):this.layerView.removeNode(s),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}async _updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{const i=this.layerView.getLoadedAttributes(e.index),s=E(i,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:s},t.signal),t.signal)}catch(i){if(!d(i))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))return void i.getLogger(this).error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(i=>{i&&null!=this._index&&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 1===e.cacheState?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!d(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(0===t&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t?.attributeInfo&&E(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=(t,i)=>this._nodeLoader.loadTextures(e,t,i),r=t=>this._clientNodeLoader.loadTextures(e,t),a=e.index>=0?s:r,d=await this.schedule(()=>i.loadCachedNodeData(e,t,a),t);if(null==d)return!1;const n=this._requiredAttributes,o=await this.reschedule(()=>this._loadAttributes(e,n,t),t);return await this.reschedule(()=>i.addCachedNodeData(e,d,{loadedAttributes:n,attributeData:o},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).then(i=>this.schedule(()=>this.layerView.addNode(e,i,t),t)).finally(()=>this._downloadingCount--).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!d(t))throw i.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(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],H.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],H.prototype,"isGraphics3D",null),e([h({readOnly:!0})],H.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],H.prototype,"indexRequester",null),e([h({readOnly:!0})],H.prototype,"dataRequester",null),e([h({readOnly:!0})],H.prototype,"crsVertex",null),e([h({readOnly:!0})],H.prototype,"crsIndex",null),e([h()],H.prototype,"featureTarget",void 0),e([h()],H.prototype,"fixedFeatureTarget",void 0),e([h()],H.prototype,"layerView",void 0),e([h()],H.prototype,"layer",null),e([h()],H.prototype,"_updatingHandles",void 0),e([h()],H.prototype,"updating",null),e([h()],H.prototype,"running",void 0),e([h()],H.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],H.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],H.prototype,"worker",void 0),e([h({readOnly:!0})],H.prototype,"rootNodeVisible",null),H=e([u("esri.layers.graphics.controllers.I3SOnDemandController")],H);const Q=new r({deallocator:null});let j;function E(e,t){return null!=e&&e.length===t.length&&e.every(e=>T(t,e.name)>=0)}function T(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const k=m(),B=H;export{B as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import r from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as n,sync as o,initial as l}from"../../../core/reactiveUtils.js";import{property as h,subclass as u}from"../../../core/accessorSupport/decorators.js";import{runUntracked as _}from"../../../core/accessorSupport/tracking.js";import{exactEquals as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{UpdatingHandles as p}from"../../../core/support/UpdatingHandles.js";import{projectBoundingRect as g}from"../../../geometry/projection/projectBoundingRect.js";import{create as m}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as y}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as f}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{I3SDataRequester as x}from"../../../views/3d/layers/i3s/I3SDataRequester.js";import{addCallback as N}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as b}from"../../../views/3d/layers/i3s/I3SIndex.js";import v from"../../../views/3d/layers/i3s/I3SLodHandling.js";import w from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{getVertexCrs as L,getIndexCrs as D,findIntersectingNodes as C}from"../../../views/3d/layers/i3s/I3SUtil.js";import V from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{toBoundingRect as A}from"../../../views/3d/support/extentUtils.js";import{minQuality as I}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as M}from"../../../views/support/PromiseQueue.js";import{noBudget as F}from"../../../views/support/Scheduler.js";const O=100,q=2,P=1e4,R=1e-4,S=1.2,G=500,U=1.5;let H=class extends(a(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexRequester(){return new x(this.layer.customParameters,this.layer.apiKey)}get dataRequester(){return new x(this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return L(this.layer)}get crsIndex(){return D(this.layer)}get layer(){return this.layerView.layer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){return _(()=>{if(this._index){const 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 p,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 r({deallocator:null}),this._modificationsNodeFilteringArray=new r,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new M,this._elevationUpdateNodes=new r({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new v(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(([s])=>{if(this.destroyed||!e||e.destroyed||!s)return;const{view:r,clientGeometry:a}=e;if(this._setClippingArea(r.clippingArea),this.addHandles([this._updatingHandles.add(()=>r?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:c}),n(()=>r.quality,()=>this._setCameraDirty(),o),this._updatingHandles.add(()=>2===r.state.mode,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),N(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>r.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e),o),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>null!=this._index&&(this._index.holeFilling=e))]),this._viewportQueries=new V(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?r.groundView:r.elevationProvider,y(r.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new f(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:r.renderCoordsHelper.spatialReference},r.resourceController.memoryController,this.worker),this._index=new b(y(r.viewingMode),t,s,this.indexRequester,this._clientNodeLoader,this._viewportQueries,i.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),null!=a){for(const e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on("change",e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)}),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._updatingHandles.destroy(),this._nodeLoader=null,Q.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),null!=j&&(j.hide(),j=null),this._index=null,this._lodHandling=s(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set("worker",null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map(i=>{const s=T(e,i),r=T(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null}).filter(e=>null!=e&&e.name!==i)}_requiredFieldsChange(){const e=this._getRequiredAttributes();E(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=m();A(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&this._index.requestUpdate())}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateRunning(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null!=t){if(null==this._index)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}}updateElevationChanged(e,t){const i=this._index;if(null==i?.rootNode||null==t)return null;this.crsIndex.equals(t)||(g(e,t,k,this.crsIndex),e=k);const s=this._elevationUpdateNodes;return s.clear(),C(e,i.rootNode,i,e=>s.push(e.index)),s.length&&(s.forAll(e=>i.updateElevationChanged(e)),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.calculateServiceMbsInRenderSRElevationAdjusted(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){const i=this._idleQueue.push(e,t);return this._evaluateRunning(),i}reschedule(e,t){const i=this._idleQueue.unshift(e,t);return this._evaluateRunning(),i}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get unloadedMemoryEstimate(){return null!=this._index&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,i){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,i)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData?this._disableMemCache=e:this._disableMemCache=!0}runTask(e,t){return this.layerView.contentVisible?this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(s){this._errorCount<50?i.getLogger(this).error(`Error during processing: ${s} at ${s.stack}`):50===this._errorCount&&i.getLogger(this).error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(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(null==this._index)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));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>G){if(this._featureLOD<=R)return;this._featureLOD/=U,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=P||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*S||e&&i.estimate>t))return;if(this._featureLOD<=R)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(P,Math.max(R,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&!this.layerView.isNodeLoaded(s.index);s=t.getParent(s.index))if(this._enableFromGPUCache(s,0)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?O:q)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(null==r||2!==r.cacheState&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),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){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=q)&&(null==this.index||!this.dataRequester.isFull(this._index.urlPrefix))}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(this.layerView.contentVisible){const i=(this._index?.indexMissing??0)+3*(this._index?.updates.add.length??0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}else e=this._cameraDirty,t=e?0:1;this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this._viewportQueries.updateCamera(t,!i||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(){const e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;return(Math.min(this.layerView.view.quality,.5)-I)/(.5-I)}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))&&!(null==this._index||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenterAndUpdateMinmax(e))-this._viewportQueries.minCenterDistance>(this._viewportQueries.maxCenterDistance-this._viewportQueries.minCenterDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new w(this.layer,this.dataRequester,i.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 null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexRequester.cancelAll(),this.dataRequester.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;Q.clear(),this.layerView.getLoadedNodeIndices(Q);const i=0===this._viewportQueries.maxCenterDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return Q.filterInPlace(e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)}),Q.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(Q,e,0),!(i&&this._lodDropFactor<1)&&(0===Q.length||(Q.clear(),!1))}markNodeToRemove(e){Q.push(e)}removeMarkedNodes(){this._removeNodes(Q,F,0)}_removeNodes(e,t,i){if(0!==e.length&&!t.done)for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;1===i&&this.layerView.nodeFadeoutEnabled&&null!=r&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,1,!0):this.layerView.removeNode(s),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}async _updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{const i=this.layerView.getLoadedAttributes(e.index),s=E(i,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:s},t.signal),t.signal)}catch(i){if(!d(i))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))return void i.getLogger(this).error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(i=>{i&&null!=this._index&&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 1===e.cacheState?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!d(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(0===t&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t?.attributeInfo&&E(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=(t,i)=>this._nodeLoader.loadTextures(e,t,i),r=t=>this._clientNodeLoader.loadTextures(e,t),a=e.index>=0?s:r,d=await this.schedule(()=>i.loadCachedNodeData(e,t,a),t);if(null==d)return!1;const n=this._requiredAttributes,o=await this.reschedule(()=>this._loadAttributes(e,n,t),t);return await this.reschedule(()=>i.addCachedNodeData(e,d,{loadedAttributes:n,attributeData:o},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).then(i=>this.schedule(()=>this.layerView.addNode(e,i,t),t)).finally(()=>this._downloadingCount--).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!d(t))throw i.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(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],H.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],H.prototype,"isGraphics3D",null),e([h({readOnly:!0})],H.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],H.prototype,"indexRequester",null),e([h({readOnly:!0})],H.prototype,"dataRequester",null),e([h({readOnly:!0})],H.prototype,"crsVertex",null),e([h({readOnly:!0})],H.prototype,"crsIndex",null),e([h()],H.prototype,"featureTarget",void 0),e([h()],H.prototype,"fixedFeatureTarget",void 0),e([h()],H.prototype,"layerView",void 0),e([h()],H.prototype,"layer",null),e([h()],H.prototype,"_updatingHandles",void 0),e([h()],H.prototype,"updating",null),e([h()],H.prototype,"running",void 0),e([h()],H.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],H.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],H.prototype,"worker",void 0),e([h({readOnly:!0})],H.prototype,"rootNodeVisible",null),H=e([u("esri.layers.graphics.controllers.I3SOnDemandController")],H);const Q=new r({deallocator:null});let j;function E(e,t){return null!=e&&e.length===t.length&&e.every(e=>T(t,e.name)>=0)}function T(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const k=m(),B=H;export{B as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../request.js";import{JSONSupportMixin as s}from"../core/JSONSupport.js";import{Loadable as r}from"../core/Loadable.js";import{sqlIn as o,sqlAnd as n,sqlOr as i}from"../core/sql.js";import{property as a,subclass as c}from"../core/accessorSupport/decorators.js";import{getAssetFieldNames as u,getRuleValues as l,getCompatibleRuleElements as p,getFeatureSourceLayerId as y,doesRuleAllowAssociation as d}from"./support/utils.js";import{isGraphic as h}from"../support/graphicInstanceUtils.js";let f=class extends(s(r)){constructor(e){super(e),this.rulesCategorized={attachment:[],containment:[],connectivity:[]},this.request=t}initialize(){}async load(e){const t=this.rulesLayer.load(e).then(()=>this._initializeRulesTable());return this.addResolvingPromise(t),this}getFeaturesCanAssociateWithClause(e,t,s){const r=new Map,[i,a]=u(e.sourceLayer);if(!i||!a)return"";const c=l(e),y=l(t);s.forEach(e=>{const{type:t,direction:s}=e;this._getRulesForAssociationType(t).forEach(e=>{p(e,c,s).filter(e=>e.networkSource?.layerId===y.layerId).forEach(e=>{const t=e.assetGroup?.assetGroupCode,s=e.assetType?.assetTypeCode;if(null!=t&&null!=s){const e=r.get(t)??new Set;e.add(s),r.set(t,e)}})})});let d=[];return this._mergeAssetCodes(r).forEach((e,t)=>{const s=`${i} IN (${t})`,r=o(a,[...e]);s&&r&&d.push(n(s,r))}),d.length>1&&(d=d.map(e=>`(${e})`)),d.join(" OR ")}getFeaturesCanAssociateWith(e,t,s){return null==y(e)?[]:t.filter(t=>this.canAssociateFeatures(e,t,s))}canAssociateFeatures(e,t,s){if(!this._canSupportAssociations([e,t]))return!1;const r=l(e),o=l(t);return s.some(e=>{const{type:t,direction:s}=e;return this._getRulesForAssociationType(t).some(e=>"to"===s?d(e,o,r):d(e,r,o))})}getLayersCanAssociateWith(e,t,s){return null==y(e)?[]:t.filter(t=>this.canAssociateFeatureToLayer(e,t,s))}canAssociateFeatureToLayer(e,t,s){if(!this._canSupportAssociations([e,t]))return!1;const r=l(e),o=l(t);return s.some(e=>{const{type:t,direction:s}=e;return this._getRulesForAssociationType(t).some(e=>"to"===s?d(e,o,r):d(e,r,o))})}getFeatureSQL(e,t){const s=e.layerId.toString(),r=e.fieldsIndex?.normalizeFieldName("assetGroup"),o=e.fieldsIndex?.normalizeFieldName("assetType"),n=r?t.attributes[r]:null,i=o?t.attributes[o]:null,a=this.rulesHash[s];if(a){const e=a.assetGroupHash[n];if(e){return e.assetTypeHash[i]||null}}return null}_initializeRulesTable(){const e={},t=[{networkSourceId:"fromNetworkSource",assetGroupId:"fromAssetGroup",assetTypeId:"fromAssetType"},{networkSourceId:"toNetworkSource",assetGroupId:"toAssetGroup",assetTypeId:"toAssetType"},{networkSourceId:"viaNetworkSource",assetGroupId:"viaAssetGroup",assetTypeId:"viaAssetType"}];this.rulesCategorized={attachment:[],containment:[],connectivity:[]};for(const s of this.rules){if(3===s.ruleType){this.rulesCategorized.attachment.push(s);continue}if(2===s.ruleType){this.rulesCategorized.containment.push(s);continue}if(1===s.ruleType){this.rulesCategorized.connectivity.push(s);continue}this.rulesCategorized.connectivity.push(s);let r=[[0,1],[1,0]];5===s.ruleType&&(r=[[0,2],[2,0],[1,2],[2,1]]);for(const o of r){const r=o.shift(),a=o.shift();let c=!1;switch(s.ruleType){case 5:c=0===r||1===r;break;case 4:c=1===r}const u=t[r],l=s[u.networkSourceId]?.layerId.toString()??"",p=s[u.assetGroupId]?.assetGroupCode?.toString(),y=s[u.assetTypeId],d=y?.assetTypeCode?.toString(),h=t[a],f=s[h.networkSourceId]?.layerId.toString()??"",m=s[h.assetGroupId]?.assetGroupCode?.toString(),g=s[h.assetTypeId],T=g?.assetTypeCode?.toString(),S=e[l]??{assetGroupHash:{}};if(!(p&&d&&m&&T))continue;const I=S.assetGroupHash[p]??{assetTypeHash:{}},v=I.assetTypeHash[d]??{};if(v[f]=v[f]??{},c){v[l]=v[l]??{};const e=n(`assetgroup = ${p}`,`assettype = ${d}`);"esriNECPEndVertex"===g?.connectivityPolicy?v[l].endVertex=v[l]?.endVertex?`${v[l].endVertex}`:`(${e})`:v[l].anyVertex=v[l].anyVertex?`${v[l].anyVertex}`:`(${e})`}const A=n(`assetgroup = ${m}`,`assettype = ${T}`);"esriNECPEndVertex"===g?.connectivityPolicy?v[f].endVertex=v[f]?.endVertex?i(v[f].endVertex,A):`(${A})`:v[f].anyVertex=v[f]?.anyVertex?i(v[f].anyVertex,A):`(${A})`,I.assetTypeHash[d]=v,S.assetGroupHash[p]=I,e[l]=S}}this._set("rulesHash",e)}_getRulesForAssociationType(e){const{rulesCategorized:t}=this;switch(e){case"attachment":return t.attachment;case"containment":return t.containment;case"connectivity":case"junction-junction-connectivity":return t.connectivity.filter(e=>1===e.ruleType);case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":return t.connectivity.filter(e=>4===e.ruleType||5===e.ruleType);default:return[]}}_areSetsEqual(e,t){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}_mergeAssetCodes(e){const t=new Map,s=new Set;for(const[r,o]of e){const n=new Set([r]);for(const[t,a]of e)r!==t&&!s.has(t)&&this._areSetsEqual(o,a)&&(n.add(t),s.add(t));const i=Array.from(n).sort().join(",");t.set(i,o)}return t}_canSupportAssociations(e){return e.every(e=>{const t=h(e)?e.sourceLayer:e,[s,r]=u(t);return null!=s&&null!=r})}};e([a({constructOnly:!0})],f.prototype,"rulesLayer",void 0),e([a({constructOnly:!0})],f.prototype,"rules",void 0),e([a({readOnly:!0})],f.prototype,"rulesHash",void 0),e([a()],f.prototype,"rulesCategorized",void 0),e([a({constructOnly:!0})],f.prototype,"request",void 0),f=e([c("esri.networks.RulesTable")],f);export{f as default};
2
+ import{__decorate as e}from"tslib";import t from"../request.js";import{JSONSupportMixin as s}from"../core/JSONSupport.js";import{Loadable as r}from"../core/Loadable.js";import{sqlIn as o,sqlAnd as n,sqlOr as i}from"../core/sql.js";import{property as a,subclass as c}from"../core/accessorSupport/decorators.js";import{getGraphicLayer as u}from"../graphic/graphicOriginUtils.js";import{getAssetFieldNames as p,getRuleValues as l,getCompatibleRuleElements as d,getFeatureSourceLayerId as y,doesRuleAllowAssociation as h}from"./support/utils.js";import{isGraphic as f}from"../support/graphicInstanceUtils.js";let m=class extends(s(r)){constructor(e){super(e),this.rulesCategorized={attachment:[],containment:[],connectivity:[]},this.request=t}initialize(){}async load(e){const t=this.rulesLayer.load(e).then(()=>this._initializeRulesTable());return this.addResolvingPromise(t),this}getFeaturesCanAssociateWithClause(e,t,s){const r=new Map,[i,a]=p(u(e));if(!i||!a)return"";const c=l(e),y=l(t);s.forEach(e=>{const{type:t,direction:s}=e;this._getRulesForAssociationType(t).forEach(e=>{d(e,c,s).filter(e=>e.networkSource?.layerId===y.layerId).forEach(e=>{const t=e.assetGroup?.assetGroupCode,s=e.assetType?.assetTypeCode;if(null!=t&&null!=s){const e=r.get(t)??new Set;e.add(s),r.set(t,e)}})})});let h=[];return this._mergeAssetCodes(r).forEach((e,t)=>{const s=`${i} IN (${t})`,r=o(a,[...e]);s&&r&&h.push(n(s,r))}),h.length>1&&(h=h.map(e=>`(${e})`)),h.join(" OR ")}getFeaturesCanAssociateWith(e,t,s){return null==y(e)?[]:t.filter(t=>this.canAssociateFeatures(e,t,s))}canAssociateFeatures(e,t,s){if(!this._canSupportAssociations([e,t]))return!1;const r=l(e),o=l(t);return s.some(e=>{const{type:t,direction:s}=e;return this._getRulesForAssociationType(t).some(e=>"to"===s?h(e,o,r):h(e,r,o))})}getLayersCanAssociateWith(e,t,s){return null==y(e)?[]:t.filter(t=>this.canAssociateFeatureToLayer(e,t,s))}canAssociateFeatureToLayer(e,t,s){if(!this._canSupportAssociations([e,t]))return!1;const r=l(e),o=l(t);return s.some(e=>{const{type:t,direction:s}=e;return this._getRulesForAssociationType(t).some(e=>"to"===s?h(e,o,r):h(e,r,o))})}getFeatureSQL(e,t){const s=e.layerId.toString(),r=e.fieldsIndex?.normalizeFieldName("assetGroup"),o=e.fieldsIndex?.normalizeFieldName("assetType"),n=r?t.attributes[r]:null,i=o?t.attributes[o]:null,a=this.rulesHash[s];if(a){const e=a.assetGroupHash[n];if(e){return e.assetTypeHash[i]||null}}return null}_initializeRulesTable(){const e={},t=[{networkSourceId:"fromNetworkSource",assetGroupId:"fromAssetGroup",assetTypeId:"fromAssetType"},{networkSourceId:"toNetworkSource",assetGroupId:"toAssetGroup",assetTypeId:"toAssetType"},{networkSourceId:"viaNetworkSource",assetGroupId:"viaAssetGroup",assetTypeId:"viaAssetType"}];this.rulesCategorized={attachment:[],containment:[],connectivity:[]};for(const s of this.rules){if(3===s.ruleType){this.rulesCategorized.attachment.push(s);continue}if(2===s.ruleType){this.rulesCategorized.containment.push(s);continue}if(1===s.ruleType){this.rulesCategorized.connectivity.push(s);continue}this.rulesCategorized.connectivity.push(s);let r=[[0,1],[1,0]];5===s.ruleType&&(r=[[0,2],[2,0],[1,2],[2,1]]);for(const o of r){const r=o.shift(),a=o.shift();let c=!1;switch(s.ruleType){case 5:c=0===r||1===r;break;case 4:c=1===r}const u=t[r],p=s[u.networkSourceId]?.layerId.toString()??"",l=s[u.assetGroupId]?.assetGroupCode?.toString(),d=s[u.assetTypeId],y=d?.assetTypeCode?.toString(),h=t[a],f=s[h.networkSourceId]?.layerId.toString()??"",m=s[h.assetGroupId]?.assetGroupCode?.toString(),g=s[h.assetTypeId],T=g?.assetTypeCode?.toString(),S=e[p]??{assetGroupHash:{}};if(!(l&&y&&m&&T))continue;const I=S.assetGroupHash[l]??{assetTypeHash:{}},v=I.assetTypeHash[y]??{};if(v[f]=v[f]??{},c){v[p]=v[p]??{};const e=n(`assetgroup = ${l}`,`assettype = ${y}`);"esriNECPEndVertex"===g?.connectivityPolicy?v[p].endVertex=v[p]?.endVertex?`${v[p].endVertex}`:`(${e})`:v[p].anyVertex=v[p].anyVertex?`${v[p].anyVertex}`:`(${e})`}const A=n(`assetgroup = ${m}`,`assettype = ${T}`);"esriNECPEndVertex"===g?.connectivityPolicy?v[f].endVertex=v[f]?.endVertex?i(v[f].endVertex,A):`(${A})`:v[f].anyVertex=v[f]?.anyVertex?i(v[f].anyVertex,A):`(${A})`,I.assetTypeHash[y]=v,S.assetGroupHash[l]=I,e[p]=S}}this._set("rulesHash",e)}_getRulesForAssociationType(e){const{rulesCategorized:t}=this;switch(e){case"attachment":return t.attachment;case"containment":return t.containment;case"connectivity":case"junction-junction-connectivity":return t.connectivity.filter(e=>1===e.ruleType);case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":return t.connectivity.filter(e=>4===e.ruleType||5===e.ruleType);default:return[]}}_areSetsEqual(e,t){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}_mergeAssetCodes(e){const t=new Map,s=new Set;for(const[r,o]of e){const n=new Set([r]);for(const[t,a]of e)r!==t&&!s.has(t)&&this._areSetsEqual(o,a)&&(n.add(t),s.add(t));const i=Array.from(n).sort().join(",");t.set(i,o)}return t}_canSupportAssociations(e){return e.every(e=>{const t=f(e)?u(e):e,[s,r]=p(t);return null!=s&&null!=r})}};e([a({constructOnly:!0})],m.prototype,"rulesLayer",void 0),e([a({constructOnly:!0})],m.prototype,"rules",void 0),e([a({readOnly:!0})],m.prototype,"rulesHash",void 0),e([a()],m.prototype,"rulesCategorized",void 0),e([a({constructOnly:!0})],m.prototype,"request",void 0),m=e([c("esri.networks.RulesTable")],m);export{m as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../Graphic.js";import r from"../core/Error.js";import{getOrCreateMapValue as s}from"../core/MapUtils.js";import{watch as o}from"../core/reactiveUtils.js";import{property as i,subclass as a}from"../core/accessorSupport/decorators.js";import n from"../layers/FeatureLayer.js";import{queryAllJSON as l}from"../layers/support/featureQueryAll.js";import u from"./Network.js";import d from"./RulesTable.js";import m from"./support/NamedTraceConfiguration.js";import{getAssociationsTableFields as c}from"./support/networkFieldUtils.js";import y from"./support/NetworkSystemLayers.js";import h from"./support/TerminalConfiguration.js";import f from"./support/TraceJobInfo.js";import{AssociationTypeEnum as p,nullGuid as w,associationTypeKebabDict as I}from"./support/typeUtils.js";import{doesRuleAllowAssociation as b}from"./support/utils.js";import g from"../rest/networks/support/TelecomNetworkElement.js";import T from"../rest/support/Query.js";let k=class extends u{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._circuitManagerMap=new Map,this._terminalById=new Map,this._unitIdentifierManager=null}initialize(){this.addHandles(o(()=>[this.gdbVersion,this.historicMoment],()=>{this.networkSystemLayers.associationsTable&&(this.networkSystemLayers.associationsTable.gdbVersion!==this.gdbVersion&&(this.networkSystemLayers.associationsTable.gdbVersion=this.gdbVersion),this.networkSystemLayers.associationsTable.historicMoment!==this.historicMoment&&(this.networkSystemLayers.associationsTable.historicMoment=this.historicMoment))}))}get _rulesLayer(){const{gdbVersion:e,historicMoment:t}=this,r=this.networkSystemLayers.rulesTableUrl;return new n({url:r,gdbVersion:e,historicMoment:t})}get _telecomSourceSet(){const e=new Set;return this.dataElement?.domainNetworks.forEach(t=>{t.isTelecomNetwork&&(t.edgeSources?.forEach(t=>e.add(t.sourceId)),t.junctionSources?.forEach(t=>e.add(t.sourceId)))}),e}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map(t=>{t?.edgeSources?.map(({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}),t?.junctionSources?.map(({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})}),e}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new y({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map(e=>h.fromJSON(e))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map(e=>e.domainNetworkName)||[]}get hasTelecomNetwork(){return this.dataElement?.domainNetworks.some(e=>e.isTelecomNetwork)??!1}get associationsTable(){return this.networkSystemLayers.associationsTable}async load(e){return this.addResolvingPromise(this._load(e)),this}async _load(e){await super._load(e);const{dataElement:t,layerId:s,sourceJSON:o}=this;if(!(t&&"domainNetworks"in t&&Array.isArray(t.domainNetworks)))throw new r("network:invalid-data-element",`The data element for layer ${s} does not have the expected properties for a utility network.`);if(!o||!("type"in o)||"string"!=typeof o.type||"Utility Network Layer"!==o.type)throw new r("network:invalid-layer",`The metadata for layer ${s} does not have the expected properties for a utility network.`);await Promise.all([this._loadNamedTraceConfigurationsFromNetwork(e),this.networkSystemLayers.loadAssociationsTable(e)])}getTerminalConfiguration(e){let t=null,r=null;const s=e.sourceLayer??e.origin??e.layer??null;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const i=e.attributes;if(null==i)return null;for(const l of Object.keys(i))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let a=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find(e=>e.layerId===o);if(e){const s=e.assetGroups?.find(e=>e.assetGroupCode===t);if(s){const e=s.assetTypes?.find(e=>e.assetTypeCode===r);if(e?.isTerminalConfigurationSupported){a=e.terminalConfigurationId;break}}}}if(null!=a){const e=this.dataElement.terminalConfigurations,t=e?.find(e=>e.terminalConfigurationId===a);return t?h.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find(t=>t.domainNetworkName===e);return t?.tiers?.map(e=>e.name)||[]}async getRulesTable(){const e=this._rulesLayer;e.loaded||await e.load();const t=this.dataElement?.domainNetworks;if(!t)return null;const r=t.flatMap(e=>[...e.edgeSources||[],...e.junctionSources||[]]),s=(await this._queryRulesTable(e)).map(t=>this._hydrateRuleInfo(e,r,t));return new d({rulesLayer:e,rules:s})}async getCircuitManager(e){if(!this.hasTelecomNetwork)return null;const t=this.dataElement?.domainNetworks.find(t=>t.domainNetworkName===e&&t.isTelecomNetwork);if(!t)return null;const{default:r}=await import("./CircuitManager.js");return s(this._circuitManagerMap,e,()=>new r({utilityNetwork:this,telecomDomainNetwork:t}))}async getUnitIdentifierManager(){if(!this.hasTelecomNetwork)return null;if(this._unitIdentifierManager)return this._unitIdentifierManager;const{default:e}=await import("./UnitIdentifierManager.js");return this._unitIdentifierManager=new e({utilityNetwork:this}),this._unitIdentifierManager}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach(e=>{e.terminals.forEach(e=>{this._terminalById.set(e.id,e)})}),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?null!=e.layerId&&this._utilityLayerList.has(e.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from({...e,telecomSourceSet:this._telecomSourceSet});return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new f({statusUrl:o,telecomSourceSet:this._telecomSourceSet})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;const{fromNetworkElement:r,toNetworkElement:s}=e;if(!r||!s)return!1;await t.load();let o=null;switch(e.associationType){case"containment":o=t.rulesCategorized.containment;break;case"attachment":o=t.rulesCategorized.attachment;break;default:o=t.rulesCategorized.connectivity}return o.some(e=>b(e,r,s))}generateAddAssociations(e){const{associationsTable:r}=this.networkSystemLayers,{fromNetworkSourceId:s,fromGlobalId:o,fromTerminalId:i,fromFirstUnit:a,fromLastUnit:n,toNetworkSourceId:l,toGlobalId:u,toTerminalId:d,toFirstUnit:m,toLastUnit:y,associationType:h,isContentVisible:f,percentAlong:w,globalId:I}=c(r);return{addFeatures:e.map(e=>{const r=new t({attributes:{[s]:e.fromNetworkElement?.networkSourceId,[o]:e.fromNetworkElement?.globalId,[i]:e.fromNetworkElement?.terminalId,[l]:e.toNetworkElement?.networkSourceId,[u]:e.toNetworkElement?.globalId,[d]:e.toNetworkElement?.terminalId,[h]:p[e.associationType],[f]:null==e.isContentVisible?void 0:e.isContentVisible?1:0,[w]:e.percentAlong,[I]:e.globalId}}),c=e.associationType.includes("connectivity");return e.fromNetworkElement instanceof g&&(r.attributes[a]=e.fromNetworkElement?.firstUnit,r.attributes[n]=e.fromNetworkElement?.lastUnit),e.toNetworkElement instanceof g&&(r.attributes[m]=e.toNetworkElement?.firstUnit,r.attributes[y]=e.toNetworkElement?.lastUnit),c&&(r.attributes[i]=e.fromNetworkElement?.terminalId??1,r.attributes[d]=e.toNetworkElement?.terminalId??1),r}),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:r?.globalIdField??"globalid",objectIdField:r?.objectIdField??"objectid"}}}generateDeleteAssociations(e){const{associationsTable:t,associationsTableId:r}=this.networkSystemLayers,s={id:r,identifierFields:{globalIdField:t?.globalIdField??"globalid",objectIdField:t?.objectIdField??"objectid"}};if(-8===this.dataElement?.schemaGeneration){const t=this._generateDeleteTelecomAssociationPayload(e);return{...s,deleteAssociations:t}}const o=e.map(e=>({globalId:e.globalId}));return{...s,deleteFeatures:o}}async loadAssociationsTable(){return this.networkSystemLayers.loadAssociationsTable()}async loadSubnetworksTable(){return this.networkSystemLayers.loadSubnetworksTable()}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map(e=>e.globalId),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find(e=>e.globalId===s.globalId);if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),i=s.get("CREATIONDATE"),a=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),d=s.get("TONETWORKSOURCEID"),m=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),h=s.get("VIANETWORKSOURCEID"),f=s.get("VIAASSETGROUP"),p=s.get("VIAASSETTYPE"),w=s.get("VIATERMINALID"),I=r.attributes[o.name],b=new Date(r.attributes[i.name]),g=[{networkSourceId:r.attributes[a.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[d.name],assetGroupId:r.attributes[m.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[h.name],assetGroupId:r.attributes[f.name],assetTypeId:r.attributes[p.name],terminalId:r.attributes[w.name]}],T={ruleType:I,creationDate:b};for(const k of[0,1,2]){if(5!==I&&2===k)continue;const e=g[k],r=t.find(t=>t.sourceId===e.networkSourceId),s=r?.assetGroups.find(t=>t.assetGroupCode===e.assetGroupId),o=s?.assetTypes.find(t=>t.assetTypeCode===e.assetTypeId),i=this._getTerminal(o,e);let a="";switch(k){case 0:a="from";break;case 1:a="to";break;case 2:a="via"}T[`${a}NetworkSource`]=r,T[`${a}AssetGroup`]=s,T[`${a}AssetType`]=o,T[`${a}Terminal`]=i?.toJSON()}return T}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find(e=>e.id===r);return s?.terminals?.find(e=>e.id===t.terminalId)??null}async _queryRulesTable(e){const{gdbVersion:t,historicMoment:r}=this,s=new T({where:"1=1",outFields:["*"],gdbVersion:t,historicMoment:r});return(await l(e,s)).features}_generateDeleteTelecomAssociationPayload(e){return e.map(e=>({globalId:e.globalId??w,associationType:I.toJSON(e.associationType),fromSourceId:e.fromNetworkElement.networkSourceId,fromGlobalId:e.fromNetworkElement.globalId,fromTerminalId:e.fromNetworkElement.terminalId,toSourceId:e.toNetworkElement.networkSourceId,toGlobalId:e.toNetworkElement.globalId,toTerminalId:e.toNetworkElement.terminalId}))}};e([i({readOnly:!0})],k.prototype,"_rulesLayer",null),e([i({readOnly:!0})],k.prototype,"_telecomSourceSet",null),e([i({type:[m],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],k.prototype,"sharedNamedTraceConfigurations",void 0),e([i({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],k.prototype,"type",void 0),e([i({readOnly:!0})],k.prototype,"serviceTerritoryFeatureLayerId",null),e([i({readOnly:!0})],k.prototype,"networkSystemLayers",null),e([i({readOnly:!0})],k.prototype,"terminalConfigurations",null),e([i({readOnly:!0})],k.prototype,"domainNetworkNames",null),e([i({readOnly:!0})],k.prototype,"hasTelecomNetwork",null),e([i({readOnly:!0,json:{read:!1}})],k.prototype,"associationsTable",null),k=e([a("esri.networks.UtilityNetwork")],k);const S=k;export{S as default};
2
+ import{__decorate as e}from"tslib";import t from"../Graphic.js";import r from"../core/Error.js";import{getOrCreateMapValue as s}from"../core/MapUtils.js";import{watch as o}from"../core/reactiveUtils.js";import{property as i,subclass as a}from"../core/accessorSupport/decorators.js";import{getGraphicLayer as n}from"../graphic/graphicOriginUtils.js";import l from"../layers/FeatureLayer.js";import{queryAllJSON as u}from"../layers/support/featureQueryAll.js";import d from"./Network.js";import m from"./RulesTable.js";import c from"./support/NamedTraceConfiguration.js";import{getAssociationsTableFields as y}from"./support/networkFieldUtils.js";import h from"./support/NetworkSystemLayers.js";import p from"./support/TerminalConfiguration.js";import f from"./support/TraceJobInfo.js";import{AssociationTypeEnum as w,nullGuid as I,associationTypeKebabDict as b}from"./support/typeUtils.js";import{doesRuleAllowAssociation as g}from"./support/utils.js";import T from"../rest/networks/support/TelecomNetworkElement.js";import k from"../rest/support/Query.js";let S=class extends d{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._circuitManagerMap=new Map,this._terminalById=new Map,this._unitIdentifierManager=null}initialize(){this.addHandles(o(()=>[this.gdbVersion,this.historicMoment],()=>{this.networkSystemLayers.associationsTable&&(this.networkSystemLayers.associationsTable.gdbVersion!==this.gdbVersion&&(this.networkSystemLayers.associationsTable.gdbVersion=this.gdbVersion),this.networkSystemLayers.associationsTable.historicMoment!==this.historicMoment&&(this.networkSystemLayers.associationsTable.historicMoment=this.historicMoment))}))}get _rulesLayer(){const{gdbVersion:e,historicMoment:t}=this,r=this.networkSystemLayers.rulesTableUrl;return new l({url:r,gdbVersion:e,historicMoment:t})}get _telecomSourceSet(){const e=new Set;return this.dataElement?.domainNetworks.forEach(t=>{t.isTelecomNetwork&&(t.edgeSources?.forEach(t=>e.add(t.sourceId)),t.junctionSources?.forEach(t=>e.add(t.sourceId)))}),e}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map(t=>{t?.edgeSources?.map(({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}),t?.junctionSources?.map(({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})}),e}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new h({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map(e=>p.fromJSON(e))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map(e=>e.domainNetworkName)||[]}get hasTelecomNetwork(){return this.dataElement?.domainNetworks.some(e=>e.isTelecomNetwork)??!1}get associationsTable(){return this.networkSystemLayers.associationsTable}async load(e){return this.addResolvingPromise(this._load(e)),this}async _load(e){await super._load(e);const{dataElement:t,layerId:s,sourceJSON:o}=this;if(!(t&&"domainNetworks"in t&&Array.isArray(t.domainNetworks)))throw new r("network:invalid-data-element",`The data element for layer ${s} does not have the expected properties for a utility network.`);if(!o||!("type"in o)||"string"!=typeof o.type||"Utility Network Layer"!==o.type)throw new r("network:invalid-layer",`The metadata for layer ${s} does not have the expected properties for a utility network.`);await Promise.all([this._loadNamedTraceConfigurationsFromNetwork(e),this.networkSystemLayers.loadAssociationsTable(e)])}getTerminalConfiguration(e){let t=null,r=null;const s=n(e)??null;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const i=e.attributes;if(null==i)return null;for(const n of Object.keys(i))"ASSETGROUP"===n.toUpperCase()&&(t=e.getAttribute(n)),"ASSETTYPE"===n.toUpperCase()&&(r=e.getAttribute(n));if(!this.dataElement)return null;let a=null;const l=this.dataElement.domainNetworks;for(const n of l){const e=n.junctionSources?.find(e=>e.layerId===o);if(e){const s=e.assetGroups?.find(e=>e.assetGroupCode===t);if(s){const e=s.assetTypes?.find(e=>e.assetTypeCode===r);if(e?.isTerminalConfigurationSupported){a=e.terminalConfigurationId;break}}}}if(null!=a){const e=this.dataElement.terminalConfigurations,t=e?.find(e=>e.terminalConfigurationId===a);return t?p.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find(t=>t.domainNetworkName===e);return t?.tiers?.map(e=>e.name)||[]}async getRulesTable(){const e=this._rulesLayer;e.loaded||await e.load();const t=this.dataElement?.domainNetworks;if(!t)return null;const r=t.flatMap(e=>[...e.edgeSources||[],...e.junctionSources||[]]),s=(await this._queryRulesTable(e)).map(t=>this._hydrateRuleInfo(e,r,t));return new m({rulesLayer:e,rules:s})}async getCircuitManager(e){if(!this.hasTelecomNetwork)return null;const t=this.dataElement?.domainNetworks.find(t=>t.domainNetworkName===e&&t.isTelecomNetwork);if(!t)return null;const{default:r}=await import("./CircuitManager.js");return s(this._circuitManagerMap,e,()=>new r({utilityNetwork:this,telecomDomainNetwork:t}))}async getUnitIdentifierManager(){if(!this.hasTelecomNetwork)return null;if(this._unitIdentifierManager)return this._unitIdentifierManager;const{default:e}=await import("./UnitIdentifierManager.js");return this._unitIdentifierManager=new e({utilityNetwork:this}),this._unitIdentifierManager}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach(e=>{e.terminals.forEach(e=>{this._terminalById.set(e.id,e)})}),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?null!=e.layerId&&this._utilityLayerList.has(e.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from({...e,telecomSourceSet:this._telecomSourceSet});return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new f({statusUrl:o,telecomSourceSet:this._telecomSourceSet})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;const{fromNetworkElement:r,toNetworkElement:s}=e;if(!r||!s)return!1;await t.load();let o=null;switch(e.associationType){case"containment":o=t.rulesCategorized.containment;break;case"attachment":o=t.rulesCategorized.attachment;break;default:o=t.rulesCategorized.connectivity}return o.some(e=>g(e,r,s))}generateAddAssociations(e){const{associationsTable:r}=this.networkSystemLayers,{fromNetworkSourceId:s,fromGlobalId:o,fromTerminalId:i,fromFirstUnit:a,fromLastUnit:n,toNetworkSourceId:l,toGlobalId:u,toTerminalId:d,toFirstUnit:m,toLastUnit:c,associationType:h,isContentVisible:p,percentAlong:f,globalId:I}=y(r);return{addFeatures:e.map(e=>{const r=new t({attributes:{[s]:e.fromNetworkElement?.networkSourceId,[o]:e.fromNetworkElement?.globalId,[i]:e.fromNetworkElement?.terminalId,[l]:e.toNetworkElement?.networkSourceId,[u]:e.toNetworkElement?.globalId,[d]:e.toNetworkElement?.terminalId,[h]:w[e.associationType],[p]:null==e.isContentVisible?void 0:e.isContentVisible?1:0,[f]:e.percentAlong,[I]:e.globalId}}),y=e.associationType.includes("connectivity");return e.fromNetworkElement instanceof T&&(r.attributes[a]=e.fromNetworkElement?.firstUnit,r.attributes[n]=e.fromNetworkElement?.lastUnit),e.toNetworkElement instanceof T&&(r.attributes[m]=e.toNetworkElement?.firstUnit,r.attributes[c]=e.toNetworkElement?.lastUnit),y&&(r.attributes[i]=e.fromNetworkElement?.terminalId??1,r.attributes[d]=e.toNetworkElement?.terminalId??1),r}),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:r?.globalIdField??"globalid",objectIdField:r?.objectIdField??"objectid"}}}generateDeleteAssociations(e){const{associationsTable:t,associationsTableId:r}=this.networkSystemLayers,s={id:r,identifierFields:{globalIdField:t?.globalIdField??"globalid",objectIdField:t?.objectIdField??"objectid"}};if(-8===this.dataElement?.schemaGeneration){const t=this._generateDeleteTelecomAssociationPayload(e);return{...s,deleteAssociations:t}}const o=e.map(e=>({globalId:e.globalId}));return{...s,deleteFeatures:o}}async loadAssociationsTable(){return this.networkSystemLayers.loadAssociationsTable()}async loadSubnetworksTable(){return this.networkSystemLayers.loadSubnetworksTable()}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map(e=>e.globalId),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find(e=>e.globalId===s.globalId);if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),i=s.get("CREATIONDATE"),a=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),d=s.get("TONETWORKSOURCEID"),m=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),h=s.get("VIANETWORKSOURCEID"),p=s.get("VIAASSETGROUP"),f=s.get("VIAASSETTYPE"),w=s.get("VIATERMINALID"),I=r.attributes[o.name],b=new Date(r.attributes[i.name]),g=[{networkSourceId:r.attributes[a.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[d.name],assetGroupId:r.attributes[m.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[h.name],assetGroupId:r.attributes[p.name],assetTypeId:r.attributes[f.name],terminalId:r.attributes[w.name]}],T={ruleType:I,creationDate:b};for(const k of[0,1,2]){if(5!==I&&2===k)continue;const e=g[k],r=t.find(t=>t.sourceId===e.networkSourceId),s=r?.assetGroups.find(t=>t.assetGroupCode===e.assetGroupId),o=s?.assetTypes.find(t=>t.assetTypeCode===e.assetTypeId),i=this._getTerminal(o,e);let a="";switch(k){case 0:a="from";break;case 1:a="to";break;case 2:a="via"}T[`${a}NetworkSource`]=r,T[`${a}AssetGroup`]=s,T[`${a}AssetType`]=o,T[`${a}Terminal`]=i?.toJSON()}return T}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find(e=>e.id===r);return s?.terminals?.find(e=>e.id===t.terminalId)??null}async _queryRulesTable(e){const{gdbVersion:t,historicMoment:r}=this,s=new k({where:"1=1",outFields:["*"],gdbVersion:t,historicMoment:r});return(await u(e,s)).features}_generateDeleteTelecomAssociationPayload(e){return e.map(e=>({globalId:e.globalId??I,associationType:b.toJSON(e.associationType),fromSourceId:e.fromNetworkElement.networkSourceId,fromGlobalId:e.fromNetworkElement.globalId,fromTerminalId:e.fromNetworkElement.terminalId,toSourceId:e.toNetworkElement.networkSourceId,toGlobalId:e.toNetworkElement.globalId,toTerminalId:e.toNetworkElement.terminalId}))}};e([i({readOnly:!0})],S.prototype,"_rulesLayer",null),e([i({readOnly:!0})],S.prototype,"_telecomSourceSet",null),e([i({type:[c],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],S.prototype,"sharedNamedTraceConfigurations",void 0),e([i({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],S.prototype,"type",void 0),e([i({readOnly:!0})],S.prototype,"serviceTerritoryFeatureLayerId",null),e([i({readOnly:!0})],S.prototype,"networkSystemLayers",null),e([i({readOnly:!0})],S.prototype,"terminalConfigurations",null),e([i({readOnly:!0})],S.prototype,"domainNetworkNames",null),e([i({readOnly:!0})],S.prototype,"hasTelecomNetwork",null),e([i({readOnly:!0,json:{read:!1}})],S.prototype,"associationsTable",null),S=e([a("esri.networks.UtilityNetwork")],S);const N=S;export{N as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../request.js";import t from"../../core/Error.js";import{queryAllJSON as r}from"../../layers/support/featureQueryAll.js";import{isSubtypeSublayer as o,isFeatureLayer as n}from"../../layers/support/layerUtils.js";import s from"../../portal/PortalItem.js";import u from"../../rest/support/FeatureSet.js";import{isGraphic as a}from"../../support/graphicInstanceUtils.js";function l(e,t,r="from"){const{fromRuleElement:o,viaRuleElement:n,toRuleElement:s}=y(e),u=[];switch(e.ruleType){case 2:case 3:"from"===r&&m(t,o,!1)?u.push(s):"to"===r&&m(t,s,!1)&&u.push(o);break;case 1:m(t,o,!0)?u.push(s):m(t,s,!0)&&u.push(o);break;case 4:s.networkSource?.usesGeometry||(m(t,o,!0)?u.push(s):m(t,s,!0)&&u.push(o));break;case 5:n&&(m(t,n,!0)?(o.networkSource?.usesGeometry||u.push(o),s.networkSource?.usesGeometry||u.push(s)):(!o.networkSource?.usesGeometry&&m(t,o,!0)||!s.networkSource?.usesGeometry&&m(t,s,!0))&&u.push(n));break;default:return[]}return u}function i(e,t,r){const{fromRuleElement:o,viaRuleElement:n,toRuleElement:s}=y(e);switch(e.ruleType){case 2:case 3:return c(t,r,o,s,!1,!1);case 1:return c(t,r,o,s,!0,!0);case 4:return!s.networkSource?.usesGeometry&&c(t,r,o,s,!0,!0);case 5:return!o.networkSource?.usesGeometry&&c(t,r,o,n,!0,!0)||!s.networkSource?.usesGeometry&&c(t,r,s,n,!0,!0);default:return!1}}function c(e,t,r,o,n,s){if(!r||!o)return!1;const u=m(e,r,s),a=m(t,o,s);if(n){const n=m(e,o,s),l=m(t,r,s);return u&&a||n&&l}return u&&a}function p(e,t){const r=e.terminal?.terminalId,o=t.terminalId;return null==r&&null==o||(1===r?null==o||1===o:r===o)}function m(e,t,r){const{assetGroupCode:o,assetTypeCode:n}=e;return("layerId"in e?e.layerId===t.networkSource?.layerId:e.networkSourceId===t.networkSource?.sourceId)&&(null==o||o===t.assetGroup?.assetGroupCode)&&(null==n||n===t.assetType?.assetTypeCode)&&(!r||!("terminalId"in e)||p(t,e))}function y(e){return{fromRuleElement:{networkSource:e.fromNetworkSource,assetGroup:e.fromAssetGroup,assetType:e.fromAssetType,terminal:e.fromTerminal},viaRuleElement:e.viaNetworkSource?{networkSource:e.viaNetworkSource,assetGroup:e.viaAssetGroup,assetType:e.viaAssetType,terminal:e.viaTerminal}:void 0,toRuleElement:{networkSource:e.toNetworkSource,assetGroup:e.toAssetGroup,assetType:e.toAssetType,terminal:e.toTerminal}}}function f(e){let t=null,r=null,n=null;if(a(e))t=d(e),[r,n]=w(e);else if(o(e)){t=e.parent?.layerId??null;const[o]=I(e);o===e.subtypeField&&(r=e.subtypeCode)}else t=e.layerId??null;return{layerId:t,assetGroupCode:r,assetTypeCode:n}}function d(e){const{sourceLayer:t}=e;let r;return n(t)?r=t.layerId:o(t)&&(r=t.parent?.layerId),r??null}function w(e){const[t,r]=I(e.sourceLayer);return[t?e.attributes[t]:null,r?e.attributes[r]:null]}function I(e){if(!e||!("fieldsIndex"in e))return[null,null];return[e.fieldsIndex.normalizeFieldName("assetGroup")??null,e.fieldsIndex.normalizeFieldName("assetType")??null]}async function k(e,t){const o=e.layers,n=e.layerInfos,s=e.returnGeometry||!1,a=e.outSpatialReference;await Promise.all(o.map(async e=>{await e.load()}));return(await Promise.all(o.map(async e=>{const o=n.find(t=>t.layerUrl===e.parsedUrl?.path);if(!o?.objectIds?.length)return{layer:e,featureSet:void 0};const l=e.createQuery();l.returnGeometry=s,l.outFields=o.outFields||["*"],l.outSpatialReference=a,l.gdbVersion=e.gdbVersion,l.objectIds=o.objectIds,t&&(l.where="1=1");const i=u.fromJSON(await r(e,l));return i.features.forEach(t=>{t.layer=t.sourceLayer=e}),{layer:e,featureSet:i}}))).filter(e=>void 0!==e.featureSet)}async function S(e,t){if("Utility Network Layer"===e){const{default:e}=await import("../UtilityNetwork.js");return new e({layerUrl:t})}return null}async function G(r){let o="portalItem"in r?r:{portalItem:r};!o.portalItem||o.portalItem instanceof s||(o={...o,portalItem:new s(o.portalItem)});const n=o.portalItem;if(await n.load(),"Feature Service"!==n.type)throw new t("portal:unknown-item-type","Unknown item type '${type}'",{type:n.type});const u=n.url,a=await e(u,{responseType:"json",query:{f:"json"}}),l="Network Layer";if(a.data.type?.includes(l))return S(a.data.type,u);if(a.data.layers){const e=a.data.layers.find(e=>e.type.includes(l));if(e){const t=`${u}/${e.id}`;return S(e.type,t)}}return null}export{c as doElementsMatchRule,i as doesRuleAllowAssociation,I as getAssetFieldNames,l as getCompatibleRuleElements,y as getElementsFromRule,w as getFeatureAssetCodes,d as getFeatureSourceLayerId,k as getFeaturesFromLayers,f as getRuleValues,m as isRuleElementMatch,p as isTerminalMatch,G as networkFromPortalItem};
2
+ import e from"../../request.js";import r from"../../core/Error.js";import{getGraphicLayer as t}from"../../graphic/graphicOriginUtils.js";import{queryAllJSON as o}from"../../layers/support/featureQueryAll.js";import{isSubtypeSublayer as n,isFeatureLayer as s,isSubtypeGroupLayer as u}from"../../layers/support/layerUtils.js";import a from"../../portal/PortalItem.js";import l from"../../rest/support/FeatureSet.js";import{isGraphic as i}from"../../support/graphicInstanceUtils.js";function c(e,r,t="from"){const{fromRuleElement:o,viaRuleElement:n,toRuleElement:s}=d(e),u=[];switch(e.ruleType){case 2:case 3:"from"===t&&f(r,o,!1)?u.push(s):"to"===t&&f(r,s,!1)&&u.push(o);break;case 1:f(r,o,!0)?u.push(s):f(r,s,!0)&&u.push(o);break;case 4:s.networkSource?.usesGeometry||(f(r,o,!0)?u.push(s):f(r,s,!0)&&u.push(o));break;case 5:n&&(f(r,n,!0)?(o.networkSource?.usesGeometry||u.push(o),s.networkSource?.usesGeometry||u.push(s)):(!o.networkSource?.usesGeometry&&f(r,o,!0)||!s.networkSource?.usesGeometry&&f(r,s,!0))&&u.push(n));break;default:return[]}return u}function p(e,r,t){const{fromRuleElement:o,viaRuleElement:n,toRuleElement:s}=d(e);switch(e.ruleType){case 2:case 3:return m(r,t,o,s,!1,!1);case 1:return m(r,t,o,s,!0,!0);case 4:return!s.networkSource?.usesGeometry&&m(r,t,o,s,!0,!0);case 5:return!o.networkSource?.usesGeometry&&m(r,t,o,n,!0,!0)||!s.networkSource?.usesGeometry&&m(r,t,s,n,!0,!0);default:return!1}}function m(e,r,t,o,n,s){if(!t||!o)return!1;const u=f(e,t,s),a=f(r,o,s);if(n){const n=f(e,o,s),l=f(r,t,s);return u&&a||n&&l}return u&&a}function y(e,r){const t=e.terminal?.terminalId,o=r.terminalId;return null==t&&null==o||(1===t?null==o||1===o:t===o)}function f(e,r,t){const{assetGroupCode:o,assetTypeCode:n}=e;return("layerId"in e?e.layerId===r.networkSource?.layerId:e.networkSourceId===r.networkSource?.sourceId)&&(null==o||o===r.assetGroup?.assetGroupCode)&&(null==n||n===r.assetType?.assetTypeCode)&&(!t||!("terminalId"in e)||y(r,e))}function d(e){return{fromRuleElement:{networkSource:e.fromNetworkSource,assetGroup:e.fromAssetGroup,assetType:e.fromAssetType,terminal:e.fromTerminal},viaRuleElement:e.viaNetworkSource?{networkSource:e.viaNetworkSource,assetGroup:e.viaAssetGroup,assetType:e.viaAssetType,terminal:e.viaTerminal}:void 0,toRuleElement:{networkSource:e.toNetworkSource,assetGroup:e.toAssetGroup,assetType:e.toAssetType,terminal:e.toTerminal}}}function w(e){let r=null,t=null,o=null;if(i(e))r=I(e),[t,o]=S(e);else if(n(e)){r=e.parent?.layerId??null;const[o]=k(e);o===e.subtypeField&&(t=e.subtypeCode)}else r=e.layerId??null;return{layerId:r,assetGroupCode:t,assetTypeCode:o}}function I(e){const{sourceLayer:r}=e;let t;return s(r)?t=r.layerId:n(r)&&(t=r.parent?.layerId),t??null}function S(e){const[r,o]=k(t(e));return[r?e.attributes[r]:null,o?e.attributes[o]:null]}function k(e){if(!e||!("fieldsIndex"in e))return[null,null];return[e.fieldsIndex.normalizeFieldName("assetGroup")??null,e.fieldsIndex.normalizeFieldName("assetType")??null]}async function h(e,r){const t=e.layers,n=e.layerInfos,s=e.returnGeometry||!1,a=e.outSpatialReference;await Promise.all(t.map(async e=>{await e.load()}));return(await Promise.all(t.map(async e=>{const t=n.find(r=>r.layerUrl===e.parsedUrl?.path);if(!t?.objectIds?.length)return{layer:e,featureSet:void 0};const i=e.createQuery();i.returnGeometry=s,i.outFields=t.outFields||["*"],i.outSpatialReference=a,i.gdbVersion=e.gdbVersion,i.objectIds=t.objectIds,r&&(i.where="1=1");const c=l.fromJSON(await o(e,i));return c.features.forEach(r=>{r.sourceLayer=r.layer=u(e)?e.findSublayerForFeature(r):e,r.origin=u(e)?e.findSublayerForFeature(r)?.graphicOrigin:e.graphicOrigin}),{layer:e,featureSet:c}}))).filter(e=>void 0!==e.featureSet)}async function G(e,r){if("Utility Network Layer"===e){const{default:e}=await import("../UtilityNetwork.js");return new e({layerUrl:r})}return null}async function T(t){let o="portalItem"in t?t:{portalItem:t};!o.portalItem||o.portalItem instanceof a||(o={...o,portalItem:new a(o.portalItem)});const n=o.portalItem;if(await n.load(),"Feature Service"!==n.type)throw new r("portal:unknown-item-type","Unknown item type '${type}'",{type:n.type});const s=n.url,u=await e(s,{responseType:"json",query:{f:"json"}}),l="Network Layer";if(u.data.type?.includes(l))return G(u.data.type,s);if(u.data.layers){const e=u.data.layers.find(e=>e.type.includes(l));if(e){const r=`${s}/${e.id}`;return G(e.type,r)}}return null}export{m as doElementsMatchRule,p as doesRuleAllowAssociation,k as getAssetFieldNames,c as getCompatibleRuleElements,d as getElementsFromRule,S as getFeatureAssetCodes,I as getFeatureSourceLayerId,h as getFeaturesFromLayers,w as getRuleValues,f as isRuleElementMatch,y as isTerminalMatch,T as networkFromPortalItem};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.2.0-next.68",
3
+ "version": "5.2.0-next.69",
4
4
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
5
5
  "keywords": [
6
6
  "ArcGIS",
@@ -19,7 +19,7 @@
19
19
  "type": "module",
20
20
  "license": "SEE LICENSE IN LICENSE.md",
21
21
  "dependencies": {
22
- "@amcharts/amcharts5": "~5.20.0",
22
+ "@amcharts/amcharts5": "~5.20.1",
23
23
  "@arcgis/toolkit": "^5.2.0-next.65",
24
24
  "@esri/arcgis-html-sanitizer": "~4.1.0",
25
25
  "@esri/calcite-components": "^5.2.0-next.40",
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- const f="20260804",b="b8e4b7b461e3b01f4f420c2b1fc56ffc05f40a1a";export{f as buildDate,b as commitHash};
2
+ const b="20260805",e="ecfb0d38abbeb070a2507e42648123856d3b756c";export{b as buildDate,e as commitHash};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{identity as e,translate as s,rotate as t,scaleByVec2 as i,multiply as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{createVFMeshData as o,createVFScalarData as l}from"../../../../layers/raster/functions/vectorFieldUtils.js";import{DisplayObject as n}from"../DisplayObject.js";import{Mesh as m}from"../webgl/meshing/Mesh.js";import{PrimitiveType as c,DataType as d}from"../../../webgl/enums.js";import{VertexElementDescriptor as u}from"../../../webgl/VertexElementDescriptor.js";class f extends n{constructor(e=null){super(),this._source=null,this._symbolizerParameters=null,this._meshesInvalidated=!0,this.coordScale=[1,1],this.height=null,this.key=null,this.offset=null,this.stencilRef=0,this.resolution=null,this.pixelRatio=1,this.x=0,this.y=0,this.rotation=0,this.rawPixelData=null,this.meshes=null,this.width=null,this.source=e}destroy(){super.destroy(),null!=this.meshes&&(this.meshes.magdir?.destroy(),this.meshes.scalar?.destroy(),this.meshes=null)}get symbolizerParameters(){return this._symbolizerParameters}set symbolizerParameters(e){JSON.stringify(this._symbolizerParameters)!==JSON.stringify(e)&&(this._symbolizerParameters=e,this.invalidateMeshes())}get source(){return this._source}set source(e){this._source=e,this.invalidateMeshes()}invalidateMeshes(){this._meshesInvalidated||null==this.meshes||(this.meshes.magdir?.destroy(),this.meshes.scalar?.destroy(),this.meshes=null,this._meshesInvalidated=!0,this.requestRender())}updateVectorFieldMesh(e){if(this._meshesInvalidated){if(this._meshesInvalidated=!1,null!=this.source&&null==this.meshes){const{style:s}=this.symbolizerParameters;switch(s){case"beaufort_ft":case"beaufort_km":case"beaufort_kn":case"beaufort_m":case"beaufort_mi":case"classified_arrow":case"ocean_current_kn":case"ocean_current_m":case"single_arrow":{const s=o(this.source,this.symbolizerParameters),t=this._createVectorFieldMesh(e,s);this.meshes={magdir:t}}break;case"simple_scalar":{const s=l(this.source,this.symbolizerParameters),t=this._createVectorFieldMesh(e,s);this.meshes={scalar:t}}break;case"wind_speed":{const s=o(this.source,this.symbolizerParameters),t=this._createVectorFieldMesh(e,s),i=l(this.source,this.symbolizerParameters),r=this._createVectorFieldMesh(e,i);this.meshes={scalar:r,magdir:t}}}}this.ready(),this.requestRender()}}_createTransforms(){return{displayViewScreenMat3:a()}}setTransform(a){const o=e(this.transforms.displayViewScreenMat3),[l,n]=a.toScreenNoRotation([0,0],[this.x,this.y]),m=this.resolution/this.pixelRatio/a.resolution,c=m*this.width,d=m*this.height,u=Math.PI*this.rotation/180;s(o,o,h(l,n)),s(o,o,h(c/2,d/2)),t(o,o,-u),s(o,o,h(-c/2,-d/2)),i(o,o,h(c,d)),r(this.transforms.displayViewScreenMat3,a.displayViewMat3,o)}onAttach(){this.invalidateMeshes()}onDetach(){this.invalidateMeshes()}_createVectorFieldMesh(e,s){const{vertexData:t,indexData:i}=s,r={vertex:{geometry:{data:t,layout:[new u("position",2,d.FLOAT,0,24),new u("offset",2,d.FLOAT,8,24),new u("vv",2,d.FLOAT,16,24)]}},index:{indices:{data:i}},groups:[{index:"indices",primitive:c.TRIANGLES}],parts:[{group:0,start:0,count:i.length}]};return new m(e.context,r)}}export{f as RasterVFDisplayObject};
2
+ import{identity as e,translate as s,scaleByVec2 as t,multiply as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{createVFMeshData as h,createVFScalarData as o}from"../../../../layers/raster/functions/vectorFieldUtils.js";import{DisplayObject as l}from"../DisplayObject.js";import{Mesh as n}from"../webgl/meshing/Mesh.js";import{PrimitiveType as m,DataType as c}from"../../../webgl/enums.js";import{VertexElementDescriptor as d}from"../../../webgl/VertexElementDescriptor.js";class u extends l{constructor(e=null){super(),this._source=null,this._symbolizerParameters=null,this._meshesInvalidated=!0,this.coordScale=[1,1],this.height=null,this.key=null,this.offset=null,this.stencilRef=0,this.resolution=null,this.pixelRatio=1,this.x=0,this.y=0,this.rotation=0,this.rawPixelData=null,this.meshes=null,this.width=null,this.source=e}destroy(){super.destroy(),null!=this.meshes&&(this.meshes.magdir?.destroy(),this.meshes.scalar?.destroy(),this.meshes=null)}get symbolizerParameters(){return this._symbolizerParameters}set symbolizerParameters(e){JSON.stringify(this._symbolizerParameters)!==JSON.stringify(e)&&(this._symbolizerParameters=e,this.invalidateMeshes())}get source(){return this._source}set source(e){this._source=e,this.invalidateMeshes()}invalidateMeshes(){this._meshesInvalidated||null==this.meshes||(this.meshes.magdir?.destroy(),this.meshes.scalar?.destroy(),this.meshes=null,this._meshesInvalidated=!0,this.requestRender())}updateVectorFieldMesh(e){if(this._meshesInvalidated){if(this._meshesInvalidated=!1,null!=this.source&&null==this.meshes){const{style:s}=this.symbolizerParameters;switch(s){case"beaufort_ft":case"beaufort_km":case"beaufort_kn":case"beaufort_m":case"beaufort_mi":case"classified_arrow":case"ocean_current_kn":case"ocean_current_m":case"single_arrow":{const s=h(this.source,this.symbolizerParameters),t=this._createVectorFieldMesh(e,s);this.meshes={magdir:t}}break;case"simple_scalar":{const s=o(this.source,this.symbolizerParameters),t=this._createVectorFieldMesh(e,s);this.meshes={scalar:t}}break;case"wind_speed":{const s=h(this.source,this.symbolizerParameters),t=this._createVectorFieldMesh(e,s),i=o(this.source,this.symbolizerParameters),r=this._createVectorFieldMesh(e,i);this.meshes={scalar:r,magdir:t}}}}this.ready(),this.requestRender()}}_createTransforms(){return{displayViewScreenMat3:r()}}setTransform(r){const h=e(this.transforms.displayViewScreenMat3),[o,l]=r.toScreenNoRotation([0,0],[this.x,this.y]),n=this.resolution/this.pixelRatio/r.resolution,m=n*this.width,c=n*this.height;s(h,h,a(o,l)),t(h,h,a(m,c)),i(this.transforms.displayViewScreenMat3,r.displayViewMat3,h)}onAttach(){this.invalidateMeshes()}onDetach(){this.invalidateMeshes()}_createVectorFieldMesh(e,s){const{vertexData:t,indexData:i}=s,r={vertex:{geometry:{data:t,layout:[new d("position",2,c.FLOAT,0,24),new d("offset",2,c.FLOAT,8,24),new d("vv",2,c.FLOAT,16,24)]}},index:{indices:{data:i}},groups:[{index:"indices",primitive:m.TRIANGLES}],parts:[{group:0,start:0,count:i.length}]};return new n(e.context,r)}}export{u as RasterVFDisplayObject};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../../Color.js";import i from"../../../../Graphic.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as r}from"../../../../core/reactiveUtils.js";import{property as s,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{project as a,initializeProjection as h}from"../../../../geometry/projectionUtils.js";import{isValid as l}from"../../../../geometry/support/spatialReferenceUtils.js";import c from"../../../../layers/GraphicsLayer.js";import p from"../../../../symbols/CIMSymbol.js";import{applyCIMSymbolColor as d}from"../../../../symbols/support/cimSymbolUtils.js";import{DragManipulation as y}from"./manipulations/DragManipulation.js";import{primaryKey as m}from"../../../input/keys.js";import{InteractiveToolBase as _}from"../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as g}from"../../../interactive/editGeometry/EditGeometryOperations.js";const f={up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",toggleOpacity:"t",shift:"Shift",primaryKey:m},u=1,P=10,v=new e("#009af2");let S=class extends _{constructor(t){super(t),this._isOpacityToggled=!1,this._isModifierActive=!1,this._factor=1,this._initialControlPoints=null,this._graphicsLayer=new c({internal:!0,listMode:"hide",visible:!1,effect:"drop-shadow(0px, 0px, 3px)",title:"ControlPointsTransformationTool layer"}),this._undoStack=[],this._redoStack=[],this._sharedUndoStack=[],this._sharedRedoStack=[],this._highlightHandle=null,this.activeHandle=0,this.type="reshape"}initialize(){this._initialize()}destroy(){const{map:t}=this.view;this._controlPointManipulations.forEach(t=>t.destroy()),this._controlPointEditGeometryOperations.forEach(t=>t.destroy()),t.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=o(this._graphicsLayer),this._georeference=null,this._controlPointGraphics=null,this._controlPointManipulations=null,this._graphicsLayer=null,this._controlPointEditGeometryOperations=null,this._undoStack=null,this._redoStack=null,this._initialControlPoints=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _hasValidSpatialReference(){return l(this.view.spatialReference)}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){const t=this._undoStack[this._undoStack.length-1];return null!=t&&this._controlPointEditGeometryOperations[t].canUndo}canRedo(){const t=this._redoStack[this._redoStack.length-1];return null!=t&&this._controlPointEditGeometryOperations[t].canRedo}undo(){if(this._undoStack.length>0){const t=this._undoStack.pop();this._controlPointEditGeometryOperations[t].undo(),this.updateGraphics(),this._redoStack.push(t)}}redo(){if(this._redoStack.length>0){const t=this._redoStack.pop();this._controlPointEditGeometryOperations[t].redo(),this.updateGraphics(),this._undoStack.push(t)}}refresh(){const{mediaElement:t}=this;if(null==t.georeference)return;const e=t.georeference;"control-points"===e.type&&null!=e.coords&&(this._georeference=e,this._georeference.controlPoints.forEach(({mapPoint:t},e)=>{const i=this._controlPointEditGeometryOperations[e],o=i.data.parts[0].vertices[0];i.setVertexPosition(o,i.data.coordinateHelper.pointToVector(t))}),this.updateGraphics())}reset(){this._georeference.controlPoints=this._initialControlPoints,this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const t=this._georeference,e=t.controlPoints,i=e[0].mapPoint.spatialReference,o=this._hasValidSpatialReference;this._georeference.controlPoints=this._controlPointEditGeometryOperations.map((r,s)=>{const n=r.data.geometry;return this._controlPointGraphics[s].geometry=n,{mapPoint:a(n,i),sourcePoint:o?e[s].sourcePoint:t.toSource(n)}})}updateActiveHandle(t){if(this.activeHandle===t)return;const e=this._controlPointGraphics[this.activeHandle].symbol.clone();d(e,this.view.effectiveTheme.accentColor),this._controlPointGraphics[this.activeHandle].symbol=e;const i=this._controlPointGraphics[t].symbol.clone();d(i,v),this._controlPointGraphics[t].symbol=i,this.activeHandle=t,this.view.surface===document.activeElement&&this.highlightActiveHandle()}async highlightActiveHandle(){this.removeHighlightActiveHandle();const t=await this.view.whenLayerView(this._graphicsLayer);this._highlightHandle=t.highlight(this._controlPointGraphics[this.activeHandle])}removeHighlightActiveHandle(){this._highlightHandle&&this._highlightHandle.remove()}setSharedUndoStack(t){this._sharedUndoStack=t}setSharedRedoStack(t){this._sharedRedoStack=t}async _initialize(){const{view:t,mediaElement:e}=this;if(null==e.georeference)return;const o=e.georeference;"control-points"===o.type&&null!=o.coords&&(this._georeference=o,this._initialControlPoints=this._georeference.controlPoints,t.map.addMany([this._graphicsLayer]),t.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._controlPointEditGeometryOperations=this._georeference.controlPoints.map(({mapPoint:e})=>g.fromGeometry(a(e,t.spatialReference),2)),this._controlPointGraphics=this._controlPointEditGeometryOperations.map((t,e)=>new i({symbol:new p({data:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,colorLocked:!0,anchorPoint:{x:0,y:-15.75},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:9,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:84.3,ymax:84.3},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[83.2,32.5],[84.3,40.7],[83.8,48.9],[81.7,56.9],[78.1,64.3],[73,70.9],[66.9,76.4],[59.7,80.5],[51.9,83.2],[43.7,84.3],[35.4,83.8],[27.4,81.7],[20,78],[13.4,73],[7.9,66.8],[3.8,59.7],[1.1,51.9],[0,43.7],[.5,35.4],[2.6,27.4],[6.3,20],[11.3,13.4],[17.5,7.9],[24.7,3.8],[32.5,1.1],[39.8,.1],[47.1,.3],[54.3,1.8],[61.1,4.5],[67.4,8.4],[72.9,13.3],[77.4,19.1],[80.9,25.5],[83.2,32.5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[84.3,0],[84.3,84.3],[0,84.3],[0,0]]]}},rotation:0},{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:-11.25},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:22.5,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:197.7,ymax:294.7},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[98.9,0],[119.4,23.2],[139.4,49.3],[156.8,75.2],[171.2,100.8],[182.4,125.3],[190.6,148.8],[195.7,171.4],[197.7,192.9],[197.7,195.8],[197.7,200.3],[197.6,202.5],[197.5,204.8],[197.3,207.1],[197,209.4],[196.7,211.7],[196.4,214.1],[196,216.4],[195.5,218.7],[195,221.1],[194.4,223.4],[193.7,225.8],[193,228.1],[192.2,230.5],[191.4,232.8],[190.5,235.1],[189.5,237.5],[188.5,239.7],[187.4,242],[186.2,244.3],[185,246.5],[183.7,248.7],[182.4,250.9],[181,253.1],[179.5,255.2],[178,257.3],[176.4,259.4],[174.7,261.4],[173.1,263.3],[171.3,265.3],[169.5,267.2],[167.7,269],[165.8,270.8],[163.9,272.5],[161.9,274.2],[159.9,275.8],[157.8,277.4],[155.7,278.9],[153.6,280.4],[151.4,281.7],[149.2,283.1],[147,284.4],[144.8,285.6],[142.5,286.7],[140.3,287.8],[138,288.8],[135.7,289.8],[133.4,290.7],[131,291.5],[128.7,292.3],[126.4,293],[124,293.6],[121.7,294.2],[119.4,294.7],[117,295.2],[114.7,295.6],[112.4,296],[110.1,296.3],[107.8,296.5],[105.5,296.7],[103.3,296.8],[101.1,296.9],[98.8,296.9],[83.1,295.7],[67.8,292],[53.3,285.9],[39.9,277.5],[28.1,267.2],[18,255.1],[10,241.5],[4.2,226.9],[.9,211.5],[0,195.8],[.1,192.9],[2.1,171.4],[7.2,148.8],[15.4,125.3],[26.6,100.8],[41,75.2],[58.4,49.3],[78.4,23.2],[98.9,0]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:e===this.activeHandle?v.toArray():this.view.effectiveTheme.accentColor.toArray()}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[197.7,0],[197.7,294.7],[0,294.7],[0,0]]]}},rotation:0}],haloSize:1,scaleX:1,angleAlignment:"Display",angle:0}}}),geometry:t.data.geometry})),this._graphicsLayer.graphics.addMany([...this._controlPointGraphics]),this._controlPointManipulations=this._controlPointGraphics.map(e=>new y({tool:this,view:t,graphic:e})),this.addHandles([...this._controlPointManipulations.map((t,e)=>t.createDragPipeline(this._getInfo.bind(this,e),(t,i)=>{"start"===t.action&&(this._undoStack.push(e),this._redoStack=[],this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0),this.updateGraphics()})),r(()=>this.view.scale,()=>this.active?this.updateGraphics():null)]),this._controlPointManipulations.forEach((t,e)=>{const i=t=>{this.addHandles([t.events.on(["click","grab-changed"],t=>this.updateActiveHandle(e))])};t.forEachManipulator(i)}),this.addHandles([t.on("key-down",i=>{t.activeTool===this&&(i.key!==f.shift||i.repeat||(this._isModifierActive=!0,i.stopPropagation()),i.key!==f.toggleOpacity||i.repeat||(e.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled,i.stopPropagation()),i.key!==f.primaryKey||i.repeat||(this._factor=P,i.stopPropagation()),this._isModifierActive&&(i.key===f.up&&(this._move(0,this._factor),i.stopPropagation()),i.key===f.down&&(this._move(0,-this._factor),i.stopPropagation()),i.key===f.left&&(this._move(-this._factor,0),i.stopPropagation()),i.key===f.right&&(this._move(this._factor,0),i.stopPropagation())))}),t.on("key-up",e=>{t.activeTool===this&&(e.key===f.shift&&(this._isModifierActive=!1,e.stopPropagation()),e.key===f.primaryKey&&(this._factor=u,e.stopPropagation()))})]))}async _loadProjectionEngine(){const t=this._georeference.controlPoints[0].mapPoint;return h(t.spatialReference,this.view.spatialReference)}_getInfo(t){return{editGeometryOperations:this._controlPointEditGeometryOperations[t],constraints:this._hasValidSpatialReference?null:{xmin:0,ymin:0,xmax:this._georeference.width,ymax:this._georeference.height}}}_move(t,e){const i=this._controlPointEditGeometryOperations[this.activeHandle].move(t*this.view.resolution,e*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0,this.updateGraphics()}};t([s()],S.prototype,"_hasValidSpatialReference",null),t([s()],S.prototype,"activeHandle",void 0),t([s({constructOnly:!0,nonNullable:!0})],S.prototype,"mediaElement",void 0),t([s({readOnly:!0})],S.prototype,"type",void 0),t([s({constructOnly:!0})],S.prototype,"view",void 0),S=t([n("esri.views.2d.interactive.editingTools.ControlPointsTransformTool")],S);export{S as ControlPointsTransformTool,f as keys};
2
+ import{__decorate as t}from"tslib";import e from"../../../../Color.js";import i from"../../../../Graphic.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as s}from"../../../../core/reactiveUtils.js";import{property as r,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{project as a,initializeProjection as h}from"../../../../geometry/projectionUtils.js";import{isValid as l}from"../../../../geometry/support/spatialReferenceUtils.js";import c from"../../../../layers/GraphicsLayer.js";import p from"../../../../symbols/CIMSymbol.js";import{applyCIMSymbolColor as d}from"../../../../symbols/support/cimSymbolUtils.js";import{DragManipulation as m}from"./manipulations/DragManipulation.js";import{InteractiveToolBase as y}from"../../../interactive/InteractiveToolBase.js";import{KeyBindings as _,mediaKeys as g}from"../../../interactive/keybindings.js";import{EditGeometryOperations as u}from"../../../interactive/editGeometry/EditGeometryOperations.js";const f=1,v=10,P=new e("#009af2");let S=class extends y{constructor(t){super(t),this._isOpacityToggled=!1,this._factor=f,this._initialControlPoints=null,this._graphicsLayer=new c({internal:!0,listMode:"hide",visible:!1,effect:"drop-shadow(0px, 0px, 3px)",title:"ControlPointsTransformationTool layer"}),this._undoStack=[],this._redoStack=[],this._sharedUndoStack=[],this._sharedRedoStack=[],this._highlightHandle=null,this.activeHandle=0,this.editSourcePoints=!1,this.type="reshape"}initialize(){this._initialize()}destroy(){const{map:t}=this.view;this._controlPointManipulations.forEach(t=>t.destroy()),this._controlPointEditGeometryOperations.forEach(t=>t.destroy()),t.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=o(this._graphicsLayer),this._georeference=null,this._controlPointGraphics=null,this._controlPointManipulations=null,this._graphicsLayer=null,this._controlPointEditGeometryOperations=null,this._undoStack=null,this._redoStack=null,this._initialControlPoints=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _hasValidSpatialReference(){return l(this.view.spatialReference)}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){const t=this._undoStack[this._undoStack.length-1];return null!=t&&this._controlPointEditGeometryOperations[t].canUndo}canRedo(){const t=this._redoStack[this._redoStack.length-1];return null!=t&&this._controlPointEditGeometryOperations[t].canRedo}undo(){if(this._undoStack.length>0){const t=this._undoStack.pop();this._controlPointEditGeometryOperations[t].undo(),this.updateGraphics(),this._redoStack.push(t)}}redo(){if(this._redoStack.length>0){const t=this._redoStack.pop();this._controlPointEditGeometryOperations[t].redo(),this.updateGraphics(),this._undoStack.push(t)}}refresh(){const{mediaElement:t}=this;if(null==t.georeference)return;const e=t.georeference;"control-points"===e.type&&null!=e.coords&&(this._georeference=e,this._georeference.controlPoints.forEach(({mapPoint:t},e)=>{const i=this._controlPointEditGeometryOperations[e],o=i.data.parts[0].vertices[0];i.setVertexPosition(o,i.data.coordinateHelper.pointToVector(t))}),this.updateGraphics())}reset(){this._georeference.controlPoints=this._initialControlPoints,this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const t=this._georeference,e=t.controlPoints,i=e[0].mapPoint.spatialReference,o=this._hasValidSpatialReference;this._georeference.controlPoints=this._controlPointEditGeometryOperations.map((s,r)=>{const n=s.data.geometry;return this._controlPointGraphics[r].geometry=n,{mapPoint:a(n,i),sourcePoint:o&&!this.editSourcePoints?e[r].sourcePoint:t.toSource(n)}})}updateActiveHandle(t){if(this.activeHandle===t)return;const e=this._controlPointGraphics[this.activeHandle].symbol.clone();d(e,this.view.effectiveTheme.accentColor),this._controlPointGraphics[this.activeHandle].symbol=e;const i=this._controlPointGraphics[t].symbol.clone();d(i,P),this._controlPointGraphics[t].symbol=i,this.activeHandle=t,this.view.surface===document.activeElement&&this.highlightActiveHandle()}async highlightActiveHandle(){this.removeHighlightActiveHandle();const t=await this.view.whenLayerView(this._graphicsLayer);this._highlightHandle=t.highlight(this._controlPointGraphics[this.activeHandle])}removeHighlightActiveHandle(){this._highlightHandle&&this._highlightHandle.remove()}setSharedUndoStack(t){this._sharedUndoStack=t}setSharedRedoStack(t){this._sharedRedoStack=t}async _initialize(){const{view:t,mediaElement:e}=this;if(null==e.georeference)return;const o=e.georeference;if("control-points"!==o.type||null==o.coords)return;this._georeference=o,this._initialControlPoints=this._georeference.controlPoints,t.map.addMany([this._graphicsLayer]),t.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._controlPointEditGeometryOperations=this._georeference.controlPoints.map(({mapPoint:e})=>u.fromGeometry(a(e,t.spatialReference),2)),this._controlPointGraphics=this._controlPointEditGeometryOperations.map((t,e)=>new i({symbol:new p({data:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,colorLocked:!0,anchorPoint:{x:0,y:-15.75},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:9,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:84.3,ymax:84.3},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[83.2,32.5],[84.3,40.7],[83.8,48.9],[81.7,56.9],[78.1,64.3],[73,70.9],[66.9,76.4],[59.7,80.5],[51.9,83.2],[43.7,84.3],[35.4,83.8],[27.4,81.7],[20,78],[13.4,73],[7.9,66.8],[3.8,59.7],[1.1,51.9],[0,43.7],[.5,35.4],[2.6,27.4],[6.3,20],[11.3,13.4],[17.5,7.9],[24.7,3.8],[32.5,1.1],[39.8,.1],[47.1,.3],[54.3,1.8],[61.1,4.5],[67.4,8.4],[72.9,13.3],[77.4,19.1],[80.9,25.5],[83.2,32.5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[84.3,0],[84.3,84.3],[0,84.3],[0,0]]]}},rotation:0},{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:-11.25},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:22.5,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:197.7,ymax:294.7},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[98.9,0],[119.4,23.2],[139.4,49.3],[156.8,75.2],[171.2,100.8],[182.4,125.3],[190.6,148.8],[195.7,171.4],[197.7,192.9],[197.7,195.8],[197.7,200.3],[197.6,202.5],[197.5,204.8],[197.3,207.1],[197,209.4],[196.7,211.7],[196.4,214.1],[196,216.4],[195.5,218.7],[195,221.1],[194.4,223.4],[193.7,225.8],[193,228.1],[192.2,230.5],[191.4,232.8],[190.5,235.1],[189.5,237.5],[188.5,239.7],[187.4,242],[186.2,244.3],[185,246.5],[183.7,248.7],[182.4,250.9],[181,253.1],[179.5,255.2],[178,257.3],[176.4,259.4],[174.7,261.4],[173.1,263.3],[171.3,265.3],[169.5,267.2],[167.7,269],[165.8,270.8],[163.9,272.5],[161.9,274.2],[159.9,275.8],[157.8,277.4],[155.7,278.9],[153.6,280.4],[151.4,281.7],[149.2,283.1],[147,284.4],[144.8,285.6],[142.5,286.7],[140.3,287.8],[138,288.8],[135.7,289.8],[133.4,290.7],[131,291.5],[128.7,292.3],[126.4,293],[124,293.6],[121.7,294.2],[119.4,294.7],[117,295.2],[114.7,295.6],[112.4,296],[110.1,296.3],[107.8,296.5],[105.5,296.7],[103.3,296.8],[101.1,296.9],[98.8,296.9],[83.1,295.7],[67.8,292],[53.3,285.9],[39.9,277.5],[28.1,267.2],[18,255.1],[10,241.5],[4.2,226.9],[.9,211.5],[0,195.8],[.1,192.9],[2.1,171.4],[7.2,148.8],[15.4,125.3],[26.6,100.8],[41,75.2],[58.4,49.3],[78.4,23.2],[98.9,0]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:e===this.activeHandle?P.toArray():this.view.effectiveTheme.accentColor.toArray()}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[197.7,0],[197.7,294.7],[0,294.7],[0,0]]]}},rotation:0}],haloSize:1,scaleX:1,angleAlignment:"Display",angle:0}}}),geometry:t.data.geometry})),this._graphicsLayer.graphics.addMany([...this._controlPointGraphics]),this._controlPointManipulations=this._controlPointGraphics.map(e=>new m({tool:this,view:t,graphic:e})),this.addHandles([...this._controlPointManipulations.map((t,e)=>t.createDragPipeline(this._getInfo.bind(this,e),(t,i)=>{"start"===t.action&&(this._undoStack.push(e),this._redoStack=[],this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0),this.updateGraphics()})),s(()=>this.view.scale,()=>this.active?this.updateGraphics():null)]),this._controlPointManipulations.forEach((t,e)=>{const i=t=>{this.addHandles([t.events.on(["click","grab-changed"],t=>this.updateActiveHandle(e))])};t.forEachManipulator(i)});const r=new _;r.add(g.toggleOpacity,()=>{t.activeTool===this&&(e.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),r.addToggle(g.factorModifier,e=>{t.activeTool===this&&(this._factor="key-down"===e.type?v:f)}),r.add(g.moveUp,()=>{t.activeTool===this&&this._move(0,this._factor)}),r.add(g.moveDown,()=>{t.activeTool===this&&this._move(0,-this._factor)}),r.add(g.moveLeft,()=>{t.activeTool===this&&this._move(-this._factor,0)}),r.add(g.moveRight,()=>{t.activeTool===this&&this._move(this._factor,0)}),this.addHandles([r.register(t)])}async _loadProjectionEngine(){const t=this._georeference.controlPoints[0].mapPoint;return h(t.spatialReference,this.view.spatialReference)}_getInfo(t){return{editGeometryOperations:this._controlPointEditGeometryOperations[t],constraints:this._hasValidSpatialReference?null:{xmin:0,ymin:0,xmax:this._georeference.width,ymax:this._georeference.height}}}_move(t,e){const i=this._controlPointEditGeometryOperations[this.activeHandle].move(t*this.view.resolution,e*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0,this.updateGraphics()}};t([r()],S.prototype,"_hasValidSpatialReference",null),t([r()],S.prototype,"activeHandle",void 0),t([r()],S.prototype,"editSourcePoints",void 0),t([r({constructOnly:!0,nonNullable:!0})],S.prototype,"mediaElement",void 0),t([r({readOnly:!0})],S.prototype,"type",void 0),t([r({constructOnly:!0})],S.prototype,"view",void 0),S=t([n("esri.views.2d.interactive.editingTools.ControlPointsTransformTool")],S);export{S as ControlPointsTransformTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{destroyHandle as o,makeHandle as i,abortHandle as s}from"../../../../core/handleUtils.js";import{debounce as n}from"../../../../core/promiseUtils.js";import{initial as r}from"../../../../core/reactiveUtils.js";import{property as l,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../../../../core/support/UpdatingHandles.js";import{ViewEventPriorities as h}from"../../../input/InputManager.js";const c={redo:"r",undo:"z"},p=Symbol(),m=Symbol(),_=Symbol();let u=class extends t{constructor(e){super(e),this._tool=null,this._updatingHandles=new d,this.enabled=!1,this._onPointerMove=n(async e=>{const t=await this._updatingHandles.addPromise(this._findElementAtScreenPoint(e));this.destroyed||(this.removeHandles(m),t&&t!==this.selectedElement&&this.addHandles(this.view.acquireCursor("pointer","high"),m))})}initialize(){this.addHandles(o(this._updatingHandles)),this._updatingHandles.add(()=>this.enabled,e=>this._setEnabled(e),r),this._updatingHandles.add(()=>this._preferredInteractionTool,()=>this._preferredInteractionToolChanged())}get _validatedSelectedElement(){const e=this.selectedElement;if(!e)return null;const{layer:{source:t}}=this;return t?"hasElement"in t?t.hasElement(e)?e:null:t===e?e:null:null}get _preferredInteractionTool(){return this.options?.tool??"transform"}get updating(){return this._updatingHandles.updating}_setEnabled(e){if(this.removeHandles(p),!e)return;const{view:t}=this;this.addHandles([t.on("immediate-click",e=>this._onClick(e),h.TOOL),t.on("pointer-move",e=>this._onPointerMove(e).catch(()=>{}),h.TOOL),t.on("key-down",e=>{e.key===c.undo&&this._tool?.canUndo()&&(this._tool.undo(),e.stopPropagation()),e.key===c.redo&&this._tool?.canRedo()&&(this._tool.redo(),e.stopPropagation())}),this._updatingHandles.add(()=>this._validatedSelectedElement,e=>this._selectedElementChanged(e),r),i(()=>{this.removeHandles(m),this._removeTool()})],p)}async _findElementAtScreenPoint(e){const t=(await this.view.hitTest(e,{include:[this.layer]})).results[0];return"media"===t?.type?t.element:null}async _onClick(e){await this._updatingHandles.addPromise(e.defer(async()=>{const t=await this._findElementAtScreenPoint(e);this.destroyed||(t&&e.stopPropagation(),this.selectedElement=t,this.selectedElement&&this.removeHandles(m))}))}_preferredInteractionToolChanged(){const{_tool:e}=this;e&&(this._preferredInteractionTool===e.type||this._updatingHandles.consumePromise(this._recreateTool()))}async _recreateTool(){this.removeHandles(_),this._removeTool();const e=this._validatedSelectedElement;if(!e)return;const t=new AbortController;this.addHandles(s(t),_);const{TransformTool:o,ControlPointsTransformTool:n}=await import("../../interactive/editingTools.js");if(t.signal.aborted)return;const{view:r}=this;switch(this._preferredInteractionTool){case"transform":this._tool=new o({target:e,view:r});break;case"reshape":this._tool=new n({mediaElement:e,view:r})}this.addHandles(i(()=>{this._tool&&(r.tools.remove(this._tool),this._tool=null)}),this._tool),r.addAndActivateTool(this._tool)}_removeTool(){this._tool&&this.removeHandles(this._tool)}async _selectedElementChanged(e){e?.georeference?await this._updatingHandles.addPromise(this._recreateTool()):this._removeTool()}};e([l()],u.prototype,"_validatedSelectedElement",null),e([l()],u.prototype,"_preferredInteractionTool",null),e([l({constructOnly:!0})],u.prototype,"view",void 0),e([l({constructOnly:!0})],u.prototype,"layer",void 0),e([l()],u.prototype,"selectedElement",void 0),e([l()],u.prototype,"enabled",void 0),e([l()],u.prototype,"options",void 0),e([l()],u.prototype,"updating",null),u=e([a("esri.views.2d.layers.support.MediaLayerInteraction")],u);export{u as MediaLayerInteraction};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{destroyHandle as o,makeHandle as i,abortHandle as s}from"../../../../core/handleUtils.js";import{debounce as n}from"../../../../core/promiseUtils.js";import{initial as r}from"../../../../core/reactiveUtils.js";import{property as d,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as a}from"../../../../core/support/UpdatingHandles.js";import{ViewEventPriorities as h}from"../../../input/InputManager.js";import{mediaKeys as c}from"../../../interactive/keybindings.js";const p={redo:"r",undo:"z"},u=Symbol(),_=Symbol(),m=Symbol();let y=class extends t{constructor(e){super(e),this._tool=null,this._updatingHandles=new a,this._editSourcePointsEnabled=!1,this.enabled=!1,this._onPointerMove=n(async e=>{const t=await this._updatingHandles.addPromise(this._findElementAtScreenPoint(e));this.destroyed||(this.removeHandles(_),t&&t!==this.selectedElement&&this.addHandles(this.view.acquireCursor("pointer","high"),_))})}initialize(){this.addHandles(o(this._updatingHandles)),this._updatingHandles.add(()=>this.enabled,e=>this._setEnabled(e),r),this._updatingHandles.add(()=>this._preferredInteractionTool,()=>this._preferredInteractionToolChanged()),this._updatingHandles.add(()=>this.editSourcePoints,()=>this._editSourcePointsChanged())}get _validatedSelectedElement(){const e=this.selectedElement;if(!e)return null;const{layer:{source:t}}=this;return t?"hasElement"in t?t.hasElement(e)?e:null:t===e?e:null:null}get _preferredInteractionTool(){return this.options?.tool??"transform"}get editSourcePoints(){return!!this.options?.reshapeOptions.editSourcePoints!==this._editSourcePointsEnabled}get updating(){return this._updatingHandles.updating}_setEnabled(e){if(this.removeHandles(u),!e)return;const{view:t}=this;this.addHandles([t.on("immediate-click",e=>this._onClick(e),h.TOOL),t.on("pointer-move",e=>this._onPointerMove(e).catch(()=>{}),h.TOOL),t.on("key-down",e=>{e.key===p.undo&&this._tool?.canUndo()&&(this._tool.undo(),e.stopPropagation()),e.key===p.redo&&this._tool?.canRedo()&&(this._tool.redo(),e.stopPropagation()),e.key===c.editSourcePoints.key&&(this._editSourcePointsEnabled=!0,"reshape"===this._tool?.type&&(this._tool.editSourcePoints=this.editSourcePoints))}),t.on("key-up",e=>{e.key===c.editSourcePoints.key&&(this._editSourcePointsEnabled=!1,"reshape"===this._tool?.type&&(this._tool.editSourcePoints=this.editSourcePoints))}),this._updatingHandles.add(()=>this._validatedSelectedElement,e=>this._selectedElementChanged(e),r),i(()=>{this.removeHandles(_),this._removeTool()})],u)}async _findElementAtScreenPoint(e){const t=(await this.view.hitTest(e,{include:[this.layer]})).results[0];return"media"===t?.type?t.element:null}_editSourcePointsChanged(){"reshape"===this._tool?.type&&(this._tool.editSourcePoints=this.editSourcePoints)}async _onClick(e){await this._updatingHandles.addPromise(e.defer(async()=>{const t=await this._findElementAtScreenPoint(e);this.destroyed||(t&&e.stopPropagation(),this.selectedElement=t,this.selectedElement&&this.removeHandles(_))}))}_preferredInteractionToolChanged(){const{_tool:e}=this;e&&(this._preferredInteractionTool===e.type||this._updatingHandles.consumePromise(this._recreateTool()))}async _recreateTool(){this.removeHandles(m),this._removeTool();const e=this._validatedSelectedElement;if(!e)return;const t=new AbortController;this.addHandles(s(t),m);const{TransformTool:o,ControlPointsTransformTool:n}=await import("../../interactive/editingTools.js");if(t.signal.aborted)return;const{view:r}=this;switch(this._preferredInteractionTool){case"transform":this._tool=new o({target:e,view:r});break;case"reshape":this._tool=new n({mediaElement:e,view:r}),this._tool.editSourcePoints=this.editSourcePoints}this.addHandles(i(()=>{this._tool&&(r.tools.remove(this._tool),this._tool=null)}),this._tool),r.addAndActivateTool(this._tool)}_removeTool(){this._tool&&this.removeHandles(this._tool)}async _selectedElementChanged(e){e?.georeference?await this._updatingHandles.addPromise(this._recreateTool()):this._removeTool()}};e([d()],y.prototype,"_validatedSelectedElement",null),e([d()],y.prototype,"_preferredInteractionTool",null),e([d()],y.prototype,"_editSourcePointsEnabled",void 0),e([d()],y.prototype,"editSourcePoints",null),e([d({constructOnly:!0})],y.prototype,"view",void 0),e([d({constructOnly:!0})],y.prototype,"layer",void 0),e([d()],y.prototype,"selectedElement",void 0),e([d()],y.prototype,"enabled",void 0),e([d()],y.prototype,"options",void 0),e([d()],y.prototype,"updating",null),y=e([l("esri.views.2d.layers.support.MediaLayerInteraction")],y);export{y as MediaLayerInteraction};
@@ -0,0 +1,46 @@
1
+ import type Accessor from "../../../../core/Accessor.js";
2
+ import type MediaLayerInteractionReshapeOptions from "./MediaLayerInteractionReshapeOptions.js";
3
+ import type { MediaLayerInteractionReshapeOptionsProperties } from "./MediaLayerInteractionReshapeOptions.js";
4
+
5
+ /** @since 5.2 */
6
+ export interface MediaLayerInteractionOptionsProperties extends Partial<Pick<MediaLayerInteractionOptions, "tool">> {
7
+ /**
8
+ * Changes the behavior of the `reshape` tool.
9
+ *
10
+ * @since 5.2
11
+ */
12
+ reshapeOptions?: MediaLayerInteractionReshapeOptionsProperties;
13
+ }
14
+
15
+ /**
16
+ * Options for when the media layer view is interactive in 2D.
17
+ * Configure the interaction tool and reshape behavior for media elements.
18
+ *
19
+ * @since 5.2
20
+ */
21
+ export class MediaLayerInteractionOptions extends Accessor {
22
+ constructor(properties?: MediaLayerInteractionOptionsProperties);
23
+ /**
24
+ * Changes the behavior of the `reshape` tool.
25
+ *
26
+ * @since 5.2
27
+ */
28
+ get reshapeOptions(): MediaLayerInteractionReshapeOptions;
29
+ set reshapeOptions(value: MediaLayerInteractionReshapeOptionsProperties);
30
+ /**
31
+ * The type of tool to use
32
+ * to interact with media elements.
33
+ *
34
+ * Value | Description |
35
+ * ----- | ----------- |
36
+ * transform | The media element can be moved, scaled and rotated as a whole (**default**).
37
+ * reshape | The corners of the media element can be moved individually.
38
+ *
39
+ * @default "transform"
40
+ * @since 5.2
41
+ */
42
+ accessor tool: MediaLayerInteractionTool;
43
+ }
44
+
45
+ /** @since 5.2 */
46
+ export type MediaLayerInteractionTool = "transform" | "reshape";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import r from"../../../../core/Accessor.js";import{property as t,subclass as s}from"../../../../core/accessorSupport/decorators.js";let e=class extends r{constructor(o){super(o),this.tool="transform"}};o([t()],e.prototype,"tool",void 0),e=o([s("esri.views.2d.layers.support.MediaLayerInteractionOptions")],e);export{e as MediaLayerInteractionOptions};
2
+ import{__decorate as o}from"tslib";import r from"../../../../core/Accessor.js";import{property as t,subclass as e}from"../../../../core/accessorSupport/decorators.js";import s from"./MediaLayerInteractionReshapeOptions.js";let p=class extends r{constructor(o){super(o),this.tool="transform",this.reshapeOptions=new s}};o([t()],p.prototype,"tool",void 0),o([t({type:s})],p.prototype,"reshapeOptions",void 0),p=o([e("esri.views.2d.layers.support.MediaLayerInteractionOptions")],p);export{p as MediaLayerInteractionOptions};
@@ -0,0 +1,22 @@
1
+ import type Accessor from "../../../../core/Accessor.js";
2
+
3
+ /** @since 5.2 */
4
+ export interface MediaLayerInteractionReshapeOptionsProperties extends Partial<Pick<MediaLayerInteractionReshapeOptions, "editSourcePoints">> {}
5
+
6
+ /**
7
+ * Options that change the behavior of the `reshape` interaction tool in 2D.
8
+ *
9
+ * @since 5.2
10
+ */
11
+ export default class MediaLayerInteractionReshapeOptions extends Accessor {
12
+ constructor(properties?: MediaLayerInteractionReshapeOptionsProperties);
13
+ /**
14
+ * Indicates if the source point should be edited when moving a control point.
15
+ * Only applies if the selected media element has a
16
+ * [ControlPointsGeoreference](https://developers.arcgis.com/javascript/latest/references/core/layers/support/ControlPointsGeoreference/).
17
+ *
18
+ * @default false
19
+ * @since 5.2
20
+ */
21
+ accessor editSourcePoints: boolean;
22
+ }
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as o}from"tslib";import r from"../../../../core/Accessor.js";import{property as e,subclass as s}from"../../../../core/accessorSupport/decorators.js";let t=class extends r{constructor(o){super(o),this.editSourcePoints=!1}};o([e()],t.prototype,"editSourcePoints",void 0),t=o([s("esri.views.2d.layers.support.MediaLayerInteractionReshapeOptions")],t);const i=t;export{i as default};