@arcgis/core 4.33.0-next.20250311 → 4.33.0-next.20250312
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/{bc988b9d3990380be907.js → 0a98dc3ea67ce97a6e7b.js} +1 -1
- package/assets/esri/core/workers/chunks/{eacab4bd6eb58e545f73.js → 11f9d7cd95891596b716.js} +1 -1
- package/assets/esri/core/workers/chunks/{5b1b93665c93955491c4.js → 3ee2cf2db08164cde43c.js} +44 -44
- package/assets/esri/core/workers/chunks/4d95cc85f4b73e857b1f.js +1 -0
- package/assets/esri/core/workers/chunks/54ace3e4802934f3f9f2.js +1 -0
- package/assets/esri/core/workers/chunks/5820808c7659460969d4.js +1 -0
- package/assets/esri/core/workers/chunks/add0770399a63b7635b5.js +1 -0
- package/assets/esri/core/workers/chunks/b2f8702a9f54fff23ad9.js +1 -0
- package/assets/esri/core/workers/chunks/b8b8425e8b1246cdc86d.js +1 -0
- package/assets/esri/core/workers/chunks/{0137c17f15d79134b4ca.js → d0ad20548eb4786b7750.js} +36 -36
- package/assets/esri/core/workers/chunks/d0fbd4c6bffe0cb98d14.js +1 -0
- package/assets/esri/core/workers/chunks/dd6f18bbab50be139d20.js +1 -0
- package/assets/esri/core/workers/chunks/de6864e120243cf0bee8.js +1 -0
- package/assets/esri/core/workers/chunks/fc7ce48c7b31a4665a9b.js +1 -0
- package/chunks/DefaultMaterial.glsl.js +21 -21
- package/chunks/Pattern.glsl.js +23 -25
- package/chunks/RealisticTree.glsl.js +12 -12
- package/chunks/Terrain.glsl.js +27 -27
- package/core/LRUCache.js +1 -1
- package/core/MemCache.js +1 -1
- package/geometry/support/ShortArray.js +5 -0
- package/interfaces.d.ts +18 -4
- package/layers/video/VideoController.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/LabelInfo.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +63 -77
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +6 -6
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/lib/Normals.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/parts/Model.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
- package/views/FocusAreas.js +1 -1
- package/views/animation/easing.js +1 -1
- package/views/support/projectionUtils.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/support/GoTo.js +1 -1
- package/widgets/support/goToUtils.js +1 -1
- package/assets/esri/core/workers/chunks/3bbf7f89bc37c01b453b.js +0 -1
- package/assets/esri/core/workers/chunks/40f2c8022fd583c43f42.js +0 -1
- package/assets/esri/core/workers/chunks/4f2bb248dd258b493663.js +0 -1
- package/assets/esri/core/workers/chunks/5295e685ae839087c568.js +0 -1
- package/assets/esri/core/workers/chunks/54b115ecf446b4095d3e.js +0 -1
- package/assets/esri/core/workers/chunks/5a536de1ecae424bad05.js +0 -1
- package/assets/esri/core/workers/chunks/7ca9230681d05ef89059.js +0 -1
- package/assets/esri/core/workers/chunks/840c02610d845114ace7.js +0 -1
- package/assets/esri/core/workers/chunks/a4228101f709f0bb9a3d.js +0 -1
- package/assets/esri/core/workers/chunks/ffd28a9b1d8db3a731f4.js +0 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
var e;function E(E){return E===e.POSITION}!function(e){e.POSITION="position",e.NORMAL="normal",e.NORMALCOMPRESSED="normalCompressed",e.UV0="uv0",e.COLOR="color",e.SYMBOLCOLOR="symbolColor",e.SIZE="size",e.ROTATION="rotation",e.TANGENT="tangent",e.OFFSET="offset",e.PERSPECTIVEDIVIDE="perspectiveDivide",e.CENTEROFFSETANDDISTANCE="centerOffsetAndDistance",e.LENGTH="length",e.PREVPOSITION="prevPosition",e.NEXTPOSITION="nextPosition",e.SUBDIVISIONFACTOR="subdivisionFactor",e.COLORFEATUREATTRIBUTE="colorFeatureAttribute",e.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",e.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",e.DISTANCETOSTART="distanceToStart",e.UVMAPSPACE="uvMapSpace",e.BOUNDINGRECT="boundingRect",e.UVREGION="uvRegion",e.PROFILERIGHT="profileRight",e.PROFILEUP="profileUp",e.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",e.FEATUREVALUE="featureValue",e.INSTANCEMODELORIGINHI="instanceModelOriginHi",e.INSTANCEMODELORIGINLO="instanceModelOriginLo",e.INSTANCEMODEL="instanceModel",e.INSTANCEMODELNORMAL="instanceModelNormal",e.INSTANCECOLOR="instanceColor",e.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",e.LOCALTRANSFORM="localTransform",e.GLOBALTRANSFORM="globalTransform",e.BOUNDINGSPHERE="boundingSphere",e.MODELORIGIN="modelOrigin",e.MODELSCALEFACTORS="modelScaleFactors",e.FEATUREATTRIBUTE="featureAttribute",e.STATE="state",e.LODLEVEL="lodLevel",e.POSITION0="position0",e.POSITION1="position1",e.NORMAL2COMPRESSED="normal2Compressed",e.COMPONENTINDEX="componentIndex",e.VARIANTOFFSET="variantOffset",e.VARIANTSTROKE="variantStroke",e.VARIANTEXTENSION="variantExtension",e.SIDENESS="sideness",e.START="start",e.END="end",e.UP="up",e.START_UP="startUp",e.END_UP="endUp",e.EXTRUDE="extrude",e.OBJECTANDLAYERIDCOLOR="objectAndLayerIdColor",e.INSTANCEOBJECTANDLAYERIDCOLOR="instanceObjectAndLayerIdColor"}(e||(e={}));export{e as VertexAttribute,E as affectsGeometry};
|
|
5
|
+
var e;function E(E){return E===e.POSITION}!function(e){e.POSITION="position",e.NORMAL="normal",e.NORMALCOMPRESSED="normalCompressed",e.UV0="uv0",e.COLOR="color",e.SYMBOLCOLOR="symbolColor",e.SIZE="size",e.ROTATION="rotation",e.TANGENT="tangent",e.OFFSET="offset",e.PERSPECTIVEDIVIDE="perspectiveDivide",e.CENTEROFFSETANDDISTANCE="centerOffsetAndDistance",e.LENGTH="length",e.PREVPOSITION="prevPosition",e.NEXTPOSITION="nextPosition",e.SUBDIVISIONFACTOR="subdivisionFactor",e.COLORFEATUREATTRIBUTE="colorFeatureAttribute",e.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",e.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",e.DISTANCETOSTART="distanceToStart",e.UVMAPSPACE="uvMapSpace",e.BOUNDINGRECT="boundingRect",e.UVREGION="uvRegion",e.PROFILERIGHT="profileRight",e.PROFILEUP="profileUp",e.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",e.PROFILEAUXDATA="profileAuxData",e.FEATUREVALUE="featureValue",e.INSTANCEMODELORIGINHI="instanceModelOriginHi",e.INSTANCEMODELORIGINLO="instanceModelOriginLo",e.INSTANCEMODEL="instanceModel",e.INSTANCEMODELNORMAL="instanceModelNormal",e.INSTANCECOLOR="instanceColor",e.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",e.LOCALTRANSFORM="localTransform",e.GLOBALTRANSFORM="globalTransform",e.BOUNDINGSPHERE="boundingSphere",e.MODELORIGIN="modelOrigin",e.MODELSCALEFACTORS="modelScaleFactors",e.FEATUREATTRIBUTE="featureAttribute",e.STATE="state",e.LODLEVEL="lodLevel",e.POSITION0="position0",e.POSITION1="position1",e.NORMAL2COMPRESSED="normal2Compressed",e.COMPONENTINDEX="componentIndex",e.VARIANTOFFSET="variantOffset",e.VARIANTSTROKE="variantStroke",e.VARIANTEXTENSION="variantExtension",e.SIDENESS="sideness",e.START="start",e.END="end",e.UP="up",e.START_UP="startUp",e.END_UP="endUp",e.EXTRUDE="extrude",e.OBJECTANDLAYERIDCOLOR="objectAndLayerIdColor",e.INSTANCEOBJECTANDLAYERIDCOLOR="instanceObjectAndLayerIdColor"}(e||(e={}));export{e as VertexAttribute,E as affectsGeometry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{i as e,I as t,t as r}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newLayout as
|
|
5
|
+
import{i as e,I as t,t as r}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newLayout as a}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as s,isColor as n,isDepth as o,isColorHighlightOrDepth as h,isColorOrColorEmission as c}from"../core/shaderLibrary/ShaderOutput.js";import p from"../lib/GLMaterial.js";import{Material as m,RenderOccludedFlag as l}from"../lib/Material.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{VertexAttribute as T}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as d}from"./VisualVariablePassParameters.js";import{vertexAttributeLocations as f,LineMarkerTechnique as A}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as v,LineMarkerSpace as _,LineMarkerAnchor as E}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as g}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as O}from"../../../../webscene/support/AlphaCutoff.js";class S extends m{constructor(e){super(e,I),this._configuration=new v,this.vertexAttributeLocations=f,this.produces=new Map([[u.OPAQUE_MATERIAL,e=>e===s.Highlight||n(e)&&this.parameters.renderOccluded===l.OccludeAndTransparentStencil],[u.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>o(e)],[u.OCCLUDER_MATERIAL,e=>h(e)&&this.parameters.renderOccluded===l.OccludeAndTransparentStencil],[u.TRANSPARENT_OCCLUDER_MATERIAL,e=>h(e)&&this.parameters.renderOccluded===l.OccludeAndTransparentStencil],[u.TRANSPARENT_MATERIAL,e=>n(e)&&this.parameters.writeDepth],[u.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>n(e)&&!this.parameters.writeDepth],[u.DRAPED_MATERIAL,e=>c(e)||e===s.Highlight]]),this._layout=this.createLayout()}getConfiguration(e,t){return this._configuration.output=e,this._configuration.space=t.slot===u.DRAPED_MATERIAL?_.Draped:this.parameters.worldSpace?_.World:_.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==g.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=t.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===l.OccludeAndTransparentStencil,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest&&c(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}get visible(){return this.parameters.color[3]>=O}intersect(){}createLayout(){const e=a().vec3f(T.POSITION).vec3f(T.PREVPOSITION).vec2f(T.UV0);return this.parameters.worldSpace&&e.vec3f(T.NORMAL),this.parameters.vvSize?e.f32(T.SIZEFEATUREATTRIBUTE):e.f32(T.SIZE),this.parameters.vvColor?e.f32(T.COLORFEATUREATTRIBUTE):e.vec4u8(T.COLOR),this.parameters.vvOpacity&&e.f32(T.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new L(this._layout,this.parameters)}createGLMaterial(e){return new R(e)}}class R extends p{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextures.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(A,e)}}class I extends d{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=g.BUTT,this.anchor=E.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.markerTexture=null}}class L{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,a,s,n,o,h){const c=s.get(T.POSITION).data,p=c.length/3;let m=[1,0,0];const l=s.get(T.NORMAL);this._parameters.worldSpace&&null!=l&&(m=l.data);let u=1,d=0;this._parameters.vvSize?d=s.get(T.SIZEFEATUREATTRIBUTE).data[0]:s.has(T.SIZE)&&(u=s.get(T.SIZE).data[0]);let f=[1,1,1,1],A=0;this._parameters.vvColor?A=s.get(T.COLORFEATUREATTRIBUTE).data[0]:s.has(T.COLOR)&&(f=s.get(T.COLOR).data);let v=0;this._parameters.vvOpacity&&(v=s.get(T.OPACITYFEATUREATTRIBUTE).data[0]);const _=new Float32Array(o.buffer),E=new Uint8Array(o.buffer);let g=h*(this.vertexBufferLayout.stride/4);const O=(e,t,r,i)=>{if(_[g++]=e[0],_[g++]=e[1],_[g++]=e[2],_[g++]=t[0],_[g++]=t[1],_[g++]=t[2],_[g++]=r[0],_[g++]=r[1],this._parameters.worldSpace&&(_[g++]=m[0],_[g++]=m[1],_[g++]=m[2]),this._parameters.vvSize?_[g++]=d:_[g++]=u,this._parameters.vvColor)_[g++]=A;else{const e=Math.min(4*i,f.length-4),t=4*g;g++,E[t]=f[e],E[t+1]=f[e+1],E[t+2]=f[e+2],E[t+3]=f[e+3]}this._parameters.vvOpacity&&(_[g++]=v)};let S;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(S||(S={}));const R=(a,s)=>{const n=e(P,c[3*a],c[3*a+1],c[3*a+2]),o=C;let h=a+s;do{e(o,c[3*h],c[3*h+1],c[3*h+2]),h+=s}while(t(n,o)&&h>=0&&h<p);i&&(r(n,n,i),r(o,o,i)),O(n,o,[-1,-1],a),O(n,o,[1,-1],a),O(n,o,[1,1],a),O(n,o,[-1,-1],a),O(n,o,[1,1],a),O(n,o,[-1,1],a)},I=this._parameters.placement;return"begin"!==I&&"begin-end"!==I||R(0,S.ASCENDING),"end"!==I&&"begin-end"!==I||R(p-1,S.DESCENDING),null}}const P=i(),C=i();export{S as LineMarkerMaterial,I as Parameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clamp as e}from"../../../../core/mathUtils.js";import{clone as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as i}from"../../../../chunks/vec32.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as a}from"../../support/buffer/InterleavedLayout.js";import{isShadowRelatedOutput as o,is3DGeometryOutputMRT as n,isColorOrColorEmission as c,ShaderOutput as h}from"../core/shaderLibrary/ShaderOutput.js";import{EmissionSource as u}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as m}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as
|
|
5
|
+
import{clamp as e}from"../../../../core/mathUtils.js";import{clone as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as i}from"../../../../chunks/vec32.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as a}from"../../support/buffer/InterleavedLayout.js";import{isShadowRelatedOutput as o,is3DGeometryOutputMRT as n,isColorOrColorEmission as c,ShaderOutput as h}from"../core/shaderLibrary/ShaderOutput.js";import{EmissionSource as u}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as m}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as l}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as p}from"../effects/geometry/olidUtils.js";import f from"../lib/GLMaterial.js";import{Material as d}from"../lib/Material.js";import{isPathGeometry as b}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as g,intersectAabbInvDir as v}from"../lib/RayIntersections.js";import{RenderSlot as S}from"../lib/RenderSlot.js";import{VertexAttribute as A}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as _}from"./DefaultBufferWriter.js";import{vertexAttributeLocations as y,PathTechnique as O,PathPassParameters as j}from"./PathTechnique.js";import{PathTechniqueConfiguration as P}from"./PathTechniqueConfiguration.js";import{alphaCutoff as R}from"../../../../webscene/support/AlphaCutoff.js";class L extends d{constructor(e,t){super(e,M),this._vertexBufferLayout=T(),this.vertexAttributeLocations=y,this.supportsEdges=!0,this.produces=new Map([[S.OPAQUE_MATERIAL,e=>(this.parameters.castShadows&&o(e)||n(e))&&!this.transparent],[S.TRANSPARENT_MATERIAL,e=>(this.parameters.castShadows&&o(e)||n(e))&&this.transparent]]),this._configuration=new P(t.spherical)}get hasEmissions(){return!i(this.parameters.emissiveFactor,r)}getConfiguration(e,t){return this._configuration.output=e,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,c(e)?(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?m.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?m.WindingOrder:m.None,this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?l.Schematic:l.Disabled,this._configuration.emissionSource=this.parameters.usePBR?u.Value:u.None,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}isVisibleForOutput(e){return e!==h.Shadow&&e!==h.ShadowExcludeHighlight&&e!==h.ShadowHighlight||this.parameters.castShadows}get visible(){return this.parameters.opacity>=R}intersect(i,r,a,o,n,c){const h=i;if(!b(h))return;const u=h.path,m=t(this.parameters.size);if(this.parameters.vvSize){const{offset:t,factor:i,minSize:r,maxSize:s,fallback:a}=this.parameters.vvSize,o=u.sizeAttributeValue;Number.isNaN(o)?(m[0]*=a[0],m[1]*=a[2]):(m[0]*=e(t[0]+o*i[0],r[0],s[0]),m[1]*=e(t[2]+o*i[2],r[2],s[2]))}const l=new g(!1,a.options.normalRequired),p=Math.max(m[0],m[1]),f=i.boundingInfo;if(null==f)return void w(u,m,o,n,l,c);const d=s(f.bbMin[0]-p,f.bbMin[1]-p,f.bbMin[2]-p,f.bbMax[0]+p,f.bbMax[1]+p,f.bbMax[2]+p),S=[n[0]-o[0],n[1]-o[1],n[2]-o[2]],A=Math.sqrt(S[0]*S[0]+S[1]*S[1]+S[2]*S[2]),_=[A/S[0],A/S[1],A/S[2]];v(d,o,_,a.tolerance)&&w(u,m,o,n,l,c)}createBufferWriter(){return new _(this._vertexBufferLayout)}createGLMaterial(e){return new E(e)}get transparent(){const{parameters:e}=this;return e.drivenOpacity||e.opacity<1}}function T(){const e=a().vec3f(A.POSITION).vec4f(A.PROFILEVERTEXANDNORMAL).vec4f(A.FEATUREVALUE).vec2f(A.PROFILEAUXDATA).vec2i16(A.PROFILERIGHT,{glNormalized:!0}).vec2i16(A.PROFILEUP,{glNormalized:!0});return p()&&e.vec4u8(A.OBJECTANDLAYERIDCOLOR),e}class E extends f{beginSlot(e){return this.getTechnique(O,e)}}function w(e,t,i,r,s,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(i,r,s,a)}class M extends j{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1}}export{M as Parameters,L as PathMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{freeze as r,create as e,ZEROS as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isColorOrColorEmission as t,ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{PathVertexPositionPassParameters as o}from"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import{NormalsDoubleSidedMode as l}from"../core/shaderLibrary/shading/Normals.glsl.js";import{ReloadableShaderModule as n}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as a}from"../core/shaderTechnique/ShaderTechnique.js";import{OITPass as m}from"../lib/OITPass.js";import{blending as c,oitDepthTest as p,getDrawBuffers as u,OITPolygonOffset as h}from"../lib/OrderIndependentTransparency.js";import{stencilWriteMaskOn as d,stencilBaseAllZerosParams as f}from"../lib/StencilUtils.js";import{VertexAttribute as b}from"../lib/VertexAttribute.js";import{advancedMRRFactors as O}from"./pbrUtils.js";import{P as j}from"../../../../chunks/Path.glsl.js";import{SpecialDrawBuffers as P}from"../../../webgl/enums.js";import{makePipelineState as T,frontFaceCullingParams as
|
|
5
|
+
import{freeze as r,create as e,ZEROS as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isColorOrColorEmission as t,ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{PathVertexPositionPassParameters as o}from"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import{NormalsDoubleSidedMode as l}from"../core/shaderLibrary/shading/Normals.glsl.js";import{ReloadableShaderModule as n}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as a}from"../core/shaderTechnique/ShaderTechnique.js";import{OITPass as m}from"../lib/OITPass.js";import{blending as c,oitDepthTest as p,getDrawBuffers as u,OITPolygonOffset as h}from"../lib/OrderIndependentTransparency.js";import{stencilWriteMaskOn as d,stencilBaseAllZerosParams as f}from"../lib/StencilUtils.js";import{VertexAttribute as b}from"../lib/VertexAttribute.js";import{advancedMRRFactors as O}from"./pbrUtils.js";import{P as j}from"../../../../chunks/Path.glsl.js";import{SpecialDrawBuffers as P}from"../../../webgl/enums.js";import{makePipelineState as T,frontFaceCullingParams as E,defaultDepthWrite as g,defaultColorWrite as L}from"../../../webgl/renderState.js";class R extends o{constructor(){super(...arguments),this.ambient=r(.2,.2,.2),this.diffuse=r(.8,.8,.8),this.specular=r(0,0,0),this.opacity=1,this.origin=e(),this.modelTransformation=null,this.mrrFactors=O,this.emissiveFactor=s}}class A extends a{constructor(r,e){super(r,e,new n(j,(()=>import("../shaders/Path.glsl.js"))),I)}initializePipeline(r){const{output:e,transparent:s,hasSlicePlane:o,doubleSidedMode:n,hasOccludees:a,oitPass:b}=r,O=b===m.NONE,j=b===m.FrontFace;return T({blending:t(e)&&s?c(b):null,culling:o&&!s&&n!==l.None?E:null,depthTest:{func:p(b)},depthWrite:O||j?g:null,drawBuffers:e===i.Depth?{buffers:[P.NONE]}:u(b,e),colorWrite:L,stencilWrite:a?d:null,stencilTest:a?f:null,polygonOffset:O||j?null:h})}}const I=new Map([[b.POSITION,0],[b.PROFILEVERTEXANDNORMAL,1],[b.FEATUREVALUE,2],[b.PROFILEAUXDATA,3],[b.PROFILERIGHT,4],[b.PROFILEUP,5],[b.OBJECTANDLAYERIDCOLOR,6]]);export{R as PathPassParameters,A as PathTechnique,I as vertexAttributeLocations};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{i as s,d as a,f as n,h as o,g as l,c,l as p,j as h,t as u}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as T}from"../../../../geometry/support/frustum.js";import{create as d,distance2 as _,fromPoints as E,closestLineSegmentPoint as A}from"../../../../geometry/support/lineSegment.js";import{create as R,fromPoints as O,signedDistance as g,getNormal as S}from"../../../../geometry/support/plane.js";import{newLayout as I}from"../../support/buffer/InterleavedLayout.js";import{isHighlightOrOID as v,isColorOrColorEmission as N,isDepth as P,isColorEmissionHighlightOIDOrDepth as L,is2DGeometryOutput as b,ShaderOutput as C}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as U}from"../effects/geometry/olidUtils.js";import y from"../lib/GLMaterial.js";import{Material as D,RenderOccludedFlag as j}from"../lib/Material.js";import{RenderSlot as F}from"../lib/RenderSlot.js";import{isTranslationMatrix as w}from"../lib/Util.js";import{VertexAttribute as M}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as x}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as B}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as J}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as z,RibbonLineTechnique as H}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as G,CapType as k}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as V}from"../../../../webscene/support/AlphaCutoff.js";var Z;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(Z||(Z={}));class W extends D{constructor(e){super(e,q),this._configuration=new G,this.vertexAttributeLocations=z,this.produces=new Map([[F.OPAQUE_MATERIAL,e=>v(e)||N(e)&&this.parameters.renderOccluded===j.OccludeAndTransparentStencil],[F.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>P(e)],[F.OCCLUDER_MATERIAL,e=>L(e)&&this.parameters.renderOccluded===j.OccludeAndTransparentStencil],[F.TRANSPARENT_OCCLUDER_MATERIAL,e=>L(e)&&this.parameters.renderOccluded===j.OccludeAndTransparentStencil],[F.TRANSPARENT_MATERIAL,e=>N(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==j.OccludeAndTransparentStencil],[F.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>N(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==j.OccludeAndTransparentStencil],[F.DRAPED_MATERIAL,e=>b(e)]])}getConfiguration(e,t){this._configuration.output=e,this._configuration.oitPass=t.oitPass,this._configuration.draped=t.slot===F.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==C.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&$(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=this.parameters.renderOccluded===j.OccludeAndTransparentStencil,this._configuration.terrainDepthTest=t.terrainDepthTest&&N(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration}get visible(){return this.parameters.color[3]>=V||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>V}intersectDraped({attributes:e,screenToWorldRatio:r},i,s,a,n,o){if(!s.options.selectionMode)return;const l=e.get(M.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.get(M.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(r)?c*=this.parameters.vvSize.fallback[0]:c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const p=a[0],h=a[1],u=(c/2+4)*r;let m=Number.MAX_VALUE,f=0;const T=e.get(M.POSITION).data,d=K(this.parameters,e)?T.length-2:T.length-5;for(let _=0;_<d;_+=3){const e=T[_],r=T[_+1],i=(_+3)%T.length,s=p-e,a=h-r,n=T[i]-e,o=T[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,u=o*l-a,d=c*c+u*u;d<m&&(m=d,f=_/3)}m<u*u&&n(o.dist,o.normal,f,!1)}intersect(r,u,m,f,d,R){if(!m.options.selectionMode||!r.visible)return;if(!w(u))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const I=r.attributes,v=I.get(M.POSITION).data;let N=this.parameters.width;if(this.parameters.vvSize){const e=I.get(M.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(e)||(N*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else I.has(M.SIZE)&&(N*=I.get(M.SIZE).data[0]);const P=m.camera,L=se;i(L,m.point);const b=N*P.pixelRatio/2+4*P.pixelRatio;s(fe[0],L[0]-b,L[1]+b,0),s(fe[1],L[0]+b,L[1]+b,0),s(fe[2],L[0]+b,L[1]-b,0),s(fe[3],L[0]-b,L[1]-b,0);for(let e=0;e<4;e++)if(!P.unprojectFromRenderScreen(fe[e],Te[e]))return;O(P.eye,Te[0],Te[1],de),O(P.eye,Te[1],Te[2],_e),O(P.eye,Te[2],Te[3],Ee),O(P.eye,Te[3],Te[0],Ae);let C=Number.MAX_VALUE,U=0;const y=K(this.parameters,I)?v.length-2:v.length-5;for(let e=0;e<y;e+=3){ee[0]=v[e]+u[12],ee[1]=v[e+1]+u[13],ee[2]=v[e+2]+u[14];const t=(e+3)%v.length;if(te[0]=v[t]+u[12],te[1]=v[t+1]+u[13],te[2]=v[t+2]+u[14],g(de,ee)<0&&g(de,te)<0||g(_e,ee)<0&&g(_e,te)<0||g(Ee,ee)<0&&g(Ee,te)<0||g(Ae,ee)<0&&g(Ae,te)<0)continue;if(P.projectToRenderScreen(ee,ae),P.projectToRenderScreen(te,ne),ae[2]<0&&ne[2]>0){a(re,ee,te);const e=P.frustum,t=-g(e[T.NEAR],ee)/n(re,S(e[T.NEAR]));o(re,re,t),l(ee,ee,re),P.projectToRenderScreen(ee,ae)}else if(ae[2]>0&&ne[2]<0){a(re,te,ee);const e=P.frustum,t=-g(e[T.NEAR],te)/n(re,S(e[T.NEAR]));o(re,re,t),l(te,te,re),P.projectToRenderScreen(te,ne)}else if(ae[2]<0&&ne[2]<0)continue;ae[2]=0,ne[2]=0;const r=_(E(ae,ne,ce),L);r<C&&(C=r,c(oe,ee),c(le,te),U=e/3)}const D=m.rayBegin,j=m.rayEnd;if(C<b*b){let e=Number.MAX_VALUE;if(A(E(oe,le,ce),E(D,j,pe),ie)){a(ie,ie,D);const t=p(ie);o(ie,ie,1/t),e=t/h(D,j)}R(e,ie,U,!1)}}get _layout(){const e=I().vec3f(M.POSITION).vec3f(M.PREVPOSITION).vec3f(M.NEXTPOSITION).f32(M.SUBDIVISIONFACTOR).vec2f(M.UV0);return this.parameters.vvSize?e.f32(M.SIZEFEATUREATTRIBUTE):e.f32(M.SIZE),this.parameters.vvColor?e.f32(M.COLORFEATUREATTRIBUTE):e.vec4f(M.COLOR),this.parameters.vvOpacity&&e.f32(M.OPACITYFEATUREATTRIBUTE),U()&&e.vec4u8(M.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new X(this._layout,this.parameters)}createGLMaterial(e){return new Y(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class Y extends y{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(H,e)}}class q extends x{constructor(){super(...arguments),this.width=0,this.color=f,this.join="miter",this.cap=k.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1}get transparent(){return this.color[3]<1||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}}class X{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t,this.numJoinSubdivisions=0;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=J+r}}_isClosed(e){return K(this._parameters,e)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.get(M.POSITION).indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,a,n){const o=he,l=ue,p=me,m=r.get(M.POSITION),f=m.indices,T=m.data.length/3,d=r.get(M.DISTANCETOSTART)?.data;f&&f.length!==2*(T-1)&&console.warn("RibbonLineMaterial does not support indices");const _=r.get(M.SIZEFEATUREATTRIBUTE)?.data[0]??r.get(M.SIZE)?.data[0]??1;let E=[1,1,1,1],A=0;const R=this.vertexBufferLayout.fields.has(M.COLORFEATUREATTRIBUTE);R?A=r.get(M.COLORFEATUREATTRIBUTE).data[0]:r.has(M.COLOR)&&(E=r.get(M.COLOR).data);const O=this.vertexBufferLayout.fields.has(M.OPACITYFEATUREATTRIBUTE),g=O?r.get(M.OPACITYFEATUREATTRIBUTE).data[0]:0,S=new Float32Array(a.buffer),I=U()?new Uint8Array(a.buffer):null,v=this.vertexBufferLayout.stride/4;let N=n*v;const P=N;let L=0;const b=d?(e,t,r)=>L=d[r]:(e,t,r)=>L+=h(e,t),C=(e,t,r,s,a,n,o)=>{if(S[N++]=t[0],S[N++]=t[1],S[N++]=t[2],S[N++]=e[0],S[N++]=e[1],S[N++]=e[2],S[N++]=r[0],S[N++]=r[1],S[N++]=r[2],S[N++]=s,S[N++]=o,S[N++]=a,S[N++]=_,R)S[N++]=A;else{const e=Math.min(4*n,E.length-4);S[N++]=E[e],S[N++]=E[e+1],S[N++]=E[e+2],S[N++]=E[e+3]}O&&(S[N++]=g),U()&&(i&&(I[4*N]=i[0],I[4*N+1]=i[1],I[4*N+2]=i[2],I[4*N+3]=i[3]),N++)};N+=v,s(l,m.data[0],m.data[1],m.data[2]),e&&u(l,l,e);const y=this._isClosed(r);if(y){const t=m.data.length-3;s(o,m.data[t],m.data[t+1],m.data[t+2]),e&&u(o,o,e)}else s(p,m.data[3],m.data[4],m.data[5]),e&&u(p,p,e),C(l,l,p,1,Z.LEFT_CAP_START,0,0),C(l,l,p,1,Z.RIGHT_CAP_START,0,0),c(o,l),c(l,p);const D=y?0:1,j=y?T:T-1;for(let h=D;h<j;h++){const t=(h+1)%T*3;s(p,m.data[t],m.data[t+1],m.data[t+2]),e&&u(p,p,e),b(o,l,h),C(o,l,p,0,Z.LEFT_JOIN_END,h,L),C(o,l,p,0,Z.RIGHT_JOIN_END,h,L);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);C(o,l,p,t,Z.LEFT_JOIN_END,h,L),C(o,l,p,t,Z.RIGHT_JOIN_END,h,L)}C(o,l,p,1,Z.LEFT_JOIN_START,h,L),C(o,l,p,1,Z.RIGHT_JOIN_START,h,L),c(o,l),c(l,p)}y?(s(p,m.data[3],m.data[4],m.data[5]),e&&u(p,p,e),L=b(o,l,j),C(o,l,p,0,Z.LEFT_JOIN_END,D,L),C(o,l,p,0,Z.RIGHT_JOIN_END,D,L)):(L=b(o,l,j),C(o,l,l,0,Z.LEFT_CAP_END,j,L),C(o,l,l,0,Z.RIGHT_CAP_END,j,L)),Q(S,P+v,S,P,v);return N=Q(S,N-v,S,N,v),this._parameters.wireframe&&this._addWireframeVertices(a,P,N,v),null}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=Q(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function Q(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function K(e,t){if(!e.isClosed)return!1;return t.get(M.POSITION).indices.length>2}function $(e){return e.anchor===B.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const ee=m(),te=m(),re=m(),ie=m(),se=m(),ae=r(),ne=r(),oe=m(),le=m(),ce=d(),pe=d(),he=m(),ue=m(),me=m(),fe=[r(),r(),r(),r()],Te=[m(),m(),m(),m()],de=R(),_e=R(),Ee=R(),Ae=R();export{q as Parameters,W as RibbonLineMaterial};
|
|
5
|
+
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{i as s,d as a,f as n,h as o,g as l,c,l as p,j as h,t as u}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as T}from"../../../../geometry/support/frustum.js";import{create as d,distance2 as _,fromPoints as E,closestLineSegmentPoint as A}from"../../../../geometry/support/lineSegment.js";import{create as R,fromPoints as O,signedDistance as g,getNormal as S}from"../../../../geometry/support/plane.js";import{newLayout as I}from"../../support/buffer/InterleavedLayout.js";import{isHighlightOrOID as v,isColorOrColorEmission as N,isDepth as P,isColorEmissionHighlightOIDOrDepth as L,is2DGeometryOutput as b,ShaderOutput as C}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as U}from"../effects/geometry/olidUtils.js";import y from"../lib/GLMaterial.js";import{Material as D,RenderOccludedFlag as j}from"../lib/Material.js";import{RenderSlot as F}from"../lib/RenderSlot.js";import{isTranslationMatrix as w}from"../lib/Util.js";import{VertexAttribute as M}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as x}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as B}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as J}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as z,RibbonLineTechnique as H}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as G,CapType as k}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as V}from"../../../../webscene/support/AlphaCutoff.js";var Z;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(Z||(Z={}));class W extends D{constructor(e){super(e,q),this._configuration=new G,this.vertexAttributeLocations=z,this.produces=new Map([[F.OPAQUE_MATERIAL,e=>v(e)||N(e)&&this.parameters.renderOccluded===j.OccludeAndTransparentStencil],[F.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>P(e)],[F.OCCLUDER_MATERIAL,e=>L(e)&&this.parameters.renderOccluded===j.OccludeAndTransparentStencil],[F.TRANSPARENT_OCCLUDER_MATERIAL,e=>L(e)&&this.parameters.renderOccluded===j.OccludeAndTransparentStencil],[F.TRANSPARENT_MATERIAL,e=>N(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==j.OccludeAndTransparentStencil],[F.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>N(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==j.OccludeAndTransparentStencil],[F.DRAPED_MATERIAL,e=>b(e)]])}getConfiguration(e,t){this._configuration.output=e,this._configuration.oitPass=t.oitPass,this._configuration.draped=t.slot===F.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==C.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&$(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=this.parameters.renderOccluded===j.OccludeAndTransparentStencil,this._configuration.terrainDepthTest=t.terrainDepthTest&&N(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration}get visible(){return this.parameters.color[3]>=V||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>V}intersectDraped({attributes:e,screenToWorldRatio:r},i,s,a,n,o){if(!s.options.selectionMode)return;const l=e.get(M.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.get(M.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(r)?c*=this.parameters.vvSize.fallback[0]:c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const p=a[0],h=a[1],u=(c/2+4)*r;let m=Number.MAX_VALUE,f=0;const T=e.get(M.POSITION).data,d=K(this.parameters,e)?T.length-2:T.length-5;for(let _=0;_<d;_+=3){const e=T[_],r=T[_+1],i=(_+3)%T.length,s=p-e,a=h-r,n=T[i]-e,o=T[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,u=o*l-a,d=c*c+u*u;d<m&&(m=d,f=_/3)}m<u*u&&n(o.dist,o.normal,f,!1)}intersect(r,u,m,f,d,R){if(!m.options.selectionMode||!r.visible)return;if(!w(u))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const I=r.attributes,v=I.get(M.POSITION).data;let N=this.parameters.width;if(this.parameters.vvSize){const e=I.get(M.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(e)||(N*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else I.has(M.SIZE)&&(N*=I.get(M.SIZE).data[0]);const P=m.camera,L=se;i(L,m.point);const b=N*P.pixelRatio/2+4*P.pixelRatio;s(fe[0],L[0]-b,L[1]+b,0),s(fe[1],L[0]+b,L[1]+b,0),s(fe[2],L[0]+b,L[1]-b,0),s(fe[3],L[0]-b,L[1]-b,0);for(let e=0;e<4;e++)if(!P.unprojectFromRenderScreen(fe[e],Te[e]))return;O(P.eye,Te[0],Te[1],de),O(P.eye,Te[1],Te[2],_e),O(P.eye,Te[2],Te[3],Ee),O(P.eye,Te[3],Te[0],Ae);let C=Number.MAX_VALUE,U=0;const y=K(this.parameters,I)?v.length-2:v.length-5;for(let e=0;e<y;e+=3){ee[0]=v[e]+u[12],ee[1]=v[e+1]+u[13],ee[2]=v[e+2]+u[14];const t=(e+3)%v.length;if(te[0]=v[t]+u[12],te[1]=v[t+1]+u[13],te[2]=v[t+2]+u[14],g(de,ee)<0&&g(de,te)<0||g(_e,ee)<0&&g(_e,te)<0||g(Ee,ee)<0&&g(Ee,te)<0||g(Ae,ee)<0&&g(Ae,te)<0)continue;if(P.projectToRenderScreen(ee,ae),P.projectToRenderScreen(te,ne),ae[2]<0&&ne[2]>0){a(re,ee,te);const e=P.frustum,t=-g(e[T.NEAR],ee)/n(re,S(e[T.NEAR]));o(re,re,t),l(ee,ee,re),P.projectToRenderScreen(ee,ae)}else if(ae[2]>0&&ne[2]<0){a(re,te,ee);const e=P.frustum,t=-g(e[T.NEAR],te)/n(re,S(e[T.NEAR]));o(re,re,t),l(te,te,re),P.projectToRenderScreen(te,ne)}else if(ae[2]<0&&ne[2]<0)continue;ae[2]=0,ne[2]=0;const r=_(E(ae,ne,ce),L);r<C&&(C=r,c(oe,ee),c(le,te),U=e/3)}const D=m.rayBegin,j=m.rayEnd;if(C<b*b){let e=Number.MAX_VALUE;if(A(E(oe,le,ce),E(D,j,pe),ie)){a(ie,ie,D);const t=p(ie);o(ie,ie,1/t),e=t/h(D,j)}R(e,ie,U,!1)}}get _layout(){const e=I().vec3f(M.POSITION).vec3f(M.PREVPOSITION).vec3f(M.NEXTPOSITION).f32(M.SUBDIVISIONFACTOR).vec2f(M.UV0);return this.parameters.vvSize?e.f32(M.SIZEFEATUREATTRIBUTE):e.f32(M.SIZE),this.parameters.vvColor?e.f32(M.COLORFEATUREATTRIBUTE):e.vec4u8(M.COLOR),this.parameters.vvOpacity&&e.f32(M.OPACITYFEATUREATTRIBUTE),U()&&e.vec4u8(M.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new X(this._layout,this.parameters)}createGLMaterial(e){return new Y(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class Y extends y{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(H,e)}}class q extends x{constructor(){super(...arguments),this.width=0,this.color=f,this.join="miter",this.cap=k.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1}get transparent(){return this.color[3]<1||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}}class X{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t,this.numJoinSubdivisions=0;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=J+r}}_isClosed(e){return K(this._parameters,e)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.get(M.POSITION).indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,a,n){const o=he,l=ue,p=me,m=r.get(M.POSITION),f=m.indices,T=m.data.length/3,d=r.get(M.DISTANCETOSTART)?.data;f&&f.length!==2*(T-1)&&console.warn("RibbonLineMaterial does not support indices");const _=r.get(M.SIZEFEATUREATTRIBUTE)?.data[0]??r.get(M.SIZE)?.data[0]??1;let E=[1,1,1,1],A=0;const R=this.vertexBufferLayout.fields.has(M.COLORFEATUREATTRIBUTE);R?A=r.get(M.COLORFEATUREATTRIBUTE).data[0]:r.has(M.COLOR)&&(E=r.get(M.COLOR).data);const O=this.vertexBufferLayout.fields.has(M.OPACITYFEATUREATTRIBUTE),g=O?r.get(M.OPACITYFEATUREATTRIBUTE).data[0]:0,S=new Float32Array(a.buffer),I=new Uint8Array(a.buffer),v=this.vertexBufferLayout.stride/4;let N=n*v;const P=N;let L=0;const b=d?(e,t,r)=>L=d[r]:(e,t,r)=>L+=h(e,t),C=(e,t,r,s,a,n,o)=>{if(S[N++]=t[0],S[N++]=t[1],S[N++]=t[2],S[N++]=e[0],S[N++]=e[1],S[N++]=e[2],S[N++]=r[0],S[N++]=r[1],S[N++]=r[2],S[N++]=s,S[N++]=o,S[N++]=a,S[N++]=_,R)S[N++]=A;else{const e=Math.min(4*n,E.length-4),t=4*N;N++,I[t]=E[e],I[t+1]=E[e+1],I[t+2]=E[e+2],I[t+3]=E[e+3]}if(O&&(S[N++]=g),U()){const e=4*N;N++,i&&(I[e]=i[0],I[e+1]=i[1],I[e+2]=i[2],I[e+3]=i[3])}};N+=v,s(l,m.data[0],m.data[1],m.data[2]),e&&u(l,l,e);const y=this._isClosed(r);if(y){const t=m.data.length-3;s(o,m.data[t],m.data[t+1],m.data[t+2]),e&&u(o,o,e)}else s(p,m.data[3],m.data[4],m.data[5]),e&&u(p,p,e),C(l,l,p,1,Z.LEFT_CAP_START,0,0),C(l,l,p,1,Z.RIGHT_CAP_START,0,0),c(o,l),c(l,p);const D=y?0:1,j=y?T:T-1;for(let h=D;h<j;h++){const t=(h+1)%T*3;s(p,m.data[t],m.data[t+1],m.data[t+2]),e&&u(p,p,e),b(o,l,h),C(o,l,p,0,Z.LEFT_JOIN_END,h,L),C(o,l,p,0,Z.RIGHT_JOIN_END,h,L);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);C(o,l,p,t,Z.LEFT_JOIN_END,h,L),C(o,l,p,t,Z.RIGHT_JOIN_END,h,L)}C(o,l,p,1,Z.LEFT_JOIN_START,h,L),C(o,l,p,1,Z.RIGHT_JOIN_START,h,L),c(o,l),c(l,p)}y?(s(p,m.data[3],m.data[4],m.data[5]),e&&u(p,p,e),L=b(o,l,j),C(o,l,p,0,Z.LEFT_JOIN_END,D,L),C(o,l,p,0,Z.RIGHT_JOIN_END,D,L)):(L=b(o,l,j),C(o,l,l,0,Z.LEFT_CAP_END,j,L),C(o,l,l,0,Z.RIGHT_CAP_END,j,L)),Q(S,P+v,S,P,v);return N=Q(S,N-v,S,N,v),this._parameters.wireframe&&this._addWireframeVertices(a,P,N,v),null}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=Q(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function Q(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function K(e,t){if(!e.isClosed)return!1;return t.get(M.POSITION).indices.length>2}function $(e){return e.anchor===B.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const ee=m(),te=m(),re=m(),ie=m(),se=m(),ae=r(),ne=r(),oe=m(),le=m(),ce=d(),pe=d(),he=m(),ue=m(),me=m(),fe=[r(),r(),r(),r()],Te=[m(),m(),m(),m()],de=R(),_e=R(),Ee=R(),Ae=R();export{q as Parameters,W as RibbonLineMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{hasIdentityRotation as e,isOrthoNormal as t}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{BufferViewVec4u8 as f,
|
|
5
|
+
import{hasIdentityRotation as e,isOrthoNormal as t}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{BufferViewVec4u8 as f,BufferViewVec2f as r,BufferViewVec4f as o,BufferViewFloat as i,BufferViewVec2i16 as s,BufferViewVec3f as n}from"../../../../../geometry/support/buffer/BufferView.js";import{assert as c}from"../../lib/Util.js";import{VertexAttribute as l}from"../../lib/VertexAttribute.js";function d(e,t,f,r=1){const{data:o,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===r)for(let l=0;l<c;++l)s[f]=o[i[l]],f+=n;else for(let l=0;l<c;++l){const e=o[i[l]];for(let t=0;t<r;t++)s[f]=e,f+=n}}function u(e,t,f){const{data:r,indices:o}=e,i=t.typedBuffer,s=t.typedBufferStride,n=o.length;f*=s;for(let c=0;c<n;++c){const e=2*o[c];i[f]=r[e],i[f+1]=r[e+1],f+=s}}function a(e,t,f,r=1){const{data:o,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===r)for(let l=0;l<c;++l){const e=3*i[l];s[f]=o[e],s[f+1]=o[e+1],s[f+2]=o[e+2],f+=n}else for(let l=0;l<c;++l){const e=3*i[l];for(let t=0;t<r;++t)s[f]=o[e],s[f+1]=o[e+1],s[f+2]=o[e+2],f+=n}}function p(e,t,f,r=1){const{data:o,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===r)for(let l=0;l<c;++l){const e=4*i[l];s[f]=o[e],s[f+1]=o[e+1],s[f+2]=o[e+2],s[f+3]=o[e+3],f+=n}else for(let l=0;l<c;++l){const e=4*i[l];for(let t=0;t<r;++t)s[f]=o[e],s[f+1]=o[e+1],s[f+2]=o[e+2],s[f+3]=o[e+3],f+=n}}function B(e,t,f){const r=e.typedBuffer,o=e.typedBufferStride;t*=o;for(let i=0;i<f;++i)r[t]=0,r[t+1]=0,r[t+2]=0,r[t+3]=0,t+=o}function y(e,t,f){const{data:r,indices:o}=e,i=t.typedBuffer,s=t.typedBufferStride,n=o.length;f*=s;for(let c=0;c<n;++c){const e=9*o[c];for(let t=0;t<9;++t)i[f+t]=r[e+t];f+=s}}function g(e,t,f){const{data:r,indices:o}=e,i=t.typedBuffer,s=t.typedBufferStride,n=o.length;f*=s;for(let c=0;c<n;++c){const e=16*o[c];for(let t=0;t<16;++t)i[f+t]=r[e+t];f+=s}}function O(t,f,r,o,i=1){if(!f)return void a(t,r,o,i);const{data:s,indices:n}=t,c=r.typedBuffer,l=r.typedBufferStride,d=n.length,u=f[0],p=f[1],B=f[2],y=f[4],g=f[5],O=f[6],b=f[8],h=f[9],m=f[10],N=f[12],S=f[13],R=f[14];o*=l;let E=0,I=0,A=0;const F=e(f)?e=>{E=s[e]+N,I=s[e+1]+S,A=s[e+2]+R}:e=>{const t=s[e],f=s[e+1],r=s[e+2];E=u*t+y*f+b*r+N,I=p*t+g*f+h*r+S,A=B*t+O*f+m*r+R};if(1===i)for(let e=0;e<d;++e)F(3*n[e]),c[o]=E,c[o+1]=I,c[o+2]=A,o+=l;else for(let e=0;e<d;++e){F(3*n[e]);for(let e=0;e<i;++e)c[o]=E,c[o+1]=I,c[o+2]=A,o+=l}}function b(f,r,o,i,s=1){if(!r)return void a(f,o,i,s);const{data:n,indices:c}=f,l=r,d=o.typedBuffer,u=o.typedBufferStride,p=c.length,B=l[0],y=l[1],g=l[2],O=l[4],b=l[5],h=l[6],m=l[8],N=l[9],S=l[10],R=!t(l),E=1e-6,I=1-E;i*=u;let A=0,F=0,z=0;const L=e(l)?e=>{A=n[e],F=n[e+1],z=n[e+2]}:e=>{const t=n[e],f=n[e+1],r=n[e+2];A=B*t+O*f+m*r,F=y*t+b*f+N*r,z=g*t+h*f+S*r};if(1===s)if(R)for(let e=0;e<p;++e){L(3*c[e]);const t=A*A+F*F+z*z;if(t<I&&t>E){const e=1/Math.sqrt(t);d[i]=A*e,d[i+1]=F*e,d[i+2]=z*e}else d[i]=A,d[i+1]=F,d[i+2]=z;i+=u}else for(let e=0;e<p;++e)L(3*c[e]),d[i]=A,d[i+1]=F,d[i+2]=z,i+=u;else for(let e=0;e<p;++e){if(L(3*c[e]),R){const e=A*A+F*F+z*z;if(e<I&&e>E){const t=1/Math.sqrt(e);A*=t,F*=t,z*=t}}for(let e=0;e<s;++e)d[i]=A,d[i+1]=F,d[i+2]=z,i+=u}}function h(e,f,r,o,i=1){if(!f)return void p(e,r,o,i);const{data:s,indices:n}=e,c=f,l=r.typedBuffer,d=r.typedBufferStride,u=n.length,a=c[0],B=c[1],y=c[2],g=c[4],O=c[5],b=c[6],h=c[8],m=c[9],N=c[10],S=!t(c),R=1e-6,E=1-R;if(o*=d,1===i)for(let t=0;t<u;++t){const e=4*n[t],f=s[e],r=s[e+1],i=s[e+2],c=s[e+3];let u=a*f+g*r+h*i,p=B*f+O*r+m*i,I=y*f+b*r+N*i;if(S){const e=u*u+p*p+I*I;if(e<E&&e>R){const t=1/Math.sqrt(e);u*=t,p*=t,I*=t}}l[o]=u,l[o+1]=p,l[o+2]=I,l[o+3]=c,o+=d}else for(let t=0;t<u;++t){const e=4*n[t],f=s[e],r=s[e+1],c=s[e+2],u=s[e+3];let p=a*f+g*r+h*c,I=B*f+O*r+m*c,A=y*f+b*r+N*c;if(S){const e=p*p+I*I+A*A;if(e<E&&e>R){const t=1/Math.sqrt(e);p*=t,I*=t,A*=t}}for(let t=0;t<i;++t)l[o]=p,l[o+1]=I,l[o+2]=A,l[o+3]=u,o+=d}}function m(e,t,f,r,o=1){const{data:i,indices:s}=e,n=f.typedBuffer,c=f.typedBufferStride,l=s.length;if(r*=c,t!==i.length||4!==t)if(1!==o)if(4!==t)for(let d=0;d<l;++d){const e=3*s[d];for(let t=0;t<o;++t)n[r]=i[e],n[r+1]=i[e+1],n[r+2]=i[e+2],n[r+3]=255,r+=c}else for(let d=0;d<l;++d){const e=4*s[d];for(let t=0;t<o;++t)n[r]=i[e],n[r+1]=i[e+1],n[r+2]=i[e+2],n[r+3]=i[e+3],r+=c}else{if(4===t){for(let e=0;e<l;++e){const t=4*s[e];n[r]=i[t],n[r+1]=i[t+1],n[r+2]=i[t+2],n[r+3]=i[t+3],r+=c}return}for(let e=0;e<l;++e){const t=3*s[e];n[r]=i[t],n[r+1]=i[t+1],n[r+2]=i[t+2],n[r+3]=255,r+=c}}else{n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3];const e=new Uint32Array(f.typedBuffer.buffer,f.start),t=c/4,s=e[r/=4];r+=t;const d=l*o;for(let f=1;f<d;++f)e[r]=s,r+=t}}function N(e,t,f){const{data:r,indices:o}=e,i=t.typedBuffer,s=t.typedBufferStride,n=o.length,c=r[0];f*=s;for(let l=0;l<n;++l)i[f]=c,f+=s}function S(e,t,f,r,o=1){const i=t.typedBuffer,s=t.typedBufferStride;if(r*=s,1===o)for(let n=0;n<f;++n)i[r]=e[0],i[r+1]=e[1],i[r+2]=e[2],i[r+3]=e[3],r+=s;else for(let n=0;n<f;++n)for(let t=0;t<o;++t)i[r]=e[0],i[r+1]=e[1],i[r+2]=e[2],i[r+3]=e[3],r+=s}function R(e,t,r,o,i,s,n){let c={numItems:0,numVerticesPerItem:0};for(const d of r.fields.keys()){const r=e.get(d),u=r?.indices;if(r&&u)d===l.POSITION&&(c={numItems:1,numVerticesPerItem:u.length}),E(d,r,o,i,s,n);else if(d===l.OBJECTANDLAYERIDCOLOR&&null!=t){const r=e.get(l.POSITION)?.indices;if(r){const e=r.length;S(t,s.getField(d,f),e,n)}}}return c}function E(e,t,d,a,B,y){switch(e){case l.POSITION:{c(3===t.size);const f=B.getField(e,n);c(!!f,`No buffer view for ${e}`),f&&O(t,d,f,y);break}case l.NORMAL:{c(3===t.size);const f=B.getField(e,n);c(!!f,`No buffer view for ${e}`),f&&b(t,a,f,y);break}case l.NORMALCOMPRESSED:case l.PROFILERIGHT:case l.PROFILEUP:{c(2===t.size);const f=B.getField(e,s);c(!!f,`No buffer view for ${e}`),f&&u(t,f,y);break}case l.UV0:{c(2===t.size);const f=B.getField(e,r);c(!!f,`No buffer view for ${e}`),f&&u(t,f,y);break}case l.COLOR:case l.SYMBOLCOLOR:{const r=B.getField(e,f);c(!!r,`No buffer view for ${e}`),c(3===t.size||4===t.size),!r||3!==t.size&&4!==t.size||m(t,t.size,r,y);break}case l.COLORFEATUREATTRIBUTE:{const f=B.getField(e,i);c(!!f,`No buffer view for ${e}`),c(1===t.size),f&&1===t.size&&N(t,f,y);break}case l.TANGENT:{c(4===t.size);const f=B.getField(e,o);c(!!f,`No buffer view for ${e}`),f&&h(t,d,f,y);break}case l.PROFILEVERTEXANDNORMAL:case l.FEATUREVALUE:{c(4===t.size);const f=B.getField(e,o);c(!!f,`No buffer view for ${e}`),f&&p(t,f,y)}break;case l.PROFILEAUXDATA:{c(2===t.size);const f=B.getField(e,r);c(!!f,`No buffer view for ${e}`),f&&u(t,f,y)}}}export{d as writeBufferFloat,y as writeBufferMat3f,g as writeBufferMat4f,u as writeBufferVec2,a as writeBufferVec3,p as writeBufferVec4,B as writeBufferVec4Zeros,m as writeColor,N as writeColorFeatureAttribute,E as writeDefaultAttribute,R as writeDefaultAttributes,b as writeNormal,S as writeObjectAndLayerIdColor,O as writePosition,h as writeTangent};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import"../../../../core/has.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import"../../../../core/has.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as n}from"../../../../chunks/sphere.js";import{ContentObjectType as s}from"../lib/ContentObjectType.js";import{GridLocalOriginFactory as a}from"../lib/GridLocalOriginFactory.js";import c from"../lib/ModelDirtySet.js";import{RenderGeometry as d}from"../lib/RenderGeometry.js";import{assert as m}from"../lib/Util.js";import{isWebGLLayer as l}from"../lib/WebGLLayer.js";let h=class extends e{constructor(){super(...arguments),this.dirtySet=new c({model:this}),this._content=new Map,this._originFactory=new a(null)}getObject(t){return this._content.get(t)}add(t){const e=t.id;m(!this._content.has(e),"Model/Stage already contains object to be added"),this._content.set(e,t),l(t)&&this.dirtySet.layerAdded(t)}remove(t){return!!this._content.has(t.id)&&(this._content.delete(t.id),l(t)&&this.dirtySet.layerRemoved(t),!0)}addMany(t){for(const e of t)e&&(m(!this._content.has(e.id),"Model/Stage already contains object to be added"),this._content.set(e.id,e))}removeMany(t){for(const e of t)e&&(m(this._content.has(e.id),"Model/Stage doesn't contain object to be removed"),this._content.delete(e.id))}has(t){return this._content.has(t.id)}forEachOfType(t,e){this._content.forEach((o=>{o.type===t&&e(o)}))}getRenderGeometry(t,e){const o=new d(e,{castShadow:t.castShadow,objectShaderTransformation:t.shaderTransformation}),r=e.localOrigin;return o.transformation=t.getCombinedStaticTransformation(e,p),o.localOrigin=r??this._originFactory.getOrigin(n(o.boundingSphere)),o}updateRenderGeometryTransformation(t,e,o){if(null==t)return!1;o.transformation=t.getCombinedStaticTransformation(e,p);const r=this._originFactory.getOrigin(n(o.boundingSphere));return o.localOrigin!==r}getStats(){const t={},e=Array.from(this._content.values());for(let o=0;o<s.COUNT;++o)t[o]=e.filter((t=>t.type===o)).length;return{contentTypes:t,dirtySet:this.dirtySet.formatDebugInfo()}}get test(){}};t([o({constructOnly:!0})],h.prototype,"dirtySet",void 0),h=t([r("esri.views.3d.webgl-engine.parts.Model")],h);const p=i();export{h as Model};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/
|
|
5
|
+
import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/SymbolColor.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../core/shaderLibrary/attributes/VerticalOffset.glsl.js";import"../core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import"../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/Normals.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../core/shaderLibrary/shading/TextureTransformUV.glsl.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../core/shaderLibrary/util/MixExternalColor.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/VertexAttribute.js";import"./OutputColorHighlightOID.glsl.js";import"../../../webgl/ShaderBuilder.js";import"../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../chunks/DefaultMaterial.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/
|
|
5
|
+
import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/SymbolColor.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../core/shaderLibrary/attributes/VerticalOffset.glsl.js";import"../core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../core/shaderLibrary/util/MixExternalColor.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/VertexAttribute.js";import"./OutputColorHighlightOID.glsl.js";import"../../../webgl/ShaderBuilder.js";import"../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../chunks/RealisticTree.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../../chunks/vec32.js";import"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../terrain/OverlayContent.js";import"../../terrain/TransparencyMode.js";import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/
|
|
5
|
+
import"../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../../chunks/vec32.js";import"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../terrain/OverlayContent.js";import"../../terrain/TransparencyMode.js";import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexTangent.glsl.js";import"../core/shaderLibrary/output/OutputDepth.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/NormalUtils.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/terrain/Overlay.glsl.js";import"../core/shaderLibrary/terrain/TerrainTexture.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3BindUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Matrix4DrawUniform.js";import"../core/shaderModules/Texture2DBindUniform.js";import"../lib/VertexAttribute.js";import"../../../webgl/ShaderBuilder.js";import"../../../../webscene/support/AlphaCutoff.js";export{T as TerrainPassParameters,b as build}from"../../../../chunks/Terrain.glsl.js";
|
package/views/FocusAreas.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import o from"../core/Accessor.js";import s from"../core/Collection.js";import{destroyMaybe as r}from"../core/maybe.js";import{watch as t,syncAndInitial as i}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{e as c}from"../chunks/earcut.js";import{create as m}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{n as d}from"../chunks/vec32.js";import{create as p}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../geometry/Point.js";import{computeTranslationToOriginAndRotation as h}from"../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as u}from"../geometry/support/DoubleArray.js";import{newIndexArray as f}from"../geometry/support/Indices.js";import{t as g}from"../chunks/vec3.js";import{ViewingMode as y}from"./ViewingMode.js";import{ElevationContext as v}from"./3d/layers/graphics/ElevationContext.js";import{extrudePolygon as j}from"./3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{computeCentroid as _}from"./3d/layers/graphics/graphicUtils.js";import{geometryToRenderInfo as w}from"./3d/support/renderInfoUtils/polygon.js";import{FocusAreaColorNode as A}from"./3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js";import{FocusAreaGeometry as b,FocusAreaMaskNode as R}from"./3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js";const G
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import o from"../core/Accessor.js";import s from"../core/Collection.js";import{destroyMaybe as r}from"../core/maybe.js";import{watch as t,syncAndInitial as i}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{e as c}from"../chunks/earcut.js";import{create as m}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{n as d}from"../chunks/vec32.js";import{create as p}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../geometry/Point.js";import{computeTranslationToOriginAndRotation as h}from"../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as u}from"../geometry/support/DoubleArray.js";import{newIndexArray as f}from"../geometry/support/Indices.js";import{t as g}from"../chunks/vec3.js";import{ViewingMode as y}from"./ViewingMode.js";import{ElevationContext as v}from"./3d/layers/graphics/ElevationContext.js";import{extrudePolygon as j}from"./3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{computeCentroid as _}from"./3d/layers/graphics/graphicUtils.js";import{geometryToRenderInfo as w}from"./3d/support/renderInfoUtils/polygon.js";import{FocusAreaColorNode as A}from"./3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js";import{FocusAreaGeometry as b,FocusAreaMaskNode as R}from"./3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js";const G=-1e4,N=5e6,k=.42,x=.32;function C(e,o){if(e){if("bright"===o){const o=(e[0]+e[1]+e[2])/3;return[o*x+(1-x),o*x+(1-x),o*x+(1-x),e[3]*x]}return"dark"===o?[e[0]*k,e[1]*k,e[2]*k,e[3]*k]:e}}let F=class extends o{constructor(e){super(e),this.style="dark",this.geometries=new Array,this._areas=new s,this._elevationContext=new v}initialize(){this.addHandles([t((()=>this.style),(()=>this._updateRenderNodes()),i)]),this.addHandles([t((()=>this.activePolygons),(()=>this._updateFocusAreaGeometries()),i)])}get activePolygons(){const e=new s;for(const o of this.areas)if(o.enabled)for(const s of o.geometries)e.push(s);return e}add(e){this.areas.add(e),this._updateFocusAreaGeometries()}addMany(e){this.areas.addMany(e),this._updateFocusAreaGeometries()}remove(e){this.areas.remove(e),this._updateFocusAreaGeometries()}removeMany(e){this.areas.removeMany(e),this._updateFocusAreaGeometries()}removeAll(){this.areas.removeAll(),this._updateFocusAreaGeometries()}containsGeometry(e){let o=!0;const s=new l(e);return o=this.areas.some((e=>!!e.enabled&&(!!e?.geometries.length&&e.geometries.some((e=>e.contains(s)))))),o}get areas(){return this._areas}_updateFocusAreaGeometries(){this._extrudePolygons(),this._updateRenderNodes()}_extrudePolygons(){if(!this.view.renderCoordsHelper)return;this.geometries.length=0;const e=N-G,o=p(),s=this.view.renderCoordsHelper.viewingMode===y.Global,r=m(),t=m();s||this.view.renderCoordsHelper.worldUpAtPosition([0,0,0],o);for(const i of this.areas)if(i.enabled)for(const a of i.geometries){const n=_(a);if(null==n)continue;h(a.spatialReference,[n.x,n.y,0],r,this.view.renderCoordsHelper.spatialReference);const m=d(P,[r[12]-G*o[0],r[13]-G*o[1],r[14]-G*o[2]]);t[12]=-r[12],t[13]=-r[13],t[14]=-r[14];const p=w(a,this.view.elevationProvider,this.view.renderCoordsHelper,this._elevationContext),{polygons:l,mapPositions:y,position:v}=p;for(const a of l){const n=a.count,d=c(a.mapPositions,a.holeIndices,3);if(0===d.length)continue;const p=d.length,l=6*n,h=f(l+p),_=f(p),w=u(3*l),A=u(3*l),R=u(3*l),N=u(l);j(v,y,d,a,w,R,A,N,h,_,e,o,s),g(w,w,t);const k=new b(w,_,h,e,[r[12]+G*m[0],r[13]+G*m[1],r[14]+G*m[2]],i.outline?.color);this.geometries.push(k)}}this._maskRenderNode?.updateGeometries()}_updateRenderNodes(){this.view._stage&&("none"===this.style||0===this.geometries.length?(this._maskRenderNode=r(this._maskRenderNode),this._colorRenderNode=r(this._colorRenderNode)):(this._maskRenderNode??=new R({focusAreas:this}),this._colorRenderNode??=new A({focusAreas:this})))}};e([a()],F.prototype,"activePolygons",null),e([a()],F.prototype,"style",void 0),e([a()],F.prototype,"geometries",void 0),e([a({constructOnly:!0})],F.prototype,"view",void 0),e([a()],F.prototype,"_areas",void 0),F=e([n("esri.views.FocusAreas")],F);const P=p();export{F as FocusAreas,C as focusAreaHUDColor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{easingFunctions as t}from"../2d/unitBezier.js";const u=t=>t,i=t=>t*t,o=t=>1-i(1-t),n=t=>t<.5?i(2*t)/2:(o(2*(t-.5))+1)/2,
|
|
5
|
+
import{easingFunctions as t}from"../2d/unitBezier.js";const u=t=>t,i=t=>t*t,o=t=>1-i(1-t),n=t=>t<.5?i(2*t)/2:(o(2*(t-.5))+1)/2,c=t=>t*t*t,a=t=>1-c(1-t),s=t=>t<.5?c(2*t)/2:(a(2*(t-.5))+1)/2,q=t=>t*t*t*t,e=t=>1-q(1-t),r=t=>t<.5?q(2*t)/2:(e(2*(t-.5))+1)/2,d=t=>t*t*t*t*t,b=t=>1-d(1-t),p=t=>t<.5?d(2*t)/2:(b(2*(t-.5))+1)/2,x=t=>1-Math.cos(t*Math.PI/2),h=t=>1-x(1-t),M=t=>t<.5?x(2*t)/2:(h(2*(t-.5))+1)/2,f=t=>2**(10*(t-1)),I=t=>1-f(1-t),m=t=>t<.5?f(2*t)/2:(I(2*(t-.5))+1)/2,O=t=>-(Math.sqrt(1-t*t)-1),j=t=>1-O(1-t),l=t=>t<.5?O(2*t)/2:(j(2*(t-.5))+1)/2;function z(t){const u=2*(t-Math.sqrt((t-1)*t)),i=u/2/t;return o=>o<i?t*o*o:u*o-u+1}function B(t,u){return(i,o)=>i<u?u*t(i/u,o):1-t((1-i)/(1-u),o)*(1-u)}const P=B(z(1),1),g=B(z(1),0),k=B(z(1),.5),v=B(z(2),1),w=B(z(2),0),y=B(z(2),.5),A=B(z(3),1),C=B(z(3),0),D=B(z(3),.5),E=B(z(4),1),F=B(z(4),0),G=B(z(4),.5),H={linear:u,"in-quad":i,"out-quad":o,"in-out-quad":n,"in-coast-quad":P,"out-coast-quad":g,"in-out-coast-quad":k,"in-cubic":c,"out-cubic":a,"in-out-cubic":s,"in-coast-cubic":v,"out-coast-cubic":w,"in-out-coast-cubic":y,"in-quart":q,"out-quart":e,"in-out-quart":r,"in-coast-quart":A,"out-coast-quart":C,"in-out-coast-quart":D,"in-quint":d,"out-quint":b,"in-out-quint":p,"in-coast-quint":E,"out-coast-quint":F,"in-out-coast-quint":G,"in-sine":x,"out-sine":h,"in-out-sine":M,"in-expo":f,"out-expo":I,"in-out-expo":m,"in-circ":O,"out-circ":j,"in-out-circ":l,"quad-in":i,"quad-out":o,"quad-in-out":n,"quad-in-coast":P,"quad-out-coast":g,"quad-in-out-coast":k,"cubic-in":c,"cubic-out":a,"cubic-in-out":s,"cubic-in-coast":v,"cubic-out-coast":w,"cubic-in-out-coast":y,"quart-in":q,"quart-out":e,"quart-in-out":r,"quart-in-coast":A,"quart-out-coast":C,"quart-in-out-coast":D,"quint-in":d,"quint-out":b,"quint-in-out":p,"quint-in-coast":E,"quint-out-coast":F,"quint-in-out-coast":G,"sine-in":x,"sine-out":h,"sine-in-out":M,"expo-in":f,"expo-out":I,"expo-in-out":m,"circ-in":O,"circ-out":j,"circ-in-out":l,ease:u=>t.ease(u),"ease-in":u=>t.easeIn(u),"ease-out":u=>t.easeOut(u),"ease-in-out":u=>t.easeInOut(u)};export{H as EasingFunctions,O as inCirc,v as inCoastCubic,P as inCoastQuad,A as inCoastQuart,E as inCoastQuint,c as inCubic,f as inExpo,l as inOutCirc,y as inOutCoastCubic,k as inOutCoastQuad,D as inOutCoastQuart,G as inOutCoastQuint,s as inOutCubic,m as inOutExpo,n as inOutQuad,r as inOutQuart,p as inOutQuint,M as inOutSine,i as inQuad,q as inQuart,d as inQuint,x as inSine,u as linear,j as outCirc,w as outCoastCubic,g as outCoastQuad,C as outCoastQuart,F as outCoastQuint,a as outCubic,I as outExpo,o as outQuad,e as outQuart,b as outQuint,h as outSine};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{throwIfAborted as t}from"../../core/promiseUtils.js";import{isLoaded as e,canProjectWithoutEngine as r,project as n,load as o,projectWithZConversion as i}from"../../geometry/projection.js";let a,c=null;async function l(e){c||(c=import("../../portal/support/geometryServiceUtils.js").then((t=>a=t))),await c,t(e)}async function s(t,i,c,p){if(!t)return null;const u=t.spatialReference;return e()||r(u,i)?n(t,i):a?a.projectGeometry(t,i,c,p):(await Promise.race([l(p),o(p)]),s(t,i,c,p))}async function p(t,e){try{return t
|
|
5
|
+
import{throwIfAborted as t}from"../../core/promiseUtils.js";import{isLoaded as e,canProjectWithoutEngine as r,project as n,load as o,projectWithZConversion as i}from"../../geometry/projection.js";let a,c=null;async function l(e){c||(c=import("../../portal/support/geometryServiceUtils.js").then((t=>a=t))),await c,t(e)}async function s(t,i,c,p){if(!t)return null;const u=t.spatialReference;return e()||r(u,i)?n(t,i):a?a.projectGeometry(t,i,c,p):(await Promise.race([l(p),o(p)]),s(t,i,c,p))}async function p(t,e){try{return t?.spatialReference?await i(t,e):null}catch{return null}}export{s as projectWithEngineOrService,p as projectWithZConversionSilent};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import{isSome as e}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import i from"../../core/Collection.js";import r from"../../core/Error.js";import s from"../../core/Evented.js";import{makeHandle as o}from"../../core/handleUtils.js";import n from"../../core/Logger.js";import{abortMaybe as l,removeMaybe as p,destroyMaybe as d}from"../../core/maybe.js";import{throwIfAborted as c,createResolver as u}from"../../core/promiseUtils.js";import{watch as h,on as f,when as w,whenOnce as m,syncAndInitial as y,initial as g,sync as k}from"../../core/reactiveUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as W}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as F}from"../../editing/templateUtils.js";import M from"../../layers/GraphicsLayer.js";import{isEditableLayer as E}from"../../layers/support/editableLayers.js";import{isFeatureLayer as I,isSubtypeGroupLayer as T,getOwningPortalUrl as b}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as V}from"../../portal/support/urlUtils.js";import A from"../../views/interactive/sketch/SketchOptions.js";import{SnappingManager as C}from"../../views/interactive/snapping/SnappingManager.js";import L from"../../views/interactive/snapping/SnappingOptions.js";import U from"../Attachments/AttachmentsViewModel.js";import O from"./CreateFeaturesWorkflow.js";import S from"./UpdateWorkflow.js";import{isUpdateWorkflow as j,whenEditorLayerView as P}from"./workflowUtils.js";import R from"./support/EditorItem.js";import{makeTemplateGroupInfoForLayer as H}from"../FeatureTemplates/featureTemplatesUtils.js";import G from"../FeatureTemplates/FeatureTemplatesViewModel.js";import x from"../Sketch/SketchViewModel.js";import D from"../Spinner/SpinnerViewModel.js";const B="esri.widgets.Editor.EditorViewModel",q=()=>n.getLogger(B);function N(t,e,a){q().error(new r(t,e,a))}function Q(t,e){return t?.find((t=>t.layer===e))}let z=class extends s.EventedAccessor{constructor(t){super(t),this._templatesByLayer=new Map,this._sketchEventListenerHandle=null,this._sketchGraphicsLayer=new M({listMode:"hide",internal:!0}),this._snappingManager=null,this._updateItemsTask=null,this._updateTemplatesTask=null,this._updatingHandles=new W,this._featureTemplatesViewModelIsRestricted=!1,this.activeWorkflow=null,this._activityQueue=new i,this.editorItems=new i,this.failures=[],this.hideTemplatesForInactiveLayers=!1,this.attachmentsViewModel=new U({capabilities:{editing:!0}}),this.featureTemplatesViewModel=new G({disabledItemFunction:({layer:t})=>this._itemIsSuspended(t)}),this.layerInfos=null,this.ownSketchViewModel=new x({layer:this._sketchGraphicsLayer}),this.sketchOptions=new A,this.snappingOptions=new L({attributeRulesEnabled:!0}),this.spinnerViewModel=new D,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.back=async()=>{this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))},this.saveWorkflow=async()=>{const{featureFormViewModel:t}=this;if(t&&"create-features"!==this.activeWorkflow?.type){if(t.submit(),!t.submittable||t.pendingSubtypeChoice)return;const e=t.getValues();if(t.validateContingencyConstraints(e,{includeIncompleteViolations:!0}).length>0)return}await(this.activeWorkflow?.save())},this.selectFeature=(t,e=!1)=>{const a=this.activeWorkflow;this._candidateCommitted||"update"!==a?.type||(a.data.rootFeature=t,e&&(a.next(),this._candidateCommitted=!0))}}initialize(){this.addHandles([h((()=>{const t=this.view,e=t?.map?.editableLayers.toArray(),a=t?.allLayerViews,i=a?.filter((t=>!!e?.includes(t.layer)));return[e,i,this.layerInfos]}),(()=>this._updateEditorItems()),y),h((()=>this.hideTemplatesForInactiveLayers),(()=>this.syncFeatureTemplates())),f((()=>this.activeWorkflow),"cancel",(()=>this.emit("workflow-cancel"))),f((()=>this.activeWorkflow),"commit",(()=>this.emit("workflow-commit"))),f((()=>this.activeWorkflow),"complete",(()=>{this.emit("workflow-commit"),this._set("activeWorkflow",null)})),w((()=>this.view?.map),(t=>t.add(this._sketchGraphicsLayer)),g),f((()=>this.editorItems),"change",(()=>this._afterEditorItemsChange())),h((()=>[this.canCreate,this.canUpdateVisible]),(()=>this._afterEditorItemsChange())),h((()=>this.page),((t,e)=>{const a=[...this.pageStack];if(-1===a.indexOf(t))a.push(t);else for(;a.length&&a.at(-1)!==t;)a.pop();this.pageStack=a}),y),w((()=>"awaiting-update-feature-candidate"===this.state),(()=>this._candidateCommitted=!1)),f((()=>this.featureTemplatesViewModel),"select",(async({item:t,oldItem:e})=>{const{activeWorkflow:a}=this;if(a){if("update"===a.type&&"awaiting-feature-creation-info"===a.activeWorkflow?.stepId)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return void this.featureTemplatesViewModel.select(e,{emit:!1})}}if(!t)return;const i={layer:t.layer,template:t.template};if(t.supportsUpload)return this.featureTemplatesViewModel.select(e,{emit:!1}),this.startCreateFeaturesWorkflow(i);this.startCreateFeaturesWorkflowAtFeatureCreation(i)})),h((()=>[this.view,this.featureTemplatesViewModel]),(([t,e])=>{e.view=t}),y),f((()=>this.view),"key-down",(t=>{"Escape"===t.key&&this.activeWorkflow?.keyboardCancellationEnabled&&(t.stopPropagation(),this.back())})),f((()=>this.sketchViewModel),["create","delete","update"],(t=>{const{activeWorkflow:e}=this,a="update"===e?.type,i=a?e.activeWorkflow?.layer:e?.layer,r=a?e?.activeWorkflow?.parentLayer:void 0,s=`sketch-${t.type}`;this.emit(s,{type:s,detail:t,layer:i,parentLayer:r})}),k),h((()=>this.view),(t=>{if(this._snappingManager=d(this._snappingManager),!t)return;const e=this.snappingOptions;this._snappingManager=new C({view:t,options:e}),this.ownSketchViewModel.snappingManager=this._snappingManager}),y),h((()=>this.snappingOptions),(t=>{this._snappingManager&&(this._snappingManager.options=t)}),y)])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then((()=>{this.view?.map?.remove(this._sketchGraphicsLayer),this.view=null})),this._updateItemsTask=l(this._updateItemsTask),this._updatingHandles.destroy(),this._sketchEventListenerHandle=p(this._sketchEventListenerHandle)}get _featureTemplatesLayersAndTables(){const t=new i;for(const e of this.editorItems){const a=this.hideTemplatesForInactiveLayers&&!e.visible;e.supportsCreateFeaturesWorkflow&&!a&&t.push(e.layer)}return t}get activeLeafWorkflow(){const t=this.activeWorkflow;return t&&j(t)?t.activeWorkflow??t:t}get canCreate(){return this.editorItems.some((t=>t.supportsCreateFeaturesWorkflow))}get canCreateVisible(){return!!this.featureTemplatesLayers.length}get canUpdate(){return this.editorItems.some((t=>t.supportsUpdateWorkflow))}get canUpdateVisible(){return this.editorItems.some((t=>t.supportsUpdateWorkflow&&t.visible))}get featureTemplatesLayers(){return this._featureTemplatesLayersAndTables.filter((t=>"scene"===t.type||!t.isTable))}get featureFormViewModel(){const{activeWorkflow:t}=this;return"update"===t?.type?t.activeFeatureFormViewModel:"create-features"===t?.type?t.featureFormViewModel:null}get utilityNetworkAssociationAddAssociationViewModel(){const{activeWorkflow:t}=this;return"update"===t?.type?t.activeUtilityNetworkAssociationAddAssociationViewModel:null}get labelOptions(){return this.sketchOptions.labels}set labelOptions(t){this.sketchOptions.labels=t}get sketchViewModel(){const{activeWorkflow:t}=this;return"update"===t?.type?t.activeSketchViewModel:"create-features"===t?.type?t.sketchViewModel:this.ownSketchViewModel}get state(){if(!this.view?.ready)return"disabled";const t=this.attachmentsViewModel.mode;if("add"===t)return"adding-attachment";if("edit"===t)return"editing-attachment";const{activeWorkflow:e}=this;return e?.stepId?"update"===e.type&&e.activeWorkflow?.stepId?e.activeWorkflow.stepId:e.stepId:"ready"}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||!0===this.activeWorkflow?.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(t){this.sketchOptions.tooltips=t}get valueOptions(){return this.sketchOptions.values}set valueOptions(t){this.sketchOptions.values=t}set view(t){this.ownSketchViewModel.view=t,this.spinnerViewModel.view=t,this._set("view",t)}get canZoomTo(){const t=this.sketchViewModel,e=t?.createGraphic?.geometry?.type;return!(!t?.updateGraphics?.length&&"multipoint"!==e)}get page(){const{activeWorkflow:t,state:e}=this;if("update"===t?.type&&null!=t?.activeWorkflow?.featureFormViewModel?.associatedLayer)return"viewing-associated-features";if("update"===t?.type&&null!=t?.activeWorkflow?.featureFormViewModel?.associationId)return"viewing-associated-layers";if("update"===t?.type&&"awaiting-feature-to-update"===t.stepId)return"ready";if("create-features"===t?.type&&0===t.numPendingFeatures){const e=t.data.upload;if(e)return"default"===e.state?"ready":"creating-features-upload-details"}return e??"disabled"}get featureFormDisabled(){const{activeWorkflow:t}=this;return"update"===t?.type&&!1===t.activeEditorItem?.capabilities.update.attributes}get featureFormHasAssociation(){return!!this.featureFormViewModel?.activeAssociation}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeWorkflow:t}=this;return!!t&&"update"===t.type&&!!t.activeEditorItem?.capabilities.delete.enabled}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}get snappingManager(){return this._snappingManager}getTemplatesForLayer(t){return this._templatesByLayer.get(t)??[]}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateFeaturesWorkflowAtFeatureCreation(t){return this.startCreateFeaturesWorkflow(t,"creating-features")}async startCreateFeaturesWorkflow(t,e="awaiting-feature-creation-info"){if(await m((()=>!this.updating)),!this.canCreate)throw new r("editing:unsupported-workflow","Creating features is unsupported or disabled.");const a=this._createUpdatingResolver();try{await this._cancelWorkflow();const a=this._createCreateFeaturesWorkflow(t,e);this._set("activeWorkflow",a),await a.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{a.resolve()}}async startCreateFeaturesWorkflowAtFeatureEdit(t){await m((()=>!this.updating));const e=this._createUpdatingResolver();try{const{initialFeature:e}=t,a=e.sourceLayer=e.layer,i=a?this.findEditorItemForLayer(a):void 0;if(!i?.supportsCreateFeaturesWorkflow)throw new r("editing:unsupported-workflow","Creating features is unsupported or disabled for this layer.");await this._cancelWorkflow();const s=this._createCreateFeaturesWorkflow({initialFeature:e,layer:i.layer,maxFeatures:1},"creating-features");this._set("activeWorkflow",s),await s.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{e.resolve()}}async startUpdateWorkflowAtFeatureSelection(){if(await m((()=>!this.updating)),!this.canUpdate)return void N("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow();const t=this._createUpdateWorkflow();this._set("activeWorkflow",t),await t.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{t.resolve()}}async startUpdateWorkflowAtMultipleFeatureSelection(t){if(await m((()=>!this.updating)),!this.canUpdate)return void N("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow("awaiting-update-feature-candidate");e.data.candidates=t,this._set("activeWorkflow",e),await e.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{e.resolve()}}async startUpdateWorkflowAtFeatureEdit(t){if(await m((()=>!this.updating)),!this.canUpdate)return void N("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow("editing-existing-feature");e.data.rootFeature=t,this._set("activeWorkflow",e),await e.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{e.resolve()}}async deleteFeatureFromWorkflow(){const{activeWorkflow:t}=this;t&&"update"===t.type?await t.deleteActiveFeature():N("editing:unsupported-workflow","Deleting a feature requires an active update workflow.")}async deleteAssociationFromWorkflow(){const{activeWorkflow:t}=this;t&&"update"===t.type?await t.deleteActiveAssociation():N("editing:unsupported-workflow","Deleting an association requires an active update workflow.")}async cancelWorkflow(t){return this._cancelWorkflow({warnIfNoWorkflow:!0,...t})}findEditorItemForLayer(t){return this.editorItems.find((e=>e.layer===t))}itemHasInvalidFormTemplate(t){return null!=t&&!0===this.findEditorItemForLayer(t.layer)?.hasInvalidFormTemplate}syncFeatureTemplates(){this._featureTemplatesViewModelIsRestricted||this._updateTemplates()}zoomTo(t){const a=this.sketchViewModel,i=t?t.geometry:a?.updateGraphics.length?a?.updateGraphics.toArray().map((t=>t.geometry)).filter(e):a?.createGraphic?.geometry;i&&this.view?.goTo(i)}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection()))}restrictFeatureTemplatesViewModelToLayer(t){return this._featureTemplatesViewModelIsRestricted=!0,this._setFeatureTemplatesViewModelLayers([t]),o((()=>{this._featureTemplatesViewModelIsRestricted=!1,this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)}))}async _getEditorItemCandidates(t){const{view:e}=this;if(!e?.map)return[];const{map:a}=e,i=a.editableLayers.toArray(),r=a.allTables.toArray().filter((t=>I(t)||T(t)));return await Promise.allSettled([...i.flatMap((t=>this._getLayerLoadPromise(t))),...r.flatMap((t=>this._getLayerLoadPromise(t)))]),c(t),[...i.reverse(),...r.reverse()].filter((t=>E(t)&&("mesh"!==t.geometryType||"3d"===e.type))).flatMap((t=>"subtype-group"===t.type?t.sublayers.toArray():t))}_getLayerLoadPromise(t){return T(t)?t.loadAll():t.load()}_drainEditorItems(){this.editorItems.drain((t=>t.destroy()))}_updateEditorItems(){l(this._updateItemsTask);const{view:t}=this,e=a((async e=>{if(!t?.map||!t?.allLayerViews)return;const a=await this._getEditorItemCandidates(e);if(!a.length)return void this._drainEditorItems();const i=[],r=[],s=[],{layerInfos:o}=this;for(const l of a){const e=Q(o,l),a=await P(t,l).catch((()=>null));(e?i:a?r:s).push(new R({layer:l,layerInfo:e,layerView:a}))}o?.length&&i.sort(((t,e)=>o.findIndex((({layer:e})=>e===t.layer))-o.findIndex((({layer:t})=>t===e.layer))));const n=[...i,...r,...s];e.aborted||(this._drainEditorItems(),this.editorItems.addMany(n))}));this._updatingHandles.addPromise(e.promise),this._updateItemsTask=e}_updateTemplates(){l(this._updateTemplatesTask);const t=a((async t=>{const e=this._templatesByLayer,a=this._featureTemplatesLayersAndTables.filter((t=>!e.has(t)));if(a.length>0){const i=await F(a.toArray(),this.view,t);for(const{layer:t,templates:a}of i)e.set(t,a)}this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)}));this._updatingHandles.addPromise(t.promise),this._updateTemplatesTask=t}_setFeatureTemplatesViewModelLayers(t){const e=this._templatesByLayer,a=[];for(const i of t){const t=e.get(i);t&&t.length>0&&a.push(H(i,t))}this.featureTemplatesViewModel.templateInfos=a}_afterEditorItemsChange(){const{activeWorkflow:t}=this;if(this.syncFeatureTemplates(),!t)return;const{stepId:e}=t;"create-features"!==t.type?"update"===t.type&&("awaiting-feature-to-update"===e&&!this.canUpdateVisible||"awaiting-update-feature-candidate"===e&&!t.hasUpdatableCandidates)&&this._cancelWorkflow():"awaiting-feature-creation-info"!==e||this.canCreate||this._cancelWorkflow()}async _cancelWorkflow(t){const e=this.activeWorkflow;if(!e)return void(t?.warnIfNoWorkflow&&N("editing:no-active-workflow","There is no active workflow to cancel."));if(!t||!1!==t.force){this.emit("workflow-cancel"),this._set("activeWorkflow",null);try{await e.cancel(t)}finally{e.destroy()}}else try{await e.cancel(t),this._set("activeWorkflow",null),e.destroy()}catch(a){}}_createCreateFeaturesWorkflow(t,e){return O.create({viewModel:this,creationInfo:t,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:e,applyEditsCallback:(t,e,a)=>this._applyEdits(t,e,a),applyEditsFeatureServiceCallback:(t,e,a)=>this._applyEditsFeatureService(t,e,a),addAttachmentsCallback:(t,e)=>this._addAttachments(t,e)})}_createUpdateWorkflow(t){return S.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEditsCallback:(t,e,a)=>this._applyEdits(t,e,a),applyEditsFeatureServiceCallback:(t,e,a)=>this._applyEditsFeatureService(t,e,a),addAttachmentsCallback:(t,e)=>this._addAttachments(t,e)})}_addAttachments(t,e){const a=e.map((e=>this._addAttachment(t,e.feature,e.attachment)))??[];return Promise.all(a)}async _addAttachment(t,e,a){let i=null;if(!("addAttachment"in t)||null==t.capabilities?.attachment)throw new r("editor:attachments-not-supported","Adding attachments is not supported for this layer type");return await this._queueOperation((async()=>(i=await(t.addAttachment?.(e,a).catch((t=>{throw t?.error||t})))??null,i))),i}async _applyEdits(t,e,a){let i=null;const r=t.url?await b(t.url):null,s={returnServiceEditsOption:(!r||!V(r))&&!RegExp("/hosted/","i").test(t.url)?"original-and-current-features":void 0,...a};return await this._queueOperation((async()=>{const{view:a}=this;if(!a)return null;const r=await P(a,t).catch((()=>null));return i=await t.applyEdits(e,s),r&&await m((()=>!r.updating)),i})),i}async _applyEditsFeatureService(t,e,a){let i=null;return await this._queueOperation((async()=>i=await t.applyEdits(e,a))),i}_queueOperation(t){this._activityQueue.push(t);const e=(t,e)=>{const a=e.indexOf(t);a>-1&&e.splice(a,1)};return t().then((t=>(Array.isArray(t)?t.forEach((t=>this._handleEditsResultError(t))):this._handleEditsResultError(t),t))).catch((a=>{N("editing:operation-error","An error occurred.",{error:a});const i={error:a,retry:()=>(e(i,this.failures),this._queueOperation(t)),cancel:()=>{e(i,this.failures)}};this._set("failures",[...this.failures,i])})).then((()=>{e(t,this._activityQueue)}))}_handleEditsResultError(t){if(null!=t&&"error"in t&&null!=t.error)throw t.error;if(null!=t&&"addFeatureResults"in t){const{addFeatureResults:e,deleteFeatureResults:a,updateFeatureResults:i}=t,r=e.find((t=>!!t.error))||i.find((t=>!!t.error))||a.find((t=>!!t.error));if(r)throw r.error}}_createUpdatingResolver(){const t=u();return this._updatingHandles.addPromise(t.promise),t}_logErrorAndCancelWorkflow(t){const{name:e,message:a,details:i}=t;N(e??"editing:workflow-start-failed",a??void 0,i??t),this._cancelWorkflow({force:!0})}_itemIsSuspended(t){const e=this.findEditorItemForLayer(t);return null!=e&&(!e.visible||e.disabled)}};t([v()],z.prototype,"_featureTemplatesLayersAndTables",null),t([v()],z.prototype,"_snappingManager",void 0),t([v({readOnly:!0})],z.prototype,"activeWorkflow",void 0),t([v()],z.prototype,"activeLeafWorkflow",null),t([v({readOnly:!0})],z.prototype,"_activityQueue",void 0),t([v({readOnly:!0})],z.prototype,"canCreate",null),t([v()],z.prototype,"canCreateVisible",null),t([v({readOnly:!0})],z.prototype,"canUpdate",null),t([v()],z.prototype,"canUpdateVisible",null),t([v()],z.prototype,"featureTemplatesLayers",null),t([v()],z.prototype,"editorItems",void 0),t([v({readOnly:!0})],z.prototype,"failures",void 0),t([v()],z.prototype,"hideTemplatesForInactiveLayers",void 0),t([v({type:U})],z.prototype,"attachmentsViewModel",void 0),t([v()],z.prototype,"featureFormViewModel",null),t([v()],z.prototype,"utilityNetworkAssociationAddAssociationViewModel",null),t([v({type:G})],z.prototype,"featureTemplatesViewModel",void 0),t([v()],z.prototype,"labelOptions",null),t([v()],z.prototype,"layerInfos",void 0),t([v()],z.prototype,"ownSketchViewModel",void 0),t([v()],z.prototype,"sketchOptions",void 0),t([v()],z.prototype,"sketchViewModel",null),t([v({type:L,nonNullable:!0})],z.prototype,"snappingOptions",void 0),t([v()],z.prototype,"spinnerViewModel",void 0),t([v()],z.prototype,"state",null),t([v({readOnly:!0})],z.prototype,"syncing",null),t([v()],z.prototype,"updating",null),t([v()],z.prototype,"tooltipOptions",null),t([v()],z.prototype,"valueOptions",null),t([v()],z.prototype,"view",null),t([v()],z.prototype,"canZoomTo",null),t([v()],z.prototype,"pageStack",void 0),t([v()],z.prototype,"showDiscardEditsPrompt",void 0),t([v()],z.prototype,"_candidateCommitted",void 0),t([v()],z.prototype,"page",null),t([v()],z.prototype,"featureFormDisabled",null),t([v()],z.prototype,"featureFormHasAssociation",null),t([v()],z.prototype,"canGoBack",null),t([v()],z.prototype,"shouldShowDeleteButton",null),t([v()],z.prototype,"hasPendingEdits",null),t([v()],z.prototype,"snappingManager",null),z=t([_(B)],z);const Z=z;export{Z as default};
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{isSome as e}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import i from"../../core/Collection.js";import r from"../../core/Error.js";import s from"../../core/Evented.js";import{makeHandle as o}from"../../core/handleUtils.js";import n from"../../core/Logger.js";import{abortMaybe as l,removeMaybe as p,destroyMaybe as d}from"../../core/maybe.js";import{throwIfAborted as c,createResolver as u}from"../../core/promiseUtils.js";import{watch as h,on as f,when as w,whenOnce as m,syncAndInitial as y,initial as g,sync as k}from"../../core/reactiveUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as W}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as F}from"../../editing/templateUtils.js";import M from"../../layers/GraphicsLayer.js";import{isEditableLayer as E}from"../../layers/support/editableLayers.js";import{isFeatureLayer as I,isSubtypeGroupLayer as T,getOwningPortalUrl as b}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as V}from"../../portal/support/urlUtils.js";import A from"../../views/interactive/sketch/SketchOptions.js";import{SnappingManager as C}from"../../views/interactive/snapping/SnappingManager.js";import L from"../../views/interactive/snapping/SnappingOptions.js";import U from"../Attachments/AttachmentsViewModel.js";import O from"./CreateFeaturesWorkflow.js";import S from"./UpdateWorkflow.js";import{isUpdateWorkflow as j,whenEditorLayerView as P}from"./workflowUtils.js";import R from"./support/EditorItem.js";import{makeTemplateGroupInfoForLayer as H}from"../FeatureTemplates/featureTemplatesUtils.js";import G from"../FeatureTemplates/FeatureTemplatesViewModel.js";import x from"../Sketch/SketchViewModel.js";import D from"../Spinner/SpinnerViewModel.js";import{goTo as B}from"../support/goToUtils.js";const q="esri.widgets.Editor.EditorViewModel",N=()=>n.getLogger(q);function Q(t,e,a){N().error(new r(t,e,a))}function z(t,e){return t?.find((t=>t.layer===e))}let Z=class extends s.EventedAccessor{constructor(t){super(t),this._templatesByLayer=new Map,this._sketchEventListenerHandle=null,this._sketchGraphicsLayer=new M({listMode:"hide",internal:!0}),this._snappingManager=null,this._updateItemsTask=null,this._updateTemplatesTask=null,this._updatingHandles=new W,this._featureTemplatesViewModelIsRestricted=!1,this.activeWorkflow=null,this._activityQueue=new i,this.editorItems=new i,this.failures=[],this.hideTemplatesForInactiveLayers=!1,this.attachmentsViewModel=new U({capabilities:{editing:!0}}),this.featureTemplatesViewModel=new G({disabledItemFunction:({layer:t})=>this._itemIsSuspended(t)}),this.layerInfos=null,this.ownSketchViewModel=new x({layer:this._sketchGraphicsLayer}),this.sketchOptions=new A,this.snappingOptions=new L({attributeRulesEnabled:!0}),this.spinnerViewModel=new D,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.back=async()=>{this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))},this.saveWorkflow=async()=>{const{featureFormViewModel:t}=this;if(t&&"create-features"!==this.activeWorkflow?.type){if(t.submit(),!t.submittable||t.pendingSubtypeChoice)return;const e=t.getValues();if(t.validateContingencyConstraints(e,{includeIncompleteViolations:!0}).length>0)return}await(this.activeWorkflow?.save())},this.selectFeature=(t,e=!1)=>{const a=this.activeWorkflow;this._candidateCommitted||"update"!==a?.type||(a.data.rootFeature=t,e&&(a.next(),this._candidateCommitted=!0))}}initialize(){this.addHandles([h((()=>{const t=this.view,e=t?.map?.editableLayers.toArray(),a=t?.allLayerViews,i=a?.filter((t=>!!e?.includes(t.layer)));return[e,i,this.layerInfos]}),(()=>this._updateEditorItems()),y),h((()=>this.hideTemplatesForInactiveLayers),(()=>this.syncFeatureTemplates())),f((()=>this.activeWorkflow),"cancel",(()=>this.emit("workflow-cancel"))),f((()=>this.activeWorkflow),"commit",(()=>this.emit("workflow-commit"))),f((()=>this.activeWorkflow),"complete",(()=>{this.emit("workflow-commit"),this._set("activeWorkflow",null)})),w((()=>this.view?.map),(t=>t.add(this._sketchGraphicsLayer)),g),f((()=>this.editorItems),"change",(()=>this._afterEditorItemsChange())),h((()=>[this.canCreate,this.canUpdateVisible]),(()=>this._afterEditorItemsChange())),h((()=>this.page),((t,e)=>{const a=[...this.pageStack];if(-1===a.indexOf(t))a.push(t);else for(;a.length&&a.at(-1)!==t;)a.pop();this.pageStack=a}),y),w((()=>"awaiting-update-feature-candidate"===this.state),(()=>this._candidateCommitted=!1)),f((()=>this.featureTemplatesViewModel),"select",(async({item:t,oldItem:e})=>{const{activeWorkflow:a}=this;if(a){if("update"===a.type&&"awaiting-feature-creation-info"===a.activeWorkflow?.stepId)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return void this.featureTemplatesViewModel.select(e,{emit:!1})}}if(!t)return;const i={layer:t.layer,template:t.template};if(t.supportsUpload)return this.featureTemplatesViewModel.select(e,{emit:!1}),this.startCreateFeaturesWorkflow(i);this.startCreateFeaturesWorkflowAtFeatureCreation(i)})),h((()=>[this.view,this.featureTemplatesViewModel]),(([t,e])=>{e.view=t}),y),f((()=>this.view),"key-down",(t=>{"Escape"===t.key&&this.activeWorkflow?.keyboardCancellationEnabled&&(t.stopPropagation(),this.back())})),f((()=>this.sketchViewModel),["create","delete","update"],(t=>{const{activeWorkflow:e}=this,a="update"===e?.type,i=a?e.activeWorkflow?.layer:e?.layer,r=a?e?.activeWorkflow?.parentLayer:void 0,s=`sketch-${t.type}`;this.emit(s,{type:s,detail:t,layer:i,parentLayer:r})}),k),h((()=>this.view),(t=>{if(this._snappingManager=d(this._snappingManager),!t)return;const e=this.snappingOptions;this._snappingManager=new C({view:t,options:e}),this.ownSketchViewModel.snappingManager=this._snappingManager}),y),h((()=>this.snappingOptions),(t=>{this._snappingManager&&(this._snappingManager.options=t)}),y)])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then((()=>{this.view?.map?.remove(this._sketchGraphicsLayer),this.view=null})),this._updateItemsTask=l(this._updateItemsTask),this._updatingHandles.destroy(),this._sketchEventListenerHandle=p(this._sketchEventListenerHandle)}get _featureTemplatesLayersAndTables(){const t=new i;for(const e of this.editorItems){const a=this.hideTemplatesForInactiveLayers&&!e.visible;e.supportsCreateFeaturesWorkflow&&!a&&t.push(e.layer)}return t}get activeLeafWorkflow(){const t=this.activeWorkflow;return t&&j(t)?t.activeWorkflow??t:t}get canCreate(){return this.editorItems.some((t=>t.supportsCreateFeaturesWorkflow))}get canCreateVisible(){return!!this.featureTemplatesLayers.length}get canUpdate(){return this.editorItems.some((t=>t.supportsUpdateWorkflow))}get canUpdateVisible(){return this.editorItems.some((t=>t.supportsUpdateWorkflow&&t.visible))}get featureTemplatesLayers(){return this._featureTemplatesLayersAndTables.filter((t=>"scene"===t.type||!t.isTable))}get featureFormViewModel(){const{activeWorkflow:t}=this;return"update"===t?.type?t.activeFeatureFormViewModel:"create-features"===t?.type?t.featureFormViewModel:null}get utilityNetworkAssociationAddAssociationViewModel(){const{activeWorkflow:t}=this;return"update"===t?.type?t.activeUtilityNetworkAssociationAddAssociationViewModel:null}get labelOptions(){return this.sketchOptions.labels}set labelOptions(t){this.sketchOptions.labels=t}get sketchViewModel(){const{activeWorkflow:t}=this;return"update"===t?.type?t.activeSketchViewModel:"create-features"===t?.type?t.sketchViewModel:this.ownSketchViewModel}get state(){if(!this.view?.ready)return"disabled";const t=this.attachmentsViewModel.mode;if("add"===t)return"adding-attachment";if("edit"===t)return"editing-attachment";const{activeWorkflow:e}=this;return e?.stepId?"update"===e.type&&e.activeWorkflow?.stepId?e.activeWorkflow.stepId:e.stepId:"ready"}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||!0===this.activeWorkflow?.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(t){this.sketchOptions.tooltips=t}get valueOptions(){return this.sketchOptions.values}set valueOptions(t){this.sketchOptions.values=t}set view(t){this.ownSketchViewModel.view=t,this.spinnerViewModel.view=t,this._set("view",t)}get canZoomTo(){const t=this.sketchViewModel,e=t?.createGraphic?.geometry?.type;return!(!t?.updateGraphics?.length&&"multipoint"!==e)}get page(){const{activeWorkflow:t,state:e}=this;if("update"===t?.type&&null!=t?.activeWorkflow?.featureFormViewModel?.associatedLayer)return"viewing-associated-features";if("update"===t?.type&&null!=t?.activeWorkflow?.featureFormViewModel?.associationId)return"viewing-associated-layers";if("update"===t?.type&&"awaiting-feature-to-update"===t.stepId)return"ready";if("create-features"===t?.type&&0===t.numPendingFeatures){const e=t.data.upload;if(e)return"default"===e.state?"ready":"creating-features-upload-details"}return e??"disabled"}get featureFormDisabled(){const{activeWorkflow:t}=this;return"update"===t?.type&&!1===t.activeEditorItem?.capabilities.update.attributes}get featureFormHasAssociation(){return!!this.featureFormViewModel?.activeAssociation}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeWorkflow:t}=this;return!!t&&"update"===t.type&&!!t.activeEditorItem?.capabilities.delete.enabled}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}get snappingManager(){return this._snappingManager}getTemplatesForLayer(t){return this._templatesByLayer.get(t)??[]}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateFeaturesWorkflowAtFeatureCreation(t){return this.startCreateFeaturesWorkflow(t,"creating-features")}async startCreateFeaturesWorkflow(t,e="awaiting-feature-creation-info"){if(await m((()=>!this.updating)),!this.canCreate)throw new r("editing:unsupported-workflow","Creating features is unsupported or disabled.");const a=this._createUpdatingResolver();try{await this._cancelWorkflow();const a=this._createCreateFeaturesWorkflow(t,e);this._set("activeWorkflow",a),await a.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{a.resolve()}}async startCreateFeaturesWorkflowAtFeatureEdit(t){await m((()=>!this.updating));const e=this._createUpdatingResolver();try{const{initialFeature:e}=t,a=e.sourceLayer=e.layer,i=a?this.findEditorItemForLayer(a):void 0;if(!i?.supportsCreateFeaturesWorkflow)throw new r("editing:unsupported-workflow","Creating features is unsupported or disabled for this layer.");await this._cancelWorkflow();const s=this._createCreateFeaturesWorkflow({initialFeature:e,layer:i.layer,maxFeatures:1},"creating-features");this._set("activeWorkflow",s),await s.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{e.resolve()}}async startUpdateWorkflowAtFeatureSelection(){if(await m((()=>!this.updating)),!this.canUpdate)return void Q("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow();const t=this._createUpdateWorkflow();this._set("activeWorkflow",t),await t.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{t.resolve()}}async startUpdateWorkflowAtMultipleFeatureSelection(t){if(await m((()=>!this.updating)),!this.canUpdate)return void Q("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow("awaiting-update-feature-candidate");e.data.candidates=t,this._set("activeWorkflow",e),await e.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{e.resolve()}}async startUpdateWorkflowAtFeatureEdit(t){if(await m((()=>!this.updating)),!this.canUpdate)return void Q("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow("editing-existing-feature");e.data.rootFeature=t,this._set("activeWorkflow",e),await e.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{e.resolve()}}async deleteFeatureFromWorkflow(){const{activeWorkflow:t}=this;t&&"update"===t.type?await t.deleteActiveFeature():Q("editing:unsupported-workflow","Deleting a feature requires an active update workflow.")}async deleteAssociationFromWorkflow(){const{activeWorkflow:t}=this;t&&"update"===t.type?await t.deleteActiveAssociation():Q("editing:unsupported-workflow","Deleting an association requires an active update workflow.")}async cancelWorkflow(t){return this._cancelWorkflow({warnIfNoWorkflow:!0,...t})}findEditorItemForLayer(t){return this.editorItems.find((e=>e.layer===t))}itemHasInvalidFormTemplate(t){return null!=t&&!0===this.findEditorItemForLayer(t.layer)?.hasInvalidFormTemplate}syncFeatureTemplates(){this._featureTemplatesViewModelIsRestricted||this._updateTemplates()}zoomTo(t){const a=this.sketchViewModel,i=t?t.geometry:a?.updateGraphics.length?a?.updateGraphics.toArray().map((t=>t.geometry)).filter(e):a?.createGraphic?.geometry;i&&this.view&&B(this.view,i)}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection()))}restrictFeatureTemplatesViewModelToLayer(t){return this._featureTemplatesViewModelIsRestricted=!0,this._setFeatureTemplatesViewModelLayers([t]),o((()=>{this._featureTemplatesViewModelIsRestricted=!1,this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)}))}async _getEditorItemCandidates(t){const{view:e}=this;if(!e?.map)return[];const{map:a}=e,i=a.editableLayers.toArray(),r=a.allTables.toArray().filter((t=>I(t)||T(t)));return await Promise.allSettled([...i.flatMap((t=>this._getLayerLoadPromise(t))),...r.flatMap((t=>this._getLayerLoadPromise(t)))]),c(t),[...i.reverse(),...r.reverse()].filter((t=>E(t)&&("mesh"!==t.geometryType||"3d"===e.type))).flatMap((t=>"subtype-group"===t.type?t.sublayers.toArray():t))}_getLayerLoadPromise(t){return T(t)?t.loadAll():t.load()}_drainEditorItems(){this.editorItems.drain((t=>t.destroy()))}_updateEditorItems(){l(this._updateItemsTask);const{view:t}=this,e=a((async e=>{if(!t?.map||!t?.allLayerViews)return;const a=await this._getEditorItemCandidates(e);if(!a.length)return void this._drainEditorItems();const i=[],r=[],s=[],{layerInfos:o}=this;for(const l of a){const e=z(o,l),a=await P(t,l).catch((()=>null));(e?i:a?r:s).push(new R({layer:l,layerInfo:e,layerView:a}))}o?.length&&i.sort(((t,e)=>o.findIndex((({layer:e})=>e===t.layer))-o.findIndex((({layer:t})=>t===e.layer))));const n=[...i,...r,...s];e.aborted||(this._drainEditorItems(),this.editorItems.addMany(n))}));this._updatingHandles.addPromise(e.promise),this._updateItemsTask=e}_updateTemplates(){l(this._updateTemplatesTask);const t=a((async t=>{const e=this._templatesByLayer,a=this._featureTemplatesLayersAndTables.filter((t=>!e.has(t)));if(a.length>0){const i=await F(a.toArray(),this.view,t);for(const{layer:t,templates:a}of i)e.set(t,a)}this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)}));this._updatingHandles.addPromise(t.promise),this._updateTemplatesTask=t}_setFeatureTemplatesViewModelLayers(t){const e=this._templatesByLayer,a=[];for(const i of t){const t=e.get(i);t&&t.length>0&&a.push(H(i,t))}this.featureTemplatesViewModel.templateInfos=a}_afterEditorItemsChange(){const{activeWorkflow:t}=this;if(this.syncFeatureTemplates(),!t)return;const{stepId:e}=t;"create-features"!==t.type?"update"===t.type&&("awaiting-feature-to-update"===e&&!this.canUpdateVisible||"awaiting-update-feature-candidate"===e&&!t.hasUpdatableCandidates)&&this._cancelWorkflow():"awaiting-feature-creation-info"!==e||this.canCreate||this._cancelWorkflow()}async _cancelWorkflow(t){const e=this.activeWorkflow;if(!e)return void(t?.warnIfNoWorkflow&&Q("editing:no-active-workflow","There is no active workflow to cancel."));if(!t||!1!==t.force){this.emit("workflow-cancel"),this._set("activeWorkflow",null);try{await e.cancel(t)}finally{e.destroy()}}else try{await e.cancel(t),this._set("activeWorkflow",null),e.destroy()}catch(a){}}_createCreateFeaturesWorkflow(t,e){return O.create({viewModel:this,creationInfo:t,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:e,applyEditsCallback:(t,e,a)=>this._applyEdits(t,e,a),applyEditsFeatureServiceCallback:(t,e,a)=>this._applyEditsFeatureService(t,e,a),addAttachmentsCallback:(t,e)=>this._addAttachments(t,e)})}_createUpdateWorkflow(t){return S.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEditsCallback:(t,e,a)=>this._applyEdits(t,e,a),applyEditsFeatureServiceCallback:(t,e,a)=>this._applyEditsFeatureService(t,e,a),addAttachmentsCallback:(t,e)=>this._addAttachments(t,e)})}_addAttachments(t,e){const a=e.map((e=>this._addAttachment(t,e.feature,e.attachment)))??[];return Promise.all(a)}async _addAttachment(t,e,a){let i=null;if(!("addAttachment"in t)||null==t.capabilities?.attachment)throw new r("editor:attachments-not-supported","Adding attachments is not supported for this layer type");return await this._queueOperation((async()=>(i=await(t.addAttachment?.(e,a).catch((t=>{throw t?.error||t})))??null,i))),i}async _applyEdits(t,e,a){let i=null;const r=t.url?await b(t.url):null,s={returnServiceEditsOption:(!r||!V(r))&&!RegExp("/hosted/","i").test(t.url)?"original-and-current-features":void 0,...a};return await this._queueOperation((async()=>{const{view:a}=this;if(!a)return null;const r=await P(a,t).catch((()=>null));return i=await t.applyEdits(e,s),r&&await m((()=>!r.updating)),i})),i}async _applyEditsFeatureService(t,e,a){let i=null;return await this._queueOperation((async()=>i=await t.applyEdits(e,a))),i}_queueOperation(t){this._activityQueue.push(t);const e=(t,e)=>{const a=e.indexOf(t);a>-1&&e.splice(a,1)};return t().then((t=>(Array.isArray(t)?t.forEach((t=>this._handleEditsResultError(t))):this._handleEditsResultError(t),t))).catch((a=>{Q("editing:operation-error","An error occurred.",{error:a});const i={error:a,retry:()=>(e(i,this.failures),this._queueOperation(t)),cancel:()=>{e(i,this.failures)}};this._set("failures",[...this.failures,i])})).then((()=>{e(t,this._activityQueue)}))}_handleEditsResultError(t){if(null!=t&&"error"in t&&null!=t.error)throw t.error;if(null!=t&&"addFeatureResults"in t){const{addFeatureResults:e,deleteFeatureResults:a,updateFeatureResults:i}=t,r=e.find((t=>!!t.error))||i.find((t=>!!t.error))||a.find((t=>!!t.error));if(r)throw r.error}}_createUpdatingResolver(){const t=u();return this._updatingHandles.addPromise(t.promise),t}_logErrorAndCancelWorkflow(t){const{name:e,message:a,details:i}=t;Q(e??"editing:workflow-start-failed",a??void 0,i??t),this._cancelWorkflow({force:!0})}_itemIsSuspended(t){const e=this.findEditorItemForLayer(t);return null!=e&&(!e.visible||e.disabled)}};t([v()],Z.prototype,"_featureTemplatesLayersAndTables",null),t([v()],Z.prototype,"_snappingManager",void 0),t([v({readOnly:!0})],Z.prototype,"activeWorkflow",void 0),t([v()],Z.prototype,"activeLeafWorkflow",null),t([v({readOnly:!0})],Z.prototype,"_activityQueue",void 0),t([v({readOnly:!0})],Z.prototype,"canCreate",null),t([v()],Z.prototype,"canCreateVisible",null),t([v({readOnly:!0})],Z.prototype,"canUpdate",null),t([v()],Z.prototype,"canUpdateVisible",null),t([v()],Z.prototype,"featureTemplatesLayers",null),t([v()],Z.prototype,"editorItems",void 0),t([v({readOnly:!0})],Z.prototype,"failures",void 0),t([v()],Z.prototype,"hideTemplatesForInactiveLayers",void 0),t([v({type:U})],Z.prototype,"attachmentsViewModel",void 0),t([v()],Z.prototype,"featureFormViewModel",null),t([v()],Z.prototype,"utilityNetworkAssociationAddAssociationViewModel",null),t([v({type:G})],Z.prototype,"featureTemplatesViewModel",void 0),t([v()],Z.prototype,"labelOptions",null),t([v()],Z.prototype,"layerInfos",void 0),t([v()],Z.prototype,"ownSketchViewModel",void 0),t([v()],Z.prototype,"sketchOptions",void 0),t([v()],Z.prototype,"sketchViewModel",null),t([v({type:L,nonNullable:!0})],Z.prototype,"snappingOptions",void 0),t([v()],Z.prototype,"spinnerViewModel",void 0),t([v()],Z.prototype,"state",null),t([v({readOnly:!0})],Z.prototype,"syncing",null),t([v()],Z.prototype,"updating",null),t([v()],Z.prototype,"tooltipOptions",null),t([v()],Z.prototype,"valueOptions",null),t([v()],Z.prototype,"view",null),t([v()],Z.prototype,"canZoomTo",null),t([v()],Z.prototype,"pageStack",void 0),t([v()],Z.prototype,"showDiscardEditsPrompt",void 0),t([v()],Z.prototype,"_candidateCommitted",void 0),t([v()],Z.prototype,"page",null),t([v()],Z.prototype,"featureFormDisabled",null),t([v()],Z.prototype,"featureFormHasAssociation",null),t([v()],Z.prototype,"canGoBack",null),t([v()],Z.prototype,"shouldShowDeleteButton",null),t([v()],Z.prototype,"hasPendingEdits",null),t([v()],Z.prototype,"snappingManager",null),Z=t([_(q)],Z);const $=Z;export{$ as default};
|