@arcgis/core 4.34.0-next.40 → 4.34.0-next.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/1a2278b9fe9666342728.js +1 -0
  3. package/assets/esri/core/workers/chunks/{4e6e5677b90b00622146.js → 7ef7f3925495b9ade88c.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{5fe3c279d57f44416c28.js → a1d3f1c221389eb6090c.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{306a68137e62656b0f05.js → d5d2d4df407cf078bb81.js} +1 -1
  6. package/config.js +1 -1
  7. package/core/workers/registry.js +1 -1
  8. package/editing/sharedTemplates/executor/support/createFeatureServiceEdit.js +1 -1
  9. package/geometry/support/curves/closestPointOnCurve.js +1 -1
  10. package/geometry/support/curves/curveExtent.js +1 -1
  11. package/geometry/support/curves/curveLength.js +1 -1
  12. package/geometry/support/curves/curveUtils.js +1 -1
  13. package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
  14. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  15. package/geometry/support/curves/splitCurveAtPoint.js +1 -1
  16. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  17. package/interfaces.d.ts +24 -2
  18. package/kernel.js +1 -1
  19. package/layers/PointCloudLayer.js +1 -1
  20. package/package.json +1 -1
  21. package/rest/networks/support/CircuitPath.js +1 -1
  22. package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
  23. package/support/revision.js +1 -1
  24. package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
  25. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  26. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  27. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  28. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  29. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  30. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  31. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +1 -1
  32. package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
  33. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  34. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  35. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  36. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  37. package/views/3d/support/intersectionUtils.js +1 -1
  38. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  39. package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +5 -0
  40. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  41. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  42. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +5 -0
  43. package/views/PopupView.js +1 -1
  44. package/views/draw/DrawAction.js +1 -1
  45. package/views/draw/DrawOperation.js +1 -1
  46. package/views/draw/SegmentDrawAction.js +1 -1
  47. package/views/draw/support/Reshape.js +1 -1
  48. package/views/interactive/SegmentLabels.js +1 -1
  49. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  50. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  51. package/views/interactive/editGeometry/operations/AppendVertex.js +1 -1
  52. package/views/interactive/editGeometry/operations/ClosePart.js +5 -0
  53. package/views/interactive/editGeometry/operations/MoveMesh.js +1 -1
  54. package/views/interactive/editGeometry/operations/MoveVertex.js +1 -1
  55. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  56. package/views/interactive/editGeometry/operations/RemoveVertices.js +1 -1
  57. package/views/interactive/editGeometry/operations/RotateVertex.js +1 -1
  58. package/views/interactive/editGeometry/operations/ScaleVertex.js +1 -1
  59. package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
  60. package/views/interactive/editGeometry/operations/SetVertexPosition.js +1 -1
  61. package/views/interactive/editGeometry/operations/SplitSegment.js +5 -0
  62. package/views/interactive/editGeometry/operations/UpdateVertices.js +1 -1
  63. package/views/interactive/editGeometry/operations/curveOperationUtils.js +5 -0
  64. package/views/interactive/editGeometry/operations.js +1 -1
  65. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  66. package/views/interactive/snapping/LineSnapper.js +1 -1
  67. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  68. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  69. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  70. package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
  71. package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
  72. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  73. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  74. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  75. package/widgets/Editor/EditorViewModel.js +1 -1
  76. package/widgets/Editor/support/SketchController.js +1 -1
  77. package/widgets/Feature/FeatureMedia.js +1 -1
  78. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  79. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  80. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  81. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  82. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  83. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  84. package/widgets/Features.js +1 -1
  85. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  86. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  87. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  88. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
  89. package/widgets/PanoramicViewer/support/PanoramicMeshManager.js +5 -0
  90. package/widgets/PanoramicViewer/support/PanoramicMeshWorker.js +5 -0
  91. package/widgets/Spinner.js +1 -1
  92. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  93. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  94. package/widgets/UtilityNetworkTrace.js +1 -1
  95. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  96. package/widgets/smartMapping/HeatmapSlider/HeatmapSliderViewModel.js +1 -1
  97. package/views/interactive/editGeometry/operations/CloseComponent.js +0 -5
  98. package/views/interactive/editGeometry/operations/SplitEdge.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.34/esri/copyright.txt for details.
4
4
  */
5
- import{equals as e}from"../../../core/arrayUtils.js";import{neverReached as t}from"../../../core/compilerUtils.js";import{Evented as s}from"../../../core/Evented.js";import i from"../../../geometry/Polygon.js";import r from"../../../geometry/Polyline.js";import{createCoordinateHelper as o}from"../coordinateHelper.js";import{unnormalize as n,getUnnormalizationInfo as c}from"./unnormalizationHelper.js";class h{constructor(e){this.component=e,this.leftEdge=null,this.rightEdge=null,this.type="vertex",this.index=null}get pos(){return this._pos}set pos(e){this._pos=e,this.component.unnormalizeVertexPositions()}}class l{constructor(e,t,s){this.component=e,this.leftVertex=t,this.rightVertex=s,this.type="edge",t.rightEdge=this,s.leftEdge=this}}class a{constructor(e,t){this._spatialReference=e,this._viewingMode=t,this.vertices=[],this.edges=[],this.index=null}unnormalizeVertexPositions(){this.vertices.length<=1||n(this.vertices,c(this._spatialReference,this._viewingMode))}updateVertexIndex(e,t){if(0===this.vertices.length)return;const s=this.vertices[0];let i=null,r=e,o=t;do{i=r,i.index=o++,r=i.rightEdge?i.rightEdge.rightVertex:null}while(null!=r&&r!==s);i.leftEdge&&i!==this.vertices[this.vertices.length-1]&&this.swapVertices(this.vertices.indexOf(i),this.vertices.length-1)}getFirstVertex(){return this.vertices.at(0)}getLastVertex(){return this.vertices.at(-1)}isClosed(){return this.vertices.length>2&&null!==this.vertices[0].leftEdge}swapVertices(e,t){const s=this.vertices[e];this.vertices[e]=this.vertices[t],this.vertices[t]=s}*iterateVertices(){const e=this.getFirstVertex();let t=e;if(t)do{yield t,t=t.rightEdge?.rightVertex}while(t!==e&&null!=t)}}class p extends s{constructor(e,t){super(),this.type=e,this.coordinateHelper=t,this._geometry=null,this._dirty=!0,this.components=[]}get geometry(){if(this._dirty){switch(this.type){case"point":this._geometry=this._toPoint();break;case"polyline":this._geometry=this._toPolyline();break;case"polygon":this._geometry=this._toPolygon();break;case"mesh":break;default:t(this.type)}this._dirty=!1}return this._geometry}get spatialReference(){return this.coordinateHelper.spatialReference}get allVerticesUnordered(){return Array.from(this.iterateVerticesUnordered())}*iterateVerticesUnordered(){for(const e of this.components)for(const t of e.vertices)yield t}get allVertices(){return Array.from(this.iterateVertices())}*iterateVertices(){for(const e of this.components)yield*e.iterateVertices()}notifyChanges(e){this._dirty=!0,this.emit("change",e)}_toPoint(){return 0===this.components.length||0===this.components[0].vertices.length?null:this.coordinateHelper.vectorToPoint(this.components[0].vertices[0].pos)}_toPolyline(){const e=[],t=this.coordinateHelper.vectorToArray;for(const s of this.components){if(s.vertices.length<1)continue;const i=[];let r=s.vertices.find(e=>null==e.leftEdge);const o=r;do{i.push(t(r.pos)),r=r.rightEdge?r.rightEdge.rightVertex:null}while(r&&r!==o);e.push(i)}return new r({paths:e,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}_toPolygon(){const e=[],t=this.coordinateHelper.vectorToArray;for(const s of this.components){if(s.vertices.length<1)continue;const i=[],r=s.vertices[0];let o=r;const n=o;do{i.push(t(o.pos)),o=null!=o.rightEdge?o.rightEdge.rightVertex:null}while(o&&o!==n);s.isClosed()&&i.push(t(r.pos)),e.push(i)}return new i({rings:e,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}static fromGeometry(e,t){const s=e.spatialReference,i=o(e.hasZ,e.hasM,s),r=new p(e.type,i);switch(e.type){case"polygon":g(r,e,t);break;case"polyline":d(r,e,t);break;case"point":u(r,e,t);break;case"mesh":u(r,e.origin,t),r._geometry=e,r._dirty=!1}return r}}function g(t,s,i){const r=s.spatialReference,o=t.coordinateHelper,n=s.rings;for(let c=0;c<n.length;++c){const s=n[c],p=new a(r,i);p.index=c;const g=s.length>2&&e(s[0],s[s.length-1]),d=g?s.length-1:s.length;for(let e=0;e<d;++e){const t=o.arrayToVector(s[e]),i=new h(p);p.vertices.push(i),i.pos=t,i.index=e}const u=p.vertices.length-1;for(let e=0;e<u;++e){const t=p.vertices[e],s=p.vertices[e+1],i=new l(p,t,s);p.edges.push(i)}if(g){const e=new l(p,p.vertices[p.vertices.length-1],p.vertices[0]);p.edges.push(e)}t.components.push(p)}}function d(e,t,s){const i=t.spatialReference,r=e.coordinateHelper,o=t.paths;for(let n=0;n<o.length;++n){const t=o[n],c=new a(i,s);c.index=n;const p=t.length;for(let e=0;e<p;++e){const s=r.arrayToVector(t[e]),i=new h(c);c.vertices.push(i),i.pos=s,i.index=e}const g=c.vertices.length-1;for(let e=0;e<g;++e){const t=c.vertices[e],s=c.vertices[e+1],i=new l(c,t,s);c.edges.push(i)}e.components.push(c)}}function u(e,t,s){const i=t.spatialReference,r=e.coordinateHelper,o=new a(i,s);o.index=0;const n=new h(o);n.index=0,n.pos=r.pointToVector(t),o.vertices.push(n),e.components.push(o)}function f(e){return"mesh"===e.type}export{a as Component,l as Edge,p as EditGeometry,h as Vertex,f as isMeshEditGeometry};
5
+ import{equals as t}from"../../../core/arrayUtils.js";import{neverReached as e}from"../../../core/compilerUtils.js";import{Evented as r}from"../../../core/Evented.js";import i from"../../../geometry/Polygon.js";import s from"../../../geometry/Polyline.js";import{getEndpoint as n,isCoordinate as o,isBezierCurve as h,isCircularArc as c,isEllipticArc4 as l}from"../../../geometry/support/curves/curveUtils.js";import{createCoordinateHelper as a}from"../coordinateHelper.js";import{unnormalize as p,getUnnormalizationInfo as g}from"./unnormalizationHelper.js";class u{constructor(t){this.part=t,this.leftSegment=null,this.rightSegment=null,this.type="vertex",this.index=null}get pos(){return this._pos}set pos(t){this._pos=t,this.part.unnormalizeVertexPositions()}}class f{constructor(t,e,r){this.part=t,this.leftVertex=e,this.rightVertex=r,this.type="line",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){return[...this.rightVertex.pos]}}class m{constructor(t,e,r,i){this.part=t,this.leftVertex=e,this.rightVertex=r,this.curveDefinition=i,this.type="bezier",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){return{b:[[...this.rightVertex.pos],[...this.curveDefinition.controlPoint1],[...this.curveDefinition.controlPoint2]]}}}class d{constructor(t,e,r,i){this.part=t,this.leftVertex=e,this.rightVertex=r,this.curveDefinition=i,this.type="circular-arc",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){const t=this.rightVertex.pos,{interiorPoint:e}=this.curveDefinition;return{c:[[...t],[...e]]}}}class v{constructor(t,e,r,i){this.part=t,this.leftVertex=e,this.rightVertex=r,this.curveDefinition=i,this.type="elliptic-arc-4",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){const t=this.rightVertex.pos,{centerPoint:e,sweep:r,orientation:i}=this.curveDefinition;return{a:[[...t],[...e],r,i]}}}class y{constructor(t,e,r,i){this.part=t,this.leftVertex=e,this.rightVertex=r,this.curveDefinition=i,this.type="elliptic-arc-7",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){const t=this.rightVertex.pos,{centerPoint:e,sweep:r,orientation:i,rotation:s,semiMajorAxisLength:n,minorMajorAxisRatio:o}=this.curveDefinition;return{a:[[...t],e,r,i,s,n,o]}}}class x{constructor(t,e){this._spatialReference=t,this._viewingMode=e,this.vertices=[],this.segments=[],this.index=null}unnormalizeVertexPositions(){this.vertices.length<=1||p(this.vertices,g(this._spatialReference,this._viewingMode))}updateVertexIndex(t,e){const{vertices:r}=this;if(0===r.length)return;const i=r[0];let s=null,n=t,o=e;do{s=n,s.index=o++,n=s.rightSegment?s.rightSegment.rightVertex:null}while(null!=n&&n!==i);s.leftSegment&&s!==r[r.length-1]&&this.swapVertices(r.indexOf(s),r.length-1)}getFirstVertex(){return this.vertices.at(0)}getLastVertex(){return this.vertices.at(-1)}isClosed(){return null!==this.getFirstVertex()?.leftSegment}swapVertices(t,e){const{vertices:r}=this,i=r[t];r[t]=r[e],r[e]=i}*iterateVertices(){const t=this.getFirstVertex();let e=t;if(e)do{yield e,e=e.rightSegment?.rightVertex}while(e!==t&&null!=e)}}class V extends r{constructor(t,e){super(),this.type=t,this.coordinateHelper=e,this._geometry=null,this._dirty=!0,this.parts=[]}get geometry(){if(this._dirty){switch(this.type){case"point":this._geometry=this._toPoint();break;case"polyline":this._geometry=this._toPolyline();break;case"polygon":this._geometry=this._toPolygon();break;case"mesh":break;default:e(this.type)}this._dirty=!1}return this._geometry}get spatialReference(){return this.coordinateHelper.spatialReference}get allVerticesUnordered(){return Array.from(this.iterateVerticesUnordered())}*iterateVerticesUnordered(){for(const t of this.parts)for(const e of t.vertices)yield e}get allVertices(){return Array.from(this.iterateVertices())}*iterateVertices(){for(const t of this.parts)yield*t.iterateVertices()}notifyChanges(t){this._dirty=!0,this.emit("change",t)}_toPoint(){const{parts:t,coordinateHelper:e}=this;return t.at(0)?.vertices.length?e.vectorToPoint(t[0].vertices[0].pos):null}_toPolyline(){const t=[];let e=!1;for(const r of this.parts){if(r.vertices.length<1)continue;const i=r.vertices[0],s=[];s.push(i.pos);let n=i.rightSegment;for(;n;)e||="line"!==n.type,s.push(n.toCurveOrCoordinate()),n=n.rightVertex.rightSegment;t.push(s)}return new s({paths:e?void 0:t,curvePaths:e?t:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}_toPolygon(){const t=[];let e=!1;for(const r of this.parts){if(r.vertices.length<1)continue;const i=r.vertices[0],s=[];s.push(i.pos);let n=i.rightSegment;for(;n&&(e||="line"!==n.type,s.push(n.toCurveOrCoordinate()),n=n.rightVertex.rightSegment,n?.leftVertex!==i););t.push(s)}return new i({rings:e?void 0:t,curveRings:e?t:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}static fromGeometry(t,e,r){const i=t.spatialReference,s=a(t.hasZ,t.hasM,i),n=new V(t.type,s);switch(t.type){case"polygon":_(n,t,e,r?.allowCurves??!1);break;case"polyline":S(n,t,e,r?.allowCurves??!1);break;case"point":C(n,t,e);break;case"mesh":C(n,t.origin,e),n._geometry=t,n._dirty=!1}return n}}function w(t,e,r,i){const s=new u(t);t.vertices.push(s);const o=n(i);return s.pos=e.arrayToVector(o),s.index=t.vertices.length-1,r&&t.segments.push(P(t,r,s,i)),s}function P(t,e,r,i){if(o(i))return new f(t,e,r);if(h(i)){const[,s,n]=i.b;return new m(t,e,r,{controlPoint1:[...s],controlPoint2:[...n]})}if(c(i)){const[,s]=i.c;return new d(t,e,r,{interiorPoint:[...s]})}if(l(i)){const[,s,n,o]=i.a;return new v(t,e,r,{centerPoint:[...s],sweep:n,orientation:o})}const[,s,n,a,p,g,u]=i.a;return new y(t,e,r,{centerPoint:[...s],sweep:n,orientation:a,rotation:p,semiMajorAxisLength:g,minorMajorAxisRatio:u})}function _(e,r,i,s){const o=r.spatialReference,h=e.coordinateHelper,{rings:c,curveRings:l}=r,a=l&&s?l:c;for(let p=0;p<a.length;++p){const r=a[p],s=new x(o,i);if(s.index=p,e.parts.push(s),r.length<1)continue;let c=null,l=null;for(let t=0;t<r.length-1;++t)l=w(s,h,l,r[t]),c??=l;r.length>1&&t(n(r[r.length-1]),c?.pos)?l&&c&&s.segments.push(P(s,l,c,r[r.length-1])):l=w(s,h,l,r[r.length-1])}}function S(t,e,r,i){const s=e.spatialReference,n=t.coordinateHelper,{curvePaths:o,paths:h}=e,c=o&&i?o:h;for(let l=0;l<c.length;++l){const e=c[l],i=new x(s,r);if(i.index=l,t.parts.push(i),e.length<1)continue;let o=null;for(let t=0;t<e.length;++t)o=w(i,n,o,e[t])}}function C(t,e,r){const i=e.spatialReference,s=t.coordinateHelper,n=new x(i,r);n.index=0;const o=new u(n);o.index=0,o.pos=s.pointToVector(e),n.vertices.push(o),t.parts.push(n)}function R(t){return"mesh"===t.type}export{m as BezierSegment,d as CircularArcSegment,V as EditGeometry,v as EllipticArc4Segment,y as EllipticArc7Segment,f as LineSegment,x as Part,u as Vertex,P as createConnectingSegment,R as isMeshEditGeometry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{Evented as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import{clone as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{hasCompatibleTopology as s}from"../../../geometry/support/coordsUtils.js";import{isMeshEditGeometry as o,EditGeometry as i}from"./EditGeometry.js";import{AppendVertex as a}from"./operations/AppendVertex.js";import{UpdateVertices as n}from"./operations/UpdateVertices.js";import{RemoveVertices as p}from"./operations/RemoveVertices.js";import{SplitEdge as d}from"./operations/SplitEdge.js";import{SetVertexPosition as c}from"./operations/SetVertexPosition.js";import{CloseComponent as h}from"./operations/CloseComponent.js";import{MoveMesh as u}from"./operations/MoveMesh.js";import{MoveVertex as l}from"./operations/MoveVertex.js";import{OffsetEdgeVertex as m}from"./operations/OffsetEdgeVertex.js";import{RotateVertex as V}from"./operations/RotateVertex.js";import{ScaleVertex as y}from"./operations/ScaleVertex.js";import{SetAllVertexPositions as f}from"./operations/SetAllVertexPositions.js";import{UndoGroup as _}from"./operations/UndoGroup.js";class v extends e{constructor(e,t){super(),this.data=e,this.viewingMode=t,this._undoStack=[],this._redoStack=[],this._listener=this.data.on("change",e=>{e.addedVertices&&this.emit("vertex-add",{type:"vertex-add",vertices:e.addedVertices,operation:e.operation}),e.removedVertices&&this.emit("vertex-remove",{type:"vertex-remove",vertices:e.removedVertices,operation:e.operation}),e.updatedVertices&&this.emit("vertex-update",{type:"vertex-update",vertices:e.updatedVertices,operation:e.operation})})}destroy(){super.destroy(),this._listener.remove()}splitEdge(e,t){return this._apply(new d(this.data,e,t))}updateVertices(e,t,r=1){return this._apply(new n(this.data,e,t),r)}move(e,t,r,s=1){return o(this.data)?this._apply(new u(this.data,e,t,r),s):this.moveVertices(this.data.allVerticesUnordered,e,t,r,s)}moveVertices(e,t,r,s,i=1){return o(this.data)?this._apply(new u(this.data,t,r,s),i):this.updateVertices(e,new l(this.data.coordinateHelper,t,r,s),i)}scale(e,t,r,s,o=1,i=0){return this.scaleVertices(this.data.allVerticesUnordered,e,t,r,s,o,i)}scaleVertices(e,t,r,s,o,i=1,a=0){return this.updateVertices(e,new y(t,r,s,o,a),i)}rotate(e,t,r=1,s=0){return this.rotateVertices(this.data.allVerticesUnordered,e,t,r,s)}rotateVertices(e,t,r,s=1,o=0){return this.updateVertices(e,new V(t,r,o),s)}removeVertices(e){return this._apply(new p(this.data,e,this._minNumVerticesPerType))}appendVertex(e){return 0===this.data.components.length?null:this._apply(new a(this.data,this.data.components[0],e))}setVertexPosition(e,t){return this._apply(new c(this.data,e,t))}offsetEdge(e,t,r,s=1){return this.updateVertices([t.leftVertex,t.rightVertex],new m(this.data.coordinateHelper,e,t,r),s)}trySetGeometry(e,t=1){const{data:r}=this,{coordinateHelper:a}=r;if(r.type!==e.type||!r.spatialReference.equals(e.spatialReference)||a.hasZ()!==e.hasZ||a.hasM()!==e.hasM||!s(r.geometry,e)||o(r))return;const n=Array.from(i.fromGeometry(e,this.viewingMode).iterateVerticesUnordered(),e=>e.pos);return this.setVertexPositions(n,t)}setVertexPositions(e,t=1){return this._apply(new f(this.data,e),t)}createResetState(){if(o(this.data))return this._createResetStateMesh();const e=this.data.geometry.clone();return t(()=>this.trySetGeometry(e))}closeComponent(e){return this.data.components.includes(e)?this._apply(new h(this.data,e)):null}canRemoveVertex(e){return e.vertices.length>this._minNumVerticesPerType}createUndoGroup(){const e=new _;return this._apply(e),t(()=>e.close())}undo(){if(this._undoStack.length>0){const e=this._undoStack.pop();return e.undo(),this._redoStack.push(e),e}return null}redo(){if(this._redoStack.length>0){const e=this._redoStack.pop();return e.apply(),this._undoStack.push(e),e}return null}get canUndo(){return this._undoStack.length>0}get canRedo(){return this._redoStack.length>0}get lastOperation(){return this._undoStack.length>0?this._undoStack[this._undoStack.length-1]:null}get _minNumVerticesPerType(){switch(this.data.type){case"point":return 1;case"polyline":return 2;case"polygon":return 3;default:return 0}}_apply(e,t=1){return 0!==t&&null!=this.lastOperation&&this.lastOperation.accumulate(e)||(e.apply(),this._undoStack.push(e),this._redoStack=[]),e}_createResetStateMesh(){if(!o(this.data))return t();const e=this.data.geometry,{vertexSpace:s}=e;if(s.origin){const o=r(s.origin);return t(()=>{e.vertexSpace.origin=o})}const i=e.vertexAttributes.clonePositional();return t(()=>{e.vertexAttributes=i,e.vertexAttributesChanged()})}static fromGeometry(e,t){return new v(i.fromGeometry(e,t),t)}}export{v as EditGeometryOperations};
5
+ import{Evented as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import{clone as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{hasCompatibleTopology as s}from"../../../geometry/support/coordsUtils.js";import{isMeshEditGeometry as i,EditGeometry as o}from"./EditGeometry.js";import{AppendVertex as a}from"./operations/AppendVertex.js";import{UpdateVertices as n}from"./operations/UpdateVertices.js";import{RemoveVertices as p}from"./operations/RemoveVertices.js";import{SplitSegment as d}from"./operations/SplitSegment.js";import{SetVertexPosition as h}from"./operations/SetVertexPosition.js";import{ClosePart as c}from"./operations/ClosePart.js";import{MoveMesh as u}from"./operations/MoveMesh.js";import{MoveVertex as l}from"./operations/MoveVertex.js";import{OffsetEdgeVertex as m}from"./operations/OffsetEdgeVertex.js";import{RotateVertex as V}from"./operations/RotateVertex.js";import{ScaleVertex as y}from"./operations/ScaleVertex.js";import{SetAllVertexPositions as f}from"./operations/SetAllVertexPositions.js";import{UndoGroup as v}from"./operations/UndoGroup.js";class _ extends e{constructor(e,t,r=!1){super(),this.data=e,this.viewingMode=t,this.allowCurves=r,this._undoStack=[],this._redoStack=[],this._listener=this.data.on("change",e=>{e.addedVertices&&this.emit("vertex-add",{type:"vertex-add",vertices:e.addedVertices,operation:e.operation}),e.removedVertices&&this.emit("vertex-remove",{type:"vertex-remove",vertices:e.removedVertices,operation:e.operation}),e.updatedVertices&&this.emit("vertex-update",{type:"vertex-update",vertices:e.updatedVertices,operation:e.operation})})}destroy(){super.destroy(),this._listener.remove()}splitSegment(e,t){return this._apply(new d(this.data,e,t))}updateVertices(e,t,r=1){return this._apply(new n(this.data,e,t),r)}move(e,t,r,s=1){return i(this.data)?this._apply(new u(this.data,e,t,r),s):this.moveVertices(this.data.allVerticesUnordered,e,t,r,s)}moveVertices(e,t,r,s,o=1){return i(this.data)?this._apply(new u(this.data,t,r,s),o):this.updateVertices(e,new l(this.data.coordinateHelper,t,r,s),o)}scale(e,t,r,s,i=1,o=0){return this.scaleVertices(this.data.allVerticesUnordered,e,t,r,s,i,o)}scaleVertices(e,t,r,s,i,o=1,a=0){return this.updateVertices(e,new y(t,r,s,i,a),o)}rotate(e,t,r=1,s=0){return this.rotateVertices(this.data.allVerticesUnordered,e,t,r,s)}rotateVertices(e,t,r,s=1,i=0){return this.updateVertices(e,new V(t,r,i),s)}removeVertices(e){return this._apply(new p(this.data,e,this._minNumVerticesPerType))}appendVertex(e){return 0===this.data.parts.length?null:this._apply(new a(this.data,this.data.parts[0],e))}setVertexPosition(e,t){return this._apply(new h(this.data,e,t))}offsetEdge(e,t,r,s=1){return this.updateVertices([t.leftVertex,t.rightVertex],new m(this.data.coordinateHelper,e,t,r),s)}trySetGeometry(e,t=1){const{data:r}=this,{coordinateHelper:a}=r;if(r.type!==e.type||!r.spatialReference.equals(e.spatialReference)||a.hasZ()!==e.hasZ||a.hasM()!==e.hasM||!s(r.geometry,e)||i(r))return;const n=Array.from(o.fromGeometry(e,this.viewingMode,{allowCurves:this.allowCurves}).iterateVerticesUnordered(),e=>e.pos);return this.setVertexPositions(n,t)}setVertexPositions(e,t=1){return this._apply(new f(this.data,e),t)}createResetState(){if(i(this.data))return this._createResetStateMesh();const e=this.data.geometry.clone();return t(()=>this.trySetGeometry(e))}closePart(e){return this.data.parts.includes(e)?this._apply(new c(this.data,e)):null}canRemoveVertex(e){return e.vertices.length>this._minNumVerticesPerType}createUndoGroup(){const e=new v;return this._apply(e),t(()=>e.close())}undo(){if(this._undoStack.length>0){const e=this._undoStack.pop();return e.undo(),this._redoStack.push(e),e}return null}redo(){if(this._redoStack.length>0){const e=this._redoStack.pop();return e.apply(),this._undoStack.push(e),e}return null}get canUndo(){return this._undoStack.length>0}get canRedo(){return this._redoStack.length>0}get lastOperation(){return this._undoStack.length>0?this._undoStack[this._undoStack.length-1]:null}get _minNumVerticesPerType(){switch(this.data.type){case"point":return 1;case"polyline":return 2;case"polygon":return 3;default:return 0}}_apply(e,t=1){return 0!==t&&null!=this.lastOperation&&this.lastOperation.accumulate(e)||(e.apply(),this._undoStack.push(e),this._redoStack=[]),e}_createResetStateMesh(){if(!i(this.data))return t();const e=this.data.geometry,{vertexSpace:s}=e;if(s.origin){const i=r(s.origin);return t(()=>{e.vertexSpace.origin=i})}const o=e.vertexAttributes.clonePositional();return t(()=>{e.vertexAttributes=o,e.vertexAttributesChanged()})}static fromGeometry(e,t,r){return new _(o.fromGeometry(e,t,r),t,!!r?.allowCurves)}}export{_ as EditGeometryOperations};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{Vertex as e,Edge as t}from"../EditGeometry.js";class i{constructor(e,t,i){this._editGeometry=e,this._component=t,this._pos=i,this._addedVertex=null,this._originalEdge=null,this._left=null,this._right=null}apply(){let i="redo";null==this._addedVertex&&(i="apply",this._addedVertex=new e(this._component));const s=this._component.getLastVertex();if(null==s)this._component.vertices.push(this._addedVertex),this._addedVertex.pos=this._pos,this._addedVertex.index=0;else{let e=null;s.rightEdge&&(this._originalEdge=s.rightEdge,e=this._originalEdge.rightVertex,this._component.edges.splice(this._component.edges.indexOf(this._originalEdge),1)),this._component.vertices.push(this._addedVertex),this._addedVertex.pos=this._pos,null==this._left&&(this._left=new t(this._component,s,this._addedVertex)),this._component.edges.push(this._left),s.rightEdge=this._left,null!=this._originalEdge&&null!=e&&(null==this._right&&(this._right=new t(this._component,this._addedVertex,e)),this._component.edges.push(this._right),e.leftEdge=this._right),this._component.updateVertexIndex(this._addedVertex,s.index+1)}this._editGeometry.notifyChanges({operation:i,addedVertices:[this._addedVertex]})}undo(){null!=this._addedVertex&&(this._component.vertices.splice(this._component.vertices.indexOf(this._addedVertex),1),null!=this._left&&(this._component.edges.splice(this._component.edges.indexOf(this._left),1),this._left.leftVertex.rightEdge=null),null!=this._right&&(this._component.edges.splice(this._component.edges.indexOf(this._right),1),this._right.rightVertex.leftEdge=null),null!=this._originalEdge&&(this._component.edges.push(this._originalEdge),this._originalEdge.leftVertex.rightEdge=this._originalEdge,this._originalEdge.rightVertex.leftEdge=this._originalEdge),null!=this._left?this._component.updateVertexIndex(this._left.leftVertex,this._left.leftVertex.index):this._component.updateVertexIndex(this._addedVertex,0),this._editGeometry.notifyChanges({operation:"undo",removedVertices:[this._addedVertex]}))}accumulate(){return!1}}export{i as AppendVertex};
5
+ import{getEndpoint as e}from"../../../../geometry/support/curves/curveUtils.js";import{Vertex as t,createConnectingSegment as i,LineSegment as s}from"../EditGeometry.js";class r{constructor(e,t,i){this._editGeometry=e,this._part=t,this._posOrCurveDef=i,this._addedVertex=null,this._originalSegment=null,this._left=null,this._right=null}apply(){let r="redo";const{_part:n,_editGeometry:d,_posOrCurveDef:l}=this;null==this._addedVertex&&(r="apply",this._addedVertex=new t(n));const h=n.getLastVertex(),g=d.coordinateHelper.arrayToVector(e(l));if(null==h)n.vertices.push(this._addedVertex),this._addedVertex.pos=g,this._addedVertex.index=0;else{let e=null;h.rightSegment&&(this._originalSegment=h.rightSegment,e=this._originalSegment.rightVertex,n.segments.splice(n.segments.indexOf(this._originalSegment),1)),n.vertices.push(this._addedVertex),this._addedVertex.pos=g,this._left??=i(n,h,this._addedVertex,l),n.segments.push(this._left),h.rightSegment=this._left,null!=this._originalSegment&&null!=e&&(this._right??=new s(this._part,this._addedVertex,e),n.segments.push(this._right),e.leftSegment=this._right),n.updateVertexIndex(this._addedVertex,h.index+1)}this._editGeometry.notifyChanges({operation:r,addedVertices:[this._addedVertex]})}undo(){const{_addedVertex:e,_part:t,_left:i,_right:s,_originalSegment:r}=this;null!=e&&(t.vertices.splice(t.vertices.indexOf(e),1),null!=i&&(t.segments.splice(t.segments.indexOf(i),1),i.leftVertex.rightSegment=null),null!=s&&(t.segments.splice(t.segments.indexOf(s),1),s.rightVertex.leftSegment=null),null!=r&&(t.segments.push(r),r.leftVertex.rightSegment=r,r.rightVertex.leftSegment=r),null!=i?t.updateVertexIndex(i.leftVertex,i.leftVertex.index):t.updateVertexIndex(e,0),this._editGeometry.notifyChanges({operation:"undo",removedVertices:[e]}))}accumulate(){return!1}}export{r as AppendVertex};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{remove as e}from"../../../../core/arrayUtils.js";import{LineSegment as t}from"../EditGeometry.js";class r{constructor(e,t){this._editGeometry=e,this._part=t,this._createdSegment=null}apply(){let e="redo";const{_part:r}=this;if(null==this._createdSegment){e="apply";const n=r.getFirstVertex(),i=r.getLastVertex();if(r.isClosed()||r.vertices.length<2||null==n||null==i)return;if(2===r.vertices.length&&"line"===i.leftSegment?.type)return;this._createdSegment=new t(this._part,i,n)}this._createdSegment.leftVertex.rightSegment=this._createdSegment,this._createdSegment.rightVertex.leftSegment=this._createdSegment,r.segments.push(this._createdSegment),this._editGeometry.notifyChanges({operation:e})}undo(){const{_part:t,_createdSegment:r,_editGeometry:n}=this;null!=r&&(e(t.segments,r),r.leftVertex.rightSegment=null,r.rightVertex.leftSegment=null,n.notifyChanges({operation:"undo"}))}accumulate(){return!1}}export{r as ClosePart};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(t,e,i,s){this._editGeometry=t,this.dx=e,this.dy=i,this.dz=s,this._firstTime=!0}apply(){const t=this._firstTime?"apply":"redo";this._firstTime=!1,this._apply(t,this.dx,this.dy,this.dz)}undo(){this._apply("undo",-this.dx,-this.dy,-this.dz)}accumulate(e){const i=this._editGeometry.geometry;return e instanceof t&&e._editGeometry.geometry===i&&(this._apply("apply",e.dx,e.dy,e.dz),this.dx+=e.dx,this.dy+=e.dy,this.dz+=e.dz,!0)}_apply(t,e,i,s){const o=this._editGeometry.geometry;o.offset(e,i,s);const d=this._editGeometry.components[0].getFirstVertex();if(!d)return;const r=this._editGeometry.coordinateHelper;d.pos=r.pointToVector(o.origin),this._editGeometry.notifyChanges({operation:t,updatedVertices:[d]})}}export{t as MoveMesh};
5
+ class t{constructor(t,e,i,s){this._editGeometry=t,this.dx=e,this.dy=i,this.dz=s,this._firstTime=!0}apply(){const t=this._firstTime?"apply":"redo";this._firstTime=!1,this._apply(t,this.dx,this.dy,this.dz)}undo(){this._apply("undo",-this.dx,-this.dy,-this.dz)}accumulate(e){const i=this._editGeometry.geometry;return e instanceof t&&e._editGeometry.geometry===i&&(this._apply("apply",e.dx,e.dy,e.dz),this.dx+=e.dx,this.dy+=e.dy,this.dz+=e.dz,!0)}_apply(t,e,i,s){const o=this._editGeometry.geometry;o.offset(e,i,s);const d=this._editGeometry.parts[0].getFirstVertex();if(!d)return;const r=this._editGeometry.coordinateHelper;d.pos=r.pointToVector(o.origin),this._editGeometry.notifyChanges({operation:t,updatedVertices:[d]})}}export{t as MoveMesh};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(t,s,d,h){this._helper=t,this.dx=s,this.dy=d,this.dz=h}_move(t,s,d,h){this._helper.addDelta(t.pos,s,d,h)}apply(t){this._move(t,this.dx,this.dy,this.dz)}undo(t){this._move(t,-this.dx,-this.dy,-this.dz)}canAccumulate(s){return s instanceof t}accumulate(t,s){this._move(t,s.dx,s.dy,s.dz)}accumulateParams(t){this.dx+=t.dx,this.dy+=t.dy,this.dz+=t.dz}}export{t as MoveVertex};
5
+ class t{constructor(t,e,i,c){this._helper=t,this.dx=e,this.dy=i,this.dz=c}_move(t,i,c,s){this._helper.addDelta(t.pos,i,c,s),e(t.leftSegment,i,c)}apply(t){this._move(t,this.dx,this.dy,this.dz)}undo(t){this._move(t,-this.dx,-this.dy,-this.dz)}canAccumulate(e){return e instanceof t}accumulate(t,e){this._move(t,e.dx,e.dy,e.dz)}accumulateParams(t){this.dx+=t.dx,this.dy+=t.dy,this.dz+=t.dz}}function e(t,e,i){switch(t?.type){case null:case void 0:case"line":return;case"bezier":{const{controlPoint1:c,controlPoint2:s}=t.curveDefinition;c[0]+=e,c[1]+=i,s[0]+=e,s[1]+=i;break}case"circular-arc":{const{interiorPoint:c}=t.curveDefinition;c[0]+=e,c[1]+=i;break}case"elliptic-arc-4":case"elliptic-arc-7":{const{centerPoint:c}=t.curveDefinition;c[0]+=e,c[1]+=i}}}export{t as MoveVertex};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t,deg2rad as i}from"../../../../core/mathUtils.js";import{subtract as e,normalize as s,dot as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{E as h,i as o,h as a,n as _,g as c,e as l,u as p,f as g,m as d,G as m,c as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as D,fromPositionAndNormal as x,signedDistance as b,getNormal as V,copy as N,intersectLine as P,isPointInside as y,projectPoint as Z}from"../../../../geometry/support/plane.js";import{angle as X,projectPointSignedLength as Y}from"../../../../geometry/support/vector.js";import{intersectLineAndRay as E}from"../../../support/geometry2dUtils.js";class T{get plane(){return this._plane}get requiresSplitEdgeLeft(){return!this._left.isOriginalDirection}get requiresSplitEdgeRight(){return!this._right.isOriginalDirection}get edgeDirection(){return this._edgeDirection}constructor(t,i,e,s=0,n=0){this._helper=t,this._planeType=i,this._edge=e,this.distance=s,this._plane=D(),this._offsetPlane=D(),this._minDistance=-1/0,this._maxDistance=1/0,this._selectedArrow=1,0===n&&this._initialize()}_initialize(){this._initializeNeighbors(),this._initializePlane(),this._initializeDistanceConstraints()}_initializeNeighbors(){const t=this._toXYZ(this._edge.leftVertex.pos),i=this._toXYZ(this._edge.leftVertex.leftEdge?.leftVertex?.pos),e=this._toXYZ(this._edge.rightVertex.pos),s=this._toXYZ(this._edge.rightVertex.rightEdge?.rightVertex?.pos);this._edgeDirection=h(f(),t,e),i?(this._left=this._computeNeighbor(t,i,this._edgeDirection),this._right=this._computeNeighbor(e,s,this._edgeDirection,this._left)):(this._right=this._computeNeighbor(e,s,this._edgeDirection),this._left=this._computeNeighbor(t,i,this._edgeDirection,this._right))}_toXYZ(t){return null!=t?this._helper.toXYZ(t):null}_pointToXYZ(t){return this._toXYZ(this._helper.pointToVector(t))}_computeNeighbor(t,i,e,s){const n=f();if(i){h(n,t,i);const s=!this._passesBisectingAngleThreshold(n,e);return{start:t,end:i,direction:s?this._bisectVectorsPerpendicular(e,n):n,isOriginalDirection:!s}}return this._helper.hasZ()?s&&(a(n,e,s.direction),a(n,n,e),_(n,n),Math.sign(n[1])!==Math.sign(e[0])&&c(n,n,-1)):o(n,-e[1],e[0],0),{start:t,end:i,direction:n,isOriginalDirection:!0}}_passesBisectingAngleThreshold(t,i){const e=Math.abs(X(i,t));return e>=M&&e<=Math.PI-M}_bisectVectorsPerpendicular(t,i){const e=l(t,i)<0?t:p(f(),t),s=Math.abs(l(e,i));if(!(s<z||s>1-z))return this._bisectDirection(e,i);const n=a(f(),e,[0,0,1]);return _(n,n)}_bisectDirection(t,i){const e=g(f(),t,i);return _(e,e)}_initializePlane(){const t=this._computeNormalDirection(this._left),i=this._computeNormalDirection(this._right);l(t,i)<0&&p(i,i),x(this._left.start,this._bisectDirection(t,i),this._plane)}_computeNormalDirection(t){const i=a(f(),t.direction,this._edgeDirection);_(i,i);const e=a(f(),this._edgeDirection,i);return 1===this._planeType&&(e[2]=0),_(e,e)}_initializeDistanceConstraints(){null==this._left.end||this.requiresSplitEdgeLeft||this._updateDistanceConstraint(b(this._plane,this._left.end)),null==this._right.end||this.requiresSplitEdgeRight||this._updateDistanceConstraint(b(this._plane,this._right.end)),this._updateIntersectDistanceConstraint(this._plane)}_updateDistanceConstraint(t){t<=0&&(this._minDistance=Math.max(this._minDistance,t)),t>=0&&(this._maxDistance=Math.min(this._maxDistance,t))}_updateIntersectDistanceConstraint(t){const i=V(t),h=this._edgeDirection,o=g(f(),this._left.start,this._left.direction),a=g(f(),this._right.start,this._right.direction),_=this._pointInBasis2D(r(),i,h,this._left.start),l=this._pointInBasis2D(r(),i,h,o),p=this._pointInBasis2D(r(),i,h,this._right.start),d=this._pointInBasis2D(r(),i,h,a),[m]=E({start:l,end:_,type:1},{start:d,end:p,type:1});if(!m)return;const u=e(r(),_,l);s(u,u);const D=e(r(),m,l),x=n(u,D),N=g(f(),o,c(f(),this._left.direction,-x)),P=b(t,N);this._updateDistanceConstraint(P)}_pointInBasis2D(t,i,e,s){return t[0]=Y(i,s),t[1]=Y(e,s),t}_offset(t,i){Number.isFinite(this._minDistance)&&(i=Math.max(this._minDistance,i)),Number.isFinite(this._maxDistance)&&(i=Math.min(this._maxDistance,i)),N(this._offsetPlane,this._plane),this._offsetPlane[3]-=i;const e=(t,i,e)=>null!=i&&P(this._offsetPlane,t,g(f(),t,i),e),s=f();(t===this._edge.leftVertex?e(this._left.start,this._left.direction,s):e(this._right.start,this._right.direction,s))&&this._helper.copy(this._helper.fromXYZ(s,void 0,this._helper.getM(t.pos)),t.pos)}selectArrowFromStartPoint(t){this._selectedArrow=y(this.plane,this._pointToXYZ(t))?1:-1}get selectedArrow(){return this._selectedArrow}signedDistanceToPoint(t){return b(this.plane,this._pointToXYZ(t))}clampedStartAndEnd(i){const e=this._helper.toXYZ(this._helper.pointToVector(i)),s=Z(this._plane,e,f()),n=b(this._plane,e),r=t(n,this._minDistance,this._maxDistance);return d(e,s,e,r/n),{start:s,end:e}}apply(t){this._offset(t,this.distance)}undo(t){this._offset(t,0)}canAccumulate(t){return t instanceof T&&this._edge.leftVertex.index===t._edge.leftVertex.index&&this._edge.rightVertex.index===t._edge.rightVertex.index&&this._edge.component===t._edge.component&&this._maybeEqualsVec3(this._left.direction,t._left.direction)&&this._maybeEqualsVec3(this._right.direction,t._right.direction)&&m(V(this._plane),V(t._plane))}accumulate(t,i){const e=this._plane[3]-i._plane[3]+i.distance;this._offset(t,e)}accumulateParams(t){const i=t.distance-t._plane[3];this.distance=i+this._plane[3]}clone(){const t=new T(this._helper,this._planeType,this._edge,this.distance,1);return N(t._plane,this._plane),N(t._offsetPlane,this._offsetPlane),t._maxDistance=this._maxDistance,t._minDistance=this._minDistance,t._left=this._cloneNeighbor(this._left),t._right=this._cloneNeighbor(this._right),t._edgeDirection=u(f(),this._edgeDirection),t}_maybeEqualsVec3(t,i){return null==t&&null==i||null!=t&&null!=i&&m(t,i)}_cloneNeighbor({start:t,end:i,direction:e,isOriginalDirection:s}){return{start:u(f(),t),end:null!=i?u(f(),i):null,direction:u(f(),e),isOriginalDirection:s}}}const M=i(15),z=.001;export{T as OffsetEdgeVertex};
5
+ import{clamp as t,deg2rad as i}from"../../../../core/mathUtils.js";import{subtract as e,normalize as s,dot as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{E as h,i as a,h as o,n as _,g as c,e as l,u as p,f as g,m as d,G as m,c as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as D,fromPositionAndNormal as x,signedDistance as b,getNormal as V,copy as N,intersectLine as P,isPointInside as y,projectPoint as Z}from"../../../../geometry/support/plane.js";import{angle as X,projectPointSignedLength as Y}from"../../../../geometry/support/vector.js";import{intersectLineAndRay as T}from"../../../support/geometry2dUtils.js";class M{get plane(){return this._plane}get requiresSplitEdgeLeft(){return!this._left.isOriginalDirection}get requiresSplitEdgeRight(){return!this._right.isOriginalDirection}get edgeDirection(){return this._edgeDirection}constructor(t,i,e,s=0,n=0){this._helper=t,this._planeType=i,this._edge=e,this.distance=s,this._plane=D(),this._offsetPlane=D(),this._minDistance=-1/0,this._maxDistance=1/0,this._selectedArrow=1,0===n&&this._initialize()}_initialize(){this._initializeNeighbors(),this._initializePlane(),this._initializeDistanceConstraints()}_initializeNeighbors(){const t=this._toXYZ(this._edge.leftVertex.pos),i=this._toXYZ(this._edge.leftVertex.leftSegment?.leftVertex?.pos),e=this._toXYZ(this._edge.rightVertex.pos),s=this._toXYZ(this._edge.rightVertex.rightSegment?.rightVertex?.pos);this._edgeDirection=h(f(),t,e),i?(this._left=this._computeNeighbor(t,i,this._edgeDirection),this._right=this._computeNeighbor(e,s,this._edgeDirection,this._left)):(this._right=this._computeNeighbor(e,s,this._edgeDirection),this._left=this._computeNeighbor(t,i,this._edgeDirection,this._right))}_toXYZ(t){return null!=t?this._helper.toXYZ(t):null}_pointToXYZ(t){return this._toXYZ(this._helper.pointToVector(t))}_computeNeighbor(t,i,e,s){const n=f();if(i){h(n,t,i);const s=!this._passesBisectingAngleThreshold(n,e);return{start:t,end:i,direction:s?this._bisectVectorsPerpendicular(e,n):n,isOriginalDirection:!s}}return this._helper.hasZ()?s&&(o(n,e,s.direction),o(n,n,e),_(n,n),Math.sign(n[1])!==Math.sign(e[0])&&c(n,n,-1)):a(n,-e[1],e[0],0),{start:t,end:i,direction:n,isOriginalDirection:!0}}_passesBisectingAngleThreshold(t,i){const e=Math.abs(X(i,t));return e>=z&&e<=Math.PI-z}_bisectVectorsPerpendicular(t,i){const e=l(t,i)<0?t:p(f(),t),s=Math.abs(l(e,i));if(!(s<A||s>1-A))return this._bisectDirection(e,i);const n=o(f(),e,[0,0,1]);return _(n,n)}_bisectDirection(t,i){const e=g(f(),t,i);return _(e,e)}_initializePlane(){const t=this._computeNormalDirection(this._left),i=this._computeNormalDirection(this._right);l(t,i)<0&&p(i,i),x(this._left.start,this._bisectDirection(t,i),this._plane)}_computeNormalDirection(t){const i=o(f(),t.direction,this._edgeDirection);_(i,i);const e=o(f(),this._edgeDirection,i);return 1===this._planeType&&(e[2]=0),_(e,e)}_initializeDistanceConstraints(){null==this._left.end||this.requiresSplitEdgeLeft||this._updateDistanceConstraint(b(this._plane,this._left.end)),null==this._right.end||this.requiresSplitEdgeRight||this._updateDistanceConstraint(b(this._plane,this._right.end)),this._updateIntersectDistanceConstraint(this._plane)}_updateDistanceConstraint(t){t<=0&&(this._minDistance=Math.max(this._minDistance,t)),t>=0&&(this._maxDistance=Math.min(this._maxDistance,t))}_updateIntersectDistanceConstraint(t){const i=V(t),h=this._edgeDirection,a=g(f(),this._left.start,this._left.direction),o=g(f(),this._right.start,this._right.direction),_=this._pointInBasis2D(r(),i,h,this._left.start),l=this._pointInBasis2D(r(),i,h,a),p=this._pointInBasis2D(r(),i,h,this._right.start),d=this._pointInBasis2D(r(),i,h,o),[m]=T({start:l,end:_,type:1},{start:d,end:p,type:1});if(!m)return;const u=e(r(),_,l);s(u,u);const D=e(r(),m,l),x=n(u,D),N=g(f(),a,c(f(),this._left.direction,-x)),P=b(t,N);this._updateDistanceConstraint(P)}_pointInBasis2D(t,i,e,s){return t[0]=Y(i,s),t[1]=Y(e,s),t}_offset(t,i){Number.isFinite(this._minDistance)&&(i=Math.max(this._minDistance,i)),Number.isFinite(this._maxDistance)&&(i=Math.min(this._maxDistance,i)),N(this._offsetPlane,this._plane),this._offsetPlane[3]-=i;const e=(t,i,e)=>null!=i&&P(this._offsetPlane,t,g(f(),t,i),e),s=f();(t===this._edge.leftVertex?e(this._left.start,this._left.direction,s):e(this._right.start,this._right.direction,s))&&this._helper.copy(this._helper.fromXYZ(s,void 0,this._helper.getM(t.pos)),t.pos)}selectArrowFromStartPoint(t){this._selectedArrow=y(this.plane,this._pointToXYZ(t))?1:-1}get selectedArrow(){return this._selectedArrow}signedDistanceToPoint(t){return b(this.plane,this._pointToXYZ(t))}clampedStartAndEnd(i){const e=this._helper.toXYZ(this._helper.pointToVector(i)),s=Z(this._plane,e,f()),n=b(this._plane,e),r=t(n,this._minDistance,this._maxDistance);return d(e,s,e,r/n),{start:s,end:e}}apply(t){this._offset(t,this.distance)}undo(t){this._offset(t,0)}canAccumulate(t){return t instanceof M&&this._edge.leftVertex.index===t._edge.leftVertex.index&&this._edge.rightVertex.index===t._edge.rightVertex.index&&this._edge.part===t._edge.part&&this._maybeEqualsVec3(this._left.direction,t._left.direction)&&this._maybeEqualsVec3(this._right.direction,t._right.direction)&&m(V(this._plane),V(t._plane))}accumulate(t,i){const e=this._plane[3]-i._plane[3]+i.distance;this._offset(t,e)}accumulateParams(t){const i=t.distance-t._plane[3];this.distance=i+this._plane[3]}clone(){const t=new M(this._helper,this._planeType,this._edge,this.distance,1);return N(t._plane,this._plane),N(t._offsetPlane,this._offsetPlane),t._maxDistance=this._maxDistance,t._minDistance=this._minDistance,t._left=this._cloneNeighbor(this._left),t._right=this._cloneNeighbor(this._right),t._edgeDirection=u(f(),this._edgeDirection),t}_maybeEqualsVec3(t,i){return null==t&&null==i||null!=t&&null!=i&&m(t,i)}_cloneNeighbor({start:t,end:i,direction:e,isOriginalDirection:s}){return{start:u(f(),t),end:null!=i?u(f(),i):null,direction:u(f(),e),isOriginalDirection:s}}}const z=i(15),A=.001;export{M as OffsetEdgeVertex};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{Edge as e}from"../EditGeometry.js";class t{constructor(e,t,r=0){this._editGeometry=e,this._vertices=t,this._minNumberOfVertices=r,this.removedVertices=null}apply(){let e="redo";if(null==this.removedVertices){const t=this.removedVertices=[];this._vertices.forEach(e=>{const r=this._removeVertex(e);null!=r&&t.push(r)}),e="apply"}else this.removedVertices.forEach(e=>{this._removeVertex(e.removedVertex)});this._editGeometry.notifyChanges({operation:e,removedVertices:this._vertices})}undo(){this.removedVertices?.forEach(e=>{this._undoRemoveVertex(e)}),this._editGeometry.notifyChanges({operation:"undo",addedVertices:this._vertices})}accumulate(){return!1}_removeVertex(t){const r=t.component;if(r.vertices.length<=this._minNumberOfVertices)return null;const i={removedVertex:t,createdEdge:null},s=t.leftEdge,d=t.rightEdge;return r.vertices.splice(r.vertices.indexOf(t),1),s&&(r.edges.splice(r.edges.indexOf(s),1),s.leftVertex.rightEdge=null),d&&(r.edges.splice(r.edges.indexOf(d),1),d.rightVertex.leftEdge=null),0===t.index&&d&&this._vertices.length>0&&r.swapVertices(r.vertices.indexOf(d.rightVertex),0),s&&d&&(i.createdEdge=new e(r,s.leftVertex,d.rightVertex),r.edges.push(i.createdEdge)),d&&r.updateVertexIndex(d.rightVertex,d.rightVertex.index-1),i}_undoRemoveVertex(e){const t=e.removedVertex,r=e.removedVertex.component,i=t.leftEdge,s=t.rightEdge;e.createdEdge&&r.edges.splice(r.edges.indexOf(e.createdEdge),1),r.vertices.push(t),i&&(r.edges.push(i),i.leftVertex.rightEdge=i),s&&(r.edges.push(s),s.rightVertex.leftEdge=s),r.updateVertexIndex(t,t.index)}}export{t as RemoveVertices};
5
+ import{LineSegment as e}from"../EditGeometry.js";class t{constructor(e,t,r=0){this._editGeometry=e,this._vertices=t,this._minNumberOfVertices=r,this.removedVertices=null}apply(){let e="redo";if(null==this.removedVertices){const t=this.removedVertices=[];this._vertices.forEach(e=>{const r=this._removeVertex(e);null!=r&&t.push(r)}),e="apply"}else this.removedVertices.forEach(e=>{this._removeVertex(e.removedVertex)});this._editGeometry.notifyChanges({operation:e,removedVertices:this._vertices})}undo(){this.removedVertices?.forEach(e=>{this._undoRemoveVertex(e)}),this._editGeometry.notifyChanges({operation:"undo",addedVertices:this._vertices})}accumulate(){return!1}_removeVertex(t){const r=t.part;if(r.vertices.length<=this._minNumberOfVertices)return null;const s={removedVertex:t,createdSegment:null},i=t.leftSegment,n=t.rightSegment;return r.vertices.splice(r.vertices.indexOf(t),1),i&&(r.segments.splice(r.segments.indexOf(i),1),i.leftVertex.rightSegment=null),n&&(r.segments.splice(r.segments.indexOf(n),1),n.rightVertex.leftSegment=null),0===t.index&&n&&this._vertices.length>0&&r.swapVertices(r.vertices.indexOf(n.rightVertex),0),i&&n&&(s.createdSegment=new e(r,i.leftVertex,n.rightVertex),r.segments.push(s.createdSegment)),n&&r.updateVertexIndex(n.rightVertex,n.rightVertex.index-1),s}_undoRemoveVertex(e){const t=e.removedVertex,r=e.removedVertex.part,s=t.leftSegment,i=t.rightSegment;e.createdSegment&&r.segments.splice(r.segments.indexOf(e.createdSegment),1),r.vertices.push(t),s&&(r.segments.push(s),s.leftVertex.rightSegment=s),i&&(r.segments.push(i),i.rightVertex.leftSegment=i),r.updateVertexIndex(t,t.index)}}export{t as RemoveVertices};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{equals as t}from"../../../../core/arrayUtils.js";import{rotate as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";class i{constructor(t,a,i=0){this.origin=t,this.angle=a,this._accumulationType=i}_rotate(t,i){a(t.pos,t.pos,this.origin,i)}apply(t){this._rotate(t,this.angle)}undo(t){this._rotate(t,-this.angle)}canAccumulate(a){return a instanceof i&&t(this.origin,a.origin)}accumulate(t,a){const i=1===a._accumulationType;this._rotate(t,i?a.angle-this.angle:a.angle)}accumulateParams(t){const a=1===t._accumulationType;this.angle=a?t.angle:this.angle+t.angle}}export{i as RotateVertex};
5
+ import{equals as t}from"../../../../core/arrayUtils.js";import{rotate as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{rotateArc as e}from"./curveOperationUtils.js";class o{constructor(t,i,e=0){this.origin=t,this.angle=i,this._accumulationType=e}_rotate(t,e){i(t.pos,t.pos,this.origin,e),n(t.leftSegment,this.origin,e)}apply(t){this._rotate(t,this.angle)}undo(t){this._rotate(t,-this.angle)}canAccumulate(i){return i instanceof o&&t(this.origin,i.origin)}accumulate(t,i){const e=1===i._accumulationType;this._rotate(t,e?i.angle-this.angle:i.angle)}accumulateParams(t){const i=1===t._accumulationType;this.angle=i?t.angle:this.angle+t.angle}}function n(t,o,n){switch(t?.type){case null:case void 0:case"line":return;case"bezier":{const{controlPoint1:e,controlPoint2:r}=t.curveDefinition;return i(e,e,o,n),void i(r,r,o,n)}case"circular-arc":{const{interiorPoint:e}=t.curveDefinition;return void i(e,e,o,n)}case"elliptic-arc-4":case"elliptic-arc-7":{const r=t.leftVertex.pos,a=i([0,0],[r[0],r[1]],o,-n),c=t.toCurveOrCoordinate(),[,s,l,u,p,g,m]=e(a,c,o,n).a;if("elliptic-arc-4"===t.type){const i=t.curveDefinition;i.centerPoint=[...s],i.sweep=l,i.orientation=u}else{const i=t.curveDefinition;i.centerPoint=[...s],i.sweep=l,i.orientation=u,i.rotation=p,i.semiMajorAxisLength=g,i.minorMajorAxisRatio=m}}}}export{o as RotateVertex};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{equals as t}from"../../../../core/arrayUtils.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{projectAndScale as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";class s{constructor(t,a,s,c,o=0){this.origin=t,this.axis1=a,this.factor1=s,this.factor2=c,this._accumulationType=o,this.axis2=i(a[1],-a[0])}_scale(t,i,s){a(t.pos,t.pos,this.origin,this.axis1,i),a(t.pos,t.pos,this.origin,this.axis2,s)}apply(t){this._scale(t,this.factor1,this.factor2)}undo(t){this._scale(t,1/this.factor1,1/this.factor2)}canAccumulate(i){return i instanceof s&&t(this.origin,i.origin)&&t(this.axis1,i.axis1)}accumulate(t,i){1===i._accumulationType?this._scale(t,i.factor1/this.factor1,i.factor2/this.factor2):this._scale(t,i.factor1,i.factor2)}accumulateParams(t){const i=1===t._accumulationType;this.factor1=i?t.factor1:this.factor1*t.factor1,this.factor2=i?t.factor2:this.factor2*t.factor2}}export{s as ScaleVertex};
5
+ import{equals as t}from"../../../../core/arrayUtils.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{projectAndScale as r,transformMat3 as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as a,create as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{invert as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{EllipticArc7Segment as c}from"../EditGeometry.js";import{getScaleTransform as n,scaleArc as f}from"./curveOperationUtils.js";class l{constructor(t,i,r,o,e=0){this.origin=t,this.axis1=i,this.factor1=r,this.factor2=o,this._accumulationType=e,this.axis2=a(i[1],-i[0])}_scale({pos:t,leftSegment:i},o,a){const e=i?.toCurveOrCoordinate(),{origin:s,axis1:c,axis2:n}=this;r(t,t,s,c,o),r(t,t,s,n,a),m(i,s,c,n,o,a,e)}apply(t){this._scale(t,this.factor1,this.factor2)}undo(t){this._scale(t,1/this.factor1,1/this.factor2)}canAccumulate(i){return i instanceof l&&t(this.origin,i.origin)&&t(this.axis1,i.axis1)}accumulate(t,i){1===i._accumulationType?this._scale(t,i.factor1/this.factor1,i.factor2/this.factor2):this._scale(t,i.factor1,i.factor2)}accumulateParams(t){const i=1===t._accumulationType;this.factor1=i?t.factor1:this.factor1*t.factor1,this.factor2=i?t.factor2:this.factor2*t.factor2}}function m(t,a,l,m,h,p,u){switch(t?.type){case null:case void 0:case"line":return;case"bezier":{const{controlPoint1:i,controlPoint2:o}=t.curveDefinition;r(i,i,a,l,h),r(i,i,a,m,p),r(o,o,a,l,h),r(o,o,a,m,p);break}case"circular-arc":case"elliptic-arc-4":case"elliptic-arc-7":{if(!u)return;const r=t.leftVertex.pos,x=n(a[0],a[1],l[0],l[1],m[0],m[1],h,p),g=s(i(),x),j=g?o(e(),[r[0],r[1]],g):r,[,y,_,v,b,d,A]=f(u,[j[0],j[1]],t,a,l,m,h,p).a;if("elliptic-arc-7"===t.type){const i=t.curveDefinition;i.centerPoint=y,i.sweep=_,i.orientation=v,i.rotation=b,i.semiMajorAxisLength=d,i.minorMajorAxisRatio=A}else{const i=new c(t.part,t.leftVertex,t.rightVertex,{centerPoint:y,sweep:_,orientation:v,rotation:b,semiMajorAxisLength:d,minorMajorAxisRatio:A});t.part.segments.splice(t.part.segments.indexOf(t),1,i)}return}}}export{l as ScaleVertex};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- class i{constructor(i,t){this._editGeometry=i,this._newPositions=t}apply(){const i=null==this._originalPositions?"apply":"redo";if(!this._originalPositions){const i=this._editGeometry.coordinateHelper;this._originalPositions=[];for(const{pos:t}of this._editGeometry.iterateVertices())this._originalPositions.push(i.clone(t))}this._apply(i,this._newPositions)}undo(){this._originalPositions&&this._apply("undo",this._originalPositions)}accumulate(t){return t instanceof i&&(this._newPositions=t._newPositions,this._apply("apply",this._newPositions),!0)}_apply(i,t){const o=this._editGeometry.coordinateHelper,s=this._editGeometry.allVertices;for(let e=0;e<s.length;e++)o.copy(t[e],s[e].pos);this._editGeometry.components.forEach(i=>i.unnormalizeVertexPositions()),this._editGeometry.notifyChanges({operation:i,updatedVertices:s})}}export{i as SetAllVertexPositions};
5
+ class i{constructor(i,t){this._editGeometry=i,this._newPositions=t}apply(){const i=null==this._originalPositions?"apply":"redo";if(!this._originalPositions){const i=this._editGeometry.coordinateHelper;this._originalPositions=[];for(const{pos:t}of this._editGeometry.iterateVertices())this._originalPositions.push(i.clone(t))}this._apply(i,this._newPositions)}undo(){this._originalPositions&&this._apply("undo",this._originalPositions)}accumulate(t){return t instanceof i&&(this._newPositions=t._newPositions,this._apply("apply",this._newPositions),!0)}_apply(i,t){const o=this._editGeometry.coordinateHelper,s=this._editGeometry.allVertices;for(let e=0;e<s.length;e++)o.copy(t[e],s[e].pos);this._editGeometry.parts.forEach(i=>i.unnormalizeVertexPositions()),this._editGeometry.notifyChanges({operation:i,updatedVertices:s})}}export{i as SetAllVertexPositions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(t,e,i){this._editGeometry=t,this._vertex=e,this._pos=i}apply(){const t=null==this._originalPosition;t&&(this._originalPosition=this._vertex.pos),this._apply(t?"apply":"redo")}undo(){this._vertex.pos=this._originalPosition,this._editGeometry.notifyChanges({operation:"undo",updatedVertices:[this._vertex]})}accumulate(e){return e instanceof t&&e._vertex===this._vertex&&(this._pos=e._pos,this._apply("apply"),!0)}_apply(t){this._vertex.pos=this._pos,this._editGeometry.components.forEach(t=>t.unnormalizeVertexPositions()),this._editGeometry.notifyChanges({operation:t,updatedVertices:[this._vertex]})}}export{t as SetVertexPosition};
5
+ import{getEndpoint as e,isEllipticArc7 as t,isEllipticArc4 as i,isCircularArc as r,isBezierCurve as o,isCoordinate as s}from"../../../../geometry/support/curves/curveUtils.js";import{createConnectingSegment as n}from"../EditGeometry.js";class a{constructor(e,t,i){this._editGeometry=e,this._vertex=t,this._pos=i}apply(){const e=null==this._originalPosition;e&&(this._originalPosition=this._vertex.leftSegment?.toCurveOrCoordinate()??this._vertex.pos),this._apply(e?"apply":"redo")}undo(){const t=this._vertex.leftSegment;t&&this._originalPosition&&this._replaceEdge(t,this._vertex,this._originalPosition),this._vertex.pos=this._editGeometry.coordinateHelper.arrayToVector(e(this._originalPosition)),this._editGeometry.notifyChanges({operation:"undo",updatedVertices:[this._vertex]})}accumulate(e){return e instanceof a&&e._vertex===this._vertex&&(this._pos=e._pos,this._apply("apply"),!0)}_apply(n){this._vertex.pos=this._editGeometry.coordinateHelper.arrayToVector(e(this._pos));const a=this._pos,c=this._vertex.leftSegment;switch(c?.type){case void 0:break;case"line":s(a)||this._replaceEdge(c,this._vertex,a);break;case"bezier":o(a)?(c.curveDefinition.controlPoint1=a.b[1],c.curveDefinition.controlPoint2=a.b[2]):this._replaceEdge(c,this._vertex,a);break;case"circular-arc":r(a)?c.curveDefinition.interiorPoint=a.c[1]:this._replaceEdge(c,this._vertex,a);break;case"elliptic-arc-4":i(a)?(c.curveDefinition.centerPoint=a.a[1],c.curveDefinition.sweep=a.a[2],c.curveDefinition.orientation=a.a[3]):this._replaceEdge(c,this._vertex,a);break;case"elliptic-arc-7":t(a)?(c.curveDefinition.centerPoint=a.a[1],c.curveDefinition.sweep=a.a[2],c.curveDefinition.orientation=a.a[3],c.curveDefinition.rotation=a.a[4],c.curveDefinition.semiMajorAxisLength=a.a[5],c.curveDefinition.minorMajorAxisRatio=a.a[6]):this._replaceEdge(c,this._vertex,a)}this._editGeometry.parts.forEach(e=>e.unnormalizeVertexPositions()),this._editGeometry.notifyChanges({operation:n,updatedVertices:[this._vertex]})}_replaceEdge(e,t,i){const r=this._vertex.part,o=e?r.segments.indexOf(e):-1;if(o>-1&&e.leftVertex){const s=n(r,e.leftVertex,t,i);this._vertex.part.segments.splice(o,1,s)}}}export{a as SetVertexPosition};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{splitBezierCurve as e}from"../../../../geometry/support/curves/bezierCurveUtils.js";import{deriveCircleFromCircularArc as t,splitCircularArc as r}from"../../../../geometry/support/curves/circularArcUtils.js";import{getEndpoint as s}from"../../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as i,splitEllipticArc4 as c}from"../../../../geometry/support/curves/ellipticArc4Utils.js";import{deriveEllipse as o,splitEllipticArc7 as d}from"../../../../geometry/support/curves/ellipticArc7Utils.js";import{Vertex as a,createConnectingSegment as h}from"../EditGeometry.js";class n{constructor(e,t,r){this._editGeometry=e,this._segment=t,this._t=r,this.createdVertex=null,this._createdLeftEdge=null,this._createdRightEdge=null}apply(){let n="redo";const g=this._editGeometry.coordinateHelper,l=this._segment,p=l.part,u=l.leftVertex,m=l.rightVertex;p.segments.splice(p.segments.indexOf(l),1);const f=[];switch(null==this.createdVertex&&(n="apply",this.createdVertex=new a(p)),l.type){case"line":f.push(g.lerp(u.pos,m.pos,this._t,g.createVector()));break;case"bezier":{const t=l.toCurveOrCoordinate();f.push(...e(u.pos,t,this._t));break}case"circular-arc":{const e=l.toCurveOrCoordinate(),s=t(u.pos,e);f.push(...r(s,e,this._t));break}case"elliptic-arc-4":{const e=l.toCurveOrCoordinate(),t=i(u.pos,e);f.push(...c(t,e,this._t));break}case"elliptic-arc-7":{const e=l.toCurveOrCoordinate(),t=o(u.pos,e);f.push(...d(t,e,this._t));break}}p.vertices.push(this.createdVertex),this.createdVertex.pos=g.arrayToVector(s(f[0])),f.length>1&&(m.pos=g.arrayToVector(s(f[1]))),null==this._createdLeftEdge&&(this._createdLeftEdge=h(p,u,this.createdVertex,f[0])),this._createdLeftEdge.leftVertex.leftSegment?p.segments.push(this._createdLeftEdge):p.segments.unshift(this._createdLeftEdge),u.rightSegment=this._createdLeftEdge,null==this._createdRightEdge&&(this._createdRightEdge=h(p,this.createdVertex,m,f.at(1)??m.pos)),p.segments.push(this._createdRightEdge),m.leftSegment=this._createdRightEdge,p.updateVertexIndex(this.createdVertex,u.index+1),this._editGeometry.notifyChanges({operation:n,addedVertices:[this.createdVertex]})}undo(){if(null==this.createdVertex||null==this._createdLeftEdge||null==this._createdRightEdge)return null;const e=this._segment,t=e.part,{leftSegment:r,rightSegment:s}=this.createdVertex,i=r?.leftVertex,c=s?.rightVertex;t.vertices.splice(t.vertices.indexOf(this.createdVertex),1),t.segments.splice(t.segments.indexOf(this._createdLeftEdge),1),t.segments.splice(t.segments.indexOf(this._createdRightEdge),1),e.leftVertex.leftSegment?t.segments.push(e):t.segments.unshift(e),i&&(i.rightSegment=e),c&&(c.leftSegment=e),i&&t.updateVertexIndex(i,i.index),this._editGeometry.notifyChanges({operation:"undo",removedVertices:[this.createdVertex]})}accumulate(){return!1}}export{n as SplitSegment};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(t,e,i){this._editGeometry=t,this._vertices=e,this.operation=i,this._undone=!1}_notifyChanges(t){this._editGeometry.components.forEach(t=>t.unnormalizeVertexPositions()),this._editGeometry.notifyChanges({operation:t,updatedVertices:this._vertices})}apply(){this._vertices.forEach(t=>this.operation.apply(t)),this._notifyChanges(this._undone?"redo":"apply")}undo(){this._vertices.forEach(t=>this.operation.undo(t)),this._undone=!0,this._notifyChanges("undo")}canAccumulate(t){if(this._undone||t._vertices.length!==this._vertices.length)return!1;for(let e=0;e<t._vertices.length;++e)if(t._vertices[e]!==this._vertices[e])return!1;return this.operation.canAccumulate(t.operation)}accumulate(e){return!!(e instanceof t&&this.canAccumulate(e))&&(this._vertices.forEach(t=>this.operation.accumulate(t,e.operation)),this.operation.accumulateParams(e.operation),this._notifyChanges("apply"),!0)}}export{t as UpdateVertices};
5
+ class t{constructor(t,e,i){this._editGeometry=t,this._vertices=e,this.operation=i,this._undone=!1}_notifyChanges(t){this._editGeometry.parts.forEach(t=>t.unnormalizeVertexPositions()),this._editGeometry.notifyChanges({operation:t,updatedVertices:this._vertices})}apply(){this._vertices.forEach(t=>this.operation.apply(t)),this._notifyChanges(this._undone?"redo":"apply")}undo(){this._vertices.forEach(t=>this.operation.undo(t)),this._undone=!0,this._notifyChanges("undo")}canAccumulate(t){if(this._undone||t._vertices.length!==this._vertices.length)return!1;for(let e=0;e<t._vertices.length;++e)if(t._vertices[e]!==this._vertices[e])return!1;return this.operation.canAccumulate(t.operation)}accumulate(e){return!!(e instanceof t&&this.canAccumulate(e))&&(this._vertices.forEach(t=>this.operation.accumulate(t,e.operation)),this.operation.accumulateParams(e.operation),this._notifyChanges("apply"),!0)}}export{t as UpdateVertices};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{fromValues as t,create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{mul as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{deriveCircleFromCircularArc as s}from"../../../../geometry/support/curves/circularArcUtils.js";import{isCircularArc as c}from"../../../../geometry/support/curves/curveUtils.js";import{transformEllipticArc as e}from"../../../../geometry/support/curves/ellipticArc7Utils.js";function a(t,r){const[o]=r.c,c=s(t,r);return{a:[o,[c.cx,c.cy],Math.abs(c.thetaEnd-c.thetaStart)>Math.PI?0:1,1,0,c.radius,1]}}function i(r,o,s,i){const m=c(o)?a(r,o):o,[n,u,p,f,h,l,y]=m.a,M=h??0,g=l??Math.hypot(n[0]-u[0],n[1]-u[1]),j=y??1,x=Math.cos(i),v=Math.sin(i),[b,U]=s,d=t(x,v,0,-v,x,0,b-x*b+v*U,U-v*b-x*U,1);return e(r,{a:[n,u,p,f,M,g,j]},d)}function m(t,r,o,s,i,m,u,p){const f=r??o.leftVertex.pos,h=c(t)?a(f,t):t,[l,y,M,g,j,x,v]=h.a,b=j??0,U=x??Math.hypot(l[0]-y[0],l[1]-y[1]),d=v??1,A=n(s[0],s[1],i[0],i[1],m[0],m[1],u,p);return e(f,{a:[l,y,M,g,b,U,d]},A)}function n(s,c,e,a,i,m,n,u){const p=t(1,0,0,0,1,0,-s,-c,1),f=n-1,h=t(e*e*f+1,a*e*f,0,e*a*f,a*a*f+1,0,0,0,1),l=u-1,y=t(i*i*l+1,m*i*l,0,i*m*l,m*m*l+1,0,0,0,1),M=t(1,0,0,0,1,0,s,c,1),g=r();return o(g,h,p),o(g,y,g),o(g,M,g),g}export{n as getScaleTransform,i as rotateArc,m as scaleArc,a as toEllipticArc7};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- export{AppendVertex}from"./operations/AppendVertex.js";export{UpdateVertices}from"./operations/UpdateVertices.js";export{RemoveVertices}from"./operations/RemoveVertices.js";export{SplitEdge}from"./operations/SplitEdge.js";export{SetVertexPosition}from"./operations/SetVertexPosition.js";export{CloseComponent}from"./operations/CloseComponent.js";
5
+ export{AppendVertex}from"./operations/AppendVertex.js";export{UpdateVertices}from"./operations/UpdateVertices.js";export{RemoveVertices}from"./operations/RemoveVertices.js";export{SplitSegment}from"./operations/SplitSegment.js";export{SetVertexPosition}from"./operations/SetVertexPosition.js";export{ClosePart}from"./operations/ClosePart.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.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as r}from"../../../core/arrayUtils.js";import{destroyHandle as a}from"../../../core/handleUtils.js";import"../../../core/has.js";import{mapCollectionAsync as n}from"../../../core/mapCollectionUtils.js";import{allSettledValues as s,throwIfAborted as o}from"../../../core/promiseUtils.js";import{watch as i,sync as c}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as u,getMetersPerVerticalUnitForSR as l}from"../../../core/unitUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{squaredDistance as m}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{c as g,s as h}from"../../../chunks/vec32.js";import{create as S}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as f}from"../../../core/libs/gl-matrix-2/math/common.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import{absoluteHeightElevationInfo as _}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as v}from"../sketch/constraints.js";import{fromAnyMapPoint as w,asVec2 as j,markAsTarget as F}from"../sketch/normalizedPoint.js";import{FeatureSnappingSourceInfo as b}from"./FeatureSnappingSourceInfo.js";import{sortCandidatesInPlace as x,screenDistance as C}from"./snappingUtils.js";import{DrapedEdgeSnappingCandidate as R}from"./candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as M}from"./candidates/EdgeSnappingCandidate.js";import{FeatureSnappingCandidate as L}from"./candidates/FeatureSnappingCandidate.js";import{RightAngleSnappingCandidate as I}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as E}from"../support/viewUtils.js";let G=class extends t{get updating(){return this._snappingSources.some(e=>null==e?.valid||!0===e.valid&&!0===e.snappingSource?.updating)||this._updatingHandles.updating}constructor(e){super(e),this.options=null,this._domain=1,this._updatingHandles=new y,this._sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null},notes:{module:null,loader:null},scene:{module:null,loader:null}}}initialize(){const e=n(()=>this.options?._effectiveFeatureSources,(e,t)=>this._createSourceInfo(e,t));this._snappingSources=e,this.addHandles([a(e),i(()=>({rulesEnabled:!!this.options?.attributeRulesEnabled,sources:this._snappingSources.filter(r)}),({rulesEnabled:e,sources:t})=>{for(const r of t)r.attributeRulesEnabled=e},c)])}destroy(){this._set("options",null),this._updatingHandles.destroy()}async fetchCandidates(e,t,r,a){if(!(t&this._domain&&null!=this.options&&this.options.effectiveFeatureEnabled))return[];const n=[],i=this._computeScreenSizeDistanceParameters(e,r);for(const s of this._snappingSources){if(!s?.valid||!s.snappingSource?.layerSource?.enabled||s.layerView?.suspended)continue;const t=s.getFetchCandidatesParameters(e,r,i);for(const e of t)n.push(s.snappingSource.fetchCandidates(e,a).then(e=>e.filter(e=>!this._candidateIsExcluded(s.snappingSource,e,r.excludeFeature))))}const c=(await s(n)).flat();return this._addRightAngleCandidates(c,e,i,r),o(a),x(e,c),c}_addRightAngleCandidates(e,t,r,a){const n=null!=a.vertexHandle?a.vertexHandle.rightEdge?.rightVertex?.pos:null!=a.editGeometryOperations&&"polygon"===a.editGeometryOperations.data.type?a.editGeometryOperations.data.components[0]?.getFirstVertex()?.pos:null,s=null!=a.vertexHandle?a.vertexHandle.leftEdge?.leftVertex?.pos:null!=a.editGeometryOperations?a.editGeometryOperations.data.components[0]?.getLastVertex()?.pos:null,{view:o}=this,i=w(n,o,a),c=w(s,o,a),u=e.length;for(let l=0;l<u;l++)this._addRightAngleCandidate(e[l],c,t,r,e),this._addRightAngleCandidate(e[l],i,t,r,e)}_addRightAngleCandidate(e,t,r,a,n){if(null==t||!H(e))return;const s=e.constraint.closestTo(t),o=(s[0]-r[0])/a.x,i=(s[1]-r[1])/a.y,{start:c,end:u}=e.constraint;if(o*o+i*i<=1){const r=m(j(s),j(c))>m(j(s),j(u))?c:u,a=new I({targetPoint:F(s),otherVertex:t,otherVertexType:0,previousVertex:r,constraint:new v(t,s),objectId:e.objectId,isDraped:e.isDraped,domain:1});n.push(a)}}_computeScreenSizeDistanceParameters(e,t){let r=null!=this.options?this.options.distance*("touch"===t.pointer?this.options.touchSensitivityMultiplier:1):0;return null==this.view?{x:r,y:r,z:r,distance:r}:"2d"===this.view.type?(r*=this.view.resolution,{x:r,y:r,z:r,distance:r}):this._computeScreenSizeDistanceParameters3D(e,r,this.view,t)}_computeScreenSizeDistanceParameters3D(e,t,r,a){const{spatialReference:n}=a;r.renderCoordsHelper.toRenderCoords(e,n,O);const s=r.state.camera.computeScreenPixelSizeAt(O),o=s*r.renderCoordsHelper.unitInMeters,i=o/u(n),c=o/l(n),p=t*i,d=t*c,m=E(e,n,_,r),g=m?z(m,e,i,0,0,r,a):0,h=m?z(m,e,0,i,0,r,a):0,S=m?z(m,e,0,0,c,r,a):0;return{x:0===g?0:p/g,y:0===h?0:p/h,z:0===S?0:d/S,distance:s*t}}_candidateIsExcluded(e,t,r){if(null==r)return!1;const a=this._getCandidateObjectId(t);if(null==a)return!1;const n=e.layerSource.layer;return"graphics"===n.type?r.uid===a:r.sourceLayer===n&&(!(!r.attributes||!("objectIdField"in n))&&r.attributes[n.objectIdField]===a)}_getCandidateObjectId(e){return e instanceof L?e.objectId:null}async _createSourceInfo(e,t){const r=e.layer;r.loaded||(await r.load(),o(t));const{view:a}=this,n=await this._createFeatureSnappingSourceType(e);return o(t),new b(null==n?{}:{snappingSource:n,view:a,layer:r})}async _createFeatureSnappingSourceType(e){switch(e.layer.type){case"feature":case"geojson":case"csv":case"oriented-imagery":case"subtype-group":case"wfs":return this._createFeatureSnappingSourceFeatureLayer(e);case"graphics":return this._createFeatureSnappingSourceGraphicsLayer(e);case"map-notes":return this._createFeatureSnappingSourceMapNotesLayer(e);case"scene":case"building-scene":return this._createFeatureSnappingSourceSceneLayer(e)}return null}async _createFeatureSnappingSourceSceneLayer(e){const{view:t}=this;if(null==t||"3d"!==t.type)return null;return new((await this._getSourceModule("scene")).SceneLayerSnappingSource)({layerSource:e,view:t})}async _createFeatureSnappingSourceFeatureLayer(e){switch(e.layer.source?.type){case"feature-layer":case"oriented-imagery":return new((await this._getSourceModule("featureService")).FeatureServiceSnappingSource)({spatialReference:this.spatialReference,view:this.view,layerSource:e});case"memory":case"csv":case"geojson":case"wfs":if("mesh"===e.layer.geometryType)return null;return new((await this._getSourceModule("featureCollection")).FeatureCollectionSnappingSource)({layerSource:e,view:this.view})}return null}async _createFeatureSnappingSourceGraphicsLayer(e){return new((await this._getSourceModule("graphics")).GraphicsSnappingSource)({getGraphicsLayers:()=>[e.layer],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _createFeatureSnappingSourceMapNotesLayer(e){return new((await this._getSourceModule("notes")).GraphicsSnappingSource)({getGraphicsLayers:()=>e.layer.sublayers?.toArray()??[],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _getSourceModule(e){const t=this._sourceModules[e];if(null==t.loader){const t=this._loadSourceModule(e),r={module:null,loader:t};this._sourceModules[e]=r;const a=await t,n={module:a,loader:t};return this._sourceModules[e]=n,a}return null==t.module?t.loader:t.module}_loadSourceModule(e){const t=this._updatingHandles;switch(e){case"featureService":return t.addPromise(import("./featureSources/FeatureServiceSnappingSource.js"));case"featureCollection":return t.addPromise(import("./featureSources/FeatureCollectionSnappingSource.js"));case"graphics":case"notes":return t.addPromise(import("./featureSources/GraphicsSnappingSource.js"));case"scene":return t.addPromise(import("./featureSources/SceneLayerSnappingSource.js"))}}get test(){}};function H(e){return(e instanceof M||e instanceof R)&&!P(e)}function P({constraint:{start:e,end:t}}){const r=h(e,t),a=m(j(e),j(t));return r<f()||a/r<A}function z(e,t,r,a,n,s,{spatialReference:o}){const i=g(U,t);i[0]+=r,i[1]+=a,i[2]+=n;const c=E(i,o,_,s);return c?C(c,e):1/0}e([p({constructOnly:!0})],G.prototype,"spatialReference",void 0),e([p({constructOnly:!0})],G.prototype,"view",void 0),e([p()],G.prototype,"options",void 0),e([p({readOnly:!0})],G.prototype,"updating",null),e([p()],G.prototype,"_snappingSources",void 0),G=e([d("esri.views.interactive.snapping.FeatureSnappingEngine")],G);const O=S(),U=S(),A=1e-4;export{G as FeatureSnappingEngine};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as r}from"../../../core/arrayUtils.js";import{destroyHandle as a}from"../../../core/handleUtils.js";import"../../../core/has.js";import{mapCollectionAsync as n}from"../../../core/mapCollectionUtils.js";import{allSettledValues as s,throwIfAborted as i}from"../../../core/promiseUtils.js";import{watch as o,sync as c}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as u,getMetersPerVerticalUnitForSR as l}from"../../../core/unitUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{squaredDistance as m}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{c as S,s as g}from"../../../chunks/vec32.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as f}from"../../../core/libs/gl-matrix-2/math/common.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import{absoluteHeightElevationInfo as _}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as v}from"../sketch/constraints.js";import{fromAnyMapPoint as w,asVec2 as j,markAsTarget as F}from"../sketch/normalizedPoint.js";import{FeatureSnappingSourceInfo as b}from"./FeatureSnappingSourceInfo.js";import{sortCandidatesInPlace as x,screenDistance as C}from"./snappingUtils.js";import{DrapedEdgeSnappingCandidate as R}from"./candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as M}from"./candidates/EdgeSnappingCandidate.js";import{FeatureSnappingCandidate as L}from"./candidates/FeatureSnappingCandidate.js";import{RightAngleSnappingCandidate as I}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as G}from"../support/viewUtils.js";let H=class extends t{get updating(){return this._snappingSources.some(e=>null==e?.valid||!0===e.valid&&!0===e.snappingSource?.updating)||this._updatingHandles.updating}constructor(e){super(e),this.options=null,this._domain=1,this._updatingHandles=new y,this._sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null},notes:{module:null,loader:null},scene:{module:null,loader:null}}}initialize(){const e=n(()=>this.options?._effectiveFeatureSources,(e,t)=>this._createSourceInfo(e,t));this._snappingSources=e,this.addHandles([a(e),o(()=>({rulesEnabled:!!this.options?.attributeRulesEnabled,sources:this._snappingSources.filter(r)}),({rulesEnabled:e,sources:t})=>{for(const r of t)r.attributeRulesEnabled=e},c)])}destroy(){this._set("options",null),this._updatingHandles.destroy()}async fetchCandidates(e,t,r,a){if(!(t&this._domain&&null!=this.options&&this.options.effectiveFeatureEnabled))return[];const n=[],o=this._computeScreenSizeDistanceParameters(e,r);for(const s of this._snappingSources){if(!s?.valid||!s.snappingSource?.layerSource?.enabled||s.layerView?.suspended)continue;const t=s.getFetchCandidatesParameters(e,r,o);for(const e of t)n.push(s.snappingSource.fetchCandidates(e,a).then(e=>e.filter(e=>!this._candidateIsExcluded(s.snappingSource,e,r.excludeFeature))))}const c=(await s(n)).flat();return this._addRightAngleCandidates(c,e,o,r),i(a),x(e,c),c}_addRightAngleCandidates(e,t,r,a){const n=null!=a.vertexHandle?a.vertexHandle.rightSegment?.rightVertex?.pos:null!=a.editGeometryOperations&&"polygon"===a.editGeometryOperations.data.type?a.editGeometryOperations.data.parts[0]?.getFirstVertex()?.pos:null,s=null!=a.vertexHandle?a.vertexHandle.leftSegment?.leftVertex?.pos:null!=a.editGeometryOperations?a.editGeometryOperations.data.parts[0]?.getLastVertex()?.pos:null,{view:i}=this,o=w(n,i,a),c=w(s,i,a),u=e.length;for(let l=0;l<u;l++)this._addRightAngleCandidate(e[l],c,t,r,e),this._addRightAngleCandidate(e[l],o,t,r,e)}_addRightAngleCandidate(e,t,r,a,n){if(null==t||!P(e))return;const s=e.constraint.closestTo(t),i=(s[0]-r[0])/a.x,o=(s[1]-r[1])/a.y,{start:c,end:u}=e.constraint;if(i*i+o*o<=1){const r=m(j(s),j(c))>m(j(s),j(u))?c:u,a=new I({targetPoint:F(s),otherVertex:t,otherVertexType:0,previousVertex:r,constraint:new v(t,s),objectId:e.objectId,isDraped:e.isDraped,domain:1});n.push(a)}}_computeScreenSizeDistanceParameters(e,t){let r=null!=this.options?this.options.distance*("touch"===t.pointer?this.options.touchSensitivityMultiplier:1):0;return null==this.view?{x:r,y:r,z:r,distance:r}:"2d"===this.view.type?(r*=this.view.resolution,{x:r,y:r,z:r,distance:r}):this._computeScreenSizeDistanceParameters3D(e,r,this.view,t)}_computeScreenSizeDistanceParameters3D(e,t,r,a){const{spatialReference:n}=a;r.renderCoordsHelper.toRenderCoords(e,n,O);const s=r.state.camera.computeScreenPixelSizeAt(O),i=s*r.renderCoordsHelper.unitInMeters,o=i/u(n),c=i/l(n),p=t*o,d=t*c,m=G(e,n,_,r),S=m?E(m,e,o,0,0,r,a):0,g=m?E(m,e,0,o,0,r,a):0,h=m?E(m,e,0,0,c,r,a):0;return{x:0===S?0:p/S,y:0===g?0:p/g,z:0===h?0:d/h,distance:s*t}}_candidateIsExcluded(e,t,r){if(null==r)return!1;const a=this._getCandidateObjectId(t);if(null==a)return!1;const n=e.layerSource.layer;return"graphics"===n.type?r.uid===a:r.sourceLayer===n&&(!(!r.attributes||!("objectIdField"in n))&&r.attributes[n.objectIdField]===a)}_getCandidateObjectId(e){return e instanceof L?e.objectId:null}async _createSourceInfo(e,t){const r=e.layer;r.loaded||(await r.load(),i(t));const{view:a}=this,n=await this._createFeatureSnappingSourceType(e);return i(t),new b(null==n?{}:{snappingSource:n,view:a,layer:r})}async _createFeatureSnappingSourceType(e){switch(e.layer.type){case"feature":case"geojson":case"csv":case"oriented-imagery":case"subtype-group":case"wfs":return this._createFeatureSnappingSourceFeatureLayer(e);case"graphics":return this._createFeatureSnappingSourceGraphicsLayer(e);case"map-notes":return this._createFeatureSnappingSourceMapNotesLayer(e);case"scene":case"building-scene":return this._createFeatureSnappingSourceSceneLayer(e)}return null}async _createFeatureSnappingSourceSceneLayer(e){const{view:t}=this;if(null==t||"3d"!==t.type)return null;return new((await this._getSourceModule("scene")).SceneLayerSnappingSource)({layerSource:e,view:t})}async _createFeatureSnappingSourceFeatureLayer(e){switch(e.layer.source?.type){case"feature-layer":case"oriented-imagery":return new((await this._getSourceModule("featureService")).FeatureServiceSnappingSource)({spatialReference:this.spatialReference,view:this.view,layerSource:e});case"memory":case"csv":case"geojson":case"wfs":if("mesh"===e.layer.geometryType)return null;return new((await this._getSourceModule("featureCollection")).FeatureCollectionSnappingSource)({layerSource:e,view:this.view})}return null}async _createFeatureSnappingSourceGraphicsLayer(e){return new((await this._getSourceModule("graphics")).GraphicsSnappingSource)({getGraphicsLayers:()=>[e.layer],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _createFeatureSnappingSourceMapNotesLayer(e){return new((await this._getSourceModule("notes")).GraphicsSnappingSource)({getGraphicsLayers:()=>e.layer.sublayers?.toArray()??[],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _getSourceModule(e){const t=this._sourceModules[e];if(null==t.loader){const t=this._loadSourceModule(e),r={module:null,loader:t};this._sourceModules[e]=r;const a=await t,n={module:a,loader:t};return this._sourceModules[e]=n,a}return null==t.module?t.loader:t.module}_loadSourceModule(e){const t=this._updatingHandles;switch(e){case"featureService":return t.addPromise(import("./featureSources/FeatureServiceSnappingSource.js"));case"featureCollection":return t.addPromise(import("./featureSources/FeatureCollectionSnappingSource.js"));case"graphics":case"notes":return t.addPromise(import("./featureSources/GraphicsSnappingSource.js"));case"scene":return t.addPromise(import("./featureSources/SceneLayerSnappingSource.js"))}}get test(){}};function P(e){return(e instanceof M||e instanceof R)&&!z(e)}function z({constraint:{start:e,end:t}}){const r=g(e,t),a=m(j(e),j(t));return r<f()||a/r<A}function E(e,t,r,a,n,s,{spatialReference:i}){const o=S(U,t);o[0]+=r,o[1]+=a,o[2]+=n;const c=G(o,i,_,s);return c?C(c,e):1/0}e([p({constructOnly:!0})],H.prototype,"spatialReference",void 0),e([p({constructOnly:!0})],H.prototype,"view",void 0),e([p()],H.prototype,"options",void 0),e([p({readOnly:!0})],H.prototype,"updating",null),e([p()],H.prototype,"_snappingSources",void 0),H=e([d("esri.views.interactive.snapping.FeatureSnappingEngine")],H);const O=h(),U=h(),A=1e-4;export{H as FeatureSnappingEngine};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{cyclicalPI as e,cyclical2PI as t}from"../../../core/Cyclical.js";import{valueInUnit as s,createAngle as r}from"../../../core/quantityUtils.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as o}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as n,markAsTarget as a,fromVec3 as d}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as l}from"./SnappingAlgorithm.js";import{editEdgeToSnappingEdge as p,squaredScreenDistance as h}from"./snappingUtils.js";import{LineSnappingCandidate as c}from"./candidates/LineSnappingCandidate.js";import{vectorToScreenPoint as g}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as f,pointFromDistanceAlongAzimuth as m}from"../../support/angularMeasurementUtils.js";import{projectPointToLineLike as u}from"../../support/geometry3dUtils.js";class x extends l{constructor(e,t,s){super(e,t),this._geodesicLengthMeasurementUtils=s}snapNewVertex(e,t){const s=t.editGeometryOperations.data.components[0],r=s.edges.length,i=[];if(r<1)return i;const{spatialReference:n}=t,a=g(e,n,o,this.view),{view:d}=this,l=s.edges[r-1];let h=l;do{if(this.edgeExceedsShortLineThreshold(h,t)){const s=p(h,d,t);this._processCandidateProposal(s.left,s.right,e,a,t,i)}h=h.leftVertex.leftEdge}while(h&&h!==l);return i}snapExistingVertex(e,t){const s=[],r=t.vertexHandle,i=r.component;if(i.edges.length<2)return s;const{view:a}=this,{spatialReference:d}=t,l=g(e,d,o,a),h=r.leftEdge,c=r.rightEdge;h&&c&&this.edgeExceedsShortLineThreshold(h,t)&&this.edgeExceedsShortLineThreshold(c,t)&&this._processCandidateProposal(n(h.leftVertex.pos,a,t),n(c.rightVertex.pos,a,t),e,l,t,s);const f=i.edges[0];let m=f;do{if(m!==r.leftEdge&&m!==r.rightEdge&&this.edgeExceedsShortLineThreshold(m,t)){const r=p(m,a,t);this._processCandidateProposal(r.left,r.right,e,l,t,s)}m=m.rightVertex.rightEdge}while(m&&m!==f);return s}_processCandidateProposal(e,t,s,r,n,l){const{spatialReference:p,pointer:f}=n,m=i();E(m,e,t,s,n,this._geodesicLengthMeasurementUtils);const u=a(d(m));h(r,g(u,p,o,this.view))<this.squaredProximityThreshold(f)&&l.push(new c({lineStart:e,lineEnd:t,targetPoint:u,isDraped:"on-the-ground"===n.elevationInfo?.mode}))}}function E(e,t,s,r,i,o){j(e,t,s,r,i,o)||v(e,r,t,s)}function j(i,o,n,a,{spatialReference:d},l){const p=f(o,n,d,d);if(null==p)return!1;const h=f(n,a,d,d);if(null==h)return!1;const c=l.geodesicDistance(n,a,d);if(null==c)return!1;const g=Math.abs(e.shortestSignedDiff(p,h))>Math.PI/2?t.normalize(p+Math.PI):p;return m(i,n,d,s(c,"meters"),r(g,"radians","geographic"),"geodesic"),i[2]=a[2],!0}function v(e,t,s,r){u(t,{start:s,end:r,type:1},e),e[2]=t[2]}export{x as LineSnapper};
5
+ import{cyclicalPI as e,cyclical2PI as t}from"../../../core/Cyclical.js";import{valueInUnit as s,createAngle as r}from"../../../core/quantityUtils.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as o}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as n,markAsTarget as a,fromVec3 as l}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as p}from"./SnappingAlgorithm.js";import{editEdgeToSnappingEdge as h,squaredScreenDistance as c}from"./snappingUtils.js";import{LineSnappingCandidate as d}from"./candidates/LineSnappingCandidate.js";import{vectorToScreenPoint as m}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as g,pointFromDistanceAlongAzimuth as f}from"../../support/angularMeasurementUtils.js";import{projectPointToLineLike as u}from"../../support/geometry3dUtils.js";class x extends p{constructor(e,t,s){super(e,t),this._geodesicLengthMeasurementUtils=s}snapNewVertex(e,t){const s=t.editGeometryOperations.data.parts[0],r=s.segments.length,i=[];if(r<1)return i;const{spatialReference:n}=t,a=m(e,n,o,this.view),{view:l}=this,p=s.segments[r-1];let c=p;do{if(this.edgeExceedsShortLineThreshold(c,t)){const s=h(c,l,t);this._processCandidateProposal(s.left,s.right,e,a,t,i)}c=c.leftVertex.leftSegment}while(c&&c!==p);return i}snapExistingVertex(e,t){const s=[],r=t.vertexHandle,i=r.part;if(i.segments.length<2)return s;const{view:a}=this,{spatialReference:l}=t,p=m(e,l,o,a),c=r.leftSegment,d=r.rightSegment;c&&d&&this.edgeExceedsShortLineThreshold(c,t)&&this.edgeExceedsShortLineThreshold(d,t)&&this._processCandidateProposal(n(c.leftVertex.pos,a,t),n(d.rightVertex.pos,a,t),e,p,t,s);const g=i.segments[0];let f=g;do{if(f!==r.leftSegment&&f!==r.rightSegment&&this.edgeExceedsShortLineThreshold(f,t)){const r=h(f,a,t);this._processCandidateProposal(r.left,r.right,e,p,t,s)}f=f.rightVertex.rightSegment}while(f&&f!==g);return s}_processCandidateProposal(e,t,s,r,n,p){const{spatialReference:h,pointer:g}=n,f=i();S(f,e,t,s,n,this._geodesicLengthMeasurementUtils);const u=a(l(f));c(r,m(u,h,o,this.view))<this.squaredProximityThreshold(g)&&p.push(new d({lineStart:e,lineEnd:t,targetPoint:u,isDraped:"on-the-ground"===n.elevationInfo?.mode}))}}function S(e,t,s,r,i,o){j(e,t,s,r,i,o)||v(e,r,t,s)}function j(i,o,n,a,{spatialReference:l},p){const h=g(o,n,l,l);if(null==h)return!1;const c=g(n,a,l,l);if(null==c)return!1;const d=p.geodesicDistance(n,a,l);if(null==d)return!1;const m=Math.abs(e.shortestSignedDiff(h,c))>Math.PI/2?t.normalize(h+Math.PI):h;return f(i,n,l,s(d,"meters"),r(m,"radians","geographic"),"geodesic"),i[2]=a[2],!0}function v(e,t,s,r){u(t,{start:s,end:r,type:1},e),e[2]=t[2]}export{x as LineSnapper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{squaredDistance as e}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as i,asVec2 as s,markAsTarget as o,fromValues as n}from"../sketch/normalizedPoint.js";import{defaults as l}from"./Settings.js";import{SnappingAlgorithm as a}from"./SnappingAlgorithm.js";import{editEdgeToSnappingEdge as c,squaredScreenDistance as h}from"./snappingUtils.js";import{ParallelLineSnappingCandidate as d}from"./candidates/ParallelLineSnappingCandidate.js";import{vectorToScreenPoint as p}from"../support/viewUtils.js";import{projectPointToLine as g}from"../../support/geometry2dUtils.js";class f extends a{snapNewVertex(e,t){const s=t.editGeometryOperations.data.components[0],o=s.edges.length,n=s.vertices.length,l=[];if(o<2)return l;const{view:a}=this,h=p(e,t.spatialReference,r,a),d=i(s.vertices[n-1].pos,a,t),g=i(s.vertices[0].pos,a,t),f=s.edges[o-1];let m=f;do{if(this.edgeExceedsShortLineThreshold(m,t)){const r=c(m,a,t);this._checkEdgeForParallelLines(r,d,e,h,t,l),this._checkEdgeForParallelLines(r,g,e,h,t,l)}m=m.leftVertex.leftEdge}while(m&&m!==f);return l}snapExistingVertex(e,t){const s=[],o=t.vertexHandle,n=o.component;if(n.edges.length<3)return s;const{view:l}=this,a=p(e,t.spatialReference,r,l),h=o.leftEdge,d=o.rightEdge,g=n.vertices[0],f=i(g.pos,l,t),m=n.vertices.length,u=n.vertices[m-1],v=i(u.pos,l,t),x=n.edges[0];let E=x;do{if(E!==h&&E!==d&&this.edgeExceedsShortLineThreshold(E,t)){const r=c(E,l,t);h&&this._checkEdgeForParallelLines(r,i(h.leftVertex.pos,l,t),e,a,t,s),d&&this._checkEdgeForParallelLines(r,i(d.rightVertex.pos,l,t),e,a,t,s),o===g?this._checkEdgeForParallelLines(r,v,e,a,t,s):o===u&&this._checkEdgeForParallelLines(r,f,e,a,t,s)}E=E.rightVertex.rightEdge}while(E&&E!==x);return s}_checkEdgeForParallelLines(t,i,a,c,f,v){const x=t.left,E=t.right;if(g(u,s(i),s(x),s(E)),e(u,s(i))<l.parallelLineThreshold)return;g(u,s(a),s(x),s(E),s(i));const{spatialReference:L,pointer:P}=f,j=o(n(u[0],u[1],a[2]));if(h(c,p(j,L,r,this.view))<this.squaredProximityThreshold(P)){if(this.isVertical(j,i,f)||this.isVertical(x,E,f))return;if(m(t,v))return;v.push(new d({referenceLine:t,lineStart:i,targetPoint:j,isDraped:"on-the-ground"===f.elevationInfo?.mode}))}}}function m(t,r){const i=t.left,o=t.right;for(const n of r)if(g(u,s(o),s(n.constraint.start),s(n.constraint.end),s(i)),e(u,s(o))<l.parallelLineThreshold)return n.addReferenceLine(t),!0;return!1}const u=t();export{f as ParallelLineSnapper};
5
+ import{squaredDistance as e}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as i,asVec2 as s,markAsTarget as n,fromValues as o}from"../sketch/normalizedPoint.js";import{defaults as l}from"./Settings.js";import{SnappingAlgorithm as a}from"./SnappingAlgorithm.js";import{editEdgeToSnappingEdge as c,squaredScreenDistance as h}from"./snappingUtils.js";import{ParallelLineSnappingCandidate as p}from"./candidates/ParallelLineSnappingCandidate.js";import{vectorToScreenPoint as g}from"../support/viewUtils.js";import{projectPointToLine as f}from"../../support/geometry2dUtils.js";class m extends a{snapNewVertex(e,t){const s=t.editGeometryOperations.data.parts[0],n=s.segments.length,o=s.vertices.length,l=[];if(n<2)return l;const{view:a}=this,h=g(e,t.spatialReference,r,a),p=i(s.vertices[o-1].pos,a,t),f=i(s.vertices[0].pos,a,t),m=s.segments[n-1];let d=m;do{if(this.edgeExceedsShortLineThreshold(d,t)){const r=c(d,a,t);this._checkEdgeForParallelLines(r,p,e,h,t,l),this._checkEdgeForParallelLines(r,f,e,h,t,l)}d=d.leftVertex.leftSegment}while(d&&d!==m);return l}snapExistingVertex(e,t){const s=[],n=t.vertexHandle,o=n.part;if(o.segments.length<3)return s;const{view:l}=this,a=g(e,t.spatialReference,r,l),h=n.leftSegment,p=n.rightSegment,f=o.vertices[0],m=i(f.pos,l,t),d=o.vertices.length,u=o.vertices[d-1],v=i(u.pos,l,t),x=o.segments[0];let L=x;do{if(L!==h&&L!==p&&this.edgeExceedsShortLineThreshold(L,t)){const r=c(L,l,t);h&&this._checkEdgeForParallelLines(r,i(h.leftVertex.pos,l,t),e,a,t,s),p&&this._checkEdgeForParallelLines(r,i(p.rightVertex.pos,l,t),e,a,t,s),n===f?this._checkEdgeForParallelLines(r,v,e,a,t,s):n===u&&this._checkEdgeForParallelLines(r,m,e,a,t,s)}L=L.rightVertex.rightSegment}while(L&&L!==x);return s}_checkEdgeForParallelLines(t,i,a,c,m,v){const x=t.left,L=t.right;if(f(u,s(i),s(x),s(L)),e(u,s(i))<l.parallelLineThreshold)return;f(u,s(a),s(x),s(L),s(i));const{spatialReference:P,pointer:j}=m,E=n(o(u[0],u[1],a[2]));if(h(c,g(E,P,r,this.view))<this.squaredProximityThreshold(j)){if(this.isVertical(E,i,m)||this.isVertical(x,L,m))return;if(d(t,v))return;v.push(new p({referenceLine:t,lineStart:i,targetPoint:E,isDraped:"on-the-ground"===m.elevationInfo?.mode}))}}}function d(t,r){const i=t.left,n=t.right;for(const o of r)if(f(u,s(n),s(o.constraint.start),s(o.constraint.end),s(i)),e(u,s(n))<l.parallelLineThreshold)return o.addReferenceLine(t),!0;return!1}const u=t();export{m as ParallelLineSnapper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{cyclical2PI as e}from"../../../core/Cyclical.js";import{createAngle as t,valueInUnit as i}from"../../../core/quantityUtils.js";import{subtract as r,dot as s,squaredLength as n,scaleAndAdd as o}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as c,d as p,i as g}from"../../../chunks/vec32.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as l}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as d}from"../sketch/constraints.js";import{fromAnyMapPoint as f,asVec2 as m,markAsTarget as u,fromValues as x,fromVec3 as v}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as V}from"./SnappingAlgorithm.js";import{squaredScreenDistance as j}from"./snappingUtils.js";import{RightAngleSnappingCandidate as E}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as S}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as k,pointFromDistanceAlongAzimuth as C}from"../../support/angularMeasurementUtils.js";class _ extends V{constructor(e,t,i){super(e,t),this._geodesicLengthMeasurementUtils=i}snapNewVertex(e,t){const i=t.editGeometryOperations.data.components[0],r=[];if(i.vertices.length<2)return r;const{view:s}=this,n=S(e,t.spatialReference,l,s),o=i.vertices.at(-1);this._checkForSnappingCandidate(1,r,o.leftEdge,o,o.leftEdge.leftVertex,e,n,t);const a=i.vertices[0];return this._checkForSnappingCandidate(2,r,a.rightEdge,a,a.rightEdge.rightVertex,e,n,t),r}snapExistingVertex(e,t){const i=[],r=t.vertexHandle;if(r.component.vertices.length<3)return i;const{view:s}=this,n=S(e,t.spatialReference,l,s),o=r.leftEdge,a=r.rightEdge;if(o?.leftVertex.leftEdge){const r=o.leftVertex.leftEdge;this._checkForSnappingCandidate(3,i,r,r.rightVertex,r.leftVertex,e,n,t)}if(a?.rightVertex.rightEdge){const r=a.rightVertex.rightEdge;this._checkForSnappingCandidate(3,i,r,r.leftVertex,r.rightVertex,e,n,t)}return i}_checkForSnappingCandidate(e,t,i,r,s,n,o,a){if(!this.edgeExceedsShortLineThreshold(i,a))return;const c=this.view,p=f(r.pos,c,a),g=f(s.pos,c,a);w(U,g,p,n,a,this._geodesicLengthMeasurementUtils),this._checkForSnappingCandidateAlongProjectedRay(e,t,g,p,U,n,o,a)}_checkForSnappingCandidateAlongProjectedRay(e,t,i,a,p,g,f,V){const{spatialReference:k,pointer:C}=V,_=r(R,m(g),m(a)),w=s(p,_)/n(p),y=o(R,m(a),p,w),F=u(x(y[0],y[1],g[2]));if(j(f,S(F,k,l,this.view))>this.squaredProximityThreshold(C)||this.isVertical(F,a,V)||this.isVertical(a,i,V))return;const U=c(h(),a,p,Math.sign(w));t.push(new E({targetPoint:F,constraint:new d(a,v(U)),previousVertex:i,otherVertex:a,otherVertexType:1,selfSnappingType:e,isDraped:"on-the-ground"===V.elevationInfo?.mode}))}}function w(e,t,i,r,s,n){y(e,t,i,r,s,n)||F(e,t,i)}function y(r,s,n,o,{spatialReference:a},c){const g=k(s,n,a,a);if(null==g)return!1;const l=k(n,o,a,a);if(null==l)return!1;const d=Math.sign(e.shortestSignedDiff(g,l))*Math.PI*.5,f=t(g+d,"radians","geographic"),m=h(),u=c.geodesicDistance(n,o,a);return null!=u&&(C(m,n,a,i(u,"meters"),f,"geodesic"),p(r,m,n),!0)}function F(e,t,i){const s=r(R,m(i),m(t));g(e,s[1],-s[0],0)}const R=a(),U=h();export{_ as RightAngleSnapper};
5
+ import{cyclical2PI as e}from"../../../core/Cyclical.js";import{createAngle as t,valueInUnit as r}from"../../../core/quantityUtils.js";import{subtract as i,dot as n,squaredLength as s,scaleAndAdd as o}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as c,d as p,i as g}from"../../../chunks/vec32.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as l}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as m}from"../sketch/constraints.js";import{fromAnyMapPoint as f,asVec2 as d,markAsTarget as u,fromValues as x,fromVec3 as S}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as v}from"./SnappingAlgorithm.js";import{squaredScreenDistance as V}from"./snappingUtils.js";import{RightAngleSnappingCandidate as j}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as k}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as C,pointFromDistanceAlongAzimuth as _}from"../../support/angularMeasurementUtils.js";class w extends v{constructor(e,t,r){super(e,t),this._geodesicLengthMeasurementUtils=r}snapNewVertex(e,t){const r=t.editGeometryOperations.data.parts[0],i=[];if(r.vertices.length<2)return i;const{view:n}=this,s=k(e,t.spatialReference,l,n),o=r.vertices.at(-1);this._checkForSnappingCandidate(1,i,o.leftSegment,o,o.leftSegment.leftVertex,e,s,t);const a=r.vertices[0];return this._checkForSnappingCandidate(2,i,a.rightSegment,a,a.rightSegment.rightVertex,e,s,t),i}snapExistingVertex(e,t){const r=[],i=t.vertexHandle;if(i.part.vertices.length<3)return r;const{view:n}=this,s=k(e,t.spatialReference,l,n),o=i.leftSegment,a=i.rightSegment;if(o?.leftVertex.leftSegment){const i=o.leftVertex.leftSegment;this._checkForSnappingCandidate(3,r,i,i.rightVertex,i.leftVertex,e,s,t)}if(a?.rightVertex.rightSegment){const i=a.rightVertex.rightSegment;this._checkForSnappingCandidate(3,r,i,i.leftVertex,i.rightVertex,e,s,t)}return r}_checkForSnappingCandidate(e,t,r,i,n,s,o,a){if(!this.edgeExceedsShortLineThreshold(r,a))return;const c=this.view,p=f(i.pos,c,a),g=f(n.pos,c,a);y(M,g,p,s,a,this._geodesicLengthMeasurementUtils),this._checkForSnappingCandidateAlongProjectedRay(e,t,g,p,M,s,o,a)}_checkForSnappingCandidateAlongProjectedRay(e,t,r,a,p,g,f,v){const{spatialReference:C,pointer:_}=v,w=i(U,d(g),d(a)),y=n(p,w)/s(p),F=o(U,d(a),p,y),R=u(x(F[0],F[1],g[2]));if(V(f,k(R,C,l,this.view))>this.squaredProximityThreshold(_)||this.isVertical(R,a,v)||this.isVertical(a,r,v))return;const M=c(h(),a,p,Math.sign(y));t.push(new j({targetPoint:R,constraint:new m(a,S(M)),previousVertex:r,otherVertex:a,otherVertexType:1,selfSnappingType:e,isDraped:"on-the-ground"===v.elevationInfo?.mode}))}}function y(e,t,r,i,n,s){F(e,t,r,i,n,s)||R(e,t,r)}function F(i,n,s,o,{spatialReference:a},c){const g=C(n,s,a,a);if(null==g)return!1;const l=C(s,o,a,a);if(null==l)return!1;const m=Math.sign(e.shortestSignedDiff(g,l))*Math.PI*.5,f=t(g+m,"radians","geographic"),d=h(),u=c.geodesicDistance(s,o,a);return null!=u&&(_(d,s,a,r(u,"meters"),f,"geodesic"),p(i,d,s),!0)}function R(e,t,r){const n=i(U,d(r),d(t));g(e,n[1],-n[0],0)}const U=a(),M=h();export{w as RightAngleSnapper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{lerp as e,distance as t}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as o,asVec2 as s,markAsTarget as n,fromValues as p}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as a}from"./SnappingAlgorithm.js";import{squaredScreenDistance as d}from"./snappingUtils.js";import{RightAngleTriangleSnappingCandidate as l}from"./candidates/RightAngleTriangleSnappingCandidate.js";import{vectorToScreenPoint as m}from"../support/viewUtils.js";import{projectPointToCircle as c}from"../../support/geometry2dUtils.js";class h extends a{snapNewVertex(e,t){const i=t.editGeometryOperations.data.components[0],r=[],s=i.vertices.length;if("polygon"!==t.editGeometryOperations.data.type||s<2)return r;const{view:n}=this,p=i.vertices[0],a=i.vertices[s-1],d=o(p.pos,n,t),l=o(a.pos,n,t);return this._processCandidateProposal(d,l,e,t,r),r}snapExistingVertex(e,t){const i=[],r=t.vertexHandle,s=r.component;if(s.edges.length<2)return i;if("polyline"===t.editGeometryOperations.data.type&&(0===r.index||r.index===s.vertices.length-1))return i;const{view:n}=this,p=o(r.leftEdge.leftVertex.pos,n,t),a=o(r.rightEdge.rightVertex.pos,n,t);return this._processCandidateProposal(p,a,e,t,i),i}_processCandidateProposal(i,o,a,h,g){if(!this.exceedsShortLineThreshold(i,o,h))return;const v=e(f,s(i),s(o),.5),x=.5*t(s(i),s(o)),u=c(f,s(a),v,x),j=n(p(u[0],u[1],a[2])),{spatialReference:y,pointer:w}=h,P=m(a,y,r,this.view);if(d(P,m(j,y,r,this.view))<this.squaredProximityThreshold(w)){if(this.isVertical(i,j,h)||this.isVertical(j,o,h))return;g.push(new l({targetPoint:j,point1:i,point2:o,isDraped:"on-the-ground"===h.elevationInfo?.mode}))}}}const f=i();export{h as RightAngleTriangleSnapper};
5
+ import{lerp as e,distance as t}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as s,asVec2 as o,markAsTarget as n,fromValues as p}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as a}from"./SnappingAlgorithm.js";import{squaredScreenDistance as l}from"./snappingUtils.js";import{RightAngleTriangleSnappingCandidate as m}from"./candidates/RightAngleTriangleSnappingCandidate.js";import{vectorToScreenPoint as d}from"../support/viewUtils.js";import{projectPointToCircle as h}from"../../support/geometry2dUtils.js";class c extends a{snapNewVertex(e,t){const i=t.editGeometryOperations.data.parts[0],r=[],o=i.vertices.length;if("polygon"!==t.editGeometryOperations.data.type||o<2)return r;const{view:n}=this,p=i.vertices[0],a=i.vertices[o-1],l=s(p.pos,n,t),m=s(a.pos,n,t);return this._processCandidateProposal(l,m,e,t,r),r}snapExistingVertex(e,t){const i=[],r=t.vertexHandle,o=r.part;if(o.segments.length<2)return i;if("polyline"===t.editGeometryOperations.data.type&&(0===r.index||r.index===o.vertices.length-1))return i;const{view:n}=this,p=s(r.leftSegment.leftVertex.pos,n,t),a=s(r.rightSegment.rightVertex.pos,n,t);return this._processCandidateProposal(p,a,e,t,i),i}_processCandidateProposal(i,s,a,c,g){if(!this.exceedsShortLineThreshold(i,s,c))return;const v=e(f,o(i),o(s),.5),x=.5*t(o(i),o(s)),u=h(f,o(a),v,x),j=n(p(u[0],u[1],a[2])),{spatialReference:y,pointer:w}=c,P=d(a,y,r,this.view);if(l(P,d(j,y,r,this.view))<this.squaredProximityThreshold(w)){if(this.isVertical(i,j,c)||this.isVertical(j,s,c))return;g.push(new m({targetPoint:j,point1:i,point2:s,isDraped:"on-the-ground"===c.elevationInfo?.mode}))}}}const f=i();export{c as RightAngleTriangleSnapper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{abortMaybe as n,removeMaybe as e}from"../../../core/maybe.js";import{ignoreAbortErrors as t,debounce as o}from"../../../core/promiseUtils.js";import{watch as r}from"../../../core/reactiveUtils.js";import{pointEquals as i}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{clonePoint as l}from"../../../layers/graphics/hydratedFeatures.js";import{absoluteHeightElevationInfo as a}from"../../../support/elevationInfoUtils.js";import{EventPipeline as s}from"../dragEventPipeline.js";import{SnappingContext as u}from"./SnappingContext.js";import{ImmediateTask as c,TaskPriority as p}from"../../support/Scheduler.js";function f({predicate:o=()=>!0,snappingManager:i,snappingContext:l,updatingHandles:u,useZ:c=!0}){const p=new s;if(null==i)return{snappingStep:[y,p],cancelSnapping:y};let f,Z=null,j=null,z=null;const T=()=>{Z=n(Z),i.doneSnapping(),j?.frameTask.remove(),j=null,f=e(f),z=null},k=d(i,c,p);let w=null,I=null,U=null;return{snappingStep:[n=>{if(!o(n))return n;const{action:e}=n;if("start"===e){const{info:e}=n,t=m(i.view);if(j=g(l,n,t),j.context.selfSnappingZ=null,!c&&null!=e){const n=S(l.coordinateHelper,e.handle.component);null!=n&&(j.context.selfSnappingZ={value:n,elevationInfo:l.elevationInfo??a})}}if(null!=j){const{context:o,originalScenePos:l,originalPos:a}=j,{mapEnd:s,mapStart:p,scenePoints:d}=n,m=x(a,v(s,p)),g=v(p,a),S={...n,action:"update"},y=j.context,T=P(l,d),C=i.update({point:m,scenePoint:T,context:o});if(U=C,h(s,C,g,c),w=m,I=T,"end"!==e){const{frameTask:n}=j;null==Z&&(Z=new AbortController),z=e=>{u.addPromise(t(k({frameTask:n,event:S,context:y,point:m,scenePoint:T,delta:g,getLastState:()=>({point:w,scenePoint:I,updatePoint:e.forceUpdate?null:U})},Z.signal)))},z({forceUpdate:!1}),null==f&&(f=r(()=>i.options.effectiveEnabled,()=>z?.({forceUpdate:!0})))}}return"end"===e&&T(),n},p],cancelSnapping:n=>(T(),n)}}function d(n,e,t){return o(async({frameTask:o,point:r,scenePoint:l,context:a,event:s,delta:u,getLastState:c},p)=>{const f=await o.schedule(()=>n.snap({point:r,scenePoint:l,context:a,signal:p}),p);if(f.valid){let l=await o.schedule(()=>f.apply(),p);const d=c();null!=d.point&&r!==d.point&&(l=n.update({point:d.point,scenePoint:d.scenePoint,context:a})),null!=d.updatePoint&&i(l,d.updatePoint)||(h(s.mapEnd,l,u,e),t.execute(s))}})}function m(n){return"3d"===n.type?n.resourceController.scheduler.registerTask(p.SNAPPING):c}function g(n,e,t){return{context:new u({editGeometryOperations:n.editGeometryOperations,elevationInfo:n.elevationInfo,pointer:n.pointer,vertexHandle:null!=e.info?e.info.handle:null,excludeFeature:n.excludeFeature,feature:n.feature,visualizer:n.visualizer}),originalPos:null!=e.snapOrigin?n.coordinateHelper.vectorToDehydratedPoint(e.snapOrigin):e.mapStart,originalScenePos:null!=e.scenePoints?e.scenePoints.sceneStart:null,frameTask:t}}function x(n,[e,t,o]){const r=l(n);return r.x+=e,r.y+=t,r.hasZ&&(r.z+=o),r}function P(n,e){return null==n||null==e?null:x(n,v(e.sceneEnd,e.sceneStart))}function v(n,e){const t=n.hasZ&&e.hasZ?n.z-e.z:0;return[n.x-e.x,n.y-e.y,t]}function h(n,e,[t,o,r],i){n.x=e.x+t,n.y=e.y+o,i&&n.hasZ&&e.hasZ&&(n.z=e.z+r)}function S(n,e){if(!n.hasZ())return null;const t=e.vertices;let o=null;for(const r of t){const e=n.getZ(r.pos);if(null!=o&&null!=e&&Math.abs(e-o)>1e-6)return null;null==o&&(o=e)}return o}function y(n){return n}export{f as createSnapDragEventPipelineStep};
5
+ import{abortMaybe as n,removeMaybe as e}from"../../../core/maybe.js";import{ignoreAbortErrors as t,debounce as o}from"../../../core/promiseUtils.js";import{watch as r}from"../../../core/reactiveUtils.js";import{pointEquals as i}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{clonePoint as a}from"../../../layers/graphics/hydratedFeatures.js";import{absoluteHeightElevationInfo as l}from"../../../support/elevationInfoUtils.js";import{EventPipeline as s}from"../dragEventPipeline.js";import{SnappingContext as u}from"./SnappingContext.js";import{ImmediateTask as p,TaskPriority as c}from"../../support/Scheduler.js";function f({predicate:o=()=>!0,snappingManager:i,snappingContext:a,updatingHandles:u,useZ:p=!0}){const c=new s;if(null==i)return{snappingStep:[y,c],cancelSnapping:y};let f,Z=null,j=null,z=null;const T=()=>{Z=n(Z),i.doneSnapping(),j?.frameTask.remove(),j=null,f=e(f),z=null},k=d(i,p,c);let w=null,I=null,U=null;return{snappingStep:[n=>{if(!o(n))return n;const{action:e}=n;if("start"===e){const{info:e}=n,t=m(i.view);if(j=g(a,n,t),j.context.selfSnappingZ=null,!p&&null!=e){const n=S(a.coordinateHelper,e.handle.part);null!=n&&(j.context.selfSnappingZ={value:n,elevationInfo:a.elevationInfo??l})}}if(null!=j){const{context:o,originalScenePos:a,originalPos:l}=j,{mapEnd:s,mapStart:c,scenePoints:d}=n,m=x(l,v(s,c)),g=v(c,l),S={...n,action:"update"},y=j.context,T=P(a,d),C=i.update({point:m,scenePoint:T,context:o});if(U=C,h(s,C,g,p),w=m,I=T,"end"!==e){const{frameTask:n}=j;null==Z&&(Z=new AbortController),z=e=>{u.addPromise(t(k({frameTask:n,event:S,context:y,point:m,scenePoint:T,delta:g,getLastState:()=>({point:w,scenePoint:I,updatePoint:e.forceUpdate?null:U})},Z.signal)))},z({forceUpdate:!1}),null==f&&(f=r(()=>i.options.effectiveEnabled,()=>z?.({forceUpdate:!0})))}}return"end"===e&&T(),n},c],cancelSnapping:n=>(T(),n)}}function d(n,e,t){return o(async({frameTask:o,point:r,scenePoint:a,context:l,event:s,delta:u,getLastState:p},c)=>{const f=await o.schedule(()=>n.snap({point:r,scenePoint:a,context:l,signal:c}),c);if(f.valid){let a=await o.schedule(()=>f.apply(),c);const d=p();null!=d.point&&r!==d.point&&(a=n.update({point:d.point,scenePoint:d.scenePoint,context:l})),null!=d.updatePoint&&i(a,d.updatePoint)||(h(s.mapEnd,a,u,e),t.execute(s))}})}function m(n){return"3d"===n.type?n.resourceController.scheduler.registerTask(c.SNAPPING):p}function g(n,e,t){return{context:new u({editGeometryOperations:n.editGeometryOperations,elevationInfo:n.elevationInfo,pointer:n.pointer,vertexHandle:null!=e.info?e.info.handle:null,excludeFeature:n.excludeFeature,feature:n.feature,visualizer:n.visualizer}),originalPos:null!=e.snapOrigin?n.coordinateHelper.vectorToDehydratedPoint(e.snapOrigin):e.mapStart,originalScenePos:null!=e.scenePoints?e.scenePoints.sceneStart:null,frameTask:t}}function x(n,[e,t,o]){const r=a(n);return r.x+=e,r.y+=t,r.hasZ&&(r.z+=o),r}function P(n,e){return null==n||null==e?null:x(n,v(e.sceneEnd,e.sceneStart))}function v(n,e){const t=n.hasZ&&e.hasZ?n.z-e.z:0;return[n.x-e.x,n.y-e.y,t]}function h(n,e,[t,o,r],i){n.x=e.x+t,n.y=e.y+o,i&&n.hasZ&&e.hasZ&&(n.z=e.z+r)}function S(n,e){if(!n.hasZ())return null;const t=e.vertices;let o=null;for(const r of t){const e=n.getZ(r.pos);if(null!=o&&null!=e&&Math.abs(e-o)>1e-6)return null;null==o&&(o=e)}return o}function y(n){return n}export{f as createSnapDragEventPipelineStep};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../Color.js";import r from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Error.js";import has from"../../../core/has.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{debounce as a,throwIfAborted as l}from"../../../core/promiseUtils.js";import{on as n}from"../../../core/reactiveUtils.js";import{sqlAnd as p}from"../../../core/sql.js";import{getMetersPerUnitForSR as c}from"../../../core/unitUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import y from"../../../geometry/Extent.js";import{getResolutionForScale as m}from"../../../geometry/support/scaleUtils.js";import{collectFields as d}from"../../../layers/support/fieldUtils.js";import{getLayerFloorFilterClause as f}from"../../../layers/support/floorFilterUtils.js";import{calculateTolerance as g}from"../../../renderers/support/clickToleranceUtils.js";import{identify as b}from"../../../rest/identify.js";import w from"../../../rest/support/IdentifyParameters.js";import{loadArcade as v}from"../../../support/loadArcade.js";import x from"../../../symbols/SimpleMarkerSymbol.js";import{getRequiredFields as j,getFetchPopupTemplate as S}from"./popupUtils.js";let F=null;function _(e,t){return"tile"===t.type||"map-image"===t.type}let P=class extends r{constructor(e){super(e),this._featuresResolutions=new WeakMap,this.highlightGraphics=null,this.highlightGraphicUpdated=null,this.updateHighlightedFeatures=a(async e=>{this.destroyed||this.updatingHandles.addPromise(this._updateHighlightedFeaturesGeometries(e).catch(()=>{}))})}initialize(){const e=e=>{for(const t of e){const{sourceLayer:e}=t;null!=e&&"geometryType"in e&&"point"===e.geometryType&&t.visible&&(t.visible=!1,this.highlightGraphicUpdated?.({graphic:t,property:"visible",oldValue:!0,newValue:!1}))}this.updatingHandles.addPromise(this._updateHighlightedFeaturesSymbols(e).catch(()=>{})),this.updateHighlightedFeatures(this._highlightGeometriesResolution)};this.addHandles([n(()=>this.highlightGraphics,"change",t=>e(t.added),{onListenerAdd:t=>e(t)})])}async fetchPopupFeaturesAtLocation(e,t){const{layerView:{layer:r,view:{scale:i}}}=this;if(!e)throw new s("fetchPopupFeatures:invalid-area","Nothing to fetch without area",{layer:r});const o=G(r.sublayers,i,t);if(!o.length)return[];const a=await U(r,o);if(!((r.capabilities?.operations?.supportsIdentify??!0)&&r.version>=10.5)&&!a)throw new s("fetchPopupFeatures:not-supported","query operation is disabled for this service",{layer:r});return a?this._fetchPopupFeaturesUsingQueries(e,o,t):this._fetchPopupFeaturesUsingIdentify(e,o,t)}clearHighlights(){this.highlightGraphics?.removeAll()}async _updateHighlightedFeaturesSymbols(e){for(const t of e)this._updateSymbology(t)}_updateSymbology(e){if("point"===e.geometry?.type)return this._updatePointSymbology(e)}_setGraphicSymbol(e,t){if(!t)return;const r=e.symbol;e.symbol=t,this.highlightGraphicUpdated?.({graphic:e,property:"symbol",oldValue:r,newValue:t})}_updatePointSymbology(e){const r=e.sourceLayer&&"renderer"in e.sourceLayer&&e.sourceLayer.renderer,{highlightGraphicUpdated:i,highlightGraphics:s,layerView:{view:o}}=this,a=e=>{e.visible||(e.visible=!0,i?.({graphic:e,property:"visible",oldValue:!1,newValue:!0}))};r&&"getSymbolAsync"in r?r.getSymbolAsync(e).then(async i=>{i||=new x;let l=null;const n="visualVariables"in r?r.visualVariables?.find(e=>"size"===e.type):void 0;n&&(F||(F=(await import("../../../renderers/visualVariables/support/visualVariableUtils.js")).getSize),l=F(n,e,{view:o.type,scale:o.scale,shape:"simple-marker"===i.type?i.style:null})),l||="width"in i&&"height"in i&&null!=i.width&&null!=i.height?Math.max(i.width,i.height):"size"in i?i.size:16,s?.includes(e)&&(this._setGraphicSymbol(e,new x({style:"square",size:l,color:new t([255,255,255,1/255]),xoffset:"xoffset"in i?i.xoffset:0,yoffset:"yoffset"in i?i.yoffset:0})),a(e))}):a(e)}async _updateHighlightedFeaturesGeometries(e){const{layerView:{layer:t,view:r},highlightGraphics:i,highlightGraphicUpdated:s}=this;if(this._highlightGeometriesResolution=e,!s||!i?.length||!t.capabilities.operations.supportsQuery)return;const a=this._getTargetResolution(e),l=new Map;for(const c of i)if(!this._featuresResolutions.has(c)||this._featuresResolutions.get(c)>a){const e=c.sourceLayer;o(l,e,()=>new Map).set(c.getObjectId(),c)}const n=Array.from(l,([e,t])=>{const i=e.createQuery();return i.objectIds=[...t.keys()],i.outFields=[e.objectIdField],i.returnGeometry=!0,i.maxAllowableOffset=a,i.outSpatialReference=r.spatialReference,e.queryFeatures(i)}),p=await Promise.all(n);if(!this.destroyed)for(const{features:o}of p)for(const e of o){const t=e.sourceLayer,r=l.get(t).get(e.getObjectId());if(r&&i.includes(r)){const t=r.geometry;r.geometry=e.geometry,s({graphic:r,property:"geometry",oldValue:t,newValue:r.geometry}),this._featuresResolutions.set(r,a)}}}_getTargetResolution(e){const t=e*c(this.layerView.view.spatialReference),r=t/16;return r<=10?0:e/t*r}async _fetchPopupFeaturesUsingIdentify(e,t,r){const i=await this._createIdentifyParameters(e,t,r);if(null==i)return[];const{results:s}=await b(this.layerView.layer.parsedUrl,i,r);return s.map(e=>e.feature)}async _createIdentifyParameters(e,t,r){const{floors:i,layer:s,timeExtent:o,view:{spatialReference:a,scale:l}}=this.layerView;if(!t.length)return null;await Promise.all(t.map(({sublayer:e})=>e.load(r).catch(()=>{})));const n=Math.min(has("mapservice-popup-identify-max-tolerance"),s.allSublayers.reduce((e,t)=>t.renderer?g({renderer:t.renderer,pointerType:r?.pointerType}):e,2)),p=this.createFetchPopupFeaturesQueryGeometry(e,n),c=m(l,a),u=Math.round(p.width/c),h=new y({xmin:p.center.x-c*u,ymin:p.center.y-c*u,xmax:p.center.x+c*u,ymax:p.center.y+c*u,spatialReference:p.spatialReference});return new w({floors:i,gdbVersion:"gdbVersion"in s?s.gdbVersion:void 0,geometry:e,height:u,layerOption:"popup",mapExtent:h,returnGeometry:!0,spatialReference:a,sublayers:s.sublayers,timeExtent:o,tolerance:n,width:u})}async _fetchPopupFeaturesUsingQueries(e,t,r){const{layerView:{floors:s,timeExtent:o}}=this,a=t.map(async({sublayer:t,popupTemplate:i})=>{if(await t.load(r).catch(()=>{}),t.capabilities&&!t.capabilities.operations.supportsQuery)return[];const a=t.createQuery(),n=g({renderer:t.renderer,pointerType:r?.pointerType}),c=this.createFetchPopupFeaturesQueryGeometry(e,n),u=new Set,[h]=await Promise.all([j(t,i),t.renderer?.collectRequiredFields(u,t.fieldsIndex)]);l(r),d(u,t.fieldsIndex,h);const y=Array.from(u).sort();a.geometry=c,a.outFields=y,a.timeExtent=o;const m=f(s,t);if(a.where=p(a.where,m),t.capabilities?.query.supportsOrderBy&&t.orderBy?.[0]){const e=t.orderBy[0],r=!e.valueExpression&&e.field,i="ascending"===e.order?"asc":"desc";r&&(a.orderByFields=[`${r} ${i}`])}const b=this._getTargetResolution(c.width/n),w=await V(i);l(r);const v="point"===t.geometryType||w&&w.arcadeUtils.hasGeometryOperations(i);v||(a.maxAllowableOffset=b);let{features:x}=await t.queryFeatures(a,r);const S=v?0:b;x=await R(t,x,r);for(const e of x)this._featuresResolutions.set(e,S);return x});return(await Promise.allSettled(a)).reduce((e,t)=>"fulfilled"===t.status?[...e,...t.value]:e,[]).filter(i)}};function G(e,t,r){const i=[];if(!e)return i;const s=e=>{const o=0===e.minScale||t<=e.minScale,a=0===e.maxScale||t>=e.maxScale;if(e.visible&&o&&a)if(e.sublayers)e.sublayers.forEach(s);else if(e.popupEnabled){const t=S(e,{...r,defaultPopupTemplateEnabled:!1});null!=t&&i.unshift({sublayer:e,popupTemplate:t})}};return e.map(s),i}function V(e){return e.expressionInfos?.length||Array.isArray(e.content)&&e.content.some(e=>"expression"===e.type)?v():Promise.resolve()}async function U(e,t){if(e.capabilities?.operations?.supportsQuery)return!0;try{return await Promise.any(t.map(({sublayer:e})=>e.load().then(()=>e.capabilities.operations.supportsQuery)))}catch{return!1}}async function R(e,t,r){const i=e.renderer;return i&&"defaultSymbol"in i&&!i.defaultSymbol&&(t=i.valueExpression?await Promise.all(t.map(e=>i.getSymbolAsync(e,r).then(t=>t?e:null))).then(e=>e.filter(e=>null!=e)):t.filter(e=>null!=i.getSymbol(e))),t}e([u({constructOnly:!0})],P.prototype,"createFetchPopupFeaturesQueryGeometry",void 0),e([u({constructOnly:!0})],P.prototype,"layerView",void 0),e([u({constructOnly:!0})],P.prototype,"highlightGraphics",void 0),e([u({constructOnly:!0})],P.prototype,"highlightGraphicUpdated",void 0),e([u({constructOnly:!0})],P.prototype,"updatingHandles",void 0),P=e([h("esri.views.layers.support.MapServiceLayerViewHelper")],P);export{P as MapServiceLayerViewHelper,G as collectPopupProviders,_ as isMapServiceLayerView};
5
+ import{__decorate as e}from"tslib";import t from"../../../Color.js";import r from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Error.js";import has from"../../../core/has.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{debounce as a,throwIfAborted as l}from"../../../core/promiseUtils.js";import{on as n}from"../../../core/reactiveUtils.js";import{sqlAnd as p}from"../../../core/sql.js";import{getMetersPerUnitForSR as c}from"../../../core/unitUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import y from"../../../geometry/Extent.js";import{getResolutionForScale as m}from"../../../geometry/support/scaleUtils.js";import{collectFields as d}from"../../../layers/support/fieldUtils.js";import{getLayerFloorFilterClause as f}from"../../../layers/support/floorFilterUtils.js";import{calculateTolerance as g}from"../../../renderers/support/clickToleranceUtils.js";import{identify as b}from"../../../rest/identify.js";import w from"../../../rest/support/IdentifyParameters.js";import{loadArcade as v}from"../../../support/loadArcade.js";import x from"../../../symbols/SimpleMarkerSymbol.js";import{getRequiredFields as j,getFetchPopupTemplate as S}from"./popupUtils.js";let F=null;function _(e,t){return"tile"===t.type||"map-image"===t.type}let P=class extends r{constructor(e){super(e),this._featuresResolutions=new WeakMap,this.highlightGraphics=null,this.highlightGraphicUpdated=null,this.updateHighlightedFeatures=a(async e=>{this.destroyed||await this.updatingHandles.addPromise(this._updateHighlightedFeaturesGeometries(e).catch(()=>{}))})}initialize(){const e=e=>{for(const t of e){const{sourceLayer:e}=t;null!=e&&"geometryType"in e&&"point"===e.geometryType&&t.visible&&(t.visible=!1,this.highlightGraphicUpdated?.({graphic:t,property:"visible",oldValue:!0,newValue:!1}))}this.updatingHandles.addPromise(this._updateHighlightedFeaturesSymbols(e).catch(()=>{})),this.updateHighlightedFeatures(this._highlightGeometriesResolution)};this.addHandles([n(()=>this.highlightGraphics,"change",t=>e(t.added),{onListenerAdd:t=>e(t)})])}async fetchPopupFeaturesAtLocation(e,t){const{layerView:{layer:r,view:{scale:i}}}=this;if(!e)throw new s("fetchPopupFeatures:invalid-area","Nothing to fetch without area",{layer:r});const o=G(r.sublayers,i,t);if(!o.length)return[];const a=await U(r,o);if(!((r.capabilities?.operations?.supportsIdentify??!0)&&r.version>=10.5)&&!a)throw new s("fetchPopupFeatures:not-supported","query operation is disabled for this service",{layer:r});return a?this._fetchPopupFeaturesUsingQueries(e,o,t):this._fetchPopupFeaturesUsingIdentify(e,o,t)}clearHighlights(){this.highlightGraphics?.removeAll()}async _updateHighlightedFeaturesSymbols(e){for(const t of e)this._updateSymbology(t)}_updateSymbology(e){if("point"===e.geometry?.type)return this._updatePointSymbology(e)}_setGraphicSymbol(e,t){if(!t)return;const r=e.symbol;e.symbol=t,this.highlightGraphicUpdated?.({graphic:e,property:"symbol",oldValue:r,newValue:t})}_updatePointSymbology(e){const r=e.sourceLayer&&"renderer"in e.sourceLayer&&e.sourceLayer.renderer,{highlightGraphicUpdated:i,highlightGraphics:s,layerView:{view:o}}=this,a=e=>{e.visible||(e.visible=!0,i?.({graphic:e,property:"visible",oldValue:!1,newValue:!0}))};r&&"getSymbolAsync"in r?r.getSymbolAsync(e).then(async i=>{i||=new x;let l=null;const n="visualVariables"in r?r.visualVariables?.find(e=>"size"===e.type):void 0;n&&(F||(F=(await import("../../../renderers/visualVariables/support/visualVariableUtils.js")).getSize),l=F(n,e,{view:o.type,scale:o.scale,shape:"simple-marker"===i.type?i.style:null})),l||="width"in i&&"height"in i&&null!=i.width&&null!=i.height?Math.max(i.width,i.height):"size"in i?i.size:16,s?.includes(e)&&(this._setGraphicSymbol(e,new x({style:"square",size:l,color:new t([255,255,255,1/255]),xoffset:"xoffset"in i?i.xoffset:0,yoffset:"yoffset"in i?i.yoffset:0})),a(e))}):a(e)}async _updateHighlightedFeaturesGeometries(e){const{layerView:{layer:t,view:r},highlightGraphics:i,highlightGraphicUpdated:s}=this;if(this._highlightGeometriesResolution=e,!s||!i?.length||!t.capabilities.operations.supportsQuery)return;const a=this._getTargetResolution(e),l=new Map;for(const c of i)if(!this._featuresResolutions.has(c)||this._featuresResolutions.get(c)>a){const e=c.sourceLayer;o(l,e,()=>new Map).set(c.getObjectId(),c)}const n=Array.from(l,([e,t])=>{const i=e.createQuery();return i.objectIds=[...t.keys()],i.outFields=[e.objectIdField],i.returnGeometry=!0,i.maxAllowableOffset=a,i.outSpatialReference=r.spatialReference,e.queryFeatures(i)}),p=await Promise.all(n);if(!this.destroyed)for(const{features:o}of p)for(const e of o){const t=e.sourceLayer,r=l.get(t).get(e.getObjectId());if(r&&i.includes(r)){const t=r.geometry;r.geometry=e.geometry,s({graphic:r,property:"geometry",oldValue:t,newValue:r.geometry}),this._featuresResolutions.set(r,a)}}}_getTargetResolution(e){const t=e*c(this.layerView.view.spatialReference),r=t/16;return r<=10?0:e/t*r}async _fetchPopupFeaturesUsingIdentify(e,t,r){const i=await this._createIdentifyParameters(e,t,r);if(null==i)return[];const{results:s}=await b(this.layerView.layer.parsedUrl,i,r);return s.map(e=>e.feature)}async _createIdentifyParameters(e,t,r){const{floors:i,layer:s,timeExtent:o,view:{spatialReference:a,scale:l}}=this.layerView;if(!t.length)return null;await Promise.all(t.map(({sublayer:e})=>e.load(r).catch(()=>{})));const n=Math.min(has("mapservice-popup-identify-max-tolerance"),s.allSublayers.reduce((e,t)=>t.renderer?g({renderer:t.renderer,pointerType:r?.pointerType}):e,2)),p=this.createFetchPopupFeaturesQueryGeometry(e,n),c=m(l,a),u=Math.round(p.width/c),h=new y({xmin:p.center.x-c*u,ymin:p.center.y-c*u,xmax:p.center.x+c*u,ymax:p.center.y+c*u,spatialReference:p.spatialReference});return new w({floors:i,gdbVersion:"gdbVersion"in s?s.gdbVersion:void 0,geometry:e,height:u,layerOption:"popup",mapExtent:h,returnGeometry:!0,spatialReference:a,sublayers:s.sublayers,timeExtent:o,tolerance:n,width:u})}async _fetchPopupFeaturesUsingQueries(e,t,r){const{layerView:{floors:s,timeExtent:o}}=this,a=t.map(async({sublayer:t,popupTemplate:i})=>{if(await t.load(r).catch(()=>{}),t.capabilities&&!t.capabilities.operations.supportsQuery)return[];const a=t.createQuery(),n=g({renderer:t.renderer,pointerType:r?.pointerType}),c=this.createFetchPopupFeaturesQueryGeometry(e,n),u=new Set,[h]=await Promise.all([j(t,i),t.renderer?.collectRequiredFields(u,t.fieldsIndex)]);l(r),d(u,t.fieldsIndex,h);const y=Array.from(u).sort();a.geometry=c,a.outFields=y,a.timeExtent=o;const m=f(s,t);if(a.where=p(a.where,m),t.capabilities?.query.supportsOrderBy&&t.orderBy?.[0]){const e=t.orderBy[0],r=!e.valueExpression&&e.field,i="ascending"===e.order?"asc":"desc";r&&(a.orderByFields=[`${r} ${i}`])}const b=this._getTargetResolution(c.width/n),w=await V(i);l(r);const v="point"===t.geometryType||w&&w.arcadeUtils.hasGeometryOperations(i);v||(a.maxAllowableOffset=b);let{features:x}=await t.queryFeatures(a,r);const S=v?0:b;x=await R(t,x,r);for(const e of x)this._featuresResolutions.set(e,S);return x});return(await Promise.allSettled(a)).reduce((e,t)=>"fulfilled"===t.status?[...e,...t.value]:e,[]).filter(i)}};function G(e,t,r){const i=[];if(!e)return i;const s=e=>{const o=0===e.minScale||t<=e.minScale,a=0===e.maxScale||t>=e.maxScale;if(e.visible&&o&&a)if(e.sublayers)e.sublayers.forEach(s);else if(e.popupEnabled){const t=S(e,{...r,defaultPopupTemplateEnabled:!1});null!=t&&i.unshift({sublayer:e,popupTemplate:t})}};return e.map(s),i}function V(e){return e.expressionInfos?.length||Array.isArray(e.content)&&e.content.some(e=>"expression"===e.type)?v():Promise.resolve()}async function U(e,t){if(e.capabilities?.operations?.supportsQuery)return!0;try{return await Promise.any(t.map(({sublayer:e})=>e.load().then(()=>e.capabilities.operations.supportsQuery)))}catch{return!1}}async function R(e,t,r){const i=e.renderer;return i&&"defaultSymbol"in i&&!i.defaultSymbol&&(t=i.valueExpression?await Promise.all(t.map(e=>i.getSymbolAsync(e,r).then(t=>t?e:null))).then(e=>e.filter(e=>null!=e)):t.filter(e=>null!=i.getSymbol(e))),t}e([u({constructOnly:!0})],P.prototype,"createFetchPopupFeaturesQueryGeometry",void 0),e([u({constructOnly:!0})],P.prototype,"layerView",void 0),e([u({constructOnly:!0})],P.prototype,"highlightGraphics",void 0),e([u({constructOnly:!0})],P.prototype,"highlightGraphicUpdated",void 0),e([u({constructOnly:!0})],P.prototype,"updatingHandles",void 0),P=e([h("esri.views.layers.support.MapServiceLayerViewHelper")],P);export{P as MapServiceLayerViewHelper,G as collectPopupProviders,_ as isMapServiceLayerView};