@arcgis/core 5.2.0-next.19 → 5.2.0-next.20

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 (113) 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/0a259137932211b80f0e.js +1 -0
  4. package/assets/esri/core/workers/chunks/{c318e6dbb8651433038f.js → 2dbd88566abac030e965.js} +2 -2
  5. package/assets/esri/core/workers/chunks/2ed81f1e490cb7e73405.js +1 -0
  6. package/assets/esri/core/workers/chunks/{aeeee92b86554962711e.js → 4104a0585969f8cd524c.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{99c002015c2127e6cbfc.js → 44b30bce8e9a75b9e1b3.js} +2 -2
  8. package/assets/esri/core/workers/chunks/{c0b7b9d115dccb2924ff.js → 4fdd38d7362bf09a994b.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{0d42322362e76f674d94.js → 501fa9b029df2e7b73c3.js} +2 -2
  10. package/assets/esri/core/workers/chunks/{fb81705cec1be2431876.js → 5216dd0544e901039c84.js} +1 -1
  11. package/assets/esri/core/workers/chunks/5d710b3e50f2211a765d.js +1 -0
  12. package/assets/esri/core/workers/chunks/5f0bc019add4aff3130c.js +1 -0
  13. package/assets/esri/core/workers/chunks/{2d7a4b669804d0c5029b.js → 5f63077ec5ba3560491b.js} +1 -1
  14. package/assets/esri/core/workers/chunks/6121cd0264b6841a5bac.js +1 -0
  15. package/assets/esri/core/workers/chunks/{dd3b0070081eaf805d95.js → 6ac09f4e85c664a17365.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{5ea1113b7bdcf94b2822.js → 6e8b9c03240ec372b587.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{29e6f4b19c3da9129439.js → 72edd08a2ff08970ba38.js} +1 -1
  18. package/assets/esri/core/workers/chunks/74922daaedb479ec6f03.js +1 -0
  19. package/assets/esri/core/workers/chunks/{169bfafec4d59be2beb0.js → 790462ab5f21491a4f75.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{c8672a54c98d472aa24d.js → 82adfa2dbd40e1becaf4.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{851fc5290497991ba001.js → 88df19742edb0cdc3e67.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{1ea840b7ac1ffaa0c389.js → 8ce4fe00328173224ed2.js} +1 -1
  23. package/assets/esri/core/workers/chunks/912a8743a02f467b63b0.js +2 -0
  24. package/assets/esri/core/workers/chunks/9ad36947bb42ed7f97d3.js +1 -0
  25. package/assets/esri/core/workers/chunks/9def4619d102f1d41578.js +1 -0
  26. package/assets/esri/core/workers/chunks/9e0ea6c34940b1acf3c6.js +1 -0
  27. package/assets/esri/core/workers/chunks/{4e59e5a5d0ff887ff899.js → a856ae928273f9d6792f.js} +1 -1
  28. package/assets/esri/core/workers/chunks/aec46ec486912dca549d.js +1 -0
  29. package/assets/esri/core/workers/chunks/{f0924613f818dd165ad9.js → b375abfb2a2d9c63e20a.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{888af532ad48fd86f285.js → c9e5d3f496cefb8e3934.js} +1 -1
  31. package/assets/esri/core/workers/chunks/cd892f429d5ffe8de99e.js +1 -0
  32. package/assets/esri/core/workers/chunks/d2387906b52624b4f7f1.js +1 -0
  33. package/assets/esri/core/workers/chunks/d34d41a350facfa9b7c0.js +1 -0
  34. package/assets/esri/core/workers/chunks/d8329c2000c0cc597adc.js +1 -0
  35. package/assets/esri/core/workers/chunks/{dfb19701b488089874fd.js → db26cf2c2735183294b8.js} +1 -1
  36. package/assets/esri/core/workers/chunks/dee339774131d7274137.js +1 -0
  37. package/assets/esri/core/workers/chunks/{05016e5a1de384994001.js → eccbddaec4be44c86f79.js} +2 -2
  38. package/assets/esri/core/workers/chunks/fee50ab6c92ef0327255.js +1 -0
  39. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +1 -1
  40. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +4 -0
  41. package/assets/esri/themes/dark/main.css +1 -1
  42. package/assets/esri/themes/light/main.css +1 -1
  43. package/assets/esri/themes/light/view.css +1 -1
  44. package/chunks/OITBlendEmission.glsl.js +2 -21
  45. package/config.js +1 -1
  46. package/kernel.js +1 -1
  47. package/layers/AnnotationFeatureLayer.d.ts +3 -3
  48. package/layers/AnnotationFeatureLayer.js +1 -1
  49. package/layers/DimensionFeatureLayer.js +1 -1
  50. package/layers/GaussianSplatLayer.d.ts +1 -2
  51. package/layers/VideoLayer.js +1 -1
  52. package/layers/mixins/SceneService.js +1 -1
  53. package/layers/support/arcgisLayers.js +1 -1
  54. package/layers/support/fetchService.js +1 -1
  55. package/libs/parquet/parquet.js +1 -1
  56. package/package.json +2 -2
  57. package/portal/support/layersLoader.js +1 -1
  58. package/portal/support/loadUtils.js +1 -1
  59. package/portal/support/portalLayers.js +1 -1
  60. package/portal/support/resourceUtils.js +1 -1
  61. package/support/revision.js +1 -1
  62. package/symbols/WebStyleSymbol.js +1 -1
  63. package/undoredo/support/ApplySetItem.js +1 -1
  64. package/views/2d/engine/webgl/TextureManager.js +1 -1
  65. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  66. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  67. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  68. package/views/2d/layers/support/annodime/virtualFields.js +1 -1
  69. package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
  70. package/views/3d/analysis/Viewshed/ViewshedDrawToolRenderer.js +1 -1
  71. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  72. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  73. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  74. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  75. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  76. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  77. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  78. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  79. package/views/3d/webgl-engine/effects/transparency/OITBlendEmission.glsl.js +1 -1
  80. package/views/3d/webgl-engine/effects/transparency/oitBlendFragment.glsl.js +1 -1
  81. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  82. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +6 -6
  83. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  84. package/widgets/BatchAttributeForm.js +1 -1
  85. package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
  86. package/widgets/Editor/support/attachmentUtils.js +1 -1
  87. package/widgets/OrientedImageryViewer/css.js +1 -1
  88. package/widgets/OrientedImageryViewer.js +1 -1
  89. package/widgets/Print/PrintViewModel.js +1 -1
  90. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  91. package/widgets/UtilityNetworkTrace.js +1 -1
  92. package/assets/esri/core/workers/chunks/00bcb04934972179b9ca.js +0 -1
  93. package/assets/esri/core/workers/chunks/0c13591347d51d684561.js +0 -1
  94. package/assets/esri/core/workers/chunks/35533c8ef541f7643497.js +0 -2
  95. package/assets/esri/core/workers/chunks/3d4ad7c728e02aa90551.js +0 -1
  96. package/assets/esri/core/workers/chunks/50c88e2545380800381f.js +0 -1
  97. package/assets/esri/core/workers/chunks/57a6572d440d2c62432b.js +0 -1
  98. package/assets/esri/core/workers/chunks/6a21a22b08f968fa8d60.js +0 -1
  99. package/assets/esri/core/workers/chunks/753e0b21e57c12c742ee.js +0 -1
  100. package/assets/esri/core/workers/chunks/85505a8b8b0794656d06.js +0 -1
  101. package/assets/esri/core/workers/chunks/93d08d82ceab19e314f8.js +0 -1
  102. package/assets/esri/core/workers/chunks/9802770413ad814dab29.js +0 -1
  103. package/assets/esri/core/workers/chunks/9d59cc5c0a63a4e41d99.js +0 -1
  104. package/assets/esri/core/workers/chunks/a32651777e4f07df5b6a.js +0 -1
  105. package/assets/esri/core/workers/chunks/a59a1fdcd37a875f179b.js +0 -1
  106. package/assets/esri/core/workers/chunks/aa5f36d7ed59c625ba78.js +0 -1
  107. package/assets/esri/core/workers/chunks/bb9232d9f63ec0c32447.js +0 -1
  108. package/assets/esri/core/workers/chunks/e3ea4b7217df16592def.js +0 -1
  109. /package/assets/esri/core/workers/chunks/{c318e6dbb8651433038f.js.LICENSE.txt → 2dbd88566abac030e965.js.LICENSE.txt} +0 -0
  110. /package/assets/esri/core/workers/chunks/{0d42322362e76f674d94.js.LICENSE.txt → 44b30bce8e9a75b9e1b3.js.LICENSE.txt} +0 -0
  111. /package/assets/esri/core/workers/chunks/{99c002015c2127e6cbfc.js.LICENSE.txt → 501fa9b029df2e7b73c3.js.LICENSE.txt} +0 -0
  112. /package/assets/esri/core/workers/chunks/{35533c8ef541f7643497.js.LICENSE.txt → 912a8743a02f467b63b0.js.LICENSE.txt} +0 -0
  113. /package/assets/esri/core/workers/chunks/{05016e5a1de384994001.js.LICENSE.txt → eccbddaec4be44c86f79.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/has.js";import{baseObjectMemory as e}from"../../../../../core/memoryEstimations.js";import{minInt16 as t}from"../../../../../core/typedArrayUtil.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import{getParquetObjectId as r}from"../../../../../layers/graphics/sources/support/parquetIdUtils.js";import{QuantizedGeometryBuffer as i}from"../../../../../chunks/bundle2.js";import{FeatureSetReader as n}from"./FeatureSetReader.js";let o;const d=new TextDecoder;class a extends n{constructor(s,r,i,n,o,d=new Uint32Array(i.size()),a,h){if(super(s),this._indexMap=r,this._inner=i,this._fileId=n,this._transform=o,this._displayIds=d,this._points=a,this._rowIds=h,this._index=-1,this._emptyNumberValue=0,this.usedMemory=e,this._size=this._inner.size(),this._rowIds||(this._rowIds=this._inner.readIdsUnsafe().slice()),!this._points&&"esriGeometryPoint"===this.geometryType){const e=this._inner.readPointCoordsQuantizedUnsafe()?.slice();e?(this._emptyNumberValue=t,this._points=e):(this._emptyNumberValue=NaN,this._points=this._inner.readPointCoordsUnsafe()?.slice())}s.featureIdInfo.type}destroy(){super.destroy(),this._inner.free()}get fields(){return this.metadata.fieldsIndex}get geometryType(){return this.metadata.geometryType}get hasFeatures(){return!0}get hasNext(){throw new Error("Method not implemented.")}get exceededTransferLimit(){return!1}get hasZ(){return!1}get hasM(){return!1}async updateFields(e,t,s,r){const i=this._inner.rowGroup(),n=new Uint32Array(this._inner.readIdsUnsafe()),o=await e.createPatch(t,i,n,s,r);this._inner.insertPatchBytes(new Uint8Array(o))}getInTransform(){return this._transform}getSize(){return this._size}getCursor(){return this.copy()}getAttributeHash(){let e="";for(const t of this.fields.fields)e+=this._readAttribute(t.name,!1)+".";return e}getObjectId(){const e=this._rowIds[this._index];return r(this._fileId,e)}getDisplayId(){return this._displayIds[this._index]}setDisplayId(e){this._displayIds[this._index]=e}setIndex(e){this._index=e}getBoundsXMin(){return this._inner.boundsXMin(this._index)}getBoundsYMin(){return this._inner.boundsYMin(this._index)}getBoundsXMax(){return this._inner.boundsXMax(this._index)}getBoundsYMax(){return this._inner.boundsYMax(this._index)}setBoundsXMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsXMax(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMax(e){throw new Error("InternalError: Setting bounds is unsupported")}getIndex(){return this._index}next(){for(;++this._index<this._size&&!this._getExists(););return this._index<this._size}readGeometryArea(){return this.readGeometryForDisplay()?.area()??0}copy(){const e=new a(this.metadata,this._indexMap,this._inner,this._fileId,this._transform,this._displayIds,this._points,this._rowIds);return this.copyInto(e),e}copyInto(e){super.copyInto(e),e._index=this._index}readGeometryForDisplayTransformed(e){const[t,r]=e.translate,[n,d]=e.scale;o||(o=i.new());return this._inner.transformGeometry(o,t,r,n,d,this._index)?new s(o.readLengthsUnsafe(),o.readCoordsUnsafe(),this.hasZ,this.hasM):null}_readGeometry(e){const t=this._inner.readCoordsUnsafe(this._index),r=this._inner.readLengthsUnsafe(this._index);return t&&r?new s(r,t,this.hasZ,this.hasM):null}_readX(){if(this._points){const e=this._points[2*this._index];return e===this._emptyNumberValue?NaN:e}return this._inner.readX(this._index)}_readY(){if(this._points){const e=this._points[2*this._index+1];return e===this._emptyNumberValue?NaN:e}return this._inner.readY(this._index)}_readServerCentroid(){return null}_readAttribute(e,t){const s=this.fields.get(e);if(!s)return;const r=this._indexMap[s.name];if(null==r)return this.getObjectId();const i=this._inner.readAttribute(this._index,r);if(null==i)return i;if("esriFieldTypeString"===s.type||"esriFieldTypeDateOnly"===s.type||"esriFieldTypeTimeOnly"===s.type||"esriFieldTypeTimestampOffset"===s.type){const e=this._inner.readAttribute(this._index,r);return d.decode(e)}const n=this.fields.isDateField(s.name);return t?null==i?i:n?new Date(i):i:i}_readAttributes(){const e={};for(const t of this.metadata.fieldsIndex.fields){if(null==this._indexMap[t.name])continue;const s=this._readAttribute(t.name,!1);void 0!==s&&(e[t.name]=s)}return e.__OBJECTID=this.getObjectId(),e}}export{a as FeatureSetReaderParquet};
2
+ import"../../../../../core/has.js";import{baseObjectMemory as e}from"../../../../../core/memoryEstimations.js";import{minInt16 as t}from"../../../../../core/typedArrayUtil.js";import i from"../../../../../layers/graphics/OptimizedGeometry.js";import{getParquetObjectId as s}from"../../../../../layers/graphics/sources/support/parquetIdUtils.js";import{FeatureSetReader as r}from"./FeatureSetReader.js";const n=new TextDecoder;class o extends r{constructor(i,s,r,n,o,d=new Uint32Array(r.size()),a,h){if(super(i),this._indexMap=s,this._inner=r,this._fileId=n,this._transform=o,this._displayIds=d,this._points=a,this._rowIds=h,this._index=-1,this._emptyNumberValue=0,this.usedMemory=e,this._size=this._inner.size(),this._rowIds||(this._rowIds=this._inner.readIdsUnsafe().slice()),!this._points&&"esriGeometryPoint"===this.geometryType){const e=this._inner.readPointCoordsQuantizedUnsafe()?.slice();e?(this._emptyNumberValue=t,this._points=e):(this._emptyNumberValue=NaN,this._points=this._inner.readPointCoordsUnsafe()?.slice())}i.featureIdInfo.type}destroy(){super.destroy(),this._inner.free()}get fields(){return this.metadata.fieldsIndex}get geometryType(){return this.metadata.geometryType}get hasFeatures(){return!0}get hasNext(){throw new Error("Method not implemented.")}get exceededTransferLimit(){return!1}get hasZ(){return!1}get hasM(){return!1}async updateFields(e,t,i,s){const r=this._inner.rowGroup(),n=new Uint32Array(this._inner.readIdsUnsafe()),o=await e.createPatch(t,r,n,i,s);this._inner.insertPatchBytes(new Uint8Array(o))}getInTransform(){return this._transform}getSize(){return this._size}getCursor(){return this.copy()}getAttributeHash(){let e="";for(const t of this.fields.fields)e+=this._readAttribute(t.name,!1)+".";return e}getObjectId(){const e=this._rowIds[this._index];return s(this._fileId,e)}getDisplayId(){return this._displayIds[this._index]}setDisplayId(e){this._displayIds[this._index]=e}setIndex(e){this._index=e}getBoundsXMin(){return this._inner.boundsXMin(this._index)}getBoundsYMin(){return this._inner.boundsYMin(this._index)}getBoundsXMax(){return this._inner.boundsXMax(this._index)}getBoundsYMax(){return this._inner.boundsYMax(this._index)}setBoundsXMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsXMax(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMax(e){throw new Error("InternalError: Setting bounds is unsupported")}getIndex(){return this._index}next(){for(;++this._index<this._size&&!this._getExists(););return this._index<this._size}readGeometryArea(){return this.readGeometryForDisplay()?.area()??0}copy(){const e=new o(this.metadata,this._indexMap,this._inner,this._fileId,this._transform,this._displayIds,this._points,this._rowIds);return this.copyInto(e),e}copyInto(e){super.copyInto(e),e._index=this._index}_readGeometry(e){const t=this._inner.readCoordsUnsafe(this._index),s=this._inner.readLengthsUnsafe(this._index);return t&&s?new i(s,t,this.hasZ,this.hasM):null}_readX(){if(this._points){const e=this._points[2*this._index];return e===this._emptyNumberValue?NaN:e}return this._inner.readX(this._index)}_readY(){if(this._points){const e=this._points[2*this._index+1];return e===this._emptyNumberValue?NaN:e}return this._inner.readY(this._index)}_readServerCentroid(){return null}_readAttribute(e,t){const i=this.fields.get(e);if(!i)return;const s=this._indexMap[i.name];if(null==s)return this.getObjectId();const r=this._inner.readAttribute(this._index,s);if(null==r)return r;if("esriFieldTypeString"===i.type||"esriFieldTypeDateOnly"===i.type||"esriFieldTypeTimeOnly"===i.type||"esriFieldTypeTimestampOffset"===i.type){const e=this._inner.readAttribute(this._index,s);return n.decode(e)}const o=this.fields.isDateField(i.name);return t?null==r?r:o?new Date(r):r:r}_readAttributes(){const e={};for(const t of this.metadata.fieldsIndex.fields){if(null==this._indexMap[t.name])continue;const i=this._readAttribute(t.name,!1);void 0!==i&&(e[t.name]=i)}return e.__OBJECTID=this.getObjectId(),e}}export{o as FeatureSetReaderParquet};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{fixCIMColors as e}from"./unsupported.js";let r=0;class t{}class s extends t{constructor(e,r){super(),this.kind="feature";const t=`__virtual_fi_${e}`;this.realField={name:t,alias:t,type:r}}addToFeature(e,r){const t=this.getValue(r);e.attributes[this.realField.name]=t}addToSymbol(e){const t=this.findTargetNode(e);let{primitiveName:s}=t;s||(r++,s=`primitive_${r}`,t.primitiveName=s);const i={type:"CIMPrimitiveOverride",primitiveName:s,propertyName:this.cimPropertyName,valueExpressionInfo:{type:"CIMExpressionInfo",expression:`return $feature.${this.realField.name};`}};e.primitiveOverrides=e.primitiveOverrides||[],e.primitiveOverrides.push(i)}}class i extends s{constructor(){super("text","esriFieldTypeString"),this.cimPropertyName="TextString"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0]}getValue(e){return e.graphic?e.graphic.text:e.text}}class o extends s{constructor(){super("color","esriFieldTypeString"),this.cimPropertyName="Color"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol.symbol.symbolLayers.find(e=>"CIMSolidFill"===e.type)}getValue(r){const t=r.color||"#000000";if(t.startsWith("#"))return t;if(t.startsWith("rgb"))return t;const s=JSON.parse(t),i=e(s);return`rgba(${i[0]}, ${i[1]}, ${i[2]}, ${i[3]/255})`}}class n extends s{constructor(){super("rotation","esriFieldTypeDouble"),this.cimPropertyName="Rotation"}findTargetNode(e){return e.symbol.symbolLayers[0]}getValue(e){return null!=e.textAngle?-e.textAngle:void 0}}class a extends s{constructor(){super("offsetX","esriFieldTypeDouble"),this.cimPropertyName="OffsetX"}findTargetNode(e){return e.symbol.symbolLayers[0]}getValue(e){return e.xOffset}}class l extends s{constructor(){super("offsetY","esriFieldTypeDouble"),this.cimPropertyName="OffsetY"}findTargetNode(e){return e.symbol.symbolLayers[0]}getValue(e){return e.yOffset}}class m extends t{constructor(){super(...arguments),this.kind="symbol"}addToSymbol(e,r){const t=this.getValue(r);if(null==t)return;this.findTargetNode(e)[this._fixCase(this.cimPropertyName)]=t}_fixCase(e){return this.cimPropertyName[0].toLocaleLowerCase()+e.slice(1)}}class u extends m{constructor(){super(...arguments),this.cimPropertyName="VerticalAlignment"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return null==e.verticalAlignment?null:["Top","Center","Baseline","Bottom"][e.verticalAlignment]}}class c extends m{constructor(){super(...arguments),this.cimPropertyName="HorizontalAlignment"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return null==e.horizontalAlignment?null:["Left","Right","Center","Justify"][e.horizontalAlignment]}}class y extends m{constructor(){super(...arguments),this.cimPropertyName="FontFamilyName"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return e.fontFamilyName}}class d extends m{constructor(){super(...arguments),this.cimPropertyName="FontStyleName"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return e.fontStyleName}}class p extends m{constructor(){super(...arguments),this.cimPropertyName="Height"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return e.size}}class g extends m{constructor(){super(...arguments),this.cimPropertyName="Underline"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return e.underline}}const f=new i,h=new o,b=new n,N=new a,x=new l,T=new p,v=new g,L=[f,h,b,N,x],P=[new c,new u,new y,new d,T,v];export{L as featureFields,P as symbolFields};
2
+ import{fixCIMColors as e}from"./unsupported.js";let r=0;class t{}class s extends t{constructor(e,r){super(),this.kind="feature";const t=`__virtual_fi_${e}`;this.realField={name:t,alias:t,type:r,editable:!1,nullable:!0}}addToFeature(e,r){const t=this.getValue(r);e.attributes[this.realField.name]=t}addToSymbol(e){const t=this.findTargetNode(e);let{primitiveName:s}=t;s||(r++,s=`primitive_${r}`,t.primitiveName=s);const i={type:"CIMPrimitiveOverride",primitiveName:s,propertyName:this.cimPropertyName,valueExpressionInfo:{type:"CIMExpressionInfo",expression:`return $feature.${this.realField.name};`}};e.primitiveOverrides=e.primitiveOverrides||[],e.primitiveOverrides.push(i)}}class i extends s{constructor(){super("text","esriFieldTypeString"),this.cimPropertyName="TextString"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0]}getValue(e){return e.graphic?e.graphic.text:e.text}}class o extends s{constructor(){super("color","esriFieldTypeString"),this.cimPropertyName="Color"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol.symbol.symbolLayers.find(e=>"CIMSolidFill"===e.type)}getValue(r){const t=r.color||"#000000";if(t.startsWith("#"))return t;if(t.startsWith("rgb"))return t;const s=JSON.parse(t),i=e(s);return`rgba(${i[0]}, ${i[1]}, ${i[2]}, ${i[3]/255})`}}class n extends s{constructor(){super("rotation","esriFieldTypeDouble"),this.cimPropertyName="Rotation"}findTargetNode(e){return e.symbol.symbolLayers[0]}getValue(e){return null!=e.textAngle?-e.textAngle:void 0}}class a extends s{constructor(){super("offsetX","esriFieldTypeDouble"),this.cimPropertyName="OffsetX"}findTargetNode(e){return e.symbol.symbolLayers[0]}getValue(e){return e.xOffset}}class l extends s{constructor(){super("offsetY","esriFieldTypeDouble"),this.cimPropertyName="OffsetY"}findTargetNode(e){return e.symbol.symbolLayers[0]}getValue(e){return e.yOffset}}class m extends t{constructor(){super(...arguments),this.kind="symbol"}addToSymbol(e,r){const t=this.getValue(r);if(null==t)return;this.findTargetNode(e)[this._fixCase(this.cimPropertyName)]=t}_fixCase(e){return this.cimPropertyName[0].toLocaleLowerCase()+e.slice(1)}}class u extends m{constructor(){super(...arguments),this.cimPropertyName="VerticalAlignment"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return null==e.verticalAlignment?null:["Top","Center","Baseline","Bottom"][e.verticalAlignment]}}class c extends m{constructor(){super(...arguments),this.cimPropertyName="HorizontalAlignment"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return null==e.horizontalAlignment?null:["Left","Right","Center","Justify"][e.horizontalAlignment]}}class y extends m{constructor(){super(...arguments),this.cimPropertyName="FontFamilyName"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return e.fontFamilyName}}class d extends m{constructor(){super(...arguments),this.cimPropertyName="FontStyleName"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return e.fontStyleName}}class p extends m{constructor(){super(...arguments),this.cimPropertyName="Height"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return e.size}}class g extends m{constructor(){super(...arguments),this.cimPropertyName="Underline"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return e.underline}}const b=new i,f=new o,h=new n,N=new a,x=new l,T=new p,v=new g,L=[b,f,h,N,x],P=[new c,new u,new y,new d,T,v];export{L as featureFields,P as symbolFields};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../Color.js";import{deg2rad as i}from"../../../../core/mathUtils.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";const r=2,s=4,o=i(2),c=1.5;class n{constructor(){this.collisionRadius=5,this.fovUnfocusedArcWidth=s,this.fovFocusedArcWidth=r*this.fovUnfocusedArcWidth,this.scaleOrientSize=90,this.scaleOrientHandleRadius=.025,this.scaleOrientMinDistance=1,this.scaleOrientArrowTipLength=.3,this.scaleOrientArrowTipFocusMultiplier=r/1.5,this.observerSize=5,this.hoverTimeoutMilliseconds=1e3,this.viewAngleThreshold=10}getFovArcWidth(e){return e?this.fovFocusedArcWidth:this.fovUnfocusedArcWidth}getScaleOrientArrowTipLength(e){return this.scaleOrientArrowTipLength*(e?this.scaleOrientArrowTipFocusMultiplier:1)}}const h=new n;class l{constructor(){this.frameWidthNotSelected=.3,this.frameWidthSelected=1,this.frameColor=new e([255,255,255,.99]),this.observerPointConfiguration={size:6,pixelSnappingEnabled:!1,primitive:"circle",elevationInfo:{mode:"absolute-height",offset:0},outlineSize:0,color:new e([3,252,111,1]).toUnitRGBA()},this.shapeMaterialParameters={color:t(.33,.33,.33,.25),renderOccluded:1,cullFace:2,writeDepth:!1}}}const a=new l;export{o as arcAnglePerSegment,c as creationVerticalOffset,h as viewshedToolManipulatorConfiguration,a as viewshedVisualizationConfiguration};
2
+ import e from"../../../../Color.js";import{deg2rad as i}from"../../../../core/mathUtils.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";const r=2,o=4,s=i(2),c=1.5;class n{constructor(){this.collisionRadius=5,this.fovUnfocusedArcWidth=o,this.fovFocusedArcWidth=r*this.fovUnfocusedArcWidth,this.scaleOrientSize=90,this.scaleOrientHandleRadius=.025,this.scaleOrientMinDistance=1,this.scaleOrientArrowTipLength=.3,this.scaleOrientArrowTipFocusMultiplier=r/1.5,this.observerSize=5,this.hoverTimeoutMilliseconds=1e3,this.viewAngleThreshold=10}getFovArcWidth(e){return e?this.fovFocusedArcWidth:this.fovUnfocusedArcWidth}getScaleOrientArrowTipLength(e){return this.scaleOrientArrowTipLength*(e?this.scaleOrientArrowTipFocusMultiplier:1)}}const l=new n;class h{constructor(){this.frameWidthNotSelected=.3,this.frameWidthSelected=1,this.frameColor=new e([255,255,255,.99]),this.observerPointConfiguration={size:6,pixelSnappingEnabled:!1,primitive:"circle",outlineSize:0,color:new e([3,252,111,1]).toUnitRGBA()},this.observerStagedPointConfiguration={size:10,outlineColor:new e([0,0,0,0]).toUnitRGBA(),renderOccluded:4},this.shapeMaterialParameters={color:t(.33,.33,.33,.25),renderOccluded:1,cullFace:2,writeDepth:!1}}}const a=new h;export{s as arcAnglePerSegment,c as creationVerticalOffset,l as viewshedToolManipulatorConfiguration,a as viewshedVisualizationConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as i}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import s from"../../../../core/ReactiveMap.js";import{watch as r}from"../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewshedInteractionVisuals as n}from"./ViewshedInteractionVisuals.js";import{ViewshedObserverManipulator as c}from"./viewshedToolManipulatorUtils.js";let u=class extends t{constructor(i){super(i),this._active=!1,this.analysisVisible=!0,this._placementLocation=null,this._visuals=new s,this._interactionVisuals=null,this._observerManipulator=null,this._observerManipulatorTool=null}initialize(){this._interactionVisuals=new n({view:this.view}),this.addHandles(r(()=>this.analysisVisible,()=>this._refreshInteractionVisuals()))}destroy(){this._visuals.clear(),this._interactionVisuals=e(this._interactionVisuals);const i=this._observerManipulator;null!=i&&(this._observerManipulatorTool?.manipulators.remove(i),this._observerManipulator=e(i),this._observerManipulatorTool=null)}get _placingObserver(){return this.isPlacingObserver()}activate(){this._active=!0,this._refreshInteractionVisuals()}deactivate(){this._active=!1,this._interactionVisuals?.setVisibility(!1);const i=this._observerManipulator;null!=i&&(i.available=!1)}addObserverManipulator(i){null==this._observerManipulator&&(this._observerManipulatorTool=i,this._observerManipulator=new c(this.view,i),this._refreshInteractionVisuals())}addOrUpdateGraphic(i,t){}updatePlacementLocation(i){this._placementLocation=i?l(i):null,this._refreshInteractionVisuals()}addOrUpdateVisual(i,t){this._visuals.set(i,h(t,this._visuals.get(i))),this._refreshInteractionVisuals()}removeGraphic(i){}removeVisual(i){this._visuals.delete(i),this._refreshInteractionVisuals()}hitTestVisualDistance(i,t){return null}_refreshInteractionVisuals(){const i=this._placementLocation,t=null!=i&&this._active&&this.analysisVisible,e=t&&this._placingObserver;this._interactionVisuals?.update({location:i,laserlineVisible:t,verticalLineVisible:e});const s=this._observerManipulator;null!=s&&(e&&(s.renderLocation=i),s.available=e)}get test(){}};function h(i,t={geometry:null,role:"outputGeometry",state:"idle"}){return{...t,...i}}i([a({constructOnly:!0})],u.prototype,"view",void 0),i([a({constructOnly:!0})],u.prototype,"isPlacingObserver",void 0),i([a()],u.prototype,"_active",void 0),i([a()],u.prototype,"analysisVisible",void 0),i([a()],u.prototype,"_placementLocation",void 0),i([a()],u.prototype,"_placingObserver",null),u=i([o("esri.views.3d.analysis.Viewshed.ViewshedDrawToolRenderer")],u);export{u as ViewshedDrawToolRenderer};
2
+ import{__decorate as e}from"tslib";import i from"../../../../core/Accessor.js";import"../../../../core/has.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/ReactiveMap.js";import{watch as r,initial as o}from"../../../../core/reactiveUtils.js";import{property as l,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{clone as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as c}from"../../../../support/elevationInfoUtils.js";import{ViewshedInteractionVisuals as u}from"./ViewshedInteractionVisuals.js";import{Settings as h}from"../../interactive/editingTools/settings.js";import{VerticesVisualElement as v}from"../../interactive/visualElements/VerticesVisualElement.js";let p=class extends i{constructor(e){super(e),this._active=!1,this.analysisVisible=!0,this._placementLocation=null,this._settings=new h({getTheme:()=>this.view.effectiveTheme}),this._visuals=new s}initialize(){const e=this._settings,i=e.manipulators.vertex;this._observerVisual=new v({view:this.view,isDecoration:!0,spatialReference:this.view.renderCoordsHelper.spatialReference,elevationInfo:c,size:i.size,outlineSize:i.outlineSize,renderOccluded:i.renderOccluded,color:e.colors.selected.toUnitRGBA(),outlineColor:i.outlineColor.toUnitRGBA()}),this._interactionVisuals=new u({view:this.view}),this.addHandles([r(()=>this.analysisVisible,()=>this._refreshInteractionVisuals()),r(()=>({selectedColor:e.colors.selected.toUnitRGBA(),outlineColor:e.manipulators.vertex.outlineColor.toUnitRGBA()}),({selectedColor:e,outlineColor:i})=>{this._observerVisual.color=e,this._observerVisual.outlineColor=i},o)])}destroy(){this._visuals.clear(),t(this._observerVisual),t(this._interactionVisuals)}get _placingObserver(){return this.isPlacingObserver()}activate(){this._active=!0,this._observerVisual.attached=!0,this._refreshInteractionVisuals()}deactivate(){this._active=!1,this._observerVisual.attached=!1,this._interactionVisuals.setVisibility(!1)}addOrUpdateGraphic(e,i){}updatePlacementLocation(e){this._placementLocation=e?n(e):null,this._refreshInteractionVisuals()}addOrUpdateVisual(e,i){this._visuals.set(e,d(i,this._visuals.get(e))),this._refreshInteractionVisuals()}removeGraphic(e){}removeVisual(e){this._visuals.delete(e),this._refreshInteractionVisuals()}hitTestVisualDistance(e,i){return null}_refreshInteractionVisuals(){const e=this._placementLocation,i=null!=e&&this._active&&this.analysisVisible,t=i&&this._placingObserver;this._observerVisual.vertices=e?[e]:[],this._observerVisual.visible=t,this._interactionVisuals.update({location:e,laserlineVisible:i,verticalLineVisible:t})}get test(){}};function d(e,i={geometry:null,role:"outputGeometry",state:"idle"}){return{...i,...e}}e([l({constructOnly:!0})],p.prototype,"view",void 0),e([l({constructOnly:!0})],p.prototype,"isPlacingObserver",void 0),e([l()],p.prototype,"_active",void 0),e([l()],p.prototype,"analysisVisible",void 0),e([l()],p.prototype,"_placementLocation",void 0),e([l()],p.prototype,"_placingObserver",null),p=e([a("esri.views.3d.analysis.Viewshed.ViewshedDrawToolRenderer")],p);export{p as ViewshedDrawToolRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../analysis/Viewshed.js";import i from"../../../../core/Accessor.js";import"../../../../core/has.js";import{createAbortError as s,throwIfAborted as o,onAbort as a}from"../../../../core/promiseUtils.js";import{watch as n,sync as r}from"../../../../core/reactiveUtils.js";import{getMetersPerVerticalUnitForSR as l}from"../../../../core/units.js";import{property as c,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{createDrawTool as p,getFeatureReference as _}from"./placementUtils.js";import{detachToolFromView as m}from"./toolLifecycleUtils.js";import{creationVerticalOffset as u}from"./ViewshedConfiguration.js";import w from"./ViewshedPlacementOperation.js";import{createViewshedPlacementRootPluginConfiguration as v}from"./ViewshedPlacementRootPlugin.js";import{computeParametersFromTargetPoint as g}from"./viewshedToolUtils.js";import{DrawManipulator3D as P}from"../../../draw/DrawManipulator3D.js";import{ViewEventPriorities as y}from"../../../input/InputManager.js";import{sketchKeys as O}from"../../../interactive/keybindings.js";import b from"../../../interactive/sketch/SketchOptions.js";const S="multiple",f=Symbol("hiddenManipulatorHandle");let C=class extends i{constructor(e){super(e),this.placementMode=S,this.stagedViewshed=null,this._placeOperation=null,this._drawTool=null,this._renderer=null,this._sketchOptions=new b({tooltips:{enabled:!1}}),this._scenePoint=d()}initialize(){this.addHandles([this.view.on("key-down",e=>this._handleKeyDown(e),y.DEFAULT),n(()=>{const{stagedViewshed:e}=this;return{stagedViewshed:e,stagedViewshedInAnalysis:null!=e&&this.analysis.viewsheds.includes(e)}},({stagedViewshed:e,stagedViewshedInAnalysis:t})=>{null==e||t||this.analysis.viewsheds.add(e)},r)])}destroy(){this._cancelPlacementOperation()}get updating(){return!!this._drawTool?.updating}get active(){return!!this._drawTool?.active}get creationState(){return this._get("creationState")}set creationState(e){this._set("creationState",e),this._sketchOptions.tooltips.enabled="placing-observer"===e}startPlaceOperation(e,t){this._removeStaged(),this.creationState=null,this._rejectPlaceOperation(s()),o(t);const{resolve:i,reject:n,promise:r}=Promise.withResolvers(),l=a(t,()=>this._cancelPlacementOperation());return this._placeOperation=new w({abortHandle:l,reject:n,resolve:i}),this.place(e),r}place(e){this.callbacks.setSelectedViewshed(null),this.placementMode=e,this._startObserverPlacement()}cancelPlaceOperation(){null==this.creationState&&null==this._placeOperation||(this._cancelPlacementOperation(),this.callbacks.cancelTool())}_handleDeleteDuringCreation(){return null!=this.creationState&&(this._destroyDrawTool(),this._removeStaged(),this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),!0)}_handleKeyDown(e){null!=this.creationState&&(O.cancel===e.key?(this._handleCancelDuringCreation(),e.stopPropagation(),e.preventDefault()):O.delete.includes(e.key)&&(this._handleDeleteDuringCreation(),e.stopPropagation(),e.preventDefault()))}_handleCancelDuringCreation(){if(this._removeStaged()&&"multiple"===this.placementMode)return this.callbacks.setSelectedViewshed(null),void this._startObserverPlacement();this._destroyDrawTool(),this._abortCreation()}_removeStaged(){const{stagedViewshed:e}=this;return this.stagedViewshed=null,!!e&&(this.analysis.viewsheds.remove(e),!0)}_cancelPlacementOperation(){this._destroyDrawTool(),this._removeStaged(),this.creationState=null,this._finishPlaceOperation()}_abortCreation(){this.callbacks.cancelTool(),this.creationState=null,this._finishPlaceOperation()}_handleObserverPlacementComplete(e,i,s){const o=new t({observer:e,feature:s});this.analysis.viewsheds.add(o),this.stagedViewshed=o,this.creationState="placing-target",this._updateStagedViewshed(i),this.callbacks.setSelectedViewshed(null)}_onCancel(e){const t=this._removeStaged();return"placing-observer"===this.creationState?t&&"multiple"===this.placementMode?(this.callbacks.setSelectedViewshed(null),void this._startObserverPlacement()):(this._destroyDrawTool(e),void this._abortCreation()):t?(this.creationState="placing-observer",this.callbacks.setSelectedViewshed(null),void("multiple"!==this.placementMode?(this._destroyDrawTool(e),this._abortCreation()):this._startPointPlacement())):(this._destroyDrawTool(e),void this._abortCreation())}_handleTargetPlacementComplete(e){this._updateStagedViewshed(e);const t=this.stagedViewshed;this._placeOperation?.markPlacedViewshed(),this.stagedViewshed=null,this.callbacks.setSelectedViewshed(t),"multiple"!==this.placementMode||(this.creationState="placing-observer")}_resolvePlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.resolve())}_finishPlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.finish())}_rejectPlaceOperation(e){this._clearPlaceOperationAndRun(t=>t?.reject(e))}_clearPlaceOperationAndRun(e){const t=this._placeOperation;this._placeOperation=null,e(t)}_startObserverPlacement(){this.creationState="placing-observer",this._startPointPlacement()}_startPointPlacement(){this._drawTool&&this._destroyDrawTool(this._drawTool);const{drawTool:e,intersector:t,renderer:i,snappingManager:s}=p({analysisViewData:this.analysisViewData,view:this.view,sketchOptions:this._sketchOptions,onCancel:e=>this._onCancel(e),onComplete:e=>this._onComplete(e),onManipulatorCountChange:e=>this._onManipulatorCountChange(e),isPlacingObserver:()=>"placing-observer"===this.creationState});this._drawTool=e,this._renderer=i;try{this.view.addAndActivateTool(e),e.begin([v({mode:this.placementMode,onObserverComplete:(e,i)=>this._onObserverMapPointComplete(t,s,e,i),onTargetComplete:e=>this._onTargetMapPointComplete(e),onObserverPreview:e=>this._onObserverMapPointPreview(e),onTargetPreview:e=>this._onTargetMapPointPreview(e)})])}catch(o){this._destroyDrawTool(e),this._rejectPlaceOperation(o instanceof Error?o:new Error(String(o)))}}_onComplete(e){this._removeStaged(),this._resolvePlaceOperation(),this._destroyDrawTool(e),this.creationState=null}_onObserverMapPointComplete(e,t,i,s){const o=V(i),a=this._toScenePoint(o),n=_({intersector:e,snappingManager:t,screenPoint:s,view:this.view});this._renderer?.updatePlacementLocation(a),this._handleObserverPlacementComplete(o,a,n)}_onTargetMapPointComplete(e){const t=this._toScenePoint(e);this._renderer?.updatePlacementLocation(t),this._handleTargetPlacementComplete(t),"multiple"===this.placementMode&&this._renderer?.updatePlacementLocation(null)}_onObserverMapPointPreview(e){const t=V(e),i=this._toScenePoint(t);this._renderer?.updatePlacementLocation(i)}_onTargetMapPointPreview(e){const t=this._toScenePoint(e);this._renderer?.updatePlacementLocation(t),this._updateStagedViewshed(t)}_onManipulatorCountChange(e){e.removeHandles(f);const t=[];e.manipulators.forEach(({manipulator:e})=>{e instanceof P&&t.push(e.disableDisplay())}),e.addHandles(t,f)}_destroyDrawTool(e=this._drawTool){this._drawTool=null,this._renderer=null,e&&m(this.view,e)}_toScenePoint(e){return this.view.renderCoordsHelper.toRenderCoords(e,this._scenePoint),this._scenePoint}_updateStagedViewshed(e){const t=this.stagedViewshed;if(!t)return;const i=this.callbacks.findViewshedComputedData(t);if(!i)return;const{heading:s,tilt:o,farDistance:a}=g(this.view,i,e);t.farDistance=a,t.tilt=o,t.heading=s}get test(){}};function V(e){const t=e.clone(),i=l(t.spatialReference);return t.z=(t.z??0)+u/i,t}e([c({constructOnly:!0})],C.prototype,"analysis",void 0),e([c({constructOnly:!0})],C.prototype,"analysisViewData",void 0),e([c({constructOnly:!0})],C.prototype,"view",void 0),e([c({constructOnly:!0})],C.prototype,"callbacks",void 0),e([c()],C.prototype,"placementMode",void 0),e([c()],C.prototype,"stagedViewshed",void 0),e([c()],C.prototype,"_placeOperation",void 0),e([c()],C.prototype,"_drawTool",void 0),e([c()],C.prototype,"_renderer",void 0),e([c()],C.prototype,"_sketchOptions",void 0),e([c()],C.prototype,"updating",null),e([c()],C.prototype,"active",null),e([c({value:null})],C.prototype,"creationState",null),C=e([h("esri.views.3d.analysis.Viewshed.ViewshedPlacementController")],C);export{C as ViewshedPlacementController};
2
+ import{__decorate as e}from"tslib";import t from"../../../../analysis/Viewshed.js";import i from"../../../../core/Accessor.js";import"../../../../core/has.js";import{createAbortError as s,throwIfAborted as o,onAbort as a}from"../../../../core/promiseUtils.js";import{watch as n,sync as r}from"../../../../core/reactiveUtils.js";import{getMetersPerVerticalUnitForSR as l}from"../../../../core/units.js";import{property as c,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{createDrawTool as p,getFeatureReference as _}from"./placementUtils.js";import{detachToolFromView as m}from"./toolLifecycleUtils.js";import{creationVerticalOffset as u}from"./ViewshedConfiguration.js";import w from"./ViewshedPlacementOperation.js";import{createViewshedPlacementRootPluginConfiguration as v}from"./ViewshedPlacementRootPlugin.js";import{computeParametersFromTargetPoint as g}from"./viewshedToolUtils.js";import{DrawManipulator3D as P}from"../../../draw/DrawManipulator3D.js";import{ViewEventPriorities as y}from"../../../input/InputManager.js";import{sketchKeys as O}from"../../../interactive/keybindings.js";import b from"../../../interactive/sketch/SketchOptions.js";const S="multiple",f=Symbol("hiddenManipulatorHandle");let C=class extends i{constructor(e){super(e),this.placementMode=S,this.stagedViewshed=null,this._placeOperation=null,this._drawTool=null,this._renderer=null,this._sketchOptions=new b({tooltips:{enabled:!1}}),this._scenePoint=d()}initialize(){this.addHandles([this.view.on("key-down",e=>this._handleKeyDown(e),y.DEFAULT),n(()=>{const{stagedViewshed:e}=this;return{stagedViewshed:e,stagedViewshedInAnalysis:null!=e&&this.analysis.viewsheds.includes(e)}},({stagedViewshed:e,stagedViewshedInAnalysis:t})=>{null==e||t||this.analysis.viewsheds.add(e)},r)])}destroy(){this._cancelPlacementOperation()}get updating(){return!!this._drawTool?.updating}get active(){return!!this._drawTool?.active}get creationState(){return this._get("creationState")}set creationState(e){this._set("creationState",e),this._sketchOptions.tooltips.enabled="placing-observer"===e}startPlaceOperation(e,t){this._removeStaged(),this.creationState=null,this._rejectPlaceOperation(s()),o(t);const{resolve:i,reject:n,promise:r}=Promise.withResolvers(),l=a(t,()=>this._cancelPlacementOperation());return this._placeOperation=new w({abortHandle:l,reject:n,resolve:i}),this.place(e),r}place(e){this.callbacks.setSelectedViewshed(null),this.placementMode=e,this._startObserverPlacement()}cancelPlaceOperation(){null==this.creationState&&null==this._placeOperation||(this._cancelPlacementOperation(),this.callbacks.cancelTool())}_handleDeleteDuringCreation(){return null!=this.creationState&&(this._destroyDrawTool(),this._removeStaged(),this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),!0)}_handleKeyDown(e){null!=this.creationState&&(O.cancel===e.key?(this._handleCancelDuringCreation(),e.stopPropagation(),e.preventDefault()):O.delete.includes(e.key)&&(this._handleDeleteDuringCreation(),e.stopPropagation(),e.preventDefault()))}_handleCancelDuringCreation(){if(this._removeStaged()&&"multiple"===this.placementMode)return this.callbacks.setSelectedViewshed(null),void this._startObserverPlacement();this._destroyDrawTool(),this._abortCreation()}_removeStaged(){const{stagedViewshed:e}=this;return this.stagedViewshed=null,!!e&&(this.analysis.viewsheds.remove(e),!0)}_cancelPlacementOperation(){this._destroyDrawTool(),this._removeStaged(),this.creationState=null,this._finishPlaceOperation()}_abortCreation(){this.callbacks.cancelTool(),this.creationState=null,this._finishPlaceOperation()}_handleObserverPlacementComplete(e,i,s){const o=new t({observer:e,feature:s});this.analysis.viewsheds.add(o),this.stagedViewshed=o,this.creationState="placing-target",this._updateStagedViewshed(i),this.callbacks.setSelectedViewshed(null)}_onCancel(e){const t=this._removeStaged();return"placing-observer"===this.creationState?t&&"multiple"===this.placementMode?(this.callbacks.setSelectedViewshed(null),void this._startObserverPlacement()):(this._destroyDrawTool(e),void this._abortCreation()):t?(this.creationState="placing-observer",this.callbacks.setSelectedViewshed(null),void("multiple"!==this.placementMode?(this._destroyDrawTool(e),this._abortCreation()):this._startPointPlacement())):(this._destroyDrawTool(e),void this._abortCreation())}_handleTargetPlacementComplete(e){this._updateStagedViewshed(e);const t=this.stagedViewshed;this._placeOperation?.markPlacedViewshed(),this.stagedViewshed=null,this.callbacks.setSelectedViewshed(t),"multiple"!==this.placementMode||(this.creationState="placing-observer")}_resolvePlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.resolve())}_finishPlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.finish())}_rejectPlaceOperation(e){this._clearPlaceOperationAndRun(t=>t?.reject(e))}_clearPlaceOperationAndRun(e){const t=this._placeOperation;this._placeOperation=null,e(t)}_startObserverPlacement(){this.creationState="placing-observer",this._startPointPlacement()}_startPointPlacement(){this._drawTool&&this._destroyDrawTool(this._drawTool);const{drawTool:e,intersector:t,renderer:i,snappingManager:s}=p({analysisViewData:this.analysisViewData,view:this.view,sketchOptions:this._sketchOptions,onCancel:e=>this._onCancel(e),onComplete:e=>this._onComplete(e),onManipulatorCountChange:e=>this._onManipulatorCountChange(e),isPlacingObserver:()=>"placing-observer"===this.creationState});this._drawTool=e,this._renderer=i;try{this.view.addAndActivateTool(e),e.begin([v({mode:this.placementMode,onObserverComplete:(e,i)=>this._onObserverMapPointComplete(t,s,e,i),onTargetComplete:e=>this._onTargetMapPointComplete(e),onObserverPreview:e=>this._onObserverMapPointPreview(e),onTargetPreview:e=>this._onTargetMapPointPreview(e)})])}catch(o){this._destroyDrawTool(e),this._rejectPlaceOperation(o instanceof Error?o:new Error(String(o)))}}_onComplete(e){this._removeStaged(),this._resolvePlaceOperation(),this._destroyDrawTool(e),this.creationState=null}_onObserverMapPointComplete(e,t,i,s){const o=V(i),a=this._toScenePoint(o),n=_({intersector:e,snappingManager:t,screenPoint:s,view:this.view});this._renderer?.updatePlacementLocation(a),this._handleObserverPlacementComplete(o,a,n)}_onTargetMapPointComplete(e){const t=this._toScenePoint(e);this._renderer?.updatePlacementLocation(t),this._handleTargetPlacementComplete(t)}_onObserverMapPointPreview(e){const t=V(e),i=this._toScenePoint(t);this._renderer?.updatePlacementLocation(i)}_onTargetMapPointPreview(e){const t=this._toScenePoint(e);this._renderer?.updatePlacementLocation(t),this._updateStagedViewshed(t)}_onManipulatorCountChange(e){e.removeHandles(f);const t=[];e.manipulators.forEach(({manipulator:e})=>{e instanceof P&&t.push(e.disableDisplay())}),e.addHandles(t,f)}_destroyDrawTool(e=this._drawTool){this._drawTool=null,this._renderer=null,e&&m(this.view,e)}_toScenePoint(e){return this.view.renderCoordsHelper.toRenderCoords(e,this._scenePoint),this._scenePoint}_updateStagedViewshed(e){const t=this.stagedViewshed;if(!t)return;const i=this.callbacks.findViewshedComputedData(t);if(!i)return;const{heading:s,tilt:o,farDistance:a}=g(this.view,i,e);t.farDistance=a,t.tilt=o,t.heading=s}get test(){}};function V(e){const t=e.clone(),i=l(t.spatialReference);return t.z=(t.z??0)+u/i,t}e([c({constructOnly:!0})],C.prototype,"analysis",void 0),e([c({constructOnly:!0})],C.prototype,"analysisViewData",void 0),e([c({constructOnly:!0})],C.prototype,"view",void 0),e([c({constructOnly:!0})],C.prototype,"callbacks",void 0),e([c()],C.prototype,"placementMode",void 0),e([c()],C.prototype,"stagedViewshed",void 0),e([c()],C.prototype,"_placeOperation",void 0),e([c()],C.prototype,"_drawTool",void 0),e([c()],C.prototype,"_renderer",void 0),e([c()],C.prototype,"_sketchOptions",void 0),e([c()],C.prototype,"updating",null),e([c()],C.prototype,"active",null),e([c({value:null})],C.prototype,"creationState",null),C=e([h("esri.views.3d.analysis.Viewshed.ViewshedPlacementController")],C);export{C as ViewshedPlacementController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{equals as i}from"../../../../core/lang.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as o,initial as a}from"../../../../core/reactiveUtils.js";import{property as l,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as m,set as d,sub as u,len as p,normalize as _,scale as f,angle as V,negate as v,copy as w,add as E}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b,clone as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isOtherViewshedToolCreating as A}from"./analysisViewRegister.js";import{viewshedVisualizationConfiguration as C,arcAnglePerSegment as L}from"./ViewshedConfiguration.js";import{ViewshedShapeVisualElement as D}from"./ViewshedShapeVisualElement.js";import{LineVisualElement as y}from"../../interactive/visualElements/LineVisualElement.js";import{PointVisualElement as j}from"../../interactive/visualElements/PointVisualElement.js";import{createStipplePatternSimple as O}from"../../webgl-engine/materials/lineStippleUtils.js";let R=class extends t{constructor(e){super(e),this.visible=!0,this._viewshedCorners={topLeft:b(),topRight:b(),bottomLeft:b(),bottomRight:b()},this._arcCenterPoints={top:b(),bottom:b(),left:b(),right:b()},this._parallelCenters={top:b(),bottom:b()}}initialize(){const e={view:this.view,isDecoration:!0},t={...e,color:this._color,renderOccluded:4},s={...t,stipplePattern:O(2)};this._observerVisualElement=new j({...e,...C.observerPointConfiguration}),this._shapeVisualElement=new D({...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(s),this._centralLatitude=new y(s),this.addHandles([o(()=>{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:i}),o(()=>{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()},a),o(()=>{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 r=t||i;this._shapeVisualElement.visible=e,this._topArcVisualElement.visible=e,this._bottomArcVisualElement.visible=e,this._frameLinesVisualElement.visible=e&&s;const o=e&&(t||s);this._leftArcVisualElement.visible=o,this._rightArcVisualElement.visible=o,this._forEachLineVisualElement(e=>{e.width=r?C.frameWidthSelected:C.frameWidthNotSelected,e.renderOccluded=t?4:1}),[this._centralLatitude,this._centralLongitude].forEach(i=>{i.width=2*(r?C.frameWidthSelected:C.frameWidthNotSelected),i.visible=e&&t})},a),o(()=>{const{analysisViewData:{interactive:e,effectiveTool:t},_selected:i,visible:s}=this,r=!t?.active&&A(this.view,this.analysisViewData);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)},a)])}get _color(){const{viewshedComputedData:e,_selected:t,analysisViewData:i}=this;if(null==e)return C.frameColor.toUnitRGBA();const s=i.effectiveTool?.active||i.interactive,r=e.viewshed===i.stagedViewshed;return(s&&(t||r)?this.view.effectiveTheme.accentColor:C.frameColor).toUnitRGBA()}get _selected(){const{viewshedComputedData:e,analysisViewData:{selectedViewshedComputedData:t}}=this;return null!=e&&e===t}get _staged(){const{analysisViewData:e,viewshedComputedData:t}=this,{effectiveTool:i}=e;return null!=i&&i.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:r}=e;this._observerVisualElement.geometry=t.elevationAlignedObserver,this._shapeVisualElement.updateTransform(),this._updateFrameLines(t,i),this._updateFrameArcs(t,i,r),this._updateCentralHelperArcs(t,s)}_updateFrameLines(e,t){const i=e.elevationAlignedObserverRenderSpace;this._frameLinesVisualElement.geometry=[[i,t.topLeft],[i,t.topRight],[i,t.bottomLeft],[i,t.bottomRight]]}_updateFrameArcs(e,t,i){const{elevationAlignedObserverRenderSpace:r,rightVector:o,horizontalFieldOfView:a,tiltedUpVector:l}=e,n=s(a),u=b(),p=h();c(p,n/2,l),m(u,o,p),F(this._leftArcVisualElement,r,t.bottomLeft,t.topLeft,"forward",u),c(p,-n/2,l),d(u,0,0,0),m(u,o,p),F(this._rightArcVisualElement,r,t.bottomRight,t.topRight,"forward",u);const _=a>180?"backward":"forward";F(this._topArcVisualElement,i.top,t.topRight,t.topLeft,_,l),F(this._bottomArcVisualElement,i.bottom,t.bottomRight,t.bottomLeft,_,l)}_updateCentralHelperArcs(e,t){const i=e.elevationAlignedObserverRenderSpace,s=e.horizontalFieldOfView>=180?"backward":"forward";F(this._centralLatitude,i,t.right,t.left,s,e.tiltedUpVector),F(this._centralLongitude,i,t.top,t.bottom,"forward",e.leftVector)}get test(){}};function F(e,t,i,s,r,o,a=L){const l=b();u(l,i,t);const n=p(l),d=b();u(d,s,t),_(d,d),f(d,d,n);let A=V(l,d);const C=g(o);"backward"===r&&(v(C,C),A=-(2*Math.PI-A));const D=[],y=Math.ceil(Math.abs(A)/a),j=h();c(j,A/y,C);const O=b();w(O,l);const R=b();w(R,i);for(let c=0;c<y;c++){const e=b();w(e,R),m(O,O,j),E(R,t,O);const i=b();w(i,R),D.push([e,i])}e.geometry=D}e([l()],R.prototype,"view",void 0),e([l({constructOnly:!0})],R.prototype,"isDecoration",void 0),e([l()],R.prototype,"analysisViewData",void 0),e([l()],R.prototype,"viewshedComputedData",void 0),e([l()],R.prototype,"visible",void 0),e([l()],R.prototype,"_color",null),e([l()],R.prototype,"_selected",null),e([l()],R.prototype,"_staged",null),R=e([n("esri.views.3d.analysis.Viewshed.ViewshedSubVisualization")],R);const S=R;export{S as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{equals as i}from"../../../../core/lang.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as o,initial as a}from"../../../../core/reactiveUtils.js";import{property as l,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as m,set as d,sub as u,len as p,normalize as v,scale as _,angle as V,negate as f,copy as E,add as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w,clone as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as C}from"../../../../support/elevationInfoUtils.js";import{isOtherViewshedToolCreating as A}from"./analysisViewRegister.js";import{viewshedVisualizationConfiguration as L,arcAnglePerSegment as D}from"./ViewshedConfiguration.js";import{ViewshedShapeVisualElement as y}from"./ViewshedShapeVisualElement.js";import{LineVisualElement as S}from"../../interactive/visualElements/LineVisualElement.js";import{PointVisualElement as j}from"../../interactive/visualElements/PointVisualElement.js";import{VerticesVisualElement as R}from"../../interactive/visualElements/VerticesVisualElement.js";import{createStipplePatternSimple as O}from"../../webgl-engine/materials/lineStippleUtils.js";let F=class extends t{constructor(e){super(e),this.visible=!0,this._viewshedCorners={topLeft:w(),topRight:w(),bottomLeft:w(),bottomRight:w()},this._arcCenterPoints={top:w(),bottom:w(),left:w(),right:w()},this._parallelCenters={top:w(),bottom:w()}}initialize(){const e={view:this.view,isDecoration:!0},t={...e,color:this._color,renderOccluded:4},s={...t,stipplePattern:O(2)};this._observerVisualElement=new j({...e,...L.observerPointConfiguration,elevationInfo:C}),this._observerStagedVisualElement=new R({...e,...L.observerStagedPointConfiguration,spatialReference:this.view.renderCoordsHelper.spatialReference,elevationInfo:C}),this._shapeVisualElement=new y({...e,isDecoration:this.isDecoration}),this._frameLinesVisualElement=new S(t),this._leftArcVisualElement=new S(t),this._rightArcVisualElement=new S(t),this._topArcVisualElement=new S(t),this._bottomArcVisualElement=new S(t),this._centralLongitude=new S(s),this._centralLatitude=new S(s),this.addHandles([o(()=>{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:i}),o(()=>{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()},a),o(()=>{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 r=t||i;this._shapeVisualElement.visible=e,this._topArcVisualElement.visible=e,this._bottomArcVisualElement.visible=e,this._frameLinesVisualElement.visible=e&&s;const o=e&&(t||s);this._leftArcVisualElement.visible=o,this._rightArcVisualElement.visible=o,this._forEachLineVisualElement(e=>{e.width=r?L.frameWidthSelected:L.frameWidthNotSelected,e.renderOccluded=t?4:1}),[this._centralLatitude,this._centralLongitude].forEach(i=>{i.width=2*(r?L.frameWidthSelected:L.frameWidthNotSelected),i.visible=e&&t})},a),o(()=>{const{analysisViewData:{interactive:e,effectiveTool:t},_selected:i,_staged:s,visible:r}=this,o=i||s,a=!t?.active&&A(this.view,this.analysisViewData);return{observerVisible:r&&!o&&(!e||(t?.creating??!1)||a),observerStagedVisible:s,color:this._color}},({observerVisible:e,observerStagedVisible:t,color:i})=>{this._observerVisualElement.visible=e,this._observerStagedVisualElement.visible=t,this._forEachLineVisualElement(e=>e.color=i)},a)])}get _color(){const{viewshedComputedData:e,_selected:t,analysisViewData:i}=this;if(null==e)return L.frameColor.toUnitRGBA();const s=i.effectiveTool?.active||i.interactive,r=e.viewshed===i.stagedViewshed;return(s&&(t||r)?this.view.effectiveTheme.accentColor:L.frameColor).toUnitRGBA()}get _selected(){const{viewshedComputedData:e,analysisViewData:{selectedViewshedComputedData:t}}=this;return null!=e&&e===t}get _staged(){const{analysisViewData:e,viewshedComputedData:t}=this,{effectiveTool:i}=e;return null!=i&&i.creating&&e.stagedViewshed===t?.viewshed}destroy(){this._observerVisualElement=r(this._observerVisualElement),this._observerStagedVisualElement=r(this._observerStagedVisualElement),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._observerStagedVisualElement),e(this._shapeVisualElement)}_updateVisualElements(e){const{viewshedComputedData:t,corners:i,arcCenters:s,parallelCenters:r}=e,o=w();this.view.renderCoordsHelper.toRenderCoords(t.elevationAlignedObserver,o),this._observerVisualElement.geometry=t.elevationAlignedObserver,this._observerStagedVisualElement.vertices=[o],this._shapeVisualElement.updateTransform(),this._updateFrameLines(t,i),this._updateFrameArcs(t,i,r),this._updateCentralHelperArcs(t,s)}_updateFrameLines(e,t){const i=e.elevationAlignedObserverRenderSpace;this._frameLinesVisualElement.geometry=[[i,t.topLeft],[i,t.topRight],[i,t.bottomLeft],[i,t.bottomRight]]}_updateFrameArcs(e,t,i){const{elevationAlignedObserverRenderSpace:r,rightVector:o,horizontalFieldOfView:a,tiltedUpVector:l}=e,n=s(a),u=w(),p=c();h(p,n/2,l),m(u,o,p),P(this._leftArcVisualElement,r,t.bottomLeft,t.topLeft,"forward",u),h(p,-n/2,l),d(u,0,0,0),m(u,o,p),P(this._rightArcVisualElement,r,t.bottomRight,t.topRight,"forward",u);const v=a>180?"backward":"forward";P(this._topArcVisualElement,i.top,t.topRight,t.topLeft,v,l),P(this._bottomArcVisualElement,i.bottom,t.bottomRight,t.bottomLeft,v,l)}_updateCentralHelperArcs(e,t){const i=e.elevationAlignedObserverRenderSpace,s=e.horizontalFieldOfView>=180?"backward":"forward";P(this._centralLatitude,i,t.right,t.left,s,e.tiltedUpVector),P(this._centralLongitude,i,t.top,t.bottom,"forward",e.leftVector)}get test(){}};function P(e,t,i,s,r,o,a=D){const l=w();u(l,i,t);const n=p(l),d=w();u(d,s,t),v(d,d),_(d,d,n);let C=V(l,d);const A=g(o);"backward"===r&&(f(A,A),C=-(2*Math.PI-C));const L=[],y=Math.ceil(Math.abs(C)/a),S=c();h(S,C/y,A);const j=w();E(j,l);const R=w();E(R,i);for(let h=0;h<y;h++){const e=w();E(e,R),m(j,j,S),b(R,t,j);const i=w();E(i,R),L.push([e,i])}e.geometry=L}e([l()],F.prototype,"view",void 0),e([l({constructOnly:!0})],F.prototype,"isDecoration",void 0),e([l()],F.prototype,"analysisViewData",void 0),e([l()],F.prototype,"viewshedComputedData",void 0),e([l()],F.prototype,"visible",void 0),e([l()],F.prototype,"_color",null),e([l()],F.prototype,"_selected",null),e([l()],F.prototype,"_staged",null),F=e([n("esri.views.3d.analysis.Viewshed.ViewshedSubVisualization")],F);const U=F;export{U as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as n,sync as r,initial as t}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as o}from"../../../../core/screenUtils.js";import{absoluteHeightElevationInfo as i}from"../../../../support/elevationInfoUtils.js";import{ViewshedDrawToolRenderer as s}from"./ViewshedDrawToolRenderer.js";import{isValidIntersectorResult as a}from"../../webgl-engine/lib/IntersectorResult.js";import{toGraphic as l}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{DrawTool as c}from"../../../draw/DrawTool.js";import{newToolIntersector as p}from"../../../interactive/ToolIntersector.js";import{acquire as d}from"../../../interactive/snapping/SnappingManagerPool.js";function m(o){const{analysisViewData:a,view:l,sketchOptions:m,onCancel:u,onComplete:g,onManipulatorCountChange:b,isPlacingObserver:j}=o,f=new s({view:l,isPlacingObserver:j}),v=d(l),w=p(l.state.viewingMode),{snappingManager:I}=v,M=new c({elevationInfo:i,enableVertexVisuals:!1,hasZ:!0,renderer:f,sketchOptions:m,snappingManager:I,view:l});return f.addObserverManipulator(M),M.addHandles([v,e(f),M.on("cancel",()=>u(M)),M.on("complete",()=>g(M)),n(()=>M.manipulators.length,()=>b(M),r),n(()=>a.visible,e=>f.analysisVisible=e,t)]),{drawTool:M,intersector:w,renderer:f,snappingManager:I}}function u({intersector:e,snappingManager:n,screenPoint:r,view:t}){const o=n.getMainFeatureCandidate();return o?b(o):r?g(r,t,e):null}function g(e,n,r){n.sceneIntersectionHelper.intersectToolIntersectorScreen(o(e.x,e.y),r);const t=r.results.min;return a(t)?l(t,n):null}function b(e){const n={id:e.layer.id,objectIdField:"objectIdField"in e.layer?e.layer.objectIdField:void 0};return{attributes:{[n.objectIdField??"ObjectId"]:e.objectId},layer:n,objectId:e.objectId,uid:null}}export{m as createDrawTool,u as getFeatureReference};
2
+ import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as n,sync as r,initial as t}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as o}from"../../../../core/screenUtils.js";import{absoluteHeightElevationInfo as i}from"../../../../support/elevationInfoUtils.js";import{ViewshedDrawToolRenderer as s}from"./ViewshedDrawToolRenderer.js";import{isValidIntersectorResult as a}from"../../webgl-engine/lib/IntersectorResult.js";import{toGraphic as l}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{DrawTool as c}from"../../../draw/DrawTool.js";import{newToolIntersector as p}from"../../../interactive/ToolIntersector.js";import{acquire as d}from"../../../interactive/snapping/SnappingManagerPool.js";function m(o){const{analysisViewData:a,view:l,sketchOptions:m,onCancel:g,onComplete:u,onManipulatorCountChange:b,isPlacingObserver:j}=o,f=new s({view:l,isPlacingObserver:j}),v=d(l),w=p(l.state.viewingMode),{snappingManager:I}=v,M=new c({elevationInfo:i,enableVertexVisuals:!1,hasZ:!0,renderer:f,sketchOptions:m,snappingManager:I,view:l});return M.addHandles([v,e(f),M.on("cancel",()=>g(M)),M.on("complete",()=>u(M)),n(()=>M.manipulators.length,()=>b(M),r),n(()=>a.visible,e=>f.analysisVisible=e,t)]),{drawTool:M,intersector:w,renderer:f,snappingManager:I}}function g({intersector:e,snappingManager:n,screenPoint:r,view:t}){const o=n.getMainFeatureCandidate();return o?b(o):r?u(r,t,e):null}function u(e,n,r){n.sceneIntersectionHelper.intersectToolIntersectorScreen(o(e.x,e.y),r);const t=r.results.min;return a(t)?l(t,n):null}function b(e){const n={id:e.layer.id,objectIdField:"objectIdField"in e.layer?e.layer.objectIdField:void 0};return{attributes:{[n.objectIdField??"ObjectId"]:e.objectId},layer:n,objectId:e.objectId,uid:null}}export{m as createDrawTool,g as getFeatureReference};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{removeMaybe as i,destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,initial as a}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as n,convertUnit as l}from"../../../core/units.js";import{property as o,subclass as h}from"../../../core/accessorSupport/decorators.js";import{fromValues as d}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as u}from"../../../geometry/ellipsoidUtils.js";import c from"../../../geometry/HeightModelInfo.js";import{create as p}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as f}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as m,isWebMercator as g,equals as _,isGeographic as y}from"../../../geometry/support/spatialReferenceUtils.js";import w from"../../../geometry/support/WKIDUnitConversion.js";import{validateMeshData as v,makeCacheKey as b,getHeightModelInfoFromVCS as S}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as C}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as M}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as x}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as H}from"./LayerView3D.js";import{addLayerViewToWasm as I,getLyr3DWasm as T,removeLayerViewFromWasm as A}from"./Lyr3DWasm.js";import{LayerElevationProvider as P}from"./i3s/LayerElevationProvider.js";import{ElevationRange as F}from"../support/ElevationRange.js";import{projectToBoundingBox as R}from"../support/extentUtils.js";import{Obb as V}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as j,packedGaussianSizeInU32 as E,splatPageSizeInU32WithoutHeader as G,gaussiansPerSplatPage as O,elementsPerSplatPage as U,splatAtlasTextureWidth as D}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as L}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as B}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as z}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as k}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as N}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import{GaussianSplatShadowRenderNode as q}from"../webgl-engine/lib/GaussianSplatShadowRenderNode.js";import W from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as $,isInEffectiveScaleRange as X}from"../../support/layerViewUtils.js";import{TaskPriority as Z}from"../../support/Scheduler.js";var K;const Y=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D"),J=3,Q=J*J,ee=255,te=(()=>{const e=new Int16Array(ee+1);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/ee));return e})();let ie=class extends(H(W)){static{K=this}static{this.createRenderableBatchSize=64}constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(j),this._tmpTilesWithChangedVisibility=new Array,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._fadeDurationPerVisibilityChange=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(Z.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=p();return R(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw $("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=I(this).then(e=>{this._wasmLayerId=e,this._renderNode=new N({view:this.view,layerView:this}),this.data=new L(this._renderNode,(e,t)=>this._onSortComplete(e,t)),this._shadowRenderNode=new q({view:this.view,layerView:this}),this.fadeHelper=new B(this),this._intersectionHandler=new z(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new P({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([r(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),r(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),a)]),this._suspendedHandle=r(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),a),this.addHandles([r(()=>this._clippingBox,e=>this._renderNode.clippingBox=e,a)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([r(()=>this.view.qualitySettings.fadeDuration,e=>{const t=this.data;t&&(this.fadeHelper.onFadeDurationChanged(e),t.fadingTexture.updateTexture(t.textureAtlas.pageAllocator.pageCount))}),r(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),r(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return T(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return C(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new F(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return X(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!v(t))throw new Error("meshData not valid");const i=t.desc.prims[0],s=i.vertexCount;if(0===s)return Y().warnOnce("encountered tile with zero Gaussians"),()=>({memUsageBytes:0,numGaussians:0});const r=i.atrbs[0].view,a=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==r.type)throw new Error("unexpected meshData.data format");l=new Uint32Array(t.data.buffer,n,a/4);const o=this.extractHeader(l),h=2.048,c=o.tileOrigin.x*h,p=o.tileOrigin.y*h,f=o.tileOrigin.z*h,m=t.desc;if(null==m.obb)throw new Error("meshData.desc.obb undefined");const g=m.obb.quaternion,_=new V(m.obb.center,m.obb.halfSize,d(...g)),y=this.view.state.isGlobal,w=y?u(this.view.spatialReference).radius:0,b={handle:e.handle,bufferView:l,totalGaussians:s,packedHeader:o.packedHeader,tileOrigin:{x:c,y:p,z:f},invPosScale:o.invPosScale,obb:_,origin:{x:_.centerX,y:_.centerY,z:_.centerZ},isGlobal:y,ellipsoidRadius:w},S=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(b,e),this._createRenderableAbortController.signal);return()=>S}*_createRenderableTask(e,t){const{handle:i,bufferView:s,totalGaussians:r,packedHeader:a,tileOrigin:n,invPosScale:l,obb:o,origin:h,isGlobal:d,ellipsoidRadius:u}=e,c=n.x,p=n.y,f=n.z,m=h.x,g=h.y,_=h.z,y=new Uint32Array(r),w=new Float32Array(3*r),v=new Uint32Array(r),b=new Uint32Array(r),S=new Array,C=Math.ceil(r/O);for(let F=0;F<C;F++){let e=this.data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this.data.textureAtlas.requestPage()),null===e)throw new Error("ran out of gaussian splat memory");S.push(e);const i=r-F*O,n=Math.min(i,O),l=F*O,o=U*e;for(let t=0;t<n;t++)y[l+t]=o+t;const h=F*G;this._pageBuffer.set(s.subarray(h,h+n*E)),this._pageBuffer.set(a,G);const d=e*U,u=d%D,c=Math.floor(d/D);this.data.textureAtlas.update(u,c,this._pageBuffer),t.madeProgress()&&(t=yield)}let M=1/0,x=-1/0,H=1/0,I=-1/0,T=0,A=-1,P=0;for(let F=0;F<r;F++){const e=F*E,i=s[e],r=s[e+1],a=s[e+2],n=s[e+3],o=16383&r,h=r>>>14&16383,u=r>>>28&15|(1023&a)<<4,y=te[n>>>24],S=(a>>>10&255)+y,C=(a>>>18&255)+y,R=(a>>>26&63|(3&n)<<6)+y,V=S>0?S:0,j=C>0?C:0,G=R>0?R:0,O=V|j<<8|G<<16,U=Math.max(V,j,G),D=o*l+c,L=h*l+p,B=u*l+f;if(w[T]=D-m,w[T+1]=L-g,w[T+2]=B-_,d){const e=D*D+L*L+B*B;H=Math.min(H,e),I=Math.max(I,e)}else M=Math.min(M,B),x=Math.max(x,B);v[F]=i,b[F]=O,U>A&&(A=U),T+=3,P++,P===K.createRenderableBatchSize&&(P=0,t.madeProgress()&&(t=yield))}P>0&&t.madeProgress(),d&&(M=Math.sqrt(H)-u,x=Math.sqrt(I)-u);const R=this._extractGaussianSplatMbsRadiusSquared(A),{fullExtent:V}=this.layer;V?.hasZ&&V.zmax&&V.zmin&&(M=Math.max(M,V.zmin),x=Math.min(x,V.zmax));const j=new F(M,x),L=new k(i,o,y,S,w,v,b,r,R,j);return this._memCache.put(`${L.handle}`,L),this._tileHandles.set(i,L),this._cacheTileMemory+=L.usedMemory,{memUsageBytes:L.usedMemory,numGaussians:r}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*Q}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);const t=this.data?.textureAtlas;let i=!1;const s=this._tileHandles.get(e);if(s){0!==s.lifecycleState?(i=!0,this.fadeHelper.onTileDiscarded(s),this._usedTileMemory-=s.usedMemory,this._intersectionHandler.removeTile(s)):this._cacheTileMemory-=s.usedMemory,t&&s.pageIds.forEach(e=>t.freePage(e)),this.freeObject(s),this._tileHandles.delete(e)}i&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(t=>{for(const i of e)t(i.obb)})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1,r=this.fadeHelper.updateFadeDuration();this._fadeDurationPerVisibilityChange.set(s,r);let a=!1;for(let n=0;n<i;n++){const i=this._tileHandles.get(e[n]);if(!i)continue;const l=t[n]?this._prepareTileFadeIn(i,s,r):this._prepareTileFadeOut(i,s);a||=l}a?(this._currentLyr3dVisibilityChange=s,this.updateGaussians()):this._fadeDurationPerVisibilityChange.delete(s)}_prepareTileFadeIn(e,t,i){const s=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0,i),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):s}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let a=0;a<e.length;a++){const t=e[a];s.add(t.handle)}this._triggerFadeIns(t,s,i);const r=this._triggerFadeOuts(t,i);s.clear(),i.length>0&&this.notifyTileObbsChanged(i),r&&this.updateGaussians(),this._cleanupVisibilityChangeFadeDurations(t)}_triggerFadeIns(e,t,i){for(const[s,r]of this._tileFadeInsAwaitingInitialSort){if(r>e||!t.has(s))continue;const a=this._tileHandles.get(s);if(!a){this._tileFadeInsAwaitingInitialSort.delete(s);continue}const n=this._getFadeDurationForPendingVisibilityChange(r),l=0===a.lifecycleState;2!==a.lifecycleState&&(a.lifecycleState=2,l&&this._popTileFromCache(a),i.push(a)),this.fadeHelper.fadeTile(a,0,n),this._tileFadeInsAwaitingInitialSort.delete(s)}}_triggerFadeOuts(e,t){let i=!1;for(const[s,r]of this._tileFadeOutsAwaitingInitialSort){if(r>e)continue;const a=this._tileHandles.get(s);if(a){const e=2===a.lifecycleState,s=this._getFadeDurationForPendingVisibilityChange(r);this.fadeHelper.fadeTile(a,1,s),e&&0===a.lifecycleState&&(t.push(a),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_getFadeDurationForPendingVisibilityChange(e){return this._fadeDurationPerVisibilityChange.get(e)??this.fadeHelper.baseFadeDuration}_cleanupVisibilityChangeFadeDurations(e){if(0!==this._fadeDurationPerVisibilityChange.size)for(const t of this._fadeDurationPerVisibilityChange.keys())t<=e&&this._fadeDurationPerVisibilityChange.delete(t)}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(b(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(b(e.handle),e)}destroy(){this._createRenderableAbortController.abort(),A(this),this._suspendedHandle&&(this._suspendedHandle=i(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>{for(const t of this._tileHandles.values())e(t.obb)}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadowRenderNode=s(this._shadowRenderNode),this._renderNode=s(this._renderNode),this._memCache.destroy(),this.data=s(this.data)}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(m(this.view.renderSpatialReference)||g(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&_(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=S(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!y(t)&&t.wkid&&-1!==t.wkid&&(i=n(w.units[w[t.wkid]])),i&&(e=new c({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===f(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=l(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=M(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,C(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderNode&&(this._renderNode.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){this._wasm?.setMaximumGaussianSplatCount(e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0===e.lifecycleState&&this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++});const i=this.data?.textureAtlasMemory??0,s=this.data?.orderTextureMemory??0,r=this.data?.fadingTextureMemory??0,a=this.data?.sortBufferMemory??0;return new x(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,i,s,r,a)}get test(){}};e([o()],ie.prototype,"layer",void 0),e([o({readOnly:!0})],ie.prototype,"_clippingBox",null),e([o()],ie.prototype,"elevationOffset",null),e([o({readOnly:!0})],ie.prototype,"visibleAtCurrentScale",null),e([o()],ie.prototype,"fullExtentInLocalViewSpatialReference",void 0),ie=K=e([h("esri.views.3d.layers.GaussianSplatLayerView3D")],ie);const se=ie;export{se as default};
2
+ import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{removeMaybe as i,destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,initial as a}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as n,convertUnit as l}from"../../../core/units.js";import{property as o,subclass as h}from"../../../core/accessorSupport/decorators.js";import{fromValues as d}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as u}from"../../../geometry/ellipsoidUtils.js";import c from"../../../geometry/HeightModelInfo.js";import{create as p}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as f}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as m,isWebMercator as g,equals as _,isGeographic as y}from"../../../geometry/support/spatialReferenceUtils.js";import w from"../../../geometry/support/WKIDUnitConversion.js";import{validateMeshData as v,makeCacheKey as b,getHeightModelInfoFromVCS as S}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as C}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as M}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as x}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as I}from"./LayerView3D.js";import{addLayerViewToWasm as T,getLyr3DWasm as H,removeLayerViewFromWasm as A}from"./Lyr3DWasm.js";import{LayerElevationProvider as P}from"./i3s/LayerElevationProvider.js";import{ElevationRange as F}from"../support/ElevationRange.js";import{projectToBoundingBox as R}from"../support/extentUtils.js";import{Obb as V}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as j,packedGaussianSizeInU32 as E,splatPageSizeInU32WithoutHeader as G,gaussiansPerSplatPage as O,elementsPerSplatPage as U,splatAtlasTextureWidth as D}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as L}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as B}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as z}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as k}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as N}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import{GaussianSplatShadowRenderNode as q}from"../webgl-engine/lib/GaussianSplatShadowRenderNode.js";import W from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as $,isInEffectiveScaleRange as X}from"../../support/layerViewUtils.js";import{TaskPriority as Z}from"../../support/Scheduler.js";var K;const Y=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D"),J=3,Q=J*J,ee=255,te=(()=>{const e=new Int16Array(ee+1);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/ee));return e})();let ie=class extends(I(W)){static{K=this}static{this.createRenderableBatchSize=64}constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(j),this._tmpTilesWithChangedVisibility=new Array,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._fadeDurationPerVisibilityChange=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(Z.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=p();return R(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw $("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=T(this).then(e=>{this._wasmLayerId=e,this._renderNode=new N({view:this.view,layerView:this}),this.data=new L(this._renderNode,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._shadowRenderNode=new q({view:this.view,layerView:this}),this.fadeHelper=new B(this),this._intersectionHandler=new z(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new P({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([r(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),r(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),a)]),this._suspendedHandle=r(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),a),this.addHandles([r(()=>this._clippingBox,e=>this._renderNode.clippingBox=e,a)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([r(()=>this.view.qualitySettings.fadeDuration,e=>{const t=this.data;t&&(this.fadeHelper.onFadeDurationChanged(e),t.fadingTexture.updateTexture(t.textureAtlas.pageAllocator.pageCount))}),r(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),r(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return H(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return C(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new F(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return X(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!v(t))throw new Error("meshData not valid");const i=t.desc.prims[0],s=i.vertexCount;if(0===s)return Y().warnOnce("encountered tile with zero Gaussians"),()=>({memUsageBytes:0,numGaussians:0});const r=i.atrbs[0].view,a=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==r.type)throw new Error("unexpected meshData.data format");l=new Uint32Array(t.data.buffer,n,a/4);const o=this.extractHeader(l),h=2.048,c=o.tileOrigin.x*h,p=o.tileOrigin.y*h,f=o.tileOrigin.z*h,m=t.desc;if(null==m.obb)throw new Error("meshData.desc.obb undefined");const g=m.obb.quaternion,_=new V(m.obb.center,m.obb.halfSize,d(...g)),y=this.view.state.isGlobal,w=y?u(this.view.spatialReference).radius:0,b={handle:e.handle,bufferView:l,totalGaussians:s,packedHeader:o.packedHeader,tileOrigin:{x:c,y:p,z:f},invPosScale:o.invPosScale,obb:_,origin:{x:_.centerX,y:_.centerY,z:_.centerZ},isGlobal:y,ellipsoidRadius:w},S=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(b,e),this._createRenderableAbortController.signal);return()=>S}*_createRenderableTask(e,t){const{handle:i,bufferView:s,totalGaussians:r,packedHeader:a,tileOrigin:n,invPosScale:l,obb:o,origin:h,isGlobal:d,ellipsoidRadius:u}=e,c=n.x,p=n.y,f=n.z,m=h.x,g=h.y,_=h.z,y=new Uint32Array(r),w=new Float32Array(3*r),v=new Uint32Array(r),b=new Uint32Array(r),S=new Array,C=Math.ceil(r/O);for(let F=0;F<C;F++){let e=this.data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this.data.textureAtlas.requestPage()),null===e)throw new Error("ran out of gaussian splat memory");S.push(e);const i=r-F*O,n=Math.min(i,O),l=F*O,o=U*e;for(let t=0;t<n;t++)y[l+t]=o+t;const h=F*G;this._pageBuffer.set(s.subarray(h,h+n*E)),this._pageBuffer.set(a,G);const d=e*U,u=d%D,c=Math.floor(d/D);this.data.textureAtlas.update(u,c,this._pageBuffer),t.madeProgress()&&(t=yield)}let M=1/0,x=-1/0,I=1/0,T=-1/0,H=0,A=-1,P=0;for(let F=0;F<r;F++){const e=F*E,i=s[e],r=s[e+1],a=s[e+2],n=s[e+3],o=16383&r,h=r>>>14&16383,u=r>>>28&15|(1023&a)<<4,y=te[n>>>24],S=(a>>>10&255)+y,C=(a>>>18&255)+y,R=(a>>>26&63|(3&n)<<6)+y,V=S>0?S:0,j=C>0?C:0,G=R>0?R:0,O=V|j<<8|G<<16,U=Math.max(V,j,G),D=o*l+c,L=h*l+p,B=u*l+f;if(w[H]=D-m,w[H+1]=L-g,w[H+2]=B-_,d){const e=D*D+L*L+B*B;I=Math.min(I,e),T=Math.max(T,e)}else M=Math.min(M,B),x=Math.max(x,B);v[F]=i,b[F]=O,U>A&&(A=U),H+=3,P++,P===K.createRenderableBatchSize&&(P=0,t.madeProgress()&&(t=yield))}P>0&&t.madeProgress(),d&&(M=Math.sqrt(I)-u,x=Math.sqrt(T)-u);const R=this._extractGaussianSplatMbsRadiusSquared(A),{fullExtent:V}=this.layer;V?.hasZ&&V.zmax&&V.zmin&&(M=Math.max(M,V.zmin),x=Math.min(x,V.zmax));const j=new F(M,x),L=new k(i,o,y,S,w,v,b,r,R,j);return this._memCache.put(`${L.handle}`,L),this._tileHandles.set(i,L),this._cacheTileMemory+=L.usedMemory,{memUsageBytes:L.usedMemory,numGaussians:r}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*Q}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);const t=this.data?.textureAtlas;let i=!1;const s=this._tileHandles.get(e);if(s){0!==s.lifecycleState?(i=!0,this.fadeHelper.onTileDiscarded(s),this._usedTileMemory-=s.usedMemory,this._intersectionHandler.removeTile(s)):this._cacheTileMemory-=s.usedMemory,t&&s.pageIds.forEach(e=>t.freePage(e)),this.freeObject(s),this._tileHandles.delete(e)}i&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(t=>{for(const i of e)t(i.obb)})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1,r=this.fadeHelper.updateFadeDuration();this._fadeDurationPerVisibilityChange.set(s,r);let a=!1;for(let n=0;n<i;n++){const i=this._tileHandles.get(e[n]);if(!i)continue;const l=t[n]?this._prepareTileFadeIn(i,s,r):this._prepareTileFadeOut(i,s);a||=l}a?(this._currentLyr3dVisibilityChange=s,this.updateGaussians()):this._fadeDurationPerVisibilityChange.delete(s)}_prepareTileFadeIn(e,t,i){const s=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0,i),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):s}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let a=0;a<e.length;a++){const t=e[a];s.add(t.handle)}this._triggerFadeIns(t,s,i);const r=this._triggerFadeOuts(t,i);s.clear(),i.length>0&&this.notifyTileObbsChanged(i),r&&this.updateGaussians(),this._cleanupVisibilityChangeFadeDurations(t)}_triggerFadeIns(e,t,i){for(const[s,r]of this._tileFadeInsAwaitingInitialSort){if(r>e||!t.has(s))continue;const a=this._tileHandles.get(s);if(!a){this._tileFadeInsAwaitingInitialSort.delete(s);continue}const n=this._getFadeDurationForPendingVisibilityChange(r),l=0===a.lifecycleState;2!==a.lifecycleState&&(a.lifecycleState=2,l&&this._popTileFromCache(a),i.push(a)),this.fadeHelper.fadeTile(a,0,n),this._tileFadeInsAwaitingInitialSort.delete(s)}}_triggerFadeOuts(e,t){let i=!1;for(const[s,r]of this._tileFadeOutsAwaitingInitialSort){if(r>e)continue;const a=this._tileHandles.get(s);if(a){const e=2===a.lifecycleState,s=this._getFadeDurationForPendingVisibilityChange(r);this.fadeHelper.fadeTile(a,1,s),e&&0===a.lifecycleState&&(t.push(a),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_getFadeDurationForPendingVisibilityChange(e){return this._fadeDurationPerVisibilityChange.get(e)??this.fadeHelper.baseFadeDuration}_cleanupVisibilityChangeFadeDurations(e){if(0!==this._fadeDurationPerVisibilityChange.size)for(const t of this._fadeDurationPerVisibilityChange.keys())t<=e&&this._fadeDurationPerVisibilityChange.delete(t)}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(b(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(b(e.handle),e)}destroy(){this._createRenderableAbortController.abort(),A(this),this._suspendedHandle&&(this._suspendedHandle=i(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>{for(const t of this._tileHandles.values())e(t.obb)}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadowRenderNode=s(this._shadowRenderNode),this._renderNode=s(this._renderNode),this._memCache.destroy(),this.data=s(this.data)}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(m(this.view.renderSpatialReference)||g(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&_(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=S(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!y(t)&&t.wkid&&-1!==t.wkid&&(i=n(w.units[w[t.wkid]])),i&&(e=new c({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===f(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=l(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=M(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,C(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderNode&&(this._renderNode.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){this._wasm?.setMaximumGaussianSplatCount(e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0===e.lifecycleState&&this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++});const i=this.data?.textureAtlasMemory??0,s=this.data?.orderTextureMemory??0,r=this.data?.fadingTextureMemory??0,a=this.data?.sortBufferMemory??0;return new x(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,i,s,r,a)}get test(){}};e([o()],ie.prototype,"layer",void 0),e([o({readOnly:!0})],ie.prototype,"_clippingBox",null),e([o()],ie.prototype,"elevationOffset",null),e([o({readOnly:!0})],ie.prototype,"visibleAtCurrentScale",null),e([o()],ie.prototype,"fullExtentInLocalViewSpatialReference",void 0),ie=K=e([h("esri.views.3d.layers.GaussianSplatLayerView3D")],ie);const se=ie;export{se as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{emptySymbolComplexity as t}from"./defaultSymbolComplexity.js";import{Loadable as r}from"./Loadable.js";import{getSymbolMemorySize as s}from"./symbolMemory.js";class e extends r{constructor(t,r,s){super(r),this.symbol=t,this._convert=s,this.symbologySnappingSupported=!1,this.graphics3DSymbol=null,this.referenced=0}getSymbolLayerSize(t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.getSymbolLayerSize(t):null}get symbolLayers(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.symbolLayers:[]}get extentPadding(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.extentPadding:0}async doLoad(t){const r=await this.symbol.fetchSymbol({signal:t});r.id=this.symbol.id,this.graphics3DSymbol=this._convert(r),null!=this.graphics3DSymbol&&await this.graphics3DSymbol.load()}createGraphics3DGraphic(t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.createGraphics3DGraphic(t,this):null}get complexity(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.complexity:t}globalPropertyChanged(t,r){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.globalPropertyChanged(t,r)}applyRendererDiff(t,r){return null!=this.graphics3DSymbol?this.graphics3DSymbol.applyRendererDiff(t,r):0}prepareSymbolPatch(t){null!=this.graphics3DSymbol&&this.graphics3DSymbol.prepareSymbolPatch(t)}updateGeometry(t){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.updateGeometry(t)}updateTransform(t,r,s,e){return this.graphics3DSymbol?.updateTransform(t,r,s,e)??!1}onRemoveGraphic(){}get needsUpdateFocus(){return!1}getFastUpdateStatus(){return this.graphics3DSymbol?.getFastUpdateStatus()??3}destroy(){null!=this.graphics3DSymbol&&this.graphics3DSymbol.destroy(),this.graphics3DSymbol=void 0,super.destroy()}get destroyed(){return void 0===this.graphics3DSymbol}get usedMemory(){return s(this)}}export{e as Graphics3DWebStyleSymbol};
2
+ import{throwIfAborted as r}from"../../../../core/promiseUtils.js";import{emptySymbolComplexity as t}from"./defaultSymbolComplexity.js";import{Loadable as s}from"./Loadable.js";import{getSymbolMemorySize as e}from"./symbolMemory.js";class i extends s{constructor(r,t,s){super(t),this.symbol=r,this._convert=s,this.symbologySnappingSupported=!1,this.graphics3DSymbol=null,this.referenced=0}getSymbolLayerSize(r){return null!=this.graphics3DSymbol?this.graphics3DSymbol.getSymbolLayerSize(r):null}get symbolLayers(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.symbolLayers:[]}get extentPadding(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.extentPadding:0}async doLoad(t){const s=await this.symbol.fetchSymbol({signal:t});r(t),s.id=this.symbol.id,this.graphics3DSymbol=this._convert(s),null!=this.graphics3DSymbol&&(await this.graphics3DSymbol.load(),r(t))}createGraphics3DGraphic(r){return null!=this.graphics3DSymbol?this.graphics3DSymbol.createGraphics3DGraphic(r,this):null}get complexity(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.complexity:t}globalPropertyChanged(r,t){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.globalPropertyChanged(r,t)}applyRendererDiff(r,t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.applyRendererDiff(r,t):0}prepareSymbolPatch(r){null!=this.graphics3DSymbol&&this.graphics3DSymbol.prepareSymbolPatch(r)}updateGeometry(r){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.updateGeometry(r)}updateTransform(r,t,s,e){return this.graphics3DSymbol?.updateTransform(r,t,s,e)??!1}onRemoveGraphic(){}get needsUpdateFocus(){return!1}getFastUpdateStatus(){return this.graphics3DSymbol?.getFastUpdateStatus()??3}destroy(){null!=this.graphics3DSymbol&&this.graphics3DSymbol.destroy(),this.graphics3DSymbol=void 0,super.destroy()}get destroyed(){return void 0===this.graphics3DSymbol}get usedMemory(){return e(this)}}export{i as Graphics3DWebStyleSymbol};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as o,now as a}from"../../../../core/time.js";import{exactEquals as n,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as c,copy as p}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as f}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as m}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as g}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as T}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as b}from"./GaussianSplatTextureAtlas.js";import{DepthRange as S}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as y}from"../../../support/Scheduler.js";class C{constructor(e,t){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new S,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._bufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=o(-1/0),this._sortInterval=o(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new T(this._renderer.renderingContext),this._fadingTexture=new g(this._renderer.renderingContext),this._textureAtlas=new b(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:s}=this._renderer.view;this._workerHandle=new m(f(s)),this._frameTask=s.scheduler.registerTask(y.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get usedMemory(){return this.textureAtlasMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],o=s[1],a=s[2],h=i[0],u=i[1],d=i[2],f=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&n(this._previousVisibleTileDepthRangeEye,s)&&n(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return f.near<=f.far?f:null;let m=1/0,g=-1/0;const T=this._latestSortedGaussianTiles;for(let n=0;n<T.length;n++){const e=T[n];if(null!=t){const s=e.boundingBox;if(!c(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-o)+d*(e.obbCenterZ-a),i=e.paddedMbsRadius,l=s-i;l<m&&(m=l);const _=s+i;_>g&&(g=_)}const b=m<=g;return b?f.set(m,g):f.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&p(this._previousVisibleTileDepthRangeClippingBox,t),b?f:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){return this._updating.value=!0,!this._pendingSortTask&&(this._pendingSortTask=!0,this._scheduleSortStart(),!0)}_scheduleSortStart(){if(this._isSorting)return;const e=a()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=a(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._sortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._bufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacities(e){if(this._bufferCapacity<e){const t=this._computeExpandedCapacity(this._bufferCapacity,e);this._atlasIndicesBuffer=new Uint32Array(t),this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._distancesBuffer=new Float64Array(t),this._bufferCapacity=t,this._sortBufferMemory=s(this._atlasIndicesBuffer,this._sortedAtlasIndicesBuffer,this._distancesBuffer)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacities(r),this._textureAtlas.ensureTextureAtlas();const o=this._renderer.camera;h(this._cameraDirectionNormalized,o.ray.direction);const a=this._cameraDirectionNormalized[0],n=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._atlasIndicesBuffer,_=this._distancesBuffer,p=this._renderer.clippingBox,f=this._nextCommittedVisibleGaussianTiles;f.length=0;let m=0;const{frustum:g}=o,T=this._renderer.tileCullingRevision,b=g[0],S=g[1],y=g[2],C=g[3],x=g[4],V=g[5];for(let e=0;e<s;e++){const s=t[e],{gaussianAtlasIndices:i,relativePositions:r,obbCenterX:o,obbCenterY:h,obbCenterZ:g,paddedMbsRadius:v}=s,A=s.gaussianCount;if(s.cullingRevision!==T){let e=null==p||c(s.boundingBox,p);if(e){const t=1.5*v;e=b[0]*o+b[1]*h+b[2]*g+b[3]<t&&S[0]*o+S[1]*h+S[2]*g+S[3]<t&&y[0]*o+y[1]*h+y[2]*g+y[3]<t&&C[0]*o+C[1]*h+C[2]*g+C[3]<t&&x[0]*o+x[1]*h+x[2]*g+x[3]<t&&V[0]*o+V[1]*h+V[2]*g+V[3]<t}s.cullingRevision=T,s.cullingVisible=e}if(!s.cullingVisible)continue;d.set(i,u),f[m++]=s;const B=a*o+n*h+l*g,G=u+A;for(let e=u,t=0;e<G;e++,t+=3){const s=r[t],i=r[t+1],o=r[t+2];_[e]=s*a+i*n+o*l+B}u=G}if(f.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const v={distances:this._distancesBuffer,atlasIndices:this._atlasIndicesBuffer,sortedAtlasIndices:this._sortedAtlasIndicesBuffer,numGaussians:u,preciseSort:this._useDeterministicSort},A=await(this._workerHandle?.sort(v,e));if(e.aborted)return;A&&(this._distancesBuffer=A.distances,this._atlasIndicesBuffer=A.atlasIndices,this._sortedAtlasIndicesBuffer=A.sortedAtlasIndices);const B=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=f,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(B,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{C as GaussianSplatDataStore};
2
+ import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as o,now as a}from"../../../../core/time.js";import{exactEquals as n,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as c,copy as p}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as f}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as m}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as g}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as T}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as b}from"./GaussianSplatTextureAtlas.js";import{DepthRange as S}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as y}from"../../../support/Scheduler.js";class C{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new S,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._bufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=o(-1/0),this._sortInterval=o(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new T(this._renderer.renderingContext),this._fadingTexture=new g(this._renderer.renderingContext),this._textureAtlas=new b(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new m(f(i)),this._frameTask=i.scheduler.registerTask(y.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get usedMemory(){return this.textureAtlasMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],o=s[1],a=s[2],h=i[0],u=i[1],d=i[2],f=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&n(this._previousVisibleTileDepthRangeEye,s)&&n(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return f.near<=f.far?f:null;let m=1/0,g=-1/0;const T=this._latestSortedGaussianTiles;for(let n=0;n<T.length;n++){const e=T[n];if(null!=t){const s=e.boundingBox;if(!c(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-o)+d*(e.obbCenterZ-a),i=e.paddedMbsRadius,l=s-i;l<m&&(m=l);const _=s+i;_>g&&(g=_)}const b=m<=g;return b?f.set(m,g):f.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&p(this._previousVisibleTileDepthRangeClippingBox,t),b?f:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){return this._updating.value=!0,!this._pendingSortTask&&(this._pendingSortTask=!0,this._scheduleSortStart(),!0)}_scheduleSortStart(){if(this._isSorting)return;const e=a()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=a(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._sortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._bufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacities(e){if(this._bufferCapacity<e){const t=this._computeExpandedCapacity(this._bufferCapacity,e);this._atlasIndicesBuffer=new Uint32Array(t),this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._distancesBuffer=new Float64Array(t),this._bufferCapacity=t,this._sortBufferMemory=s(this._atlasIndicesBuffer,this._sortedAtlasIndicesBuffer,this._distancesBuffer)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacities(r),this._textureAtlas.ensureTextureAtlas();const o=this._renderer.camera;h(this._cameraDirectionNormalized,o.ray.direction);const a=this._cameraDirectionNormalized[0],n=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._atlasIndicesBuffer,_=this._distancesBuffer,p=this._renderer.clippingBox,f=this._nextCommittedVisibleGaussianTiles;f.length=0;let m=0;const{frustum:g}=o,T=this._renderer.tileCullingRevision,b=g[0],S=g[1],y=g[2],C=g[3],x=g[4],V=g[5];for(let e=0;e<s;e++){const s=t[e],{gaussianAtlasIndices:i,relativePositions:r,obbCenterX:o,obbCenterY:h,obbCenterZ:g,paddedMbsRadius:v}=s,A=s.gaussianCount;if(s.cullingRevision!==T){let e=null==p||c(s.boundingBox,p);if(e){const t=1.5*v;e=b[0]*o+b[1]*h+b[2]*g+b[3]<t&&S[0]*o+S[1]*h+S[2]*g+S[3]<t&&y[0]*o+y[1]*h+y[2]*g+y[3]<t&&C[0]*o+C[1]*h+C[2]*g+C[3]<t&&x[0]*o+x[1]*h+x[2]*g+x[3]<t&&V[0]*o+V[1]*h+V[2]*g+V[3]<t}s.cullingRevision=T,s.cullingVisible=e}if(!s.cullingVisible)continue;d.set(i,u),f[m++]=s;const B=a*o+n*h+l*g,G=u+A;for(let e=u,t=0;e<G;e++,t+=3){const s=r[t],i=r[t+1],o=r[t+2];_[e]=s*a+i*n+o*l+B}u=G}if(f.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const v={distances:this._distancesBuffer,atlasIndices:this._atlasIndicesBuffer,sortedAtlasIndices:this._sortedAtlasIndicesBuffer,numGaussians:u,preciseSort:this._useDeterministicSort},A=await(this._workerHandle?.sort(v,e));if(e.aborted)return;A&&(this._distancesBuffer=A.distances,this._atlasIndicesBuffer=A.atlasIndices,this._sortedAtlasIndicesBuffer=A.sortedAtlasIndices);const B=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=f,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(B,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{C as GaussianSplatDataStore};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{initialSplatAtlasTextureHeight as e,GaussianSplatAtlasPages as s,splatAtlasTextureWidth as r,elementsPerSplatPage as a}from"./GaussianSplatAtlasPages.js";import{PixelType as i,SizedPixelFormat as l}from"../../../webgl/enums.js";import{DisposableFramebufferObject as o}from"../../../webgl/FramebufferObject.js";import u from"../../../webgl/Texture.js";import{TextureDescriptor as h}from"../../../webgl/TextureDescriptor.js";class c{constructor(t,r,a){this._splatAtlasTextureHeight=e,this.texture=null,this._rctx=t,this._fboCache=a,this.pageAllocator=new s,this._cache=r.newCache("gaussian texture cache",t=>t.dispose())}get usedMemory(){return this.texture?.usedMemory??0}ensureTextureAtlas(){if(this.texture?.hasWebGLTextureObject)return;this.texture=null;const t=this._cache.pop("splatTextureAtlas");if(t)return void(this.texture=t);const e=new h;e.height=this._splatAtlasTextureHeight,e.width=r,e.pixelFormat=36249,e.dataType=i.UNSIGNED_INT,e.internalFormat=l.RGBA32UI,e.samplingMode=9728,e.wrapMode=33071,e.isImmutable=!0,this.texture=new u(this._rctx,e),this._updatePageAllocator()}grow(){if(!this.texture)return this.ensureTextureAtlas(),!1;const e=Math.floor(this._splatAtlasTextureHeight*t);if(e*r>this._rctx.parameters.maxPreferredTexturePixels)return!1;const s=new o(this._rctx,this.texture),a=this._fboCache.acquire(r,e,"gaussian splat atlas resize",12);return this._rctx.blitFramebuffer(s,a.fbo,16384,9728,0,0,r,this._splatAtlasTextureHeight,0,0,r,this._splatAtlasTextureHeight),this.texture=a.fbo?.detachColorTexture(),s.dispose(),a.dispose(),this._splatAtlasTextureHeight=e,this._updatePageAllocator(),!0}requestPage(){let t=this.pageAllocator.findFirstFreePage();return null===t&&this.grow()&&(t=this.pageAllocator.findFirstFreePage()),null!==t&&this.pageAllocator.allocate(t),t}freePage(t){this.pageAllocator.free(t)}update(t,e,s){this.ensureTextureAtlas(),this.texture.updateData(0,t,e,a,1,s)}_updatePageAllocator(){const t=r*this._splatAtlasTextureHeight/a;this.pageAllocator.pageCount!==t&&this.pageAllocator.resize(t)}clear(){this.texture&&(this._cache.put("splatTextureAtlas",this.texture),this.texture=null)}destroy(){this._cache.destroy(),this.texture?.dispose(),this.texture=null}}export{c as GaussianSplatTextureAtlas};
2
+ import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{initialSplatAtlasTextureHeight as e,GaussianSplatAtlasPages as s,splatAtlasTextureWidth as r,elementsPerSplatPage as a}from"./GaussianSplatAtlasPages.js";import{PixelType as i,SizedPixelFormat as l}from"../../../webgl/enums.js";import{DisposableFramebufferObject as h}from"../../../webgl/FramebufferObject.js";import o from"../../../webgl/Texture.js";import{TextureDescriptor as u}from"../../../webgl/TextureDescriptor.js";class c{constructor(t,r,a,i){this._splatAtlasTextureHeight=e,this.texture=null,this._rctx=t,this._fboCache=a,this._onCachedTextureEvicted=i,this.pageAllocator=new s,this._cache=r.newCache("gaussian texture cache",t=>{t.dispose(),this._onCachedTextureEvicted()})}get usedMemory(){return this.texture?.usedMemory??0}ensureTextureAtlas(){if(this.texture?.hasWebGLTextureObject)return;this.texture=null;const t=this._cache.pop("splatTextureAtlas");if(t)return void(this.texture=t);const e=new u;e.height=this._splatAtlasTextureHeight,e.width=r,e.pixelFormat=36249,e.dataType=i.UNSIGNED_INT,e.internalFormat=l.RGBA32UI,e.samplingMode=9728,e.wrapMode=33071,e.isImmutable=!0,this.texture=new o(this._rctx,e),this._updatePageAllocator()}grow(){if(!this.texture)return this.ensureTextureAtlas(),!1;const e=Math.floor(this._splatAtlasTextureHeight*t);if(e*r>this._rctx.parameters.maxPreferredTexturePixels)return!1;const s=new h(this._rctx,this.texture),a=this._fboCache.acquire(r,e,"gaussian splat atlas resize",12);return this._rctx.blitFramebuffer(s,a.fbo,16384,9728,0,0,r,this._splatAtlasTextureHeight,0,0,r,this._splatAtlasTextureHeight),this.texture=a.fbo?.detachColorTexture(),s.dispose(),a.dispose(),this._splatAtlasTextureHeight=e,this._updatePageAllocator(),!0}requestPage(){let t=this.pageAllocator.findFirstFreePage();return null===t&&this.grow()&&(t=this.pageAllocator.findFirstFreePage()),null!==t&&this.pageAllocator.allocate(t),t}freePage(t){this.pageAllocator.free(t)}update(t,e,s){this.ensureTextureAtlas(),this.texture.updateData(0,t,e,a,1,s)}_updatePageAllocator(){const t=r*this._splatAtlasTextureHeight/a;this.pageAllocator.pageCount!==t&&this.pageAllocator.resize(t)}clear(){this.texture&&(this._cache.put("splatTextureAtlas",this.texture),this.texture=null)}destroy(){this._onCachedTextureEvicted=()=>{},this._cache.destroy(),this.texture?.dispose(),this.texture=null}}export{c as GaussianSplatTextureAtlas};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{releaseMaybe as e}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as l}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{G as u}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as p}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as _}from"./GlowBlurTechniqueConfiguration.js";import{G as g,a as d,m as b}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as f}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as P}from"./GlowCompositionTechniqueConfiguration.js";import{floatBlendReductionFactor as w}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as C,DepthStencilAttachment as T}from"../../../../webgl/enums.js";let v=class extends m{constructor(t){super(t),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._scatteringFactors={realistic:new g([.8,.12,.05,.02,.01,0],1),cartographicMin:new g([.4,.18,.25,.12,.05,0],1),cartographicDefault:new g([1.17,1.08,.78,.4,.26,.11],4),cartographicMax:new g([3.59,3.9,2.46,1.4,.93,.44],13)},this._blurHorizontalConfiguration=new _,this._blurVerticalConfiguration=new _,this._compositeConfiguration=new P,this._compositionParameters=new d,this._blurParameters=new u,this._blurScalePerLod=3.06,this._logicalBlurRadius=.0037;const e=l(t.view.spatialReference);this._atmosphereRadius=e.radius+e.atmosphereHeight,this._blurVerticalConfiguration.glowStage=1}initialize(){this.addHandles([i(()=>this._updateParameters(),()=>{},r)])}_updateParameters(){this._compositionParameters.minDisperse.preset=this._preset,this.requestRender(1)}_updateConfigurations(){this._compositeConfiguration.useFloatBlend=this._blurHorizontalConfiguration.useFloatBlend=this._blurVerticalConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositeConfiguration.blurEnabled=2!==this._mode}precompile(){this._updateConfigurations(),this._compositeConfiguration.blurEnabled&&(this.techniques.precompile(p,this._blurHorizontalConfiguration),this.techniques.precompile(p,this._blurVerticalConfiguration)),this.techniques.precompile(f,this._compositeConfiguration)}render(t){const i=t.find(({name:t})=>t===c.TRANSPARENT_ENVIRONMENT),r=i.getAttachment(C);if(!r?.attachment)return i;const s=i.getTexture(),o=i.getAttachment(T),a=this.fboCache,{fullWidth:h,fullHeight:l}=this.bindParameters.camera,m=this.renderingContext;if(this._updateConfigurations(),this._compositionParameters.fogOpacity=this.view.stage.renderView.fog?.strength??0,this._compositionParameters.color=s,this._compositionParameters.emission=r.attachment,!this._compositeConfiguration.blurEnabled){const t=a.acquire(s.descriptor.width,s.descriptor.height,this.produces);this._setupFBO(t,h,l);const e=this.techniques.get(f,this._compositeConfiguration);return m.bindTechnique(e,this.bindParameters,this._compositionParameters),m.screen.draw(),t.attachDepth(o),t.attachColor(r,C),t}const u=this.camera,p=n(u.eye);this._compositionParameters.atmosphereC=p**2-this._atmosphereRadius**2,this._renderGlowMipMap();const _=a.acquire(s.descriptor.width,s.descriptor.height,this.produces);_.acquireColor(C,this.bindParameters.useFloatBlend.value?8:5,"emissive glow"),this._setupFBO(_,h,l,!0);const g=this.techniques.get(f,this._compositeConfiguration);return m.bindTechnique(g,this.bindParameters,this._compositionParameters),m.screen.draw(),this._compositionParameters.lodTexture=e(this._compositionParameters.lodTexture),_.attachDepth(o),_}_renderGlowMipMap(){const t=this.fboCache,{fullWidth:e,fullHeight:i}=this.camera,r=this.renderingContext,s=5,o=this.techniques.get(p,this._blurHorizontalConfiguration),n=this.techniques.get(p,this._blurVerticalConfiguration);this._blurParameters.input=this._compositionParameters.emission,this._blurParameters.inputScale=w,this._blurParameters.level=0,this._blurParameters.blurRadius=this._logicalBlurRadius,a(this._blurParameters.size,.5*e,.5*i);let h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]);const c=t.acquire(h,l,"glow horizontal",8);for(this._compositionParameters.lodTexture=t.acquire(h,l,"glow mipmap",9);h>1&&l>1&&this._blurParameters.level<s;)this._setupFBO(c,h,l),r.bindTechnique(o,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(`glow horizontal ${this._blurParameters.level}`,c.fbo),this._blurParameters.inputScale=1,this._blurParameters.input=c.getTexture(),this._setupFBO(this._compositionParameters.lodTexture,h,l,!1,this._blurParameters.level),r.bindTechnique(n,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(this._compositionParameters.lodTexture.name,this._compositionParameters.lodTexture.fbo),a(this._blurParameters.size,.5*h,.5*l),h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]),this._blurParameters.input=this._compositionParameters.lodTexture.getTexture(),this._blurParameters.blurRadius*=this._blurScalePerLod,++this._blurParameters.level;c.release(),this._compositionParameters.lodTexture.fbo.level=0}get _preset(){return 0===this._mode?this._scatteringFactors.realistic.preset:this._intensity<=.5?b(this._scatteringFactors.cartographicMin.preset,this._scatteringFactors.cartographicDefault.preset,2*this._intensity):b(this._scatteringFactors.cartographicDefault.preset,this._scatteringFactors.cartographicMax.preset,2*(this._intensity-.5))}get _mode(){return null==this.view.environment.lighting.glow?this.view.environment.atmosphereEnabled?0:2:1}get _intensity(){return this.view.environment.lighting.glow?.intensity??0}_setupFBO(t,e,i,r=!1,s=0){t.fbo.level=s;const o=this.renderingContext;o.bindFramebuffer(t.fbo),o.setViewport(0,0,e,i),o.setClearColor(0,0,0,0),o.clear(16384),r&&o.clearBuffer(1,h)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,preset:this._preset,setMinDisperse:(t,e)=>{0===this._mode?this._scatteringFactors.realistic.preset[t]=e:(this._scatteringFactors.cartographicMin.preset[t]=e,this._scatteringFactors.cartographicMax.preset[t]=e)}}}};t([s()],v.prototype,"consumes",void 0),t([s()],v.prototype,"produces",void 0),v=t([o("esri.views.3d.webgl-engine.effects.glow.Glow")],v);export{v as Glow};
2
+ import{__decorate as t}from"tslib";import{releaseMaybe as e}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as l}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{G as u}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as p}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as _}from"./GlowBlurTechniqueConfiguration.js";import{G as g,a as d,m as b}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as f}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as P}from"./GlowCompositionTechniqueConfiguration.js";import{floatBlendReductionFactor as w}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as C,DepthStencilAttachment as T}from"../../../../webgl/enums.js";let v=class extends m{constructor(t){super(t),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._scatteringFactors={realistic:new g([.8,.12,.05,.02,.01,0],1),cartographicMin:new g([.4,.18,.25,.12,.05,0],1),cartographicDefault:new g([1.17,1.08,.78,.4,.26,.11],4),cartographicMax:new g([3.59,3.9,2.46,1.4,.93,.44],13)},this._blurHorizontalConfiguration=new _,this._blurVerticalConfiguration=new _,this._compositeConfiguration=new P,this._compositionParameters=new d,this._blurParameters=new u,this._blurScalePerLod=3.06,this._logicalBlurRadius=.0037;const e=l(t.view.spatialReference);this._atmosphereRadius=e.radius+e.atmosphereHeight,this._blurVerticalConfiguration.glowStage=1}initialize(){this.addHandles([i(()=>this._updateParameters(),()=>{},r)])}_updateParameters(){this._compositionParameters.minDisperse.preset=this._preset,this.requestRender(1)}_updateConfigurations(){this._compositeConfiguration.useFloatBlend=this._blurHorizontalConfiguration.useFloatBlend=this._blurVerticalConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositeConfiguration.blurEnabled=2!==this._mode}precompile(){this._updateConfigurations(),this._compositeConfiguration.blurEnabled&&(this.techniques.precompile(p,this._blurHorizontalConfiguration),this.techniques.precompile(p,this._blurVerticalConfiguration)),this.techniques.precompile(f,this._compositeConfiguration)}render(t){const i=t.find(({name:t})=>t===c.TRANSPARENT_ENVIRONMENT),r=i.getAttachment(C);if(!r?.attachment)return i;const s=i.getTexture(),o=i.getAttachment(T),a=this.fboCache,{fullWidth:h,fullHeight:l}=this.bindParameters.camera,m=this.renderingContext;this._updateConfigurations();const u=this.camera,p=n(u.eye);if(this._compositionParameters.fogOpacity=this.view.stage.renderView.fog?.strength??0,this._compositionParameters.color=s,this._compositionParameters.emission=r.attachment,this._compositionParameters.atmosphereC=p**2-this._atmosphereRadius**2,!this._compositeConfiguration.blurEnabled){const t=a.acquire(s.descriptor.width,s.descriptor.height,this.produces);this._setupFBO(t,h,l);const e=this.techniques.get(f,this._compositeConfiguration);return m.bindTechnique(e,this.bindParameters,this._compositionParameters),m.screen.draw(),t.attachDepth(o),t.attachColor(r,C),t}this._renderGlowMipMap();const _=a.acquire(s.descriptor.width,s.descriptor.height,this.produces);_.acquireColor(C,this.bindParameters.useFloatBlend.value?8:5,"emissive glow"),this._setupFBO(_,h,l,!0);const g=this.techniques.get(f,this._compositeConfiguration);return m.bindTechnique(g,this.bindParameters,this._compositionParameters),m.screen.draw(),this._compositionParameters.lodTexture=e(this._compositionParameters.lodTexture),_.attachDepth(o),_}_renderGlowMipMap(){const t=this.fboCache,{fullWidth:e,fullHeight:i}=this.camera,r=this.renderingContext,s=5,o=this.techniques.get(p,this._blurHorizontalConfiguration),n=this.techniques.get(p,this._blurVerticalConfiguration);this._blurParameters.input=this._compositionParameters.emission,this._blurParameters.inputScale=w,this._blurParameters.level=0,this._blurParameters.blurRadius=this._logicalBlurRadius,a(this._blurParameters.size,.5*e,.5*i);let h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]);const c=t.acquire(h,l,"glow horizontal",8);for(this._compositionParameters.lodTexture=t.acquire(h,l,"glow mipmap",9);h>1&&l>1&&this._blurParameters.level<s;)this._setupFBO(c,h,l),r.bindTechnique(o,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(`glow horizontal ${this._blurParameters.level}`,c.fbo),this._blurParameters.inputScale=1,this._blurParameters.input=c.getTexture(),this._setupFBO(this._compositionParameters.lodTexture,h,l,!1,this._blurParameters.level),r.bindTechnique(n,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(this._compositionParameters.lodTexture.name,this._compositionParameters.lodTexture.fbo),a(this._blurParameters.size,.5*h,.5*l),h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]),this._blurParameters.input=this._compositionParameters.lodTexture.getTexture(),this._blurParameters.blurRadius*=this._blurScalePerLod,++this._blurParameters.level;c.release(),this._compositionParameters.lodTexture.fbo.level=0}get _preset(){return 0===this._mode?this._scatteringFactors.realistic.preset:this._intensity<=.5?b(this._scatteringFactors.cartographicMin.preset,this._scatteringFactors.cartographicDefault.preset,2*this._intensity):b(this._scatteringFactors.cartographicDefault.preset,this._scatteringFactors.cartographicMax.preset,2*(this._intensity-.5))}get _mode(){return null==this.view.environment.lighting.glow?this.view.environment.atmosphereEnabled?0:2:1}get _intensity(){return this.view.environment.lighting.glow?.intensity??0}_setupFBO(t,e,i,r=!1,s=0){t.fbo.level=s;const o=this.renderingContext;o.bindFramebuffer(t.fbo),o.setViewport(0,0,e,i),o.setClearColor(0,0,0,0),o.clear(16384),r&&o.clearBuffer(1,h)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,preset:this._preset,setMinDisperse:(t,e)=>{0===this._mode?this._scatteringFactors.realistic.preset[t]=e:(this._scatteringFactors.cartographicMin.preset[t]=e,this._scatteringFactors.cartographicMax.preset[t]=e)}}}};t([s()],v.prototype,"consumes",void 0),t([s()],v.prototype,"produces",void 0),v=t([o("esri.views.3d.webgl-engine.effects.glow.Glow")],v);export{v as Glow};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./oitBlendFragment.glsl.js";import"../../shaders/alphaCutoff.glsl.js";import"../../shaders/oitResolution.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{O as OITBlendEmissionPassParameters,b as build}from"../../../../../chunks/OITBlendEmission.glsl.js";
2
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/util/ColorConversion.glsl.js";import"../../core/shaderLibrary/util/EmissionDimming.glsl.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./oitBlendFragment.glsl.js";import"../../shaders/oitResolution.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{O as OITBlendEmissionPassParameters,b as build}from"../../../../../chunks/OITBlendEmission.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{If as e}from"../../core/shaderModules/glsl.js";import{Texture2DPassUniform as r}from"../../core/shaderModules/Texture2DPassUniform.js";import{alphaCutoff as o}from"../../shaders/alphaCutoff.glsl.js";import{oitResolution as t}from"../../shaders/oitResolution.glsl.js";import{NoParameters as a}from"../../../../webgl/NoParameters.js";class n extends a{}function l(a,n){const{frontFaceMask:l,useFloatBlend:c}=n;a.include(t,n),a.include(o),a.uniforms.add(new r("colorTexture",e=>e.colorTexture),new r("alphaTexture",e=>e.alphaTexture),new r("frontFaceTexture",e=>e.frontFaceTexture)).code.add(`\n vec4 oitBlendFragment() {\n float srcAlpha = texture(alphaTexture, uv).r * floatBlendInputScale;\n if(srcAlpha < alphaCutoff) {\n return vec4(0.0);\n }\n vec4 frontFace = texture(frontFaceTexture, uv);\n ${e(l,"if (frontFace.a == 0.0) return vec4(0.0);")}\n\n vec4 srcColor = texture(colorTexture, uv);\n ${e(!c,"float frontWeight = srcAlpha * floatBlendOutputScale;\n frontWeight = clamp((frontWeight - 0.9) * 10.0, 0.0, 1.0);\n\n float toAlpha = (1.0 + frontFace.a) * 0.5;\n frontFace.a = mix(frontFace.a, toAlpha, frontWeight);")}\n vec3 backColor = srcColor.rgb * floatBlendInputScale / srcAlpha;\n return vec4(mix(backColor, frontFace.rgb, frontFace.a), 1.0 - srcColor.a);\n }\n `)}export{n as OITBlendFragmentPassParameters,l as oitBlendFragment};
2
+ import{If as e}from"../../core/shaderModules/glsl.js";import{Texture2DPassUniform as r}from"../../core/shaderModules/Texture2DPassUniform.js";import{alphaCutoff as t}from"../../shaders/alphaCutoff.glsl.js";import{oitResolution as o}from"../../shaders/oitResolution.glsl.js";import{NoParameters as n}from"../../../../webgl/NoParameters.js";class a extends n{}function l(n,a){const{frontFaceMask:l,useFloatBlend:c}=a;n.include(o,a),n.include(t),n.uniforms.add(new r("colorTexture",e=>e.colorTexture),new r("alphaTexture",e=>e.alphaTexture),new r("frontFaceTexture",e=>e.frontFaceTexture)).code.add(`\n vec4 oitBlendFragment(sampler2D colorTex, sampler2D frontFaceTex, float frontFaceScale) {\n float srcAlpha = texture(alphaTexture, uv).r * floatBlendInputScale;\n if(srcAlpha < alphaCutoff) {\n return vec4(0.0);\n }\n vec4 frontFace = texture(frontFaceTex, uv);\n ${e(l,"if (frontFace.a == 0.0) return vec4(0.0);")}\n\n vec4 srcColor = texture(colorTex, uv);\n srcColor.rgb *= floatBlendInputScale / srcAlpha;\n\n ${e(!c,"float frontWeight = srcAlpha * floatBlendOutputScale;\n frontWeight = clamp((frontWeight - 0.9) * 10.0, 0.0, 1.0);\n\n float toAlpha = (1.0 + frontFace.a) * 0.5;\n frontFace.a = mix(frontFace.a, toAlpha, frontWeight);")}\n return vec4(mix(srcColor.rgb, frontFace.rgb * frontFaceScale, frontFace.a), 1.0 - srcColor.a);\n }\n\n vec4 oitBlendFragment() {\n return oitBlendFragment(colorTexture, frontFaceTexture, 1.0);\n }\n `)}export{a as OITBlendFragmentPassParameters,l as oitBlendFragment};