@arcgis/core 4.27.0 → 4.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/07f52b140db07fa962bb.js +1 -0
- package/assets/esri/core/workers/chunks/2d19500b2c042b6b79ac.js +1 -0
- package/assets/esri/core/workers/chunks/{979d9f37c555df0e8fa6.js → 7adbd577bb58c3bbaf28.js} +1 -1
- package/assets/esri/core/workers/chunks/{588cd91d08cec5207be1.js → 873b608720cce890e572.js} +1 -1
- package/assets/esri/core/workers/chunks/{9d4bd73dd50400e9d328.js → 9c8ab6bd8c170cbc5fa5.js} +1 -1
- package/assets/esri/core/workers/chunks/da2110b4caff9cc9b116.js +1 -0
- package/assets/esri/themes/base/widgets/_BasemapGallery.scss +1 -1
- package/assets/esri/themes/base/widgets/_Feature.scss +1 -1
- package/assets/esri/themes/base/widgets/_ValuePicker.scss +5 -2
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/Pattern.glsl.js +33 -32
- package/interfaces.d.ts +42 -12
- package/kernel.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/VideoLayer.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/support/ElevationQuery.js +1 -1
- package/layers/support/TelemetryData.js +1 -1
- package/layers/support/TelemetryDisplay.js +1 -1
- package/layers/support/imageryRendererUtils.js +1 -1
- package/layers/video/videoUtils.js +1 -1
- package/package.json +1 -1
- package/renderers/support/colorRampUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/i3s/featureEditing.js +1 -1
- package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/webgl/AppleAmdDriverHelper.js +5 -0
- package/views/webgl/testAppleAmdDrawArrays.js +1 -1
- package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
- package/widgets/Attachments.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/Feature/FeatureAttachments.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/Feature/support/relatedFeatureUtils.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/RelationshipInput.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
- package/assets/esri/core/workers/chunks/17ab08f60764244b2cf8.js +0 -1
- package/assets/esri/core/workers/chunks/38c6452dc9cf18e8bca8.js +0 -1
- package/assets/esri/core/workers/chunks/fbd3c78ee8e2219a6c7a.js +0 -1
- package/views/3d/webgl-engine/lib/AppleAmdDriverHelper.js +0 -5
package/chunks/Pattern.glsl.js
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
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{addNearFar as e,addLinearDepth as o}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js";import{ShaderOutput as
|
|
6
|
-
const mat2 rotate45 = mat2(${
|
|
7
|
-
${
|
|
8
|
-
`),
|
|
5
|
+
import{addNearFar as e,addLinearDepth as o}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js";import{ShaderOutput as r}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as t}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as a}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{VertexColor as i}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js";import{OutputDepth as l}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js";import{OutputHighlight as n}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{multipassTerrainTest as c}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import{VisualVariables as d}from"../views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js";import{symbolAlphaCutoff as s}from"../views/3d/webgl-engine/core/shaderLibrary/util/AlphaCutoff.js";import{ColorConversion as p}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{addProjViewLocalOrigin as g,addCameraPosition as v}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float4PassUniform as u}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as m}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as f}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{ShaderBuilder as h}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{TransparencyPassType as w}from"../views/3d/webgl-engine/lib/TransparencyPassType.js";import{VertexAttribute as b}from"../views/3d/webgl-engine/lib/VertexAttribute.js";import{Style as y}from"../views/3d/webgl-engine/materials/PatternStyle.js";const S=.70710678118,j=S,C=.08715574274;function T(T){const P=new h,R=T.hasMultipassTerrain&&(T.output===r.Color||T.output===r.Alpha),{vertex:$,fragment:D,attributes:V,varyings:A}=P;g($,T),P.include(a,T),P.include(i,T),P.include(d,T),T.draped?$.uniforms.add(new m("worldToScreenRatio",((e,o)=>1/o.screenToPCSRatio))):V.add(b.BOUNDINGRECT,"mat3"),V.add(b.POSITION,"vec3"),V.add(b.UVMAPSPACE,"vec4"),T.vvColor&&V.add(b.COLORFEATUREATTRIBUTE,"float"),A.add("vColor","vec4"),A.add("vpos","vec3"),A.add("vuv","vec2"),R&&A.add("depth","float"),$.uniforms.add(new u("uColor",(e=>e.color)));const L=T.style===y.ForwardDiagonal||T.style===y.BackwardDiagonal||T.style===y.DiagonalCross;L&&$.code.add(f`
|
|
6
|
+
const mat2 rotate45 = mat2(${f.float(S)}, ${f.float(-j)},
|
|
7
|
+
${f.float(j)}, ${f.float(S)});
|
|
8
|
+
`),T.draped||(v($,T),$.uniforms.add(new m("worldToScreenPerDistanceRatio",((e,o)=>1/o.camera.perScreenPixelRatio))),$.code.add(f`vec3 projectPointToLineSegment(vec3 center, vec3 halfVector, vec3 point) {
|
|
9
9
|
float projectedLength = dot(halfVector, point - center) / dot(halfVector, halfVector);
|
|
10
10
|
return center + halfVector * clamp(projectedLength, -1.0, 1.0);
|
|
11
|
-
}`)
|
|
11
|
+
}`),$.code.add(f`vec3 intersectRayPlane(vec3 rayDir, vec3 rayOrigin, vec3 planeNormal, vec3 planePoint) {
|
|
12
12
|
float d = dot(planeNormal, planePoint);
|
|
13
13
|
float t = (d - dot(planeNormal, rayOrigin)) / dot(planeNormal, rayDir);
|
|
14
14
|
return rayOrigin + t * rayDir;
|
|
15
|
-
}`)
|
|
15
|
+
}`),$.code.add(f`
|
|
16
16
|
float boundingRectDistanceToCamera() {
|
|
17
17
|
vec3 center = vec3(boundingRect[0][0], boundingRect[0][1], boundingRect[0][2]);
|
|
18
18
|
vec3 halfU = vec3(boundingRect[1][0], boundingRect[1][1], boundingRect[1][2]);
|
|
@@ -22,7 +22,7 @@ return rayOrigin + t * rayDir;
|
|
|
22
22
|
vec3 viewDir = - vec3(view[0][2], view[1][2], view[2][2]);
|
|
23
23
|
|
|
24
24
|
float viewAngle = dot(viewDir, n);
|
|
25
|
-
float minViewAngle = ${
|
|
25
|
+
float minViewAngle = ${f.float(C)};
|
|
26
26
|
|
|
27
27
|
if (abs(viewAngle) < minViewAngle) {
|
|
28
28
|
// view direction is (almost) parallel to plane -> clamp it to min angle
|
|
@@ -42,12 +42,12 @@ return rayOrigin + t * rayDir;
|
|
|
42
42
|
|
|
43
43
|
return length(closestPoint - cameraPosition);
|
|
44
44
|
}
|
|
45
|
-
`))
|
|
45
|
+
`)),$.code.add(f`
|
|
46
46
|
vec2 scaledUV() {
|
|
47
|
-
vec2 uv = uvMapSpace.xy ${
|
|
48
|
-
vec2 uvCellOrigin = uvMapSpace.zw ${
|
|
47
|
+
vec2 uv = uvMapSpace.xy ${L?" * rotate45":""};
|
|
48
|
+
vec2 uvCellOrigin = uvMapSpace.zw ${L?" * rotate45":""};
|
|
49
49
|
|
|
50
|
-
${
|
|
50
|
+
${T.draped?"":f`
|
|
51
51
|
float distanceToCamera = boundingRectDistanceToCamera();
|
|
52
52
|
float worldToScreenRatio = worldToScreenPerDistanceRatio / distanceToCamera;
|
|
53
53
|
`}
|
|
@@ -58,21 +58,22 @@ return rayOrigin + t * rayDir;
|
|
|
58
58
|
discreteWorldToScreenRatio = ceil(discreteWorldToScreenRatio / step) * step;
|
|
59
59
|
discreteWorldToScreenRatio = exp(discreteWorldToScreenRatio);
|
|
60
60
|
|
|
61
|
-
vec2 uvOffset = mod(uvCellOrigin * discreteWorldToScreenRatio, ${
|
|
61
|
+
vec2 uvOffset = mod(uvCellOrigin * discreteWorldToScreenRatio, ${f.float(T.patternSpacing)});
|
|
62
62
|
return uvOffset + (uv * discreteWorldToScreenRatio);
|
|
63
63
|
}
|
|
64
|
-
`);const
|
|
64
|
+
`);const O=T.output===r.Depth;return O&&(P.include(l,T),e(P),o(P)),$.code.add(f`
|
|
65
65
|
void main(void) {
|
|
66
66
|
vuv = scaledUV();
|
|
67
67
|
vpos = position;
|
|
68
|
-
${
|
|
68
|
+
${R?"depth = (view * vec4(vpos, 1.0)).z;":""}
|
|
69
69
|
forwardNormalizedVertexColor();
|
|
70
|
-
|
|
70
|
+
${T.hasVertexColors?"vColor *= uColor;":T.vvColor?"vColor = uColor * interpolateVVColor(colorFeatureAttribute);":"vColor = uColor;"}
|
|
71
|
+
gl_Position = ${O?f`transformPositionWithDepth(proj, view, vpos, nearFar, linearDepth);`:f`transformPosition(proj, view, vpos);`}
|
|
71
72
|
}
|
|
72
|
-
`),
|
|
73
|
-
const float lineWidth = ${
|
|
74
|
-
const float spacing = ${
|
|
75
|
-
const float spacingINV = ${
|
|
73
|
+
`),P.include(t,T),D.include(p),T.draped&&D.uniforms.add(new m("texelSize",((e,o)=>1/o.camera.pixelRatio))),T.output===r.Highlight&&P.include(n,T),R&&P.include(c,T),T.output!==r.Highlight&&(D.code.add(f`
|
|
74
|
+
const float lineWidth = ${f.float(T.lineWidth)};
|
|
75
|
+
const float spacing = ${f.float(T.patternSpacing)};
|
|
76
|
+
const float spacingINV = ${f.float(1/T.patternSpacing)};
|
|
76
77
|
|
|
77
78
|
float coverage(float p, float txlSize) {
|
|
78
79
|
p = mod(p, spacing);
|
|
@@ -88,7 +89,7 @@ return rayOrigin + t * rayDir;
|
|
|
88
89
|
|
|
89
90
|
return coverage / txlSize;
|
|
90
91
|
}
|
|
91
|
-
`),
|
|
92
|
+
`),T.draped||D.code.add(f`const int maxSamples = 5;
|
|
92
93
|
float sampleAA(float p) {
|
|
93
94
|
vec2 dxdy = abs(vec2(dFdx(p), dFdy(p)));
|
|
94
95
|
float fwidth = dxdy.x + dxdy.y;
|
|
@@ -109,27 +110,27 @@ accumulator += coverage(p + step.x * dxdy.x + step.y * dxdy.y, fwidth);
|
|
|
109
110
|
}
|
|
110
111
|
accumulator /= float(samples.x * samples.y);
|
|
111
112
|
return accumulator;
|
|
112
|
-
}`))
|
|
113
|
+
}`)),D.code.add(f`
|
|
113
114
|
void main() {
|
|
114
115
|
discardBySlice(vpos);
|
|
115
|
-
${
|
|
116
|
-
vec4 color =
|
|
116
|
+
${R?"terrainDepthTest(gl_FragCoord, depth);":""}
|
|
117
|
+
vec4 color = vColor;
|
|
117
118
|
color = highlightSlice(color, vpos);
|
|
118
119
|
|
|
119
|
-
${
|
|
120
|
+
${T.output!==r.Highlight?f`color.a *= ${x(T)};`:""}
|
|
120
121
|
|
|
121
|
-
${
|
|
122
|
+
${T.output===r.ObjectAndLayerIdColor?f`color.a = 1.0;`:""}
|
|
122
123
|
|
|
123
|
-
if (color.a < ${
|
|
124
|
+
if (color.a < ${f.float(s)}) {
|
|
124
125
|
discard;
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
${
|
|
128
|
+
${T.output===r.Alpha?f`fragColor = vec4(color.a);`:""}
|
|
128
129
|
|
|
129
|
-
${
|
|
130
|
-
${
|
|
131
|
-
${
|
|
130
|
+
${T.output===r.Color?f`fragColor = color; ${T.transparencyPassType===w.Color?"fragColor = premultiplyAlpha(fragColor);":""}`:""}
|
|
131
|
+
${T.output===r.Highlight?f`outputHighlight();`:""}
|
|
132
|
+
${T.output===r.Depth?f`outputDepth(linearDepth);`:""};
|
|
132
133
|
}
|
|
133
|
-
`),
|
|
134
|
+
`),P}function x(e){function o(o){return e.draped?f`coverage(vuv.${o}, texelSize)`:f`sampleAA(vuv.${o})`}switch(e.style){case y.ForwardDiagonal:case y.Horizontal:return o("y");case y.BackwardDiagonal:case y.Vertical:return o("x");case y.DiagonalCross:case y.Cross:return f`
|
|
134
135
|
1.0 - (1.0 - ${o("x")}) * (1.0 - ${o("y")})
|
|
135
|
-
`;default:return"0.0"}}const
|
|
136
|
+
`;default:return"0.0"}}const P=Object.freeze(Object.defineProperty({__proto__:null,build:T},Symbol.toStringTag,{value:"Module"}));export{P,T as b};
|
package/interfaces.d.ts
CHANGED
|
@@ -4210,7 +4210,7 @@ declare namespace __esri {
|
|
|
4210
4210
|
*
|
|
4211
4211
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-form-elements-RelationshipElement.html#displayCount)
|
|
4212
4212
|
*/
|
|
4213
|
-
displayCount:
|
|
4213
|
+
displayCount: number;
|
|
4214
4214
|
/**
|
|
4215
4215
|
* A string value indicating how to display related records within the relationship content.
|
|
4216
4216
|
*
|
|
@@ -4269,7 +4269,7 @@ declare namespace __esri {
|
|
|
4269
4269
|
*
|
|
4270
4270
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-form-elements-RelationshipElement.html#displayCount)
|
|
4271
4271
|
*/
|
|
4272
|
-
displayCount?:
|
|
4272
|
+
displayCount?: number;
|
|
4273
4273
|
/**
|
|
4274
4274
|
* A string value indicating how to display related records within the relationship content.
|
|
4275
4275
|
*
|
|
@@ -19359,6 +19359,10 @@ declare namespace __esri {
|
|
|
19359
19359
|
* Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html) against the associated feature service and returns an array of ObjectIDs of the features that satisfy the input query. The query succeeds only if the layer's `supportsLayerQuery` capability is enabled. Use the [getFieldUsageInfo()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#getFieldUsageInfo) method to check if the layer supports queries. If querying is not enabled, then an error with the name `scenelayer:query-not-available` is thrown. Read more about queries in the [Querying](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#querying) section of the class description above. [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#queryObjectIds)
|
|
19360
19360
|
*/
|
|
19361
19361
|
queryObjectIds(query?: Query | QueryProperties, options?: SceneLayerQueryObjectIdsOptions): Promise<number[]>;
|
|
19362
|
+
on(name: "edits", eventHandler: SceneLayerEditsEventHandler): IHandle;
|
|
19363
|
+
on(name: "layerview-create", eventHandler: SceneLayerLayerviewCreateEventHandler): IHandle;
|
|
19364
|
+
on(name: "layerview-create-error", eventHandler: SceneLayerLayerviewCreateErrorEventHandler): IHandle;
|
|
19365
|
+
on(name: "layerview-destroy", eventHandler: SceneLayerLayerviewDestroyEventHandler): IHandle;
|
|
19362
19366
|
static fromJSON(json: any): SceneLayer;
|
|
19363
19367
|
}
|
|
19364
19368
|
|
|
@@ -19474,6 +19478,13 @@ declare namespace __esri {
|
|
|
19474
19478
|
screenSizePerspectiveEnabled?: boolean;
|
|
19475
19479
|
}
|
|
19476
19480
|
|
|
19481
|
+
export interface SceneLayerEditsEvent {
|
|
19482
|
+
addedFeatures: FeatureEditResult[];
|
|
19483
|
+
deletedFeatures: FeatureEditResult[];
|
|
19484
|
+
exceededTransferLimit: boolean;
|
|
19485
|
+
updatedFeatures: FeatureEditResult[];
|
|
19486
|
+
}
|
|
19487
|
+
|
|
19477
19488
|
/**
|
|
19478
19489
|
* Results returned from the [applyEdits](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#applyEdits) method.
|
|
19479
19490
|
*
|
|
@@ -19500,6 +19511,21 @@ declare namespace __esri {
|
|
|
19500
19511
|
deleteFeatureResults: FeatureEditResult[];
|
|
19501
19512
|
}
|
|
19502
19513
|
|
|
19514
|
+
export interface SceneLayerLayerviewCreateErrorEvent {
|
|
19515
|
+
error: Error;
|
|
19516
|
+
view: View;
|
|
19517
|
+
}
|
|
19518
|
+
|
|
19519
|
+
export interface SceneLayerLayerviewCreateEvent {
|
|
19520
|
+
layerView: LayerView;
|
|
19521
|
+
view: View;
|
|
19522
|
+
}
|
|
19523
|
+
|
|
19524
|
+
export interface SceneLayerLayerviewDestroyEvent {
|
|
19525
|
+
layerView: LayerView;
|
|
19526
|
+
view: View;
|
|
19527
|
+
}
|
|
19528
|
+
|
|
19503
19529
|
export interface SceneLayerApplyEditsEdits {
|
|
19504
19530
|
/**
|
|
19505
19531
|
* An array or a [collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of features to be added.
|
|
@@ -79805,19 +79831,19 @@ declare namespace __esri {
|
|
|
79805
79831
|
|
|
79806
79832
|
export interface PopupViewOpenPopupOptions {
|
|
79807
79833
|
/**
|
|
79808
|
-
* Sets the [title](https://developers.arcgis.com/javascript/latest/api-reference/esri-
|
|
79834
|
+
* Sets the [title](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#title) of the popup.
|
|
79809
79835
|
*
|
|
79810
79836
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-PopupView.html#openPopup)
|
|
79811
79837
|
*/
|
|
79812
79838
|
title?: string;
|
|
79813
79839
|
/**
|
|
79814
|
-
* Sets the [content](https://developers.arcgis.com/javascript/latest/api-reference/esri-
|
|
79840
|
+
* Sets the [content](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#content) of the popup.
|
|
79815
79841
|
*
|
|
79816
79842
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-PopupView.html#openPopup)
|
|
79817
79843
|
*/
|
|
79818
79844
|
content?: string | HTMLElement | Widget;
|
|
79819
79845
|
/**
|
|
79820
|
-
* Sets the popup's [location](https://developers.arcgis.com/javascript/latest/api-reference/esri-
|
|
79846
|
+
* Sets the popup's [location](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#location), which is the geometry used to position the popup.
|
|
79821
79847
|
*
|
|
79822
79848
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-PopupView.html#openPopup)
|
|
79823
79849
|
*/
|
|
@@ -79829,37 +79855,37 @@ declare namespace __esri {
|
|
|
79829
79855
|
*/
|
|
79830
79856
|
fetchFeatures?: boolean;
|
|
79831
79857
|
/**
|
|
79832
|
-
* Sets the popup's [features](https://developers.arcgis.com/javascript/latest/api-reference/esri-
|
|
79858
|
+
* Sets the popup's [features](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#features), which populate the title and content of the popup based on each graphic's [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html).
|
|
79833
79859
|
*
|
|
79834
79860
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-PopupView.html#openPopup)
|
|
79835
79861
|
*/
|
|
79836
79862
|
features?: Graphic[];
|
|
79837
79863
|
/**
|
|
79838
|
-
* Sets pending [promises](https://developers.arcgis.com/javascript/latest/api-reference/esri-
|
|
79864
|
+
* Sets pending [promises](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#promises) on the popup.
|
|
79839
79865
|
*
|
|
79840
79866
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-PopupView.html#openPopup)
|
|
79841
79867
|
*/
|
|
79842
79868
|
promises?: Promise<any>[];
|
|
79843
79869
|
/**
|
|
79844
|
-
*
|
|
79870
|
+
* This property enables multiple features in a popup to display in a list rather than displaying the first selected feature.
|
|
79845
79871
|
*
|
|
79846
79872
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-PopupView.html#openPopup)
|
|
79847
79873
|
*/
|
|
79848
79874
|
featureMenuOpen?: boolean;
|
|
79849
79875
|
/**
|
|
79850
|
-
* When `true
|
|
79876
|
+
* When `true`, indicates the popup should update its [location](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#location) for each paginated feature based on the [selectedFeature's](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#selectedFeature) geometry.
|
|
79851
79877
|
*
|
|
79852
79878
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-PopupView.html#openPopup)
|
|
79853
79879
|
*/
|
|
79854
79880
|
updateLocationEnabled?: boolean;
|
|
79855
79881
|
/**
|
|
79856
|
-
*
|
|
79882
|
+
* When `true`, indicates that only the popup header will display.
|
|
79857
79883
|
*
|
|
79858
79884
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-PopupView.html#openPopup)
|
|
79859
79885
|
*/
|
|
79860
79886
|
collapsed?: boolean;
|
|
79861
79887
|
/**
|
|
79862
|
-
*
|
|
79888
|
+
* When `true`, indicates that the focus should be on the popup after it has been opened.
|
|
79863
79889
|
*
|
|
79864
79890
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-PopupView.html#openPopup)
|
|
79865
79891
|
*/
|
|
@@ -93102,7 +93128,7 @@ declare namespace __esri {
|
|
|
93102
93128
|
*
|
|
93103
93129
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-RelationshipInput.html#displayCount)
|
|
93104
93130
|
*/
|
|
93105
|
-
readonly displayCount:
|
|
93131
|
+
readonly displayCount: number;
|
|
93106
93132
|
/**
|
|
93107
93133
|
* A string value indicating how to display related records within the relationship content.
|
|
93108
93134
|
*
|
|
@@ -112494,6 +112520,10 @@ declare namespace __esri {
|
|
|
112494
112520
|
export type PopupViewModelTriggerActionEventHandler = (event: PopupViewModelTriggerActionEvent) => void;
|
|
112495
112521
|
export type PrintCompleteEventHandler = (event: PrintCompleteEvent) => void;
|
|
112496
112522
|
export type PrintSubmitEventHandler = (event: PrintSubmitEvent) => void;
|
|
112523
|
+
export type SceneLayerEditsEventHandler = (event: SceneLayerEditsEvent) => void;
|
|
112524
|
+
export type SceneLayerLayerviewCreateErrorEventHandler = (event: SceneLayerLayerviewCreateErrorEvent) => void;
|
|
112525
|
+
export type SceneLayerLayerviewCreateEventHandler = (event: SceneLayerLayerviewCreateEvent) => void;
|
|
112526
|
+
export type SceneLayerLayerviewDestroyEventHandler = (event: SceneLayerLayerviewDestroyEvent) => void;
|
|
112497
112527
|
export type SearchSearchBlurEventHandler = (event: SearchSearchBlurEvent) => void;
|
|
112498
112528
|
export type SearchSearchClearEventHandler = (event: SearchSearchClearEvent) => void;
|
|
112499
112529
|
export type SearchSearchCompleteEventHandler = (event: SearchSearchCompleteEvent) => void;
|
package/kernel.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 has from"./core/has.js";import{getInterceptor as t,addQueryParameter as e}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";const a="4.27";let s=a;s="4.27.
|
|
5
|
+
import has from"./core/has.js";import{getInterceptor as t,addQueryParameter as e}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";const a="4.27";let s=a;s="4.27.2";const r={async request(e,a){const{default:s}=await import("./request.js"),r=e.options,n=r.responseType;r.signal=a?.signal,r.responseType="native"===n||"native-request-init"===n?"native-request-init":n&&["blob","json","text"].includes(n)&&t(e.url)?.after?n:"array-buffer";const o=await s(e.url,r),i={data:o.data,httpStatus:o.httpStatus,ssl:o.ssl};switch(o.requestOptions?.responseType){case"native-request-init":return delete i.data.signal,i;case"blob":i.data=await i.data.arrayBuffer();break;case"json":i.data=(new TextEncoder).encode(JSON.stringify(i.data)).buffer;break;case"text":i.data=(new TextEncoder).encode(i.data).buffer}return{result:i,transferList:[i.data]}}};let n;function o(t){n=t}function i(t){const a=n?.findCredential(t);return a?.token?e(t,"token",a.token):t}has("host-webworker");export{i as addTokenParameter,s as fullVersion,n as id,o as setId,a as version,r as workerMessages};
|
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{ClonableMixin as i}from"../core/Clonable.js";import a from"../core/Collection.js";import n from"../core/Error.js";import p from"../core/Logger.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as d,isAbortError as y}from"../core/promiseUtils.js";import{whenOnce as u}from"../core/reactiveUtils.js";import{join as c}from"../core/urlUtils.js";import{property as f}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{getProperties as h}from"../core/accessorSupport/utils.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as v}from"../core/accessorSupport/PropertyOrigin.js";import b from"./Layer.js";import{APIKeyMixin as I}from"./mixins/APIKeyMixin.js";import{ArcGISService as w}from"./mixins/ArcGISService.js";import{EditBusLayer as j}from"./mixins/EditBusLayer.js";import{OperationalLayer as L}from"./mixins/OperationalLayer.js";import{PortalLayer as F}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as S}from"./mixins/ScaleRangeLayer.js";import{SceneService as O,SaveOperationType as _}from"./mixins/SceneService.js";import{zeroCapabilities as A}from"./support/capabilities.js";import{elevationInfo as T,labelsVisible as E,legendEnabled as P,popupEnabled as x,screenSizePerspectiveEnabled as D}from"./support/commonProperties.js";import{FeatureReduction as U}from"./support/FeatureReduction.js";import R from"./support/FeatureReductionSelection.js";import{FetchAssociatedFeatureLayer as q}from"./support/FetchAssociatedFeatureLayer.js";import{defineFieldProperties as C}from"./support/fieldProperties.js";import Q from"./support/FieldsIndex.js";import{fixRendererFields as N,unpackFieldNames as G}from"./support/fieldUtils.js";import{I3SNodePageDefinition as k,I3SMaterialDefinition as V,I3STextureSetDefinition as K,I3SGeometryDefinition as M}from"./support/I3SLayerDefinitions.js";import $ from"./support/LabelClass.js";import{reader as W}from"./support/labelingInfo.js";import z from"./support/LayerFloorInfo.js";import{RangeInfo as B}from"./support/RangeInfo.js";import H from"./support/SceneFilter.js";import{loadStyleRenderer as Z}from"../renderers/support/styleUtils.js";import J from"../rest/support/Query.js";import{sceneLayerEditingEnabled as X}from"../support/featureFlags.js";import{createPopupTemplate as Y}from"../support/popupUtils.js";import{queryAttributesFromCachedAttributesId as ee}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as te,getFetchPopupTemplate as re}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as se}from"../webdoc/support/opacityUtils.js";const oe=["3DObject","Point"],ie=C();let ae=class extends(j(O(w(L(F(S(l(I(i(b)))))))))){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 a,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 pe[this.profile]||"mesh"}set renderer(e){N(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??A,{query:t,editing:{supportsGlobalId:r,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:i,supportsReturnServiceEditsInSourceSpatialReference:a},data:{supportsZ:n,supportsM:p,isVersioned:l,supportsAttachment:d},operations:{supportsEditing:y,supportsAdd:u,supportsUpdate:c,supportsDelete:f,supportsQuery:h,supportsQueryAttachments:m,supportsAsyncConvert3D:g}}=e,v=e.operations.supportsChangeTracking,b=!!this.associatedLayer?.infoFor3D&&X();return{query:t,editing:{supportsGlobalId:r,supportsReturnServiceEditsInSourceSpatialReference:a,supportsRollbackOnFailure:s,supportsGeometryUpdate:b&&i,supportsUploadWithItemId:o},data:{supportsAttachment:d,supportsZ:n,supportsM:p,isVersioned:l},operations:{supportsQuery:h,supportsQueryAttachments:m,supportsEditing:y&&v,supportsAdd:b&&u&&v,supportsDelete:b&&f&&v,supportsUpdate:c&&v,supportsAsyncConvert3D: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&&ne[r]?ne[r]:(p.getLogger(this).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(d).then((()=>this._fetchService(t))).then((()=>Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]))).then((()=>this._validateElevationInfo())).then((()=>this._applyAssociatedLayerOverrides())).then((()=>this._populateFieldUsageInfo())).then((()=>Z(this,{origin:"service"},t))).then((()=>N(this.renderer,this.fieldsIndex))).then((()=>this.finishLoadEditablePortalLayer(e)));return this.addResolvingPromise(r),Promise.resolve(this)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){p.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new J;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=G(this.fieldsIndex,await te(this,re(this)));return ee(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 n("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:(p.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return Y(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 n("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 n("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 n("scenelayer:no-cached-statistics","Cached statistics are not available for this layer");const r=this.fieldsIndex.get(e);if(!r)throw new n("scenelayer:field-unexisting",`Field '${e}' does not exist on the layer`);for(const s of this.statisticsInfo)if(s.name===r.name){const e=c(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 n("scenelayer:no-cached-statistics","Cached statistics for this attribute are not available")}async saveAs(e,t){return this._debouncedSaveOperations(_.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(_.SAVE,e)}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");if(await this.load(),!this.associatedLayer)throw new n(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),r(this,this.associatedLayer.source,e,t)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new n(`${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&&!oe.includes(e.layerType))throw new n("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 n("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 n("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 n("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!s)throw new n("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 n("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=h(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===v.SERVICE||i===v.PORTAL_ITEM)&&t.setAtOrigin(s,this.associatedLayer[s],i)}}async _setAssociatedFeatureLayer(e){if(!["mesh-pyramids","points"].includes(this.profile))return;const t=new q(this.parsedUrl,this.portalItem,this.apiKey,e);try{this.associatedLayer=await t.fetch()}catch(r){y(r)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){await u((()=>this.popupEnabled&&null!=this.popupTemplate));const e=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?p.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):p.getLogger(this).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&&p.getLogger(this).warn(".elevationInfo=","Mesh scene layers don't support relative-to-scene elevation mode"),e.featureExpressionInfo&&"0"!==e.featureExpressionInfo.expression&&p.getLogger(this).warn(".elevationInfo=","Scene layers do not support featureExpressionInfo"))}};e([f({types:{key:"type",base:U,typeMap:{selection:R}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],ae.prototype,"featureReduction",void 0),e([f({type:[B],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],ae.prototype,"rangeInfos",void 0),e([f({json:{read:!1}})],ae.prototype,"associatedLayer",void 0),e([f({type:["show","hide"]})],ae.prototype,"listMode",void 0),e([f({type:["ArcGISSceneServiceLayer"]})],ae.prototype,"operationalLayerType",void 0),e([f({json:{read:!1},readOnly:!0})],ae.prototype,"type",void 0),e([f({...ie.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ae.prototype,"fields",void 0),e([f()],ae.prototype,"types",null),e([f()],ae.prototype,"typeIdField",null),e([f()],ae.prototype,"templates",null),e([f()],ae.prototype,"formTemplate",null),e([f({readOnly:!0})],ae.prototype,"fieldsIndex",null),e([f({type:z,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],ae.prototype,"floorInfo",void 0),e([f(ie.outFields)],ae.prototype,"outFields",void 0),e([f({type:k,readOnly:!0,json:{read:!1}})],ae.prototype,"nodePages",void 0),e([m("service","nodePages",["nodePages","pointNodePages"])],ae.prototype,"readNodePages",null),e([f({type:[V],readOnly:!0})],ae.prototype,"materialDefinitions",void 0),e([f({type:[K],readOnly:!0})],ae.prototype,"textureSetDefinitions",void 0),e([f({type:[M],readOnly:!0})],ae.prototype,"geometryDefinitions",void 0),e([f({readOnly:!0})],ae.prototype,"serviceUpdateTimeStamp",void 0),e([f({readOnly:!0})],ae.prototype,"attributeStorageInfo",void 0),e([f({readOnly:!0})],ae.prototype,"statisticsInfo",void 0),e([f({type:a.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],ae.prototype,"excludeObjectIds",void 0),e([f({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],ae.prototype,"definitionExpression",void 0),e([f({type:H,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],ae.prototype,"filter",void 0),e([f({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],ae.prototype,"path",void 0),e([f(T)],ae.prototype,"elevationInfo",null),e([f({type:String})],ae.prototype,"geometryType",null),e([f(E)],ae.prototype,"labelsVisible",void 0),e([f({type:[$],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:W},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:W},write:!0}})],ae.prototype,"labelingInfo",void 0),e([f(P)],ae.prototype,"legendEnabled",void 0),e([f({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?se(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],ae.prototype,"opacity",void 0),e([f({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ae.prototype,"priority",void 0),e([f({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ae.prototype,"semantic",void 0),e([f({types:s,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],ae.prototype,"renderer",null),e([f({json:{read:!1}})],ae.prototype,"cachedDrawingInfo",void 0),e([m("service","cachedDrawingInfo")],ae.prototype,"readCachedDrawingInfo",null),e([f({readOnly:!0,json:{read:!1}})],ae.prototype,"capabilities",null),e([f({type:Boolean,json:{read:!1}})],ae.prototype,"editingEnabled",null),e([f({readOnly:!0,json:{write:!1,read:!1}})],ae.prototype,"infoFor3D",null),e([f(x)],ae.prototype,"popupEnabled",void 0),e([f({type:r,json:{name:"popupInfo",write:!0}})],ae.prototype,"popupTemplate",void 0),e([f({readOnly:!0,json:{read:!1}})],ae.prototype,"defaultPopupTemplate",null),e([f({type:String,json:{read:!1}})],ae.prototype,"objectIdField",void 0),e([m("service","objectIdField",["objectIdField","fields"])],ae.prototype,"readObjectIdField",null),e([f({type:String,json:{read:!1}})],ae.prototype,"globalIdField",void 0),e([m("service","globalIdField",["globalIdField","fields"])],ae.prototype,"readGlobalIdField",null),e([f({readOnly:!0,type:String,json:{read:!1}})],ae.prototype,"displayField",null),e([f({type:String,json:{read:!1}})],ae.prototype,"profile",void 0),e([m("service","profile",["store.profile"])],ae.prototype,"readProfile",null),e([f({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],ae.prototype,"normalReferenceFrame",void 0),e([f(D)],ae.prototype,"screenSizePerspectiveEnabled",void 0),ae=e([g("esri.layers.SceneLayer")],ae);const ne={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},pe={"mesh-pyramids":"mesh",points:"point",lines:"polyline",polygons:"polygon"},le=ae;export{le 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 i from"../request.js";import{ClonableMixin as o}from"../core/Clonable.js";import a from"../core/Collection.js";import n from"../core/Error.js";import p from"../core/Logger.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as d,isAbortError as y}from"../core/promiseUtils.js";import{whenOnce as u}from"../core/reactiveUtils.js";import{join as c}from"../core/urlUtils.js";import{property as h}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 m}from"../core/accessorSupport/decorators/reader.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as v}from"../core/accessorSupport/PropertyOrigin.js";import b from"./Layer.js";import{APIKeyMixin as I}from"./mixins/APIKeyMixin.js";import{ArcGISService as w}from"./mixins/ArcGISService.js";import{EditBusLayer as j}from"./mixins/EditBusLayer.js";import{OperationalLayer as L}from"./mixins/OperationalLayer.js";import{PortalLayer as S}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as F}from"./mixins/ScaleRangeLayer.js";import{SceneService as O,SaveOperationType as E}from"./mixins/SceneService.js";import{isHostedAgolService as A}from"./support/arcgisLayerUrl.js";import{zeroCapabilities as _}from"./support/capabilities.js";import{elevationInfo as T,labelsVisible as x,legendEnabled as D,popupEnabled as P,screenSizePerspectiveEnabled as U}from"./support/commonProperties.js";import{FeatureReduction as R}from"./support/FeatureReduction.js";import q from"./support/FeatureReductionSelection.js";import{FetchAssociatedFeatureLayer as C}from"./support/FetchAssociatedFeatureLayer.js";import{defineFieldProperties as G}from"./support/fieldProperties.js";import Q from"./support/FieldsIndex.js";import{fixRendererFields as N,unpackFieldNames as k}from"./support/fieldUtils.js";import{I3SNodePageDefinition as V,I3SMaterialDefinition as K,I3STextureSetDefinition as M,I3SGeometryDefinition as $}from"./support/I3SLayerDefinitions.js";import W from"./support/LabelClass.js";import{reader as z}from"./support/labelingInfo.js";import B from"./support/LayerFloorInfo.js";import{RangeInfo as H}from"./support/RangeInfo.js";import Z from"./support/SceneFilter.js";import{loadStyleRenderer as J}from"../renderers/support/styleUtils.js";import X from"../rest/support/Query.js";import{sceneLayerEditingEnabled as Y}from"../support/featureFlags.js";import{createPopupTemplate as ee}from"../support/popupUtils.js";import{queryAttributesFromCachedAttributesId as te}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as re,getFetchPopupTemplate as se}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as ie}from"../webdoc/support/opacityUtils.js";const oe=["3DObject","Point"],ae=G();let ne=class extends(j(O(w(L(S(F(l(I(o(b)))))))))){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 a,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:V.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get geometryType(){return le[this.profile]||"mesh"}set renderer(e){N(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??_,{query:t,editing:{supportsGlobalId:r,supportsRollbackOnFailure:s,supportsUploadWithItemId:i,supportsGeometryUpdate:o,supportsReturnServiceEditsInSourceSpatialReference:a},data:{supportsZ:n,supportsM:p,isVersioned:l,supportsAttachment:d},operations:{supportsEditing:y,supportsAdd:u,supportsUpdate:c,supportsDelete:h,supportsQuery:f,supportsQueryAttachments:m,supportsAsyncConvert3D:g}}=e,v=e.operations.supportsChangeTracking,b=!!this.associatedLayer?.infoFor3D&&Y();return{query:t,editing:{supportsGlobalId:r,supportsReturnServiceEditsInSourceSpatialReference:a,supportsRollbackOnFailure:s,supportsGeometryUpdate:b&&o,supportsUploadWithItemId:i},data:{supportsAttachment:d,supportsZ:n,supportsM:p,isVersioned:l},operations:{supportsQuery:f,supportsQueryAttachments:m,supportsEditing:y&&v,supportsAdd:b&&u&&v,supportsDelete:b&&h&&v,supportsUpdate:c&&v,supportsAsyncConvert3D: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&&pe[r]?pe[r]:(p.getLogger(this).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(d).then((()=>this._fetchService(t))).then((()=>Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]))).then((()=>this._validateElevationInfo())).then((()=>this._applyAssociatedLayerOverrides())).then((()=>this._populateFieldUsageInfo())).then((()=>J(this,{origin:"service"},t))).then((()=>N(this.renderer,this.fieldsIndex))).then((()=>this.finishLoadEditablePortalLayer(e)));return this.addResolvingPromise(r),Promise.resolve(this)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){p.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new X;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=k(this.fieldsIndex,await re(this,se(this)));return te(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 n("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const i=new t;return i.attributes=s[0],i.layer=this,i.sourceLayer=this,i}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:(p.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return ee(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 n("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 n("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 n("scenelayer:no-cached-statistics","Cached statistics are not available for this layer");const r=this.fieldsIndex.get(e);if(!r)throw new n("scenelayer:field-unexisting",`Field '${e}' does not exist on the layer`);for(const s of this.statisticsInfo)if(s.name===r.name){const e=c(this.parsedUrl.path,s.href);return i(e,{query:{f:"json",token:this.apiKey},responseType:"json",signal:t?t.signal:null}).then((e=>e.data))}throw new n("scenelayer:no-cached-statistics","Cached statistics for this attribute are not available")}async saveAs(e,t){return this._debouncedSaveOperations(E.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(E.SAVE,e)}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");if(await this.load(),!this.associatedLayer)throw new n(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),r(this,this.associatedLayer.source,e,t)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new n(`${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&&!oe.includes(e.layerType))throw new n("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 n("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 n("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 i=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,s=i;break;case"vertex-reference-frame":r=!0,s=!i;break;default:r=!1}}if(!r)throw new n("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!s)throw new n("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 n("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(),this._applyAssociatedLayerExtentOverride()}_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],i=this.originIdOf(s),o=this.associatedLayer.originIdOf(s);i<o&&(o===v.SERVICE||o===v.PORTAL_ITEM)&&t.setAtOrigin(s,this.associatedLayer[s],o)}}_applyAssociatedLayerExtentOverride(){const e=this.associatedLayer?.editingInfo?.lastEditDate,t=this.associatedLayer?.serverGens,r=this.associatedLayer?.getAtOrigin("fullExtent","service");if(!Y()||null==this.associatedLayer?.infoFor3D||!r||!A(this.associatedLayer?.url)||!e||this.serviceUpdateTimeStamp?.lastUpdate===e.getTime()||!this.serviceUpdateTimeStamp&&t?.minServerGen===t?.serverGen)return;f(this).setAtOrigin("fullExtent",r.clone(),v.SERVICE)}async _setAssociatedFeatureLayer(e){if(!["mesh-pyramids","points"].includes(this.profile))return;const t=new C(this.parsedUrl,this.portalItem,this.apiKey,e);try{this.associatedLayer=await t.fetch()}catch(r){y(r)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){await u((()=>this.popupEnabled&&null!=this.popupTemplate));const e=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?p.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):p.getLogger(this).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&&p.getLogger(this).warn(".elevationInfo=","Mesh scene layers don't support relative-to-scene elevation mode"),e.featureExpressionInfo&&"0"!==e.featureExpressionInfo.expression&&p.getLogger(this).warn(".elevationInfo=","Scene layers do not support featureExpressionInfo"))}};e([h({types:{key:"type",base:R,typeMap:{selection:q}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],ne.prototype,"featureReduction",void 0),e([h({type:[H],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],ne.prototype,"rangeInfos",void 0),e([h({json:{read:!1}})],ne.prototype,"associatedLayer",void 0),e([h({type:["show","hide"]})],ne.prototype,"listMode",void 0),e([h({type:["ArcGISSceneServiceLayer"]})],ne.prototype,"operationalLayerType",void 0),e([h({json:{read:!1},readOnly:!0})],ne.prototype,"type",void 0),e([h({...ae.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ne.prototype,"fields",void 0),e([h()],ne.prototype,"types",null),e([h()],ne.prototype,"typeIdField",null),e([h()],ne.prototype,"templates",null),e([h()],ne.prototype,"formTemplate",null),e([h({readOnly:!0})],ne.prototype,"fieldsIndex",null),e([h({type:B,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],ne.prototype,"floorInfo",void 0),e([h(ae.outFields)],ne.prototype,"outFields",void 0),e([h({type:V,readOnly:!0,json:{read:!1}})],ne.prototype,"nodePages",void 0),e([m("service","nodePages",["nodePages","pointNodePages"])],ne.prototype,"readNodePages",null),e([h({type:[K],readOnly:!0})],ne.prototype,"materialDefinitions",void 0),e([h({type:[M],readOnly:!0})],ne.prototype,"textureSetDefinitions",void 0),e([h({type:[$],readOnly:!0})],ne.prototype,"geometryDefinitions",void 0),e([h({readOnly:!0})],ne.prototype,"serviceUpdateTimeStamp",void 0),e([h({readOnly:!0})],ne.prototype,"attributeStorageInfo",void 0),e([h({readOnly:!0})],ne.prototype,"statisticsInfo",void 0),e([h({type:a.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],ne.prototype,"excludeObjectIds",void 0),e([h({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],ne.prototype,"definitionExpression",void 0),e([h({type:Z,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],ne.prototype,"filter",void 0),e([h({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],ne.prototype,"path",void 0),e([h(T)],ne.prototype,"elevationInfo",null),e([h({type:String})],ne.prototype,"geometryType",null),e([h(x)],ne.prototype,"labelsVisible",void 0),e([h({type:[W],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:z},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:z},write:!0}})],ne.prototype,"labelingInfo",void 0),e([h(D)],ne.prototype,"legendEnabled",void 0),e([h({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?ie(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],ne.prototype,"opacity",void 0),e([h({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ne.prototype,"priority",void 0),e([h({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ne.prototype,"semantic",void 0),e([h({types:s,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],ne.prototype,"renderer",null),e([h({json:{read:!1}})],ne.prototype,"cachedDrawingInfo",void 0),e([m("service","cachedDrawingInfo")],ne.prototype,"readCachedDrawingInfo",null),e([h({readOnly:!0,json:{read:!1}})],ne.prototype,"capabilities",null),e([h({type:Boolean,json:{read:!1}})],ne.prototype,"editingEnabled",null),e([h({readOnly:!0,json:{write:!1,read:!1}})],ne.prototype,"infoFor3D",null),e([h(P)],ne.prototype,"popupEnabled",void 0),e([h({type:r,json:{name:"popupInfo",write:!0}})],ne.prototype,"popupTemplate",void 0),e([h({readOnly:!0,json:{read:!1}})],ne.prototype,"defaultPopupTemplate",null),e([h({type:String,json:{read:!1}})],ne.prototype,"objectIdField",void 0),e([m("service","objectIdField",["objectIdField","fields"])],ne.prototype,"readObjectIdField",null),e([h({type:String,json:{read:!1}})],ne.prototype,"globalIdField",void 0),e([m("service","globalIdField",["globalIdField","fields"])],ne.prototype,"readGlobalIdField",null),e([h({readOnly:!0,type:String,json:{read:!1}})],ne.prototype,"displayField",null),e([h({type:String,json:{read:!1}})],ne.prototype,"profile",void 0),e([m("service","profile",["store.profile"])],ne.prototype,"readProfile",null),e([h({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],ne.prototype,"normalReferenceFrame",void 0),e([h(U)],ne.prototype,"screenSizePerspectiveEnabled",void 0),ne=e([g("esri.layers.SceneLayer")],ne);const pe={"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"},le={"mesh-pyramids":"mesh",points:"point",lines:"polyline",polygons:"polygon"},de=ne;export{de as default};
|
package/layers/VideoLayer.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 t}from"../chunks/tslib.es6.js";import"../geometry.js";import
|
|
5
|
+
import{_ as t}from"../chunks/tslib.es6.js";import"../geometry.js";import e from"../request.js";import{clamp as r}from"../core/mathUtils.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{watch as i,initial as s}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as n}from"../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import a from"../geometry/Polyline.js";import u from"../geometry/SpatialReference.js";import c from"./Layer.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{CustomParametersMixin as y}from"./mixins/CustomParametersMixin.js";import{ScaleRangeLayer as d}from"./mixins/ScaleRangeLayer.js";import{url as h}from"./support/commonProperties.js";import f from"./support/PlaybackInfo.js";import{getVideoLayerCapabilities as g}from"./support/serviceCapabilitiesUtils.js";import v from"./support/TelemetryData.js";import j from"./support/TelemetryDisplay.js";import S from"./support/VideoFrame.js";import b from"./video/VideoController.js";import{getTelemetryData as O,getSensorTrailPoints as U,readVideoTimeExtent as T}from"./video/videoUtils.js";import x from"../geometry/Polygon.js";import C from"../geometry/Extent.js";let P=class extends(m(d(o(y(c))))){constructor(t){super(t),this._trailPoints=[],this.capabilities=null,this.connectionInfo=null,this.controller=new b,this.copyright=null,this.coverage=null,this.description=null,this.frame=null,this.frameCount=null,this.initialExtent=null,this.playbackInfo=null,this.posterUrl=null,this.protocol="hls",this.qualities=null,this.sourceJSON=null,this.spatialReference=u.WGS84,this.telemetryDisplay=null,this.videoTimeExtent=null,this.title=null,this.type="video",this.url=null}initialize(){this.telemetryDisplay=new j({frameCenter:!0,frameOutline:!0,lineOfSight:!0,sensorLocation:!0,sensorTrail:!0}),this.addHandles([i((()=>this.metadata),(()=>this.notifyChange("telemetry"))),i((()=>this.telemetry?.sensorLocation),(t=>this._setSensorTrail(t)),s)])}load(t){const e=null!=t?t.signal:null;return this.addResolvingPromise(this._fetchService(e)),Promise.resolve(this)}get buffered(){return this.controller.buffered}readCapabilitiesFromService(t,e){return g(e)}get currentTime(){return this.controller.currentTime}get duration(){return this.controller.duration}get ended(){return this.controller.ended}get loop(){return this.controller.loop}set loop(t){this.controller.loop=t}get metadata(){return this.controller?.currentMetadata}get muted(){return this.controller.muted}set muted(t){this.controller.muted=t}get playbackRate(){return this.controller.rate}set playbackRate(t){this.controller.rate=t}get playbackUrl(){return this.connectionInfo&&this.protocol?this.connectionInfo[this.protocol]:null}get sourceUrl(){return this.controller.sourceUrl??""}set sourceUrl(t){this.controller.sourceUrl=t}get state(){return this.controller.state}get telemetry(){return O(this.metadata)}get waiting(){return this.controller.waiting}play(){this.controller.play()}pause(){this.controller.pause()}reset(){this.controller.reset()}setCurrentTime(t){if(!this.duration)return;const e=r(t,0,this.duration);this.controller.setCurrentTime(e)}getCurrentFrame(){}toGround(t,e){return this.controller?.cameraSensorModel?.metadataSupportsTransforms?this.controller.cameraSensorModel.transformImageToGeo(t,e):null}toVideo(t){if(!this.controller?.cameraSensorModel?.metadataSupportsTransforms)return null;const e=this.controller.cameraSensorModel.transformGeoToImage(t.x,t.y,t.z);return{x:e[0],y:e[1]}}async _fetchService(t){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:r,ssl:o}=await e(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters},signal:t});o&&(this.url=this.url.replace(/^http:/i,"https:")),this.sourceJSON=r,this.read(r,{origin:"service",url:this.parsedUrl})}_setSensorTrail(t){if(!t)return;const e=U(t,this._trailPoints);this._trailPoints=[...e];const r=this._trailPoints.map((t=>t.toArray())),o=new a({hasZ:t.hasZ,paths:[r]});this.telemetry.sensorTrail=o.clone()}};t([l({readOnly:!0})],P.prototype,"buffered",null),t([l({readOnly:!0,json:{read:!1}})],P.prototype,"capabilities",void 0),t([n("service","capabilities",["supportsCoverageQuery","supportsExportClip","supportsMensuration"])],P.prototype,"readCapabilitiesFromService",null),t([l({readOnly:!0,json:{read:{source:"connectionUrl"}}})],P.prototype,"connectionInfo",void 0),t([l()],P.prototype,"controller",void 0),t([l({type:String})],P.prototype,"copyright",void 0),t([l({type:x})],P.prototype,"coverage",void 0),t([l({type:Number})],P.prototype,"currentTime",null),t([l({type:String})],P.prototype,"description",void 0),t([l({type:Number})],P.prototype,"duration",null),t([l({type:Boolean})],P.prototype,"ended",null),t([l({type:S})],P.prototype,"frame",void 0),t([l({type:Number})],P.prototype,"frameCount",void 0),t([l({type:C})],P.prototype,"initialExtent",void 0),t([l({type:Boolean})],P.prototype,"loop",null),t([l({readOnly:!0})],P.prototype,"metadata",null),t([l({type:Boolean})],P.prototype,"muted",null),t([l({type:f})],P.prototype,"playbackInfo",void 0),t([l({type:Number})],P.prototype,"playbackRate",null),t([l({readOnly:!0})],P.prototype,"playbackUrl",null),t([l({readOnly:!0,json:{read:{source:"poster"}}})],P.prototype,"posterUrl",void 0),t([l({type:String})],P.prototype,"protocol",void 0),t([l({readOnly:!0})],P.prototype,"qualities",void 0),t([l()],P.prototype,"sourceJSON",void 0),t([l({type:String})],P.prototype,"sourceUrl",null),t([l()],P.prototype,"spatialReference",void 0),t([l({type:String})],P.prototype,"state",null),t([l({type:v})],P.prototype,"telemetry",null),t([l({type:j})],P.prototype,"telemetryDisplay",void 0),t([l({readOnly:!0,nonNullable:!1,json:{read:{reader:T,source:"time"}}})],P.prototype,"videoTimeExtent",void 0),t([l({readOnly:!0,json:{read:{source:"name"}}})],P.prototype,"title",void 0),t([l({readOnly:!0})],P.prototype,"type",void 0),t([l(h)],P.prototype,"url",void 0),t([l({readOnly:!0})],P.prototype,"waiting",null),P=t([p("esri.layers.VideoLayer")],P);const N=P;export{N 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 e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import{id as s}from"../../../kernel.js";import r from"../../../request.js";import a from"../../../TimeExtent.js";import{isSome as i}from"../../../core/arrayUtils.js";import o from"../../../core/Error.js";import has from"../../../core/has.js";import{JSONMap as n}from"../../../core/jsonMap.js";import u from"../../../core/Loadable.js";import l from"../../../core/Logger.js";import{setDeepValue as d}from"../../../core/object.js";import{debounce as c,after as p}from"../../../core/promiseUtils.js";import{getMetersPerCartesianUnitForSR as h}from"../../../core/unitUtils.js";import{join as y,parseData as m}from"../../../core/urlUtils.js";import{generateBracedUUID as f}from"../../../core/uuid.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as R}from"../../../core/accessorSupport/decorators/subclass.js";import S from"../../../geometry/Extent.js";import{initializeProjection as b,project as F}from"../../../geometry/projection.js";import{fromJSON as E}from"../../../geometry/support/jsonUtils.js";import{toRelativeVertexSpace as w}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isOriginalExternal as q}from"../../../geometry/support/meshUtils/External.js";import{isFeatureIdentifierArrayWithGlobalId as _,isFeatureIdentifierArrayWithObjectId as O}from"../editingSupport.js";import{createDrawingInfo as A}from"./support/clientSideDefaults.js";import I from"./support/QueryTask.js";import{isHostedAgolService as j}from"../../support/arcgisLayerUrl.js";import{getAssetMapTable as x}from"../../support/infoFor3D.js";import{executeQueryJSON as T}from"../../../rest/query/executeQueryJSON.js";import{unapplyEditsZUnitScaling as N}from"../../../rest/query/operations/editsZScale.js";import v from"../../../rest/support/Query.js";import J from"../../../geometry/SpatialReference.js";const M=new n({originalAndCurrentFeatures:"original-and-current-features",none:"none"}),U=new Set(["Feature Layer","Oriented Imagery Layer","Table"]),k=new n({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let Q=class extends u{constructor(){super(...arguments),this.type="feature-layer",this.refresh=c((async()=>{await this.load();const e=this.sourceJSON.editingInfo?.lastEditDate;if(null==e)return{dataChanged:!0,updates:{}};try{await this._fetchService(null)}catch{return{dataChanged:!0,updates:{}}}const t=e!==this.sourceJSON.editingInfo?.lastEditDate;return{dataChanged:t,updates:t?{editingInfo:this.sourceJSON.editingInfo,extent:this.sourceJSON.extent}:null}})),this._ongoingAssetUploads=new Map}load(e){const t=null!=e?e.signal:null,s=this.layer.sourceJSON;return this.addResolvingPromise(this._fetchService(s,t)),Promise.resolve(this)}get queryTask(){const{capabilities:e,parsedUrl:t,dynamicDataSource:s,infoFor3D:r,gdbVersion:a,spatialReference:i,fieldsIndex:o}=this.layer,n=has("featurelayer-pbf")&&e?.query.supportsFormatPBF&&null==r,u=e?.operations?.supportsQueryAttachments??!1;return new I({url:t.path,pbfSupported:n,fieldsIndex:o,infoFor3D:r,dynamicDataSource:s,gdbVersion:a,sourceSpatialReference:i,queryAttachmentsSupported:u})}async addAttachment(e,t){await this.load();const s=e.attributes[this.layer.objectIdField],a=this.layer.parsedUrl.path+"/"+s+"/addAttachment",i=this._getLayerRequestOptions(),o=this._getFormDataForAttachment(t,i.query);try{const e=await r(a,{body:o});return this._createFeatureEditResult(e.data.addAttachmentResult)}catch(n){throw this._createAttachmentErrorResult(s,n)}}async updateAttachment(e,t,s){await this.load();const a=e.attributes[this.layer.objectIdField],i=this.layer.parsedUrl.path+"/"+a+"/updateAttachment",o=this._getLayerRequestOptions({query:{attachmentId:t}}),n=this._getFormDataForAttachment(s,o.query);try{const e=await r(i,{body:n});return this._createFeatureEditResult(e.data.updateAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(a,u)}}async applyEdits(e,t){await this.load();const{layer:a}=this,o=a.infoFor3D,n=null!=o,u=n||(t?.globalIdUsed??!1),l=n?await this._uploadMeshesAndGetAssetMapEditsJSON(e):null,d=e.addFeatures?.map((e=>this._getFeatureJSON(e,o)))??[],c=(await Promise.all(d)).filter(i),p=e.updateFeatures?.map((e=>this._getFeatureJSON(e,o)))??[],h=(await Promise.all(p)).filter(i),y=this._getFeatureIds(e.deleteFeatures,u);N(c,h,a.spatialReference);const m=await this._getAttachmentEditsJSON(e),f=a.capabilities.editing.supportsAsyncApplyEdits&&n,g={gdbVersion:t?.gdbVersion||a.gdbVersion,rollbackOnFailure:t?.rollbackOnFailureEnabled,useGlobalIds:u,returnEditMoment:t?.returnEditMoment,usePreviousEditMoment:t?.usePreviousEditMoment,sessionId:t?.sessionId,async:f};t?.returnServiceEditsOption?(g.edits=JSON.stringify([{id:a.layerId,adds:c,updates:h,deletes:y,attachments:m,assetMaps:l}]),g.returnServiceEditsOption=M.toJSON(t?.returnServiceEditsOption),g.returnServiceEditsInSourceSR=t?.returnServiceEditsInSourceSR):(g.adds=c.length?JSON.stringify(c):null,g.updates=h.length?JSON.stringify(h):null,g.deletes=y.length?u?JSON.stringify(y):y.join(","):null,g.attachments=m&&JSON.stringify(m),g.assetMaps=null!=l?JSON.stringify(l):void 0);const R=this._getLayerRequestOptions({method:"post",query:g}),S=t?.returnServiceEditsOption?a.url:a.parsedUrl.path,b=f?await this._asyncApplyEdits(S+"/applyEdits",R):await r(S+"/applyEdits",R);if(!a.capabilities.operations?.supportsEditing&&a.effectiveCapabilities?.operations?.supportsEditing){const e=s?.findCredential(a.url);await(e?.refreshToken())}return this._createEditsResult(b)}async deleteAttachments(e,t){await this.load();const s=e.attributes[this.layer.objectIdField],a=this.layer.parsedUrl.path+"/"+s+"/deleteAttachments";try{return(await r(a,this._getLayerRequestOptions({query:{attachmentIds:t.join(",")},method:"post"}))).data.deleteAttachmentResults.map(this._createFeatureEditResult)}catch(i){throw this._createAttachmentErrorResult(s,i)}}fetchRecomputedExtents(e={}){const t=e.signal;return this.load({signal:t}).then((async()=>{const t=this._getLayerRequestOptions({...e,query:{returnUpdates:!0}}),{layerId:s,url:i}=this.layer,{data:o}=await r(`${i}/${s}`,t),{id:n,extent:u,fullExtent:l,timeExtent:d}=o,c=u||l;return{id:n,fullExtent:c&&S.fromJSON(c),timeExtent:d&&a.fromJSON({start:d[0],end:d[1]})}}))}async queryAttachments(e,t={}){await this.load();const s=this._getLayerRequestOptions(t);return this.queryTask.executeAttachmentQuery(e,s)}async queryFeatures(e,t){return await this.load(),this.queryTask.execute(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeaturesJSON(e,t){return await this.load(),this.queryTask.executeJSON(e,{...t,query:this._createRequestQueryOptions(t)})}async queryObjectIds(e,t){return await this.load(),this.queryTask.executeForIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeatureCount(e,t){return await this.load(),this.queryTask.executeForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryExtent(e,t){return await this.load(),this.queryTask.executeForExtent(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeatures(e,t){return await this.load(),this.queryTask.executeRelationshipQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeaturesCount(e,t){return await this.load(),this.queryTask.executeRelationshipQueryForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopFeatures(e,t){return await this.load(),this.queryTask.executeTopFeaturesQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopObjectIds(e,t){return await this.load(),this.queryTask.executeForTopIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopExtents(e,t){return await this.load(),this.queryTask.executeForTopExtents(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopCount(e,t){return await this.load(),this.queryTask.executeForTopCount(e,{...t,query:this._createRequestQueryOptions(t)})}async fetchPublishingStatus(){if(!j(this.layer.url))return"unavailable";const e=y(this.layer.url,"status"),t=await r(e,{query:{f:"json"}});return k.fromJSON(t.data.status)}async uploadAssets(e,t){const{uploadAssets:s}=await import("./support/uploadAssets.js");return s(e,{layer:this.layer,ongoingUploads:this._ongoingAssetUploads},t)}async _asyncApplyEdits(e,t){const s=(await r(e,t)).data.statusUrl;for(;;){const e=(await r(s,{query:{f:"json"},responseType:"json"})).data;switch(e.status){case"Completed":return r(e.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new o("async-applyEdits-failed","asynchronous applyEdits call failed.");case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new o("async-applyEdits-failed","asynchronous applyEdits call failed (undefined response status)")}await p(C)}}_createRequestQueryOptions(e){const t={...this.layer.customParameters,token:this.layer.apiKey,...e?.query};return this.layer.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t}async _fetchService(e,t){if(!e){const{data:s}=await r(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:has("featurelayer-advanced-symbols")?{returnAdvancedSymbols:!0}:{},signal:t}));e=s}this.sourceJSON=this._patchServiceJSON(e);const s=e.type;if(!U.has(s))throw new o("feature-layer-source:unsupported-type",`Source type "${s}" is not supported`)}_patchServiceJSON(e){if("Table"!==e.type&&e.geometryType&&!e?.drawingInfo?.renderer&&!e.defaultSymbol){const t=A(e.geometryType).renderer;d("drawingInfo.renderer",t,e)}return"esriGeometryMultiPatch"===e.geometryType&&e.infoFor3D&&(e.geometryType="mesh"),e}async _getFeatureJSON(e,t){const{geometry:s}=e,r={...e.attributes};if(null!=t&&"mesh"===s?.type){const{transformFieldRoles:e}=t,{origin:a,spatialReference:i,transform:o}=s,n=this.layer.spatialReference;await b(i,n);const u=F(a,n);if(r[e.originX]=u.x,r[e.originY]=u.y,r[e.originZ]=u.z??0,null!=o){const{translation:t,scale:a,rotation:u}=o,{vertexSpace:l}=s,d=l.isGeoreferenced?1:h(i)/h(n);r[e.translationX]=t[0]*d,r[e.translationY]=-t[2]*d,r[e.translationZ]=t[1]*d,r[e.scaleX]=a[0],r[e.scaleY]=a[2],r[e.scaleZ]=a[1],r[e.rotationX]=u[0],r[e.rotationY]=u[2],r[e.rotationZ]=u[1],r[e.rotationDeg]=u[3]}return{geometry:null,attributes:r}}return null==s?{attributes:r}:"mesh"===s.type||"extent"===s.type?null:{geometry:s.toJSON(),attributes:r}}async _getAttachmentEditsJSON(e){const t=await Promise.all((e.addAttachments??[]).map((e=>this._getAttachmentEditJSON(e)))),s=await Promise.all((e.updateAttachments??[]).map((e=>this._getAttachmentEditJSON(e)))),r=e.deleteAttachments??[];return t.length||s.length||r.length?{adds:t,updates:s,deletes:[...r]}:null}async _getAttachmentEditJSON(e){const{feature:t,attachment:s}=e,{globalId:r,name:a,contentType:i,data:o,uploadId:n}=s,u={globalId:r,parentGlobalId:null,contentType:null,name:null,uploadId:null,data:null};if(t&&(u.parentGlobalId="attributes"in t?t.attributes&&t.attributes[this.layer.globalIdField]:t.globalId),n)u.uploadId=n;else if(o){const e=await m(o);e&&(u.contentType=e.mediaType,u.data=e.data),o instanceof File&&(u.name=o.name)}return a&&(u.name=a),i&&(u.contentType=i),u}async _uploadMeshesAndGetAssetMapEditsJSON(e){const{addAssetFeatures:t}=e;if(!t?.length)return null;const s=await this._filterRedundantAssetMaps(t);if(!t?.length)return null;const r=new Array,a=new Map;for(const i of s){const{geometry:e}=i,{vertexSpace:t}=e;if(t.isRelative)r.push(e);else{const t=w(e);a.set(t,e),i.geometry=t,r.push(t)}}await this.uploadAssets(r);for(const[i,o]of a)o.addExternalSources(i.metadata.externalSources.items);return{adds:this._getAssetMapEditsJSON(s),updates:[],deletes:[]}}_getAssetMapEditsJSON(e){const t=new Array,s=this.layer.globalIdField,r=this.layer.parsedUrl;for(const a of e){const e=a.geometry,{metadata:i}=e,o=i.getExternalSourcesOnService(r),n=a.getAttribute(s);if(0===o.length){l.getLogger(this).error(`Skipping feature ${n}. The mesh it is associated with has not been uploaded to the service and cannot be mapped to it.`);continue}const{source:u}=o.find(q)??o[0],{vertexSpace:d}=e,c=d.isGeoreferenced?["PROJECT_VERTICES"]:[];for(const s of u)1===s.parts.length?t.push({globalId:f(),parentGlobalId:n,assetName:s.assetName,assetHash:s.parts[0].partHash,flags:c}):l.getLogger(this).error(`Skipping asset ${s.assetName}. It does not have exactly one part, so we cannot map it to a feature.`)}return t}_getFeatureIds(e,t){if(!e||0===e.length)return[];if(t&&_(e))return e.map((e=>e.globalId));if(O(e))return e.map((e=>e.objectId));const{layer:s}=this,r=t?s.globalIdField:s.objectIdField;return r?e.map((e=>e.getAttribute(r))):[]}_createEditsResult(e){const t=e.data,{layerId:s}=this.layer,r=[];let a=null;if(Array.isArray(t))for(const u of t)r.push({id:u.id,editedFeatures:u.editedFeatures}),u.id===s&&(a={addResults:u.addResults??[],updateResults:u.updateResults??[],deleteResults:u.deleteResults??[],attachments:u.attachments,editMoment:u.editMoment});else a=t;const i=a?.assetMaps;if(i){for(const e of i.addResults)e.success||l.getLogger(this).error(`Failed to map asset to feature with globalId ${e.globalId}.`);for(const e of i.updateResults)e.success||l.getLogger(this).error(`Failed to map asset to feature with globalId ${e.globalId}.`)}const o=a?.attachments,n={addFeatureResults:a?.addResults?.map(this._createFeatureEditResult,this)??[],updateFeatureResults:a?.updateResults?.map(this._createFeatureEditResult,this)??[],deleteFeatureResults:a?.deleteResults?.map(this._createFeatureEditResult,this)??[],addAttachmentResults:o&&o.addResults?o.addResults.map(this._createFeatureEditResult,this):[],updateAttachmentResults:o&&o.updateResults?o.updateResults.map(this._createFeatureEditResult,this):[],deleteAttachmentResults:o&&o.deleteResults?o.deleteResults.map(this._createFeatureEditResult,this):[]};if(a?.editMoment&&(n.editMoment=a.editMoment),r.length>0){n.editedFeatureResults=[];for(const e of r){const{editedFeatures:t}=e,s=t?.spatialReference?new J(t.spatialReference):null;n.editedFeatureResults.push({layerId:e.id,editedFeatures:{adds:t?.adds?.map((e=>this._createEditedFeature(e,s)))||[],updates:t?.updates?.map((e=>({original:this._createEditedFeature(e[0],s),current:this._createEditedFeature(e[1],s)})))||[],deletes:t?.deletes?.map((e=>this._createEditedFeature(e,s)))||[],spatialReference:s}})}}return n}_createEditedFeature(e,s){return new t({attributes:e.attributes,geometry:E({...e.geometry,spatialReference:s})})}_createFeatureEditResult(e){const t=!0===e.success?null:e.error||{code:void 0,description:void 0};return{objectId:e.objectId,globalId:e.globalId,error:t?new o("feature-layer-source:edit-failure",t.description,{code:t.code}):null}}_createAttachmentErrorResult(e,t){const s=t.details.messages&&t.details.messages[0]||t.message,r=t.details.httpStatus||t.details.messageCode;return{objectId:e,globalId:null,error:new o("feature-layer-source:attachment-failure",s,{code:r})}}_getFormDataForAttachment(e,t){const s=e instanceof FormData?e:e&&e.elements?new FormData(e):null;if(s)for(const r in t){const e=t[r];null!=e&&(s.set?s.set(r,e):s.append(r,e))}return s}_getLayerRequestOptions(e={}){const{parsedUrl:t,gdbVersion:s,dynamicDataSource:r}=this.layer;return{...e,query:{gdbVersion:s,layer:r?JSON.stringify({source:r}):void 0,...t.query,f:"json",...this._createRequestQueryOptions(e)},responseType:"json"}}async _filterRedundantAssetMaps(e){const{layer:t}=this,{globalIdField:s,infoFor3D:r,parsedUrl:a}=t;if(null==r||null==s)return e;const o=x(r);if(null==o)return e;const n=y(a.path,`../${o.id}`),u=new Array,l=new Array;for(const i of e)i.geometry.metadata.getExternalSourcesOnService(a).length>0?l.push(i):u.push(i);const d=l.map((e=>e.getAttribute(s))).filter(i);if(0===d.length)return e;const{assetMapFieldRoles:{parentGlobalId:c,assetHash:p}}=r,h=new v;h.where=`${c} IN (${d.map((e=>`'${e}'`))})`,h.outFields=[p,c],h.returnGeometry=!1;const m=await T(n,h),{features:f}=m;return 0===f.length?e:[...u,...l.filter((e=>{const t=e.getAttribute(s);if(!t)return!0;const{metadata:r}=e.geometry,i=f.filter((e=>e.getAttribute(c)===t));if(0===i.length)return!0;const o=i.map((e=>e.getAttribute(p)));return r.getExternalSourcesOnService(a).flatMap((({source:e})=>e.flatMap((e=>e.parts.map((e=>e.partHash)))))).some((e=>o.every((t=>e!==t))))}))]}};e([g()],Q.prototype,"type",void 0),e([g({constructOnly:!0})],Q.prototype,"layer",void 0),e([g({readOnly:!0})],Q.prototype,"queryTask",null),Q=e([R("esri.layers.graphics.sources.FeatureLayerSource")],Q);const C=1e3,D=Q;export{D as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import{id as s}from"../../../kernel.js";import r from"../../../request.js";import a from"../../../TimeExtent.js";import{isSome as i}from"../../../core/arrayUtils.js";import o from"../../../core/Error.js";import has from"../../../core/has.js";import{JSONMap as n}from"../../../core/jsonMap.js";import u from"../../../core/Loadable.js";import l from"../../../core/Logger.js";import{setDeepValue as d}from"../../../core/object.js";import{debounce as c,after as p,throwIfAbortError as h}from"../../../core/promiseUtils.js";import{getMetersPerCartesianUnitForSR as y}from"../../../core/unitUtils.js";import{join as m,parseData as f}from"../../../core/urlUtils.js";import{generateBracedUUID as g}from"../../../core/uuid.js";import{property as R}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as S}from"../../../core/accessorSupport/decorators/subclass.js";import b from"../../../geometry/Extent.js";import{initializeProjection as F,project as E}from"../../../geometry/projection.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{toRelativeVertexSpace as q}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isOriginalExternal as _}from"../../../geometry/support/meshUtils/External.js";import{isFeatureIdentifierArrayWithGlobalId as O,isFeatureIdentifierArrayWithObjectId as A}from"../editingSupport.js";import{createDrawingInfo as I}from"./support/clientSideDefaults.js";import j from"./support/QueryTask.js";import{isHostedAgolService as x}from"../../support/arcgisLayerUrl.js";import{getAssetMapTable as T}from"../../support/infoFor3D.js";import{executeQueryJSON as N}from"../../../rest/query/executeQueryJSON.js";import{unapplyEditsZUnitScaling as v}from"../../../rest/query/operations/editsZScale.js";import J from"../../../rest/support/Query.js";import M from"../../../geometry/SpatialReference.js";const U=new n({originalAndCurrentFeatures:"original-and-current-features",none:"none"}),k=new Set(["Feature Layer","Oriented Imagery Layer","Table"]),Q=new n({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let C=class extends u{constructor(){super(...arguments),this.type="feature-layer",this.refresh=c((async()=>{await this.load();const e=this.sourceJSON.editingInfo?.lastEditDate;if(null==e)return{dataChanged:!0,updates:{}};try{await this._fetchService(null)}catch{return{dataChanged:!0,updates:{}}}const t=e!==this.sourceJSON.editingInfo?.lastEditDate;return{dataChanged:t,updates:t?{editingInfo:this.sourceJSON.editingInfo,extent:this.sourceJSON.extent}:null}})),this._ongoingAssetUploads=new Map}load(e){const t=null!=e?e.signal:null,s=this.layer.sourceJSON;return this.addResolvingPromise(this._fetchService(s,t)),Promise.resolve(this)}get queryTask(){const{capabilities:e,parsedUrl:t,dynamicDataSource:s,infoFor3D:r,gdbVersion:a,spatialReference:i,fieldsIndex:o}=this.layer,n=has("featurelayer-pbf")&&e?.query.supportsFormatPBF&&null==r,u=e?.operations?.supportsQueryAttachments??!1;return new j({url:t.path,pbfSupported:n,fieldsIndex:o,infoFor3D:r,dynamicDataSource:s,gdbVersion:a,sourceSpatialReference:i,queryAttachmentsSupported:u})}async addAttachment(e,t){await this.load();const s=e.attributes[this.layer.objectIdField],a=this.layer.parsedUrl.path+"/"+s+"/addAttachment",i=this._getLayerRequestOptions(),o=this._getFormDataForAttachment(t,i.query);try{const e=await r(a,{body:o});return this._createFeatureEditResult(e.data.addAttachmentResult)}catch(n){throw this._createAttachmentErrorResult(s,n)}}async updateAttachment(e,t,s){await this.load();const a=e.attributes[this.layer.objectIdField],i=this.layer.parsedUrl.path+"/"+a+"/updateAttachment",o=this._getLayerRequestOptions({query:{attachmentId:t}}),n=this._getFormDataForAttachment(s,o.query);try{const e=await r(i,{body:n});return this._createFeatureEditResult(e.data.updateAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(a,u)}}async applyEdits(e,t){await this.load();const{layer:a}=this,o=a.infoFor3D,n=null!=o,u=n||(t?.globalIdUsed??!1),l=n?await this._uploadMeshesAndGetAssetMapEditsJSON(e):null,d=e.addFeatures?.map((e=>this._getFeatureJSON(e,o)))??[],c=(await Promise.all(d)).filter(i),p=e.updateFeatures?.map((e=>this._getFeatureJSON(e,o)))??[],h=(await Promise.all(p)).filter(i),y=this._getFeatureIds(e.deleteFeatures,u);v(c,h,a.spatialReference);const m=await this._getAttachmentEditsJSON(e),f=a.capabilities.editing.supportsAsyncApplyEdits&&n,g={gdbVersion:t?.gdbVersion||a.gdbVersion,rollbackOnFailure:t?.rollbackOnFailureEnabled,useGlobalIds:u,returnEditMoment:t?.returnEditMoment,usePreviousEditMoment:t?.usePreviousEditMoment,sessionId:t?.sessionId,async:f};t?.returnServiceEditsOption?(g.edits=JSON.stringify([{id:a.layerId,adds:c,updates:h,deletes:y,attachments:m,assetMaps:l}]),g.returnServiceEditsOption=U.toJSON(t?.returnServiceEditsOption),g.returnServiceEditsInSourceSR=t?.returnServiceEditsInSourceSR):(g.adds=c.length?JSON.stringify(c):null,g.updates=h.length?JSON.stringify(h):null,g.deletes=y.length?u?JSON.stringify(y):y.join(","):null,g.attachments=m&&JSON.stringify(m),g.assetMaps=null!=l?JSON.stringify(l):void 0);const R=this._getLayerRequestOptions({method:"post",query:g}),S=t?.returnServiceEditsOption?a.url:a.parsedUrl.path,b=f?await this._asyncApplyEdits(S+"/applyEdits",R):await r(S+"/applyEdits",R);if(!a.capabilities.operations?.supportsEditing&&a.effectiveCapabilities?.operations?.supportsEditing){const e=s?.findCredential(a.url);await(e?.refreshToken())}return this._createEditsResult(b)}async deleteAttachments(e,t){await this.load();const s=e.attributes[this.layer.objectIdField],a=this.layer.parsedUrl.path+"/"+s+"/deleteAttachments";try{return(await r(a,this._getLayerRequestOptions({query:{attachmentIds:t.join(",")},method:"post"}))).data.deleteAttachmentResults.map(this._createFeatureEditResult)}catch(i){throw this._createAttachmentErrorResult(s,i)}}fetchRecomputedExtents(e={}){const t=e.signal;return this.load({signal:t}).then((async()=>{const t=this._getLayerRequestOptions({...e,query:{returnUpdates:!0}}),{layerId:s,url:i}=this.layer,{data:o}=await r(`${i}/${s}`,t),{id:n,extent:u,fullExtent:l,timeExtent:d}=o,c=u||l;return{id:n,fullExtent:c&&b.fromJSON(c),timeExtent:d&&a.fromJSON({start:d[0],end:d[1]})}}))}async queryAttachments(e,t={}){await this.load();const s=this._getLayerRequestOptions(t);return this.queryTask.executeAttachmentQuery(e,s)}async queryFeatures(e,t){return await this.load(),this.queryTask.execute(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeaturesJSON(e,t){return await this.load(),this.queryTask.executeJSON(e,{...t,query:this._createRequestQueryOptions(t)})}async queryObjectIds(e,t){return await this.load(),this.queryTask.executeForIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeatureCount(e,t){return await this.load(),this.queryTask.executeForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryExtent(e,t){return await this.load(),this.queryTask.executeForExtent(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeatures(e,t){return await this.load(),this.queryTask.executeRelationshipQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeaturesCount(e,t){return await this.load(),this.queryTask.executeRelationshipQueryForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopFeatures(e,t){return await this.load(),this.queryTask.executeTopFeaturesQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopObjectIds(e,t){return await this.load(),this.queryTask.executeForTopIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopExtents(e,t){return await this.load(),this.queryTask.executeForTopExtents(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopCount(e,t){return await this.load(),this.queryTask.executeForTopCount(e,{...t,query:this._createRequestQueryOptions(t)})}async fetchPublishingStatus(){if(!x(this.layer.url))return"unavailable";const e=m(this.layer.url,"status"),t=await r(e,{query:{f:"json"}});return Q.fromJSON(t.data.status)}async uploadAssets(e,t){const{uploadAssets:s}=await import("./support/uploadAssets.js");return s(e,{layer:this.layer,ongoingUploads:this._ongoingAssetUploads},t)}async _asyncApplyEdits(e,t){const s=(await r(e,t)).data.statusUrl;for(;;){const e=(await r(s,{query:{f:"json"},responseType:"json"})).data;switch(e.status){case"Completed":return r(e.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new o("async-applyEdits-failed","asynchronous applyEdits call failed.");case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new o("async-applyEdits-failed","asynchronous applyEdits call failed (undefined response status)")}await p(D)}}_createRequestQueryOptions(e){const t={...this.layer.customParameters,token:this.layer.apiKey,...e?.query};return this.layer.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t}async _fetchService(e,t){if(!e){const{data:s}=await r(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:has("featurelayer-advanced-symbols")?{returnAdvancedSymbols:!0}:{},signal:t}));e=s}this.sourceJSON=await this._patchServiceJSON(e,t);const s=e.type;if(!k.has(s))throw new o("feature-layer-source:unsupported-type",`Source type "${s}" is not supported`)}async _patchServiceJSON(e,t){if("Table"!==e.type&&e.geometryType&&!e?.drawingInfo?.renderer&&!e.defaultSymbol){const t=I(e.geometryType).renderer;d("drawingInfo.renderer",t,e)}if("esriGeometryMultiPatch"===e.geometryType&&e.infoFor3D&&(e.geometryType="mesh"),null==e.extent)try{const{data:s}=await r(this.layer.url,this._getLayerRequestOptions({signal:t}));s.spatialReference&&(e.extent={xmin:0,ymin:0,xmax:0,ymax:0,spatialReference:s.spatialReference})}catch(s){h(s)}return e}async _getFeatureJSON(e,t){const{geometry:s}=e,r={...e.attributes};if(null!=t&&"mesh"===s?.type){const{transformFieldRoles:e}=t,{origin:a,spatialReference:i,transform:o}=s,n=this.layer.spatialReference;await F(i,n);const u=E(a,n);if(r[e.originX]=u.x,r[e.originY]=u.y,r[e.originZ]=u.z??0,null!=o){const{translation:t,scale:a,rotation:u}=o,{vertexSpace:l}=s,d=l.isGeoreferenced?1:y(i)/y(n);r[e.translationX]=t[0]*d,r[e.translationY]=-t[2]*d,r[e.translationZ]=t[1]*d,r[e.scaleX]=a[0],r[e.scaleY]=a[2],r[e.scaleZ]=a[1],r[e.rotationX]=u[0],r[e.rotationY]=u[2],r[e.rotationZ]=u[1],r[e.rotationDeg]=u[3]}return{geometry:null,attributes:r}}return null==s?{attributes:r}:"mesh"===s.type||"extent"===s.type?null:{geometry:s.toJSON(),attributes:r}}async _getAttachmentEditsJSON(e){const t=await Promise.all((e.addAttachments??[]).map((e=>this._getAttachmentEditJSON(e)))),s=await Promise.all((e.updateAttachments??[]).map((e=>this._getAttachmentEditJSON(e)))),r=e.deleteAttachments??[];return t.length||s.length||r.length?{adds:t,updates:s,deletes:[...r]}:null}async _getAttachmentEditJSON(e){const{feature:t,attachment:s}=e,{globalId:r,name:a,contentType:i,data:o,uploadId:n}=s,u={globalId:r,parentGlobalId:null,contentType:null,name:null,uploadId:null,data:null};if(t&&(u.parentGlobalId="attributes"in t?t.attributes&&t.attributes[this.layer.globalIdField]:t.globalId),n)u.uploadId=n;else if(o){const e=await f(o);e&&(u.contentType=e.mediaType,u.data=e.data),o instanceof File&&(u.name=o.name)}return a&&(u.name=a),i&&(u.contentType=i),u}async _uploadMeshesAndGetAssetMapEditsJSON(e){const{addAssetFeatures:t}=e;if(!t?.length)return null;const s=await this._filterRedundantAssetMaps(t);if(!t?.length)return null;const r=new Array,a=new Map;for(const i of s){const{geometry:e}=i,{vertexSpace:t}=e;if(t.isRelative)r.push(e);else{const t=q(e);a.set(t,e),i.geometry=t,r.push(t)}}await this.uploadAssets(r);for(const[i,o]of a)o.addExternalSources(i.metadata.externalSources.items);return{adds:this._getAssetMapEditsJSON(s),updates:[],deletes:[]}}_getAssetMapEditsJSON(e){const t=new Array,s=this.layer.globalIdField,r=this.layer.parsedUrl;for(const a of e){const e=a.geometry,{metadata:i}=e,o=i.getExternalSourcesOnService(r),n=a.getAttribute(s);if(0===o.length){l.getLogger(this).error(`Skipping feature ${n}. The mesh it is associated with has not been uploaded to the service and cannot be mapped to it.`);continue}const{source:u}=o.find(_)??o[0],{vertexSpace:d}=e,c=d.isGeoreferenced?["PROJECT_VERTICES"]:[];for(const s of u)1===s.parts.length?t.push({globalId:g(),parentGlobalId:n,assetName:s.assetName,assetHash:s.parts[0].partHash,flags:c}):l.getLogger(this).error(`Skipping asset ${s.assetName}. It does not have exactly one part, so we cannot map it to a feature.`)}return t}_getFeatureIds(e,t){if(!e||0===e.length)return[];if(t&&O(e))return e.map((e=>e.globalId));if(A(e))return e.map((e=>e.objectId));const{layer:s}=this,r=t?s.globalIdField:s.objectIdField;return r?e.map((e=>e.getAttribute(r))):[]}_createEditsResult(e){const t=e.data,{layerId:s}=this.layer,r=[];let a=null;if(Array.isArray(t))for(const u of t)r.push({id:u.id,editedFeatures:u.editedFeatures}),u.id===s&&(a={addResults:u.addResults??[],updateResults:u.updateResults??[],deleteResults:u.deleteResults??[],attachments:u.attachments,editMoment:u.editMoment});else a=t;const i=a?.assetMaps;if(i){for(const e of i.addResults)e.success||l.getLogger(this).error(`Failed to map asset to feature with globalId ${e.globalId}.`);for(const e of i.updateResults)e.success||l.getLogger(this).error(`Failed to map asset to feature with globalId ${e.globalId}.`)}const o=a?.attachments,n={addFeatureResults:a?.addResults?.map(this._createFeatureEditResult,this)??[],updateFeatureResults:a?.updateResults?.map(this._createFeatureEditResult,this)??[],deleteFeatureResults:a?.deleteResults?.map(this._createFeatureEditResult,this)??[],addAttachmentResults:o&&o.addResults?o.addResults.map(this._createFeatureEditResult,this):[],updateAttachmentResults:o&&o.updateResults?o.updateResults.map(this._createFeatureEditResult,this):[],deleteAttachmentResults:o&&o.deleteResults?o.deleteResults.map(this._createFeatureEditResult,this):[]};if(a?.editMoment&&(n.editMoment=a.editMoment),r.length>0){n.editedFeatureResults=[];for(const e of r){const{editedFeatures:t}=e,s=t?.spatialReference?new M(t.spatialReference):null;n.editedFeatureResults.push({layerId:e.id,editedFeatures:{adds:t?.adds?.map((e=>this._createEditedFeature(e,s)))||[],updates:t?.updates?.map((e=>({original:this._createEditedFeature(e[0],s),current:this._createEditedFeature(e[1],s)})))||[],deletes:t?.deletes?.map((e=>this._createEditedFeature(e,s)))||[],spatialReference:s}})}}return n}_createEditedFeature(e,s){return new t({attributes:e.attributes,geometry:w({...e.geometry,spatialReference:s})})}_createFeatureEditResult(e){const t=!0===e.success?null:e.error||{code:void 0,description:void 0};return{objectId:e.objectId,globalId:e.globalId,error:t?new o("feature-layer-source:edit-failure",t.description,{code:t.code}):null}}_createAttachmentErrorResult(e,t){const s=t.details.messages&&t.details.messages[0]||t.message,r=t.details.httpStatus||t.details.messageCode;return{objectId:e,globalId:null,error:new o("feature-layer-source:attachment-failure",s,{code:r})}}_getFormDataForAttachment(e,t){const s=e instanceof FormData?e:e&&e.elements?new FormData(e):null;if(s)for(const r in t){const e=t[r];null!=e&&(s.set?s.set(r,e):s.append(r,e))}return s}_getLayerRequestOptions(e={}){const{parsedUrl:t,gdbVersion:s,dynamicDataSource:r}=this.layer;return{...e,query:{gdbVersion:s,layer:r?JSON.stringify({source:r}):void 0,...t.query,f:"json",...this._createRequestQueryOptions(e)},responseType:"json"}}async _filterRedundantAssetMaps(e){const{layer:t}=this,{globalIdField:s,infoFor3D:r,parsedUrl:a}=t;if(null==r||null==s)return e;const o=T(r);if(null==o)return e;const n=m(a.path,`../${o.id}`),u=new Array,l=new Array;for(const i of e)i.geometry.metadata.getExternalSourcesOnService(a).length>0?l.push(i):u.push(i);const d=l.map((e=>e.getAttribute(s))).filter(i);if(0===d.length)return e;const{assetMapFieldRoles:{parentGlobalId:c,assetHash:p}}=r,h=new J;h.where=`${c} IN (${d.map((e=>`'${e}'`))})`,h.outFields=[p,c],h.returnGeometry=!1;const y=await N(n,h),{features:f}=y;return 0===f.length?e:[...u,...l.filter((e=>{const t=e.getAttribute(s);if(!t)return!0;const{metadata:r}=e.geometry,i=f.filter((e=>e.getAttribute(c)===t));if(0===i.length)return!0;const o=i.map((e=>e.getAttribute(p)));return r.getExternalSourcesOnService(a).flatMap((({source:e})=>e.flatMap((e=>e.parts.map((e=>e.partHash)))))).some((e=>o.every((t=>e!==t))))}))]}};e([R()],C.prototype,"type",void 0),e([R({constructOnly:!0})],C.prototype,"layer",void 0),e([R({readOnly:!0})],C.prototype,"queryTask",null),C=e([S("esri.layers.graphics.sources.FeatureLayerSource")],C);const D=1e3,L=C;export{L as default};
|