@arcgis/core 4.34.0-next.55 → 4.34.0-next.56

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 (118) hide show
  1. package/WebScene.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/0a4586e596413ef7a4b5.js +1 -0
  4. package/assets/esri/core/workers/chunks/{62ade6f18b375795ddfd.js → 10b46438885916d18425.js} +1 -1
  5. package/assets/esri/core/workers/chunks/1166ed298cf5ca7ad444.js +1 -0
  6. package/assets/esri/core/workers/chunks/13797036850dcc3671c3.js +1 -0
  7. package/assets/esri/core/workers/chunks/{c9c109d43a1e5160955d.js → 3490d47cac7c8dec70cd.js} +2 -2
  8. package/assets/esri/core/workers/chunks/43a56c8fa4e5be18c12a.js +1 -0
  9. package/assets/esri/core/workers/chunks/4b58da6cb91f7bf6af8b.js +1 -0
  10. package/assets/esri/core/workers/chunks/{cac060a187f3a27a19ba.js → 4d5abcf57a6ded4750ba.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{d0bf1fc6e3c198bc565d.js → 57486b18421a3c9690d0.js} +1 -1
  12. package/assets/esri/core/workers/chunks/5f518931a660b3c4f519.js +1 -0
  13. package/assets/esri/core/workers/chunks/66f3659ba18f92cd623e.js +1 -0
  14. package/assets/esri/core/workers/chunks/67355372ac5fd8a15d18.js +1 -0
  15. package/assets/esri/core/workers/chunks/{5691d504ffe5592bc40f.js → 6dc0009889f2b7cc8cff.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{4d2473e680324dc17cfa.js → 853b9f29b4d62fa621b9.js} +1 -1
  17. package/assets/esri/core/workers/chunks/855f25ce748aaef44b1a.js +1 -0
  18. package/assets/esri/core/workers/chunks/{71acded1b3c0057917a1.js → 862fe2f96d4b777ff5b8.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{fe5c37c69da3ec1e56ac.js → 8fa50cac57b6e1ecec76.js} +1 -1
  20. package/assets/esri/core/workers/chunks/9307108821d82c131654.js +1 -0
  21. package/assets/esri/core/workers/chunks/9b10e70f28873cff44f5.js +1 -0
  22. package/assets/esri/core/workers/chunks/{3b51b61a7b8a1ef87c9b.js → adf11d31f95481f89a55.js} +1 -1
  23. package/assets/esri/core/workers/chunks/af4412e79275c5a87539.js +1 -0
  24. package/assets/esri/core/workers/chunks/{7a8d740d1226719a578a.js → b457b7dd907f06278bee.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{81e518dd62bd95611d00.js → b47688e3263099540873.js} +1 -1
  26. package/assets/esri/core/workers/chunks/c91217d977a6baaee74a.js +1 -0
  27. package/assets/esri/core/workers/chunks/{e1b25b1ce3bd4f0f2cda.js → cb57cdff976d2d4b0b41.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{9fef330b241f958b55df.js → d0124b0dd62b331afe58.js} +1 -1
  29. package/assets/esri/core/workers/chunks/d3a7747f23e91d1f1b5e.js +1 -0
  30. package/assets/esri/core/workers/chunks/d3ae88fcde2d7fb3e2e2.js +1 -0
  31. package/assets/esri/core/workers/chunks/{b6a201e86f9caef45ff0.js → d42fd0effc560eefb14b.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{4f8dab492331c9a2d67a.js → d87fdc64a5cc6be4bd69.js} +1 -1
  33. package/assets/esri/core/workers/chunks/db5d3feeb61ccb5ede98.js +1 -0
  34. package/assets/esri/core/workers/chunks/{aab349d4624b78ef429f.js → e6bf4f3f6868dc9028e3.js} +1 -1
  35. package/assets/esri/core/workers/chunks/f74b0cdc1c2b56bac5f0.js +1 -0
  36. package/assets/esri/core/workers/chunks/f807e7fc90e0e7ce6b67.js +1 -0
  37. package/assets/esri/core/workers/chunks/{fae6030a81cb91a91b69.js → faf4002f9547a0cc4e33.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{fe55833c80cf59df9c2b.js → ff42b24b48019a03d841.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{e10c5405f956b2cc59e4.js → ff4e15a872de94d2b438.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{ff7962063d132c1ec814.js → ff8a4bf1bceb362d67ab.js} +1 -1
  41. package/config.js +1 -1
  42. package/core/has.js +1 -1
  43. package/geometry/Multipoint.js +1 -1
  44. package/geometry/support/coordsUtils.js +1 -1
  45. package/geometry/support/extentUtils.js +1 -1
  46. package/graphic/KMLGraphicOrigin.js +5 -0
  47. package/graphic/isKMLGraphicOrigin.js +5 -0
  48. package/interfaces.d.ts +6 -3
  49. package/kernel.js +1 -1
  50. package/layers/KMLLayer.js +1 -1
  51. package/layers/SceneLayer.js +1 -1
  52. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  53. package/layers/support/ElevationQuery.js +1 -1
  54. package/layers/support/KMLSublayer.js +1 -1
  55. package/layers/support/featureReductionUtils.js +1 -1
  56. package/layers/support/kmlUtils.js +1 -1
  57. package/package.json +1 -1
  58. package/renderers/support/colorRampUtils.js +1 -1
  59. package/support/requestUtils.js +1 -1
  60. package/support/revision.js +1 -1
  61. package/views/2d/layers/KMLLayerView2D.js +1 -1
  62. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  63. package/views/3d/analysis/Viewshed/{ArrowManipulator.js → ViewshedArrowManipulator.js} +1 -1
  64. package/views/3d/analysis/Viewshed/{FieldOfViewManipulation.js → ViewshedFieldOfViewManipulation.js} +1 -1
  65. package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +5 -0
  66. package/views/3d/analysis/Viewshed/ViewshedShapeVisualElement.js +5 -0
  67. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  68. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +5 -0
  69. package/views/3d/analysis/Viewshed/ViewshedVisualization.js +1 -1
  70. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  71. package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
  72. package/views/draw/DrawOperation.js +1 -1
  73. package/views/draw/MultipointDrawAction.js +1 -1
  74. package/views/draw/PointDrawAction.js +1 -1
  75. package/views/draw/PolygonDrawAction.js +1 -1
  76. package/views/draw/PolylineDrawAction.js +1 -1
  77. package/views/draw/SegmentDrawAction.js +1 -1
  78. package/views/draw/support/Box.js +1 -1
  79. package/views/draw/support/GraphicMover.js +1 -1
  80. package/views/draw/support/Reshape.js +1 -1
  81. package/views/draw/support/drawUtils.js +1 -1
  82. package/views/draw/support/reshapeTooltipUtils.js +1 -1
  83. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  84. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  85. package/views/interactive/editGeometry/operations/AppendVertex.js +1 -1
  86. package/views/interactive/tooltip/infos/SelectedVertexTooltipInfo.js +1 -1
  87. package/webscene/spec-certification/api.js +1 -1
  88. package/webscene/spec-certification/compare.js +1 -1
  89. package/webscene/spec-certification/spec.js +1 -1
  90. package/widgets/ElevationProfile/support/profileUtils.js +1 -1
  91. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  92. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  93. package/widgets/OrientedImageryViewer.js +1 -1
  94. package/widgets/Sketch/SketchViewModel.js +1 -1
  95. package/widgets/Sketch/support/sketchUtils.js +1 -1
  96. package/assets/esri/core/workers/chunks/02902303e5585a16ebea.js +0 -1
  97. package/assets/esri/core/workers/chunks/0445de3a8968c0734c91.js +0 -1
  98. package/assets/esri/core/workers/chunks/09268dc856c3d5ce178f.js +0 -1
  99. package/assets/esri/core/workers/chunks/0f51e51db83f303ce5a6.js +0 -1
  100. package/assets/esri/core/workers/chunks/17776d9d3558d45ea7b5.js +0 -1
  101. package/assets/esri/core/workers/chunks/1cbd59918c60a1a21494.js +0 -1
  102. package/assets/esri/core/workers/chunks/252ee00fd6c4ae0ee7fa.js +0 -1
  103. package/assets/esri/core/workers/chunks/3800764932a1c32cb29f.js +0 -1
  104. package/assets/esri/core/workers/chunks/3c57b2e13628b5c1f6de.js +0 -1
  105. package/assets/esri/core/workers/chunks/772e81e9162e2240a7a6.js +0 -1
  106. package/assets/esri/core/workers/chunks/8c81156b1605a16acc29.js +0 -1
  107. package/assets/esri/core/workers/chunks/8f6ff09e7d2f01b79faf.js +0 -1
  108. package/assets/esri/core/workers/chunks/998c38974372720b1c52.js +0 -1
  109. package/assets/esri/core/workers/chunks/a7530dcb08b43e37bbb2.js +0 -1
  110. package/assets/esri/core/workers/chunks/c51e2a048df152abd901.js +0 -1
  111. package/assets/esri/core/workers/chunks/d1842745a7699879a1e1.js +0 -1
  112. package/assets/esri/core/workers/chunks/d578c3880eaf2dd62324.js +0 -1
  113. package/assets/esri/core/workers/chunks/de499e33035b56b6697d.js +0 -1
  114. package/assets/esri/core/workers/chunks/e04951ee32f041faaeca.js +0 -1
  115. package/views/3d/analysis/Viewshed/ScaleOrientManipulation.js +0 -5
  116. package/views/3d/analysis/Viewshed/ViewshedAnalysisVisualization.js +0 -5
  117. package/views/3d/interactive/visualElements/ViewshedShapeVisualElement.js +0 -5
  118. /package/assets/esri/core/workers/chunks/{c9c109d43a1e5160955d.js.LICENSE.txt → 3490d47cac7c8dec70cd.js.LICENSE.txt} +0 -0
@@ -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{result as e}from"../../core/asyncUtils.js";import t from"../../core/Error.js";import{assertIsSome as i}from"../../core/maybe.js";import{whenOrAbort as n,throwIfAbortError as o}from"../../core/promiseUtils.js";import{getMetersPerUnitForSR as l}from"../../core/unitUtils.js";import s from"../../geometry/Multipoint.js";import a from"../../geometry/Point.js";import r from"../../geometry/Polyline.js";import{initializeProjection as c,project as u}from"../../geometry/projectionUtils.js";import{fromExtent as h,create as f,contains as m}from"../../geometry/support/aaBoundingRect.js";import{MultiTileElevationSampler as p}from"./ElevationSampler.js";import{ElevationTile as d}from"./ElevationTile.js";import{TileKey as y}from"./TileKey.js";class T{async queryAll(e,i,n){if(!(e=n?.ignoreInvisibleLayers?e.filter(e=>e.visible):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");const o=v.fromGeometry(i);let l=!1;n?.returnSampleInfo||(l=!0);const s={...R,...n,returnSampleInfo:!0},a=await this.query(e[e.length-1],o,s),r=await this._queryAllContinue(e,a,s);return r.geometry=r.geometry.export(),l&&delete r.sampleInfo,r}async query(e,i,n){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||!(i instanceof v)&&"point"!==i.type&&"multipoint"!==i.type&&"polyline"!==i.type)throw new t("elevation-query:invalid-geometry","Only point, polyline and multipoint geometries can be used to query elevation");const o={...R,...n},l=new x(e,i.spatialReference,o),s=o.signal;return await e.load({signal:s}),await q(l,i,s),await this._selectTiles(l,s),await F(l,s),b(l),z(l,s)}async createSampler(e,i,n){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const o={...R,...n};return this._createSampler(e,i,o)}async createSamplerAll(e,i,n){if(!(e=n?.ignoreInvisibleLayers?e.filter(e=>e.visible):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const o={...R,...n,returnSampleInfo:!0},l=await this._createSampler(e[e.length-1],i,o);return this._createSamplerAllContinue(e,i,l,o)}async _createSampler(e,t,i,n){const o=i.signal;await e.load({signal:o});const l=t.spatialReference,s=e.tileInfo.spatialReference;l.equals(s)||(await c([{source:l,dest:s}],{signal:o}),t=u(t,s));const a=new _(e,t,i,n);return await this._selectTiles(a,o),await F(a,o),new p(a.elevationTiles,a.layer.tileInfo,a.options.noDataValue)}async _createSamplerAllContinue(e,t,i,n){if(e.pop(),!e.length)return i;const o=i.samplers.filter(e=>!e.tile.hasNoDataValues).map(e=>h(e.extent)),l=await this._createSampler(e[e.length-1],t,n,o);if(0===l.samplers.length)return i;const s=i.samplers.concat(l.samplers),a=new p(s,n.noDataValue);return this._createSamplerAllContinue(e,t,a,n)}async _queryAllContinue(e,t,n){const o=e.pop(),l=t.geometry.coordinates,s=t.sampleInfo;i(s);const a=[],r=[];for(let i=0;i<l.length;i++){const t=s[i];t.demResolution>=0?t.source||(t.source=o):e.length&&(a.push(l[i]),r.push(i))}if(!e.length||0===a.length)return t;const c=t.geometry.clone(a),u=await this.query(e[e.length-1],c,n),h=u.sampleInfo;if(!h)throw new Error("no sampleInfo");return r.forEach((e,t)=>{l[e].z=u.geometry.coordinates[t].z,s[e].demResolution=h[t].demResolution}),this._queryAllContinue(e,t,n)}async _selectTiles(e,i){"geometry"===e.type&&I(e);const n=e.options.demResolution;if("number"==typeof n)C(e,n);else if("finest-contiguous"===n)await this._selectTilesFinestContiguous(e,i);else{if("auto"!==n)throw new t("elevation-query:invalid-dem-resolution",`Invalid dem resolution value '${n}', expected a number, "finest-contiguous" or "auto"`);await this._selectTilesAuto(e,i)}}async _selectTilesFinestContiguous(e,t){const{tileInfo:i,tilemapCache:n}=e.layer,o=E(i,n,e.options.minDemResolution);await this._selectTilesFinestContiguousAt(e,o,t)}async _selectTilesFinestContiguousAt(e,i,l){const s=e.layer;if(e.selectTilesAtLOD(i),i<0)return;const a=s.tilemapCache,r=e.getTilesToFetch();try{if(a&&!L(a))await n(Promise.all(r.map(e=>a.fetchAvailability(e.level,e.row,e.col,{signal:l}))),l);else if(await F(e,l),!e.allElevationTilesFetched())throw e.clearElevationTiles(),new t("elevation-query:has-unavailable-tiles","Some elevation tiles are unavailable")}catch(c){o(c),await this._selectTilesFinestContiguousAt(e,i-1,l)}}async _selectTilesAuto(t,i){M(t),S(t);const l=t.layer.tilemapCache;if(!l||L(l))return this._selectTilesAutoPrefetchUpsample(t,i);const s=t.getTilesToFetch(),a={},r=s.map(async t=>{const n=new y(null,0,0,0,f()),s=await e(l.fetchAvailabilityUpsample(t.level,t.row,t.col,n,{signal:i}));!1!==s.ok?null!=t.id&&(a[t.id]=n):o(s.error)});await n(Promise.all(r),i),t.remapTiles(a)}async _selectTilesAutoPrefetchUpsample(e,t){const i=e.layer.tileInfo;await F(e,t);let n=!1;e.forEachTileToFetch((e,t)=>{i.upsampleTile(e)?n=!0:t()}),n&&await this._selectTilesAutoPrefetchUpsample(e,t)}}class v{export(){return this._exporter(this.coordinates,this.spatialReference)}clone(e){const t=new v;return t.geometry=this.geometry,t.spatialReference=this.spatialReference,t.coordinates=e||this.coordinates.map(e=>e.clone()),t._exporter=this._exporter,t}async project(e,t){if(this.spatialReference.equals(e))return this.clone();await c([{source:this.spatialReference,dest:e}],{signal:t});const i=new s({spatialReference:this.spatialReference,points:this.coordinates.map(e=>[e.x,e.y])}),n=u(i,e);if(!n)return null;const o=this.coordinates.map((e,t)=>{const i=e.clone(),o=n.points[t];return i.x=o[0],i.y=o[1],i}),l=this.clone(o);return l.spatialReference=e,l}static fromGeometry(e){const t=new v;if(t.geometry=e,t.spatialReference=e.spatialReference,e instanceof v)t.coordinates=e.coordinates.map(e=>e.clone()),t._exporter=(t,i)=>{const n=e.clone(t);return n.spatialReference=i,n};else switch(e.type){case"point":{const i=e,{hasZ:n,hasM:o}=i;t.coordinates=n&&o?[new w(i.x,i.y,i.z,i.m)]:n?[new w(i.x,i.y,i.z)]:o?[new w(i.x,i.y,null,i.m)]:[new w(i.x,i.y)],t._exporter=(t,i)=>e.hasM?new a(t[0].x,t[0].y,t[0].z,t[0].m,i):new a(t[0].x,t[0].y,t[0].z,i);break}case"multipoint":{const i=e,{hasZ:n,hasM:o}=i;t.coordinates=n&&o?i.points.map(e=>new w(e[0],e[1],e[2],e[3])):n?i.points.map(e=>new w(e[0],e[1],e[2])):o?i.points.map(e=>new w(e[0],e[1],null,e[2])):i.points.map(e=>new w(e[0],e[1])),t._exporter=(t,i)=>e.hasM?new s({points:t.map(e=>[e.x,e.y,e.z,e.m]),hasZ:!0,hasM:!0,spatialReference:i}):new s(t.map(e=>[e.x,e.y,e.z]),i);break}case"polyline":{const i=e,n=[],o=[],{hasZ:l,hasM:s}=e;let a=0;for(const e of i.paths)if(o.push([a,a+e.length]),a+=e.length,l&&s)for(const t of e)n.push(new w(t[0],t[1],t[2],t[3]));else if(l)for(const t of e)n.push(new w(t[0],t[1],t[2]));else if(s)for(const t of e)n.push(new w(t[0],t[1],null,t[2]));else for(const t of e)n.push(new w(t[0],t[1]));t.coordinates=n,t._exporter=(t,i)=>{const n=e.hasM?t.map(e=>[e.x,e.y,e.z??0,e.m??0]):t.map(e=>[e.x,e.y,e.z??0]),l=o.map(e=>n.slice(e[0],e[1]));return new r({paths:l,hasM:e.hasM,hasZ:!0,spatialReference:i})};break}}return t}}class w{constructor(e,t,i=null,n=null,o=null,l=null){this.x=e,this.y=t,this.z=i,this.m=n,this.tile=o,this.elevationTile=l}clone(){return new w(this.x,this.y,this.z,this.m)}}class g{constructor(e,t){this.layer=e,this.options=t}}class x extends g{constructor(e,t,i){super(e,i),this.outSpatialReference=t,this.type="geometry"}selectTilesAtLOD(e){if(e<0)this.geometry.coordinates.forEach(e=>e.tile=null);else{const{tileInfo:t,tilemapCache:i}=this.layer,n=D(t,i)[e].level;this.geometry.coordinates.forEach(e=>e.tile=t.tileAt(n,e.x,e.y))}}allElevationTilesFetched(){return!this.geometry.coordinates.some(e=>!e.elevationTile)}clearElevationTiles(){for(const e of this.geometry.coordinates)e.elevationTile!==this.outsideExtentTile&&(e.elevationTile=null)}populateElevationTiles(e){for(const t of this.geometry.coordinates)!t.elevationTile&&t.tile?.id&&(t.elevationTile=e[t.tile.id])}remapTiles(e){for(const t of this.geometry.coordinates){const i=t.tile?.id;t.tile=i?e[i]:null}}getTilesToFetch(){const e={},t=[];for(const i of this.geometry.coordinates){const n=i.tile;if(!n)continue;const o=i.tile?.id;i.elevationTile||!o||e[o]||(e[o]=n,t.push(n))}return t}forEachTileToFetch(e){for(const t of this.geometry.coordinates)t.tile&&!t.elevationTile&&e(t.tile,()=>{t.tile=null})}}class _ extends g{constructor(e,t,i,n){super(e,i),this.type="extent",this.elevationTiles=[],this._candidateTiles=[],this._fetchedCandidates=new Set,this.extent=t.clone().intersection(e.fullExtent),this.maskExtents=n}selectTilesAtLOD(e,t){const i=this._maximumLodForRequests(t),n=Math.min(i,e);n<0?this._candidateTiles.length=0:this._selectCandidateTilesCoveringExtentAt(n)}_maximumLodForRequests(e){const{tileInfo:t,tilemapCache:i}=this.layer,n=D(t,i);if(!e)return n.length-1;const o=this.extent;if(null==o)return-1;for(let l=n.length-1;l>=0;l--){const i=n[l],s=i.resolution*t.size[0],a=i.resolution*t.size[1];if(Math.ceil(o.width/s)*Math.ceil(o.height/a)<=e)return l}return-1}allElevationTilesFetched(){return this._candidateTiles.length===this.elevationTiles.length}clearElevationTiles(){this.elevationTiles.length=0,this._fetchedCandidates.clear()}populateElevationTiles(e){for(const t of this._candidateTiles){const i=t.id&&e[t.id];i&&(this._fetchedCandidates.add(t),this.elevationTiles.push(i))}}remapTiles(e){this._candidateTiles=j(this._candidateTiles.map(t=>e[t.id]))}getTilesToFetch(){return this._candidateTiles}forEachTileToFetch(e,t){const i=this._candidateTiles;this._candidateTiles=[],i.forEach(i=>{if(this._fetchedCandidates.has(i))return void t?.(i);let n=!1;e(i,()=>n=!0),n?t?.(i):this._candidateTiles.push(i)}),this._candidateTiles=j(this._candidateTiles,t)}_selectCandidateTilesCoveringExtentAt(e){this._candidateTiles.length=0;const t=this.extent;if(null==t)return;const{tileInfo:i,tilemapCache:n}=this.layer,o=D(i,n)[e],l=i.tileAt(o.level,t.xmin,t.ymin),s=l.extent;if(null==s)return;const a=o.resolution*i.size[0],r=o.resolution*i.size[1],c=Math.ceil((t.xmax-s[0])/a),u=Math.ceil((t.ymax-s[1])/r);for(let h=0;h<u;h++)for(let e=0;e<c;e++){const t=new y(null,l.level,l.row-h,l.col+e);i.updateTileInfo(t),this._tileIsMasked(t)||this._candidateTiles.push(t)}}_tileIsMasked(e){return!!this.maskExtents&&this.maskExtents.some(t=>e.extent&&m(t,e.extent))}}function E(e,t,i=0){const n=D(e,t);let o=n.length-1;if(i>0){const t=i/l(e.spatialReference),s=n.findIndex(e=>e.resolution<t);0===s?o=0:s>0&&(o=s-1)}return o}const R={maximumAutoTileRequests:20,noDataValue:0,returnSampleInfo:!1,demResolution:"auto",minDemResolution:0};async function q(e,i,n){let o;const l=e.layer.tileInfo.spatialReference;if(i instanceof v?o=await i.project(l,n):(await c([{source:i.spatialReference,dest:l}],{signal:n}),o=u(i,l)),!o)throw new t("elevation-query:spatial-reference-mismatch",`Cannot query elevation in '${i.spatialReference.wkid}' on an elevation service in '${l.wkid}'`);e.geometry=v.fromGeometry(o)}function I(e){if(null==e.layer.fullExtent)return;const t=new d(null);t.sample=()=>e.options.noDataValue,e.outsideExtentTile=t;const i=e.layer.fullExtent;e.geometry.coordinates.forEach(e=>{const n=e.x,o=e.y;(n<i.xmin||n>i.xmax||o<i.ymin||o>i.ymax)&&(e.elevationTile=t)})}function A(e,t){const{tileInfo:i,tilemapCache:n}=e.layer,o=t/l(i.spatialReference),s=D(i,n);let a=s[0],r=0;for(let l=1;l<s.length;l++){const e=s[l];Math.abs(e.resolution-o)<Math.abs(a.resolution-o)&&(a=e,r=l)}return r}function C(e,t){const i=A(e,t);e.selectTilesAtLOD(i)}function M(e){const{tileInfo:t,tilemapCache:i}=e.layer,n=E(t,i,e.options.minDemResolution);e.selectTilesAtLOD(n,e.options.maximumAutoTileRequests)}function D(e,t){const i=e.lods;if(L(t)){const{effectiveMinLOD:e,effectiveMaxLOD:n}=t;return i.filter(t=>t.level>=e&&t.level<=n)}return i}async function F(e,t){const i=e.getTilesToFetch(),o={},l=e.options.cache,s=e.options.noDataValue,a=i.map(async i=>{if(null==i.id)return;const n=`${e.layer.uid}:${i.id}:${s}`,a=null!=l?l.get(n):null,r=null!=a?a:await e.layer.fetchTile(i.level,i.row,i.col,{noDataValue:s,signal:t});null!=l&&l.put(n,r),o[i.id]=new d(i,r)});await n(Promise.allSettled(a),t),e.populateElevationTiles(o)}function S(e){const t=e.layer.tileInfo;let i=0;const n={},o=e=>{null!=e.id&&(e.id in n?n[e.id]++:(n[e.id]=1,i++))},l=e=>{if(null==e.id)return;const t=n[e.id];1===t?(delete n[e.id],i--):n[e.id]=t-1};e.forEachTileToFetch(o,l);let s=!0;for(;s&&(s=!1,e.forEachTileToFetch(n=>{i<=e.options.maximumAutoTileRequests||(l(n),t.upsampleTile(n)&&(s=!0),o(n))},l),s););}function b(e){e.geometry.coordinates.forEach(t=>{const i=t.elevationTile;let n=e.options.noDataValue;if(i){const e=i.sample(t.x,t.y);null!=e?n=e:t.elevationTile=null}t.z=n})}function j(e,t){const i={},n=[];for(const l of e){const e=l.id;e&&!i[e]?(i[e]=l,n.push(l)):t?.(l)}const o=n.sort((e,t)=>e.level-t.level);return o.filter((e,i)=>{for(let n=0;n<i;n++){const i=o[n].extent;if(i&&e.extent&&m(i,e.extent))return t?.(e),!1}return!0})}async function z(e,t){const n=await e.geometry.project(e.outSpatialReference,t);i(n);const o={geometry:n.export(),noDataValue:e.options.noDataValue};return e.options.returnSampleInfo&&(o.sampleInfo=k(e)),e.geometry.coordinates.forEach(e=>{e.tile=null,e.elevationTile=null}),o}function k(e){const t=e.layer.tileInfo,i=l(t.spatialReference);return e.geometry.coordinates.map(n=>{let o=-1;if(n.elevationTile&&n.elevationTile!==e.outsideExtentTile){o=t.lodAt(n.elevationTile.tile.level).resolution*i}return{demResolution:o}})}function L(e){return null!=e?.tileInfo}export{T as ElevationQuery,v as GeometryDescriptor,E as getFinestLodIndex};
5
+ import{result as e}from"../../core/asyncUtils.js";import t from"../../core/Error.js";import{assertIsSome as i}from"../../core/maybe.js";import{whenOrAbort as n,throwIfAbortError as o}from"../../core/promiseUtils.js";import{getMetersPerUnitForSR as l}from"../../core/unitUtils.js";import s from"../../geometry/Multipoint.js";import a from"../../geometry/Point.js";import r from"../../geometry/Polyline.js";import{initializeProjection as c,project as u}from"../../geometry/projectionUtils.js";import{fromExtent as h,create as f,contains as p}from"../../geometry/support/aaBoundingRect.js";import{MultiTileElevationSampler as m}from"./ElevationSampler.js";import{ElevationTile as d}from"./ElevationTile.js";import{TileKey as y}from"./TileKey.js";class T{async queryAll(e,i,n){if(!(e=n?.ignoreInvisibleLayers?e.filter(e=>e.visible):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");const o=v.fromGeometry(i);let l=!1;n?.returnSampleInfo||(l=!0);const s={...R,...n,returnSampleInfo:!0},a=await this.query(e[e.length-1],o,s),r=await this._queryAllContinue(e,a,s);return r.geometry=r.geometry.export(),l&&delete r.sampleInfo,r}async query(e,i,n){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||!(i instanceof v)&&"point"!==i.type&&"multipoint"!==i.type&&"polyline"!==i.type)throw new t("elevation-query:invalid-geometry","Only point, polyline and multipoint geometries can be used to query elevation");const o={...R,...n},l=new x(e,i.spatialReference,o),s=o.signal;return await e.load({signal:s}),await q(l,i,s),await this._selectTiles(l,s),await F(l,s),b(l),z(l,s)}async createSampler(e,i,n){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const o={...R,...n};return this._createSampler(e,i,o)}async createSamplerAll(e,i,n){if(!(e=n?.ignoreInvisibleLayers?e.filter(e=>e.visible):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const o={...R,...n,returnSampleInfo:!0},l=await this._createSampler(e[e.length-1],i,o);return this._createSamplerAllContinue(e,i,l,o)}async _createSampler(e,t,i,n){const o=i.signal;await e.load({signal:o});const l=t.spatialReference,s=e.tileInfo.spatialReference;l.equals(s)||(await c([{source:l,dest:s}],{signal:o}),t=u(t,s));const a=new _(e,t,i,n);return await this._selectTiles(a,o),await F(a,o),new m(a.elevationTiles,a.layer.tileInfo,a.options.noDataValue)}async _createSamplerAllContinue(e,t,i,n){if(e.pop(),!e.length)return i;const o=i.samplers.filter(e=>!e.tile.hasNoDataValues).map(e=>h(e.extent)),l=await this._createSampler(e[e.length-1],t,n,o);if(0===l.samplers.length)return i;const s=i.samplers.concat(l.samplers),a=new m(s,n.noDataValue);return this._createSamplerAllContinue(e,t,a,n)}async _queryAllContinue(e,t,n){const o=e.pop(),l=t.geometry.coordinates,s=t.sampleInfo;i(s);const a=[],r=[];for(let i=0;i<l.length;i++){const t=s[i];t.demResolution>=0?t.source||(t.source=o):e.length&&(a.push(l[i]),r.push(i))}if(!e.length||0===a.length)return t;const c=t.geometry.clone(a),u=await this.query(e[e.length-1],c,n),h=u.sampleInfo;if(!h)throw new Error("no sampleInfo");return r.forEach((e,t)=>{l[e].z=u.geometry.coordinates[t].z,s[e].demResolution=h[t].demResolution}),this._queryAllContinue(e,t,n)}async _selectTiles(e,i){"geometry"===e.type&&I(e);const n=e.options.demResolution;if("number"==typeof n)C(e,n);else if("finest-contiguous"===n)await this._selectTilesFinestContiguous(e,i);else{if("auto"!==n)throw new t("elevation-query:invalid-dem-resolution",`Invalid dem resolution value '${n}', expected a number, "finest-contiguous" or "auto"`);await this._selectTilesAuto(e,i)}}async _selectTilesFinestContiguous(e,t){const{tileInfo:i,tilemapCache:n}=e.layer,o=E(i,n,e.options.minDemResolution);await this._selectTilesFinestContiguousAt(e,o,t)}async _selectTilesFinestContiguousAt(e,i,l){const s=e.layer;if(e.selectTilesAtLOD(i),i<0)return;const a=s.tilemapCache,r=e.getTilesToFetch();try{if(a&&!L(a))await n(Promise.all(r.map(e=>a.fetchAvailability(e.level,e.row,e.col,{signal:l}))),l);else if(await F(e,l),!e.allElevationTilesFetched())throw e.clearElevationTiles(),new t("elevation-query:has-unavailable-tiles","Some elevation tiles are unavailable")}catch(c){o(c),await this._selectTilesFinestContiguousAt(e,i-1,l)}}async _selectTilesAuto(t,i){M(t),S(t);const l=t.layer.tilemapCache;if(!l||L(l))return this._selectTilesAutoPrefetchUpsample(t,i);const s=t.getTilesToFetch(),a={},r=s.map(async t=>{const n=new y(null,0,0,0,f()),s=await e(l.fetchAvailabilityUpsample(t.level,t.row,t.col,n,{signal:i}));!1!==s.ok?null!=t.id&&(a[t.id]=n):o(s.error)});await n(Promise.all(r),i),t.remapTiles(a)}async _selectTilesAutoPrefetchUpsample(e,t){const i=e.layer.tileInfo;await F(e,t);let n=!1;e.forEachTileToFetch((e,t)=>{i.upsampleTile(e)?n=!0:t()}),n&&await this._selectTilesAutoPrefetchUpsample(e,t)}}class v{export(){return this._exporter(this.coordinates,this.spatialReference)}clone(e){const t=new v;return t.geometry=this.geometry,t.spatialReference=this.spatialReference,t.coordinates=e||this.coordinates.map(e=>e.clone()),t._exporter=this._exporter,t}async project(e,t){if(this.spatialReference.equals(e))return this.clone();await c([{source:this.spatialReference,dest:e}],{signal:t});const i=new s({spatialReference:this.spatialReference,points:this.coordinates.map(e=>[e.x,e.y])}),n=u(i,e);if(!n)return null;const o=this.coordinates.map((e,t)=>{const i=e.clone(),o=n.points[t];return i.x=o[0],i.y=o[1],i}),l=this.clone(o);return l.spatialReference=e,l}static fromGeometry(e){const t=new v;if(t.geometry=e,t.spatialReference=e.spatialReference,e instanceof v)t.coordinates=e.coordinates.map(e=>e.clone()),t._exporter=(t,i)=>{const n=e.clone(t);return n.spatialReference=i,n};else switch(e.type){case"point":{const i=e,{hasZ:n,hasM:o}=i;t.coordinates=n&&o?[new w(i.x,i.y,i.z,i.m)]:n?[new w(i.x,i.y,i.z)]:o?[new w(i.x,i.y,null,i.m)]:[new w(i.x,i.y)],t._exporter=(t,i)=>e.hasM?new a(t[0].x,t[0].y,t[0].z,t[0].m,i):new a(t[0].x,t[0].y,t[0].z,i);break}case"multipoint":{const i=e,{hasZ:n,hasM:o}=i;t.coordinates=n&&o?i.points.map(e=>new w(e[0],e[1],e[2],e[3])):n?i.points.map(e=>new w(e[0],e[1],e[2])):o?i.points.map(e=>new w(e[0],e[1],null,e[2])):i.points.map(e=>new w(e[0],e[1])),t._exporter=(t,i)=>e.hasM?new s({points:t.map(e=>[e.x,e.y,e.z??0,e.m??0]),hasZ:!0,hasM:!0,spatialReference:i}):new s({points:t.map(e=>[e.x,e.y,e.z??0]),spatialReference:i});break}case"polyline":{const i=e,n=[],o=[],{hasZ:l,hasM:s}=e;let a=0;for(const e of i.paths)if(o.push([a,a+e.length]),a+=e.length,l&&s)for(const t of e)n.push(new w(t[0],t[1],t[2],t[3]));else if(l)for(const t of e)n.push(new w(t[0],t[1],t[2]));else if(s)for(const t of e)n.push(new w(t[0],t[1],null,t[2]));else for(const t of e)n.push(new w(t[0],t[1]));t.coordinates=n,t._exporter=(t,i)=>{const n=e.hasM?t.map(e=>[e.x,e.y,e.z??0,e.m??0]):t.map(e=>[e.x,e.y,e.z??0]),l=o.map(e=>n.slice(e[0],e[1]));return new r({paths:l,hasM:e.hasM,hasZ:!0,spatialReference:i})};break}}return t}}class w{constructor(e,t,i=null,n=null,o=null,l=null){this.x=e,this.y=t,this.z=i,this.m=n,this.tile=o,this.elevationTile=l}clone(){return new w(this.x,this.y,this.z,this.m)}}class g{constructor(e,t){this.layer=e,this.options=t}}class x extends g{constructor(e,t,i){super(e,i),this.outSpatialReference=t,this.type="geometry"}selectTilesAtLOD(e){if(e<0)this.geometry.coordinates.forEach(e=>e.tile=null);else{const{tileInfo:t,tilemapCache:i}=this.layer,n=D(t,i)[e].level;this.geometry.coordinates.forEach(e=>e.tile=t.tileAt(n,e.x,e.y))}}allElevationTilesFetched(){return!this.geometry.coordinates.some(e=>!e.elevationTile)}clearElevationTiles(){for(const e of this.geometry.coordinates)e.elevationTile!==this.outsideExtentTile&&(e.elevationTile=null)}populateElevationTiles(e){for(const t of this.geometry.coordinates)!t.elevationTile&&t.tile?.id&&(t.elevationTile=e[t.tile.id])}remapTiles(e){for(const t of this.geometry.coordinates){const i=t.tile?.id;t.tile=i?e[i]:null}}getTilesToFetch(){const e={},t=[];for(const i of this.geometry.coordinates){const n=i.tile;if(!n)continue;const o=i.tile?.id;i.elevationTile||!o||e[o]||(e[o]=n,t.push(n))}return t}forEachTileToFetch(e){for(const t of this.geometry.coordinates)t.tile&&!t.elevationTile&&e(t.tile,()=>{t.tile=null})}}class _ extends g{constructor(e,t,i,n){super(e,i),this.type="extent",this.elevationTiles=[],this._candidateTiles=[],this._fetchedCandidates=new Set,this.extent=t.clone().intersection(e.fullExtent),this.maskExtents=n}selectTilesAtLOD(e,t){const i=this._maximumLodForRequests(t),n=Math.min(i,e);n<0?this._candidateTiles.length=0:this._selectCandidateTilesCoveringExtentAt(n)}_maximumLodForRequests(e){const{tileInfo:t,tilemapCache:i}=this.layer,n=D(t,i);if(!e)return n.length-1;const o=this.extent;if(null==o)return-1;for(let l=n.length-1;l>=0;l--){const i=n[l],s=i.resolution*t.size[0],a=i.resolution*t.size[1];if(Math.ceil(o.width/s)*Math.ceil(o.height/a)<=e)return l}return-1}allElevationTilesFetched(){return this._candidateTiles.length===this.elevationTiles.length}clearElevationTiles(){this.elevationTiles.length=0,this._fetchedCandidates.clear()}populateElevationTiles(e){for(const t of this._candidateTiles){const i=t.id&&e[t.id];i&&(this._fetchedCandidates.add(t),this.elevationTiles.push(i))}}remapTiles(e){this._candidateTiles=j(this._candidateTiles.map(t=>e[t.id]))}getTilesToFetch(){return this._candidateTiles}forEachTileToFetch(e,t){const i=this._candidateTiles;this._candidateTiles=[],i.forEach(i=>{if(this._fetchedCandidates.has(i))return void t?.(i);let n=!1;e(i,()=>n=!0),n?t?.(i):this._candidateTiles.push(i)}),this._candidateTiles=j(this._candidateTiles,t)}_selectCandidateTilesCoveringExtentAt(e){this._candidateTiles.length=0;const t=this.extent;if(null==t)return;const{tileInfo:i,tilemapCache:n}=this.layer,o=D(i,n)[e],l=i.tileAt(o.level,t.xmin,t.ymin),s=l.extent;if(null==s)return;const a=o.resolution*i.size[0],r=o.resolution*i.size[1],c=Math.ceil((t.xmax-s[0])/a),u=Math.ceil((t.ymax-s[1])/r);for(let h=0;h<u;h++)for(let e=0;e<c;e++){const t=new y(null,l.level,l.row-h,l.col+e);i.updateTileInfo(t),this._tileIsMasked(t)||this._candidateTiles.push(t)}}_tileIsMasked(e){return!!this.maskExtents&&this.maskExtents.some(t=>e.extent&&p(t,e.extent))}}function E(e,t,i=0){const n=D(e,t);let o=n.length-1;if(i>0){const t=i/l(e.spatialReference),s=n.findIndex(e=>e.resolution<t);0===s?o=0:s>0&&(o=s-1)}return o}const R={maximumAutoTileRequests:20,noDataValue:0,returnSampleInfo:!1,demResolution:"auto",minDemResolution:0};async function q(e,i,n){let o;const l=e.layer.tileInfo.spatialReference;if(i instanceof v?o=await i.project(l,n):(await c([{source:i.spatialReference,dest:l}],{signal:n}),o=u(i,l)),!o)throw new t("elevation-query:spatial-reference-mismatch",`Cannot query elevation in '${i.spatialReference.wkid}' on an elevation service in '${l.wkid}'`);e.geometry=v.fromGeometry(o)}function I(e){if(null==e.layer.fullExtent)return;const t=new d(null);t.sample=()=>e.options.noDataValue,e.outsideExtentTile=t;const i=e.layer.fullExtent;e.geometry.coordinates.forEach(e=>{const n=e.x,o=e.y;(n<i.xmin||n>i.xmax||o<i.ymin||o>i.ymax)&&(e.elevationTile=t)})}function A(e,t){const{tileInfo:i,tilemapCache:n}=e.layer,o=t/l(i.spatialReference),s=D(i,n);let a=s[0],r=0;for(let l=1;l<s.length;l++){const e=s[l];Math.abs(e.resolution-o)<Math.abs(a.resolution-o)&&(a=e,r=l)}return r}function C(e,t){const i=A(e,t);e.selectTilesAtLOD(i)}function M(e){const{tileInfo:t,tilemapCache:i}=e.layer,n=E(t,i,e.options.minDemResolution);e.selectTilesAtLOD(n,e.options.maximumAutoTileRequests)}function D(e,t){const i=e.lods;if(L(t)){const{effectiveMinLOD:e,effectiveMaxLOD:n}=t;return i.filter(t=>t.level>=e&&t.level<=n)}return i}async function F(e,t){const i=e.getTilesToFetch(),o={},l=e.options.cache,s=e.options.noDataValue,a=i.map(async i=>{if(null==i.id)return;const n=`${e.layer.uid}:${i.id}:${s}`,a=null!=l?l.get(n):null,r=null!=a?a:await e.layer.fetchTile(i.level,i.row,i.col,{noDataValue:s,signal:t});null!=l&&l.put(n,r),o[i.id]=new d(i,r)});await n(Promise.allSettled(a),t),e.populateElevationTiles(o)}function S(e){const t=e.layer.tileInfo;let i=0;const n={},o=e=>{null!=e.id&&(e.id in n?n[e.id]++:(n[e.id]=1,i++))},l=e=>{if(null==e.id)return;const t=n[e.id];1===t?(delete n[e.id],i--):n[e.id]=t-1};e.forEachTileToFetch(o,l);let s=!0;for(;s&&(s=!1,e.forEachTileToFetch(n=>{i<=e.options.maximumAutoTileRequests||(l(n),t.upsampleTile(n)&&(s=!0),o(n))},l),s););}function b(e){e.geometry.coordinates.forEach(t=>{const i=t.elevationTile;let n=e.options.noDataValue;if(i){const e=i.sample(t.x,t.y);null!=e?n=e:t.elevationTile=null}t.z=n})}function j(e,t){const i={},n=[];for(const l of e){const e=l.id;e&&!i[e]?(i[e]=l,n.push(l)):t?.(l)}const o=n.sort((e,t)=>e.level-t.level);return o.filter((e,i)=>{for(let n=0;n<i;n++){const i=o[n].extent;if(i&&e.extent&&p(i,e.extent))return t?.(e),!1}return!0})}async function z(e,t){const n=await e.geometry.project(e.outSpatialReference,t);i(n);const o={geometry:n.export(),noDataValue:e.options.noDataValue};return e.options.returnSampleInfo&&(o.sampleInfo=k(e)),e.geometry.coordinates.forEach(e=>{e.tile=null,e.elevationTile=null}),o}function k(e){const t=e.layer.tileInfo,i=l(t.spatialReference);return e.geometry.coordinates.map(n=>{let o=-1;if(n.elevationTile&&n.elevationTile!==e.outsideExtentTile){o=t.lodAt(n.elevationTile.tile.level).resolution*i}return{demResolution:o}})}function L(e){return null!=e?.tileInfo}export{T as ElevationQuery,v as GeometryDescriptor,E as getFinestLodIndex};
@@ -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/Collection.js";import{EventedMixin as r}from"../../core/Evented.js";import{JSONSupportMixin as s}from"../../core/JSONSupport.js";import{Loadable as i}from"../../core/Loadable.js";import{on as o,watch as l,sync as a,whenOnce as n}from"../../core/reactiveUtils.js";import{stripHTML as p}from"../../core/string.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import{ensureType as y}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{reader as h}from"../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import d from"../../geometry/Extent.js";import{computeExtent as f,sublayersFromJSON as m,fetchService as v,parseKML as b}from"./kmlUtils.js";var j;let S=j=class extends(r(s(i))){constructor(...e){super(...e),this.description=null,this.fullExtent=null,this.id=null,this.networkLink=null,this.parent=null,this.sublayers=null,this.title=null,this.sourceJSON=null,this.layer=null,this.addHandles([o(()=>this.sublayers,"after-add",({item:e})=>{e.parent=this,e.layer=this.layer},a),o(()=>this.sublayers,"after-remove",({item:e})=>{e.layer=e.parent=null},a),l(()=>this.sublayers,(e,t)=>{if(t)for(const r of t)r.layer=r.parent=null;if(e)for(const r of e)r.parent=this,r.layer=this.layer},a),l(()=>this.layer,e=>{if(this.sublayers)for(const t of this.sublayers)t.layer=e},a)])}initialize(){n(()=>this.networkLink).then(()=>n(()=>!0===this.visible)).then(()=>this.load())}load(e){if(!this.networkLink)return;if(this.networkLink.viewFormat)return;const r=null!=e?e.signal:null,s=this._fetchService(this._get("networkLink")?.href??"",r).then(e=>{const r=f(e.sublayers);this.fullExtent=d.fromJSON(r),this.sourceJSON=e;const s=y(t.ofType(j),m(j,e));this.sublayers?this.sublayers.addMany(s):this.sublayers=s,this.layer?.emit("sublayer-update"),this.layer&&this.layer.notifyChange("visibleSublayers")});return this.addResolvingPromise(s),Promise.resolve(this)}get visible(){return this._get("visible")}set visible(e){this._get("visible")!==e&&(this._set("visible",e),this.layer&&this.layer.notifyChange("visibleSublayers"))}readVisible(e,t){return!!t.visibility}_fetchService(e,t){return v(e,this.layer.outSpatialReference,this.layer.refreshInterval,t).then(e=>b(e.data))}};e([u()],S.prototype,"description",void 0),e([u({type:d})],S.prototype,"fullExtent",void 0),e([u()],S.prototype,"id",void 0),e([u({readOnly:!0,value:null})],S.prototype,"networkLink",void 0),e([u({json:{write:{allowNull:!0}}})],S.prototype,"parent",void 0),e([u({type:t.ofType(S),json:{write:{allowNull:!0}}})],S.prototype,"sublayers",void 0),e([u({value:null,json:{read:{source:"name",reader:e=>p(e)}}})],S.prototype,"title",void 0),e([u({value:!0})],S.prototype,"visible",null),e([h("visible",["visibility"])],S.prototype,"readVisible",null),e([u()],S.prototype,"sourceJSON",void 0),e([u()],S.prototype,"layer",void 0),S=j=e([c("esri.layers.support.KMLSublayer")],S);export{S as default};
5
+ import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{EventedMixin as r}from"../../core/Evented.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import{Loadable as s}from"../../core/Loadable.js";import{on as o,watch as l,sync as a,whenOnce as n}from"../../core/reactiveUtils.js";import{stripHTML as p}from"../../core/string.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import{ensureType as h}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{reader as y}from"../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import m from"../../geometry/Extent.js";import f from"../../graphic/KMLGraphicOrigin.js";import{computeExtent as d,sublayersFromJSON as v,fetchService as b,parseKML as j}from"./kmlUtils.js";var S;let g=S=class extends(r(i(s))){constructor(...e){super(...e),this.description=null,this.fullExtent=null,this.id=null,this.networkLink=null,this.parent=null,this.sublayers=null,this.title=null,this.sourceJSON=null,this.layer=null,this.addHandles([o(()=>this.sublayers,"after-add",({item:e})=>{e.parent=this,e.layer=this.layer},a),o(()=>this.sublayers,"after-remove",({item:e})=>{e.layer=e.parent=null},a),l(()=>this.sublayers,(e,t)=>{if(t)for(const r of t)r.layer=r.parent=null;if(e)for(const r of e)r.parent=this,r.layer=this.layer},a),l(()=>this.layer,e=>{if(this.sublayers)for(const t of this.sublayers)t.layer=e},a)])}initialize(){n(()=>this.networkLink).then(()=>n(()=>!0===this.visible)).then(()=>this.load())}load(e){if(!this.networkLink)return;if(this.networkLink.viewFormat)return;const r=null!=e?e.signal:null,i=this._fetchService(this._get("networkLink")?.href??"",r).then(e=>{const r=d(e.sublayers);this.fullExtent=m.fromJSON(r),this.sourceJSON=e;const i=h(t.ofType(S),v(S,e));this.sublayers?this.sublayers.addMany(i):this.sublayers=i,this.layer?.emit("sublayer-update"),this.layer&&this.layer.notifyChange("visibleSublayers")});return this.addResolvingPromise(i),Promise.resolve(this)}get visible(){return this._get("visible")}set visible(e){this._get("visible")!==e&&(this._set("visible",e),this.layer&&this.layer.notifyChange("visibleSublayers"))}readVisible(e,t){return!!t.visibility}get origin(){return this.layer?new f(this.layer,this):null}_fetchService(e,t){return b(e,this.layer.outSpatialReference,this.layer.refreshInterval,t).then(e=>j(e.data))}};e([u()],g.prototype,"description",void 0),e([u({type:m})],g.prototype,"fullExtent",void 0),e([u()],g.prototype,"id",void 0),e([u({readOnly:!0,value:null})],g.prototype,"networkLink",void 0),e([u({json:{write:{allowNull:!0}}})],g.prototype,"parent",void 0),e([u({type:t.ofType(g),json:{write:{allowNull:!0}}})],g.prototype,"sublayers",void 0),e([u({value:null,json:{read:{source:"name",reader:e=>p(e)}}})],g.prototype,"title",void 0),e([u({value:!0})],g.prototype,"visible",null),e([y("visible",["visibility"])],g.prototype,"readVisible",null),e([u()],g.prototype,"sourceJSON",void 0),e([u()],g.prototype,"layer",void 0),e([u()],g.prototype,"origin",null),g=S=e([c("esri.layers.support.KMLSublayer")],g);export{g as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{excludeTables as e}from"../../core/accessorSupport/layerContainerType.js";import{FeatureReduction as t}from"./FeatureReduction.js";import i from"./FeatureReductionBinning.js";import r from"./FeatureReductionCluster.js";import n from"./FeatureReductionSelection.js";const o={key:"type",base:t,typeMap:{cluster:r,binning:i}},p={types:{key:"type",base:t,typeMap:{selection:n,cluster:r,binning:i}},json:{name:"layerDefinition.featureReduction",write:{allowNull:!0},origins:{"web-map":{types:o},"portal-item":{types:o},"web-scene":{types:{key:"type",base:t,typeMap:{selection:n}},name:"layerDefinition.featureReduction",write:{layerContainerTypes:e}}}}};export{p as featureReductionProperty};
5
+ import{excludeTables as e}from"../../core/accessorSupport/layerContainerType.js";import{FeatureReduction as t}from"./FeatureReduction.js";import i from"./FeatureReductionBinning.js";import o from"./FeatureReductionCluster.js";import r from"./FeatureReductionSelection.js";const n={key:"type",base:t,typeMap:{cluster:o,binning:i}},a={types:{key:"type",base:t,typeMap:{selection:r,cluster:o,binning:i}},json:{name:"layerDefinition.featureReduction",write:{allowNull:!0},origins:{"web-map":{types:n},"portal-item":{types:n},"web-scene":{types:{key:"type",base:t,typeMap:{selection:r}},name:"layerDefinition.featureReduction",write:{allowNull:!0,layerContainerTypes:e}}}}};export{a as featureReductionProperty};
@@ -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 e from"../../config.js";import{id as o}from"../../kernel.js";import t from"../../PopupTemplate.js";import r from"../../request.js";import{clone as s}from"../../core/lang.js";import{addQueryParameters as n}from"../../core/urlUtils.js";import i from"../../geometry/SpatialReference.js";import{create as f,negativeInfinity as a,expandWithAABB as l,equals as u}from"../../geometry/support/aaBoundingBox.js";import{getBoundsXYZ as m}from"../../geometry/support/boundsUtils.js";import{fromJSON as p}from"../../renderers/support/jsonUtils.js";import y from"../../rest/support/FeatureSet.js";const c={esriGeometryPoint:"points",esriGeometryPolyline:"polylines",esriGeometryPolygon:"polygons"};function d(e){const o=e.folders||[],t=o.slice(),r=new Map,n=new Map,i=new Map,f=new Map,a=new Map,l={esriGeometryPoint:n,esriGeometryPolyline:i,esriGeometryPolygon:f};(e.featureCollection?.layers||[]).forEach(e=>{const o=s(e);o.featureSet.features=[];const t=e.featureSet.geometryType;r.set(t,o);const a=e.layerDefinition.objectIdField;"esriGeometryPoint"===t?h(n,a,e.featureSet.features):"esriGeometryPolyline"===t?h(i,a,e.featureSet.features):"esriGeometryPolygon"===t&&h(f,a,e.featureSet.features)}),e.groundOverlays&&e.groundOverlays.forEach(e=>{a.set(e.id,e)}),o.forEach(o=>{o.networkLinkIds.forEach(r=>{const s=P(r,o.id,e.networkLinks);s&&t.push(s)})}),t.forEach(e=>{if(e.featureInfos){e.points=s(r.get("esriGeometryPoint")),e.polylines=s(r.get("esriGeometryPolyline")),e.polygons=s(r.get("esriGeometryPolygon")),e.mapImages=[];for(const o of e.featureInfos)switch(o.type){case"esriGeometryPoint":case"esriGeometryPolyline":case"esriGeometryPolygon":{const t=l[o.type].get(o.id);t&&e[c[o.type]]?.featureSet.features.push(t);break}case"GroundOverlay":{const t=a.get(o.id);t&&e.mapImages.push(t);break}}e.fullExtent=j([e])}});const u=j(t);return{folders:o,sublayers:t,extent:u}}function g(t,s,i,f){const a=o?.findCredential(t);t=n(t,{token:a?.token});const l=e.kmlServiceUrl;return r(l,{query:{url:t,model:"simple",folders:"",refresh:0!==i||void 0,outSR:JSON.stringify(s)},responseType:"json",signal:f})}function S(e,o,t=null,r=[]){const s=[],n={},i=o.sublayers,f=new Set(o.folders.map(e=>e.id));return i.forEach(o=>{const i=new e;if(t?i.read(o,t):i.read(o),r.length&&f.has(i.id)&&(i.visible=r.includes(i.id)),n[o.id]=i,null!=o.parentFolderId&&-1!==o.parentFolderId){const e=n[o.parentFolderId];e.sublayers||(e.sublayers=[]),e.sublayers?.unshift(i)}else s.unshift(i)}),s}function h(e,o,t){t.forEach(t=>{e.set(t.attributes[o],t)})}function G(e,o){let t;return o.some(o=>o.id===e&&(t=o,!0)),t}function P(e,o,t){const r=G(e,t);return r&&(r.parentFolderId=o,r.networkLink=r),r}async function b(e){const o=y.fromJSON(e.featureSet).features,r=e.layerDefinition,s=p(r.drawingInfo.renderer),n=t.fromJSON(e.popupInfo),i=[];for(const t of o){const e=await s.getSymbolAsync(t);t.symbol=e,t.popupTemplate=n,t.visible=!0,i.push(t)}return i}function j(e){const o=f(a),t=f(a);for(const r of e){if(r.polygons?.featureSet?.features)for(const e of r.polygons.featureSet.features)m(o,e.geometry),l(t,o);if(r.polylines?.featureSet?.features)for(const e of r.polylines.featureSet.features)m(o,e.geometry),l(t,o);if(r.points?.featureSet?.features)for(const e of r.points.featureSet.features)m(o,e.geometry),l(t,o);if(r.mapImages)for(const e of r.mapImages)m(o,e.extent),l(t,o)}return u(t,a)?void 0:{xmin:t[0],ymin:t[1],zmin:t[2],xmax:t[3],ymax:t[4],zmax:t[5],spatialReference:i.WGS84}}export{j as computeExtent,g as fetchService,b as getGraphics,d as parseKML,S as sublayersFromJSON};
5
+ import e from"../../config.js";import{id as o}from"../../kernel.js";import t from"../../PopupTemplate.js";import r from"../../request.js";import{clone as s}from"../../core/lang.js";import{addQueryParameters as n}from"../../core/urlUtils.js";import i from"../../geometry/SpatialReference.js";import{create as f,negativeInfinity as a,expandWithAABB as l,equals as u}from"../../geometry/support/aaBoundingBox.js";import{getBoundsXYZ as m}from"../../geometry/support/boundsUtils.js";import{fromJSON as p}from"../../renderers/support/jsonUtils.js";import y from"../../rest/support/FeatureSet.js";const c={esriGeometryPoint:"points",esriGeometryPolyline:"polylines",esriGeometryPolygon:"polygons"};function d(e){const o=e.folders||[],t=o.slice(),r=new Map,n=new Map,i=new Map,f=new Map,a=new Map,l={esriGeometryPoint:n,esriGeometryPolyline:i,esriGeometryPolygon:f};(e.featureCollection?.layers||[]).forEach(e=>{const o=s(e);o.featureSet.features=[];const t=e.featureSet.geometryType;r.set(t,o);const a=e.layerDefinition.objectIdField;"esriGeometryPoint"===t?h(n,a,e.featureSet.features):"esriGeometryPolyline"===t?h(i,a,e.featureSet.features):"esriGeometryPolygon"===t&&h(f,a,e.featureSet.features)}),e.groundOverlays&&e.groundOverlays.forEach(e=>{a.set(e.id,e)}),o.forEach(o=>{o.networkLinkIds.forEach(r=>{const s=P(r,o.id,e.networkLinks);s&&t.push(s)})}),t.forEach(e=>{if(e.featureInfos){e.points=s(r.get("esriGeometryPoint")),e.polylines=s(r.get("esriGeometryPolyline")),e.polygons=s(r.get("esriGeometryPolygon")),e.mapImages=[];for(const o of e.featureInfos)switch(o.type){case"esriGeometryPoint":case"esriGeometryPolyline":case"esriGeometryPolygon":{const t=l[o.type].get(o.id);t&&e[c[o.type]]?.featureSet.features.push(t);break}case"GroundOverlay":{const t=a.get(o.id);t&&e.mapImages.push(t);break}}e.fullExtent=I([e])}});const u=I(t);return{folders:o,sublayers:t,extent:u}}function g(t,s,i,f){const a=o?.findCredential(t);t=n(t,{token:a?.token});const l=e.kmlServiceUrl;return r(l,{query:{url:t,model:"simple",folders:"",refresh:0!==i||void 0,outSR:JSON.stringify(s)},responseType:"json",signal:f})}function S(e,o,t=null,r=[]){const s=[],n={},i=o.sublayers,f=new Set(o.folders.map(e=>e.id));return i.forEach(o=>{const i=new e;if(t?i.read(o,t):i.read(o),r.length&&f.has(i.id)&&(i.visible=r.includes(i.id)),n[o.id]=i,null!=o.parentFolderId&&-1!==o.parentFolderId){const e=n[o.parentFolderId];e.sublayers||(e.sublayers=[]),e.sublayers?.unshift(i)}else s.unshift(i)}),s}function h(e,o,t){t.forEach(t=>{e.set(t.attributes[o],t)})}function G(e,o){let t;return o.some(o=>o.id===e&&(t=o,!0)),t}function P(e,o,t){const r=G(e,t);return r&&(r.parentFolderId=o,r.networkLink=r),r}async function b(e,o,r,s){const n=e[o];if(!n)return[];const i=y.fromJSON(n.featureSet).features,f=n.layerDefinition,a=p(f.drawingInfo.renderer),l=t.fromJSON(n.popupInfo),u=[];for(const t of i){const e=await a.getSymbolAsync(t);t.symbol=e,t.popupTemplate=l,t.visible=!0;const o=r.sublayerById.get(s);t.origin=o.origin,u.push(t)}return u}function I(e){const o=f(a),t=f(a);for(const r of e){if(r.polygons?.featureSet?.features)for(const e of r.polygons.featureSet.features)m(o,e.geometry),l(t,o);if(r.polylines?.featureSet?.features)for(const e of r.polylines.featureSet.features)m(o,e.geometry),l(t,o);if(r.points?.featureSet?.features)for(const e of r.points.featureSet.features)m(o,e.geometry),l(t,o);if(r.mapImages)for(const e of r.mapImages)m(o,e.extent),l(t,o)}return u(t,a)?void 0:{xmin:t[0],ymin:t[1],zmin:t[2],xmax:t[3],ymax:t[4],zmax:t[5],spatialReference:i.WGS84}}export{I as computeExtent,g as fetchService,b as getGraphics,d as parseKML,S as sublayersFromJSON};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.34.0-next.55",
3
+ "version": "4.34.0-next.56",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -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{toHSV as o,toLAB as r,toLCH as t,toRGB as l}from"../../core/colorUtils.js";import{JSONMap as e}from"../../core/jsonMap.js";import{isSerializable as i}from"../../core/support/jsonUtils.js";const n=["random","ndvi","ndvi2","ndvi3","elevation","gray","hillshade"],C=[{id:"aspect",type:"multipart",colorRamps:[{fromColor:[190,190,190],toColor:[255,45,8]},{fromColor:[255,45,8],toColor:[255,181,61]},{fromColor:[255,181,61],toColor:[255,254,52]},{fromColor:[255,254,52],toColor:[0,251,50]},{fromColor:[0,251,50],toColor:[255,254,52]},{fromColor:[0,253,255],toColor:[0,181,255]},{fromColor:[0,181,255],toColor:[26,35,253]},{fromColor:[26,35,253],toColor:[255,57,251]},{fromColor:[255,57,251],toColor:[255,45,8]}]},{id:"black-to-white",fromColor:[0,0,0],toColor:[255,255,255]},{id:"blue-bright",fromColor:[204,204,255],toColor:[0,0,224]},{id:"blue-light-to-dark",fromColor:[211,229,232],toColor:[46,100,140]},{id:"blue-green-bright",fromColor:[203,245,234],toColor:[48,207,146]},{id:"blue-green-light-to-dark",fromColor:[216,242,237],toColor:[21,79,74]},{id:"brown-light-to-dark",fromColor:[240,236,170],toColor:[102,72,48]},{id:"brown-to-blue-green-diverging-right",type:"multipart",colorRamps:[{fromColor:[156,85,31],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[33,130,145]}]},{id:"brown-to-blue-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[110,70,45],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[48,100,102]}]},{id:"coefficient-bias",fromColor:[214,214,255],toColor:[0,57,148]},{id:"cold-to-hot-diverging",type:"multipart",colorRamps:[{fromColor:[69,117,181],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[214,47,39]}]},{id:"condition-number",type:"multipart",colorRamps:[{fromColor:[0,97,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,34,0]}]},{id:"cyan-to-purple",type:"multipart",colorRamps:[{fromColor:[0,245,245],toColor:[0,0,245]},{fromColor:[0,0,245],toColor:[245,0,245]}]},{id:"cyan-light-to-blue-dark",type:"multipart",colorRamps:[{fromColor:[182,237,240],toColor:[31,131,224]},{fromColor:[31,131,224],toColor:[9,9,145]}]},{id:"distance",fromColor:[255,200,0],toColor:[0,0,255]},{id:"elevation1",type:"multipart",colorRamps:[{fromColor:[175,240,233],toColor:[255,255,179]},{fromColor:[255,255,179],toColor:[0,128,64]},{fromColor:[0,128,64],toColor:[252,186,3]},{fromColor:[252,186,3],toColor:[128,0,0]},{fromColor:[120,0,0],toColor:[105,48,13]},{fromColor:[105,48,13],toColor:[171,171,171]},{fromColor:[171,171,171],toColor:[255,252,255]}]},{id:"elevation2",type:"multipart",colorRamps:[{fromColor:[118,219,211],toColor:[255,255,199]},{fromColor:[255,255,199],toColor:[255,255,128]},{fromColor:[255,255,128],toColor:[217,194,121]},{fromColor:[217,194,121],toColor:[135,96,38]},{fromColor:[135,96,38],toColor:[150,150,181]},{fromColor:[150,150,181],toColor:[181,150,181]},{fromColor:[181,150,181],toColor:[255,252,255]}]},{id:"errors",fromColor:[255,235,214],toColor:[196,10,10]},{id:"gray-light-to-dark",fromColor:[219,219,219],toColor:[69,69,69]},{id:"green-bright",fromColor:[204,255,204],toColor:[14,204,14]},{id:"green-light-to-dark",fromColor:[220,245,233],toColor:[34,102,51]},{id:"green-to-blue",type:"multipart",colorRamps:[{fromColor:[32,204,16],toColor:[0,242,242]},{fromColor:[0,242,242],toColor:[2,33,227]}]},{id:"orange-bright",fromColor:[255,235,204],toColor:[240,118,5]},{id:"orange-light-to-dark",fromColor:[250,233,212],toColor:[171,65,36]},{id:"partial-spectrum",type:"multipart",colorRamps:[{fromColor:[242,241,162],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]},{fromColor:[252,3,69],toColor:[176,7,237]},{fromColor:[176,7,237],toColor:[2,29,173]}]},{id:"partial-spectrum-1-diverging",type:"multipart",colorRamps:[{fromColor:[135,38,38],toColor:[240,149,12]},{fromColor:[240,149,12],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[74,80,181]},{fromColor:[74,80,181],toColor:[39,32,122]}]},{id:"partial-spectrum-2-diverging",type:"multipart",colorRamps:[{fromColor:[115,77,42],toColor:[201,137,52]},{fromColor:[201,137,52],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[91,63,176]},{fromColor:[91,63,176],toColor:[81,13,97]}]},{id:"pink-to-yellow-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[158,30,113],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[99,110,45]}]},{id:"pink-to-yellow-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,47,73],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[22,59,15]}]},{id:"precipitation",type:"multipart",colorRamps:[{fromColor:[194,82,60],toColor:[237,161,19]},{fromColor:[237,161,19],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,219,0]},{fromColor:[0,219,0],toColor:[32,153,143]},{fromColor:[32,153,143],toColor:[11,44,122]}]},{id:"prediction",type:"multipart",colorRamps:[{fromColor:[40,146,199],toColor:[250,250,100]},{fromColor:[250,250,100],toColor:[232,16,20]}]},{id:"purple-bright",fromColor:[255,204,255],toColor:[199,0,199]},{id:"purple-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[77,32,150],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[20,122,11]}]},{id:"purple-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[67,14,89],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[24,79,15]}]},{id:"purple-blue-bright",fromColor:[223,184,230],toColor:[112,12,242]},{id:"purple-blue-light-to-dark",fromColor:[229,213,242],toColor:[93,44,112]},{id:"purple-red-bright",fromColor:[255,204,225],toColor:[199,0,99]},{id:"purple-red-light-to-dark",fromColor:[250,215,246],toColor:[143,17,57]},{id:"red-bright",fromColor:[255,204,204],toColor:[219,0,0]},{id:"red-light-to-dark",fromColor:[255,224,224],toColor:[143,10,10]},{id:"red-to-blue-diverging-bright",type:"multipart",colorRamps:[{fromColor:[196,69,57],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[48,95,207]}]},{id:"red-to-blue-diverging-dark",type:"multipart",colorRamps:[{fromColor:[107,13,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[13,53,97]}]},{id:"red-to-green",type:"multipart",colorRamps:[{fromColor:[245,0,0],toColor:[245,245,0]},{fromColor:[245,245,0],toColor:[0,245,0]}]},{id:"red-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[186,20,20],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[54,145,33]}]},{id:"red-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,21,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[16,69,16]}]},{id:"slope",type:"multipart",colorRamps:[{fromColor:[56,168,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]}]},{id:"spectrum-full-bright",type:"multipart",colorRamps:[{fromColor:[255,0,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,0,255]}]},{id:"spectrum-full-dark",type:"multipart",colorRamps:[{fromColor:[153,0,0],toColor:[153,153,0]},{fromColor:[153,153,0],toColor:[0,153,153]},{fromColor:[0,153,153],toColor:[0,0,153]}]},{id:"spectrum-full-light",type:"multipart",colorRamps:[{fromColor:[255,153,153],toColor:[255,255,153]},{fromColor:[255,255,153],toColor:[153,255,255]},{fromColor:[153,255,255],toColor:[153,153,255]}]},{id:"surface",type:"multipart",colorRamps:[{fromColor:[112,153,89],toColor:[242,238,162]},{fromColor:[242,238,162],toColor:[242,206,133]},{fromColor:[242,206,133],toColor:[194,140,124]},{fromColor:[194,140,124],toColor:[255,242,255]}]},{id:"temperature",type:"multipart",colorRamps:[{fromColor:[255,252,255],toColor:[255,0,255]},{fromColor:[255,0,255],toColor:[0,0,255]},{fromColor:[0,0,255],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,255,0]},{fromColor:[0,255,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,128,0]},{fromColor:[255,128,0],toColor:[128,0,0]}]},{id:"white-to-black",fromColor:[255,255,255],toColor:[0,0,0]},{id:"yellow-to-dark-red",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[242,167,46]},{fromColor:[242,167,46],toColor:[107,0,0]}]},{id:"yellow-to-green-to-dark-blue",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[56,224,9]},{fromColor:[56,224,9],toColor:[26,147,171]},{fromColor:[26,147,171],toColor:[12,16,120]}]},{id:"yellow-to-red",fromColor:[245,245,0],toColor:[255,0,0]},{id:"yellow-green-bright",fromColor:[236,252,204],toColor:[157,204,16]},{id:"yellow-green-light-to-dark",fromColor:[215,240,175],toColor:[96,107,45]}],m=new e({Aspect:"aspect","Black to White":"black-to-white","Blue Bright":"blue-bright","Blue Light to Dark":"blue-light-to-dark","Blue-Green Bright":"blue-green-bright","Blue-Green Light to Dark":"blue-green-light-to-dark","Brown Light to Dark":"brown-light-to-dark","Brown to Blue Green Diverging, Bright":"brown-to-blue-green-diverging-right","Brown to Blue Green Diverging, Dark":"brown-to-blue-green-diverging-dark","Coefficient Bias":"coefficient-bias","Cold to Hot Diverging":"cold-to-hot-diverging","Condition Number":"condition-number","Cyan to Purple":"cyan-to-purple","Cyan-Light to Blue-Dark":"cyan-light-to-blue-dark",Distance:"distance","Elevation #1":"elevation1","Elevation #2":"elevation2",Errors:"errors","Gray Light to Dark":"gray-light-to-dark","Green Bright":"green-bright","Green Light to Dark":"green-light-to-dark","Green to Blue":"green-to-blue","Orange Bright":"orange-bright","Orange Light to Dark":"orange-light-to-dark","Partial Spectrum":"partial-spectrum","Partial Spectrum 1 Diverging":"partial-spectrum-1-diverging","Partial Spectrum 2 Diverging":"partial-spectrum-2-diverging","Pink to YellowGreen Diverging, Bright":"pink-to-yellow-green-diverging-bright","Pink to YellowGreen Diverging, Dark":"pink-to-yellow-green-diverging-dark",Precipitation:"precipitation",Prediction:"prediction","Purple Bright":"purple-bright","Purple to Green Diverging, Bright":"purple-to-green-diverging-bright","Purple to Green Diverging, Dark":"purple-to-green-diverging-dark","Purple-Blue Bright":"purple-blue-bright","Purple-Blue Light to Dark":"purple-blue-light-to-dark","Purple-Red Bright":"purple-red-bright","Purple-Red Light to Dark":"purple-red-light-to-dark","Red Bright":"red-bright","Red Light to Dark":"red-light-to-dark","Red to Blue Diverging, Bright":"red-to-blue-diverging-bright","Red to Blue Diverging, Dark":"red-to-blue-diverging-dark","Red to Green":"red-to-green","Red to Green Diverging, Bright":"red-to-green-diverging-bright","Red to Green Diverging, Dark":"red-to-green-diverging-dark",Slope:"slope","Spectrum-Full Bright":"spectrum-full-bright","Spectrum-Full Dark":"spectrum-full-dark","Spectrum-Full Light":"spectrum-full-light",Surface:"surface",Temperature:"temperature","White to Black":"white-to-black","Yellow to Dark Red":"yellow-to-dark-red","Yellow to Green to Dark Blue":"yellow-to-green-to-dark-blue","Yellow to Red":"yellow-to-red","Yellow-Green Bright":"yellow-green-bright","Yellow-Green Light to Dark":"yellow-green-light-to-dark"});function a(o,r){if(!o||!r||o.length!==r.length)return!1;for(let t=0;t<o.length;t++)if(o[t]>r[t]+2||o[t]<r[t]-2)return!1;return!0}function g(o){const r=o.clone();return r.fromColor=o.toColor,r.toColor=o.fromColor,r}function p(o){if("multipart"===o.type){const r=o.clone();return r.colorRamps?.length?(r.colorRamps=r.colorRamps.reverse().map(o=>g(o)),r):r}return g(o)}function u(o,r){const t=r??C;if("algorithmic"===o.type){const r=o.fromColor.toRgb(),l=o.toColor.toRgb();return t.find(o=>a(r,o.fromColor)&&a(l,o.toColor))?.id}const l=o.colorRamps?.map(o=>({fromColor:o.fromColor.toRgb(),toColor:o.toColor.toRgb()}));return t.find(o=>{const r=o.colorRamps;return!(!l||!r||l.length!==r.length)&&r.every((o,r)=>a(l[r].fromColor,o.fromColor)&&a(l[r].toColor,o.toColor))})?.id}function f(o,r,t=!1){if(!o)return;let l=!1,e=u(o,r);return null!=e||t||(l=!0,e=u(o=p(o),r)),e?{id:e,inverted:l}:void 0}function s(o,r=!1){const t="string"==typeof o?o:f(o,void 0,r)?.id;return t?m.toJSON(t):null}function d(o,r="esriCIELabAlgorithm"){const t=C.find(({id:r})=>r===o);return t?t.colorRamps?{type:"multipart",colorRamps:t.colorRamps.map(o=>({type:"algorithmic",algorithm:r,fromColor:[...o.fromColor],toColor:[...o.toColor]}))}:{type:"algorithmic",algorithm:r,fromColor:[...t.fromColor],toColor:[...t.toColor]}:null}function c(o){o??={};const r=o.numColors||256,t=o.distanceOffset||0,l=null!=o.isCustomInterval?o.isCustomInterval:null!==o.distanceInterval&&o.distanceInterval!==1/(r-1),e=o.distanceInterval||1/(r-1);return{...o,numColors:r,distanceOffset:t,interpolateAlpha:!!o.interpolateAlpha,distanceInterval:e,isCustomInterval:l,weights:o.weights}}function h(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t,C=0===o.s,m=0===r.s;let a=o.h,g=r.h;C&&!m?a=g:m&&!C&&(r={...r,h:a},g=a);let p=Math.abs(g-a),u=0;const f=360;p<f/2?u=(g-a)*i:(p=f-p,u=a>g?p*i:-p*i);const s=(r.s-o.s)*i,d=(r.v-o.v)*i;let{s:c,v:h}=o,b=a;if(e){const o=e/i;b=(b+o*u+f)%f,c+=o*s,h+=o*d}const v=[];for(let y=0;y<l-1;y++)v.push({h:b,s:c,v:h}),b=(b+u+f)%f,c+=s,h+=d;return v.push(n?{h:b,s:c,v:h}:r),v}function b(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t;let{l:C,a:m,b:a}=o;const g=(r.l-C)*i,p=(r.a-m)*i,u=(r.b-a)*i,f=[];if(e){const o=e/i;C+=o*g,m+=o*p,a+=o*u}for(let s=0;s<l-1;s++)f.push({l:C,a:m,b:a}),C+=g,m+=p,a+=u;return f.push(n?{l:C,a:m,b:a}:r),f}function v(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t,C=o.h,m=r.h,a=2*Math.PI;let g=0;if(C<=m){const o=m-C,r=m-C-a;g=Math.abs(r)<Math.abs(o)?r:o}else{const o=m+a-C,r=m-C;g=Math.abs(r)<Math.abs(o)?r:o}const p=g*i,u=(r.l-o.l)*i,f=(r.c-o.c)*i;let{l:s,c:d,h:c}=o;if(e){const o=e/i;s+=o*u,d+=o*f,c=(c+o*p+a)%a}const h=[];for(let b=0;b<l-1;b++)h.push({l:s,c:d,h:c}),s+=u,d+=f,c=(c+p+a)%a;return h.push(n?{l:s,c:d,h:c}:r),h}function y(e,i){const{fromColor:n,toColor:C}=e,m=3===n.length?[...n,255]:[...n],a=3===C.length?[...C,255]:[...C],g=e.algorithm||"esriCIELabAlgorithm",p=c(i),{numColors:u,distanceOffset:f,isCustomInterval:s,interpolateAlpha:d}=p;if(1===u&&0===f)return[m];if(2===u&&0===f&&!s)return[m,a];const y={r:m[0],g:m[1],b:m[2]},k={r:a[0],g:a[1],b:a[2]},R="esriCIELabAlgorithm"===g?b(r(y),r(k),p):"esriHSVAlgorithm"===g?h(o(y),o(k),p):v(t(y),t(k),p),w=[],B=m[3]??255,D=((a[3]??255)-B)/(u-1);for(let o=0;o<u;o++){const{r,g:t,b:e}=l(R[o]),i=d?Math.round(B+D*o):255;w.push([r,t,e,i])}return w}function k(o,r){const{colorRamps:t}=o;if(!r?.length)return Array.from({length:t.length},()=>1/t.length);const l=r.reduce((o,r)=>o+r);return r.map(o=>o/l)}function R(o,r){const{numColors:t,interpolateAlpha:l}=c(r),e=k(o,r?.weights),{colorRamps:i}=o,n=[],C=1/(t-1);let m=0,a=!1;for(let p=0;p<i.length;p++){const o=n.length,r=a?0:o*C-m;m+=e[p];let g=p===i.length-1?t-1-o:(e[p]-r)/C;if(a=Math.ceil(g)===g,g=Math.ceil(g),0===g)continue;const u=y(i[p],{numColors:g,interpolateAlpha:l,distanceOffset:r/e[p],distanceInterval:C/e[p]});n.push(...u)}const g=[...i[i.length-1].toColor];return 3===g.length&&g.push(255),n.push(g),n}function w(o,r){const t=i(o)?o.toJSON():o;return"multipart"===t.type?R(t,r):y(t,r)}function B(o,r){const t=w(o,r),l=r?.interpolateAlpha;return t.forEach((o,r)=>{o.unshift(r),l||o.pop()}),t}function D(r){const t=[];for(let l=0;l<r.length;l+=4){const e=o({r:r[l],g:r[l+1],b:r[l+2]});t.push([e.h/60,e.s/100,255*e.v/100])}return t}function I(r){const t=o(r);return{type:"HsvColor",Hue:t.h,Saturation:t.s,Value:t.v,AlphaValue:255}}function A(o){const r=o.toJSON();return{Algorithm:r?.Algorithm||"esriHSVAlgorithm",type:"AlgorithmicColorRamp",FromColor:I(o.fromColor),ToColor:I(o.toColor)}}function G(o){const r=s(o);if(!r)return null;if("algorithmic"===o.type)return{...A(o),Name:r};if(o.colorRamps){const t=o.colorRamps.map(A);return{type:"MultiPartColorRamp",NumColorRamps:t.length,ArrayOfColorRamp:t,Name:r}}return null}function P(o){const r=[...o].reverse().map(o=>{const r=o.toString(16);return r.length<2?"0"+r:r});return 4294967295&Number.parseInt(r.join(""),16)}export{m as colorRampDict,B as convertColorRampToColormap,w as convertColorRampToColors,P as convertRGBATo32Bit,D as createHsvMap,f as getColorRampId,d as getColorRampJSON,s as getColorRampName,G as getRFxArgColorRampValue,C as predefinedJsonColorRamps,n as rasterColormapNames};
5
+ import{toHSV as o,toLAB as r,toLCH as t,toRGB as l}from"../../core/colorUtils.js";import{JSONMap as e}from"../../core/jsonMap.js";import{isSerializable as i}from"../../core/support/jsonUtils.js";const n=["random","ndvi","ndvi2","ndvi3","elevation","gray","hillshade"],C=[{id:"aspect",type:"multipart",colorRamps:[{fromColor:[190,190,190],toColor:[255,45,8]},{fromColor:[255,45,8],toColor:[255,181,61]},{fromColor:[255,181,61],toColor:[255,254,52]},{fromColor:[255,254,52],toColor:[0,251,50]},{fromColor:[0,251,50],toColor:[255,254,52]},{fromColor:[0,253,255],toColor:[0,181,255]},{fromColor:[0,181,255],toColor:[26,35,253]},{fromColor:[26,35,253],toColor:[255,57,251]},{fromColor:[255,57,251],toColor:[255,45,8]}]},{id:"black-to-white",fromColor:[0,0,0],toColor:[255,255,255]},{id:"blue-bright",fromColor:[204,204,255],toColor:[0,0,224]},{id:"blue-light-to-dark",fromColor:[211,229,232],toColor:[46,100,140]},{id:"blue-green-bright",fromColor:[203,245,234],toColor:[48,207,146]},{id:"blue-green-light-to-dark",fromColor:[216,242,237],toColor:[21,79,74]},{id:"brown-light-to-dark",fromColor:[240,236,170],toColor:[102,72,48]},{id:"brown-to-blue-green-diverging-right",type:"multipart",colorRamps:[{fromColor:[156,85,31],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[33,130,145]}]},{id:"brown-to-blue-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[110,70,45],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[48,100,102]}]},{id:"coefficient-bias",fromColor:[214,214,255],toColor:[0,57,148]},{id:"cold-to-hot-diverging",type:"multipart",colorRamps:[{fromColor:[69,117,181],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[214,47,39]}]},{id:"condition-number",type:"multipart",colorRamps:[{fromColor:[0,97,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,34,0]}]},{id:"cyan-to-purple",type:"multipart",colorRamps:[{fromColor:[0,245,245],toColor:[0,0,245]},{fromColor:[0,0,245],toColor:[245,0,245]}]},{id:"cyan-light-to-blue-dark",type:"multipart",colorRamps:[{fromColor:[182,237,240],toColor:[31,131,224]},{fromColor:[31,131,224],toColor:[9,9,145]}]},{id:"distance",fromColor:[255,200,0],toColor:[0,0,255]},{id:"elevation1",type:"multipart",colorRamps:[{fromColor:[175,240,233],toColor:[255,255,179]},{fromColor:[255,255,179],toColor:[0,128,64]},{fromColor:[0,128,64],toColor:[252,186,3]},{fromColor:[252,186,3],toColor:[128,0,0]},{fromColor:[120,0,0],toColor:[105,48,13]},{fromColor:[105,48,13],toColor:[171,171,171]},{fromColor:[171,171,171],toColor:[255,252,255]}]},{id:"elevation2",type:"multipart",colorRamps:[{fromColor:[118,219,211],toColor:[255,255,199]},{fromColor:[255,255,199],toColor:[255,255,128]},{fromColor:[255,255,128],toColor:[217,194,121]},{fromColor:[217,194,121],toColor:[135,96,38]},{fromColor:[135,96,38],toColor:[150,150,181]},{fromColor:[150,150,181],toColor:[181,150,181]},{fromColor:[181,150,181],toColor:[255,252,255]}]},{id:"errors",fromColor:[255,235,214],toColor:[196,10,10]},{id:"gray-light-to-dark",fromColor:[219,219,219],toColor:[69,69,69]},{id:"green-bright",fromColor:[204,255,204],toColor:[14,204,14]},{id:"green-light-to-dark",fromColor:[220,245,233],toColor:[34,102,51]},{id:"green-to-blue",type:"multipart",colorRamps:[{fromColor:[32,204,16],toColor:[0,242,242]},{fromColor:[0,242,242],toColor:[2,33,227]}]},{id:"orange-bright",fromColor:[255,235,204],toColor:[240,118,5]},{id:"orange-light-to-dark",fromColor:[250,233,212],toColor:[171,65,36]},{id:"partial-spectrum",type:"multipart",colorRamps:[{fromColor:[242,241,162],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]},{fromColor:[252,3,69],toColor:[176,7,237]},{fromColor:[176,7,237],toColor:[2,29,173]}]},{id:"partial-spectrum-1-diverging",type:"multipart",colorRamps:[{fromColor:[135,38,38],toColor:[240,149,12]},{fromColor:[240,149,12],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[74,80,181]},{fromColor:[74,80,181],toColor:[39,32,122]}]},{id:"partial-spectrum-2-diverging",type:"multipart",colorRamps:[{fromColor:[115,77,42],toColor:[201,137,52]},{fromColor:[201,137,52],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[91,63,176]},{fromColor:[91,63,176],toColor:[81,13,97]}]},{id:"pink-to-yellow-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[158,30,113],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[99,110,45]}]},{id:"pink-to-yellow-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,47,73],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[22,59,15]}]},{id:"precipitation",type:"multipart",colorRamps:[{fromColor:[194,82,60],toColor:[237,161,19]},{fromColor:[237,161,19],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,219,0]},{fromColor:[0,219,0],toColor:[32,153,143]},{fromColor:[32,153,143],toColor:[11,44,122]}]},{id:"prediction",type:"multipart",colorRamps:[{fromColor:[40,146,199],toColor:[250,250,100]},{fromColor:[250,250,100],toColor:[232,16,20]}]},{id:"purple-bright",fromColor:[255,204,255],toColor:[199,0,199]},{id:"purple-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[77,32,150],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[20,122,11]}]},{id:"purple-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[67,14,89],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[24,79,15]}]},{id:"purple-blue-bright",fromColor:[223,184,230],toColor:[112,12,242]},{id:"purple-blue-light-to-dark",fromColor:[229,213,242],toColor:[93,44,112]},{id:"purple-red-bright",fromColor:[255,204,225],toColor:[199,0,99]},{id:"purple-red-light-to-dark",fromColor:[250,215,246],toColor:[143,17,57]},{id:"red-bright",fromColor:[255,204,204],toColor:[219,0,0]},{id:"red-light-to-dark",fromColor:[255,224,224],toColor:[143,10,10]},{id:"red-to-blue-diverging-bright",type:"multipart",colorRamps:[{fromColor:[196,69,57],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[48,95,207]}]},{id:"red-to-blue-diverging-dark",type:"multipart",colorRamps:[{fromColor:[107,13,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[13,53,97]}]},{id:"red-to-green",type:"multipart",colorRamps:[{fromColor:[245,0,0],toColor:[245,245,0]},{fromColor:[245,245,0],toColor:[0,245,0]}]},{id:"red-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[186,20,20],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[54,145,33]}]},{id:"red-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,21,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[16,69,16]}]},{id:"slope",type:"multipart",colorRamps:[{fromColor:[56,168,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]}]},{id:"spectrum-full-bright",type:"multipart",colorRamps:[{fromColor:[255,0,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,0,255]}]},{id:"spectrum-full-dark",type:"multipart",colorRamps:[{fromColor:[153,0,0],toColor:[153,153,0]},{fromColor:[153,153,0],toColor:[0,153,153]},{fromColor:[0,153,153],toColor:[0,0,153]}]},{id:"spectrum-full-light",type:"multipart",colorRamps:[{fromColor:[255,153,153],toColor:[255,255,153]},{fromColor:[255,255,153],toColor:[153,255,255]},{fromColor:[153,255,255],toColor:[153,153,255]}]},{id:"surface",type:"multipart",colorRamps:[{fromColor:[112,153,89],toColor:[242,238,162]},{fromColor:[242,238,162],toColor:[242,206,133]},{fromColor:[242,206,133],toColor:[194,140,124]},{fromColor:[194,140,124],toColor:[255,242,255]}]},{id:"temperature",type:"multipart",colorRamps:[{fromColor:[255,252,255],toColor:[255,0,255]},{fromColor:[255,0,255],toColor:[0,0,255]},{fromColor:[0,0,255],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,255,0]},{fromColor:[0,255,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,128,0]},{fromColor:[255,128,0],toColor:[128,0,0]}]},{id:"white-to-black",fromColor:[255,255,255],toColor:[0,0,0]},{id:"yellow-to-dark-red",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[242,167,46]},{fromColor:[242,167,46],toColor:[107,0,0]}]},{id:"yellow-to-green-to-dark-blue",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[56,224,9]},{fromColor:[56,224,9],toColor:[26,147,171]},{fromColor:[26,147,171],toColor:[12,16,120]}]},{id:"yellow-to-red",fromColor:[245,245,0],toColor:[255,0,0]},{id:"yellow-green-bright",fromColor:[236,252,204],toColor:[157,204,16]},{id:"yellow-green-light-to-dark",fromColor:[215,240,175],toColor:[96,107,45]}],m=new e({Aspect:"aspect","Black to White":"black-to-white","Blue Bright":"blue-bright","Blue Light to Dark":"blue-light-to-dark","Blue-Green Bright":"blue-green-bright","Blue-Green Light to Dark":"blue-green-light-to-dark","Brown Light to Dark":"brown-light-to-dark","Brown to Blue Green Diverging, Bright":"brown-to-blue-green-diverging-right","Brown to Blue Green Diverging, Dark":"brown-to-blue-green-diverging-dark","Coefficient Bias":"coefficient-bias","Cold to Hot Diverging":"cold-to-hot-diverging","Condition Number":"condition-number","Cyan to Purple":"cyan-to-purple","Cyan-Light to Blue-Dark":"cyan-light-to-blue-dark",Distance:"distance","Elevation #1":"elevation1","Elevation #2":"elevation2",Errors:"errors","Gray Light to Dark":"gray-light-to-dark","Green Bright":"green-bright","Green Light to Dark":"green-light-to-dark","Green to Blue":"green-to-blue","Orange Bright":"orange-bright","Orange Light to Dark":"orange-light-to-dark","Partial Spectrum":"partial-spectrum","Partial Spectrum 1 Diverging":"partial-spectrum-1-diverging","Partial Spectrum 2 Diverging":"partial-spectrum-2-diverging","Pink to YellowGreen Diverging, Bright":"pink-to-yellow-green-diverging-bright","Pink to YellowGreen Diverging, Dark":"pink-to-yellow-green-diverging-dark",Precipitation:"precipitation",Prediction:"prediction","Purple Bright":"purple-bright","Purple to Green Diverging, Bright":"purple-to-green-diverging-bright","Purple to Green Diverging, Dark":"purple-to-green-diverging-dark","Purple-Blue Bright":"purple-blue-bright","Purple-Blue Light to Dark":"purple-blue-light-to-dark","Purple-Red Bright":"purple-red-bright","Purple-Red Light to Dark":"purple-red-light-to-dark","Red Bright":"red-bright","Red Light to Dark":"red-light-to-dark","Red to Blue Diverging, Bright":"red-to-blue-diverging-bright","Red to Blue Diverging, Dark":"red-to-blue-diverging-dark","Red to Green":"red-to-green","Red to Green Diverging, Bright":"red-to-green-diverging-bright","Red to Green Diverging, Dark":"red-to-green-diverging-dark",Slope:"slope","Spectrum-Full Bright":"spectrum-full-bright","Spectrum-Full Dark":"spectrum-full-dark","Spectrum-Full Light":"spectrum-full-light",Surface:"surface",Temperature:"temperature","White to Black":"white-to-black","Yellow to Dark Red":"yellow-to-dark-red","Yellow to Green to Dark Blue":"yellow-to-green-to-dark-blue","Yellow to Red":"yellow-to-red","Yellow-Green Bright":"yellow-green-bright","Yellow-Green Light to Dark":"yellow-green-light-to-dark"});function a(o,r){if(!o||!r||o.length!==r.length)return!1;for(let t=0;t<o.length;t++)if(o[t]>r[t]+2||o[t]<r[t]-2)return!1;return!0}function g(o){const r=o.clone();return r.fromColor=o.toColor,r.toColor=o.fromColor,r}function p(o){if("multipart"===o.type){const r=o.clone();return r.colorRamps?.length?(r.colorRamps=r.colorRamps.reverse().map(o=>g(o)),r):r}return g(o)}function u(o,r){const t=r??C;if("algorithmic"===o.type){const r=o.fromColor.toRgb(),l=o.toColor.toRgb();return t.find(o=>a(r,o.fromColor)&&a(l,o.toColor))?.id}if(o.weights?.length)return;const l=o.colorRamps?.map(o=>({fromColor:o.fromColor.toRgb(),toColor:o.toColor.toRgb()}));return t.find(o=>{const r=o.colorRamps;return!(!l||!r||l.length!==r.length)&&r.every((o,r)=>a(l[r].fromColor,o.fromColor)&&a(l[r].toColor,o.toColor))})?.id}function f(o,r,t=!1){if(!o)return;let l=!1,e=u(o,r);return null!=e||t||(l=!0,e=u(o=p(o),r)),e?{id:e,inverted:l}:void 0}function s(o,r=!1){const t="string"==typeof o?o:f(o,void 0,r)?.id;return t?m.toJSON(t):null}function d(o,r="esriCIELabAlgorithm"){const t=C.find(({id:r})=>r===o);return t?t.colorRamps?{type:"multipart",colorRamps:t.colorRamps.map(o=>({type:"algorithmic",algorithm:r,fromColor:[...o.fromColor],toColor:[...o.toColor]}))}:{type:"algorithmic",algorithm:r,fromColor:[...t.fromColor],toColor:[...t.toColor]}:null}function c(o){o??={};const r=o.numColors||256,t=o.distanceOffset||0,l=null!=o.isCustomInterval?o.isCustomInterval:null!==o.distanceInterval&&o.distanceInterval!==1/(r-1),e=o.distanceInterval||1/(r-1);return{...o,numColors:r,distanceOffset:t,interpolateAlpha:!!o.interpolateAlpha,distanceInterval:e,isCustomInterval:l,weights:o.weights}}function h(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t,C=0===o.s,m=0===r.s;let a=o.h,g=r.h;C&&!m?a=g:m&&!C&&(r={...r,h:a},g=a);let p=Math.abs(g-a),u=0;const f=360;p<f/2?u=(g-a)*i:(p=f-p,u=a>g?p*i:-p*i);const s=(r.s-o.s)*i,d=(r.v-o.v)*i;let{s:c,v:h}=o,b=a;if(e){const o=e/i;b=(b+o*u+f)%f,c+=o*s,h+=o*d}const v=[];for(let y=0;y<l-1;y++)v.push({h:b,s:c,v:h}),b=(b+u+f)%f,c+=s,h+=d;return v.push(n?{h:b,s:c,v:h}:r),v}function b(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t;let{l:C,a:m,b:a}=o;const g=(r.l-C)*i,p=(r.a-m)*i,u=(r.b-a)*i,f=[];if(e){const o=e/i;C+=o*g,m+=o*p,a+=o*u}for(let s=0;s<l-1;s++)f.push({l:C,a:m,b:a}),C+=g,m+=p,a+=u;return f.push(n?{l:C,a:m,b:a}:r),f}function v(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t,C=o.h,m=r.h,a=2*Math.PI;let g=0;if(C<=m){const o=m-C,r=m-C-a;g=Math.abs(r)<Math.abs(o)?r:o}else{const o=m+a-C,r=m-C;g=Math.abs(r)<Math.abs(o)?r:o}const p=g*i,u=(r.l-o.l)*i,f=(r.c-o.c)*i;let{l:s,c:d,h:c}=o;if(e){const o=e/i;s+=o*u,d+=o*f,c=(c+o*p+a)%a}const h=[];for(let b=0;b<l-1;b++)h.push({l:s,c:d,h:c}),s+=u,d+=f,c=(c+p+a)%a;return h.push(n?{l:s,c:d,h:c}:r),h}function y(e,i){const{fromColor:n,toColor:C}=e,m=3===n.length?[...n,255]:[...n],a=3===C.length?[...C,255]:[...C],g=e.algorithm||"esriCIELabAlgorithm",p=c(i),{numColors:u,distanceOffset:f,isCustomInterval:s,interpolateAlpha:d}=p;if(1===u&&0===f)return[m];if(2===u&&0===f&&!s)return[m,a];const y={r:m[0],g:m[1],b:m[2]},k={r:a[0],g:a[1],b:a[2]},R="esriCIELabAlgorithm"===g?b(r(y),r(k),p):"esriHSVAlgorithm"===g?h(o(y),o(k),p):v(t(y),t(k),p),w=[],B=m[3]??255,D=((a[3]??255)-B)/(u-1);for(let o=0;o<u;o++){const{r,g:t,b:e}=l(R[o]),i=d?Math.round(B+D*o):255;w.push([r,t,e,i])}return w}function k(o,r){const{colorRamps:t}=o;if(r??=t.map(({start:o,stop:r})=>null==o||null==r?-1:r-o),r.length!==t.length||r.some(o=>o<0))return Array.from({length:t.length},()=>1/t.length);const l=r.reduce((o,r)=>o+r);return r.map(o=>o/l)}function R(o,r){const{numColors:t,interpolateAlpha:l}=c(r),e=k(o,r?.weights),{colorRamps:i}=o,n=[],C=1/(t-1);let m=0,a=!1;for(let p=0;p<i.length;p++){const o=n.length,r=a?0:o*C-m;m+=e[p];let g=p===i.length-1?t-1-o:(e[p]-r)/C;if(a=Math.ceil(g)===g,g=Math.ceil(g),0===g)continue;const u=y(i[p],{numColors:g,interpolateAlpha:l,distanceOffset:r/e[p],distanceInterval:C/e[p]});n.push(...u)}const g=[...i[i.length-1].toColor];return 3===g.length&&g.push(255),n.push(g),n}function w(o,r){const t=i(o)?o.toJSON():o;return"multipart"===t.type?R(t,r):y(t,r)}function B(o,r){const t=w(o,r),l=r?.interpolateAlpha;return t.forEach((o,r)=>{o.unshift(r),l||o.pop()}),t}function D(r){const t=[];for(let l=0;l<r.length;l+=4){const e=o({r:r[l],g:r[l+1],b:r[l+2]});t.push([e.h/60,e.s/100,255*e.v/100])}return t}function I(r){const t=o(r);return{type:"HsvColor",Hue:t.h,Saturation:t.s,Value:t.v,AlphaValue:255}}function A(o){const r=o.toJSON();return{Algorithm:r?.Algorithm||"esriHSVAlgorithm",type:"AlgorithmicColorRamp",FromColor:I(o.fromColor),ToColor:I(o.toColor)}}function G(o){const r=s(o);if(!r)return null;if("algorithmic"===o.type)return{...A(o),Name:r};if(o.colorRamps){const t=o.colorRamps.map(A);return{type:"MultiPartColorRamp",NumColorRamps:t.length,ArrayOfColorRamp:t,Name:r}}return null}function P(o){const r=[...o].reverse().map(o=>{const r=o.toString(16);return r.length<2?"0"+r:r});return 4294967295&Number.parseInt(r.join(""),16)}export{m as colorRampDict,B as convertColorRampToColormap,w as convertColorRampToColors,P as convertRGBATo32Bit,D as createHsvMap,f as getColorRampId,d as getColorRampJSON,s as getColorRampName,G as getRFxArgColorRampValue,C as predefinedJsonColorRamps,n as rasterColormapNames};
@@ -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 r from"../config.js";import has from"../core/has.js";import{isAborted as e}from"../core/promiseUtils.js";import{getOrigin as o,hasSameOrigin as t,changeHost as n,getAppUrl as s,urlToObject as i}from"../core/urlUtils.js";import{parse as c}from"../layers/support/arcgisLayerUrl.js";import{isSecureProxyService as a}from"../portal/support/urlUtils.js";function u(r,o,t=!1,n){return new Promise((s,i)=>{if(e(n))return void i(l());let c=()=>{f(),i(new Error(`Unable to load ${o}`))},a=()=>{const e=r;f(),s(e)},u=()=>{if(!r)return;const e=r;f(),e.src="",i(l())};const f=()=>{has("esri-image-decode")||(r.removeEventListener("error",c),r.removeEventListener("load",a)),c=null,a=null,r=null,null!=n&&n.removeEventListener("abort",u),u=null,t&&URL.revokeObjectURL(o)};null!=n&&n.addEventListener("abort",u),has("esri-image-decode")?r.decode().then(a,c):(r.addEventListener("error",c),r.addEventListener("load",a))})}function l(){try{return new DOMException("Aborted","AbortError")}catch{const r=new Error;return r.name="AbortError",r}}const f="Timeout exceeded";function m(){return new Error(f)}function p(r){return"object"==typeof r&&!!r&&"message"in r&&r.message===f}function d(e){r.request.crossOriginNoCorsDomains||(r.request.crossOriginNoCorsDomains={});const t=r.request.crossOriginNoCorsDomains;for(let r of e)r=r.toLowerCase(),/^https?:\/\//.test(r)?t[o(r)??""]=0:(t[o("http://"+r)??""]=0,t[o("https://"+r)??""]=0)}function w(e){const n=r.request.crossOriginNoCorsDomains;if(n){let r=o(e);if(r)return r=r.toLowerCase(),!t(r,s())&&n[r]<Date.now()-36e5}return!1}async function L(e){const t=i(e);e=t.path,"json"===t.query?.f&&(e+="?f=json");try{await fetch(e,{mode:"no-cors",credentials:"include"})}catch{}const n=r.request.crossOriginNoCorsDomains,s=o(e);n&&s&&(n[s.toLowerCase()]=Date.now())}const h=new Map;function v(r,e){const o=e?.preferredHost;if(!o||t(r,`https://${o}`,!0))return;const n=c(r);if(!n||"FeatureServer"!==n.serverType||a(r))return;const s=n.url.path.toLowerCase();h.has(s)||h.set(s,o)}function g(r){const e=c(r)?.url.path.toLowerCase();if(!e)return r;const o=h.get(e);return o?n(r,o):r}export{m as createTimeoutError,g as getPreferredUrl,w as isNoCorsRequestRequired,p as isTimeoutError,u as loadImageAsync,h as preferredHosts,d as registerNoCorsDomains,L as sendNoCorsRequest,v as setPreferredHost};
5
+ import r from"../config.js";import{isAborted as e}from"../core/promiseUtils.js";import{getOrigin as t,hasSameOrigin as o,changeHost as n,getAppUrl as s,urlToObject as i}from"../core/urlUtils.js";import{parse as c}from"../layers/support/arcgisLayerUrl.js";import{isSecureProxyService as a}from"../portal/support/urlUtils.js";function u(r,t,o=!1,n){return new Promise((s,i)=>{if(e(n))return void i(f());let c=()=>{l(),i(new Error(`Unable to load ${t}`))},a=async()=>{const e=r;try{await e.decode()}catch{}l(),s(e)},u=()=>{if(!r)return;const e=r;l(),e.src="",i(f())};const l=()=>{r&&(r.removeEventListener("error",c),r.removeEventListener("load",a),c=null,a=null,r=null,n?.removeEventListener("abort",u),u=null,o&&URL.revokeObjectURL(t))};n?.addEventListener("abort",u),r.addEventListener("error",c),r.addEventListener("load",a)})}function f(){try{return new DOMException("Aborted","AbortError")}catch{const r=new Error;return r.name="AbortError",r}}const l="Timeout exceeded";function m(){return new Error(l)}function p(r){return"object"==typeof r&&!!r&&"message"in r&&r.message===l}function d(e){r.request.crossOriginNoCorsDomains||(r.request.crossOriginNoCorsDomains={});const o=r.request.crossOriginNoCorsDomains;for(let r of e)r=r.toLowerCase(),/^https?:\/\//.test(r)?o[t(r)??""]=0:(o[t("http://"+r)??""]=0,o[t("https://"+r)??""]=0)}function w(e){const n=r.request.crossOriginNoCorsDomains;if(n){let r=t(e);if(r)return r=r.toLowerCase(),!o(r,s())&&n[r]<Date.now()-36e5}return!1}async function L(e){const o=i(e);e=o.path,"json"===o.query?.f&&(e+="?f=json");try{await fetch(e,{mode:"no-cors",credentials:"include"})}catch{}const n=r.request.crossOriginNoCorsDomains,s=t(e);n&&s&&(n[s.toLowerCase()]=Date.now())}const v=new Map;function h(r,e){const t=e?.preferredHost;if(!t||o(r,`https://${t}`,!0))return;const n=c(r);if(!n||"FeatureServer"!==n.serverType||a(r))return;const s=n.url.path.toLowerCase();v.has(s)||v.set(s,t)}function E(r){const e=c(r)?.url.path.toLowerCase();if(!e)return r;const t=v.get(e);return t?n(r,t):r}export{m as createTimeoutError,E as getPreferredUrl,w as isNoCorsRequestRequired,p as isTimeoutError,u as loadImageAsync,v as preferredHosts,d as registerNoCorsDomains,L as sendNoCorsRequest,h as setPreferredHost};
@@ -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
- const c="20250807",e="64cc533f44803135373e0050983e83a9fec0d226";export{c as buildDate,e as commitHash};
5
+ const a="20250808",b="2a9f3b0219ac36efb1436ca51ab549875e257209";export{a as buildDate,b as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{version as i}from"../../../kernel.js";import t from"../../../core/Collection.js";import{abortMaybe as s,destroyMaybe as a}from"../../../core/maybe.js";import{watch as o}from"../../../core/reactiveUtils.js";import{queryToObject as l,objectToQuery as r}from"../../../core/urlUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../geometry/Extent.js";import{load as m,project as c}from"../../../geometry/projectionUtils.js";import d from"../../../geometry/SpatialReference.js";import{KMLMapImage as y}from"../../../layers/support/KMLMapImage.js";import{getGraphics as g,fetchService as w,parseKML as u}from"../../../layers/support/kmlUtils.js";import{parseUrl as _}from"../../../rest/utils.js";import{GraphicsCollection as b}from"../../../support/GraphicsCollection.js";import{Bitmap as V}from"../engine/Bitmap.js";import{BitmapContainer as f}from"../engine/BitmapContainer.js";import{LayerView2DMixin as v}from"./LayerView2D.js";import S from"./graphics/GraphicContainer.js";import I from"./graphics/GraphicsView2D.js";import x from"../../layers/LayerView.js";import{ImageReprojector as C}from"../../support/imageReprojection.js";class j{constructor(){this.allSublayers=new Map,this.allPoints=[],this.allPolylines=[],this.allPolygons=[],this.allMapImages=[]}}let k=class extends(v(x)){constructor(){super(...arguments),this._bitmapIndex=new Map,this._mapImageContainer=new f,this._kmlVisualData=new j,this._fetchController=null,this.allVisiblePoints=new b,this.allVisiblePolylines=new b,this.allVisiblePolygons=new b,this.allVisibleMapImages=new t}async hitTest(e,i){const t=this.layer;return[this._pointsView?.hitTest(e),this._polylinesView?.hitTest(e),this._polygonsView?.hitTest(e)].flat().filter(Boolean).map(i=>(i.layer=t,i.sourceLayer=t,{type:"graphic",graphic:i,layer:t,mapPoint:e}))}update(e){this._polygonsView&&this._polygonsView.processUpdate(e),this._polylinesView&&this._polylinesView.processUpdate(e),this._pointsView&&this._pointsView.processUpdate(e)}attach(){this._fetchController=new AbortController,this.container.addChild(this._mapImageContainer),this._polygonsView=new I({view:this.view,graphics:this.allVisiblePolygons,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._polygonsView.container),this._polylinesView=new I({view:this.view,graphics:this.allVisiblePolylines,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._polylinesView.container),this._pointsView=new I({view:this.view,graphics:this.allVisiblePoints,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._pointsView.container),this.addAttachHandles([this.allVisibleMapImages.on("change",e=>{e.added.forEach(e=>this._addMapImage(e)),e.removed.forEach(e=>this._removeMapImage(e))}),o(()=>this.layer.visibleSublayers,e=>{for(const i of this._kmlVisualData.allSublayers.values())i.visibility=0;for(const i of e){const e=this._kmlVisualData.allSublayers.get(i.id);e&&(e.visibility=1)}this._refreshCollections()})]),this._updatingHandles.addPromise(this._fetchService(this._fetchController.signal)),this._imageReprojector=new C}detach(){this._fetchController=s(this._fetchController),this._mapImageContainer.removeAllChildren(),this.container.removeAllChildren(),this._bitmapIndex.clear(),this._polygonsView=a(this._polygonsView),this._polylinesView=a(this._polylinesView),this._pointsView=a(this._pointsView),this._imageReprojector=a(this._imageReprojector)}viewChange(){this._polygonsView.viewChange(),this._polylinesView.viewChange(),this._pointsView.viewChange()}moveEnd(){}isUpdating(){return this._pointsView.updating||this._polygonsView.updating||this._polylinesView.updating}_addMapImage(e){(this.view.spatialReference?.isWGS84||this.view.spatialReference?.isWebMercator)&&this._imageReprojector.loadAndReprojectBitmapData(e.href,e.extent,this.view.spatialReference).then(i=>{const t=new V(i.bitmapData);t.x=i.extent.xmin,t.y=i.extent.ymax,t.resolution=i.extent.width/i.bitmapData.width,t.rotation=e.rotation,this._mapImageContainer.addChild(t),this._bitmapIndex.set(e,t)})}async _getViewDependentUrl(e,t){const{viewFormat:s,viewBoundScale:a,httpQuery:o}=e;if(null!=s){if(null==t)throw new Error("Loading this network link requires a view state.");let n;if(await m(),null!=a&&1!==a){const e=new p(t.extent);e.expand(a),n=e}else n=t.extent;n=c(n,d.WGS84);const h=c(n,d.WebMercator),y=n.xmin,g=n.xmax,w=n.ymin,u=n.ymax,b=t.size[0]*t.pixelRatio,V=t.size[1]*t.pixelRatio,f=Math.max(h.width,h.height),v={"[bboxWest]":y.toString(),"[bboxEast]":g.toString(),"[bboxSouth]":w.toString(),"[bboxNorth]":u.toString(),"[lookatLon]":n.center.x.toString(),"[lookatLat]":n.center.y.toString(),"[lookatRange]":f.toString(),"[lookatTilt]":"0","[lookatHeading]":t.rotation.toString(),"[lookatTerrainLon]":n.center.x.toString(),"[lookatTerrainLat]":n.center.y.toString(),"[lookatTerrainAlt]":"0","[cameraLon]":n.center.x.toString(),"[cameraLat]":n.center.y.toString(),"[cameraAlt]":f.toString(),"[horizFov]":"60","[vertFov]":"60","[horizPixels]":b.toString(),"[vertPixels]":V.toString(),"[terrainEnabled]":"0","[clientVersion]":i,"[kmlVersion]":"2.2","[clientName]":"ArcGIS API for JavaScript","[language]":"en-US"},S=e=>{for(const i in e){let t;for(t in v)e[i]=e[i].replace(t,v[t])}},I=l(s);S(I);let x={};null!=o&&(x=l(o),S(x));const C=_(e.href);C.query={...C.query,...I,...x};return`${C.path}?${r(I)}`}return e.href}async _fetchService(e){const i=new j;await this._loadVisualData(this.layer.url,i,e),this._kmlVisualData=i,this._refreshCollections()}_refreshCollections(){this.allVisiblePoints.removeAll(),this.allVisiblePolylines.removeAll(),this.allVisiblePolygons.removeAll(),this.allVisibleMapImages.removeAll(),this.allVisiblePoints.addMany(this._kmlVisualData.allPoints.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e)),this.allVisiblePolylines.addMany(this._kmlVisualData.allPolylines.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e)),this.allVisiblePolygons.addMany(this._kmlVisualData.allPolygons.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e)),this.allVisibleMapImages.addMany(this._kmlVisualData.allMapImages.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e))}_isSublayerVisible(e){const i=this._kmlVisualData.allSublayers.get(e);return!!i?.visibility&&(-1===i.parentFolderId||this._isSublayerVisible(i.parentFolderId))}_loadVisualData(e,i,t){return this._fetchParsedKML(e,t).then(async e=>{for(const s of e.sublayers){i.allSublayers.set(s.id,s);const e=s.points?await g(s.points):[],a=s.polylines?await g(s.polylines):[],o=s.polygons?await g(s.polygons):[],l=s.mapImages?.map(e=>y.fromJSON(e))??[];if(i.allPoints.push(...e.map(e=>({item:e,sublayerId:s.id}))),i.allPolylines.push(...a.map(e=>({item:e,sublayerId:s.id}))),i.allPolygons.push(...o.map(e=>({item:e,sublayerId:s.id}))),i.allMapImages.push(...l.map(e=>({item:e,sublayerId:s.id}))),s.networkLink){const e=await this._getViewDependentUrl(s.networkLink,this.view.state);await this._loadVisualData(e,i,t)}}})}_fetchParsedKML(e,i){return w(e,this.layer.spatialReference,this.layer.refreshInterval,i).then(e=>u(e.data))}_removeMapImage(e){const i=this._bitmapIndex.get(e);i&&(this._mapImageContainer.removeChild(i),this._bitmapIndex.delete(e))}};e([n()],k.prototype,"_pointsView",void 0),e([n()],k.prototype,"_polylinesView",void 0),e([n()],k.prototype,"_polygonsView",void 0),k=e([h("esri.views.2d.layers.KMLLayerView2D")],k);const P=k;export{P as default};
5
+ import{__decorate as e}from"tslib";import{version as i}from"../../../kernel.js";import t from"../../../core/Collection.js";import{abortMaybe as s,destroyMaybe as a}from"../../../core/maybe.js";import{watch as o}from"../../../core/reactiveUtils.js";import{queryToObject as l,objectToQuery as r}from"../../../core/urlUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../geometry/Extent.js";import{load as m,project as c}from"../../../geometry/projectionUtils.js";import d from"../../../geometry/SpatialReference.js";import{KMLMapImage as y}from"../../../layers/support/KMLMapImage.js";import{getGraphics as g,fetchService as w,parseKML as u}from"../../../layers/support/kmlUtils.js";import{parseUrl as _}from"../../../rest/utils.js";import{GraphicsCollection as V}from"../../../support/GraphicsCollection.js";import{Bitmap as f}from"../engine/Bitmap.js";import{BitmapContainer as b}from"../engine/BitmapContainer.js";import{LayerView2DMixin as v}from"./LayerView2D.js";import S from"./graphics/GraphicContainer.js";import x from"./graphics/GraphicsView2D.js";import C from"../../layers/LayerView.js";import{ImageReprojector as I}from"../../support/imageReprojection.js";class j{constructor(){this.allSublayers=new Map,this.allPoints=[],this.allPolylines=[],this.allPolygons=[],this.allMapImages=[]}}let k=class extends(v(C)){constructor(){super(...arguments),this._bitmapIndex=new Map,this._mapImageContainer=new b,this._kmlVisualData=new j,this._fetchController=null,this.allVisiblePoints=new V,this.allVisiblePolylines=new V,this.allVisiblePolygons=new V,this.allVisibleMapImages=new t}async hitTest(e,i){const t=this.layer;return[this._pointsView?.hitTest(e),this._polylinesView?.hitTest(e),this._polygonsView?.hitTest(e)].flat().filter(Boolean).map(i=>(i.layer=t,i.sourceLayer=t,{type:"graphic",graphic:i,layer:t,mapPoint:e}))}update(e){this._polygonsView&&this._polygonsView.processUpdate(e),this._polylinesView&&this._polylinesView.processUpdate(e),this._pointsView&&this._pointsView.processUpdate(e)}attach(){this._fetchController=new AbortController,this.container.addChild(this._mapImageContainer),this._polygonsView=new x({view:this.view,graphics:this.allVisiblePolygons,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._polygonsView.container),this._polylinesView=new x({view:this.view,graphics:this.allVisiblePolylines,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._polylinesView.container),this._pointsView=new x({view:this.view,graphics:this.allVisiblePoints,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._pointsView.container),this.addAttachHandles([this.allVisibleMapImages.on("change",e=>{e.added.forEach(e=>this._addMapImage(e)),e.removed.forEach(e=>this._removeMapImage(e))}),o(()=>this.layer.visibleSublayers,e=>{for(const i of this._kmlVisualData.allSublayers.values())i.visibility=0;for(const i of e){const e=this._kmlVisualData.allSublayers.get(i.id);e&&(e.visibility=1)}this._refreshCollections()})]),this._updatingHandles.addPromise(this._fetchService(this._fetchController.signal)),this._imageReprojector=new I}detach(){this._fetchController=s(this._fetchController),this._mapImageContainer.removeAllChildren(),this.container.removeAllChildren(),this._bitmapIndex.clear(),this._polygonsView=a(this._polygonsView),this._polylinesView=a(this._polylinesView),this._pointsView=a(this._pointsView),this._imageReprojector=a(this._imageReprojector)}viewChange(){this._polygonsView.viewChange(),this._polylinesView.viewChange(),this._pointsView.viewChange()}moveEnd(){}isUpdating(){return this._pointsView.updating||this._polygonsView.updating||this._polylinesView.updating}_addMapImage(e){(this.view.spatialReference?.isWGS84||this.view.spatialReference?.isWebMercator)&&this._imageReprojector.loadAndReprojectBitmapData(e.href,e.extent,this.view.spatialReference).then(i=>{const t=new f(i.bitmapData);t.x=i.extent.xmin,t.y=i.extent.ymax,t.resolution=i.extent.width/i.bitmapData.width,t.rotation=e.rotation,this._mapImageContainer.addChild(t),this._bitmapIndex.set(e,t)})}async _getViewDependentUrl(e,t){const{viewFormat:s,viewBoundScale:a,httpQuery:o}=e;if(null!=s){if(null==t)throw new Error("Loading this network link requires a view state.");let n;if(await m(),null!=a&&1!==a){const e=new p(t.extent);e.expand(a),n=e}else n=t.extent;n=c(n,d.WGS84);const h=c(n,d.WebMercator),y=n.xmin,g=n.xmax,w=n.ymin,u=n.ymax,V=t.size[0]*t.pixelRatio,f=t.size[1]*t.pixelRatio,b=Math.max(h.width,h.height),v={"[bboxWest]":y.toString(),"[bboxEast]":g.toString(),"[bboxSouth]":w.toString(),"[bboxNorth]":u.toString(),"[lookatLon]":n.center.x.toString(),"[lookatLat]":n.center.y.toString(),"[lookatRange]":b.toString(),"[lookatTilt]":"0","[lookatHeading]":t.rotation.toString(),"[lookatTerrainLon]":n.center.x.toString(),"[lookatTerrainLat]":n.center.y.toString(),"[lookatTerrainAlt]":"0","[cameraLon]":n.center.x.toString(),"[cameraLat]":n.center.y.toString(),"[cameraAlt]":b.toString(),"[horizFov]":"60","[vertFov]":"60","[horizPixels]":V.toString(),"[vertPixels]":f.toString(),"[terrainEnabled]":"0","[clientVersion]":i,"[kmlVersion]":"2.2","[clientName]":"ArcGIS API for JavaScript","[language]":"en-US"},S=e=>{for(const i in e){let t;for(t in v)e[i]=e[i].replace(t,v[t])}},x=l(s);S(x);let C={};null!=o&&(C=l(o),S(C));const I=_(e.href);I.query={...I.query,...x,...C};return`${I.path}?${r(x)}`}return e.href}async _fetchService(e){const i=new j;await this._loadVisualData(this.layer.url,i,e),this._kmlVisualData=i,this._refreshCollections()}_refreshCollections(){this.allVisiblePoints.removeAll(),this.allVisiblePolylines.removeAll(),this.allVisiblePolygons.removeAll(),this.allVisibleMapImages.removeAll();const e=(e,i)=>{e.addMany(i.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e))};e(this.allVisiblePoints,this._kmlVisualData.allPoints),e(this.allVisiblePolylines,this._kmlVisualData.allPolylines),e(this.allVisiblePolygons,this._kmlVisualData.allPolygons),this.allVisibleMapImages.addMany(this._kmlVisualData.allMapImages.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e))}_isSublayerVisible(e){const i=this._kmlVisualData.allSublayers.get(e);return!!i?.visibility&&(-1===i.parentFolderId||this._isSublayerVisible(i.parentFolderId))}_loadVisualData(e,i,t){return this._fetchParsedKML(e,t).then(async e=>{for(const s of e.sublayers){i.allSublayers.set(s.id,s);const e=await g(s,"points",this.layer,s.id),a=await g(s,"polylines",this.layer,s.id),o=await g(s,"polygons",this.layer,s.id),l=s.mapImages?.map(e=>y.fromJSON(e))??[];if(i.allPoints.push(...e.map(e=>({item:e,sublayerId:s.id}))),i.allPolylines.push(...a.map(e=>({item:e,sublayerId:s.id}))),i.allPolygons.push(...o.map(e=>({item:e,sublayerId:s.id}))),i.allMapImages.push(...l.map(e=>({item:e,sublayerId:s.id}))),s.networkLink){const e=await this._getViewDependentUrl(s.networkLink,this.view.state);await this._loadVisualData(e,i,t)}}})}_fetchParsedKML(e,i){return w(e,this.layer.spatialReference,this.layer.refreshInterval,i).then(e=>u(e.data))}_removeMapImage(e){const i=this._bitmapIndex.get(e);i&&(this._mapImageContainer.removeChild(i),this._bitmapIndex.delete(e))}};e([n()],k.prototype,"_pointsView",void 0),e([n()],k.prototype,"_polylinesView",void 0),e([n()],k.prototype,"_polygonsView",void 0),k=e([h("esri.views.2d.layers.KMLLayerView2D")],k);const P=k;export{P as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../../core/Evented.js";import r from"../../../../../core/Logger.js";import{watch as i,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import a from"../../../../../geometry/Point.js";import{tryProjectWithZConversion as l}from"../../../../../geometry/projectionUtils.js";import{empty as h,expandPointInPlace as c}from"../../../../../geometry/support/aaBoundingRect.js";import{logFailedGeometryProjectionError as m}from"../../support/projectionUtils.js";import{createCoordinateHelper as u}from"../../../../interactive/coordinateHelper.js";import{EditGeometry as p,Part as d}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as y}from"../../../../interactive/editGeometry/EditGeometryOperations.js";let g=class extends t{constructor(e={}){super(e),this._version=0,this._internalGeometryChange=!1,this._extent=h()}set areaMeasurement(e){this._set("areaMeasurement",e),null!=e&&null!=this.view&&this._initialize(e,this.view)}set view(e){this._set("view",e),null!=e&&null!=this.areaMeasurement&&this._initialize(this.areaMeasurement,e)}get constructed(){return null!=this.areaMeasurement&&null!=this.view}get version(){return this._version}get isEmptyPolygon(){return!this.constructed||0===this._editGeometry.parts.length}get isValidPolygon(){return this.constructed&&this.polygonIsClosed}get extent(){if(this.constructed&&this._editGeometry.parts[0]?.vertices.length){const e=h(this._extent);return this.forEachVertex(t=>{c(e,t.pos)}),e}return null}get spatialReference(){return this.constructed?this._editGeometry.coordinateHelper.spatialReference:null}_initialize(e,t){this.removeAllHandles(),this.addHandles(i(()=>e.geometry,()=>{this._updateEditGeometryFromModelGeometry(e,t)},o)),this._makeDirty(!0)}_makeDirty(e=!1){this.notifyChange("polygonIsClosed"),this.notifyChange("isValidPolygon"),this.notifyChange("initialized"),this.notifyChange("extent"),e&&this.notifyChange("numVertices")}_updateEditGeometryFromModelGeometry(e,t){if(this._version++,this._internalGeometryChange)return;this.removeHandles("EditGeometry");let i=e.geometry;if(null!=i){const o=l(i,t.spatialReference);null==o&&m(e,i.spatialReference,r.getLogger(this)),i=o}this._editGeometryOperations=null!=i?y.fromGeometry(i,t.state.viewingMode):new y(new p("polygon",u(!0,!1,t.spatialReference)),t.state.viewingMode),this._makeDirty(!0),this.emit("change"),this.addHandles(this._editGeometry.on("change",t=>{this._makeDirty(null!=t.addedVertices||null!=t.removedVertices),this._internalGeometryChange=!0,e.geometry=this.numVertices>0?this._editGeometry.geometry:null,this._internalGeometryChange=!1}),"EditGeometry")}get _editGeometry(){return this._editGeometryOperations.data}get vertices(){const e=[];return this.forEachVertex(t=>{e.push(t)}),e}get numVertices(){return this.constructed?this._editGeometry.parts[0]?.vertices.length??0:0}get polygonIsClosed(){return this._editGeometry.parts[0]?.isClosed()??!1}get firstPoint(){if(this.constructed){const{coordinateHelper:e,parts:t}=this._editGeometry,r=t[0]?.getFirstVertex();if(null!=r)return e.vectorToPoint(r.pos)}return null}get lastPoint(){if(this.constructed){const{coordinateHelper:e,parts:t}=this._editGeometry,r=t[0]?.getLastVertex();if(null!=r)return e.vectorToPoint(r.pos)}return null}getVertex(e){if(!this.constructed||!this._editGeometry.parts[0]?.vertices.length)return null;const t=this._editGeometry.parts[0].vertices[0];let r=t;do{if(r.index===e)return r;r=r.rightSegment.rightVertex}while(r!==t&&null!=r);return null}getVertexPositionAsPoint(e){return this._editGeometry.coordinateHelper.vectorToPoint(e.pos)}getVertexPositionAsPointFromIndex(e){return this._editGeometry.coordinateHelper.vectorToPoint(this.getVertex(e).pos)}forEachVertex(e){if(this.constructed&&this._editGeometry.parts.length>0)for(const t of this._editGeometry.parts[0].iterateVertices())e(t,t.index)}forEachVertexPosition(e){const t=this._editGeometry.coordinateHelper;this.forEachVertex((r,i)=>{t.vectorToPoint(r.pos,f),e(f,i)})}clear(){null!=this.areaMeasurement&&(this.areaMeasurement.geometry=null)}add(e){if(!this.constructed)return null;if(0===this._editGeometry.parts.length){const e=this.view;this._editGeometry.parts.push(new d(e.spatialReference,e.state.viewingMode))}const t=this._editGeometryOperations.appendVertex(this._editGeometry.coordinateHelper.pointToVector(e));return this.emit("change"),t}close(){if(!this.constructed||0===this._editGeometry.parts.length)return null;const e=this._editGeometryOperations.closePart(this._editGeometry.parts[0]);return this.emit("change"),e}ensureContains(e,t=""){let r=!1;if(this._editGeometry.parts.forEach(t=>{for(const i of t.iterateVertices())i===e&&(r=!0)}),!r)throw new Error(`vertex doesn't exist ${t}`);return r}setVertexPosition(e,t){if(!this.constructed)return null;const r=this._editGeometryOperations.setVertexPosition(e,this._editGeometry.coordinateHelper.pointToVector(t));return this.emit("change"),r}equals(e){if(this.numVertices!==e.numVertices)return!1;let t=!0;return this.forEachVertexPosition((r,i)=>{const o=e.getVertexPositionAsPointFromIndex(i);r.equals(o)||(t=!1)}),!!t}};e([s({value:null})],g.prototype,"areaMeasurement",null),e([s({value:null})],g.prototype,"view",null),e([s()],g.prototype,"isEmptyPolygon",null),e([s()],g.prototype,"isValidPolygon",null),e([s()],g.prototype,"extent",null),e([s()],g.prototype,"spatialReference",null),e([s()],g.prototype,"numVertices",null),e([s()],g.prototype,"polygonIsClosed",null),g=e([n("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementPathHelper")],g);const f=new a;export{g as AreaMeasurement3DPathHelper};
5
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../../core/Evented.js";import r from"../../../../../core/Logger.js";import{watch as i,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import a from"../../../../../geometry/Point.js";import{tryProjectWithZConversion as l}from"../../../../../geometry/projectionUtils.js";import{empty as h,expandPointInPlace as c}from"../../../../../geometry/support/aaBoundingRect.js";import{logFailedGeometryProjectionError as m}from"../../support/projectionUtils.js";import{createCoordinateHelper as u}from"../../../../interactive/coordinateHelper.js";import{EditGeometry as p}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as d}from"../../../../interactive/editGeometry/EditGeometryOperations.js";let y=class extends t{constructor(e={}){super(e),this._version=0,this._internalGeometryChange=!1,this._extent=h()}set areaMeasurement(e){this._set("areaMeasurement",e),null!=e&&null!=this.view&&this._initialize(e,this.view)}set view(e){this._set("view",e),null!=e&&null!=this.areaMeasurement&&this._initialize(this.areaMeasurement,e)}get constructed(){return null!=this.areaMeasurement&&null!=this.view}get version(){return this._version}get isEmptyPolygon(){return!this.constructed||0===this._editGeometry.parts.length}get isValidPolygon(){return this.constructed&&this.polygonIsClosed}get extent(){if(this.constructed&&this._editGeometry.parts[0]?.vertices.length){const e=h(this._extent);return this.forEachVertex(t=>{c(e,t.pos)}),e}return null}get spatialReference(){return this.constructed?this._editGeometry.coordinateHelper.spatialReference:null}_initialize(e,t){this.removeAllHandles(),this.addHandles(i(()=>e.geometry,()=>{this._updateEditGeometryFromModelGeometry(e,t)},o)),this._makeDirty(!0)}_makeDirty(e=!1){this.notifyChange("polygonIsClosed"),this.notifyChange("isValidPolygon"),this.notifyChange("initialized"),this.notifyChange("extent"),e&&this.notifyChange("numVertices")}_updateEditGeometryFromModelGeometry(e,t){if(this._version++,this._internalGeometryChange)return;this.removeHandles("EditGeometry");let i=e.geometry;if(null!=i){const o=l(i,t.spatialReference);null==o&&m(e,i.spatialReference,r.getLogger(this)),i=o}this._editGeometryOperations=null!=i?d.fromGeometry(i,t.state.viewingMode):new d(new p("polygon",u(!0,!1,t.spatialReference)),t.state.viewingMode),this._makeDirty(!0),this.emit("change"),this.addHandles(this._editGeometry.on("change",t=>{this._makeDirty(null!=t.addedVertices||null!=t.removedVertices),this._internalGeometryChange=!0,e.geometry=this.numVertices>0?this._editGeometry.geometry:null,this._internalGeometryChange=!1}),"EditGeometry")}get _editGeometry(){return this._editGeometryOperations.data}get vertices(){const e=[];return this.forEachVertex(t=>{e.push(t)}),e}get numVertices(){return this.constructed?this._editGeometry.parts[0]?.vertices.length??0:0}get polygonIsClosed(){return this._editGeometry.parts[0]?.isClosed()??!1}get firstPoint(){if(this.constructed){const{coordinateHelper:e,parts:t}=this._editGeometry,r=t[0]?.getFirstVertex();if(null!=r)return e.vectorToPoint(r.pos)}return null}get lastPoint(){if(this.constructed){const{coordinateHelper:e,parts:t}=this._editGeometry,r=t[0]?.getLastVertex();if(null!=r)return e.vectorToPoint(r.pos)}return null}getVertex(e){if(!this.constructed||!this._editGeometry.parts[0]?.vertices.length)return null;const t=this._editGeometry.parts[0].vertices[0];let r=t;do{if(r.index===e)return r;r=r.rightSegment.rightVertex}while(r!==t&&null!=r);return null}getVertexPositionAsPoint(e){return this._editGeometry.coordinateHelper.vectorToPoint(e.pos)}getVertexPositionAsPointFromIndex(e){return this._editGeometry.coordinateHelper.vectorToPoint(this.getVertex(e).pos)}forEachVertex(e){if(this.constructed&&this._editGeometry.parts.length>0)for(const t of this._editGeometry.parts[0].iterateVertices())e(t,t.index)}forEachVertexPosition(e){const t=this._editGeometry.coordinateHelper;this.forEachVertex((r,i)=>{t.vectorToPoint(r.pos,g),e(g,i)})}clear(){null!=this.areaMeasurement&&(this.areaMeasurement.geometry=null)}add(e){if(!this.constructed)return null;const t=this._editGeometryOperations.appendVertex(this._editGeometry.coordinateHelper.pointToVector(e),this._editGeometry.parts.at(0));return this.emit("change"),t}close(){if(!this.constructed||0===this._editGeometry.parts.length)return null;const e=this._editGeometryOperations.closePart(this._editGeometry.parts[0]);return this.emit("change"),e}ensureContains(e,t=""){let r=!1;if(this._editGeometry.parts.forEach(t=>{for(const i of t.iterateVertices())i===e&&(r=!0)}),!r)throw new Error(`vertex doesn't exist ${t}`);return r}setVertexPosition(e,t){if(!this.constructed)return null;const r=this._editGeometryOperations.setVertexPosition(e,this._editGeometry.coordinateHelper.pointToVector(t));return this.emit("change"),r}equals(e){if(this.numVertices!==e.numVertices)return!1;let t=!0;return this.forEachVertexPosition((r,i)=>{const o=e.getVertexPositionAsPointFromIndex(i);r.equals(o)||(t=!1)}),!!t}};e([s({value:null})],y.prototype,"areaMeasurement",null),e([s({value:null})],y.prototype,"view",null),e([s()],y.prototype,"isEmptyPolygon",null),e([s()],y.prototype,"isValidPolygon",null),e([s()],y.prototype,"extent",null),e([s()],y.prototype,"spatialReference",null),e([s()],y.prototype,"numVertices",null),e([s()],y.prototype,"polygonIsClosed",null),y=e([n("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementPathHelper")],y);const g=new a;export{y as AreaMeasurement3DPathHelper};
@@ -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 e from"../../../../Color.js";import t from"../../../../core/Handles.js";import{watch as r,initial as o}from"../../../../core/reactiveUtils.js";import{fromTranslation as i,mul as s,fromXRotation as a,fromYRotation as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as c}from"../../../../chunks/vec32.js";import{fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{displayFocusMultiplier as p}from"../Slice/sliceToolConfig.js";import{viewshedToolManipulatorConfiguration as f}from"./ViewshedConfiguration.js";import{Manipulator3D as h}from"../../interactive/Manipulator3D.js";import{RenderObject as d}from"../../interactive/RenderObject.js";import{createTubeGeometry as u,createExtrudedTriangle as j}from"../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as g}from"../../webgl-engine/materials/ColorMaterial.js";class w extends h{constructor(e,r){super({view:e,autoScaleRenderObjects:!1,worldSized:!1,radius:f.collisionRadius}),this._handles=new t,this._setupManipulatorVisual(r)}destroy(){this._handles.remove(),super.destroy()}_setupManipulatorVisual(e){const t=this._createMaterial(),r=1,o=[m(0,0,0),m(0,0,r)],h=u(t,o,e,16,!1),j=u(t,o,e*p,16,!1),g=b(!1,t,e),w=b(!0,t,e),M=l();i(M,o[o.length-1]),s(M,M,a(v,Math.PI/2)),s(M,M,n(v,Math.PI/2)),g.transformation=M,w.transformation=M,this.renderObjects=[new d(h,1),new d(j,2),new d(g,1),new d(w,2)];const _=m(0,f.getScaleOrientArrowTipLength(!0),0),O=c(_,_,M),x=[...o,O];this.collisionType={type:"line",paths:[x]}}_createMaterial(){const t=new g({cullFace:2,renderOccluded:4,isDecoration:!0});return this._handles.add(r(()=>e.toUnitRGBA(this.view.effectiveTheme.accentColor),e=>t.setParameters({color:e}),o)),t}}function b(e,t,r){const o=f.getScaleOrientArrowTipLength(e);let i=2*r;e&&(i*=p);const s=o/2;return j(t,o,s,s,i,0)}const v=l();export{w as ArrowManipulator};
5
+ import e from"../../../../Color.js";import t from"../../../../core/Handles.js";import{watch as r,initial as o}from"../../../../core/reactiveUtils.js";import{fromTranslation as i,mul as s,fromXRotation as a,fromYRotation as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as c}from"../../../../chunks/vec32.js";import{fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{displayFocusMultiplier as p}from"../Slice/sliceToolConfig.js";import{viewshedToolManipulatorConfiguration as f}from"./ViewshedConfiguration.js";import{Manipulator3D as h}from"../../interactive/Manipulator3D.js";import{RenderObject as d}from"../../interactive/RenderObject.js";import{createTubeGeometry as u,createExtrudedTriangle as j}from"../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as g}from"../../webgl-engine/materials/ColorMaterial.js";class w extends h{constructor(e,r){super({view:e,autoScaleRenderObjects:!1,worldSized:!1,radius:f.collisionRadius}),this._handles=new t,this._setupManipulatorVisual(r)}destroy(){this._handles.remove(),super.destroy()}_setupManipulatorVisual(e){const t=this._createMaterial(),r=1,o=[m(0,0,0),m(0,0,r)],h=u(t,o,e,16,!1),j=u(t,o,e*p,16,!1),g=b(!1,t,e),w=b(!0,t,e),M=l();i(M,o[o.length-1]),s(M,M,a(v,Math.PI/2)),s(M,M,n(v,Math.PI/2)),g.transformation=M,w.transformation=M,this.renderObjects=[new d(h,1),new d(j,2),new d(g,1),new d(w,2)];const _=m(0,f.getScaleOrientArrowTipLength(!0),0),O=c(_,_,M),x=[...o,O];this.collisionType={type:"line",paths:[x]}}_createMaterial(){const t=new g({cullFace:2,renderOccluded:4,isDecoration:!0});return this._handles.add(r(()=>e.toUnitRGBA(this.view.effectiveTheme.accentColor),e=>t.setParameters({color:e}),o)),t}}function b(e,t,r){const o=f.getScaleOrientArrowTipLength(e);let i=2*r;e&&(i*=p);const s=o/2;return j(t,o,s,s,i,0)}const v=l();export{w as ViewshedArrowManipulator};
@@ -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 t from"../../../../Color.js";import r from"../../../../core/Handles.js";import{handlesGroup as e}from"../../../../core/handleUtils.js";import{deg2rad as a,clamp as i}from"../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as n,initial as s}from"../../../../core/reactiveUtils.js";import{fromYRotation as l,fromXRotation as c,fromScaling as u,fromZRotation as p,fromRotation as m,multiply as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as d,a as g,g as _}from"../../../../chunks/vec32.js";import{create as M,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as v}from"../../../../chunks/boundedPlane.js";import{viewshedToolManipulatorConfiguration as j}from"./ViewshedConfiguration.js";import{getViewshedRotationMatrix as w,screenToCircleAngle as A}from"./viewshedToolUtils.js";import{Manipulator3D as V}from"../../interactive/Manipulator3D.js";import{RenderObject as O}from"../../interactive/RenderObject.js";import{InteractiveManipulation as E}from"../../interactive/editingTools/manipulations/InteractiveManipulation.js";import{createPolylineGeometry as y}from"../../webgl-engine/lib/GeometryUtil.js";import{assert as R}from"../../webgl-engine/lib/Util.js";import{RibbonLineMaterial as T}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as U}from"../../../interactive/dragEventPipeline.js";class x extends E{constructor(t){super(),this._handles=new r,this._tool=t.tool,this._view=t.view,this._focusedArcMaterial=this._createArcMaterial(!0),this._unfocusedArcMaterial=this._createArcMaterial(!1),this._createManipulators(),this.forEachManipulator(t=>this._tool.manipulators.add(t))}destroy(){this._handles=o(this._handles),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._manipulators=null}createDragPipeline(t,r){const a=Object.values(this._manipulators);return e(a.map(({manipulator:e,side:a})=>U(e,(e,i,o,n,s)=>{const l=z(a,r),c=i.next(t=>({...t,manipulatorType:2,side:a})),u=A(c,this._view,l,r);t(e,u,o)})))}updateManipulatorsTransform(t){t.arcCentersPoints(H),this._forEachManipulatorInfo(r=>this._updateArcManipulatorTransform(r,t,H[r.side]))}updateManipulatorVisuals(t){this._forEachManipulatorInfo(r=>this._updateArcManipulatorVisuals(r,t))}_updateArcManipulatorVisuals({manipulator:t,side:r},e){const a=[];if(null!=e){const[i,o]=P(r,e,this._unfocusedArcMaterial);a.push(new O(i,1),new O(i.instantiate({material:this._focusedArcMaterial}),2)),t.collisionType={type:"line",paths:[o]}}t.renderObjects=a,t.radius=j.collisionRadius}_updateArcManipulatorTransform({manipulator:t,side:r},e,i){const o=e.horizontalFieldOfView,n=a(e.verticalFieldOfView/2),s=a(o/2),g=I(r);t.renderLocation=i;const _=f(),M=t=>{h(_,t,_)};M(l(k,a(-90))),g||M(c(k,n));const b=e.farDistanceRenderSpace;let v,j;M(u(k,d(L,b,b,b))),M(p(k,F(r))),M(w(e,k)),g?(v=s,j=e.tiltedUpVector):(j=e.rightVector,v=n),v*="right"===r||"bottom"===r?-1:1;const A=m(k,v,j);null!=A&&M(A),t.modelTransform=_}_createManipulators(){const t=this._createArcManipulator("left"),r=this._createArcManipulator("right"),e=this._createArcManipulator("top"),a=this._createArcManipulator("bottom");this._manipulators={left:t,right:r,top:e,bottom:a};[[a.manipulator,e.manipulator],[t.manipulator,r.manipulator]].forEach(([t,r])=>{t.metadata={pairedManipulator:r},r.metadata={pairedManipulator:t}})}_createArcManipulator(t){const r=new V({view:this._view,autoScaleRenderObjects:!1,worldSized:!0}),e={manipulator:r,side:t};return this._updateArcManipulatorVisuals(e),this._handles.add(r.events.on(["focus-changed","grab-changed"],t=>{const e=r.metadata?.pairedManipulator;null!=e&&(e.hovering!==r.hovering&&(e.hovering=r.hovering),e.grabbing!==r.grabbing&&(e.grabbing=r.grabbing))})),e}_createArcMaterial(r){const e=j.getFovArcWidth(r),a=new T({renderOccluded:4,isDecoration:!0,width:e});return this._handles.add(n(()=>t.toUnitRGBA(this._view.effectiveTheme.accentColor),t=>a.setParameters({color:t}),s)),a}forEachManipulator(t){Object.values(this._manipulators).forEach(({manipulator:r})=>t(r,2))}_forEachManipulatorInfo(t){Object.values(this._manipulators).forEach(r=>t(r))}get test(){return{manipulators:this._manipulators}}}function P(t,r,e){const{horizontalFieldOfView:o,verticalFieldOfView:n}=r,s=I(t),l=a(i((s?n:o)/2,0,15)),c=S(-l/2,l/2,s?1:Math.max(Math.sin(a(90-n/2)),.1));return[y(e,c),c]}function S(t,r,e,a=10){R(a>1,"createArcPolylineGeometry() needs at least 2 for numVertices");const i=r-t;if(i<=0||e<=0){const t=.01;return[b(0,0,t),b(0,0,-t)]}const o=[],n=i/a;for(let s=0;s<a;s++){let i=t+s*n;s===a-1&&(i=r);const l=Math.cos(i)*e,c=Math.sin(i)*e,u=b(l-e,0,c);o.push(u)}return o}function D(t){switch(t){case"left":return 0;case"bottom":return 1;case"right":return 2;case"top":return 3}}function F(t){return D(t)*G}function I(t){return"left"===t||"right"===t}function C(t){return"left"===t?"right":"right"===t?"left":"top"===t?"bottom":"top"}function z(t,{observerRenderSpace:r,targetRenderSpace:e,tiltedUpVector:a,rightVector:i,farDistanceRenderSpace:o}){const n=g(L,e,r),s=I(t)?i:a,l=_(B,s,o);return v(r,n,l)}const G=Math.PI/2,k=f(),L=M(),B=M(),H={top:M(),bottom:M(),left:M(),right:M()};export{x as FieldOfViewManipulation,S as createArcPolylineVertices,C as flipSide,I as isSideHorizontal,F as sideToRad};
5
+ import t from"../../../../Color.js";import r from"../../../../core/Handles.js";import{handlesGroup as e}from"../../../../core/handleUtils.js";import{deg2rad as a,clamp as i}from"../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as n,initial as s}from"../../../../core/reactiveUtils.js";import{fromYRotation as l,fromXRotation as c,fromScaling as u,fromZRotation as p,fromRotation as m,multiply as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as d,a as g,g as _}from"../../../../chunks/vec32.js";import{create as M,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as v}from"../../../../chunks/boundedPlane.js";import{viewshedToolManipulatorConfiguration as j}from"./ViewshedConfiguration.js";import{getViewshedRotationMatrix as w,screenToCircleAngle as A}from"./viewshedToolUtils.js";import{Manipulator3D as V}from"../../interactive/Manipulator3D.js";import{RenderObject as O}from"../../interactive/RenderObject.js";import{InteractiveManipulation as E}from"../../interactive/editingTools/manipulations/InteractiveManipulation.js";import{createPolylineGeometry as y}from"../../webgl-engine/lib/GeometryUtil.js";import{assert as R}from"../../webgl-engine/lib/Util.js";import{RibbonLineMaterial as T}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as U}from"../../../interactive/dragEventPipeline.js";class x extends E{constructor(t){super(),this._handles=new r,this._tool=t.tool,this._view=t.view,this._focusedArcMaterial=this._createArcMaterial(!0),this._unfocusedArcMaterial=this._createArcMaterial(!1),this._createManipulators(),this.forEachManipulator(t=>this._tool.manipulators.add(t))}destroy(){this._handles=o(this._handles),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._manipulators=null}createDragPipeline(t,r){const a=Object.values(this._manipulators);return e(a.map(({manipulator:e,side:a})=>U(e,(e,i,o,n,s)=>{const l=z(a,r),c=i.next(t=>({...t,manipulatorType:2,side:a})),u=A(c,this._view,l,r);t(e,u,o)})))}updateManipulatorsTransform(t){t.arcCentersPoints(H),this._forEachManipulatorInfo(r=>this._updateArcManipulatorTransform(r,t,H[r.side]))}updateManipulatorVisuals(t){this._forEachManipulatorInfo(r=>this._updateArcManipulatorVisuals(r,t))}_updateArcManipulatorVisuals({manipulator:t,side:r},e){const a=[];if(null!=e){const[i,o]=P(r,e,this._unfocusedArcMaterial);a.push(new O(i,1),new O(i.instantiate({material:this._focusedArcMaterial}),2)),t.collisionType={type:"line",paths:[o]}}t.renderObjects=a,t.radius=j.collisionRadius}_updateArcManipulatorTransform({manipulator:t,side:r},e,i){const o=e.horizontalFieldOfView,n=a(e.verticalFieldOfView/2),s=a(o/2),g=I(r);t.renderLocation=i;const _=f(),M=t=>{h(_,t,_)};M(l(k,a(-90))),g||M(c(k,n));const b=e.farDistanceRenderSpace;let v,j;M(u(k,d(L,b,b,b))),M(p(k,F(r))),M(w(e,k)),g?(v=s,j=e.tiltedUpVector):(j=e.rightVector,v=n),v*="right"===r||"bottom"===r?-1:1;const A=m(k,v,j);null!=A&&M(A),t.modelTransform=_}_createManipulators(){const t=this._createArcManipulator("left"),r=this._createArcManipulator("right"),e=this._createArcManipulator("top"),a=this._createArcManipulator("bottom");this._manipulators={left:t,right:r,top:e,bottom:a};[[a.manipulator,e.manipulator],[t.manipulator,r.manipulator]].forEach(([t,r])=>{t.metadata={pairedManipulator:r},r.metadata={pairedManipulator:t}})}_createArcManipulator(t){const r=new V({view:this._view,autoScaleRenderObjects:!1,worldSized:!0}),e={manipulator:r,side:t};return this._updateArcManipulatorVisuals(e),this._handles.add(r.events.on(["focus-changed","grab-changed"],t=>{const e=r.metadata?.pairedManipulator;null!=e&&(e.hovering!==r.hovering&&(e.hovering=r.hovering),e.grabbing!==r.grabbing&&(e.grabbing=r.grabbing))})),e}_createArcMaterial(r){const e=j.getFovArcWidth(r),a=new T({renderOccluded:4,isDecoration:!0,width:e});return this._handles.add(n(()=>t.toUnitRGBA(this._view.effectiveTheme.accentColor),t=>a.setParameters({color:t}),s)),a}forEachManipulator(t){Object.values(this._manipulators).forEach(({manipulator:r})=>t(r,2))}_forEachManipulatorInfo(t){Object.values(this._manipulators).forEach(r=>t(r))}get test(){return{manipulators:this._manipulators}}}function P(t,r,e){const{horizontalFieldOfView:o,verticalFieldOfView:n}=r,s=I(t),l=a(i((s?n:o)/2,0,15)),c=S(-l/2,l/2,s?1:Math.max(Math.sin(a(90-n/2)),.1));return[y(e,c),c]}function S(t,r,e,a=10){R(a>1,"createArcPolylineGeometry() needs at least 2 for numVertices");const i=r-t;if(i<=0||e<=0){const t=.01;return[b(0,0,t),b(0,0,-t)]}const o=[],n=i/a;for(let s=0;s<a;s++){let i=t+s*n;s===a-1&&(i=r);const l=Math.cos(i)*e,c=Math.sin(i)*e,u=b(l-e,0,c);o.push(u)}return o}function D(t){switch(t){case"left":return 0;case"bottom":return 1;case"right":return 2;case"top":return 3}}function F(t){return D(t)*G}function I(t){return"left"===t||"right"===t}function C(t){return"left"===t?"right":"right"===t?"left":"top"===t?"bottom":"top"}function z(t,{observerRenderSpace:r,targetRenderSpace:e,tiltedUpVector:a,rightVector:i,farDistanceRenderSpace:o}){const n=g(L,e,r),s=I(t)?i:a,l=_(B,s,o);return v(r,n,l)}const G=Math.PI/2,k=f(),L=M(),B=M(),H={top:M(),bottom:M(),left:M(),right:M()};export{x as ViewshedFieldOfViewManipulation,S as createArcPolylineVertices,C as flipSide,I as isSideHorizontal,F as sideToRad};
@@ -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 t from"../../../../core/Handles.js";import{deg2rad as i}from"../../../../core/mathUtils.js";import{fromScaling as e,fromTranslation as a,fromZRotation as r,mul as o,fromYRotation as n,multiply as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as m,g as c,f as p,a as u,H as h,e as d,b as f,n as _}from"../../../../chunks/vec32.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as v}from"../../../../chunks/boundedPlane.js";import{fromValues as T}from"../../../../geometry/support/ray.js";import{displayFocusMultiplier as w}from"../Slice/sliceToolConfig.js";import{ViewshedArrowManipulator as j}from"./ViewshedArrowManipulator.js";import{viewshedToolManipulatorConfiguration as D}from"./ViewshedConfiguration.js";import{getViewshedRotationMatrix as H,screenToCircleAngle as x}from"./viewshedToolUtils.js";import{screenToRenderRay as S}from"../../interactive/editingTools/dragEventPipeline3D.js";import{discRadiusSmall as M,discRadius as P}from"../../interactive/editingTools/manipulations/config.js";import{InteractiveManipulation as R}from"../../interactive/editingTools/manipulations/InteractiveManipulation.js";import{createManipulatorDragEventPipeline as b,dragAtLocation as y}from"../../../interactive/dragEventPipeline.js";class V extends R{constructor(i){super(),this._handles=new t,this._tool=i.tool,this._view=i.view;const e=D.scaleOrientHandleRadius;this._manipulatorHeading=new j(this._view,e),this._manipulatorTilt=new j(this._view,e),this._manipulatorDistance=new j(this._view,e),this.forEachManipulator(t=>this._tool.manipulators.add(t))}destroy(){this._handles.destroy(),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._manipulatorHeading=null,this._manipulatorTilt=null,this._manipulatorDistance=null,this._tool=null,this._view=null}createHeadingDragPipeline(t,e){return b(this._manipulatorHeading,(a,r,o,n,s)=>{const l=this._view,{tiltParallelToSurface:m,farDistanceRenderSpace:d,upVector:f,observerRenderSpace:_,targetRenderSpace:g,rightVector:T}=e,w=Math.sin(i(m))*d,j=p(L,_,c(O,f,w)),D=u(O,g,j),H=c(k,T,h(D)),S=v(j,D,H),M=x(r,l,S,e).next(t=>({...t,manipulatorType:3}));t(a,M,o)})}createTiltDragPipeline(t,i){return b(this._manipulatorTilt,(e,a,r,o,n)=>{const{observerRenderSpace:s,farDistanceRenderSpace:l,upVector:m,targetDirection:p}=i,u=d(p,m),h=f(L,p,m,-u);c(h,_(h,h),l);const g=c(O,m,l),T=v(s,h,g),w=x(a,this._view,T,i).next(t=>({...t,manipulatorType:3}));t(e,w,r)})}createDistanceDragPipeline(t,i){return b(this._manipulatorDistance,(e,a,r,o,n)=>{const s=T(i.observerRenderSpace,i.targetDirection),l=a.next(y(this._view,e.location)).next(S(this._view,s)).next(t=>({...t,manipulatorType:2}));t(e,l,r)})}updateManipulators(t){const{targetRenderSpace:i}=t;this._manipulatorHeading.renderLocation=i,this._manipulatorTilt.renderLocation=i,this._manipulatorDistance.renderLocation=i;const p=l(),u=t=>{s(p,t,p)},h=D.scaleOrientSize*(M/P);u(e(E,m(L,h,h,h))),u(H(t,E));const d=D.scaleOrientHandleRadius*w*h,f=c(L,t.targetDirection,d);u(a(E,f));const _=r(E,-C);o(_,_,n(I,-C)),this._manipulatorHeading.modelTransform=o(l(),p,_);const g=n(E,C);o(g,g,r(I,Math.PI)),this._manipulatorTilt.modelTransform=s(l(),p,g),this._manipulatorDistance.modelTransform=p}forEachManipulator(t){t(this._manipulatorHeading,3),t(this._manipulatorTilt,3),t(this._manipulatorDistance,2)}}const E=l(),I=l(),L=g(),O=g(),k=g(),C=Math.PI/2;export{V as ViewshedScaleOrientManipulation};
@@ -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{deg2rad as t}from"../../../../core/mathUtils.js";import{fromScaling as e,mul as r,fromTranslation as s,fromRotation as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as a,c as n,t as l}from"../../../../chunks/vec32.js";import{fromValues as m,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{viewshedVisualizationConfiguration as f,arcAnglePerSegment as h}from"./ViewshedConfiguration.js";import{getViewshedRotationMatrix as p,rotateBy as u}from"./viewshedToolUtils.js";import{Object3DVisualElement as d}from"../../interactive/visualElements/Object3DVisualElement.js";import{Attribute as w}from"../../webgl-engine/lib/Attribute.js";import{Geometry as v}from"../../webgl-engine/lib/Geometry.js";import{ColorMaterial as D}from"../../webgl-engine/materials/ColorMaterial.js";class b extends d{constructor(t){super(t),this._material=null,this._viewshedComputedData=null,this._material=new D({...f.shapeMaterialParameters,isDecoration:this.isDecoration,writeDepth:!1}),this.applyProperties(t)}get viewshedComputedData(){return this._viewshedComputedData}set viewshedComputedData(t){this._viewshedComputedData=t,this.updateTransform()}updateTransform(){const t=this._viewshedComputedData;if(null==t)return;const o=i(),a=t.farDistanceRenderSpace;e(o,m(a,a,a)),p(t,M),r(o,M,o),s(M,this._viewshedComputedData.observerRenderSpace),r(o,M,o),this.transform=o}createExternalResources(){}destroyExternalResources(){}forEachMaterial(t){t(this._material)}createGeometries(t){const{_material:e,viewshedComputedData:r}=this;if(null==r||null==e||!r.valid)return;j(e,r).forEach(e=>t.addGeometry(e))}}function j(e,r){const{horizontalFieldOfView:s,verticalFieldOfView:i}=r,m=a(C,0,0,1),c=a(_,0,1,0),f=a(x,1,0,0);u(m,m,t(i/2),c),u(m,m,t(s/2),f);const p=t=>Math.ceil(Math.abs(t)/h)+1,d=t(s),D=n(E,f),b=p(d),j=g(-d/(b-1)),R=o(M,j,D),V=t(-i),G=p(V),O=g(V/(G-1)),T=n(_,c),F=o(y,t(s)/2,f);l(T,T,F);const N=y,P=[],S=n(x,m);for(let t=0;t<b;t++){o(N,O,T);for(let e=0;e<G;e++){const r=3*(e*b+t);P[r]=S[0],P[r+1]=S[1],P[r+2]=S[2],l(S,S,N)}l(T,T,R),l(m,m,R),n(S,m)}const U=b*G;P[3*U]=0,P[3*U+1]=0,P[3*U+2]=0;const k=[];for(let t=0;t<b-1;t++)for(let e=0;e<G-1;e++){const r=6*(e*(b-1)+t);k[r]=e*b+t,k[r+1]=(e+1)*b+t,k[r+2]=e*b+t+1,k[r+3]=e*b+t+1,k[r+4]=(e+1)*b+t,k[r+5]=(e+1)*b+t+1}const z=[k];if(360!==s&&0!==i){const t=[],e=[];for(let r=0;r<G-1;r++){const s=3*r;t[s]=U,t[s+1]=(r+1)*b,t[s+2]=r*b,e[s]=U,e[s+1]=r*b+b-1,e[s+2]=(r+1)*b+b-1}z.push(t,e)}if(180!==i&&0!==s){const t=[],e=[];for(let r=0;r<b-1;r++){const s=3*r;t[s]=U,t[s+1]=r,t[s+2]=r+1,e[s]=U,e[s+1]=r+(G-1)*b+1,e[s+2]=r+(G-1)*b}z.push(t,e)}return z.map(t=>{const r=[["position",new w(P,t,3,!0)]];return new v(e,r)})}function g(t){return isNaN(t)?1:t}const C=c(),_=c(),x=c(),E=c(),M=i(),y=i();export{b as ViewshedShapeVisualElement};
@@ -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 i}from"tslib";import e from"../../../../core/Accessor.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{cyclicalDegrees as o,Cyclical as n}from"../../../../core/Cyclical.js";import{handlesGroup as s}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{abortMaybe as l,destroyMaybe as p}from"../../../../core/maybe.js";import{after as h,throwIfAborted as u}from"../../../../core/promiseUtils.js";import{watch as c,syncAndInitial as d,initial as v}from"../../../../core/reactiveUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as g,H as M,e as b}from"../../../../chunks/vec32.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProjectWithZConversion as w}from"../../../../geometry/projectionUtils.js";import{viewingModeFromString as O}from"../../../ViewingMode.js";import{FieldOfViewManipulation as V,isSideHorizontal as y,flipSide as D}from"./FieldOfViewManipulation.js";import{ScaleOrientManipulation as T}from"./ScaleOrientManipulation.js";import{viewshedToolManipulatorConfiguration as H}from"./ViewshedConfiguration.js";import{ViewshedObserverManipulator as j}from"./viewshedToolManipulatorUtils.js";import{discRadiusSmall as C}from"../../interactive/editingTools/manipulations/config.js";import{MoveManipulation as F}from"../../interactive/editingTools/manipulations/MoveManipulation.js";import{resetProperties as S,dragManipulatedObject as P}from"../../../interactive/dragEventPipeline.js";import{EditGeometryOperations as k}from"../../../interactive/editGeometry/EditGeometryOperations.js";const E=Symbol("dragHandles"),x=Symbol("hideManipulators"),A=Symbol("hideFoVManipulators"),z=Symbol("hideObserverManipulator");let U=class extends e{constructor(i){super(i),this._moveManipulation=null,this._observerManipulator=null,this._fieldOfViewManipulation=null,this._scaleOrientManipulation=null,this._forceHoveringTask=null,this._forceHoveringTestPromise=null,this._grabbing=!1,this.viewshedComputedData=null}initialize(){this._moveManipulation=this._createMoveManipulation(),this._fieldOfViewManipulation=new V({view:this.view,tool:this.parentTool}),this._scaleOrientManipulation=new T({view:this.view,tool:this.parentTool}),this._observerManipulator=new j(this.view,this.parentTool),this.addHandles([c(()=>this.viewshedComputedData?.observerRenderSpace,i=>{null!=i&&(this._moveManipulation.renderLocation=i,this._observerManipulator.renderLocation=i)},d),c(()=>this.viewshedComputedData?.heading,i=>{i&&(this._moveManipulation.angle=r(90-i))},v),c(()=>{const{viewshedComputedData:i}=this;return{viewshedComputedData:i,observer:i?.observer}},({viewshedComputedData:i,observer:e},a)=>{this._grabbing&&e!==a?.observer||(this.removeHandles(E),i?.valid&&this.addHandles([this._buildObserverDragPipeline(i),this._buildFOVDragPipeline(i),this._buildScaleOrientDragPipeline(i)].filter(t),E))},v),c(()=>{const i=this.viewshedComputedData;return i?.valid?{viewshedCompData:i,target:i.targetRenderSpace,hFOV:i.horizontalFieldOfView,vFOV:i.verticalFieldOfView}:null},i=>{null!=i&&this._fieldOfViewManipulation.updateManipulatorsTransform(i.viewshedCompData)},v),c(()=>{const i=this.viewshedComputedData;return i?.valid?{viewshedCompData:i,hFOV:i.horizontalFieldOfView,vFOV:i.verticalFieldOfView,tilt:i.tilt}:null},i=>{null!=i&&this._fieldOfViewManipulation.updateManipulatorVisuals(i.viewshedCompData)},v),c(()=>{const i=this.analysisViewData.visible&&(this.viewshedComputedData?.valid??!1),e=this.parentTool.selectedViewshedComputedData===this.viewshedComputedData;return{fovManipulationAvailable:i&&!this.parentTool.isPlacingTarget,nonFOVManipulationAvailable:i&&(!this.parentTool.creating||e)}},({fovManipulationAvailable:i,nonFOVManipulationAvailable:e})=>{this._moveManipulation.available=e,this._scaleOrientManipulation.available=e,this._observerManipulator.available=e,this._fieldOfViewManipulation.available=i},v),c(()=>{const i=this.viewshedComputedData;if(!i?.valid)return null;const{observer:e,target:t,verticalFieldOfView:a,horizontalFieldOfView:o}=i;return{viewshedCompData:i,observer:e,target:t,verticalFieldOfView:a,horizontalFieldOfView:o}},i=>{null!=i&&this._scaleOrientManipulation.updateManipulators(i.viewshedCompData)},v)]);const i=i=>{const e=this.analysisViewData;this.addHandles([i.events.on("focus-changed",()=>{const i=this._someManipulatorHovering();i&&this.parentTool.subToolHandles.forEach(({subTool:i})=>{i._resetHoveringTask()}),this._someManipulatorSelected()||i||(this._forceHoveringTask=a(async i=>{await(this._forceHoveringTestPromise??h(H.hoverTimeoutMilliseconds,i)),u(i),this._forceHoveringTask=null,this._updateManipulatorVisibility()}))}),i.events.on("grab-changed",t=>{this._grabbing="start"===t.action,"end"===t.action&&e.tool?.updateInteractionVisualsVisibility(),this.parentTool.subToolHandles.forEach(({subTool:i})=>{i!==this&&i._setInteractive(!this._grabbing)}),this._setInteractive(e=>e.hasManipulator(i)||!this._grabbing)}),i.events.on("drag",i=>{"start"===i.action&&e.tool?.updateInteractionVisualsVisibility()})])};this._forEachManipulator(i)}destroy(){this._forceHoveringTask=l(this._forceHoveringTask),this._moveManipulation=p(this._moveManipulation),this._fieldOfViewManipulation=p(this._fieldOfViewManipulation),this._scaleOrientManipulation=p(this._scaleOrientManipulation),this.parentTool.manipulators.remove(this._observerManipulator),this._observerManipulator=p(this._observerManipulator)}get viewshed(){return this.viewshedComputedData?.viewshed}get grabbing(){return this._grabbing}get observer(){return this.viewshed?.observer}set observer(i){const e=this.viewshed;null!=e&&(e.observer=i)}get discManipulator(){return this._moveManipulation.xyManipulation.discManipulator}get moveInteractionState(){const{dragging:i,grabbing:e}=this._moveManipulation;return{dragging:i,grabbing:e}}get scaleOrientInteractionState(){const{dragging:i,grabbing:e}=this._scaleOrientManipulation;return{dragging:i,grabbing:e}}_setInteractive(i){const e="boolean"==typeof i;this._forEachManipulation(t=>t.interactive=e?i:i(t))}onManipulatorSelectionChanged(){if(this._updateManipulatorVisibility(),!this._someManipulatorSelected()){this.analysisViewData.selectedViewshed===this.viewshed&&(this.analysisViewData.selectedViewshed=null),this._resetHoveringTask()}}hasManipulator(i){let e=!1;return this._forEachManipulator(t=>{e=e||t===i}),e}_someManipulatorSelected(){return this._moveManipulation.selected||this._fieldOfViewManipulation.selected||this._scaleOrientManipulation.selected}_someManipulatorHovering(){return this._moveManipulation.hovering||this._fieldOfViewManipulation.hovering||this._scaleOrientManipulation.hovering}_createMoveManipulation(){return new F({view:this.view,tool:this.parentTool,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:C})}_buildObserverDragPipeline(i){const e={mode:"absolute-height",offset:0},t=i.observer;if(null==t)return null;const a=this.view.spatialReference;return this._moveManipulation.createDragPipeline((i,e,o,n,s)=>{n=n.next(S(this,["observer"]));const r=w(t,a);if(null==r)return{steps:o,cancel:n};const l=k.fromGeometry(r,O(this.view.viewingMode));return{steps:o.next(P({operations:l})).next(i=>(this.observer=l.data.geometry,i)),cancel:n}},e,a,void 0)}_buildFOVDragPipeline(i){let e=0,t=0;return this._fieldOfViewManipulation.createDragPipeline((a,n,s)=>{if(null==i)return{steps:n,cancel:s};const r=i.viewshed;let l=null;s=s.next(S(r,["horizontalFieldOfView","verticalFieldOfView"]));return{steps:n.next(a=>{"start"===a.action&&(l=null,e=i.horizontalFieldOfView,t=i.verticalFieldOfView);const n=a.deltaAngle;if(null==l&&0!==n){const i="bottom"===a.side||"left"===a.side?n>0:n<0;l=y(a.side)?0===e&&i||360===e&&!i:0===t&&i}const s=l?D(a.side):a.side;let p=0;switch(s){case"left":p=e/2-n;break;case"right":p=e/2+n;break;case"top":p=t+2*n;break;case"bottom":p=t-2*n}return y(s)?(p=o.normalize(p),p=p>270?0:p>180?180:p,r.horizontalFieldOfView=2*p):r.verticalFieldOfView=p,a}),cancel:s}},i)}_buildScaleOrientDragPipeline(i){let e=0,t=0;const a=(e,t)=>(a,o,n)=>{if(null==i)return{steps:o,cancel:n};const s=i.viewshed;return n=n.next(S(s,[e])),{steps:o=o.next(t(s,i)),cancel:n}};return s([this._scaleOrientManipulation.createHeadingDragPipeline(a("heading",(e,a)=>a=>("start"===a.action&&(t=i.heading),e.heading=o.normalize(t+a.deltaAngle),a)),i),this._scaleOrientManipulation.createTiltDragPipeline(a("tilt",(t,a)=>a=>{"start"===a.action&&(e=i.tilt);let o=e+a.deltaAngle;return o<-90?o=180:o>270&&(o=0),t.tilt=R.clamp(o),a}),i),this._scaleOrientManipulation.createDistanceDragPipeline(a("farDistance",(i,e)=>t=>{const a=g(I,t.renderEnd,e.observerRenderSpace),o=M(a)*e.metersPerUnit,n=b(a,e.targetDirection)<0?H.scaleOrientMinDistance:o;return i.farDistance=n,t}),i)])}_updateManipulatorVisibility(){const i=this._someManipulatorSelected(),e=null!=this._forceHoveringTask||this._someManipulatorHovering(),t=this._fieldOfViewManipulation.hovering,a=this.parentTool.creating;let o=[];const n=i=>{o.push(i.disableDisplay())};i||!a&&e?this.removeHandles(x):(this._scaleOrientManipulation.forEachManipulator(n),this._moveManipulation.forEachManipulator(n),this.addHandles(o,x),o=[]),i||!a&&e||a&&t?this.removeHandles(A):(this._fieldOfViewManipulation.forEachManipulator(n),this.addHandles(o,A)),i||!a?this.removeHandles(z):this.addHandles(this._observerManipulator.disableDisplay(),z)}_resetHoveringTask(){this._forceHoveringTask=l(this._forceHoveringTask),this._updateManipulatorVisibility()}_forEachManipulator(i){this._forEachManipulation(e=>{e.forEachManipulator(i)}),i(this._observerManipulator)}_forEachManipulation(i){i(this._moveManipulation),i(this._fieldOfViewManipulation),i(this._scaleOrientManipulation)}get test(){return{moveManipulation:this._moveManipulation,fieldOfViewManipulation:this._fieldOfViewManipulation,scaleOrientManipulation:this._scaleOrientManipulation,viewshedComputedData:this.viewshedComputedData,setHoveringTimeoutPromise:i=>{this._forceHoveringTestPromise=i}}}};i([m({constructOnly:!0})],U.prototype,"analysis",void 0),i([m({constructOnly:!0})],U.prototype,"analysisViewData",void 0),i([m({constructOnly:!0})],U.prototype,"parentTool",void 0),i([m({constructOnly:!0,nonNullable:!0})],U.prototype,"view",void 0),i([m()],U.prototype,"viewshed",null),i([m()],U.prototype,"_grabbing",void 0),i([m()],U.prototype,"grabbing",null),i([m()],U.prototype,"viewshedComputedData",void 0),i([m()],U.prototype,"observer",null),U=i([f("esri.views.3d.analysis.Viewshed.ViewshedSubTool")],U);const I=_(),R=new n(0,180);export{U as ViewshedSubTool};
5
+ import{__decorate as e}from"tslib";import i from"../../../../core/Accessor.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{cyclicalDegrees as o,Cyclical as n}from"../../../../core/Cyclical.js";import{handlesGroup as s}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{abortMaybe as l,destroyMaybe as p}from"../../../../core/maybe.js";import{after as h,throwIfAborted as u}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as c,initial as v}from"../../../../core/reactiveUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as g,H as M,e as b}from"../../../../chunks/vec32.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProjectWithZConversion as w}from"../../../../geometry/projectionUtils.js";import{viewingModeFromString as O}from"../../../ViewingMode.js";import{viewshedToolManipulatorConfiguration as V}from"./ViewshedConfiguration.js";import{ViewshedFieldOfViewManipulation as y,isSideHorizontal as D,flipSide as T}from"./ViewshedFieldOfViewManipulation.js";import{ViewshedScaleOrientManipulation as H}from"./ViewshedScaleOrientManipulation.js";import{ViewshedObserverManipulator as j}from"./viewshedToolManipulatorUtils.js";import{discRadiusSmall as C}from"../../interactive/editingTools/manipulations/config.js";import{MoveManipulation as F}from"../../interactive/editingTools/manipulations/MoveManipulation.js";import{resetProperties as S,dragManipulatedObject as P}from"../../../interactive/dragEventPipeline.js";import{EditGeometryOperations as k}from"../../../interactive/editGeometry/EditGeometryOperations.js";const E=Symbol("dragHandles"),x=Symbol("hideManipulators"),A=Symbol("hideFoVManipulators"),z=Symbol("hideObserverManipulator");let U=class extends i{constructor(e){super(e),this._moveManipulation=null,this._observerManipulator=null,this._fieldOfViewManipulation=null,this._scaleOrientManipulation=null,this._forceHoveringTask=null,this._forceHoveringTestPromise=null,this._grabbing=!1,this.viewshedComputedData=null}initialize(){this._moveManipulation=this._createMoveManipulation(),this._fieldOfViewManipulation=new y({view:this.view,tool:this.parentTool}),this._scaleOrientManipulation=new H({view:this.view,tool:this.parentTool}),this._observerManipulator=new j(this.view,this.parentTool),this.addHandles([d(()=>this.viewshedComputedData?.observerRenderSpace,e=>{null!=e&&(this._moveManipulation.renderLocation=e,this._observerManipulator.renderLocation=e)},c),d(()=>this.viewshedComputedData?.heading,e=>{e&&(this._moveManipulation.angle=r(90-e))},v),d(()=>{const{viewshedComputedData:e}=this;return{viewshedComputedData:e,observer:e?.observer}},({viewshedComputedData:e,observer:i},a)=>{this._grabbing&&i!==a?.observer||(this.removeHandles(E),e?.valid&&this.addHandles([this._buildObserverDragPipeline(e),this._buildFOVDragPipeline(e),this._buildScaleOrientDragPipeline(e)].filter(t),E))},v),d(()=>{const e=this.viewshedComputedData;return e?.valid?{viewshedCompData:e,target:e.targetRenderSpace,hFOV:e.horizontalFieldOfView,vFOV:e.verticalFieldOfView}:null},e=>{null!=e&&this._fieldOfViewManipulation.updateManipulatorsTransform(e.viewshedCompData)},v),d(()=>{const e=this.viewshedComputedData;return e?.valid?{viewshedCompData:e,hFOV:e.horizontalFieldOfView,vFOV:e.verticalFieldOfView,tilt:e.tilt}:null},e=>{null!=e&&this._fieldOfViewManipulation.updateManipulatorVisuals(e.viewshedCompData)},v),d(()=>{const e=this.analysisViewData.visible&&(this.viewshedComputedData?.valid??!1),i=this.parentTool.selectedViewshedComputedData===this.viewshedComputedData;return{fovManipulationAvailable:e&&!this.parentTool.isPlacingTarget,nonFOVManipulationAvailable:e&&(!this.parentTool.creating||i)}},({fovManipulationAvailable:e,nonFOVManipulationAvailable:i})=>{this._moveManipulation.available=i,this._scaleOrientManipulation.available=i,this._observerManipulator.available=i,this._fieldOfViewManipulation.available=e},v),d(()=>{const e=this.viewshedComputedData;if(!e?.valid)return null;const{observer:i,target:t,verticalFieldOfView:a,horizontalFieldOfView:o}=e;return{viewshedCompData:e,observer:i,target:t,verticalFieldOfView:a,horizontalFieldOfView:o}},e=>{null!=e&&this._scaleOrientManipulation.updateManipulators(e.viewshedCompData)},v)]);const e=e=>{const i=this.analysisViewData;this.addHandles([e.events.on("focus-changed",()=>{const e=this._someManipulatorHovering();e&&this.parentTool.subToolHandles.forEach(({subTool:e})=>{e._resetHoveringTask()}),this._someManipulatorSelected()||e||(this._forceHoveringTask=a(async e=>{await(this._forceHoveringTestPromise??h(V.hoverTimeoutMilliseconds,e)),u(e),this._forceHoveringTask=null,this._updateManipulatorVisibility()}))}),e.events.on("grab-changed",t=>{this._grabbing="start"===t.action,"end"===t.action&&i.tool?.updateInteractionVisualsVisibility(),this.parentTool.subToolHandles.forEach(({subTool:e})=>{e!==this&&e._setInteractive(!this._grabbing)}),this._setInteractive(i=>i.hasManipulator(e)||!this._grabbing)}),e.events.on("drag",e=>{"start"===e.action&&i.tool?.updateInteractionVisualsVisibility()})])};this._forEachManipulator(e)}destroy(){this._forceHoveringTask=l(this._forceHoveringTask),this._moveManipulation=p(this._moveManipulation),this._fieldOfViewManipulation=p(this._fieldOfViewManipulation),this._scaleOrientManipulation=p(this._scaleOrientManipulation),this.parentTool.manipulators.remove(this._observerManipulator),this._observerManipulator=p(this._observerManipulator)}get viewshed(){return this.viewshedComputedData?.viewshed}get grabbing(){return this._grabbing}get observer(){return this.viewshed?.observer}set observer(e){const i=this.viewshed;null!=i&&(i.observer=e)}get discManipulator(){return this._moveManipulation.xyManipulation.discManipulator}get moveInteractionState(){const{dragging:e,grabbing:i}=this._moveManipulation;return{dragging:e,grabbing:i}}get scaleOrientInteractionState(){const{dragging:e,grabbing:i}=this._scaleOrientManipulation;return{dragging:e,grabbing:i}}_setInteractive(e){const i="boolean"==typeof e;this._forEachManipulation(t=>t.interactive=i?e:e(t))}onManipulatorSelectionChanged(){if(this._updateManipulatorVisibility(),!this._someManipulatorSelected()){this.analysisViewData.selectedViewshed===this.viewshed&&(this.analysisViewData.selectedViewshed=null),this._resetHoveringTask()}}hasManipulator(e){let i=!1;return this._forEachManipulator(t=>{i=i||t===e}),i}_someManipulatorSelected(){return this._moveManipulation.selected||this._fieldOfViewManipulation.selected||this._scaleOrientManipulation.selected}_someManipulatorHovering(){return this._moveManipulation.hovering||this._fieldOfViewManipulation.hovering||this._scaleOrientManipulation.hovering}_createMoveManipulation(){return new F({view:this.view,tool:this.parentTool,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:C})}_buildObserverDragPipeline(e){const i={mode:"absolute-height",offset:0},t=e.observer;if(null==t)return null;const a=this.view.spatialReference;return this._moveManipulation.createDragPipeline((e,i,o,n,s)=>{n=n.next(S(this,["observer"]));const r=w(t,a);if(null==r)return{steps:o,cancel:n};const l=k.fromGeometry(r,O(this.view.viewingMode));return{steps:o.next(P({operations:l})).next(e=>(this.observer=l.data.geometry,e)),cancel:n}},i,a,void 0)}_buildFOVDragPipeline(e){let i=0,t=0;return this._fieldOfViewManipulation.createDragPipeline((a,n,s)=>{if(null==e)return{steps:n,cancel:s};const r=e.viewshed;let l=null;s=s.next(S(r,["horizontalFieldOfView","verticalFieldOfView"]));return{steps:n.next(a=>{"start"===a.action&&(l=null,i=e.horizontalFieldOfView,t=e.verticalFieldOfView);const n=a.deltaAngle;if(null==l&&0!==n){const e="bottom"===a.side||"left"===a.side?n>0:n<0;l=D(a.side)?0===i&&e||360===i&&!e:0===t&&e}const s=l?T(a.side):a.side;let p=0;switch(s){case"left":p=i/2-n;break;case"right":p=i/2+n;break;case"top":p=t+2*n;break;case"bottom":p=t-2*n}return D(s)?(p=o.normalize(p),p=p>270?0:p>180?180:p,r.horizontalFieldOfView=2*p):r.verticalFieldOfView=p,a}),cancel:s}},e)}_buildScaleOrientDragPipeline(e){let i=0,t=0;const a=(i,t)=>(a,o,n)=>{if(null==e)return{steps:o,cancel:n};const s=e.viewshed;return n=n.next(S(s,[i])),{steps:o=o.next(t(s,e)),cancel:n}};return s([this._scaleOrientManipulation.createHeadingDragPipeline(a("heading",(i,a)=>a=>("start"===a.action&&(t=e.heading),i.heading=o.normalize(t+a.deltaAngle),a)),e),this._scaleOrientManipulation.createTiltDragPipeline(a("tilt",(t,a)=>a=>{"start"===a.action&&(i=e.tilt);let o=i+a.deltaAngle;return o<-90?o=180:o>270&&(o=0),t.tilt=R.clamp(o),a}),e),this._scaleOrientManipulation.createDistanceDragPipeline(a("farDistance",(e,i)=>t=>{const a=g(I,t.renderEnd,i.observerRenderSpace),o=M(a)*i.metersPerUnit,n=b(a,i.targetDirection)<0?V.scaleOrientMinDistance:o;return e.farDistance=n,t}),e)])}_updateManipulatorVisibility(){const e=this._someManipulatorSelected(),i=null!=this._forceHoveringTask||this._someManipulatorHovering(),t=this._fieldOfViewManipulation.hovering,a=this.parentTool.creating;let o=[];const n=e=>{o.push(e.disableDisplay())};e||!a&&i?this.removeHandles(x):(this._scaleOrientManipulation.forEachManipulator(n),this._moveManipulation.forEachManipulator(n),this.addHandles(o,x),o=[]),e||!a&&i||a&&t?this.removeHandles(A):(this._fieldOfViewManipulation.forEachManipulator(n),this.addHandles(o,A)),e||!a?this.removeHandles(z):this.addHandles(this._observerManipulator.disableDisplay(),z)}_resetHoveringTask(){this._forceHoveringTask=l(this._forceHoveringTask),this._updateManipulatorVisibility()}_forEachManipulator(e){this._forEachManipulation(i=>{i.forEachManipulator(e)}),e(this._observerManipulator)}_forEachManipulation(e){e(this._moveManipulation),e(this._fieldOfViewManipulation),e(this._scaleOrientManipulation)}get test(){return{moveManipulation:this._moveManipulation,fieldOfViewManipulation:this._fieldOfViewManipulation,scaleOrientManipulation:this._scaleOrientManipulation,viewshedComputedData:this.viewshedComputedData,setHoveringTimeoutPromise:e=>{this._forceHoveringTestPromise=e}}}};e([m({constructOnly:!0})],U.prototype,"analysis",void 0),e([m({constructOnly:!0})],U.prototype,"analysisViewData",void 0),e([m({constructOnly:!0})],U.prototype,"parentTool",void 0),e([m({constructOnly:!0,nonNullable:!0})],U.prototype,"view",void 0),e([m()],U.prototype,"viewshed",null),e([m()],U.prototype,"_grabbing",void 0),e([m()],U.prototype,"grabbing",null),e([m()],U.prototype,"viewshedComputedData",void 0),e([m()],U.prototype,"observer",null),U=e([f("esri.views.3d.analysis.Viewshed.ViewshedSubTool")],U);const I=_(),R=new n(0,180);export{U as ViewshedSubTool};
@@ -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{__decorate as e}from"tslib";import t from"../../../../Color.js";import i from"../../../../core/Accessor.js";import"../../../../core/has.js";import{equals as s}from"../../../../core/lang.js";import{deg2rad as o}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as a,initial as l}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as d,i as u,a as p,H as _,n as f,g as V,p as v,u as w,c as E,f as b}from"../../../../chunks/vec32.js";import{create as g,clone as C}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{viewshedVisualizationConfiguration as L,arcAnglePerSegment as A}from"./ViewshedConfiguration.js";import{ViewshedShapeVisualElement as D}from"./ViewshedShapeVisualElement.js";import y from"./ViewshedTool.js";import{LineVisualElement as j}from"../../interactive/visualElements/LineVisualElement.js";import{PointVisualElement as F}from"../../interactive/visualElements/PointVisualElement.js";import{createStipplePatternSimple as R}from"../../webgl-engine/materials/lineStippleUtils.js";let S=class extends i{constructor(e){super(e),this.visible=!0,this._viewshedCorners={topLeft:g(),topRight:g(),bottomLeft:g(),bottomRight:g()},this._arcCenterPoints={top:g(),bottom:g(),left:g(),right:g()},this._parallelCenters={top:g(),bottom:g()}}initialize(){const e={view:this.view,isDecoration:!0},t={...e,color:this._color,renderOccluded:4},i={...t,stipplePattern:R(2)};this._observerVisualElement=new F({...e,...L.observerPointConfiguration}),this._shapeVisualElement=new D({...e,isDecoration:this.isDecoration}),this._frameLinesVisualElement=new j(t),this._leftArcVisualElement=new j(t),this._rightArcVisualElement=new j(t),this._topArcVisualElement=new j(t),this._bottomArcVisualElement=new j(t),this._centralLongitude=new j(i),this._centralLatitude=new j(i),this.addHandles([a(()=>{const e=this.viewshedComputedData;if(!e?.valid)return null;const t=this._viewshedCorners,i=this._arcCenterPoints,s=this._parallelCenters;return e.cornerPoints(t),e.arcCentersPoints(i),e.parallelCenterPoints(s),{viewshedComputedData:e,corners:t,arcCenters:i,parallelCenters:s,interactive:this.analysisViewData.interactive,selected:this._selected}},e=>{const t=null!=e;this._forEachVisualElement(e=>e.attached=t),t&&this._updateVisualElements(e)},{initial:!0,equals:s}),a(()=>{const{viewshedComputedData:e}=this,{horizontalFieldOfView:t,verticalFieldOfView:i}=e??{};return{viewshedComputedData:e,horizontalFieldOfView:t,verticalFieldOfView:i}},({viewshedComputedData:e})=>{const{_shapeVisualElement:t}=this;e!==t.viewshedComputedData&&(t.viewshedComputedData=e),this._shapeVisualElement.recreateGeometry()},l),a(()=>{const{interactive:e}=this.analysisViewData;return{visible:this.visible,selected:e&&this._selected,staged:e&&this._staged,horFovNot360:360!==this.viewshedComputedData?.horizontalFieldOfView}},({visible:e,selected:t,staged:i,horFovNot360:s})=>{const o=t||i;this._shapeVisualElement.visible=e,this._topArcVisualElement.visible=e,this._bottomArcVisualElement.visible=e,this._frameLinesVisualElement.visible=e&&s;const r=e&&(t||s);this._leftArcVisualElement.visible=r,this._rightArcVisualElement.visible=r,this._forEachLineVisualElement(e=>{e.width=o?L.frameWidthSelected:L.frameWidthNotSelected,e.renderOccluded=t?4:1}),[this._centralLatitude,this._centralLongitude].forEach(i=>{i.width=2*(o?L.frameWidthSelected:L.frameWidthNotSelected),i.visible=e&&t})},l),a(()=>{const{analysisViewData:{interactive:e,tool:t},_selected:i,visible:s}=this,o=this.view.activeTool,r=!t?.active&&o instanceof y&&o.creating;return{observerVisible:s&&!i&&(!e||(t?.creating??!1)||r),color:this._color}},({observerVisible:e,color:t})=>{this._observerVisualElement.visible=e,this._forEachLineVisualElement(e=>e.color=t)},l)])}get _color(){const{viewshedComputedData:e,_selected:i,analysisViewData:s}=this;if(null==e)return t.toUnitRGBA(L.frameColor);const o=s.tool?.active||s.interactive,r=e.viewshed===s.tool?.stagedViewshed,a=o&&(i||r)?this.view.effectiveTheme.accentColor:L.frameColor;return t.toUnitRGBA(a)}get _selected(){const{viewshedComputedData:e,analysisViewData:{selectedViewshedComputedData:t}}=this;return null!=e&&e===t}get _staged(){const{analysisViewData:{tool:e},viewshedComputedData:t}=this;return null!=e&&e.creating&&e.stagedViewshed===t?.viewshed}destroy(){this._observerVisualElement=r(this._observerVisualElement),this._shapeVisualElement=r(this._shapeVisualElement),this._frameLinesVisualElement=r(this._frameLinesVisualElement),this._leftArcVisualElement=r(this._leftArcVisualElement),this._rightArcVisualElement=r(this._rightArcVisualElement),this._topArcVisualElement=r(this._topArcVisualElement),this._bottomArcVisualElement=r(this._bottomArcVisualElement),this._centralLongitude=r(this._centralLongitude),this._centralLatitude=r(this._centralLatitude)}_forEachLineVisualElement(e){[this._frameLinesVisualElement,this._leftArcVisualElement,this._rightArcVisualElement,this._topArcVisualElement,this._bottomArcVisualElement,this._centralLatitude,this._centralLongitude].forEach(e)}_forEachVisualElement(e){this._forEachLineVisualElement(e),e(this._observerVisualElement),e(this._shapeVisualElement)}_updateVisualElements(e){const{viewshedComputedData:t,corners:i,arcCenters:s,parallelCenters:o}=e,r=C(t.observerRenderSpace);this._observerVisualElement.geometry=t.observer,this._shapeVisualElement.updateTransform(),this._updateFrameLines(r,i),this._updateFrameArcs(t,i,o),this._updateCentralHelperArcs(t,s)}_updateFrameLines(e,t){this._frameLinesVisualElement.geometry=[[e,t.topLeft],[e,t.topRight],[e,t.bottomLeft],[e,t.bottomRight]]}_updateFrameArcs(e,t,i){const{observerRenderSpace:s,rightVector:r,horizontalFieldOfView:a,tiltedUpVector:l}=e,n=o(a),c=g(),p=m();h(p,n/2,l),d(c,r,p),O(this._leftArcVisualElement,s,t.bottomLeft,t.topLeft,"forward",c),h(p,-n/2,l),u(c,0,0,0),d(c,r,p),O(this._rightArcVisualElement,s,t.bottomRight,t.topRight,"forward",c);const _=a>180?"backward":"forward";O(this._topArcVisualElement,i.top,t.topRight,t.topLeft,_,l),O(this._bottomArcVisualElement,i.bottom,t.bottomRight,t.bottomLeft,_,l)}_updateCentralHelperArcs(e,t){const i=e.observerRenderSpace,s=e.horizontalFieldOfView>=180?"backward":"forward";O(this._centralLatitude,i,t.right,t.left,s,e.tiltedUpVector),O(this._centralLongitude,i,t.top,t.bottom,"forward",e.leftVector)}get test(){}};function O(e,t,i,s,o,r,a=A){const l=g();p(l,i,t);const n=_(l),c=g();p(c,s,t),f(c,c),V(c,c,n);let u=v(l,c);const L=C(r);"backward"===o&&(w(L,L),u=-(2*Math.PI-u));const D=[],y=Math.ceil(Math.abs(u)/a),j=m();h(j,u/y,L);const F=g();E(F,l);const R=g();E(R,i);for(let h=0;h<y;h++){const e=g();E(e,R),d(F,F,j),b(R,t,F);const i=g();E(i,R),D.push([e,i])}e.geometry=D}e([n()],S.prototype,"view",void 0),e([n({constructOnly:!0})],S.prototype,"isDecoration",void 0),e([n()],S.prototype,"analysisViewData",void 0),e([n()],S.prototype,"viewshedComputedData",void 0),e([n()],S.prototype,"visible",void 0),e([n()],S.prototype,"_color",null),e([n()],S.prototype,"_selected",null),e([n()],S.prototype,"_staged",null),S=e([c("esri.views.3d.analysis.Viewshed.ViewshedSubVisualization")],S);export{S as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../Color.js";import i from"../../../../core/Accessor.js";import"../../../../core/has.js";import{equals as s}from"../../../../core/lang.js";import{deg2rad as o}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as a,initial as l}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as d,i as u,a as p,H as _,n as f,g as V,p as v,u as E,c as w,f as b}from"../../../../chunks/vec32.js";import{create as g,clone as C}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{viewshedVisualizationConfiguration as L,arcAnglePerSegment as A}from"./ViewshedConfiguration.js";import D from"./ViewshedTool.js";import{LineVisualElement as y}from"../../interactive/visualElements/LineVisualElement.js";import{PointVisualElement as j}from"../../interactive/visualElements/PointVisualElement.js";import{ViewshedShapeVisualElement as F}from"../../interactive/visualElements/ViewshedShapeVisualElement.js";import{createStipplePatternSimple as R}from"../../webgl-engine/materials/lineStippleUtils.js";let S=class extends i{constructor(e){super(e),this.visible=!0,this._viewshedCorners={topLeft:g(),topRight:g(),bottomLeft:g(),bottomRight:g()},this._arcCenterPoints={top:g(),bottom:g(),left:g(),right:g()},this._parallelCenters={top:g(),bottom:g()}}initialize(){const e={view:this.view,isDecoration:!0},t={...e,color:this._color,renderOccluded:4},i={...t,stipplePattern:R(2)};this._observerVisualElement=new j({...e,...L.observerPointConfiguration}),this._shapeVisualElement=new F({...e,isDecoration:this.isDecoration}),this._frameLinesVisualElement=new y(t),this._leftArcVisualElement=new y(t),this._rightArcVisualElement=new y(t),this._topArcVisualElement=new y(t),this._bottomArcVisualElement=new y(t),this._centralLongitude=new y(i),this._centralLatitude=new y(i),this.addHandles([a(()=>{const e=this.viewshedComputedData;if(!e?.valid)return null;const t=this._viewshedCorners,i=this._arcCenterPoints,s=this._parallelCenters;return e.cornerPoints(t),e.arcCentersPoints(i),e.parallelCenterPoints(s),{viewshedComputedData:e,corners:t,arcCenters:i,parallelCenters:s,interactive:this.analysisViewData.interactive,selected:this._selected}},e=>{const t=null!=e;this._forEachVisualElement(e=>e.attached=t),t&&this._updateVisualElements(e)},{initial:!0,equals:s}),a(()=>{const{viewshedComputedData:e}=this,{horizontalFieldOfView:t,verticalFieldOfView:i}=e??{};return{viewshedComputedData:e,horizontalFieldOfView:t,verticalFieldOfView:i}},({viewshedComputedData:e})=>{const{_shapeVisualElement:t}=this;e!==t.viewshedComputedData&&(t.viewshedComputedData=e),this._shapeVisualElement.recreateGeometry()},l),a(()=>{const{interactive:e}=this.analysisViewData;return{visible:this.visible,selected:e&&this._selected,staged:e&&this._staged,horFovNot360:360!==this.viewshedComputedData?.horizontalFieldOfView}},({visible:e,selected:t,staged:i,horFovNot360:s})=>{const o=t||i;this._shapeVisualElement.visible=e,this._topArcVisualElement.visible=e,this._bottomArcVisualElement.visible=e,this._frameLinesVisualElement.visible=e&&s;const r=e&&(t||s);this._leftArcVisualElement.visible=r,this._rightArcVisualElement.visible=r,this._forEachLineVisualElement(e=>{e.width=o?L.frameWidthSelected:L.frameWidthNotSelected,e.renderOccluded=t?4:1}),[this._centralLatitude,this._centralLongitude].forEach(i=>{i.width=2*(o?L.frameWidthSelected:L.frameWidthNotSelected),i.visible=e&&t})},l),a(()=>{const{analysisViewData:{interactive:e,tool:t},_selected:i,visible:s}=this,o=this.view.activeTool,r=!t?.active&&o instanceof D&&o.creating;return{observerVisible:s&&!i&&(!e||(t?.creating??!1)||r),color:this._color}},({observerVisible:e,color:t})=>{this._observerVisualElement.visible=e,this._forEachLineVisualElement(e=>e.color=t)},l)])}get _color(){const{viewshedComputedData:e,_selected:i,analysisViewData:s}=this;if(null==e)return t.toUnitRGBA(L.frameColor);const o=s.tool?.active||s.interactive,r=e.viewshed===s.tool?.stagedViewshed,a=o&&(i||r)?this.view.effectiveTheme.accentColor:L.frameColor;return t.toUnitRGBA(a)}get _selected(){const{viewshedComputedData:e,analysisViewData:{selectedViewshedComputedData:t}}=this;return null!=e&&e===t}get _staged(){const{analysisViewData:{tool:e},viewshedComputedData:t}=this;return null!=e&&e.creating&&e.stagedViewshed===t?.viewshed}destroy(){this._observerVisualElement=r(this._observerVisualElement),this._shapeVisualElement=r(this._shapeVisualElement),this._frameLinesVisualElement=r(this._frameLinesVisualElement),this._leftArcVisualElement=r(this._leftArcVisualElement),this._rightArcVisualElement=r(this._rightArcVisualElement),this._topArcVisualElement=r(this._topArcVisualElement),this._bottomArcVisualElement=r(this._bottomArcVisualElement),this._centralLongitude=r(this._centralLongitude),this._centralLatitude=r(this._centralLatitude)}_forEachLineVisualElement(e){[this._frameLinesVisualElement,this._leftArcVisualElement,this._rightArcVisualElement,this._topArcVisualElement,this._bottomArcVisualElement,this._centralLatitude,this._centralLongitude].forEach(e)}_forEachVisualElement(e){this._forEachLineVisualElement(e),e(this._observerVisualElement),e(this._shapeVisualElement)}_updateVisualElements(e){const{viewshedComputedData:t,corners:i,arcCenters:s,parallelCenters:o}=e,r=C(t.observerRenderSpace);this._observerVisualElement.geometry=t.observer,this._shapeVisualElement.updateTransform(),this._updateFrameLines(r,i),this._updateFrameArcs(t,i,o),this._updateCentralHelperArcs(t,s)}_updateFrameLines(e,t){this._frameLinesVisualElement.geometry=[[e,t.topLeft],[e,t.topRight],[e,t.bottomLeft],[e,t.bottomRight]]}_updateFrameArcs(e,t,i){const{observerRenderSpace:s,rightVector:r,horizontalFieldOfView:a,tiltedUpVector:l}=e,n=o(a),c=g(),p=m();h(p,n/2,l),d(c,r,p),O(this._leftArcVisualElement,s,t.bottomLeft,t.topLeft,"forward",c),h(p,-n/2,l),u(c,0,0,0),d(c,r,p),O(this._rightArcVisualElement,s,t.bottomRight,t.topRight,"forward",c);const _=a>180?"backward":"forward";O(this._topArcVisualElement,i.top,t.topRight,t.topLeft,_,l),O(this._bottomArcVisualElement,i.bottom,t.bottomRight,t.bottomLeft,_,l)}_updateCentralHelperArcs(e,t){const i=e.observerRenderSpace,s=e.horizontalFieldOfView>=180?"backward":"forward";O(this._centralLatitude,i,t.right,t.left,s,e.tiltedUpVector),O(this._centralLongitude,i,t.top,t.bottom,"forward",e.leftVector)}get test(){}};function O(e,t,i,s,o,r,a=A){const l=g();p(l,i,t);const n=_(l),c=g();p(c,s,t),f(c,c),V(c,c,n);let u=v(l,c);const L=C(r);"backward"===o&&(E(L,L),u=-(2*Math.PI-u));const D=[],y=Math.ceil(Math.abs(u)/a),j=m();h(j,u/y,L);const F=g();w(F,l);const R=g();w(R,i);for(let h=0;h<y;h++){const e=g();w(e,R),d(F,F,j),b(R,t,F);const i=g();w(i,R),D.push([e,i])}e.geometry=D}e([n()],S.prototype,"view",void 0),e([n({constructOnly:!0})],S.prototype,"isDecoration",void 0),e([n()],S.prototype,"analysisViewData",void 0),e([n()],S.prototype,"viewshedComputedData",void 0),e([n()],S.prototype,"visible",void 0),e([n()],S.prototype,"_color",null),e([n()],S.prototype,"_selected",null),e([n()],S.prototype,"_staged",null),S=e([c("esri.views.3d.analysis.Viewshed.ViewshedVisualization")],S);export{S as default};
5
+ import{__decorate as i}from"tslib";import s from"../../../../core/Accessor.js";import{destroyHandle as o}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{mapCollection as t}from"../../../../core/mapCollectionUtils.js";import{watch as e,initial as r}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import n from"./ViewshedSubVisualization.js";let c=class extends s{get visible(){return this.analysisViewData.visible}constructor(i){super(i)}initialize(){const i=this.analysisViewData,s=t(()=>this.analysisViewData.viewshedComputedDataHandles,({viewshedComputedData:s})=>{const o=new n({view:this.view,viewshedComputedData:s,analysisViewData:i,isDecoration:this.isDecoration});return{visualization:o,remove:()=>o.destroy()}});this._subVisualizations=s,this.addHandles([o(s),e(()=>this.visible,i=>this._subVisualizations.forEach(({visualization:s})=>s.visible=i),r)])}get test(){}};i([a({constructOnly:!0})],c.prototype,"analysisViewData",void 0),i([a({constructOnly:!0,nonNullable:!0})],c.prototype,"view",void 0),i([a({constructOnly:!0})],c.prototype,"isDecoration",void 0),i([a()],c.prototype,"visible",null),c=i([l("esri.views.3d.analysis.Viewshed.ViewshedVisualization")],c);export{c as ViewshedVisualization};