@arcgis/core 4.27.0-next.20230321 → 4.27.0-next.20230322
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/LineOfSightAnalysisObserver.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/02b6227c156ee0d8eb66.js +1 -0
- package/assets/esri/core/workers/chunks/{7e0c65aa61c2ff0c3504.js → 1c98b92933a48cf96c1e.js} +1 -1
- package/assets/esri/core/workers/chunks/321f272d4c7ed6b0cb46.js +1 -0
- package/assets/esri/core/workers/chunks/47bd558e2ce89f47f908.js +1 -0
- package/assets/esri/core/workers/chunks/76d6c1fc25f02bcf258e.js +1 -0
- package/assets/esri/core/workers/chunks/{c5d872adce711ec61ede.js → 8980c5dc389c27368b73.js} +1 -1
- package/assets/esri/core/workers/chunks/8d0143c0ff009b98a31f.js +1 -0
- package/assets/esri/core/workers/chunks/{6acaf28cba5d49a98fb6.js → 91b292f310f06a0cbf72.js} +1 -1
- package/assets/esri/core/workers/chunks/{ff9efa829497557ec26a.js → aa4640a0207e0be224e2.js} +1 -1
- package/assets/esri/core/workers/chunks/{92951b85676df776961f.js → ab8139e3a875a8b8dab9.js} +23 -25
- package/assets/esri/core/workers/chunks/{c8cd3fde6d8d43ddb954.js → b6cdf4daf07d9e55f61e.js} +1 -1
- package/assets/esri/core/workers/chunks/{6b14673a4afd6ef81487.js → c76cabd2d2510a653dff.js} +1 -1
- package/assets/esri/core/workers/chunks/{4be7647605300e07e843.js → c90fff7e28ba5b443b11.js} +1 -1
- package/assets/esri/core/workers/chunks/{e637e47000f4dc48054d.js → cc7f4fd20443a2acf0f1.js} +1 -1
- package/assets/esri/core/workers/chunks/d19e9fab4f4fb765c6a3.js +1 -0
- package/assets/esri/core/workers/chunks/d9ef4891c8b0bdd90f5b.js +1 -0
- package/assets/esri/core/workers/chunks/{d92d6a43270fb0d366b4.js → de4f5c48efbcee82c3c1.js} +1 -1
- package/assets/esri/core/workers/chunks/{32f9b488915a4a8864e5.js → f8b9e0c1671e55b61904.js} +1 -1
- package/assets/esri/views/3d/analysis/Slice/images/heading-rotate.ts.svg +7 -28
- package/assets/esri/views/3d/analysis/Slice/images/tilt-rotate.ts.svg +11 -0
- package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_nb.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
- package/chunks/ComponentShader.glsl.js +1 -1
- package/chunks/DefaultMaterial.glsl.js +4 -4
- package/chunks/vec42.js +1 -1
- package/core/Loadable.js +1 -1
- package/core/accessorSupport/Property.js +1 -1
- package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
- package/geometry/support/buffer/math/vec4.js +1 -1
- package/interfaces.d.ts +1 -1
- package/layers/LineOfSightLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/mixins/RefreshableLayer.js +1 -1
- package/layers/support/rasterFunctions/clipUtils.js +1 -1
- package/layers/support/rasterFunctions/stretchUtils.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/images/Factory.js +1 -1
- package/views/3d/analysis/Slice/images/generateTextures.js +1 -1
- package/views/3d/analysis/Slice/images/heading-rotate-svg.js +1 -1
- package/views/3d/analysis/Slice/images/tilt-rotate-svg.js +5 -0
- package/views/3d/analysis/Slice/settings.js +5 -0
- package/views/3d/environment/Stars.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudWorker.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/i3s/PointCloudRendererUtil.js +1 -1
- package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
- package/views/3d/layers/i3s/PointGraphic.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/controllers/SurfaceCollisionCorrectionController.js +1 -1
- package/views/3d/terrain/GeometryState.js +1 -1
- package/views/3d/terrain/PatchGeometry.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +6 -5
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +11 -11
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeShadingNormal.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/AnimationTimeStep.js +1 -1
- package/views/3d/webgl-engine/lib/AttributeArray.js +1 -1
- package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
- package/views/3d/webgl-engine/lib/Normals.js +5 -0
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/LayerViewManager.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/layers/SceneLayerView.js +1 -1
- package/views/webgl/ShaderTranspiler.js +1 -1
- package/widgets/Expand.js +1 -1
- package/assets/esri/core/workers/chunks/0487ab23a20ec356ab4c.js +0 -1
- package/assets/esri/core/workers/chunks/29ee4f14602caf6967e4.js +0 -1
- package/assets/esri/core/workers/chunks/2c0775541cfec9d43acb.js +0 -1
- package/assets/esri/core/workers/chunks/4879164b48da9ad4547a.js +0 -1
- package/assets/esri/core/workers/chunks/69060e5cffc19e76062a.js +0 -1
- package/assets/esri/core/workers/chunks/a71a5c8a9aa302bf6f01.js +0 -1
- package/assets/esri/core/workers/chunks/bc002e4dff8859571a7a.js +0 -1
- package/assets/esri/views/3d/analysis/Slice/images/tilt-rotate.svg +0 -80
- package/assets/esri/views/3d/analysis/Slice/images/tilt-rotate.ts.png +0 -0
- package/views/3d/analysis/Slice/images/tilt-rotate-png.js +0 -5
- package/views/3d/webgl-engine/core/shaderLibrary/util/DecodeNormal.glsl.js +0 -8
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{I as e}from"./mat4f64.js";import{ForwardLinearDepth as r}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js";import{Offset as o}from"../views/3d/webgl-engine/core/shaderLibrary/Offset.glsl.js";import{ShaderOutput as a}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as i}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as l}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{InstancedDoublePrecision as s}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import{NormalAttribute as t,
|
|
5
|
+
import{I as e}from"./mat4f64.js";import{ForwardLinearDepth as r}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js";import{Offset as o}from"../views/3d/webgl-engine/core/shaderLibrary/Offset.glsl.js";import{ShaderOutput as a}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as i}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as l}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{InstancedDoublePrecision as s}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import{NormalAttribute as t,NormalType as n}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{PositionAttribute as d}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js";import{SymbolColor as c}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js";import{TextureCoordinateAttribute as m}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{VertexColor as g}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js";import{VertexNormal as u}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js";import{VerticalOffset as p}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{DefaultMaterialAuxiliaryPasses as v}from"../views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import{ComputeNormalTexture as h}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import{EvaluateAmbientOcclusion as f}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import{EvaluateSceneLighting as b,addAmbientBoostFactor as w,addLightingGlobalFactor as x}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{addMainLightIntensity as y}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{multipassTerrainTest as C}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import{Normals as T}from"../views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js";import{PhysicallyBasedRendering as L}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import{PhysicallyBasedRenderingParameters as j,PBRMode as M}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{ReadShadowMapPass as P,ReadShadowMapDraw as $}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{colorTextureUV as O,normalTextureUV as A,emissiveTextureUV as N,occlusionTextureUV as S,metallicRoughnessTextureUV as E}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TextureTransformUV.glsl.js";import{VisualVariables as V}from"../views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js";import{symbolAlphaCutoff as D}from"../views/3d/webgl-engine/core/shaderLibrary/util/AlphaCutoff.js";import{DiscardOrAdjustAlphaPass as _}from"../views/3d/webgl-engine/core/shaderLibrary/util/AlphaDiscard.glsl.js";import{MixExternalColor as U}from"../views/3d/webgl-engine/core/shaderLibrary/util/MixExternalColor.glsl.js";import{addProjViewLocalOrigin as B,addCameraPosition as F}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float3PassUniform as I}from"../views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js";import{Float4PassUniform as R}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as z}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as W}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{Matrix4PassUniform as G}from"../views/3d/webgl-engine/core/shaderModules/Matrix4PassUniform.js";import{ShaderBuilder as k}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DPassUniform as q}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{TransparencyPassType as H}from"../views/3d/webgl-engine/lib/TransparencyPassType.js";import{VertexAttribute as J}from"../views/3d/webgl-engine/lib/VertexAttribute.js";function K(K){const Q=new k,{vertex:X,fragment:Y,varyings:Z}=Q;if(B(X,K),Q.include(d),Z.add("vpos","vec3"),Q.include(V,K),Q.include(s,K),Q.include(p,K),K.hasColorTextureTransform&&Q.include(O),K.output===a.Color||K.output===a.Alpha){K.hasNormalTextureTransform&&Q.include(A),K.hasEmissionTextureTransform&&Q.include(N),K.hasOcclusionTextureTransform&&Q.include(S),K.hasMetallicRoughnessTextureTransform&&Q.include(E),F(X,K),Q.include(t,K),Q.include(l,K);const a=K.normalType===n.Attribute||K.normalType===n.CompressedAttribute;a&&K.offsetBackfaces&&Q.include(o),Q.include(h,K),Q.include(u,K),K.instancedColor&&Q.attributes.add(J.INSTANCECOLOR,"vec4"),Z.add("vPositionLocal","vec3"),Q.include(m,K),Q.include(r,K),Q.include(c,K),Q.include(g,K),X.uniforms.add(new R("externalColor",(e=>e.externalColor))),Z.add("vcolorExt","vec4"),K.hasMultipassTerrain&&Z.add("depth","float"),K.hasModelTransformation&&X.uniforms.add(new G("model",(r=>null!=r.modelTransformation?r.modelTransformation:e))),X.code.add(W`
|
|
6
6
|
void main(void) {
|
|
7
7
|
forwardNormalizedVertexColor();
|
|
8
8
|
vcolorExt = externalColor;
|
|
@@ -17,11 +17,11 @@ import{I as e}from"./mat4f64.js";import{ForwardLinearDepth as r}from"../views/3d
|
|
|
17
17
|
vpos = calculateVPos();
|
|
18
18
|
vPositionLocal = vpos - view[3].xyz;
|
|
19
19
|
vpos = subtractOrigin(vpos);
|
|
20
|
-
${
|
|
20
|
+
${a?W`vNormalWorld = dpNormal(vvLocalNormal(normalModel()));`:""}
|
|
21
21
|
vpos = addVerticalOffset(vpos, localOrigin);
|
|
22
22
|
${K.hasVertexTangents?"vTangent = dpTransformVertexTangent(tangent);":""}
|
|
23
23
|
gl_Position = transformPosition(proj, view, ${K.hasModelTransformation?"model,":""} vpos);
|
|
24
|
-
${
|
|
24
|
+
${a&&K.offsetBackfaces?"gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);":""}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
${K.hasMultipassTerrain?"depth = (view * vec4(vpos, 1.0)).z;":""}
|
|
@@ -33,7 +33,7 @@ import{I as e}from"./mat4f64.js";import{ForwardLinearDepth as r}from"../views/3d
|
|
|
33
33
|
${K.hasOcclusionTextureTransform?W`forwardOcclusionUV();`:""}
|
|
34
34
|
${K.hasMetallicRoughnessTextureTransform?W`forwardMetallicRoughnessUV();`:""}
|
|
35
35
|
}
|
|
36
|
-
`)
|
|
36
|
+
`)}return K.output===a.Alpha&&(Q.include(i,K),Q.include(_,K),Q.include(C,K),Y.uniforms.add([new z("opacity",(e=>e.opacity)),new z("layerOpacity",(e=>e.layerOpacity))]),K.hasColorTexture&&Y.uniforms.add(new q("tex",(e=>e.texture))),Y.include(U),Y.code.add(W`
|
|
37
37
|
void main() {
|
|
38
38
|
discardBySlice(vpos);
|
|
39
39
|
${K.hasMultipassTerrain?"terrainDepthTest(gl_FragCoord, depth);":""}
|
package/chunks/vec42.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{mathLogger as e}from"../geometry/support/buffer/math/common.js";function t(t,f
|
|
5
|
+
import{mathLogger as e}from"../geometry/support/buffer/math/common.js";function t(t,r,f){if(t.count!==r.count)return void e.error("source and destination buffers need to have the same number of elements");const n=t.count,o=f[0],u=f[1],s=f[2],d=f[3],a=f[4],i=f[5],c=f[6],p=f[7],l=f[8],m=f[9],y=f[10],B=f[11],h=f[12],S=f[13],b=f[14],g=f[15],M=t.typedBuffer,v=t.typedBufferStride,_=r.typedBuffer,j=r.typedBufferStride;for(let e=0;e<n;e++){const t=e*v,r=e*j,f=_[r],n=_[r+1],w=_[r+2],z=_[r+3];M[t]=o*f+a*n+l*w+h*z,M[t+1]=u*f+i*n+m*w+S*z,M[t+2]=s*f+c*n+y*w+b*z,M[t+3]=d*f+p*n+B*w+g*z}}function r(e,t,r){f(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)}function f(t,r,f,n=4,o=n){if(t.length/n!=r.length/o)return void e.error("source and destination buffers need to have the same number of elements");const u=t.length/n,s=f[0],d=f[1],a=f[2],i=f[3],c=f[4],p=f[5],l=f[6],m=f[7],y=f[8];let B=0,h=0;for(let e=0;e<u;e++){const e=r[B],f=r[B+1],u=r[B+2],S=r[B+3];t[h]=s*e+i*f+l*u,t[h+1]=d*e+c*f+m*u,t[h+2]=a*e+p*f+y*u,t[h+3]=S,B+=o,h+=n}}function n(e,t){const r=Math.min(e.count,t.count),f=e.typedBuffer,n=e.typedBufferStride,o=t.typedBuffer,u=t.typedBufferStride;for(let s=0;s<r;s++){const e=s*n,t=s*u,r=o[t],d=o[t+1],a=o[t+2],i=r*r+d*d+a*a;if(i>0){const t=1/Math.sqrt(i);f[e]=t*r,f[e+1]=t*d,f[e+2]=t*a}}}function o(e,t,r){u(e.typedBuffer,t,r,e.typedBufferStride)}function u(e,t,r,f=4){const n=Math.min(e.length/f,t.count),o=t.typedBuffer,u=t.typedBufferStride;let s=0,d=0;for(let a=0;a<n;a++)e[d]=r*o[s],e[d+1]=r*o[s+1],e[d+2]=r*o[s+2],e[d+3]=r*o[s+3],s+=u,d+=f}const s=Object.freeze(Object.defineProperty({__proto__:null,normalize:n,scale:u,scaleView:o,transformMat3:f,transformMat3View:r,transformMat4:t},Symbol.toStringTag,{value:"Module"}));export{r as a,o as b,t as c,n,u as s,f as t,s as v};
|
package/core/Loadable.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../chunks/tslib.es6.js";import t from"./Error.js";import{
|
|
5
|
+
import{_ as o}from"../chunks/tslib.es6.js";import t from"./Error.js";import{abortMaybe as s}from"./maybe.js";import{EsriPromise as r}from"./Promise.js";import{onAbortOrThrow as l,onAbort as e}from"./promiseUtils.js";import a from"./Warning.js";import{property as n}from"./accessorSupport/decorators/property.js";import{subclass as i}from"./accessorSupport/decorators/subclass.js";const d="not-loaded",h="loading",c="failed",u="loaded",p=r=>{let p=class extends r{constructor(...o){super(...o),this._loadController=null,this.loadError=null,this.loadStatus="not-loaded",this._set("loadWarnings",[]),this.addResolvingPromise(new Promise((o=>{const s=this.load.bind(this);this.load=r=>{const a=new Promise(((o,s)=>{const e=l(r,s);this.destroyed&&s(new t("load:instance-destroyed",`Instance of '${this.declaredClass||this.constructor.name}' is already destroyed`,{instance:this})),this._promiseProps.when(o,s).finally((()=>{e&&e.remove()}))}));if(this.loadStatus===d){this._set("loadStatus",h);const o=this._loadController=new AbortController;s({signal:o.signal}),e(o.signal,(()=>{this._promiseProps.abort()}))}return o(),a}}))),this.when((()=>{this._set("loadStatus",u),this._loadController=null}),(o=>{this._set("loadStatus",c),this._set("loadError",o),this._loadController=null}))}destroy(){this._loadController=s(this._loadController),this._set("loadError",null),this._set("loadWarnings",[])}get loaded(){return this.loadStatus===u}get loadWarnings(){return this._get("loadWarnings")}load(){return null}cancelLoad(){return this.isFulfilled()||(this._set("loadError",new t("load:cancelled","Cancelled")),this._loadController?.abort()),this}};return o([n({readOnly:!0})],p.prototype,"loaded",null),o([n({readOnly:!0})],p.prototype,"loadError",void 0),o([n({clonable:!1})],p.prototype,"loadStatus",void 0),o([n({type:[a],readOnly:!0})],p.prototype,"loadWarnings",null),p=o([i("esri.core.Loadable")],p),p};let m=class extends(p(r)){};m=o([i("esri.core.Loadable")],m),function(o){function t(o){return!(!o||!o.load)}o.LoadableMixin=p,o.isLoadable=t}(m||(m={}));const _=m;export{_ as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ObservableBase as t}from"./ObservableBase.js";import{OriginId as e}from"./PropertyOrigin.js";import{trackAccess as s,runTracked as i,trackExplicitDependencies as r,runUntracked as o}from"./tracking.js";import{Flags as n}from"./tracking/Flags.js";class a{constructor(t,e,s){this.properties=t,this.propertyName=e,this.metadata=s,this.observerObject=new l,this._accessed=null,this._handles=null,this.observerObject.flags=n.Dirty|(s.nonNullable?n.NonNullable:0)|(s.hasOwnProperty("value")?n.HasDefaultValue:0)|(void 0===s.get?n.DepTrackingInitialized:0)|(void 0===s.dependsOn?n.AutoTracked:0),c.register(this,this.observerObject,this.
|
|
5
|
+
import{ObservableBase as t}from"./ObservableBase.js";import{OriginId as e}from"./PropertyOrigin.js";import{trackAccess as s,runTracked as i,trackExplicitDependencies as r,runUntracked as o}from"./tracking.js";import{Flags as n}from"./tracking/Flags.js";class a{constructor(t,e,s){this.properties=t,this.propertyName=e,this.metadata=s,this.observerObject=new l,this._accessed=null,this._handles=null,this._finalizationToken={},this.observerObject.flags=n.Dirty|(s.nonNullable?n.NonNullable:0)|(s.hasOwnProperty("value")?n.HasDefaultValue:0)|(void 0===s.get?n.DepTrackingInitialized:0)|(void 0===s.dependsOn?n.AutoTracked:0),c.register(this,new WeakRef(this.observerObject),this._finalizationToken)}destroy(){c.unregister(this._finalizationToken),this.observerObject.destroy(),this._accessed=null,this._clearObservationHandles()}getComputed(){const t=this.observerObject;s(t);const a=this.properties.store,l=this.propertyName,c=t.flags,h=a.get(l);if(c&n.Computing)return h;if(~c&n.Dirty&&a.has(l))return h;t.flags|=n.Computing;const d=this.properties.host;let g;c&n.AutoTracked?g=i(this,this.metadata.get,d):(r(d,this),g=this.metadata.get.call(d)),a.set(l,g,e.COMPUTED);const f=a.get(l);return f===h?t.flags&=~n.Dirty:o(this.commit,this),t.flags&=~n.Computing,f}onObservableAccessed(t){t!==this.observerObject&&(null===this._accessed&&(this._accessed=[]),this._accessed.includes(t)||this._accessed.push(t))}onTrackingEnd(){this._clearObservationHandles();const t=this.observerObject;t.flags|=n.DepTrackingInitialized;const e=this._accessed;if(null===e)return;let s=this._handles;null===s&&(s=this._handles=[]);for(let i=0;i<e.length;++i)s.push(e[i].observe(t));e.length=0}notifyChange(){const t=this.observerObject;t.onInvalidated(),t.onCommitted()}invalidate(){this.observerObject.onInvalidated()}commit(){const t=this.observerObject;t.flags&=~n.Dirty,t.onCommitted()}_clearObservationHandles(){const t=this._handles;if(null!==t){for(let e=0;e<t.length;++e)t[e].remove();t.length=0}}}class l extends t{constructor(){super(...arguments),this.flags=0}onInvalidated(){~this.flags&n.Overriden&&(this.flags|=n.Dirty);const t=this._observers;if(t&&t.length>0)for(const e of t)e.onInvalidated()}onCommitted(){const t=this._observers;if(t&&t.length>0){const e=t.slice();for(const t of e)t.onCommitted()}}destroy(){this.flags&n.Dirty&&this.onCommitted(),super.destroy()}}const c=new FinalizationRegistry((t=>{t.deref()?.destroy()}));export{a as Property};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class t{constructor(t){this._accessed=[],this._handles=[],this._observerObject=new
|
|
5
|
+
class t{constructor(t){this._accessed=[],this._handles=[],this._finalizationToken={},this._observerObject=new e(t),s.register(this,new WeakRef(this._observerObject),this._finalizationToken)}destroy(){s.unregister(this._observerObject),this._accessed.length=0,this._observerObject?.destroy(),this.clear()}onObservableAccessed(t){const e=this._accessed;e.includes(t)||e.push(t)}onTrackingEnd(){const t=this._handles,e=this._accessed,s=this._observerObject;for(let i=0;i<e.length;++i)t.push(e[i].observe(s));e.length=0}clear(){const t=this._handles;for(let e=0;e<t.length;++e)t[e].remove();t.length=0}}class e{constructor(t){this._notify=t,this._invalidCount=0,this.destroyed=!1}onInvalidated(){this._invalidCount++}onCommitted(){if(this.destroyed)return;const t=this._invalidCount;if(1===t)return this._invalidCount=0,void this._notify();this._invalidCount=t>0?t-1:0}destroy(){this.destroyed=!0,this._notify=i}}const s=new FinalizationRegistry((t=>{t.deref()?.destroy()}));function i(){}export{t as SimpleTrackingTarget};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"./common.js";export{n as normalize,s as scale,b as scaleView,
|
|
5
|
+
import"./common.js";export{n as normalize,s as scale,b as scaleView,t as transformMat3,a as transformMat3View,c as transformMat4}from"../../../../chunks/vec42.js";
|
package/interfaces.d.ts
CHANGED
|
@@ -43130,7 +43130,7 @@ declare namespace __esri {
|
|
|
43130
43130
|
*
|
|
43131
43131
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraph-SearchIndex.html#supportedCategory)
|
|
43132
43132
|
*/
|
|
43133
|
-
readonly supportedCategory: "
|
|
43133
|
+
readonly supportedCategory: "esriTypeEntity" | "esriTypeRelationship" | "esriTypeBoth";
|
|
43134
43134
|
/**
|
|
43135
43135
|
* Defines a search index for a [KnowledgeGraph](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraph-KnowledgeGraph.html).
|
|
43136
43136
|
*
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import s from"../analysis/LineOfSightAnalysis.js";import t from"../analysis/LineOfSightAnalysisObserver.js";import r from"../analysis/LineOfSightAnalysisTarget.js";import i from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import{applySome as a}from"../core/maybe.js";import{MultiOriginJSONMixin as n}from"../core/MultiOriginJSONSupport.js";import{watch as l,syncAndInitial as p}from"../core/reactiveUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import m from"./Layer.js";import{OperationalLayer as u}from"./mixins/OperationalLayer.js";const h=i.ofType(r);let d=class extends(u(n(m))){constructor(e){super(e),this.type="line-of-sight",this.operationalLayerType="LineOfSightLayer",this.analysis=new s,this.opacity=1}initialize(){this.addHandles(l((()=>this.analysis),((e,s)=>{null!=s&&s.parent===this&&(s.parent=null),null!=e&&(e.parent=this)}),p))}async load(){return null!=this.analysis&&this.addResolvingPromise(this.analysis.waitComputeExtent()),this}get observer(){return a(this.analysis,(e=>e.observer))}set observer(e){a(this.analysis,(s=>s.observer=e))}get targets(){return null!=this.analysis?this.analysis.targets:new i}set targets(e){o(e,this.analysis?.targets)}get fullExtent(){return null!=this.analysis?this.analysis.extent:null}get spatialReference(){return null!=this.analysis?this.analysis.spatialReference:null}releaseAnalysis(e){this.analysis===e&&(this.analysis=new s)}};e([y({json:{read:!1},readOnly:!0})],d.prototype,"type",void 0),e([y({type:["LineOfSightLayer"]})],d.prototype,"operationalLayerType",void 0),e([y({type:t,json:{read:!0,write:{isRequired:!0,ignoreOrigin:!0}}})],d.prototype,"observer",null),e([y({type:h,json:{read:!0,write:{ignoreOrigin:!0}}})],d.prototype,"targets",null),e([y({nonNullable:!0,json:{read:!1,write:!1}})],d.prototype,"analysis",void 0),e([y({readOnly:!0})],d.prototype,"fullExtent",null),e([y({readOnly:!0})],d.prototype,"spatialReference",null),e([y({readOnly:!0,json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}}})],d.prototype,"opacity",void 0),e([y({type:["show","hide"]})],d.prototype,"listMode",void 0),d=e([c("esri.layers.LineOfSightLayer")],d);const f=d;export{f as default};
|
package/layers/SceneLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import r from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/PieChartRenderer.js";import"../renderers/Renderer.js";import"../renderers/SimpleRenderer.js";import"../renderers/UniqueValueRenderer.js";import"../renderers/support/jsonUtils.js";import{webSceneRendererTypes as s}from"../renderers/support/types.js";import o from"../request.js";import i from"../core/Collection.js";import a from"../core/Error.js";import n from"../core/Logger.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as l,isAbortError as d}from"../core/promiseUtils.js";import{whenOnce as u}from"../core/reactiveUtils.js";import{join as y}from"../core/urlUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{getProperties as f}from"../core/accessorSupport/utils.js";import{reader as h}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as g}from"../core/accessorSupport/PropertyOrigin.js";import v from"./Layer.js";import{APIKeyMixin as b}from"./mixins/APIKeyMixin.js";import{ArcGISService as I}from"./mixins/ArcGISService.js";import{EditBusLayer as w}from"./mixins/EditBusLayer.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{PortalLayer as L}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as S}from"./mixins/ScaleRangeLayer.js";import{SceneService as F,SaveOperationType as O}from"./mixins/SceneService.js";import{zeroCapabilities as T}from"./support/capabilities.js";import{elevationInfo as E,labelsVisible as A,legendEnabled as P,popupEnabled as _,screenSizePerspectiveEnabled as x}from"./support/commonProperties.js";import{FeatureReduction as D}from"./support/FeatureReduction.js";import U from"./support/FeatureReductionSelection.js";import{FetchAssociatedFeatureLayer as R}from"./support/FetchAssociatedFeatureLayer.js";import{defineFieldProperties as C}from"./support/fieldProperties.js";import q from"./support/FieldsIndex.js";import{fixRendererFields as Q,unpackFieldNames as N}from"./support/fieldUtils.js";import{I3SNodePageDefinition as k,I3SMaterialDefinition as G,I3STextureSetDefinition as V,I3SGeometryDefinition as K}from"./support/I3SLayerDefinitions.js";import M from"./support/LabelClass.js";import{reader as $}from"./support/labelingInfo.js";import W from"./support/LayerFloorInfo.js";import{RangeInfo as z}from"./support/RangeInfo.js";import B from"./support/SceneFilter.js";import{loadStyleRenderer as H}from"../renderers/support/styleUtils.js";import Z from"../rest/support/Query.js";import{sceneLayerEditingEnabled as J}from"../support/featureFlags.js";import{createPopupTemplate as X}from"../support/popupUtils.js";import{queryAttributesFromCachedAttributesId as Y}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as ee,getFetchPopupTemplate as te}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as re}from"../webdoc/support/opacityUtils.js";const se=["3DObject","Point"],oe=C();let ie=class extends(w(F(I(j(L(S(p(b(v))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new i,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getFeatureType(t?.feature)?.domains?.[e];return r&&"inherited"!==r.type?r:this.getField(e)?.domain??null}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new q(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:k.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get geometryType(){return ne[this.profile]||"mesh"}set renderer(e){Q(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){const e=this.associatedLayer?.capabilities??T,{query:t,editing:{supportsGlobalId:r,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:i,supportsReturnServiceEditsInSourceSpatialReference:a},data:{supportsZ:n,supportsM:p,isVersioned:l,supportsAttachment:d},operations:{supportsEditing:u,supportsAdd:y,supportsUpdate:c,supportsDelete:f,supportsQuery:h,supportsQueryAttachments:m}}=e,g=e.operations.supportsChangeTracking,v=!!this.associatedLayer?.infoFor3D&&J();return{query:t,editing:{supportsGlobalId:r,supportsReturnServiceEditsInSourceSpatialReference:a,supportsRollbackOnFailure:s,supportsGeometryUpdate:v&&i,supportsUploadWithItemId:o},data:{supportsAttachment:d,supportsZ:n,supportsM:p,isVersioned:l},operations:{supportsQuery:h,supportsQueryAttachments:m,supportsEditing:u&&g,supportsAdd:v&&y&&g,supportsDelete:v&&f&&g,supportsUpdate:c&&g}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.userHasEditingPrivileges}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e))),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e))),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&ae[r]?ae[r]:(n.getLogger(this.declaredClass).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(l).then((()=>this._fetchService(t))).then((()=>Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),null!=this.filter?this.filter.loadGeometries(this.spatialReference):null]))).then((()=>this._validateElevationInfo())).then((()=>this._applyAssociatedLayerOverrides())).then((()=>this._populateFieldUsageInfo())).then((()=>H(this,{origin:"service"},t))).then((()=>Q(this.renderer,this.fieldsIndex))).then((()=>this.finishLoadEditablePortalLayer(e)));return this.addResolvingPromise(r),Promise.resolve(this)}async beforeSave(){null!=this.filter&&await this.load()}createQuery(){const e=new Z;return"mesh"!==this.geometryType&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e}))}async queryCachedAttributes(e,t){const r=N(this.fieldsIndex,await ee(this,te(this)));return Y(this.parsedUrl.path,this.attributeStorageInfo??[],e,t,r)}async queryCachedFeature(e,r){const s=await this.queryCachedAttributes(e,[r]);if(!s||0===s.length)throw new a("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const o=new t;return o.attributes=s[0],o.layer=this,o.sourceLayer=this,o}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryObjectIds(e||this.createQuery(),t)))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryAttachments(e,t)))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(n.getLogger(this.declaredClass).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return X(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new a("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new a("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some((t=>t.name===e))}async queryCachedStatistics(e,t){if(await this.load(t),!this.statisticsInfo)throw new a("scenelayer:no-cached-statistics","Cached statistics are not available for this layer");const r=this.fieldsIndex.get(e);if(!r)throw new a("scenelayer:field-unexisting",`Field '${e}' does not exist on the layer`);for(const s of this.statisticsInfo)if(s.name===r.name){const e=y(this.parsedUrl.path,s.href);return o(e,{query:{f:"json",token:this.apiKey},responseType:"json",signal:t?t.signal:null}).then((e=>e.data))}throw new a("scenelayer:no-cached-statistics","Cached statistics for this attribute are not available")}async saveAs(e,t){return this._debouncedSaveOperations(O.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(O.SAVE,e)}async applyEdits(e,t){const r=await import("./graphics/editingSupport.js");if(await this.load(),!this.associatedLayer)throw new a(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),r.applyEdits(this,this.associatedLayer.source,e,t)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new a(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}on(e,t){return super.on(e,t)}validateLayer(e){if(e.layerType&&!se.includes(e.layerType))throw new a("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new a("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new a("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});function t(e,t){let r=!1,s=!1;if(null==e)r=!0,s=!0;else{const o=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,s=o;break;case"vertex-reference-frame":r=!0,s=!o;break;default:r=!1}}if(!r)throw new a("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!s)throw new a("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}t(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new a("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!(!this.attributeStorageInfo||!this.attributeStorageInfo.some((t=>t.name===e.name))),r=!!this.associatedLayer?.fields?.some((t=>t&&e.name===t.name)),s={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=s}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPopupOverrides()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPopupOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled"],t=f(this);for(let r=0;r<e.length;r++){const s=e[r],o=this.originIdOf(s),i=this.associatedLayer.originIdOf(s);o<i&&(i===g.SERVICE||i===g.PORTAL_ITEM)&&t.setAtOrigin(s,this.associatedLayer[s],i)}}async _setAssociatedFeatureLayer(e){if(!["mesh-pyramids","points"].includes(this.profile))return;const t=new R(this.parsedUrl,this.portalItem,this.apiKey,e);try{this.associatedLayer=await t.fetch()}catch(r){d(r)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){await u((()=>this.popupEnabled&&null!=this.popupTemplate));const e=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?n.getLogger(this.declaredClass).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):n.getLogger(this.declaredClass).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${e}`)}_validateElevationInfo(){const e=this.elevationInfo;e&&("mesh-pyramids"===this.profile&&"relative-to-scene"===e.mode&&n.getLogger(this.declaredClass).warn(".elevationInfo=","Mesh scene layers don't support relative-to-scene elevation mode"),e.featureExpressionInfo&&"0"!==e.featureExpressionInfo.expression&&n.getLogger(this.declaredClass).warn(".elevationInfo=","Scene layers do not support featureExpressionInfo"))}};e([c({types:{key:"type",base:D,typeMap:{selection:U}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],ie.prototype,"featureReduction",void 0),e([c({type:[z],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],ie.prototype,"rangeInfos",void 0),e([c({json:{read:!1}})],ie.prototype,"associatedLayer",void 0),e([c({type:["show","hide"]})],ie.prototype,"listMode",void 0),e([c({type:["ArcGISSceneServiceLayer"]})],ie.prototype,"operationalLayerType",void 0),e([c({json:{read:!1},readOnly:!0})],ie.prototype,"type",void 0),e([c({...oe.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ie.prototype,"fields",void 0),e([c()],ie.prototype,"types",null),e([c()],ie.prototype,"typeIdField",null),e([c()],ie.prototype,"templates",null),e([c()],ie.prototype,"formTemplate",null),e([c({readOnly:!0})],ie.prototype,"fieldsIndex",null),e([c({type:W,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],ie.prototype,"floorInfo",void 0),e([c(oe.outFields)],ie.prototype,"outFields",void 0),e([c({type:k,readOnly:!0,json:{read:!1}})],ie.prototype,"nodePages",void 0),e([h("service","nodePages",["nodePages","pointNodePages"])],ie.prototype,"readNodePages",null),e([c({type:[G],readOnly:!0})],ie.prototype,"materialDefinitions",void 0),e([c({type:[V],readOnly:!0})],ie.prototype,"textureSetDefinitions",void 0),e([c({type:[K],readOnly:!0})],ie.prototype,"geometryDefinitions",void 0),e([c({readOnly:!0})],ie.prototype,"serviceUpdateTimeStamp",void 0),e([c({readOnly:!0})],ie.prototype,"attributeStorageInfo",void 0),e([c({readOnly:!0})],ie.prototype,"statisticsInfo",void 0),e([c({type:i.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],ie.prototype,"excludeObjectIds",void 0),e([c({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],ie.prototype,"definitionExpression",void 0),e([c({type:B,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],ie.prototype,"filter",void 0),e([c({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],ie.prototype,"path",void 0),e([c(E)],ie.prototype,"elevationInfo",null),e([c({type:String})],ie.prototype,"geometryType",null),e([c(A)],ie.prototype,"labelsVisible",void 0),e([c({type:[M],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:$},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:$},write:!0}})],ie.prototype,"labelingInfo",void 0),e([c(P)],ie.prototype,"legendEnabled",void 0),e([c({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?re(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],ie.prototype,"opacity",void 0),e([c({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ie.prototype,"priority",void 0),e([c({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ie.prototype,"semantic",void 0),e([c({types:s,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],ie.prototype,"renderer",null),e([c({json:{read:!1}})],ie.prototype,"cachedDrawingInfo",void 0),e([h("service","cachedDrawingInfo")],ie.prototype,"readCachedDrawingInfo",null),e([c({readOnly:!0,json:{read:!1}})],ie.prototype,"capabilities",null),e([c({type:Boolean,json:{read:!1}})],ie.prototype,"editingEnabled",null),e([c({readOnly:!0,json:{write:!1,read:!1}})],ie.prototype,"infoFor3D",null),e([c(_)],ie.prototype,"popupEnabled",void 0),e([c({type:r,json:{name:"popupInfo",write:!0}})],ie.prototype,"popupTemplate",void 0),e([c({readOnly:!0,json:{read:!1}})],ie.prototype,"defaultPopupTemplate",null),e([c({type:String,json:{read:!1}})],ie.prototype,"objectIdField",void 0),e([h("service","objectIdField",["objectIdField","fields"])],ie.prototype,"readObjectIdField",null),e([c({type:String,json:{read:!1}})],ie.prototype,"globalIdField",void 0),e([h("service","globalIdField",["globalIdField","fields"])],ie.prototype,"readGlobalIdField",null),e([c({readOnly:!0,type:String,json:{read:!1}})],ie.prototype,"displayField",null),e([c({type:String,json:{read:!1}})],ie.prototype,"profile",void 0),e([h("service","profile",["store.profile"])],ie.prototype,"readProfile",null),e([c({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],ie.prototype,"normalReferenceFrame",void 0),e([c(x)],ie.prototype,"screenSizePerspectiveEnabled",void 0),ie=e([m("esri.layers.SceneLayer")],ie);const ae={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},ne={"mesh-pyramids":"mesh",points:"point",lines:"polyline",polygons:"polygon"},pe=ie;export{pe as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import r from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/PieChartRenderer.js";import"../renderers/Renderer.js";import"../renderers/SimpleRenderer.js";import"../renderers/UniqueValueRenderer.js";import"../renderers/support/jsonUtils.js";import{webSceneRendererTypes as s}from"../renderers/support/types.js";import o from"../request.js";import i from"../core/Collection.js";import a from"../core/Error.js";import n from"../core/Logger.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as l,isAbortError as d}from"../core/promiseUtils.js";import{whenOnce as u}from"../core/reactiveUtils.js";import{join as y}from"../core/urlUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{getProperties as f}from"../core/accessorSupport/utils.js";import{reader as h}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as g}from"../core/accessorSupport/PropertyOrigin.js";import v from"./Layer.js";import{APIKeyMixin as b}from"./mixins/APIKeyMixin.js";import{ArcGISService as I}from"./mixins/ArcGISService.js";import{EditBusLayer as w}from"./mixins/EditBusLayer.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{PortalLayer as L}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as S}from"./mixins/ScaleRangeLayer.js";import{SceneService as F,SaveOperationType as O}from"./mixins/SceneService.js";import{zeroCapabilities as T}from"./support/capabilities.js";import{elevationInfo as E,labelsVisible as _,legendEnabled as A,popupEnabled as P,screenSizePerspectiveEnabled as x}from"./support/commonProperties.js";import{FeatureReduction as D}from"./support/FeatureReduction.js";import U from"./support/FeatureReductionSelection.js";import{FetchAssociatedFeatureLayer as R}from"./support/FetchAssociatedFeatureLayer.js";import{defineFieldProperties as C}from"./support/fieldProperties.js";import q from"./support/FieldsIndex.js";import{fixRendererFields as Q,unpackFieldNames as N}from"./support/fieldUtils.js";import{I3SNodePageDefinition as k,I3SMaterialDefinition as G,I3STextureSetDefinition as V,I3SGeometryDefinition as K}from"./support/I3SLayerDefinitions.js";import M from"./support/LabelClass.js";import{reader as $}from"./support/labelingInfo.js";import W from"./support/LayerFloorInfo.js";import{RangeInfo as z}from"./support/RangeInfo.js";import B from"./support/SceneFilter.js";import{loadStyleRenderer as H}from"../renderers/support/styleUtils.js";import Z from"../rest/support/Query.js";import{sceneLayerEditingEnabled as J}from"../support/featureFlags.js";import{createPopupTemplate as X}from"../support/popupUtils.js";import{queryAttributesFromCachedAttributesId as Y}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as ee,getFetchPopupTemplate as te}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as re}from"../webdoc/support/opacityUtils.js";const se=["3DObject","Point"],oe=C();let ie=class extends(w(F(I(j(L(S(p(b(v))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new i,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._set("renderer",null)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getFeatureType(t?.feature)?.domains?.[e];return r&&"inherited"!==r.type?r:this.getField(e)?.domain??null}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new q(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:k.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get geometryType(){return ne[this.profile]||"mesh"}set renderer(e){Q(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){const e=this.associatedLayer?.capabilities??T,{query:t,editing:{supportsGlobalId:r,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:i,supportsReturnServiceEditsInSourceSpatialReference:a},data:{supportsZ:n,supportsM:p,isVersioned:l,supportsAttachment:d},operations:{supportsEditing:u,supportsAdd:y,supportsUpdate:c,supportsDelete:f,supportsQuery:h,supportsQueryAttachments:m}}=e,g=e.operations.supportsChangeTracking,v=!!this.associatedLayer?.infoFor3D&&J();return{query:t,editing:{supportsGlobalId:r,supportsReturnServiceEditsInSourceSpatialReference:a,supportsRollbackOnFailure:s,supportsGeometryUpdate:v&&i,supportsUploadWithItemId:o},data:{supportsAttachment:d,supportsZ:n,supportsM:p,isVersioned:l},operations:{supportsQuery:h,supportsQueryAttachments:m,supportsEditing:u&&g,supportsAdd:v&&y&&g,supportsDelete:v&&f&&g,supportsUpdate:c&&g}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.userHasEditingPrivileges}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e))),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e))),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&ae[r]?ae[r]:(n.getLogger(this.declaredClass).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(l).then((()=>this._fetchService(t))).then((()=>Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),null!=this.filter?this.filter.loadGeometries(this.spatialReference):null]))).then((()=>this._validateElevationInfo())).then((()=>this._applyAssociatedLayerOverrides())).then((()=>this._populateFieldUsageInfo())).then((()=>H(this,{origin:"service"},t))).then((()=>Q(this.renderer,this.fieldsIndex))).then((()=>this.finishLoadEditablePortalLayer(e)));return this.addResolvingPromise(r),Promise.resolve(this)}async beforeSave(){null!=this.filter&&await this.load()}createQuery(){const e=new Z;return"mesh"!==this.geometryType&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e}))}async queryCachedAttributes(e,t){const r=N(this.fieldsIndex,await ee(this,te(this)));return Y(this.parsedUrl.path,this.attributeStorageInfo??[],e,t,r)}async queryCachedFeature(e,r){const s=await this.queryCachedAttributes(e,[r]);if(!s||0===s.length)throw new a("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const o=new t;return o.attributes=s[0],o.layer=this,o.sourceLayer=this,o}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryObjectIds(e||this.createQuery(),t)))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryAttachments(e,t)))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(n.getLogger(this.declaredClass).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return X(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new a("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new a("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some((t=>t.name===e))}async queryCachedStatistics(e,t){if(await this.load(t),!this.statisticsInfo)throw new a("scenelayer:no-cached-statistics","Cached statistics are not available for this layer");const r=this.fieldsIndex.get(e);if(!r)throw new a("scenelayer:field-unexisting",`Field '${e}' does not exist on the layer`);for(const s of this.statisticsInfo)if(s.name===r.name){const e=y(this.parsedUrl.path,s.href);return o(e,{query:{f:"json",token:this.apiKey},responseType:"json",signal:t?t.signal:null}).then((e=>e.data))}throw new a("scenelayer:no-cached-statistics","Cached statistics for this attribute are not available")}async saveAs(e,t){return this._debouncedSaveOperations(O.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(O.SAVE,e)}async applyEdits(e,t){const r=await import("./graphics/editingSupport.js");if(await this.load(),!this.associatedLayer)throw new a(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),r.applyEdits(this,this.associatedLayer.source,e,t)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new a(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}on(e,t){return super.on(e,t)}validateLayer(e){if(e.layerType&&!se.includes(e.layerType))throw new a("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new a("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new a("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});function t(e,t){let r=!1,s=!1;if(null==e)r=!0,s=!0;else{const o=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,s=o;break;case"vertex-reference-frame":r=!0,s=!o;break;default:r=!1}}if(!r)throw new a("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!s)throw new a("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}t(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new a("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!(!this.attributeStorageInfo||!this.attributeStorageInfo.some((t=>t.name===e.name))),r=!!this.associatedLayer?.fields?.some((t=>t&&e.name===t.name)),s={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=s}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPopupOverrides()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPopupOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled"],t=f(this);for(let r=0;r<e.length;r++){const s=e[r],o=this.originIdOf(s),i=this.associatedLayer.originIdOf(s);o<i&&(i===g.SERVICE||i===g.PORTAL_ITEM)&&t.setAtOrigin(s,this.associatedLayer[s],i)}}async _setAssociatedFeatureLayer(e){if(!["mesh-pyramids","points"].includes(this.profile))return;const t=new R(this.parsedUrl,this.portalItem,this.apiKey,e);try{this.associatedLayer=await t.fetch()}catch(r){d(r)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){await u((()=>this.popupEnabled&&null!=this.popupTemplate));const e=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?n.getLogger(this.declaredClass).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):n.getLogger(this.declaredClass).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${e}`)}_validateElevationInfo(){const e=this.elevationInfo;e&&("mesh-pyramids"===this.profile&&"relative-to-scene"===e.mode&&n.getLogger(this.declaredClass).warn(".elevationInfo=","Mesh scene layers don't support relative-to-scene elevation mode"),e.featureExpressionInfo&&"0"!==e.featureExpressionInfo.expression&&n.getLogger(this.declaredClass).warn(".elevationInfo=","Scene layers do not support featureExpressionInfo"))}};e([c({types:{key:"type",base:D,typeMap:{selection:U}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],ie.prototype,"featureReduction",void 0),e([c({type:[z],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],ie.prototype,"rangeInfos",void 0),e([c({json:{read:!1}})],ie.prototype,"associatedLayer",void 0),e([c({type:["show","hide"]})],ie.prototype,"listMode",void 0),e([c({type:["ArcGISSceneServiceLayer"]})],ie.prototype,"operationalLayerType",void 0),e([c({json:{read:!1},readOnly:!0})],ie.prototype,"type",void 0),e([c({...oe.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ie.prototype,"fields",void 0),e([c()],ie.prototype,"types",null),e([c()],ie.prototype,"typeIdField",null),e([c()],ie.prototype,"templates",null),e([c()],ie.prototype,"formTemplate",null),e([c({readOnly:!0})],ie.prototype,"fieldsIndex",null),e([c({type:W,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],ie.prototype,"floorInfo",void 0),e([c(oe.outFields)],ie.prototype,"outFields",void 0),e([c({type:k,readOnly:!0,json:{read:!1}})],ie.prototype,"nodePages",void 0),e([h("service","nodePages",["nodePages","pointNodePages"])],ie.prototype,"readNodePages",null),e([c({type:[G],readOnly:!0})],ie.prototype,"materialDefinitions",void 0),e([c({type:[V],readOnly:!0})],ie.prototype,"textureSetDefinitions",void 0),e([c({type:[K],readOnly:!0})],ie.prototype,"geometryDefinitions",void 0),e([c({readOnly:!0})],ie.prototype,"serviceUpdateTimeStamp",void 0),e([c({readOnly:!0})],ie.prototype,"attributeStorageInfo",void 0),e([c({readOnly:!0})],ie.prototype,"statisticsInfo",void 0),e([c({type:i.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],ie.prototype,"excludeObjectIds",void 0),e([c({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],ie.prototype,"definitionExpression",void 0),e([c({type:B,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],ie.prototype,"filter",void 0),e([c({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],ie.prototype,"path",void 0),e([c(E)],ie.prototype,"elevationInfo",null),e([c({type:String})],ie.prototype,"geometryType",null),e([c(_)],ie.prototype,"labelsVisible",void 0),e([c({type:[M],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:$},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:$},write:!0}})],ie.prototype,"labelingInfo",void 0),e([c(A)],ie.prototype,"legendEnabled",void 0),e([c({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?re(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],ie.prototype,"opacity",void 0),e([c({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ie.prototype,"priority",void 0),e([c({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ie.prototype,"semantic",void 0),e([c({types:s,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],ie.prototype,"renderer",null),e([c({json:{read:!1}})],ie.prototype,"cachedDrawingInfo",void 0),e([h("service","cachedDrawingInfo")],ie.prototype,"readCachedDrawingInfo",null),e([c({readOnly:!0,json:{read:!1}})],ie.prototype,"capabilities",null),e([c({type:Boolean,json:{read:!1}})],ie.prototype,"editingEnabled",null),e([c({readOnly:!0,json:{write:!1,read:!1}})],ie.prototype,"infoFor3D",null),e([c(P)],ie.prototype,"popupEnabled",void 0),e([c({type:r,json:{name:"popupInfo",write:!0}})],ie.prototype,"popupTemplate",void 0),e([c({readOnly:!0,json:{read:!1}})],ie.prototype,"defaultPopupTemplate",null),e([c({type:String,json:{read:!1}})],ie.prototype,"objectIdField",void 0),e([h("service","objectIdField",["objectIdField","fields"])],ie.prototype,"readObjectIdField",null),e([c({type:String,json:{read:!1}})],ie.prototype,"globalIdField",void 0),e([h("service","globalIdField",["globalIdField","fields"])],ie.prototype,"readGlobalIdField",null),e([c({readOnly:!0,type:String,json:{read:!1}})],ie.prototype,"displayField",null),e([c({type:String,json:{read:!1}})],ie.prototype,"profile",void 0),e([h("service","profile",["store.profile"])],ie.prototype,"readProfile",null),e([c({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],ie.prototype,"normalReferenceFrame",void 0),e([c(x)],ie.prototype,"screenSizePerspectiveEnabled",void 0),ie=e([m("esri.layers.SceneLayer")],ie);const ae={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},ne={"mesh-pyramids":"mesh",points:"point",lines:"polyline",polygons:"polygon"},pe=ie;export{pe as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{rasterRendererTypes as e}from"../../rasterRenderers.js";import r from"../../request.js";import i from"../../core/Error.js";import s from"../../core/Logger.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as o}from"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{getInfo as l}from"../../geometry/support/spatialReferenceUtils.js";import{sanitizeUrl as u}from"../support/arcgisLayerUrl.js";import{url as m}from"../support/commonProperties.js";import c from"../support/DimensionalDefinition.js";import d from"../support/MultidimensionalSubset.js";import h from"../support/RasterFunction.js";import p from"../support/RasterJobHandler.js";import f from"../support/TileInfo.js";import y from"../support/rasterDatasets/FunctionRaster.js";import{getDefaultMultidimensionalDefinition as b,hasExcludedVariableOrDimension as g,getDefaultVariablInfo as F,isMultiSliceOrRangeDefinition as I,getSubsetVariablesFromMdInfo as J}from"../support/rasterDatasets/multidimensionalUtils.js";import{snapToRaster as _,clip as R}from"../support/rasterFunctions/clipUtils.js";import{create as S}from"../support/rasterFunctions/rasterFunctionHelper.js";import{load as x,projectExtent as v,projectPolygon as j}from"../support/rasterFunctions/rasterProjectionHelper.js";import{computeStatisticsHistograms as H}from"../support/rasterFunctions/stretchUtils.js";import{convertVectorFieldData as D}from"../support/rasterFunctions/vectorFieldUtils.js";import{normalizeRendererJSON as w,getVariableRasterInfo as T,getDefaultInterpolation as N,getDefaultBandCombination as O,createDefaultRenderer as z}from"../../renderers/support/rasterRendererHelper.js";import C from"../../renderers/support/RasterSymbolizer.js";import P from"../../rest/support/ImageHistogramParameters.js";import{createFlowMesh as E}from"../../views/2d/engine/flow/dataUtils.js";import M from"../../geometry/SpatialReference.js";import U from"../../geometry/Point.js";const k=s.getLogger("esri.layers.mixins.ImageryTileMixin"),q=s=>{let q=class extends s{constructor(...t){super(...t),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation="nearest",this.multidimensionalSubset=null,this.raster=null,this.rasterFunction=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster="Function"===t[0]?.raster?.datasetFormat}get fullExtent(){return this.rasterInfo?.extent}set multidimensionalDefinition(t){this._set("multidimensionalDefinition",t),this.updateRenderer()}get tileInfo(){return this.rasterInfo?.storageInfo.tileInfo}set url(t){this._set("url",u(t,k))}set renderer(t){this._set("renderer",t),this.updateRenderer()}async convertVectorFieldData(t,e){if(null==t||!this.rasterInfo)return null;const r=this._rasterJobHandler.instance,i=this.rasterInfo.dataType;return r?r.convertVectorFieldData({pixelBlock:t,dataType:i},e):D(t,i)}async computeStatisticsHistograms(t,e){t=o(P,t).clone();const{rasterInfo:r}=this,{geometry:s}=t;if(null==s)throw new i("imagery-tile-mixin:compute-statistics-histograms","gemetry must be specified");let n=s;const{spatialReference:a}=r;s.spatialReference.equals(a)||(await x(),n="extent"===s.type?v(s,a):j(s,a));const l=t.pixelSize??new U({...r.pixelSize,spatialReference:a}),{extent:u,width:m,height:c}=_(r,n,l),d=await this.fetchPixels(u,m,c,{...e,interpolation:"nearest"});if(null==d.pixelBlock)throw new i("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const h=R(d.pixelBlock,u,n),p=this._rasterJobHandler.instance;return p?p.computeStatisticsHistograms({pixelBlock:h},e):H(h)}async createFlowMesh(t,e){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(t,e):E(t.meshType,t.simulationSettings,t.flowData,null!=e.signal?e.signal:(new AbortController).signal)}normalizeRasterFetchOptions(t){const{multidimensionalInfo:e}=this.rasterInfo??{};if(null==e)return t;let r=t.multidimensionalDefinition||this.multidimensionalDefinition;null!=r&&r.length||(r=b(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const i=t.timeExtent||this.timeExtent;if(null!=r&&null!=i&&(null!=i.start||null!=i.end)){r=r.map((t=>t.clone()));const s=e.variables.find((({name:t})=>t===r[0].variableName))?.dimensions?.find((({name:t})=>"StdTime"===t)),n=r.find((({dimensionName:t})=>"StdTime"===t));if(!s||!n)return{...t,multidimensionalDefinition:null};const{start:o,end:a}=i,l=null==o?null:o.getTime(),u=null==a?null:a.getTime(),m=l??u,c=u??l;if(null!=s.values){const t=s.values.filter((t=>{if(Array.isArray(t)){if(m===c)return t[0]<=m&&t[1]>=m;const e=t[0]<=m&&t[1]>m||t[0]<c&&t[1]>=c,r=t[0]>=m&&t[1]<=c||t[0]<m&&t[1]>c;return e||r}return m===c?t===m:t>=m&&t<=c}));if(t.length){const e=t.sort(((t,e)=>{if(m===c)return(t[0]??t)-(e[0]??e);return Math.abs((t[1]??t)-c)-Math.abs((e[1]??e)-c)}))[0];n.values=[e]}else r=null}else if(s.hasRegularIntervals&&s.extent){const[t,e]=s.extent;m>e||c<t?r=null:n.values=m===c?[m]:[Math.max(t,m),Math.min(e,c)]}}return null!=r&&g(r,this.multidimensionalSubset)?{...t,multidimensionalDefinition:null}:{...t,multidimensionalDefinition:r}}async updateRasterFunction(){if("imagery-tile"!==this.type||!this.rasterFunction&&!this._cachedRasterFunctionJson||JSON.stringify(this.rasterFunction)===JSON.stringify(this._cachedRasterFunctionJson))return;if(this._isConstructedFromFunctionRaster&&"Function"===this.raster.datasetFormat){const t=this.raster.rasterFunction.toJSON();return!this.rasterFunction&&t&&this._set("rasterFunction",h.fromJSON(t)),void(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON())}let t,e=this.raster,r=!1;"Function"===e.datasetFormat?(t=e.primaryRasters.rasters,e=t[0],r=!0):t=[e];const{rasterFunction:i}=this;if(i){const r={raster:e};t.length>1&&t.forEach((t=>r[t.url]=t));const s=S(i.rasterFunctionDefinition??i.toJSON(),r),n=new y({rasterFunction:s});n.rasterJobHandler=this._rasterJobHandler.instance,await n.open(),this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this.raster=n}else this.raster=e,this._cachedRasterFunctionJson=null;if(this._cachedRendererJson=null,!r&&!i)return;const{bandIds:s}=this,{bandCount:n}=this.raster.rasterInfo,o=s?.length?s.some((t=>t>=n)):n>=3;s&&(o||"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}async updateRenderer(){const{loaded:t,symbolizer:e}=this;if(!t||!e)return;const{rasterInfo:r}=this.raster,i=F(r,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=i?.name,n=w({...this.renderer.toJSON(),variableName:s});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(n))return;const o=this._rasterJobHandler.instance;o&&(e.rasterInfo=T(r,s),e.rendererJSON=n,e.bind(),await o.updateSymbolizer(e),this._cachedRendererJson=n)}async applyRenderer(t,e){const r=t&&t.pixelBlock;if(!(null!=r&&r.pixels&&r.pixels.length>0))return null;let i;await this.updateRenderer();const s=this._rasterJobHandler.instance,n=this.bandIds??[];return i=s?await s.symbolize({...t,simpleStretchParams:e,bandIds:n}):this.symbolizer.symbolize({...t,simpleStretchParams:e,bandIds:n}),i}getTileUrl(t,e,r){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${t}/${e}/${r}`:""}getCompatibleTileInfo(t,e,r=!1){if(!this.loaded||null==e)return null;if(r&&t.equals(this.spatialReference))return this.tileInfo;const i=l(t);return f.create({size:256,spatialReference:t,origin:i?{x:i.origin[0],y:i.origin[1]}:{x:e.xmin,y:e.ymax}})}getCompatibleFullExtent(t){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(t)||(this._compatibleFullExtent=this.raster.computeExtent(t)),this._compatibleFullExtent):null}async fetchTile(t,e,i,s={}){if(B(this),s.requestAsImageElement){const n=this.getTileUrl(t,e,i);return r(n,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:s.signal}).then((t=>t.data))}const{rasterInfo:n}=this;if(null!=n.multidimensionalInfo&&null==(s=this.normalizeRasterFetchOptions(s)).multidimensionalDefinition){const r=s.tileInfo||n.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(t,e,i,r),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer.type&&(s={...s,buffer:{cols:1,rows:1}}),this.raster.fetchTile(t,e,i,s)}async fetchPixels(t,e,r,i={}){return null!=this.rasterInfo.multidimensionalInfo&&null==(i=this.normalizeRasterFetchOptions(i)).multidimensionalDefinition?{extent:t,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),e=Math.round(e),r=Math.round(r),this.raster.fetchPixels(t,e,r,i))}async identify(t,e={}){const{raster:r,rasterInfo:s}=this;if(null!=s.multidimensionalInfo){if(!(s.hasMultidimensionalTranspose&&!!(I(e.multidimensionalDefinition)||e.transposedVariableName||e.timeExtent))&&null==(e=this.normalizeRasterFetchOptions(e)).multidimensionalDefinition)return{location:t,value:null}}const n=this.multidimensionalSubset?.areaOfInterest;if(n&&!n.contains(t))throw new i("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return r.identify(t,e)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const t=this.rasterInfo?.multidimensionalInfo;if(null==t||"standard-time"!==this.rasterInfo?.dataType)return!1;const e=this.multidimensionalDefinition,r=e?.[0]?.variableName;return t.variables.some((t=>t.name===r&&(!e?.[0].dimensionName||t.dimensions.some((t=>"StdTime"===t.name)))))}getStandardTimeValue(t){return new Date(24*(t-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(t){const e=t??this.rasterInfo?.multidimensionalInfo;return J(this.multidimensionalSubset,e)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=b(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const t=new p;return this._rasterJobHandler.connectionPromise=t.initialize().then((()=>{B(this),this._rasterJobHandler.instance=t,this.raster.rasterJobHandler=t,this.renderer&&this.updateRenderer(),"Function"===this.raster.datasetFormat&&this.raster.syncJobHandler()})).catch((()=>{})),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){if(null==this.interpolation){B(this);const{raster:t}=this,e=N(t.rasterInfo,t.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",e)}}_configDefaultRenderer(t="no"){B(this);const{rasterInfo:e}=this.raster;!this.bandIds&&e.bandCount>1&&(this.bandIds=O(e));const r=F(e,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),i=r?.name;if(!this.renderer||"override"===t){const t=z(e,{bandIds:this.bandIds,variableName:i}),r=e.statistics,s=r&&r.length>0?r[0]:null,n=s?.max??0,o=s?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===t.type&&(n>1e24||o<-1e24)&&(t.dynamicRangeAdjustment=!0,t.statistics=null,"none"===t.stretchType&&(t.stretchType="min-max")),this.renderer=t}const s=w({...this.renderer.toJSON(),variableName:i}),n=T(e,i);this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=n):this.symbolizer=new C({rendererJSON:s,rasterInfo:n});const o=this.symbolizer.bind();if(o.success){if("auto"===t){const{colormap:t}=this.raster.rasterInfo,e=this.renderer;if(null!=t)if("raster-colormap"!==e.type)this._configDefaultRenderer("override");else{const t=z(this.raster.rasterInfo);JSON.stringify(t)!==JSON.stringify(e)&&this._configDefaultRenderer("override")}else if("raster-stretch"===e.type){const t=this.bandIds?.length,r=e.statistics?.length;!e.dynamicRangeAdjustment&&r&&t&&r!==t&&this._configDefaultRenderer("override")}}}else k.warn("imagery-tile-mixin",o.error||"The given renderer is not supported by the layer."),"auto"===t&&this._configDefaultRenderer("override")}};function B(t){if(!t.raster||!t.rasterInfo)throw new i("imagery-tile","no raster")}return t([n()],q.prototype,"_cachedRendererJson",void 0),t([n()],q.prototype,"_cachedRasterFunctionJson",void 0),t([n()],q.prototype,"_compatibleFullExtent",void 0),t([n()],q.prototype,"_isConstructedFromFunctionRaster",void 0),t([n()],q.prototype,"_rasterJobHandler",void 0),t([n()],q.prototype,"bandIds",void 0),t([n({json:{origins:{service:{read:{source:"copyrightText"}}}}})],q.prototype,"copyright",void 0),t([n({json:{read:!1}})],q.prototype,"fullExtent",null),t([n()],q.prototype,"interpolation",void 0),t([n()],q.prototype,"ioConfig",void 0),t([n({type:[c],json:{write:!0}})],q.prototype,"multidimensionalDefinition",null),t([n({type:d,json:{write:!0}})],q.prototype,"multidimensionalSubset",void 0),t([n()],q.prototype,"raster",void 0),t([n({type:h})],q.prototype,"rasterFunction",void 0),t([n()],q.prototype,"rasterInfo",void 0),t([n()],q.prototype,"sourceJSON",void 0),t([n({readOnly:!0,type:M,json:{read:!1}})],q.prototype,"spatialReference",void 0),t([n({json:{read:!1}})],q.prototype,"tileInfo",null),t([n(m)],q.prototype,"url",null),t([n({types:e})],q.prototype,"renderer",null),t([n()],q.prototype,"symbolizer",void 0),q=t([a("esri.layers.ImageryTileMixin")],q),q};export{q as ImageryTileMixin};
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{rasterRendererTypes as e}from"../../rasterRenderers.js";import r from"../../request.js";import i from"../../core/Error.js";import s from"../../core/Logger.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as o}from"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{getInfo as l}from"../../geometry/support/spatialReferenceUtils.js";import{sanitizeUrl as u}from"../support/arcgisLayerUrl.js";import{url as m}from"../support/commonProperties.js";import c from"../support/DimensionalDefinition.js";import d from"../support/MultidimensionalSubset.js";import h from"../support/RasterFunction.js";import p from"../support/RasterJobHandler.js";import f from"../support/TileInfo.js";import y from"../support/rasterDatasets/FunctionRaster.js";import{getDefaultMultidimensionalDefinition as b,hasExcludedVariableOrDimension as g,getDefaultVariablInfo as F,isMultiSliceOrRangeDefinition as I,getSubsetVariablesFromMdInfo as J}from"../support/rasterDatasets/multidimensionalUtils.js";import{snapToRaster as _,clip as R}from"../support/rasterFunctions/clipUtils.js";import{create as S}from"../support/rasterFunctions/rasterFunctionHelper.js";import{load as x,projectExtent as v,projectPolygon as j}from"../support/rasterFunctions/rasterProjectionHelper.js";import{computeStatisticsHistograms as H}from"../support/rasterFunctions/stretchUtils.js";import{convertVectorFieldData as D}from"../support/rasterFunctions/vectorFieldUtils.js";import{normalizeRendererJSON as w,getVariableRasterInfo as T,getDefaultInterpolation as N,getDefaultBandCombination as O,createDefaultRenderer as z}from"../../renderers/support/rasterRendererHelper.js";import C from"../../renderers/support/RasterSymbolizer.js";import P from"../../rest/support/ImageHistogramParameters.js";import{createFlowMesh as E}from"../../views/2d/engine/flow/dataUtils.js";import M from"../../geometry/SpatialReference.js";import U from"../../geometry/Point.js";const k=s.getLogger("esri.layers.mixins.ImageryTileMixin"),q=s=>{let q=class extends s{constructor(...t){super(...t),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation="nearest",this.multidimensionalSubset=null,this.raster=null,this.rasterFunction=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster="Function"===t[0]?.raster?.datasetFormat}get fullExtent(){return this.rasterInfo?.extent}set multidimensionalDefinition(t){this._set("multidimensionalDefinition",t),this.updateRenderer()}get tileInfo(){return this.rasterInfo?.storageInfo.tileInfo}set url(t){this._set("url",u(t,k))}set renderer(t){this._set("renderer",t),this.updateRenderer()}async convertVectorFieldData(t,e){if(null==t||!this.rasterInfo)return null;const r=this._rasterJobHandler.instance,i=this.rasterInfo.dataType;return r?r.convertVectorFieldData({pixelBlock:t,dataType:i},e):D(t,i)}async computeStatisticsHistograms(t,e){t=o(P,t).clone();const{rasterInfo:r}=this,{geometry:s}=t;if(null==s)throw new i("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let n=s;const{spatialReference:a}=r;s.spatialReference.equals(a)||(await x(),n="extent"===s.type?v(s,a):j(s,a));const l=t.pixelSize??new U({...r.pixelSize,spatialReference:a}),{extent:u,width:m,height:c}=_(r,n,l),d=await this.fetchPixels(u,m,c,{...e,interpolation:"nearest"});if(null==d.pixelBlock)throw new i("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const h=R(d.pixelBlock,u,n),p=this._rasterJobHandler.instance;return p?p.computeStatisticsHistograms({pixelBlock:h},e):H(h)}async createFlowMesh(t,e){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(t,e):E(t.meshType,t.simulationSettings,t.flowData,null!=e.signal?e.signal:(new AbortController).signal)}normalizeRasterFetchOptions(t){const{multidimensionalInfo:e}=this.rasterInfo??{};if(null==e)return t;let r=t.multidimensionalDefinition||this.multidimensionalDefinition;null!=r&&r.length||(r=b(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const i=t.timeExtent||this.timeExtent;if(null!=r&&null!=i&&(null!=i.start||null!=i.end)){r=r.map((t=>t.clone()));const s=e.variables.find((({name:t})=>t===r[0].variableName))?.dimensions?.find((({name:t})=>"StdTime"===t)),n=r.find((({dimensionName:t})=>"StdTime"===t));if(!s||!n)return{...t,multidimensionalDefinition:null};const{start:o,end:a}=i,l=null==o?null:o.getTime(),u=null==a?null:a.getTime(),m=l??u,c=u??l;if(null!=s.values){const t=s.values.filter((t=>{if(Array.isArray(t)){if(m===c)return t[0]<=m&&t[1]>=m;const e=t[0]<=m&&t[1]>m||t[0]<c&&t[1]>=c,r=t[0]>=m&&t[1]<=c||t[0]<m&&t[1]>c;return e||r}return m===c?t===m:t>=m&&t<=c}));if(t.length){const e=t.sort(((t,e)=>{if(m===c)return(t[0]??t)-(e[0]??e);return Math.abs((t[1]??t)-c)-Math.abs((e[1]??e)-c)}))[0];n.values=[e]}else r=null}else if(s.hasRegularIntervals&&s.extent){const[t,e]=s.extent;m>e||c<t?r=null:n.values=m===c?[m]:[Math.max(t,m),Math.min(e,c)]}}return null!=r&&g(r,this.multidimensionalSubset)?{...t,multidimensionalDefinition:null}:{...t,multidimensionalDefinition:r}}async updateRasterFunction(){if("imagery-tile"!==this.type||!this.rasterFunction&&!this._cachedRasterFunctionJson||JSON.stringify(this.rasterFunction)===JSON.stringify(this._cachedRasterFunctionJson))return;if(this._isConstructedFromFunctionRaster&&"Function"===this.raster.datasetFormat){const t=this.raster.rasterFunction.toJSON();return!this.rasterFunction&&t&&this._set("rasterFunction",h.fromJSON(t)),void(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON())}let t,e=this.raster,r=!1;"Function"===e.datasetFormat?(t=e.primaryRasters.rasters,e=t[0],r=!0):t=[e];const{rasterFunction:i}=this;if(i){const r={raster:e};t.length>1&&t.forEach((t=>r[t.url]=t));const s=S(i.rasterFunctionDefinition??i.toJSON(),r),n=new y({rasterFunction:s});n.rasterJobHandler=this._rasterJobHandler.instance,await n.open(),this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this.raster=n}else this.raster=e,this._cachedRasterFunctionJson=null;if(this._cachedRendererJson=null,!r&&!i)return;const{bandIds:s}=this,{bandCount:n}=this.raster.rasterInfo,o=s?.length?s.some((t=>t>=n)):n>=3;s&&(o||"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}async updateRenderer(){const{loaded:t,symbolizer:e}=this;if(!t||!e)return;const{rasterInfo:r}=this.raster,i=F(r,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=i?.name,n=w({...this.renderer.toJSON(),variableName:s});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(n))return;const o=this._rasterJobHandler.instance;o&&(e.rasterInfo=T(r,s),e.rendererJSON=n,e.bind(),await o.updateSymbolizer(e),this._cachedRendererJson=n)}async applyRenderer(t,e){const r=t&&t.pixelBlock;if(!(null!=r&&r.pixels&&r.pixels.length>0))return null;let i;await this.updateRenderer();const s=this._rasterJobHandler.instance,n=this.bandIds??[];return i=s?await s.symbolize({...t,simpleStretchParams:e,bandIds:n}):this.symbolizer.symbolize({...t,simpleStretchParams:e,bandIds:n}),i}getTileUrl(t,e,r){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${t}/${e}/${r}`:""}getCompatibleTileInfo(t,e,r=!1){if(!this.loaded||null==e)return null;if(r&&t.equals(this.spatialReference))return this.tileInfo;const i=l(t);return f.create({size:256,spatialReference:t,origin:i?{x:i.origin[0],y:i.origin[1]}:{x:e.xmin,y:e.ymax}})}getCompatibleFullExtent(t){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(t)||(this._compatibleFullExtent=this.raster.computeExtent(t)),this._compatibleFullExtent):null}async fetchTile(t,e,i,s={}){if(B(this),s.requestAsImageElement){const n=this.getTileUrl(t,e,i);return r(n,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:s.signal}).then((t=>t.data))}const{rasterInfo:n}=this;if(null!=n.multidimensionalInfo&&null==(s=this.normalizeRasterFetchOptions(s)).multidimensionalDefinition){const r=s.tileInfo||n.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(t,e,i,r),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer.type&&(s={...s,buffer:{cols:1,rows:1}}),this.raster.fetchTile(t,e,i,s)}async fetchPixels(t,e,r,i={}){return null!=this.rasterInfo.multidimensionalInfo&&null==(i=this.normalizeRasterFetchOptions(i)).multidimensionalDefinition?{extent:t,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),e=Math.round(e),r=Math.round(r),this.raster.fetchPixels(t,e,r,i))}async identify(t,e={}){const{raster:r,rasterInfo:s}=this;if(null!=s.multidimensionalInfo){if(!(s.hasMultidimensionalTranspose&&!!(I(e.multidimensionalDefinition)||e.transposedVariableName||e.timeExtent))&&null==(e=this.normalizeRasterFetchOptions(e)).multidimensionalDefinition)return{location:t,value:null}}const n=this.multidimensionalSubset?.areaOfInterest;if(n&&!n.contains(t))throw new i("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return r.identify(t,e)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const t=this.rasterInfo?.multidimensionalInfo;if(null==t||"standard-time"!==this.rasterInfo?.dataType)return!1;const e=this.multidimensionalDefinition,r=e?.[0]?.variableName;return t.variables.some((t=>t.name===r&&(!e?.[0].dimensionName||t.dimensions.some((t=>"StdTime"===t.name)))))}getStandardTimeValue(t){return new Date(24*(t-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(t){const e=t??this.rasterInfo?.multidimensionalInfo;return J(this.multidimensionalSubset,e)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=b(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const t=new p;return this._rasterJobHandler.connectionPromise=t.initialize().then((()=>{B(this),this._rasterJobHandler.instance=t,this.raster.rasterJobHandler=t,this.renderer&&this.updateRenderer(),"Function"===this.raster.datasetFormat&&this.raster.syncJobHandler()})).catch((()=>{})),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){if(null==this.interpolation){B(this);const{raster:t}=this,e=N(t.rasterInfo,t.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",e)}}_configDefaultRenderer(t="no"){B(this);const{rasterInfo:e}=this.raster;!this.bandIds&&e.bandCount>1&&(this.bandIds=O(e));const r=F(e,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),i=r?.name;if(!this.renderer||"override"===t){const t=z(e,{bandIds:this.bandIds,variableName:i}),r=e.statistics,s=r&&r.length>0?r[0]:null,n=s?.max??0,o=s?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===t.type&&(n>1e24||o<-1e24)&&(t.dynamicRangeAdjustment=!0,t.statistics=null,"none"===t.stretchType&&(t.stretchType="min-max")),this.renderer=t}const s=w({...this.renderer.toJSON(),variableName:i}),n=T(e,i);this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=n):this.symbolizer=new C({rendererJSON:s,rasterInfo:n});const o=this.symbolizer.bind();if(o.success){if("auto"===t){const{colormap:t}=this.raster.rasterInfo,e=this.renderer;if(null!=t)if("raster-colormap"!==e.type)this._configDefaultRenderer("override");else{const t=z(this.raster.rasterInfo);JSON.stringify(t)!==JSON.stringify(e)&&this._configDefaultRenderer("override")}else if("raster-stretch"===e.type){const t=this.bandIds?.length,r=e.statistics?.length;!e.dynamicRangeAdjustment&&r&&t&&r!==t&&this._configDefaultRenderer("override")}}}else k.warn("imagery-tile-mixin",o.error||"The given renderer is not supported by the layer."),"auto"===t&&this._configDefaultRenderer("override")}};function B(t){if(!t.raster||!t.rasterInfo)throw new i("imagery-tile","no raster")}return t([n()],q.prototype,"_cachedRendererJson",void 0),t([n()],q.prototype,"_cachedRasterFunctionJson",void 0),t([n()],q.prototype,"_compatibleFullExtent",void 0),t([n()],q.prototype,"_isConstructedFromFunctionRaster",void 0),t([n()],q.prototype,"_rasterJobHandler",void 0),t([n()],q.prototype,"bandIds",void 0),t([n({json:{origins:{service:{read:{source:"copyrightText"}}}}})],q.prototype,"copyright",void 0),t([n({json:{read:!1}})],q.prototype,"fullExtent",null),t([n()],q.prototype,"interpolation",void 0),t([n()],q.prototype,"ioConfig",void 0),t([n({type:[c],json:{write:!0}})],q.prototype,"multidimensionalDefinition",null),t([n({type:d,json:{write:!0}})],q.prototype,"multidimensionalSubset",void 0),t([n()],q.prototype,"raster",void 0),t([n({type:h})],q.prototype,"rasterFunction",void 0),t([n()],q.prototype,"rasterInfo",void 0),t([n()],q.prototype,"sourceJSON",void 0),t([n({readOnly:!0,type:M,json:{read:!1}})],q.prototype,"spatialReference",void 0),t([n({json:{read:!1}})],q.prototype,"tileInfo",null),t([n(m)],q.prototype,"url",null),t([n({types:e})],q.prototype,"renderer",null),t([n()],q.prototype,"symbolizer",void 0),q=t([a("esri.layers.ImageryTileMixin")],q),q};export{q as ImageryTileMixin};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Logger.js";import{debounce as s,ignoreAbortErrors as t}from"../../core/promiseUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{registerLayer as i,unregisterLayer as h}from"./refresh.js";function n(e){return null!=e&&"object"==typeof e&&"refreshTimestamp"in e&&"refresh"in e}const p=n=>{let p=class extends n{constructor(...e){super(...e),this.refreshInterval=0,this.refreshTimestamp=0,this._debounceHasDataChanged=s((()=>this.hasDataChanged())),this.when().then((()=>{i(this)}),(()=>{}))}destroy(){h(this)}get refreshParameters(){return{_ts:this.refreshTimestamp||null}}refresh(e=Date.now()){t(this._debounceHasDataChanged()).then((r=>{r&&this._set("refreshTimestamp",e),this.emit("refresh",{dataChanged:r})}),(e=>{r.getLogger(this.declaredClass).error(e),this.emit("refresh",{dataChanged:!1,error:e})}))}async hasDataChanged(){return!0}};return e([o({type:Number,cast:e=>e>=.1?e:e<=0?0:.1,json:{write:!0}})],p.prototype,"refreshInterval",void 0),e([o({readOnly:!0})],p.prototype,"refreshTimestamp",void 0),e([o()],p.prototype,"refreshParameters",null),p=e([a("esri.layers.mixins.RefreshableLayer")],p),p};export{p as RefreshableLayer,n as isRefreshableLayer};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Logger.js";import{debounce as s,ignoreAbortErrors as t}from"../../core/promiseUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{registerLayer as i,unregisterLayer as h}from"./refresh.js";function n(e){return null!=e&&"object"==typeof e&&"refreshTimestamp"in e&&"refresh"in e}const p=n=>{let p=class extends n{constructor(...e){super(...e),this.refreshInterval=0,this.refreshTimestamp=0,this._debounceHasDataChanged=s((()=>this.hasDataChanged())),this.when().then((()=>{this.destroyed||i(this)}),(()=>{}))}destroy(){h(this)}get refreshParameters(){return{_ts:this.refreshTimestamp||null}}refresh(e=Date.now()){t(this._debounceHasDataChanged()).then((r=>{r&&this._set("refreshTimestamp",e),this.emit("refresh",{dataChanged:r})}),(e=>{r.getLogger(this.declaredClass).error(e),this.emit("refresh",{dataChanged:!1,error:e})}))}async hasDataChanged(){return!0}};return e([o({type:Number,cast:e=>e>=.1?e:e<=0?0:.1,json:{write:!0}})],p.prototype,"refreshInterval",void 0),e([o({readOnly:!0})],p.prototype,"refreshTimestamp",void 0),e([o()],p.prototype,"refreshParameters",null),p=e([a("esri.layers.mixins.RefreshableLayer")],p),p};export{p as RefreshableLayer,n as isRefreshableLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getMetersPerUnitForSR as
|
|
5
|
+
import{getMetersPerUnitForSR as t}from"../../../core/unitUtils.js";import e from"../../../geometry/Extent.js";import{intersects as i,contains as n}from"../../../geometry/geometryEngine.js";import a from"../PixelBlock.js";function h(e,i){if(e.spatialReference.equals(i))return e;const n=t(e.spatialReference),a=t(i);if(n===a)return e;const h=n/a;return{x:e.x*h,y:e.y*h}}function o(t,e,h){if("extent"===h.type)return x(t,e,h);const{width:o,height:m}=t,s=new Uint8Array(o*m);return i(e,h)?"polyline"===h.type?l(t,e,h):n(h,e)?t:r(t,e,h):new a({pixelType:t.pixelType,width:o,height:m,mask:s,maskIsAlpha:!1,pixels:[...t.pixels]})}function r(t,e,i){if(!t)return t;const{width:n,height:h}=t,o=e.width/n,r=e.height/h,{xmin:x,ymax:l}=e;let m;if("extent"===i.type){const t=(i.xmin-x)/o,e=(i.xmax-x)/o,n=(l-i.ymax)/r,a=(l-i.ymin)/r;m=[[[t,n],[t,a],[e,a],[e,n],[t,n]]]}else m=i.rings.map((t=>t.map((([t,e])=>[(t-x)/o,(l-e)/r]))));const s=document.createElement("canvas");s.width=n,s.height=h;const p=s.getContext("2d");p.fillStyle="#f00",m.forEach((t=>{p.beginPath(),p.moveTo(t[0][0],t[0][1]);for(let e=0;e<t.length;e++)p.lineTo(t[e][0],t[e][1]);p.closePath(),p.fill()}));const f=p.getImageData(0,0,n,h).data,y=t.mask,c=n*h,M=new Uint8Array(c);for(let a=0;a<c;a++)y&&!y[a]||(M[a]=f[4*a+3]>127?255:0);return new a({pixelType:t.pixelType,width:n,height:h,mask:M,maskIsAlpha:!1,pixels:[...t.pixels]})}function x(t,e,i){const{width:n,height:h}=t,o=new Uint8Array(n*h),r=e.width/n,x=e.height/h;if(i.width/r<.5||i.height/x<.5)return new a({pixelType:t.pixelType,width:n,height:h,mask:o,pixels:[...t.pixels]});const{xmin:l,xmax:m,ymin:s,ymax:p}=e,{xmin:f,xmax:y,ymin:c,ymax:M}=i,u=Math.max(l,f),d=Math.min(m,y),w=Math.max(s,c),g=Math.min(p,M),T=.5*r,k=.5*x;if(d-u<T||g-w<k||d<l+T||u>m-T||w>p-k||g<s+k)return new a({pixelType:t.pixelType,width:n,height:h,mask:o,pixels:[...t.pixels]});const A=Math.max(0,(u-l)/r),R=Math.min(n,Math.max(0,(d-l)/r)),U=Math.max(0,(p-g)/x),j=Math.min(h,Math.max(0,(p-w)/x)),E=Math.round(A),I=Math.round(R)-1,P=Math.round(U),v=Math.round(j)-1;if(E===I&&A%1>.5&&R%1<.5||P===v&&U%1>.5&&j%1<.5)return new a({pixelType:t.pixelType,width:n,height:h,mask:o,pixels:[...t.pixels]});if(0===E&&0===P&&I===n&&v===h)return t;const b=t.mask;for(let a=P;a<=v;a++)for(let t=E;t<=I;t++){const e=a*n+t;o[e]=b?b[e]:255}return new a({pixelType:t.pixelType,width:n,height:h,mask:o,pixels:[...t.pixels]})}function l(t,e,i){const{width:n,height:h}=t,o=new Uint8Array(n*h),r=e.width/n,x=e.height/h,{xmin:l,ymax:m}=e,{paths:s}=i,p=t.mask;for(let a=0;a<s.length;a++){const t=s[a];for(let e=0;e<t.length-1;e++){const[i,a]=t[e],[s,f]=t[e+1];let y=Math.floor((m-a)/x),c=Math.floor((m-f)/x);if(c<y){const t=y;y=c,c=t}y=Math.max(0,y),c=Math.min(h-1,c);const M=(s-i)/(f-a);for(let t=y;t<=c;t++){const e=t===y?Math.max(a,f):(h+1-t)*x,m=t===c?Math.min(a,f):e-x;let u=f===a?Math.floor((i-l)/r):Math.floor((M*(e-a)+i-l)/r),d=f===a?Math.floor((s-l)/r):Math.floor((M*(m-a)+i-l)/r);if(d<u){const t=u;u=d,d=t}const w=t*n;u=Math.max(0,u),d=Math.min(n-1,d);for(let t=w+u;t<=w+d;t++)o[t]=p?p[t]:255}}}return new a({pixelType:t.pixelType,width:n,height:h,mask:o,pixels:[...t.pixels]})}function m(t,i,n,a=!0){const{spatialReference:o}=t,{x:r,y:x}=h(n,o);let l,m,s;const p="extent"===i.type?i:i.extent;let{xmin:f,xmax:y,ymax:c,ymin:M}=p;const{xmin:u,ymax:d}=t.extent;return a?(f=u+(f>u?r*Math.round((f-u)/r):0),c=d-(c<d?x*Math.round((d-c)/x):0),y=u+(y>u?r*Math.round((y-u)/r):0),M=d-(M<d?x*Math.round((d-M)/x):0),l=new e({xmin:f,ymax:c,xmax:y,ymin:M,spatialReference:o}),m=Math.round(l.width/r),s=Math.round(l.height/x)):(m=Math.floor((y-f)/r+.8),s=Math.floor((c-M)/x+.8),f=u+(f>u?r*Math.floor((f-u)/r+.1):0),c=d-(c<d?x*Math.floor((d-c)/x+.1):0),y=f+m*r,M=c-s*x,l=new e({xmin:f,ymax:c,xmax:y,ymin:M,spatialReference:o})),{extent:l,width:m,height:s}}export{o as clip,m as snapToRaster};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{assertIsSome as t}from"../../../core/maybe.js";import n from"../PixelBlock.js";import{getPixelValueRange as e}from"../rasterFormats/pixelRangeUtils.js";import{stretchTypeFunctionEnum as s}from"../../../renderers/support/stretchRendererUtils.js";const i=1,r=[.299,.587,.114];function o(t,n=256){n=Math.min(n,256);const{size:e,counts:s}=t,i=new Uint8Array(e),r=s.reduce(((t,e)=>t+e/n),0);let o=0,a=0,l=0,f=r;for(let u=0;u<e;u++)if(l+=s[u],!(u<e-1&&l+s[u+1]<f)){for(;o<n-1&&f<l;)o++,f+=r;for(let t=a;t<=u;t++)i[t]=o;a=u+1}for(let u=a;u<e;u++)i[u]=n-1;return i}function a(t){const{minCutOff:n,maxCutOff:e,gamma:s,pixelType:i,rounding:r}=t,o=t.outMin||0,a=t.outMax||255;if(!["u8","u16","s8","s16"].includes(i))return null;const f=n.length;let u,m,c=0;"s8"===i?c=-127:"s16"===i&&(c=-32767);let h=256;["u16","s16"].includes(i)&&(h=65536);const g=[],p=[],x=a-o;for(u=0;u<f;u++)p[u]=e[u]-n[u],g[u]=0===p[u]?0:x/p[u];let M;const y=[];let v,w,z;if(s&&s.length>=f){const t=d(f,s);for(u=0;u<f;u++){for(z=[],m=0;m<h;m++)if(0!==p[u])if(v=m+c,M=(v-n[u])/p[u],w=1,s[u]>1&&(w-=(1/x)**(M*t[u])),v<e[u]&&v>n[u]){const t=w*x*M**(1/s[u])+o;z[m]="floor"===r?Math.floor(t):"round"===r?Math.round(t):t}else v>=e[u]?z[m]=a:z[m]=o;else z[m]=o;y[u]=z}}else for(u=0;u<f;u++){for(z=[],m=0;m<h;m++)if(v=m+c,v<=n[u])z[m]=o;else if(v>=e[u])z[m]=a;else{const t=(v-n[u])*g[u]+o;z[m]="floor"===r?Math.floor(t):"round"===r?Math.round(t):t}y[u]=z}if(null!=t.contrastOffset){const n=l(t.contrastOffset,t.brightnessOffset);for(u=0;u<f;u++)for(z=y[u],m=0;m<h;m++)z[m]=n[z[m]]}return{lut:y,offset:c}}function l(t,n){const e=Math.min(Math.max(t,-100),100),s=Math.min(Math.max(n??0,-100),100),i=255,r=128;let o=0,a=0;const l=new Uint8Array(256);for(o=0;o<256;o++)e>0&&e<100?a=(200*o-100*i+2*i*s)/(2*(100-e))+r:e<=0&&e>-100?a=(200*o-100*i+2*i*s)*(100+e)/2e4+r:100===e?(a=200*o-100*i+(i+1)*(100-e)+2*i*s,a=a>0?i:0):-100===e&&(a=r),l[o]=a>i?i:a<0?0:a;return l}function f(t,n,e){const s=[];for(let i=0;i<n.length;i++){let o=0,a=0,l=0;"min"in n[i]?({min:o,max:a,avg:l}=n[i]):[o,a,l]=n[i];let f=l??0;"u8"!==t&&(f=255*(f-o)/(a-o)),e&&(f*=r[i]),s.push(u(f))}return s}function u(t){if(t<=0||t>=255)return i;let n=0;150!==t&&(n=t<=150?45*Math.cos(.01047*t):17*Math.sin(.021*t));const e=255,s=t+n,r=Math.log(t/e),o=Math.log(s/e);if(0===o)return i;const a=r/o;return isNaN(a)?i:Math.min(9.9,Math.max(.01,a))}function m(t,n,e,s){let i=1/0,r=-1/0,o=0,a=0;const l=t.length;for(let d=0;d<l;d++){const e=t[d];n&&!n[d]||(i=e<i?e:i,r=e>r?e:r,o+=e,a++)}if(0===a)return{statistics:{min:0,max:0,avg:0,stddev:0},histogram:null};const f=o/a;let u=0;for(let d=0;d<l;d++)n&&!n[d]||(u+=(t[d]-f)**2);const m=n?n.filter((t=>t)).length:l,c={min:i,max:r,avg:f,stddev:m<=1?0:Math.sqrt(u/(m-1))};if(!s)return{statistics:c,histogram:null};const
|
|
5
|
+
import{assertIsSome as t}from"../../../core/maybe.js";import n from"../PixelBlock.js";import{getPixelValueRange as e}from"../rasterFormats/pixelRangeUtils.js";import{stretchTypeFunctionEnum as s}from"../../../renderers/support/stretchRendererUtils.js";const i=1,r=[.299,.587,.114];function o(t,n=256){n=Math.min(n,256);const{size:e,counts:s}=t,i=new Uint8Array(e),r=s.reduce(((t,e)=>t+e/n),0);let o=0,a=0,l=0,f=r;for(let u=0;u<e;u++)if(l+=s[u],!(u<e-1&&l+s[u+1]<f)){for(;o<n-1&&f<l;)o++,f+=r;for(let t=a;t<=u;t++)i[t]=o;a=u+1}for(let u=a;u<e;u++)i[u]=n-1;return i}function a(t){const{minCutOff:n,maxCutOff:e,gamma:s,pixelType:i,rounding:r}=t,o=t.outMin||0,a=t.outMax||255;if(!["u8","u16","s8","s16"].includes(i))return null;const f=n.length;let u,m,c=0;"s8"===i?c=-127:"s16"===i&&(c=-32767);let h=256;["u16","s16"].includes(i)&&(h=65536);const g=[],p=[],x=a-o;for(u=0;u<f;u++)p[u]=e[u]-n[u],g[u]=0===p[u]?0:x/p[u];let M;const y=[];let v,w,z;if(s&&s.length>=f){const t=d(f,s);for(u=0;u<f;u++){for(z=[],m=0;m<h;m++)if(0!==p[u])if(v=m+c,M=(v-n[u])/p[u],w=1,s[u]>1&&(w-=(1/x)**(M*t[u])),v<e[u]&&v>n[u]){const t=w*x*M**(1/s[u])+o;z[m]="floor"===r?Math.floor(t):"round"===r?Math.round(t):t}else v>=e[u]?z[m]=a:z[m]=o;else z[m]=o;y[u]=z}}else for(u=0;u<f;u++){for(z=[],m=0;m<h;m++)if(v=m+c,v<=n[u])z[m]=o;else if(v>=e[u])z[m]=a;else{const t=(v-n[u])*g[u]+o;z[m]="floor"===r?Math.floor(t):"round"===r?Math.round(t):t}y[u]=z}if(null!=t.contrastOffset){const n=l(t.contrastOffset,t.brightnessOffset);for(u=0;u<f;u++)for(z=y[u],m=0;m<h;m++)z[m]=n[z[m]]}return{lut:y,offset:c}}function l(t,n){const e=Math.min(Math.max(t,-100),100),s=Math.min(Math.max(n??0,-100),100),i=255,r=128;let o=0,a=0;const l=new Uint8Array(256);for(o=0;o<256;o++)e>0&&e<100?a=(200*o-100*i+2*i*s)/(2*(100-e))+r:e<=0&&e>-100?a=(200*o-100*i+2*i*s)*(100+e)/2e4+r:100===e?(a=200*o-100*i+(i+1)*(100-e)+2*i*s,a=a>0?i:0):-100===e&&(a=r),l[o]=a>i?i:a<0?0:a;return l}function f(t,n,e){const s=[];for(let i=0;i<n.length;i++){let o=0,a=0,l=0;"min"in n[i]?({min:o,max:a,avg:l}=n[i]):[o,a,l]=n[i];let f=l??0;"u8"!==t&&(f=255*(f-o)/(a-o)),e&&(f*=r[i]),s.push(u(f))}return s}function u(t){if(t<=0||t>=255)return i;let n=0;150!==t&&(n=t<=150?45*Math.cos(.01047*t):17*Math.sin(.021*t));const e=255,s=t+n,r=Math.log(t/e),o=Math.log(s/e);if(0===o)return i;const a=r/o;return isNaN(a)?i:Math.min(9.9,Math.max(.01,a))}function m(t,n,e,s){let i=1/0,r=-1/0,o=0,a=0;const l=t.length;for(let d=0;d<l;d++){const e=t[d];n&&!n[d]||(i=e<i?e:i,r=e>r?e:r,o+=e,a++)}if(0===a)return{statistics:{min:0,max:0,avg:0,stddev:0},histogram:null};const f=o/a;let u=0;for(let d=0;d<l;d++)n&&!n[d]||(u+=(t[d]-f)**2);const m=n?n.filter((t=>t)).length:l,c={min:i,max:r,avg:f,stddev:m<=1?0:Math.sqrt(u/(m-1))};if(!s)return{statistics:c,histogram:null};if(["u8","s8","u4","u2","u1"].includes(e)){const e=r-i+1,s=new Uint32Array(e);for(let r=0;r<l;r++)n&&!n[r]||s[t[r]-i]++;return{statistics:c,histogram:{min:i-.5,max:r+.5,size:e,counts:s}}}const h=256,g=new Uint32Array(h),p=(r-i)/h;if(0===p)return{statistics:c,histogram:{min:i,max:r,size:1,counts:new Uint32Array(1).fill(a)}};const x=new Uint32Array(h+1);for(let d=0;d<l;d++)n&&!n[d]||x[Math.floor((t[d]-i)/p)]++;for(let d=0;d<h-1;d++)g[d]=x[d];return g[h-1]=x[h-1]+x[h],{statistics:c,histogram:{min:i,max:r,size:h,counts:g}}}function c(t){const{pixels:n,mask:e,pixelType:s}=t,i=n.map((t=>m(t,e,s,!0)));return{statistics:i.map((({statistics:t})=>t)),histograms:i.map((({histogram:t})=>t))}}function h(t){if(null==t||!t.pixels?.length)return null;const{pixels:n,mask:e,pixelType:s}=t,i=t.width*t.height,r=n.length;let o,a,l,f,u;const m=[],c=[];let h,g,p,x,d,M,y,v,w,z;const C=256;for(f=0;f<r;f++){if(h=new Uint32Array(C),p=n[f],"u8"===s)if(o=-.5,a=255.5,e)for(u=0;u<i;u++)e[u]&&h[p[u]]++;else for(u=0;u<i;u++)h[p[u]]++;else{let n=!1;t.statistics||(t.updateStatistics(),n=!0);const s=t.statistics;if(o=s[f].minValue,a=s[f].maxValue,l=(a-o)/C,0===l){!s||t.validPixelCount||n||t.updateStatistics();const e=(t.validPixelCount||t.width*t.height)/C;for(let t=0;t<C;t++)h[t]=Math.round(e*(t+1))-Math.round(e*t)}else{for(g=new Uint32Array(C+1),u=0;u<i;u++)e&&!e[u]||g[Math.floor((p[u]-o)/l)]++;for(u=0;u<C-1;u++)h[u]=g[u];h[C-1]=g[C-1]+g[C]}}for(m.push({min:o,max:a,size:C,counts:h}),x=0,d=0,v=0,u=0;u<C;u++)x+=h[u],d+=u*h[u];for(w=d/x,u=0;u<C;u++)v+=h[u]*(u-w)**2;z=Math.sqrt(v/(x-1)),l=(a-o)/C,M=(w+.5)*l+o,y=z*l,c.push({min:o,max:a,avg:M,stddev:y})}return{statistics:c,histograms:m}}function g(t){const n=[];for(let e=0;e<t.length;e++){const{min:s,max:i,size:r,counts:o}=t[e];let a=0,l=0;for(let t=0;t<r;t++)a+=o[t],l+=t*o[t];const f=l/a;let u=0;for(let t=0;t<r;t++)u+=o[t]*(t-f)**2;const m=(i-s)/r,c=(f+.5)*m+s,h=Math.sqrt(u/(a-1))*m;n.push({min:s,max:i,avg:c,stddev:h})}return n}function p(n,i){const{pixelBlock:r,bandIds:a,returnHistogramLut:l,rasterInfo:f}=i;let u=null,m=null,c=n.stretchType;if("number"==typeof c&&(c=s[c]),n.dra)if("minMax"===c&&null!=r&&r.statistics)u=r.statistics.map((t=>[t.minValue,t.maxValue,0,0]));else{const t=h(r);u=null!=t?t.statistics:null,m=null!=t?t.histograms:null}else u=n.statistics?.length>0?n.statistics:f.statistics,m=n.histograms||f.histograms;"percentClip"!==c&&"histogramEqualization"!==c||m?.length||(c="minMax");const g=u?.length||m?.length||f.bandCount,p=[],d=[];let M,y,v,w,z,C,O,b,k;u&&!Array.isArray(u[0])&&(u=u.map((t=>[t.min,t.max,t.avg,t.stddev])));const[A,U]=e(f.pixelType);if(!u?.length){for(u=[],b=0;b<g;b++)u.push([A,U,1,1]);"standardDeviation"===c&&(c="minMax")}switch(c){case"none":for(b=0;b<g;b++)p[b]=A,d[b]=U;break;case"minMax":for(b=0;b<g;b++)p[b]=u[b][0],d[b]=u[b][1];break;case"standardDeviation":for(b=0;b<g;b++)p[b]=u[b][2]-n.numberOfStandardDeviations*u[b][3],d[b]=u[b][2]+n.numberOfStandardDeviations*u[b][3],p[b]<u[b][0]&&(p[b]=u[b][0]),d[b]>u[b][1]&&(d[b]=u[b][1]);break;case"histogramEqualization":for(t(m),b=0;b<g;b++)p[b]=m[b].min,d[b]=m[b].max;break;case"percentClip":for(t(m),b=0;b<m.length;b++){for(M=m[b],z=new Uint32Array(M.size),w=[...M.counts],w.length>=20&&(w[0]=w[1]=w[2]=w[w.length-1]=w[w.length-2]=0),v=0,y=(M.max-M.min)/M.size,O=-.5===M.min&&1===y?.5:0,k=0;k<M.size;k++)v+=w[k],z[k]=v;for(C=(n.minPercent||0)*v/100,p[b]=M.min+O,k=0;k<M.size;k++)if(z[k]>C){p[b]=M.min+y*(k+O);break}for(C=(1-(n.maxPercent||0)/100)*v,d[b]=M.max+O,k=M.size-2;k>=0;k--)if(z[k]<C){d[b]=M.min+y*(k+2-O);break}if(d[b]<p[b]){const t=p[b];p[b]=d[b],d[b]=t}}break;default:for(b=0;b<g;b++)p[b]=u[b][0],d[b]=u[b][1]}let T,q,P;"histogramEqualization"===c?(t(m),q=m[0].size||256,T=0,l&&(P=m.map((t=>o(t))))):(q=n.max||255,T=n.min||0);return x({minCutOff:p,maxCutOff:d,outMax:q,outMin:T,histogramLut:P},a)}function x(t,n){if(null==n||0===n.length)return t;const e=Math.max.apply(null,n),{minCutOff:s,maxCutOff:i,outMin:r,outMax:o,histogramLut:a}=t;return s.length===n.length||s.length<=e?t:{minCutOff:n.map((t=>s[t])),maxCutOff:n.map((t=>i[t])),histogramLut:a?n.map((t=>a[t])):null,outMin:r,outMax:o}}function d(t,n){const e=new Float32Array(t);for(let s=0;s<t;s++)n[s]>1?n[s]>2?e[s]=6.5+(n[s]-2)**2.5:e[s]=6.5+100*(2-n[s])**4:e[s]=1;return e}function M(t,e){if(null==t||!t.pixels?.length)return t;const{mask:s,width:i,height:r,pixels:o}=t,{minCutOff:a,maxCutOff:l,gamma:f}=e,u=e.outMin||0,m=e.outMax||255,c=i*r,h=e.outputPixelType||"u8",g=t.pixels.map((()=>n.createEmptyBand(h,c))),p=g.length;let x,M,y,v,w;const z=m-u,C=[],O=[];for(x=0;x<p;x++)O[x]=l[x]-a[x],C[x]=0===O[x]?0:z/O[x];const b=h.startsWith("u")||h.startsWith("s"),k=f&&f.length>=p,A=!!e.isRenderer;if(k){const t=d(p,f);for(M=0;M<c;M++)if(null==s||s[M])for(x=0;x<p;x++)if(0!==O[x])if(y=o[x][M],w=(y-a[x])/O[x],v=1,f[x]>1&&(v-=(1/z)**(w*t[x])),y<l[x]&&y>a[x]){const t=v*z*w**(1/f[x])+u;g[x][M]=A?Math.floor(t):b?Math.round(t):t}else y>=l[x]?g[x][M]=m:g[x][M]=u;else g[x][M]=u}else for(M=0;M<c;M++)if(null==s||s[M])for(x=0;x<p;x++)if(y=o[x][M],y<l[x]&&y>a[x]){const t=(y-a[x])*C[x]+u;g[x][M]=A?Math.floor(t):b?Math.round(t):t}else y>=l[x]?g[x][M]=m:g[x][M]=u;const U=new n({width:i,height:r,mask:s,pixels:g,pixelType:h});return U.updateStatistics(),U}export{d as computeGammaCorrection,f as computeGammaValues,c as computeStatisticsHistograms,l as createContrastBrightnessLUT,o as createHistogramEqualizationLUT,a as createStretchLUT,g as estimateStatisticsFromHistograms,h as estimateStatisticsHistograms,p as getStretchCutoff,M as stretch};
|
package/package.json
CHANGED
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const d="
|
|
5
|
+
const d="20230322",c="8db16c89e5f2dc53db513f76a86dd860a2e5fcfa";export{d as buildDate,c as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{throwIfNotAbortError as e,isAbortError as
|
|
5
|
+
import{abortMaybe as t}from"../../../../core/maybe.js";import{throwIfNotAbortError as e,throwIfAbortError as s,isAbortError as r,eachAlways as i}from"../../../../core/promiseUtils.js";import{addQueryParameters as o}from"../../../../core/urlUtils.js";import{open as n}from"../../../../core/workers/workers.js";import l from"./GlyphMosaic.js";import a from"./GlyphSource.js";import c from"./SpriteMosaic.js";import u from"../../tiling/TileKey.js";class h{constructor(t,e,s){this._layer=t,this._styleRepository=e,this.devicePixelRatio=s,this._spriteMosaic=null,this._glyphMosaic=null,this._connection=null,this._spriteSourceAbortController=null,this._startOptionsInputSignal=null,this._inputSignalEventListener=null}destroy(){this._connection?.close(),this._connection=null,this._styleRepository=null,this._layer=null,this._spriteMosaic=null,this._glyphMosaic=null,this._spriteSourceAbortController=t(this._spriteSourceAbortController),this._spriteSourcePromise=null,this._inputSignalEventListener&&this._startOptionsInputSignal?.removeEventListener("abort",this._inputSignalEventListener),this._startOptionsInputSignal=null,this._inputSignalEventListener=null}get spriteMosaic(){return this._spriteSourcePromise.then((()=>this._spriteMosaic))}get glyphMosaic(){return this._glyphMosaic}async start(t){this._requestSprite(t);const s=this._layer.currentStyleInfo.glyphsUrl,r=new a(s?o(s,{...this._layer.customParameters,token:this._layer.apiKey}):null);this._glyphMosaic=new l(1024,1024,r),this._broadcastPromise=n("WorkerTileHandler",{client:this,schedule:t.schedule,signal:t.signal}).then((s=>{if(this._layer&&(this._connection?.close(),this._connection=s,this._layer&&!this._connection.closed)){const r=s.broadcast("setStyle",this._layer.currentStyleInfo.style,t);Promise.all(r).catch((t=>e(t)))}}))}_requestSprite(t){this._spriteSourceAbortController?.abort();const e=new AbortController;this._spriteSourceAbortController=e;const r=t?.signal;this._inputSignalEventListener&&this._startOptionsInputSignal?.removeEventListener("abort",this._inputSignalEventListener),this._startOptionsInputSignal=null,r&&(this._inputSignalEventListener=p(e),r.addEventListener("abort",this._inputSignalEventListener,{once:!0}));const{signal:i}=e,o={...t,signal:i};this._spriteSourcePromise=this._layer.loadSpriteSource(this.devicePixelRatio,o),this._spriteSourcePromise.then((t=>{s(i),this._spriteMosaic=new c(1024,1024,250),this._spriteMosaic.setSpriteSource(t)}))}async updateStyle(t){return await this._broadcastPromise,this._broadcastPromise=Promise.all(this._connection.broadcast("updateStyle",t)),this._broadcastPromise}setSpriteSource(t){const e=new c(1024,1024,250);return e.setSpriteSource(t),this._spriteMosaic=e,this._spriteSourcePromise=Promise.resolve(t),this._spriteSourceAbortController=null,e}async setStyle(t,e){await this._broadcastPromise,this._styleRepository=t,this._requestSprite();const s=new a(this._layer.currentStyleInfo.glyphsUrl?o(this._layer.currentStyleInfo.glyphsUrl,{...this._layer.customParameters,token:this._layer.apiKey}):null);return this._glyphMosaic=new l(1024,1024,s),this._broadcastPromise=Promise.all(this._connection.broadcast("setStyle",e)),this._broadcastPromise}fetchTileData(t,e){return this._getRefKeys(t,e).then((t=>{const s=this._layer.sourceNameToSource,r=[];for(const e in s)r.push(e);return this._getSourcesData(r,t,e)}))}parseTileData(t,e){const s=t&&t.data;if(!s)return Promise.resolve(null);const{sourceName2DataAndRefKey:r,transferList:i}=s;return 0===Object.keys(r).length?Promise.resolve(null):this._broadcastPromise.then((()=>this._connection.invoke("createTileAndParse",{key:t.key.id,sourceName2DataAndRefKey:r,styleLayerUIDs:t.styleLayerUIDs},{...e,transferList:i})))}async getSprites(t){return await this._spriteSourcePromise,this._spriteMosaic.getSpriteItems(t)}getGlyphs(t){return this._glyphMosaic.getGlyphItems(t.font,t.codePoints)}async _getTilePayload(t,e,s){const i=u.pool.acquire(t.id),o=this._layer.sourceNameToSource[e],{level:n,row:l,col:a}=i;u.pool.release(i);try{return{protobuff:await o.requestTile(n,l,a,s),sourceName:e}}catch(c){if(r(c))throw c;return{protobuff:null,sourceName:e}}}_getRefKeys(t,e){const s=this._layer.sourceNameToSource,r=new Array;for(const i in s){const o=s[i].getRefKey(t,e);r.push(o)}return i(r)}_getSourcesData(t,e,s){const r=[];for(let i=0;i<e.length;i++)if(null==e[i].value||null==t[i])r.push(null);else{const o=this._getTilePayload(e[i].value,t[i],s);r.push(o)}return i(r).then((t=>{const s={},r=[];for(let i=0;i<t.length;i++){const o=t[i].value;if(o&&(o.protobuff&&o.protobuff.byteLength>0)){const t=e[i].value.id;s[o.sourceName]={refKey:t,protobuff:o.protobuff},r.push(o.protobuff)}}return{sourceName2DataAndRefKey:s,transferList:r}}))}}function p(t){return()=>t.abort()}export{h as TileHandler};
|