@arcgis/core 4.34.0-next.60 → 4.34.0-next.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/applications/Components/actionUtils.d.ts +3 -0
- package/applications/Components/actionUtils.js +5 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0264905da9fa56166538.js +1 -0
- package/assets/esri/core/workers/chunks/{007721d1d99233046420.js → 188feb2bcbf8e48e3163.js} +1 -1
- package/assets/esri/core/workers/chunks/{0ff8b28a34b1825c227d.js → 220c8d6338f236298720.js} +1 -1
- package/assets/esri/core/workers/chunks/226833d408eb1225e168.js +1 -0
- package/assets/esri/core/workers/chunks/33718ea851645d9078d1.js +1 -0
- package/assets/esri/core/workers/chunks/{54b43876ae6fb078eb38.js → 77e27f318b5863dd0f5c.js} +1 -1
- package/assets/esri/core/workers/chunks/{2d74af2b383187bd59c3.js → 8005ae652361f506bc5f.js} +1 -1
- package/assets/esri/core/workers/chunks/{0468266dfe15ec41d60a.js → a35a439f053d1fe0541b.js} +1 -1
- package/assets/esri/core/workers/chunks/{4e21a1116be0d6340163.js → bdc18ef9cdc8242f014e.js} +1 -1
- package/assets/esri/core/workers/chunks/d6f5297f7b323c340727.js +1 -0
- package/assets/esri/core/workers/chunks/f4167fc895d4009df1c7.js +1 -0
- package/assets/esri/core/workers/chunks/f542bdc994a5ea3aa9d1.js +1 -0
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ar.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bg.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ca.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_cs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_da.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_de.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_el.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_es.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_et.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_he.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hu.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_id.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_it.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ja.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ko.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lt.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_no.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-BR.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-PT.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ro.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ru.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_th.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_tr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_uk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_vi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-CN.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-HK.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-TW.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_ar.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_bg.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_bs.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_ca.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_cs.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_da.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_de.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_el.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_es.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_et.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_fi.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_fr.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_he.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_hr.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_hu.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_id.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_it.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_ja.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_ko.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_lt.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_lv.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_nl.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_no.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_pl.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_pt-BR.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_pt-PT.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_ro.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_ru.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_sk.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_sl.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_sr.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_sv.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_th.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_tr.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_uk.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_vi.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_zh-CN.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_zh-HK.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_zh-TW.json +1 -1
- package/chunks/BloomComposition.glsl.js +6 -5
- package/chunks/Fog.glsl.js +20 -13
- package/config.js +1 -1
- package/core/Collection.js +1 -1
- package/core/has.js +1 -1
- package/interfaces.d.ts +189 -55
- package/kernel.js +1 -1
- package/layers/OGCFeatureLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/VoxelLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/package.json +2 -2
- package/support/revision.js +1 -1
- package/symbols/IconSymbol3DLayer.js +1 -1
- package/symbols/TextSymbol3DLayer.js +1 -1
- package/symbols/support/IconSymbol3DLayerResource.js +1 -1
- package/symbols/support/OccludedVisibility.js +5 -0
- package/symbols/support/Symbol3DAnchorPosition2D.js +1 -1
- package/symbols/support/Symbol3DIconOutline.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/layers/support/UpdateTracking2D.js +1 -1
- package/views/2d/navigation/actions/Pan.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization.js +1 -1
- package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/environment/Fog.glsl.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/FogTechniqueConfiguration.js +5 -0
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/controllers/CameraController.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomCompositionTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
- package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/GroundView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileInputLineComputation.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +5 -0
- package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
- package/views/input/IViewEvents.js +5 -0
- package/views/interactive/Tooltip.js +1 -1
- package/views/support/LayerViewManager.js +1 -1
- package/webscene/SunLighting.js +1 -1
- package/webscene/VirtualLighting.js +1 -1
- package/widgets/CoordinateConversion/support/Format.js +1 -1
- package/widgets/Popup/actionUtils.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/assets/esri/core/workers/chunks/18f878ec695617650a96.js +0 -1
- package/assets/esri/core/workers/chunks/232c76f122b1f519e099.js +0 -1
- package/assets/esri/core/workers/chunks/5e1afea05b624b315d9f.js +0 -1
- package/assets/esri/core/workers/chunks/63f3e46bfa820436161c.js +0 -1
- package/assets/esri/core/workers/chunks/981275b6f008431c983a.js +0 -1
- package/assets/esri/core/workers/chunks/e36d538915261ee0373f.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as
|
|
5
|
+
import{isSome as e}from"../../../../core/arrayUtils.js";import{forEach as t}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{onAbortOrThrow as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{totalSymbolComplexities as o}from"./defaultSymbolComplexity.js";import{Graphics3DGraphic as a}from"./Graphics3DGraphic.js";import{Graphics3DObject3DGraphicLayer as i}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayerCreationContext as n}from"./Graphics3DSymbolCreationContext.js";import{Loadable as l}from"./Loadable.js";import{getSymbolMemorySize as y}from"./symbolMemory.js";class h extends l{set symbol(e){this._symbol=e,e.symbolLayers.forEach((t,s)=>{const r=this.symbolLayers[s];null!=r&&(r.symbol=e,r.symbolLayer=t)})}get symbol(){return this._symbol}constructor(e,t,s){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=s,this._destroyed=!1,this.symbolLayers=new Array,this.referenced=0,this._extentPadding=0}async doLoad(e){let o=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(o=this._backgroundLayers.concat(o));const a=o.length;for(;this.symbolLayers.length<o.length;)this.symbolLayers.push(null);this.symbolLayers.length=o.length;const i=[];if(!m){const{make:e}=await import("./Graphics3DSymbolLayerFactory.js");m=e}for(let t=0;t<a;t++){const r=o.at(t);if(!1===r.enabled)continue;c.renderPriority=1-(1+t)/a,c.renderPriorityStep=1/a,c.ignoreDrivers=r.ignoreDrivers;const n=m(this.symbol,r,this._context,c),l=s(e,()=>{this.symbolLayers[t]=null,n.destroy()});l&&i.push(l),this.symbolLayers[t]=n}if(await t(this.symbolLayers,async(e,t)=>{if(null!=e)try{await e.load(),this._extentPadding+=Math.max(this._extentPadding,e.extentPadding)}catch{this.symbolLayers[t]=null}}),i.forEach(e=>e.remove()),r(e),this.symbolLayers.length&&!this.symbolLayers.some(e=>!!e))throw new Error}getSymbolLayerSize(e){const t=this.symbolLayers[e];return null!=t?t.getCachedSize():null}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some(e=>e?.queryForSnapping)}get needsUpdateFocus(){return this.symbolLayers.some(e=>!0===e?.needsUpdateFocus)}createGraphics3DGraphic(e,t){const{graphic:s}=e,r=this.symbolLayers.map(t=>t?.createGraphics3DGraphic(e)??null),o=this._context.arcade||this._context.featureExpressionInfoContext?.arcade?.modules||null;return new a(s,t||this,r,e.layer,o)}get complexity(){return o(this.symbolLayers.map(e=>e?.complexity))}globalPropertyChanged(e,t){const s=this.symbolLayers.length;for(let r=0;r<s;r++){const s=this.symbolLayers[r],o=e=>{const t=e.layers[r];return t instanceof i?t:null};if(null!=s&&!s.globalPropertyChanged(e,t,o))return!1}return!0}applyRendererDiff(e,t){return 1!==this.loadStatus?0:this.symbolLayers.reduce((s,r)=>0!==s&&null!=r?Math.min(s,r.applyRendererDiff(e,t)):s,2)}prepareSymbolPatch(e){if(2===this.loadStatus)return;if("partial"!==e.diff.type)return;const t=e.diff.diff;if(!t.symbolLayers||"partial"!==t.symbolLayers.type)return;const s=t.symbolLayers.diff;this.symbolLayers.forEach((t,r)=>{if(null==t)return;const o=s[r];if(o){const s={diff:o,graphics3DGraphicPatches:[],symbolLayerStatePatches:[]};t.prepareSymbolLayerPatch(s),e.symbolStatePatches.push(...s.symbolLayerStatePatches),s.graphics3DGraphicPatches.length&&e.graphics3DGraphicPatches.push((e,t)=>{const o=e.layers[r];null!=o&&s.graphics3DGraphicPatches.forEach(e=>e(o,t))})}})}updateGeometry(e,t){return this._updateGeometryOrTransform(e,(e,s)=>e.updateGeometry(s,t))}updateTransform(e,t,s,r){return this._updateGeometryOrTransform(e,(e,o)=>e.updateTransform(o,t,s,r))}_updateGeometryOrTransform(e,t){for(let s=0;s<this.symbolLayers.length;s++){const r=this.symbolLayers[s];if(null==r)continue;const o=e.layers[s];if(!o||!t(r,o))return!1}return!0}onRemoveGraphic(e){for(let t=0;t<this.symbolLayers.length;t++){const s=this.symbolLayers[t];if(null==s)continue;const r=e.layers[t];null!=r&&s.onRemoveGraphic(r)}}getFastUpdateStatus(){let e=!1,t=!1;for(const s of this.symbolLayers)if(null!=s){if(0===s.loadStatus)return 3;s.isFastUpdatesEnabled()?t=!0:e=!0}return t?e?2:1:e?0:4}async queryForSnapping(t,s,o,a){const i=this.symbolLayers.filter(e).filter(e=>null!=e.queryForSnapping).map(e=>e.queryForSnapping(t,s,o,a)),n=await Promise.all(i);return r(a),n.flat()}destroy(){if(!this.destroyed){super.destroy();for(const e of this.symbolLayers)null!=e&&e.destroy();this.symbolLayers.length=0,this._destroyed=!0}}get destroyed(){return this._destroyed}get cachedMemory(){return y(this)}}let m=null;const c=new n;export{h as Graphics3DSymbol};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{ONES as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as i,c as o}from"../../../../chunks/vec42.js";import{fromValues as s,ONES as n,ZEROS as a,fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as p}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as c}from"./defaultSymbolComplexity.js";import{ElevationContext as d}from"./ElevationContext.js";import{zeroContext as u}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as h}from"./graphicUtils.js";import{Loadable as y}from"./Loadable.js";import{getAttributeValue as f}from"../support/FastSymbolUpdates.js";import{encodeNaNUInt8 as m}from"../support/symbolColorUtils.js";const g=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class v extends y{constructor(e,t,r,i,o=!0){super(r.schedule),this.symbol=e,this.symbolLayer=t,this._context=r,this._drivenOpacityFallbackAlwaysOpaque=o,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1,rotation:!1},this._materials=[],this.logger=g(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new d,this.updateComplexity(),this.ignoreDrivers=i.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=_(this._context.renderer,o)),this._updateElevationContext()}destroy(){this.complexity=null,this._materials.length=0,super.destroy()}get view(){return this._context.stage.view}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}get estimatedMemory(){const{complexity:e}=this;if(null==e)return 0;return(this.draped?e.memory.draped:e.memory).bytesPerFeature}get usedMemory(){return this.estimatedMemory}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,r=_(e,this._drivenOpacityFallbackAlwaysOpaque);return r.color!==t.color||r.opacity!==t.opacity||r.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||r.size!==t.size||r.rotation!==t.rotation}get needsDrivenTransparentPass(){return this._hasDrivenColorOrOpacity&&!this._drivenProperties.opacityAlwaysOpaque}get _hasDrivenColorOrOpacity(){return this._drivenProperties.color||this._drivenProperties.opacity}_logGeometryCreationWarnings(e,t,r,i){const o=e.projectionSuccess,s="polygons"in e?e.polygons:null,n=`${i} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,r,i)&&s&&0===s.length&&"rings"===r&&t.length>0&&t[0].length>2&&g().warnOncePerTick(`${n} (filled rings should use clockwise winding - try reversing the order of vertices)`):g().warnOncePerTick(`${n} (failed to project geometry to view spatial reference)`)}
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{ONES as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as i,c as o}from"../../../../chunks/vec42.js";import{fromValues as s,ONES as n,ZEROS as a,fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as p}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as c}from"./defaultSymbolComplexity.js";import{ElevationContext as d}from"./ElevationContext.js";import{zeroContext as u}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as h}from"./graphicUtils.js";import{Loadable as y}from"./Loadable.js";import{getAttributeValue as f}from"../support/FastSymbolUpdates.js";import{encodeNaNUInt8 as m}from"../support/symbolColorUtils.js";const g=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class v extends y{constructor(e,t,r,i,o=!0){super(r.schedule),this.symbol=e,this.symbolLayer=t,this._context=r,this._drivenOpacityFallbackAlwaysOpaque=o,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1,rotation:!1},this._materials=[],this.logger=g(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new d,this.updateComplexity(),this.ignoreDrivers=i.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=_(this._context.renderer,o)),this._updateElevationContext()}destroy(){this.complexity=null,this._materials.length=0,super.destroy()}get view(){return this._context.stage.view}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}get estimatedMemory(){const{complexity:e}=this;if(null==e)return 0;return(this.draped?e.memory.draped:e.memory).bytesPerFeature}get usedMemory(){return this.estimatedMemory}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,r=_(e,this._drivenOpacityFallbackAlwaysOpaque);return r.color!==t.color||r.opacity!==t.opacity||r.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||r.size!==t.size||r.rotation!==t.rotation}get needsDrivenTransparentPass(){return this._hasDrivenColorOrOpacity&&!this._drivenProperties.opacityAlwaysOpaque}get _hasDrivenColorOrOpacity(){return this._drivenProperties.color||this._drivenProperties.opacity}_logGeometryCreationWarnings(e,t,r,i){const o=e.projectionSuccess,s="polygons"in e?e.polygons:null,n=`${i} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,r,i)&&s&&0===s.length&&"rings"===r&&t.length>0&&t[0].length>2&&g().warnOncePerTick(`${n} (filled rings should use clockwise winding - try reversing the order of vertices)`):g().warnOncePerTick(`${n} (failed to project geometry to view spatial reference)`)}get needsUpdateFocus(){return!1}_logGeometryValidationWarnings(e,t,r){const i=`${r} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(g().warnOncePerTick(`${i} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(g().warnOncePerTick(`${i} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,r=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+r+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return g().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":p(e)}return!0}_defaultElevationInfoNoZ(){return x}_defaultElevationInfoZ(){return C}_updateElevationContext(){null!=this._elevationInfoOverride?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t=new d){const r=e.geometry,i=this.getDefaultElevationInfo(r);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:i.unit,t.mode=this.getGeometryElevationMode(r,i),t.offsetMeters=this._elevationContext.meterUnitOffset??i.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;o&&(t.mode="relative-to-ground",t.offsetMeters=0);const s=o?u:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(s,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}updateTransform(e,t,r,i){return!1}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=b){const r=this.draped?1:this._getLayerOpacity();return this._drivenProperties.color?r:e?r*(this._drivenProperties.opacity?1:e.a):t.hasIntrinsicColor?r:0}_getCombinedOpacityAndColor(t,i=b){const o=this._getCombinedOpacity(t,i);if(this._drivenProperties.color)return h(null,o);const s=null!=t?e.toUnitRGB(t):r;return h(s,o)}_getDrivenUInt8Color({color:t,opacity:r},i,o){const{color:s,opacity:l}=this._drivenProperties,p=e.toUnitRGBA(i)??(o?n:a),c=s?t??p:null,d=t||i||o,u=s?null:p[3];return h(c,l&&d?r??u:null,255)}_getDrivenUInt8ColorWithNaNSupport({color:t,opacity:r},n,a){const p=n?l(e.toUnitRGBA(n)):s(NaN,NaN,NaN,a?NaN:0);return this._drivenProperties.color&&null!=t&&i(p,t),this._drivenProperties.opacity&&null!=r&&(p[3]=r),o(p,p,255),m(p,p)}isFastUpdatesEnabled(){return null!=this._fastUpdates}updateComplexity(){this.complexity=this.computeComplexity()}computeComplexity(){return c(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,r){switch(e){case"opacity":return this.layerOpacityChanged(t,r),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return 2!==this.layerElevationInfoChanged(t,r,e)}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,r);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged;case"skipHighSymbolLods":return this.skipHighSymbolLodsChanged;default:return!1}}get pixelRatioChanged(){return!0}updateGraphics3DGraphicElevationInfo(e,t,r){let i=1;return e?.forEach(e=>{const o=t(e);if(null!=o){const t=e.graphic;this.setGraphicElevationContext(t,o.elevationContext),o.needsElevationUpdates=r(o.elevationContext.mode)}else i=2}),i}applyRendererDiff(e,t){return 0}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,r=t.size?f(t.size.field,e):0,i=t.color?f(t.color.field,e):0,o=t.opacity?f(t.opacity.field,e):0;return s(r,i,o,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&g().warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}test(){const e=()=>({size:this._fastUpdates?.visualVariables.size?.field??null,color:this._fastUpdates?.visualVariables.color?.field??null,opacity:this._fastUpdates?.visualVariables.opacity?.field??null,rotation:this._fastUpdates?.visualVariables.rotation?.field??null});return{drivenProperties:this._drivenProperties,getVisVarFields:e}}}function _(e,t){const r={color:!1,opacity:!1,opacityAlwaysOpaque:t,size:!1,rotation:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach(e=>{switch(e.type){case"color":if(r.color=!0,e.stops)for(let t=0;t<e.stops.length;t++){const i=e.stops[t].color;i&&i.a<1&&(r.opacityAlwaysOpaque=!1)}break;case"opacity":r.opacity=!0,r.opacityAlwaysOpaque=!1;break;case"size":r.size=!0;break;case"rotation":r.rotation=!0}}),r}const x={mode:"on-the-ground",offset:0,unit:"meters"},C={mode:"absolute-height",offset:0,unit:"meters"},b={hasIntrinsicColor:!1},O=s(NaN,NaN,NaN,NaN);export{v as Graphics3DSymbolLayer,_ as getDrivenProperties,O as nanFallbackColor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as s}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{fromValues as
|
|
5
|
+
import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as s}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{fromValues as n,ZEROS as o,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{freeze as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasCalloutSupport as c,textSymbolLayerSupportsVerticalOffset as m}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as f}from"./ElevationAligners.js";import{needsElevationUpdates2D as h}from"./elevationAlignmentUtils.js";import{ElevationContext as u}from"./ElevationContext.js";import{focusAreaHUDColor as p}from"./focusAreaStyle.js";import{Graphics3DObject3DGraphicLayer as d}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as g}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as y}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as v}from"./graphicUtils.js";import{LabelPlacement as x,LabelParameters as b}from"./LabelParameters.js";import{verticalScreenOffsetFromAlignment as O,verticalPlacementFromAlignment as w,textRenderAlignmentFromHorizontalPlacement as P,horizontalPlacementToAnchorX as j,anchorFromPlacements as _,namedAnchorToHUDMaterialAnchorPos as E}from"./placementUtils.js";import{placePointOnGeometry as S,updateStageObjectGeometry as L,getLocalOriginForPoint as C,extendPointGraphicElevationContext as G,createStageObject as z}from"./pointUtils.js";import{getFontMetrics as A}from"../../webgl-engine/lib/FontMetrics.js";import{createPointGeometry as U}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as F}from"../../webgl-engine/lib/TextRenderParameters.js";import D from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as R}from"../../webgl-engine/materials/HUDMaterial.js";const T=a(0,0,1);class H extends y{constructor(e,t,s,r){super(e,t,s,r),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=v(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;this._textRenderParameters=await F.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const t=e.graphic,s=S(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;const r=this.view.focusAreasView?.containsGeometry(s)??!0,n=this.symbolLayer.text;if(null==n||""===n)return null;const o=c(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(null!=o&&!m(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const{verticalAlignment:i}=this.symbolLayer,a=new x(o);O(i,a.screenOffset);const l=new b(a,this.symbolLayer.horizontalAlignment,w(i));return l.isFocused=r??l.isFocused,this._createAs3DShape(t,s,n,l)}get needsUpdateFocus(){return!0}createLabel(e,t,s,r,n){const o=e.graphic,i=S(o.geometry);if(null==i)return this.logger.warn(`unsupported geometry type for label: ${o.geometry.type}`),null;const a=this.view.focusAreasView?.containsGeometry(i)??!0,l=t.text;return!l||/^\s+$/.test(l)?null:(t.isFocused=a??t.isFocused,this._createAs3DShape(o,i,l,t,s,r,n))}setGraphicElevationContext(e,t=new u,s=0){return super.setGraphicElevationContext(e,t),t.addOffsetRenderUnits(s),t}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,t){return V(e,t,(e,t)=>{this.updateGraphicElevationContext(t,e)}),1}slicePlaneEnabledChanged(e,t){return V(e,t,e=>{for(const t of e.stageObject.geometries)t.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return!1}updateGraphicElevationContext(e,t){const{elevationContext:s,metadata:r}=t;this.setGraphicElevationContext(e,s,r?.elevationOffset??0),t.needsElevationUpdates=h(s.mode)||"absolute-height"===s.mode}updateGeometry(e,t){if(this.draped||!this._validateGeometry(t))return!1;const{elevationContext:s,stageObject:r}=e;if(s.mode!==this.getGeometryElevationMode(t))return!1;const n=S(t);if(!n)return!1;const o=L(r,this._context,n,s);if(null==o)return!1;const i=C(this._context,n);return r.geometries[0].localOrigin===i&&(e.alignedSampledElevation=o,G(e,n,this._context.elevationProvider),!0)}_defaultElevationInfoNoZ(){return I}_createAs3DShape(e,a,c,m,y,v=null,x=()=>m.placement.elevationOffset){const b=this.setGraphicElevationContext(e,new u,m.placement.elevationOffset),O=e.uid;let w=null,j=null;if(null==v){const e=P(m.horizontalPlacement);w=new D(c,e,this._textRenderParameters);let r=null;if(null!=this._context.sharedResources.textures){j=this._context.sharedResources.textures.fromData(w.key,()=>w.create()),j.texture.events.on("unloaded",()=>r=t(r));const e=this._context.stage.renderView.textures.acquire(j.texture.id);if(null==e||s(e))return j.release(),null;r=e}}const _=!has("disable-feature:non-occluded-hud"),E=W(w,m),S={occlusionTest:!_,occludedFragmentFade:_,horizonCullingEnabled:_&&this._context.spherical,screenOffset:m.placement.screenOffset,anchorPosition:E,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:m.placement.centerOffsetUnits,depthEnabled:!1,drawAsLabel:!0,isLabel:!0,isFocused:m.isFocused};if("polyline"===e.geometry?.type&&(S.shaderPolygonOffset=1e-4),v?S.textureId=v.id:j&&(S.textureId=j.texture.id),null!=m.placement.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=m.placement.verticalOffset;S.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0}}const L=this._context.graphicsCoreOwner.view.focusAreasView?.polygons.length,C={screenOffset:S.screenOffset,anchorPosition:E,centerOffsetUnits:S.centerOffsetUnits,verticalOffset:S.verticalOffset,shaderPolygonOffset:S.shaderPolygonOffset,occlusionTest:S.occlusionTest,isFocused:m.isFocused,focusStyle:this.view.map?.focusAreas.style??"none"};if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:e,screenSizePerspectiveSettingsLabels:t}=this._context.sharedResources,s=A(this._textRenderParameters);S.screenSizePerspective=t.overrideFontHeight(s.maxHeight),S.screenSizePerspectiveAlignment=e,C.fontHeight=s.maxHeight}S.hasSlicePlane=this._context.slicePlaneEnabled;const F=this._context.spherical,H=y?JSON.stringify(C):"";let V=y?.get(H);if(null==V){if(!m.isFocused&&L){const e=this.view.map?.focusAreas.style;S.color=p(S.color,e),S.outlineColor=p(S.outlineColor,e)}V=new R(S,F),y?.set(H,V)}const I=m.placement.translation,M=w?n(w.displayWidth,w.displayHeight):o,$=m.placement.centerOffset,k=T,N=v?l(0,0,0,0):null,q=U(V,{normal:k,position:I,size:M,centerOffsetAndDistance:$,uvi:N}),B=z(this._context,a,q,b,O);if(null==B)return null;const J=(t,s,r,n,o,i)=>{const a=x()||m.placement.elevationOffset,l=this.setGraphicElevationContext(e,s,a);return f(t,l,r,n,o,i)},Y=new d(this,B.object,j,J,b);Y.alignedSampledElevation=B.sampledElevation,Y.needsElevationUpdates=h(b.mode)||"absolute-height"===b.mode,Y.getScreenSize=(e=i())=>(e[0]=w?w.displayWidth:m.displaySize[0],e[1]=w?w.displayHeight:m.displaySize[1],e);const Z=new g(m.placement.elevationOffset,c);return Y.metadata=Z,G(Y,a,this._context.elevationProvider),Y}}function V(e,t,s){e?.forEach(e=>{const r=t(e);null!=r&&s(r,e.graphic)})}function W(e,t){if("baseline"===t.verticalPlacement){const s=j[t.horizontalPlacement],r=null!=e?e.baselineAnchorY:0;return n(s,r)}const s=_(t.horizontalPlacement,t.verticalPlacement);return E[s]}const I={mode:"relative-to-ground",offset:0};export{H as Graphics3DTextSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{emptySymbolComplexity as t}from"./defaultSymbolComplexity.js";import{Loadable as r}from"./Loadable.js";import{getSymbolMemorySize as s}from"./symbolMemory.js";class
|
|
5
|
+
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,r){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.updateGeometry(t,r)}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 cachedMemory(){return s(this)}}export{e as Graphics3DWebStyleSymbol};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{destroyMaybe as t,removeMaybe as i}from"../../../../core/maybe.js";import{initial as s,watch as r,sync as a}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{t as c}from"../../../../chunks/boundedPlane.js";import{Deconflictor as h,DeconflictorGraphic as n}from"./Deconflictor.js";import{LabelDeconflictor as l}from"./LabelDeconflictor.js";import{TaskPriority as d}from"../../../support/Scheduler.js";let p=class extends h{constructor(){super(...arguments),this._contexts=new Map,this.visibilityGroup=1,this._marginFactor=-.1,this.test={overrideMarginFactor:e=>{this._marginFactor=e,this.setDirty()}}}get labels(){return this._labels}get viewState(){return this._viewState}initialize(){this._updatingHandles.add(()=>this.view?.state?.camera,()=>{this._updateViewState(),this.setDirty()}),this._updatingHandles.add(()=>this.view?.slice?.plane,()=>{this._updateSlicePlane(),this._slicePlaneChanged(),this.setDirty()},s),this.addHandles(r(()=>this.view.basemapTerrain?.updating||this.view.graphicsView?.updating||this.view.allLayerViews.some(e=>e.updating),(e,t)=>{!e&&t&&this.setDirty()},a)),this._frameTask=this.view.resourceController.scheduler.registerTask(d.GRAPHICS_DECONFLICTOR,this),this._labels=new l({view:this.view,parent:this})}destroy(){this._labels=t(this._labels),this._frameTask=i(this._frameTask)}get marginFactor(){return this._marginFactor}setDirty(){this._contexts.size>0&&(super.setDirty(),this._labels.setDirty())}runTask(e){const t=super.runTask(e);return this.readyToRun||this._labels.setDirty(),t}_updateViewState(){this.view?.state&&(this._viewState.camera.copyFrom(this.view.state.camera),this._updateSlicePlane())}_updateSlicePlane(){const e=this.view?.slice?.plane;null!=e&&c(e,this._viewState.camera.viewMatrix,this._viewState.slicePlane),this._viewState.slicePlaneEnabled=null!=e}_slicePlaneChanged(){for(const e of this._contexts.keys())if(e.symbolCreationContext.slicePlaneEnabled)return void this.setDirty()}addGraphicsOwner(e){const t=this._getGraphicsContext(e);return{addGraphic:i=>this._addGraphic(e,t,i),removeGraphic:e=>this._removeGraphic(t,e),labelingInfoChange:()=>this._labelsEnabledChanged(e,t),featureReductionChange:()=>this._enabledChanged(e,t),slicePlaneEnabledChange:()=>this._slicePlaneEnabledChanged(e,t),clear:()=>t.forEach(e=>this._removeGraphic(t,e.graphics3DGraphic)),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._contexts.get(e);t&&(t.forEach(e=>this._removeGraphic(t,e.graphics3DGraphic)),this._contexts.delete(e),this.setDirty())}_addGraphic(e,t,i){const s=i.graphic.uid,r=new n(i,e.symbolCreationContext.slicePlaneEnabled);t.set(s,r),this.addToCheckOcclusion(r),
|
|
5
|
+
import{__decorate as e}from"tslib";import{destroyMaybe as t,removeMaybe as i}from"../../../../core/maybe.js";import{initial as s,watch as r,sync as a}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{t as c}from"../../../../chunks/boundedPlane.js";import{Deconflictor as h,DeconflictorGraphic as n}from"./Deconflictor.js";import{LabelDeconflictor as l}from"./LabelDeconflictor.js";import{TaskPriority as d}from"../../../support/Scheduler.js";let p=class extends h{constructor(){super(...arguments),this._contexts=new Map,this.visibilityGroup=1,this._marginFactor=-.1,this.test={overrideMarginFactor:e=>{this._marginFactor=e,this.setDirty()}}}get labels(){return this._labels}get viewState(){return this._viewState}initialize(){this._updatingHandles.add(()=>this.view?.state?.camera,()=>{this._updateViewState(),this.setDirty()}),this._updatingHandles.add(()=>this.view?.slice?.plane,()=>{this._updateSlicePlane(),this._slicePlaneChanged(),this.setDirty()},s),this.addHandles(r(()=>this.view.basemapTerrain?.updating||this.view.graphicsView?.updating||this.view.allLayerViews.some(e=>e.updating),(e,t)=>{!e&&t&&this.setDirty()},a)),this._frameTask=this.view.resourceController.scheduler.registerTask(d.GRAPHICS_DECONFLICTOR,this),this._labels=new l({view:this.view,parent:this})}destroy(){this._labels=t(this._labels),this._frameTask=i(this._frameTask)}get marginFactor(){return this._marginFactor}get usedMemory(){return super.usedMemory+this._labels.usedMemory}setDirty(){this._contexts.size>0&&(super.setDirty(),this._labels.setDirty())}runTask(e){const t=super.runTask(e);return this.readyToRun||this._labels.setDirty(),t}_updateViewState(){this.view?.state&&(this._viewState.camera.copyFrom(this.view.state.camera),this._updateSlicePlane())}_updateSlicePlane(){const e=this.view?.slice?.plane;null!=e&&c(e,this._viewState.camera.viewMatrix,this._viewState.slicePlane),this._viewState.slicePlaneEnabled=null!=e}_slicePlaneChanged(){for(const e of this._contexts.keys())if(e.symbolCreationContext.slicePlaneEnabled)return void this.setDirty()}addGraphicsOwner(e){const t=this._getGraphicsContext(e);return{addGraphic:i=>this._addGraphic(e,t,i),removeGraphic:e=>this._removeGraphic(t,e),labelingInfoChange:()=>this._labelsEnabledChanged(e,t),featureReductionChange:()=>this._enabledChanged(e,t),slicePlaneEnabledChange:()=>this._slicePlaneEnabledChanged(e,t),clear:()=>t.forEach(e=>this._removeGraphic(t,e.graphics3DGraphic)),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._contexts.get(e);t&&(t.forEach(e=>this._removeGraphic(t,e.graphics3DGraphic)),this._contexts.delete(e),this.setDirty())}_addGraphic(e,t,i){const s=i.graphic.uid,r=new n(i,e.symbolCreationContext.slicePlaneEnabled);t.set(s,r),this.addToCheckOcclusion(r),u(e)&&this.addToActiveGraphics(r),e.labelsEnabled&&(this._labels.addToCheckOcclusion(r),this._labels.addToActiveGraphics(r));const a=!this._graphicSupportsDeconfliction(i)||!u(e);i.setVisibilityFlag(1,8,a)}_removeGraphic(e,t){const i=t.graphic.uid,s=e.get(i);s&&(this.removeFromActiveGraphics(s),this.removeFromCheckOcclusion(s),this._labels.removeFromActiveGraphics(s),this._labels.removeFromCheckOcclusion(s),e.delete(i),this.setDirty())}_enabledChanged(e,t){u(e)?t.forEach(e=>this.addToActiveGraphics(e)):(t.forEach(e=>this.removeFromActiveGraphics(e)),m(e))}_labelsEnabledChanged(e,t){e.labelsEnabled?(t.forEach(e=>this._labels.addToCheckOcclusion(e)),t.forEach(e=>this._labels.addToActiveGraphics(e))):(t.forEach(e=>this._labels.removeFromCheckOcclusion(e)),t.forEach(e=>this._labels.removeFromActiveGraphics(e)))}_slicePlaneEnabledChanged(e,t){const i=e.symbolCreationContext.slicePlaneEnabled;t.forEach(e=>e.slicePlaneEnabled=i),this.setDirty()}_graphicSupportsDeconfliction(e){if(e.isDraped)return!1;const t=e.layers;if(!t?.length)return!1;for(const i of t)if(this.layerSupportsDeconfliction(i))return!0;return!1}_getGraphicsContext(e){const t=this._contexts.get(e);if(t)return t;const i=new Map;return this._contexts.set(e,i),this.setDirty(),i}};function u(e){const t=e.layer;return!(!t?.featureReduction||"selection"!==t.featureReduction.type)}function m(e){const t=e.graphics3DGraphics;t&&t.forEach(e=>e.setVisibilityFlag(1,8,!0))}p=e([o("esri.views.3d.layers.graphics.GraphicsDeconflictor")],p);export{p as GraphicsDeconflictor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import l from"../../../../core/Logger.js";import{disposeMaybe as a,abortMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import{watch as c}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as p}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as d}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{make as g}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as f,LineCalloutSymbolLayerRenderingInfo as m}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as C}from"./graphicSymbolUtils.js";import{LabelInfo as x}from"./LabelInfo.js";import{LabelParameters as _}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as L,verticalPlacementFromAnchor as v,textRenderAlignmentFromHorizontalPlacement as G}from"./placementUtils.js";import{placePointOnGeometry as w}from"./pointUtils.js";import{TextRenderer as D}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as A}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as T}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as I}from"../../webgl-engine/lib/WebGLLayer.js";import{hasLayerBasedScaleVisibility as S,isInEffectiveScaleRange as R}from"../../../support/layerViewUtils.js";import{TaskPriority as P}from"../../../support/Scheduler.js";import{Yield as j}from"../../../support/Yield.js";class V{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class O{constructor(e,t,s,i,l){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=l,this.calloutSymbolLayerIndex=0,this.graphics=new Map,this.scaleVisibility=null}}class z{constructor(e,t,s,i,l,a,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=l,this.elevationInfoOverride=a,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this._labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new I(e,{pickable:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}get labelClassContexts(){return this._labelClassContexts}setLabelClassContext(e,t){this._labelClassContexts[e]=t}resetLabelClassContext(){this._labelClassContexts.length=0}}let E=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([c(()=>this.view.state?.camera,()=>this.setDirty()),c(()=>this.view.state?.rasterPixelRatio,()=>this._resetAllLabels()),c(()=>this.view.focusAreasView?.polygons,()=>this._updateFocus()),this.view.resourceController.scheduler.registerTask(P.LABELER,this)]),S()&&this.addHandles(c(()=>this.view.scale,()=>this._updateScaleVisibility())),this._textTextureAtlas=new T({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=a(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),B.graphic=null,B.renderingInfo=null,B.layer=null}_updateFocus(){this._labelingContexts.forEach(e=>{e.graphics.forEach(t=>{if(0===t.labelLayers.length)return;const s=w(t.graphic.geometry);if(null==s)return;const i=this.view.focusAreasView?.containsGeometry(s)??!0;t.labelLayers.forEach(s=>{s.stageObject.geometries.some(e=>e.material.parameters.isFocused!==i)&&(this._removeGraphic(e,t),this._addGraphic(e,t),this.setDirty())})})})}_activateLabelingContext(e){e.graphics.forEach((t,s)=>{const i=new V(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i),t.setVisibilityFlag(16,1,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((e,t)=>{e.setVisibilityFlag(16,1,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)}),e.active=!1}_addLabelTextureToAtlas(e){if(this._textTextureAtlas)for(const t of e.graphics3DGraphic.labelLayers){if(!t.labelClass)continue;const s=e.textRenderers[t.labelClassContextIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,e=>M(t.stageObject,e))),F(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach(e=>e.remove()),e.textureAtlasHandles.length=0}get readyToRun(){return this.view.ready&&(this._dirty||this.deconflictor.readyToRun)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.readyToRun&&this.deconflictor.runTask(e),j}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(H(t))this._dirty=!0;else if(U(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(const[s,i]of t.labelsToInitialize)if(this._ensureGraphics3DResources(i)&&(this._labels.set(s,i),this.deconflictor.setDirty(),e.madeProgress()),(i.visible&&i.textInitialized||!i.visible&&i.hasGraphics3DResources)&&(t.labelsToInitialize.delete(s),e.madeProgress()),e.done){this._dirty=!0;break}this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const a=e.graphics3DCore,r=a.layer,n=r.labelingInfo?.filter(e=>!!e.symbol);if(!n||0===n.length)return;let c=!1;await s(n,async(s,r)=>{const n=s.symbol,h=C(a.getOrCreateGraphics3DSymbol(n));if(null==h)return void l.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;y(n)&&n.hasVisibleCallout()&&(b=g(n,a.symbolCreationContext),await b.load(),o(t));const u=await i(d(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===u.ok){const i=await this._createTextRenderParameters(h.symbol);o(t);const l=new O(s,h,b,i,u.value);this._updateLabelClassContextVisibility(l),e.setLabelClassContext(r,l)}else l.getLogger(this).error(`Label expression failed to evaluate: ${u.error}`),c=!0}),o(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch(t=>{if(n(t))throw t;e.resetLabelClassContext()}).then(()=>{e.labelClassAbortController=null,this.notifyChange("updating")}).catch(()=>{}),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:A.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,r(t),e.resetLabelClassContext(),e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,l,a){if(!this._textTextureAtlas)return null;const r=new _(s,L(s.anchor),v(s.anchor),e.text,u(e.displayWidth,e.displayHeight));return B.graphic=t,B.layer=i,B.renderingInfo=null,l.createLabel(B,r,this._hudMaterials,this._textTextureAtlas,()=>a.placement?.elevationOffset??null)}_createLineCalloutGraphic(e,t,s,i,l){B.graphic=e,B.layer=l;const a=i.screenOffset[0];return B.renderingInfo=new m(null,t,i.translation,i.centerOffset,a,i.centerOffsetUnits,i.elevationOffset),s.createGraphics3DGraphic(B,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,i=s.labelClassContexts;if(U(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let l=!1;const a=t.graphic,r=s.layer,o=W(s.layer);for(let n=0;n<i.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=i[n],u=b.graphics3DSymbol,p=k(u),d=u.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new x(t,p,b.labelClass),g=this._createTextSymbolGraphic(c,a,h,r,d,y);if(null==g)return!1;g.labelClass=b.labelClass,g.labelClassContextIndex=n,t.addLabelGraphic(g,s.stageLayer),this.deconflictor.setPriority(t,b.textRenderParameters?.definition.size??0),t.setVisibilityFlag(16,1,o),t.setVisibilityFlag(16,2,b.scaleVisibility??!0),t.setVisibilityFlag(16,8,!1),S()&&b.graphics.set(a.uid,t),l=!0;const f=b.graphics3DCalloutSymbolLayer;if(f&&h.hasLabelVerticalOffset){f.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,p,f,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return l&&s.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s.labelClass)continue;const e=t[s.labelClassContextIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(U(s))return;const i=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const r=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?p(i,t.layer,null):i;n=o.evaluate(e)}catch(l){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,u=r.labelClass,d=t.disablePlacement,y=new x(h,b,u,d).placement;if(null==y)continue;const g=L(y.anchor),f=G(g);e.textRenderers[a]=new D(n,f,r.textRenderParameters,T.maxSize),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const i=new V(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){const s=t.graphic.uid,i=this._labels.get(s);if(!i)return!0;for(const l of i.graphics3DGraphic.labelLayers){if(null==l.labelClass)continue;if(!e.labelClassContexts[l.labelClassContextIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(l,t.graphic.geometry))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){const s=t.graphic.uid,i=this._labels.get(s);e.graphics.delete(s),e.labelClassContexts.forEach(e=>e.graphics.delete(s)),i&&(this._destroyGraphic(i,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const i=new Map;t.graphics.forEach(e=>i.set(e.graphic.uid,e));const l=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,l),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,i,t)}}}_visibilityInfoChange(e){const t=W(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach((t,s)=>{const i=this._labels.get(s);i&&(this._destroyGraphic(i,s),i.visible=!1,e.labelsToInitialize.set(s,i))}),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const i=s?.emptySymbolLabelSupported||!1,l=s?.elevationInfoOverride||null,a=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new z(this.view.stage,r,e,t,i,l,a,W(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(o,e),layerLabelsEnabled:()=>W(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach(e=>this._removeGraphic(t,e)),t.destroy(),this.setDirty()}_updateScaleVisibility(){for(const e of this._labelingContexts)if(e.active&&!H(e))for(const t of e.labelClassContexts)this._updateLabelClassContextVisibility(t)}_updateLabelClassContextVisibility(e){if(!S())return;const{labelClass:t,graphics:s}=e,i={minScale:t.minScale,maxScale:t.maxScale},l=R(i,this.view.scale),a=null==e.scaleVisibility||e.scaleVisibility!==l;e.scaleVisibility=l,a&&s.size&&(s.forEach(e=>e.setVisibilityFlag(16,2,l)),this.deconflictor.setDirty(),this.setDirty())}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,i=this._labels.get(s);i&&i.visible!==t&&(t&&!i.textureAtlasHandles.length?(this._addLabelTextureToAtlas(i),i.textInitialized||i.labelingContext.labelsToInitialize.set(s,i)):!t&&i.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(i),i.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some(e=>H(e))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce((e,t)=>e+(H(t)?0:1),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get usedMemory(){return this._textTextureAtlas?.usedMemory??0}get test(){}};function F(e,t){e.geometries[0].setAttributeData("size",[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],"size")}function M(e,t){e.geometries[0].setAttributeData("uvi",t),e.geometryVertexAttributeUpdated(e.geometries[0],"uvi",!0)}function H(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function U(e){return!e||0===e.length}function k(e){return"label-3d"===e.symbol?.type?e.symbol:null}function W(e){return!!e.labelsVisible&&!!e.labelingInfo?.some(e=>!!e.symbol)}e([h({constructOnly:!0})],E.prototype,"view",void 0),e([h({constructOnly:!0})],E.prototype,"deconflictor",void 0),e([h()],E.prototype,"_textTextureAtlas",void 0),e([h({type:Boolean,readOnly:!0})],E.prototype,"updating",null),E=e([b("esri.views.3d.layers.graphics.Labeler")],E);const B=new f(null,null,null);export{E as Labeler,W as areLabelsVisible};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import a from"../../../../core/Logger.js";import{disposeMaybe as l,abortMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import c from"../../../../core/Queue.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as d}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as y}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as g}from"../../../../symbols/callouts/calloutUtils.js";import{make as f}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as m,LineCalloutSymbolLayerRenderingInfo as C}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as x}from"./graphicSymbolUtils.js";import{LabelInfo as _}from"./LabelInfo.js";import{LabelParameters as L}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as v,verticalPlacementFromAnchor as G,textRenderAlignmentFromHorizontalPlacement as w}from"./placementUtils.js";import{placePointOnGeometry as D}from"./pointUtils.js";import{TextRenderer as A}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as T}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as I}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as S}from"../../webgl-engine/lib/WebGLLayer.js";import{hasLayerBasedScaleVisibility as R,isInEffectiveScaleRange as P}from"../../../support/layerViewUtils.js";import{TaskPriority as j}from"../../../support/Scheduler.js";import{Yield as V}from"../../../support/Yield.js";class O{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class F{constructor(e,t,s,i,a){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=a,this.calloutSymbolLayerIndex=0,this.graphics=new Map,this.scaleVisibility=null}}class z{constructor(e,t,s,i,a,l,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=a,this.elevationInfoOverride=l,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this._labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new S(e,{pickable:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}get labelClassContexts(){return this._labelClassContexts}setLabelClassContext(e,t){this._labelClassContexts[e]=t}resetLabelClassContext(){this._labelClassContexts.length=0}}let E=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._focusAreasLabelsQueue=new c,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([h(()=>this.view.state?.camera,()=>this.setDirty()),h(()=>this.view.state?.rasterPixelRatio,()=>this._resetAllLabels()),h(()=>this.view.focusAreasView?.polygons,()=>this._updateFocus()),this.view.resourceController.scheduler.registerTask(j.LABELER,this)]),R()&&this.addHandles(h(()=>this.view.scale,()=>this._updateScaleVisibility())),this._textTextureAtlas=new I({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=l(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),B.graphic=null,B.renderingInfo=null,B.layer=null}_updateFocus(){this._focusAreasLabelsQueue.clear(),this._labelingContexts.forEach(e=>{e.graphics.forEach(t=>{this._focusAreasLabelsQueue.push({graphic3DGraphic:t,labelingContext:e})})})}_activateLabelingContext(e){e.graphics.forEach((t,s)=>{const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i),t.setVisibilityFlag(16,1,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((e,t)=>{e.setVisibilityFlag(16,1,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)}),e.active=!1}_addLabelTextureToAtlas(e){if(this._textTextureAtlas)for(const t of e.graphics3DGraphic.labelLayers){if(!t.labelClass)continue;const s=e.textRenderers[t.labelClassContextIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,e=>U(t.stageObject,e))),M(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach(e=>e.remove()),e.textureAtlasHandles.length=0}get readyToRun(){return this.view.ready&&(this._dirty||this.deconflictor.readyToRun||this._focusAreasLabelsQueue.length>0)}runTask(e){return this._updateLabels(e),this._applyFocusAreasUpdates(e),!this._dirty&&this.deconflictor.readyToRun&&this.deconflictor.runTask(e),V}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(H(t))this._dirty=!0;else if(Q(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(const[s,i]of t.labelsToInitialize)if(this._ensureGraphics3DResources(i)&&(this._labels.set(s,i),this.deconflictor.setDirty(),e.madeProgress()),(i.visible&&i.textInitialized||!i.visible&&i.hasGraphics3DResources)&&(t.labelsToInitialize.delete(s),e.madeProgress()),e.done){this._dirty=!0;break}this._dirty||this.notifyChange("updating")}}_applyFocusAreasUpdates(e){for(;this._focusAreasLabelsQueue.length>0&&!e.done;){const{graphic3DGraphic:e,labelingContext:t}=this._focusAreasLabelsQueue.pop();if(0===e.labelLayers.length)return;const s=D(e.graphic.geometry);if(null==s)return;const i=this.view.focusAreasView?.containsGeometry(s)??!0;e.labelLayers.forEach(s=>{s.stageObject.geometries.some(e=>e.material.parameters.isFocused!==i)&&(this._removeGraphic(t,e),this._addGraphic(t,e),this.setDirty())})}0===this._focusAreasLabelsQueue.length&&this.notifyChange("readyToRun")}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const l=e.graphics3DCore,r=l.layer,n=r.labelingInfo?.filter(e=>!!e.symbol);if(!n||0===n.length)return;let c=!1;await s(n,async(s,r)=>{const n=s.symbol,h=x(l.getOrCreateGraphics3DSymbol(n));if(null==h)return void a.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;g(n)&&n.hasVisibleCallout()&&(b=f(n,l.symbolCreationContext),await b.load(),o(t));const u=await i(y(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===u.ok){const i=await this._createTextRenderParameters(h.symbol);o(t);const a=new F(s,h,b,i,u.value);this._updateLabelClassContextVisibility(a),e.setLabelClassContext(r,a)}else a.getLogger(this).error(`Label expression failed to evaluate: ${u.error}`),c=!0}),o(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch(t=>{if(n(t))throw t;e.resetLabelClassContext()}).then(()=>{e.labelClassAbortController=null,this.notifyChange("updating")}).catch(()=>{}),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:T.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,r(t),e.resetLabelClassContext(),e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,a,l){if(!this._textTextureAtlas)return null;const r=new L(s,v(s.anchor),G(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return B.graphic=t,B.layer=i,B.renderingInfo=null,a.createLabel(B,r,this._hudMaterials,this._textTextureAtlas,()=>l.placement?.elevationOffset??null)}_createLineCalloutGraphic(e,t,s,i,a){B.graphic=e,B.layer=a;const l=i.screenOffset[0];return B.renderingInfo=new C(null,t,i.translation,i.centerOffset,l,i.centerOffsetUnits,i.elevationOffset),s.createGraphics3DGraphic(B,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,i=s.labelClassContexts;if(Q(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let a=!1;const l=t.graphic,r=s.layer,o=W(s.layer);for(let n=0;n<i.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=i[n],u=b.graphics3DSymbol,p=k(u),d=u.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new _(t,p,b.labelClass),g=this._createTextSymbolGraphic(c,l,h,r,d,y);if(null==g)return!1;g.labelClass=b.labelClass,g.labelClassContextIndex=n,t.addLabelGraphic(g,s.stageLayer),this.deconflictor.setPriority(t,b.textRenderParameters?.definition.size??0),t.setVisibilityFlag(16,1,o),t.setVisibilityFlag(16,2,b.scaleVisibility??!0),t.setVisibilityFlag(16,8,!1),R()&&b.graphics.set(l.uid,t),a=!0;const f=b.graphics3DCalloutSymbolLayer;if(f&&h.hasLabelVerticalOffset){f.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(l,p,f,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return a&&s.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s.labelClass)continue;const e=t[s.labelClassContextIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(Q(s))return;const i=e.graphics3DGraphic.graphic;for(let l=0;l<s.length;l++){const r=s[l];if(e.textRenderers[l]=null,e.textLabelPlacements[l]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?d(i,t.layer,null):i;n=o.evaluate(e)}catch(a){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,u=r.labelClass,p=t.disablePlacement,y=new _(h,b,u,p).placement;if(null==y)continue;const g=v(y.anchor),f=w(g);e.textRenderers[l]=new A(n,f,r.textRenderParameters,I.maxSize),e.textLabelPlacements[l]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){const s=t.graphic.uid,i=this._labels.get(s);if(!i)return!0;for(const a of i.graphics3DGraphic.labelLayers){if(null==a.labelClass)continue;if(!e.labelClassContexts[a.labelClassContextIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(a,t.graphic.geometry))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){const s=t.graphic.uid,i=this._labels.get(s);e.graphics.delete(s),e.labelClassContexts.forEach(e=>e.graphics.delete(s)),i&&(this._destroyGraphic(i,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const i=new Map;t.graphics.forEach(e=>i.set(e.graphic.uid,e));const a=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,a),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,i,t)}}}_visibilityInfoChange(e){const t=W(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach((t,s)=>{const i=this._labels.get(s);i&&(this._destroyGraphic(i,s),i.visible=!1,e.labelsToInitialize.set(s,i))}),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const i=s?.emptySymbolLabelSupported||!1,a=s?.elevationInfoOverride||null,l=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new z(this.view.stage,r,e,t,i,a,l,W(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(o,e),layerLabelsEnabled:()=>W(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach(e=>this._removeGraphic(t,e)),t.destroy(),this.setDirty()}_updateScaleVisibility(){for(const e of this._labelingContexts)if(e.active&&!H(e))for(const t of e.labelClassContexts)this._updateLabelClassContextVisibility(t)}_updateLabelClassContextVisibility(e){if(!R())return;const{labelClass:t,graphics:s}=e,i={minScale:t.minScale,maxScale:t.maxScale},a=P(i,this.view.scale),l=null==e.scaleVisibility||e.scaleVisibility!==a;e.scaleVisibility=a,l&&s.size&&(s.forEach(e=>e.setVisibilityFlag(16,2,a)),this.deconflictor.setDirty(),this.setDirty())}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,i=this._labels.get(s);i&&i.visible!==t&&(t&&!i.textureAtlasHandles.length?(this._addLabelTextureToAtlas(i),i.textInitialized||i.labelingContext.labelsToInitialize.set(s,i)):!t&&i.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(i),i.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some(e=>H(e))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce((e,t)=>e+(H(t)?0:1),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get usedMemory(){return this._textTextureAtlas?.usedMemory??0}get test(){}};function M(e,t){e.geometries[0].setAttributeData("size",[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],"size")}function U(e,t){e.geometries[0].setAttributeData("uvi",t),e.geometryVertexAttributeUpdated(e.geometries[0],"uvi",!0)}function H(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function Q(e){return!e||0===e.length}function k(e){return"label-3d"===e.symbol?.type?e.symbol:null}function W(e){return!!e.labelsVisible&&!!e.labelingInfo?.some(e=>!!e.symbol)}e([b({constructOnly:!0})],E.prototype,"view",void 0),e([b({constructOnly:!0})],E.prototype,"deconflictor",void 0),e([b()],E.prototype,"_textTextureAtlas",void 0),e([b({type:Boolean,readOnly:!0})],E.prototype,"updating",null),E=e([u("esri.views.3d.layers.graphics.Labeler")],E);const B=new m(null,null,null);export{E as Labeler,W as areLabelsVisible};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import r from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as o}from"../../../../core/unitUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as a,toRect as l,expandWithVec3 as c}from"../../../../geometry/support/aaBoundingBox.js";import{getMetersPerUnit as d}from"../../../../symbols/support/unitConversionUtils.js";import{ElevationUpdateEvent as p}from"../../support/ElevationUpdateEvent.js";import{Intersector as m}from"../../webgl-engine/lib/Intersector.js";import{affectsGeometry as h}from"../../webgl-engine/lib/VertexAttribute.js";const u=1,f=Symbol("layerHandles");let g=class extends t{get spatialReference(){return this.view.spatialReference}constructor(e){super(e),this._elevationOffset=0}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersectLayers=[this.stageLayer],this._intersector=new m(this.view.state.viewingMode),this._intersector.options.store=0;const e=this._computeLayerExtent(this.spatialReference,this.stageLayer);this._zmin=e[2],this._zmax=e[5];const t=this.stageLayer.events;this.addHandles([t.on(["layerObjectAdded","layerObjectRemoved","transformationChanged","shaderTransformationChanged"],e=>this._objectChanged(e)),t.on(["geometryAdded","geometryRemoved"],({object:e})=>this._objectChanged(e)),t.on("attributesChanged",({attribute:e,object:t})=>h(e)&&this._objectChanged(t))],f)}
|
|
5
|
+
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import r from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as o}from"../../../../core/unitUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as a,toRect as l,expandWithVec3 as c}from"../../../../geometry/support/aaBoundingBox.js";import{getMetersPerUnit as d}from"../../../../symbols/support/unitConversionUtils.js";import{ElevationUpdateEvent as p}from"../../support/ElevationUpdateEvent.js";import{Intersector as m}from"../../webgl-engine/lib/Intersector.js";import{affectsGeometry as h}from"../../webgl-engine/lib/VertexAttribute.js";const u=1,f=Symbol("layerHandles");let g=class extends t{get spatialReference(){return this.view.spatialReference}constructor(e){super(e),this._elevationOffset=0}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersectLayers=[this.stageLayer],this._intersector=new m(this.view.state.viewingMode),this._intersector.options.store=0;const e=this._computeLayerExtent(this.spatialReference,this.stageLayer);this._zmin=e[2],this._zmax=e[5];const t=this.stageLayer.events;this.addHandles([t.on(["layerObjectAdded","layerObjectRemoved","transformationChanged","shaderTransformationChanged"],e=>this._objectChanged(e)),t.on(["geometryAdded","geometryRemoved"],({object:e})=>this._objectChanged(e)),t.on("attributesChanged",({attribute:e,object:t})=>h(e)&&this._objectChanged(t))],f)}destroy(){this.removeHandles(f)}elevationInfoChanged(){const e=null!=this.layer?this.layer.elevationInfo:null;if(null!=e&&"on-the-ground"!==e.mode){const t=o(this.layer.spatialReference),r=d(e.unit??"meters");this._elevationOffset=(e.offset??0)*r/t}else this._elevationOffset=0}getElevation(e,t,o,s){if(x[0]=e,x[1]=t,x[2]=o,!this._renderCoordsHelper.toRenderCoords(x,s,x))return r.getLogger(this).error("could not project point for elevation alignment"),null;const i=this._elevationOffset,n=this._zmin+i,a=this._zmax+i;this._renderCoordsHelper.setAltitude(b,a,x),this._renderCoordsHelper.setAltitude(j,n,x);const l=e=>!!e.lastValidElevationBB;return this._intersector.reset(b,j,null),this._intersector.intersect(this._intersectLayers,null,u,null,l),this._intersector.results.min.getIntersectionPoint(x)?this._renderCoordsHelper.getAltitude(x):null}_objectChanged(e){const t=this.spatialReference;if(!e.lastValidElevationBB||!t)return;a(_);const r=e.lastValidElevationBB;r.isEmpty()||this._expandExtent(t,r.min,r.max,_);const{min:o,max:s}=e.boundingVolumeWorldSpace;this._expandExtent(t,o,s,_),l(_,v.extent),this._zmin=Math.min(this._zmin,_[2]),this._zmax=Math.max(this._zmax,_[5]),v.spatialReference=t,this.emit("elevation-change",v),v.spatialReference=null,r.assignMinMax(o,s)}_computeLayerExtent(e,t){return a(_),null!=e&&t.objects.forEach(t=>this._expandExtent(e,t.boundingVolumeWorldSpace.min,t.boundingVolumeWorldSpace.max,_)),_}_expandExtent(e,t,r,o){for(let s=0;s<8;++s)x[0]=1&s?t[0]:r[0],x[1]=2&s?t[1]:r[1],x[2]=4&s?t[2]:r[2],this._renderCoordsHelper.fromRenderCoords(x,x,e),c(o,x);return o}};e([s({constructOnly:!0})],g.prototype,"layer",void 0),e([s({constructOnly:!0})],g.prototype,"stageLayer",void 0),e([s({constructOnly:!0})],g.prototype,"view",void 0),e([s()],g.prototype,"spatialReference",null),g=e([i("esri.views.3d.layers.support.StageLayerElevationProvider")],g);const _=a(),v=new p;function y(){v.spatialReference=null}const x=n(),b=n(),j=n();export{g as StageLayerElevationProvider,y as cleanupStageLayerElevationProvider};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{EventEmitter as r}from"../../../core/Evented.js";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{EventEmitter as r}from"../../../core/Evented.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{when as a}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{afterDispatch as n}from"../../../core/accessorSupport/watch.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../geometry/ellipsoidUtils.js";import c from"../../ViewAnimation.js";import{viewingModeFromString as m}from"../../ViewingMode.js";import{Constraints as h}from"./Constraints.js";import{AnimationController as d}from"./controllers/AnimationController.js";import u from"../webgl/RenderCamera.js";import{DepthRange as g}from"../webgl-engine/lib/DepthRange.js";import{maximumHighlights as y}from"../../support/HighlightDefaults.js";import{PropertiesPool as C}from"../../support/PropertiesPool.js";let f=class extends t{constructor(e){super(e),this._propertiesPool=new C({camera:()=>new u},this),this._lastSeenCameraProjectionValues=new u,this.mode=0,this._cssCamera=new u,this._camera=new u,this.rasterPixelRatio=1,this.contentPixelRatio=1,this.constraints=new h({state:this}),this.events=new r,this._cameraChanged=!1,this._updateQueue=new Array,this._processingUpdates=!1}reset(){this.cameraController=null,this._propertiesPool.destroy(),this._propertiesPool=new C({camera:()=>new u},this)}destroy(){this.cameraController=o(this.cameraController),this._propertiesPool=o(this._propertiesPool)}createInitialCamera(){if(1===this.viewingMode){const e=p(this.spatialReference).radius;this.camera=new u({eye:l(4*e,0,0),center:l(e,0,0),up:l(0,0,1)})}else this.camera=new u({eye:l(0,0,100),center:l(0,0,0),up:l(0,1,0)})}get animation(){return this.cameraController instanceof d&&null!=this.cameraController.viewAnimation?this.cameraController.viewAnimation:null}get cssCamera(){const e=this._cssCamera.copyFrom(this.camera),{height:t,width:r,pixelRatio:o}=this.camera;return e.pixelRatio=1,e.height=Math.round(t/o),e.width=Math.round(r/o),e}get camera(){return this._camera}set camera(e){e!==v&&v.copyFrom(e),v.computeUp(this.viewingMode),this.events.emit("before-camera-change",{camera:v});const t=this._camera;if(_(this._lastSeenCameraProjectionValues,v)&&(this._lastSeenCameraProjectionValues.copyFrom(v),this.events.emit("camera-projection-changed",this._lastSeenCameraProjectionValues)),!t.equals(v)&&(this._camera=this._propertiesPool.get("camera").copyFrom(v),this._cameraChanged=!t.almostEquals(v),this._cameraChanged)){const e=n(()=>{this._cameraChanged=!1,e.remove()})}}get pixelRatio(){return this.camera.pixelRatio}get alignPixelEnabled(){return this.pixelRatio===this.rasterPixelRatio&&2===this.mode}get updating(){return 2!==this.mode}get contentCamera(){return this._contentCamera??this.camera}set contentCamera(e){if(null==e)return void(this._contentCamera=null);const t=e.clone();this.events.emit("before-camera-change",{camera:t,sceneDepthRange:g.infinite}),this._contentCamera=t}get fixedContentCamera(){return null!=this._contentCamera}get isGlobal(){return 1===this.viewingMode}get isLocal(){return 2===this.viewingMode}get viewingMode(){return m(this.view.viewingMode)}get spatialReference(){return this.view.spatialReference}get highlights(){const e=this.view.highlights.items.slice(0,y);for(let t=0;t<e.length;){const r=e[t],o=e.findIndex(e=>e.name===r.name);o>=0&&t>o?e.splice(t,1):++t}return e}get highlightOrderMap(){const e=new Map;return this.highlights.forEach((t,r)=>e.set(t.name,r)),e}get navigating(){return!!this.cameraController?.isInteractive}get stationary(){return!this._cameraChanged&&!this.navigating}get cameraController(){return this._get("cameraController")}set cameraController(e){this.stopActiveCameraController()?(this.removeHandles(j),this.cameraController?.destroy(),e&&(this.addHandles(a(()=>4===e.state||3===e.state,()=>{const{cameraController:t}=this;this._set("cameraController",null),this.updateCamera(t=>e.onControllerEnd(t)),t?.destroy()},{sync:!0,once:!0}),j),e.onControllerStart(this.camera)),this._set("cameraController",e)):e&&(e.state=1)}switchCameraController(e){this.cameraController=e}stopActiveCameraController(){return!this.cameraController||this.cameraController.stopController()}updateCamera(e){this._updateQueue.push(e),this._processUpdateQueue()}_processUpdateQueue(){if(0===this._updateQueue.length||this._processingUpdates)return;this._processingUpdates=!0;const e=this._updateQueue.shift();v.copyFrom(this._get("camera")),e(v),this.camera=v,this._processingUpdates=!1,this._processUpdateQueue()}static cleanupViewstate(){v=new u}};e([i({constructOnly:!0})],f.prototype,"view",void 0),e([i()],f.prototype,"mode",void 0),e([i({readOnly:!0,type:c})],f.prototype,"animation",null),e([i({type:u})],f.prototype,"cssCamera",null),e([i()],f.prototype,"_cssCamera",void 0),e([i({type:u})],f.prototype,"camera",null),e([i()],f.prototype,"_camera",void 0),e([i({readOnly:!0})],f.prototype,"pixelRatio",null),e([i()],f.prototype,"rasterPixelRatio",void 0),e([i()],f.prototype,"contentPixelRatio",void 0),e([i({readOnly:!0})],f.prototype,"alignPixelEnabled",null),e([i({readOnly:!0})],f.prototype,"updating",null),e([i({})],f.prototype,"_contentCamera",void 0),e([i({type:u})],f.prototype,"contentCamera",null),e([i({readOnly:!0})],f.prototype,"fixedContentCamera",null),e([i({readOnly:!0})],f.prototype,"events",void 0),e([i({readOnly:!0})],f.prototype,"isGlobal",null),e([i({readOnly:!0})],f.prototype,"isLocal",null),e([i({readOnly:!0})],f.prototype,"viewingMode",null),e([i({readOnly:!0})],f.prototype,"highlights",null),e([i({readOnly:!0})],f.prototype,"highlightOrderMap",null),e([i({readOnly:!0})],f.prototype,"navigating",null),e([i({readOnly:!0})],f.prototype,"stationary",null),e([i()],f.prototype,"_cameraChanged",void 0),e([i()],f.prototype,"cameraController",null),f=e([s("esri.views.3d.state.ViewState")],f);const w=f;function _(e,t){return e.fov!==t.fov||(e.fullViewport[0]!==t.fullViewport[0]||e.fullViewport[1]!==t.fullViewport[1]||e.fullViewport[2]!==t.fullViewport[2]||e.fullViewport[3]!==t.fullViewport[3]||(e.padding[0]!==t.padding[0]||e.padding[1]!==t.padding[1]||e.padding[2]!==t.padding[2]||e.padding[3]!==t.padding[3]))}let v=new u;const j="ViewStateHandles";export{w as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import r from"../../../../core/Accessor.js";import{property as
|
|
5
|
+
import{__decorate as t}from"tslib";import r from"../../../../core/Accessor.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";let s=class extends r{constructor(t){super(t),this.state=0}get running(){return 2===this.state}get isInteractive(){return!1}get canStop(){return!1}stopController(){return!!this.destroyed||!!this.canStop&&(this.state=3,!0)}finishController(){this.state=4}get steppingFinished(){return!1}};t([e({constructOnly:!0})],s.prototype,"view",void 0),t([e({readOnly:!0})],s.prototype,"running",null),t([e()],s.prototype,"state",void 0),t([e({readOnly:!0})],s.prototype,"isInteractive",null),s=t([o("esri.views.3d.state.controllers.CameraController")],s);export{s as CameraController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{MemCacheStorage as s,MemCache as r}from"../../../core/MemCache.js";import{addFrameTask as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{MemCacheStorage as s,MemCache as r}from"../../../core/MemCache.js";import{addFrameTask as o}from"../../../core/scheduling.js";import{Milliseconds as a}from"../../../core/time.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{isMemoryManagedView as y}from"./MemoryManagedView.js";import{makeBudget as l}from"../../support/Scheduler.js";function m(e){return new w({view:e})}const u=.1,n=1,c=1,_=.75,p=.6,M=1.3,g=!!has("esri-tests-disable-memory-pools");let w=class extends t{constructor(e){super(e),this._quality=1,this._usedMemory=0,this._updating=!1,this._stableQuality=0,this._downscaleMemoryUsed=0,this._canFastRecover=!1,this._predictedMemory=0,this._cacheStorage=new s,this._warnMemoryUsage=null,this._numQualityChanges=0,this._maxMemory=g?4096:750,this._additionalCacheMemory=g?-4096:0,this.addHandles(o({prepare:()=>this._updateMemory()}))}destroy(){this._cacheStorage.destroy()}get maxMemory(){return this._maxMemory}set maxMemory(e){null==e||e<=0||g||(this._stableQuality=0,this._canFastRecover=!1,this._maxMemory<e&&this._updateQuality(n),this._maxMemory=e)}get additionalCacheMemory(){return this._additionalCacheMemory}set additionalCacheMemory(e){null==e||g||(this._additionalCacheMemory=e)}get memoryFactor(){return this._quality}get updating(){return this._updating}get usedMemory(){return this._usedMemory}get usedCacheMemory(){return this._cacheStorage.size}newCache(e,t,i){return new r(e,this._cacheStorage,t,i)}resetStableQuality(){this._stableQuality=0}disableMemCache(){this.additionalCacheMemory=-4096}update(){if(this._predictedMemory<=0&&!this._updating)return;let e=this._layersUpdating();if(this._predictedMemory<p&&this._canFastRecover)this._downscaleMemoryUsed=0,this._stableQuality=0,this._canFastRecover=!1,this._updateQuality(n);else if(e){if(this._predictedMemory>1.1*c||this._usedMemory>c)if(this._stableQuality>0)this._downscaleMemoryUsed=0,this._updateQuality(this._stableQuality);else if(this._quality>u&&this._downscaleMemoryUsed<this._usedMemory){if(this._compactAndUpdate())return;this._updateQuality(this._quality/M),this._downscaleMemoryUsed=this._usedMemory,this._canFastRecover=!1}}else if(this._downscaleMemoryUsed=0,this._usedMemory>c){if(this._compactAndUpdate())return;this._stableQuality=0,this._canFastRecover=!1,e=this._updateQuality(this._quality/M),this._downscaleMemoryUsed=this._predictedMemory}else if(this._stableQuality!==this._quality)if(this._usedMemory<_&&this._quality<n){this._stableQuality=this._quality;const t=.05;e=this._updateQuality(this._quality+t)}else this._quality<1&&(this._canFastRecover=!0);this._updating=e}_compactAndUpdate(){const e=l(a(100)),t=this.view.stage.compact(e);return this.view.basemapTerrain.overlayManager.renderer.compact(e)||t}_updateQuality(e){return(e=Math.min(Math.max(e,u),n))!==this._quality&&(this._quality=e,++this._numQualityChanges,!0)}_layersUpdating(){return this.view.allLayerViews.some(e=>!!e.updating)}_updateMemory(){if(!this.view||this.view.destroyed||this.view.destroying)return;this.view.stage?.renderer?.tick();const e=this.view.stage?.renderer?.usedMemory;let t=(this.view.basemapTerrain?.usedMemory??0)+(e?e.fbos+e.edges+e.plugins:0)+this.view.deconflictor?.usedMemory+this.view.labeler?.usedMemory,s=0;this.view.allLayerViews&&this.view.allLayerViews.forEach(e=>{if(y(e)){const i=e.ignoresMemoryFactor?this._quality:1;t+=e.usedMemory*i,s+=e.unloadedMemory*i}});const r=null==this._warnMemoryUsage||Math.round(10*t)!==Math.round(10*this._warnMemoryUsage),o=1048576*this.maxMemory;if(t>o&&r){this._warnMemoryUsage=t;const e=e=>(e/1048576).toLocaleString(void 0,{maximumFractionDigits:1})+" MB",r=Math.round(100*this._quality);i.getLogger(this).warn(`Memory Limit exceeded! Limit: ${e(o)} Current: ${e(t)} Projected: ${e(t+s)} Quality: ${r}%`)}this._usedMemory=t/o,this._predictedMemory=(t+s)/o;const a=o-t;this._cacheStorage.maxSize=Math.max(0,a+1048576*this.additionalCacheMemory)}get test(){}};e([h({constructOnly:!0})],w.prototype,"view",void 0),e([h()],w.prototype,"maxMemory",null),e([h()],w.prototype,"additionalCacheMemory",null),e([h({readOnly:!0})],w.prototype,"memoryFactor",null),e([h({readOnly:!0})],w.prototype,"updating",null),e([h({readOnly:!0})],w.prototype,"usedMemory",null),e([h({readOnly:!0})],w.prototype,"usedCacheMemory",null),e([h()],w.prototype,"_quality",void 0),e([h()],w.prototype,"_usedMemory",void 0),e([h()],w.prototype,"_updating",void 0),e([h()],w.prototype,"_stableQuality",void 0),e([h()],w.prototype,"_maxMemory",void 0),e([h()],w.prototype,"_additionalCacheMemory",void 0),w=e([d("esri.views.3d.support.MemoryController")],w);export{u as minQuality,m as newMemoryController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{C as e}from"../../../../../chunks/Compositing.glsl.js";import{CompositingTechnique as t}from"../../shaders/CompositingTechnique.js";import{CompositingTechniqueConfiguration as i}from"../../shaders/CompositingTechniqueConfiguration.js";class r{constructor(r,s=0){this._techniques=r,this._parameters=new e,this._configuration=new i,this._configuration.blitMode=s,r.precompile(t,this._configuration)}blit(e,i,r,s){e.bindFramebuffer(r.fbo),e.setClearColor(0,0,0,1),e.clear(16384),this._parameters.texture=i
|
|
5
|
+
import{C as e}from"../../../../../chunks/Compositing.glsl.js";import{CompositingTechnique as t}from"../../shaders/CompositingTechnique.js";import{CompositingTechniqueConfiguration as i}from"../../shaders/CompositingTechniqueConfiguration.js";class r{constructor(r,s=0){this._techniques=r,this._parameters=new e,this._configuration=new i,this._configuration.blitMode=s,r.precompile(t,this._configuration)}blit(e,t,i,r){this.blitTexture(e,t.getTexture(),i,r)}blitTexture(e,i,r,s){e.bindFramebuffer(r.fbo),e.setClearColor(0,0,0,1),e.clear(16384),this._parameters.texture=i;const o=this._techniques.get(t,this._configuration);e.bindTechnique(o,s,this._parameters),e.screen.draw()}blend(e,i,r,s,o=1){this._configuration.hasOpacityFactor=o<1;const n=this._techniques.get(t,this._configuration);return!!n.compiled&&(e.bindFramebuffer(r.fbo),this._parameters.texture=i.getTexture(),this._parameters.opacity=o,e.bindTechnique(n,s,this._parameters),e.screen.draw(),!0)}}export{r as Blit};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/
|
|
5
|
+
import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./BloomPresets.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{B as BloomCompositionPassParameters,b as build,d as defaultCompositionParameters}from"../../../../../chunks/BloomComposition.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as
|
|
5
|
+
import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as o}from"../../../../../chunks/BloomComposition.glsl.js";import{Pos2Locations as s}from"../../lib/DefaultVertexBufferLayouts.js";import{ColorAttachment0 as i,ColorAttachment1 as t}from"../../../../webgl/enums.js";import{makePipelineState as m,defaultColorWrite as l}from"../../../../webgl/renderState.js";class a extends r{constructor(r,i){super(r,i,new e(o,()=>import("./BloomComposition.glsl.js")),s)}initializePipeline(){return m({colorWrite:l,drawBuffers:{buffers:[i,t]}})}}export{a as BloomCompositionTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as o,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as o,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as a}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{InternalRenderCategory as n}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{B as l}from"../../../../../chunks/BloomBlur.glsl.js";import{BloomBlurTechnique as c}from"./BloomBlurTechnique.js";import{BloomBlurTechniqueConfiguration as h}from"./BloomBlurTechniqueConfiguration.js";import{B as u}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechnique as p}from"./BloomCompositionTechnique.js";import{BloomCompositionTechniqueConfiguration as b}from"./BloomCompositionTechniqueConfiguration.js";import{blurRadiusPresets as d,lodFactorsPresets as g,normalizePreset as _}from"./BloomPresets.glsl.js";import{ColorAttachment1 as f,DepthStencilAttachment as P}from"../../../../webgl/enums.js";let T=class extends m{constructor(e){super(e),this.consumes={required:[n.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=n.TRANSPARENT_ENVIRONMENT,this._blurHorizontalConfiguration=new h,this._blurVerticalConfiguration=new h,this._compositionConfiguration=new b,this._compositionParameters=new u,this._blurParameters=new l,this._blurScale=3.06,this._glowEnabled=!1,this._bloomResults=new Array;e.view.stage.renderView.techniques.precompile(p,this._compositionConfiguration)}initialize(){this.addHandles([o(()=>this._updateFogParameters(),()=>{},r),o(()=>this.view.qualitySettings.bloom,e=>{this._glowEnabled=e,this.precompile(),this.requestRender(1)},r)])}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=d[e.type];else{const o="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(d.cloudy,d[e.type],o)}this._compositionParameters.lodFactors=g[e.type].far,this._compositionParameters.lodFactorsFront=g[e.type].near,this.requestRender(1)}precompile(){this._glowEnabled&&(this.techniques.precompile(c,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.bloomStage=1,this.techniques.precompile(c,this._blurVerticalConfiguration)),this._compositionConfiguration.blurEnabled=this._glowEnabled,this.techniques.precompile(p,this._compositionConfiguration)}render(e){const t=e.find(({name:e})=>e===n.TRANSPARENT_ENVIRONMENT),o=t.getAttachment(f)?.attachment;if(!o)return t;const r=t.getAttachment(P);if(!this._glowEnabled){const e=this.techniques.get(p,this._compositionConfiguration);if(!e.compiled)return this.requestRender(1),t;const i=t.getTexture(),s=this.fboCache,{fullWidth:a,fullHeight:n}=this.bindParameters.camera,m=this.renderingContext,l=s.acquire(i.descriptor.width,i.descriptor.height,this.produces);return this._prepareFBO(l,a,n),this._compositionParameters.color=i,this._compositionParameters.emission=o,m.bindTechnique(e,this.bindParameters,this._compositionParameters),m.screen.draw(),l.attachDepth(r),l.attachColor(t.getAttachment(f),f),l}const i=this.techniques.get(c,this._blurHorizontalConfiguration),s=this.techniques.get(c,this._blurVerticalConfiguration),a=this.techniques.get(p,this._compositionConfiguration);if(!i.compiled||!s.compiled||!a.compiled)return this.requestRender(1),t;const m=t.getTexture(),l=this.fboCache,{fullWidth:h,fullHeight:u}=this.bindParameters.camera,b=this.renderingContext;let d=o,g=Math.ceil(h/2),_=Math.ceil(u/2);const T=5,R=this._blurParameters.blurRadius;for(let n=0;n<T;n++){const e=l.acquire(g,_,"bloomHorizontal",8);this._blurParameters.color=d,this._prepareFBO(e,g,_),b.bindTechnique(i,this.bindParameters,this._blurParameters),b.screen.draw();const t=l.acquire(g,_,"bloomVertical",8);this._blurParameters.color=e.getTexture(),this._prepareFBO(t,g,_),b.bindTechnique(s,this.bindParameters,this._blurParameters),b.screen.draw(),e.release(),this._bloomResults[n]=t,g=Math.ceil(g/2),_=Math.ceil(_/2),d=this._bloomResults[n].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=R,this._compositionParameters.color=m,this._compositionParameters.emission=o,this._compositionParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._compositionParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._compositionParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._compositionParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._compositionParameters.bloomTexture4=this._bloomResults[4].getTexture();const C=l.acquire(m.descriptor.width,m.descriptor.height,this.produces);return C.acquireColor(f,8,"emissive bloom"),this._prepareFBO(C,h,u,!0),b.bindTechnique(a,this.bindParameters,this._compositionParameters),b.screen.draw(),this._bloomResults.forEach(e=>e.release()),C.attachDepth(r),C}_prepareFBO(e,t,o,r=!1){const i=this.renderingContext;i.bindFramebuffer(e.fbo),i.setViewport(0,0,t,o),i.setClearColor(0,0,0,0),i.clear(16384),r&&i.clearBuffer(1,a)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setLodFactors:e=>{this._compositionParameters.lodFactors=_(e)},toggleTonemapping:e=>{this._compositionConfiguration.tonemappingEnabled=e,this.requestRender(1)}}}};e([i()],T.prototype,"consumes",void 0),e([i()],T.prototype,"produces",void 0),T=e([s("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],T);export{T as BloomRenderNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{watch as s,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{property as
|
|
5
|
+
import{__decorate as e}from"tslib";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{watch as s,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as n}from"../../../../../support/requestImageUtils.js";import{RenderCategory as c,InternalRenderCategory as h}from"../../../webgl.js";import u from"../../../webgl/RenderNode.js";import{SMAABlendWeightsTechnique as l}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as m}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as d}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as p}from"./SMAAPassParameters.js";import{Texture as f}from"../../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../../webgl/TextureDescriptor.js";let T=class extends u{constructor(e){super(e),this.produces="disabled",this.consumes={required:[h.ANTIALIASING],optional:[c.COMPOSITE]},this._areaTexture=null,this._searchTexture=null,this._smaaParameters=new p}initialize(){this.addHandles([s(()=>this.isEnabled(),e=>e?this.enable():this.disable(),i)])}async enable(){if(this.produces=h.ANTIALIASING,this.destroyed||this._abortController||this._areaTexture&&this._searchTexture)return;this._abortController=new AbortController;const e=this._abortController.signal;try{const r=await import("./SMAAData.js");if(this.destroyed)return;if(await this._loadTextures(r,e),this.destroyed)return;this.requestRender(1)}catch(r){console.error("SMAA err:",r)}this.destroyed||(this._abortController=null)}async _loadTextures(e,r){t(r);const[s,i]=await Promise.allSettled([n(e.areaTexture,{signal:r}),n(e.searchTexure,{signal:r})]);if(t(r),"fulfilled"!==s.status||"fulfilled"!==i.status)return;const o=this.renderingContext;this._areaTexture=x(o,9729,6407,s.value),this._searchTexture=x(o,9728,6409,i.value)}disable(){this.produces="disabled"}destroy(){this._searchTexture=r(this._searchTexture),this._areaTexture=r(this._areaTexture)}precompile(){this.techniques.precompile(d),this.techniques.precompile(l),this.techniques.precompile(m)}render(e){const r=e.find(({name:e})=>e===h.ANTIALIASING);if(!this._areaTexture||!this._searchTexture)return this.requestRender(1),r;const t=this.techniques.get(d),s=this.techniques.get(l),i=this.techniques.get(m);if(!t.compiled||!s.compiled||!i.compiled)return this.requestRender(1),r;const o=e.find(({name:e})=>e===c.COMPOSITE);if(!o)return r;const a=o.fbo.width,n=o.fbo.height,u=this.renderingContext;u.setViewport(0,0,a,n);const p=this.fboCache.acquire(a,n,"smaa edges",2);u.bindFramebuffer(p.fbo),u.setClearColor(0,0,0,1),u.clear(16384),this._smaaParameters.color=o.getTexture();const f=this.bindParameters;u.bindTechnique(t,f,this._smaaParameters),u.screen.draw();const b=this.fboCache.acquire(a,n,"smaa blend");return u.bindFramebuffer(b.fbo),u.setClearColor(0,0,1,1),u.clear(16384),this._smaaParameters.inputTexture=p.getTexture(),this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,u.bindTechnique(s,f,this._smaaParameters),u.screen.draw(),p.release(),u.bindFramebuffer(r.fbo),u.setClearColor(0,1,0,1),u.clear(16384),this._smaaParameters.inputTexture=b.getTexture(),u.bindTechnique(i,f,this._smaaParameters),u.screen.draw(),b.release(),r}};function x(e,r,t,s){const i=new b(s.width,s.height);return i.pixelFormat=t,i.wrapMode=33071,i.samplingMode=r,new f(e,i,s)}e([o()],T.prototype,"produces",void 0),e([o()],T.prototype,"consumes",void 0),e([o({constructOnly:!0})],T.prototype,"isEnabled",void 0),e([o()],T.prototype,"_abortController",void 0),T=e([a("esri.views.3d.webgl-engine.effects.smaa.SMAA")],T);export{T as SMAA};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import has from"../../../../core/has.js";import{nextPowerOfTwo as t}from"../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{ortho as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderCategory as a,InternalRenderCategory as n}from"../../webgl.js";import{glLayout as c}from"../../support/buffer/glUtil.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import u from"../../webgl/RenderCamera.js";import d from"../../webgl/RenderNode.js";import{ShaderOutputConfiguration as p}from"../core/shaderLibrary/ShaderOutputConfiguration.js";import{VertexArrayObject as m}from"./VertexArrayObject.js";import{C as g}from"../../../../chunks/CutFillDepth.glsl.js";import{CutFillDepthTechnique as f}from"../shaders/CutFillDepthTechnique.js";import{C as _}from"../../../../chunks/CutFillReduction.glsl.js";import{CutFillReductionTechnique as b}from"../shaders/CutFillReductionTechnique.js";import{C as F}from"../../../../chunks/CutFillTargetDepth.glsl.js";import{CutFillTargetDepthTechnique as w}from"../shaders/CutFillTargetDepthTechnique.js";import{PrimitiveType as C,DataType as T}from"../../../webgl/enums.js";import{VertexBuffer as x}from"../../../webgl/VertexBuffer.js";let j=class extends d{constructor(e){super(e),this.consumes={required:[a.TRANSPARENT]},this.produces=n.CUTFILL_DEPTH,this._cutFillTargetDepthConfiguration=new p,this._cutFillTargetDepthParameters=new F,this._cutFillDepthParameters=new g,this._cutFillReductionParameters=new _,this.needsRender=!1,this.done=!0,this._localOrigin=o(),this._maxTextureSize=4096,this._width=0,this._height=0,this._reducedWidth=0,this._reducedHeight=0,this._depthFormat=12,this._colorFormat=10,this._targetVao=null}initialize(){this._maxTextureSize=Math.min(has("esri-mobile")?1024:this._maxTextureSize,this.fboCache.rctx.parameters.maxTextureSize),this._cutFillTargetDepthConfiguration.output=8}destroy(){this._targetVao=r(this._targetVao)}precompile(){this.techniques.precompile(w,this._cutFillTargetDepthConfiguration),this.techniques.precompile(f),this.techniques.precompile(b),this.view.stage.renderer.precompileCutFill()}render(e){const t=e.find(({name:e})=>e===n.CUTFILL_DEPTH);if(!this._orthographicCamera||!this._targetVao||!this.needsRender)return t;const r=this.techniques.get(w,this._cutFillTargetDepthConfiguration),i=this.techniques.get(f),s=this.techniques.get(b);if(!r.compiled||!i.compiled||!s.compiled)return this.requestRender(1),t;this.needsRender=!1;const h=this.renderingContext,o=this.fboCache,a=h.getViewport(),c=o.acquire(this._width,this._height,"cutfill reference depth",this._depthFormat);h.bindFramebuffer(c.fbo),h.clear(256),this.view.stage.renderer.renderCutFillReferenceDepth(this._orthographicCamera);const l=o.acquire(this._width,this._height,"cutfill target depth",this._depthFormat);h.bindFramebuffer(l.fbo),h.setViewport(0,0,this._width,this._height),h.setClearDepth(1),h.clear(256),this._cutFillTargetDepthParameters.origin=this._localOrigin,this._cutFillTargetDepthParameters.cutFillCamera=this._orthographicCamera,h.bindTechnique(r,this.bindParameters,this._cutFillTargetDepthParameters),h.bindVAO(this._targetVao),h.drawArrays(C.TRIANGLES,0,this._targetVao.vertexCount("geometry"));let u=o.acquire(this._width,this._height,"cutfill reduction even",this._colorFormat),d=o.acquire(this._width,this._height,"cutfill reduction odd",this._colorFormat);this._cutFillDepthParameters.referenceDepthTexture=c.depthTexture,this._cutFillDepthParameters.targetDepthTexture=l.depthTexture,h.bindFramebuffer(u.fbo),h.bindTechnique(i,this.bindParameters,this._cutFillDepthParameters),h.clear(16384),h.screen.draw(),c.release(),l.release();let p=this._width,m=this._height;const g=Math.ceil(Math.log2(Math.min(p,m)));for(let n=0;n<g;n++)p=Math.ceil(p/2),m=Math.ceil(m/2),this._cutFillReductionParameters.depthTexture=u.getTexture(),this._prepareFBO(d,p,m),h.bindTechnique(s,this.bindParameters,this._cutFillReductionParameters),h.screen.draw(),[u,d]=[d,u];return this._buffer=new Float32Array(p*m*2),u.fbo?.readPixels(0,0,p,m,33319,T.FLOAT,this._buffer),this._reducedWidth=p,this._reducedHeight=m,u.release(),d.release(),h.setViewport(a.x,a.y,a.width,a.height),this.done=!0,t}setup(e,i){const s=this.renderingContext,{cameraDimensions:{width:h,height:o},localOriginRenderSpace:a}=e,n=this._maxTextureSize,c=o/h,l=h>o?n:n/c,u=h>o?n*c:n;this._width=t(l),this._height=t(u);const d=[
|
|
5
|
+
import{__decorate as e}from"tslib";import has from"../../../../core/has.js";import{nextPowerOfTwo as t}from"../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{ortho as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderCategory as a,InternalRenderCategory as n}from"../../webgl.js";import{glLayout as c}from"../../support/buffer/glUtil.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import u from"../../webgl/RenderCamera.js";import d from"../../webgl/RenderNode.js";import{ShaderOutputConfiguration as p}from"../core/shaderLibrary/ShaderOutputConfiguration.js";import{VertexArrayObject as m}from"./VertexArrayObject.js";import{C as g}from"../../../../chunks/CutFillDepth.glsl.js";import{CutFillDepthTechnique as f}from"../shaders/CutFillDepthTechnique.js";import{C as _}from"../../../../chunks/CutFillReduction.glsl.js";import{CutFillReductionTechnique as b}from"../shaders/CutFillReductionTechnique.js";import{C as F}from"../../../../chunks/CutFillTargetDepth.glsl.js";import{CutFillTargetDepthTechnique as w}from"../shaders/CutFillTargetDepthTechnique.js";import{PrimitiveType as C,DataType as T}from"../../../webgl/enums.js";import{VertexBuffer as x}from"../../../webgl/VertexBuffer.js";let j=class extends d{constructor(e){super(e),this.consumes={required:[a.TRANSPARENT]},this.produces=n.CUTFILL_DEPTH,this._cutFillTargetDepthConfiguration=new p,this._cutFillTargetDepthParameters=new F,this._cutFillDepthParameters=new g,this._cutFillReductionParameters=new _,this.needsRender=!1,this.done=!0,this._localOrigin=o(),this._maxTextureSize=4096,this._width=0,this._height=0,this._reducedWidth=0,this._reducedHeight=0,this._depthFormat=12,this._colorFormat=10,this._targetVao=null}initialize(){this._maxTextureSize=Math.min(has("esri-mobile")?1024:this._maxTextureSize,this.fboCache.rctx.parameters.maxTextureSize),this._cutFillTargetDepthConfiguration.output=8}destroy(){this._targetVao=r(this._targetVao)}precompile(){this.techniques.precompile(w,this._cutFillTargetDepthConfiguration),this.techniques.precompile(f),this.techniques.precompile(b),this.view.stage.renderer.precompileCutFill()}render(e){const t=e.find(({name:e})=>e===n.CUTFILL_DEPTH);if(!this._orthographicCamera||!this._targetVao||!this.needsRender)return t;const r=this.techniques.get(w,this._cutFillTargetDepthConfiguration),i=this.techniques.get(f),s=this.techniques.get(b);if(!r.compiled||!i.compiled||!s.compiled)return this.requestRender(1),t;this.needsRender=!1;const h=this.renderingContext,o=this.fboCache,a=h.getViewport(),c=o.acquire(this._width,this._height,"cutfill reference depth",this._depthFormat);h.bindFramebuffer(c.fbo),h.clear(256),this.view.stage.renderer.renderCutFillReferenceDepth(this._orthographicCamera);const l=o.acquire(this._width,this._height,"cutfill target depth",this._depthFormat);h.bindFramebuffer(l.fbo),h.setViewport(0,0,this._width,this._height),h.setClearDepth(1),h.clear(256),this._cutFillTargetDepthParameters.origin=this._localOrigin,this._cutFillTargetDepthParameters.cutFillCamera=this._orthographicCamera,h.bindTechnique(r,this.bindParameters,this._cutFillTargetDepthParameters),h.bindVAO(this._targetVao),h.drawArrays(C.TRIANGLES,0,this._targetVao.vertexCount("geometry"));let u=o.acquire(this._width,this._height,"cutfill reduction even",this._colorFormat),d=o.acquire(this._width,this._height,"cutfill reduction odd",this._colorFormat);this._cutFillDepthParameters.referenceDepthTexture=c.depthTexture,this._cutFillDepthParameters.targetDepthTexture=l.depthTexture,h.bindFramebuffer(u.fbo),h.bindTechnique(i,this.bindParameters,this._cutFillDepthParameters),h.clear(16384),h.screen.draw(),c.release(),l.release();let p=this._width,m=this._height;const g=Math.ceil(Math.log2(Math.min(p,m)));for(let n=0;n<g;n++)p=Math.ceil(p/2),m=Math.ceil(m/2),this._cutFillReductionParameters.depthTexture=u.getTexture(),this._prepareFBO(d,p,m),h.bindTechnique(s,this.bindParameters,this._cutFillReductionParameters),h.screen.draw(),[u,d]=[d,u];return this._buffer=new Float32Array(p*m*2),u.fbo?.readPixels(0,0,p,m,33319,T.FLOAT,this._buffer),this._reducedWidth=p,this._reducedHeight=m,u.release(),d.release(),h.setViewport(a.x,a.y,a.width,a.height),this.done=!0,t}setup(e,i){const s=this.renderingContext,{cameraDimensions:{width:h,height:o},localOriginRenderSpace:a}=e,n=this._maxTextureSize,c=o/h,l=h>o?n:n/c,u=h>o?n*c:n;this._width=t(l),this._height=t(u);const d=[this._width,this._height];this._orthographicCamera=this._createCamera(e,d),this._targetVao=r(this._targetVao),this._targetVao=R(s,i),this._localOrigin=a,this.done=!1}start(){0!==this._width&&0!==this._height&&(this.needsRender=!0)}getDepth(){let e=0,t=0;for(let r=0;r<this._reducedWidth;r++)for(let i=0;i<this._reducedHeight;i++){const s=r+i*this._reducedHeight;e+=this._buffer?.[2*s]??0,t+=this._buffer?.[2*s+1]??0}return{cut:e,fill:t}}get width(){return this._width}get height(){return this._height}get updating(){return this.needsRender||!this.done}_prepareFBO(e,t,r){const i=this.renderingContext;i.bindFramebuffer(e.fbo),i.setViewport(0,0,t,r),i.setClearColor(0,0,0,0),i.clear(16384)}_createCamera(e,t){const{cameraPositionRenderSpace:r,localOriginRenderSpace:i,northVector:s,cameraDimensions:{width:o,height:a},cameraNearFar:{near:n,far:c}}=e,l=new u({eye:r,center:i,up:s,near:n,far:c});return l.viewport=[0,0,t[0],t[1]],h(l.projectionMatrix,-o/2,o/2,-a/2,a/2,n,c),l}};e([i()],j.prototype,"consumes",void 0),e([i()],j.prototype,"produces",void 0),e([i()],j.prototype,"needsRender",void 0),e([i()],j.prototype,"done",void 0),e([i()],j.prototype,"updating",null),j=e([s("esri.views.3d.webgl-engine.lib.CutFillDepth")],j);const D=l().vec3f("position").freeze();function R(e,t){const{positions:r,indices:i}=t,s=D.createBuffer(i.length),h=s.position;for(let a=0;a<i.length;++a){const e=3*i[a];h.set(a,0,r[e]),h.set(a,1,r[e+1]),h.set(a,2,r[e+2])}const o=new x(e,c(D),s.buffer);return new m(e,o)}class P{constructor(e,t){this.positions=e,this.indices=t}}export{j as CutFillDepth,P as TargetGeometry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{disposeMaybe as e,destroyMaybe as i}from"../../../../core/maybe.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{__decorate as t}from"tslib";import{disposeMaybe as e,destroyMaybe as i}from"../../../../core/maybe.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{multiply as o,fromTranslation as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as u,a as f}from"../../../../chunks/vec32.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderCategory as p}from"../../webgl.js";import c from"../../webgl/RenderNode.js";import{Pos2Locations as _}from"./DefaultVertexBufferLayouts.js";import{TaskPriority as d}from"../../../support/Scheduler.js";import{Yield as l}from"../../../support/Yield.js";import{DataType as m,PixelType as g}from"../../../webgl/enums.js";import{makePipelineState as x,defaultColorWrite as v}from"../../../webgl/renderState.js";import{Sync as y}from"../../../webgl/Sync.js";import{Texture as T}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";let B=class extends c{constructor(t){super(t),this.category=p.COMPOSITE,this.readyToRun=!1,this.done=!0,this._origin=a(),this._textureWidth=256,this._uploadBuffer=new Float32Array(3*this._textureWidth),this._counter=0,this._width=0,this._height=0,this._pixelBufferSize=0,this._pipeline=x({colorWrite:v}),this._format=0}initialize(){const t=this.view.resourceController.scheduler.registerTask(d.GRAPHICS_CORE,this);this.addHandles(t),this.produces="disabled",this.consumes.required=[this.category],this.formatOverride&&(this._format=this.formatOverride)}destroy(){this._program=e(this._program);const t=this.gl;this._sync=i(this._sync),this._pixelBuffer&&(t.deleteBuffer(this._pixelBuffer),this._pixelBuffer=null,this._pixelBufferSize=0),this._texture=e(this._texture)}precompile(){this._ensureProgram(this.renderingContext)}render(t){const e=t.find(({name:t})=>t===this.category);if(this._sync)return e;this.produces="disabled";const i=this.renderingContext,r=this.gl,s=e.getTexture(r.DEPTH_STENCIL_ATTACHMENT);if(!s)return e;const h=this.view.stage.renderer.fboCache.acquire(this._width,this._height,"hud visibility",9);i.bindFramebuffer(h.fbo),i.setPipelineState(this._pipeline);const u=this._ensureProgram(i);i.useProgram(u);const f=0;i.bindTexture(s,f),u.setUniform1i("depthTex",f);const a=1;return i.bindTexture(this._texture,a),u.setUniform1i("positionTex",a),o(C,this.camera.viewMatrix,n(C,this._origin)),u.setUniformMatrix4fv("view",C),u.setUniformMatrix4fv("proj",this.camera.projectionMatrix),u.setUniform1i("count",this._counter),i.screen.draw(),this._pixelBuffer||(this._pixelBuffer=r.createBuffer()),0===this._format&&(this._format=6403===r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT)&&r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)===m.FLOAT?6403:6408),this._pixelBufferSize=this._width*this._height*(6403===this._format?4:16),r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pixelBuffer),r.bufferData(r.PIXEL_PACK_BUFFER,this._pixelBufferSize,r.STREAM_READ),r.readPixels(0,0,this._width,this._height,this._format,m.FLOAT,0),this._sync=new y(r),h.release(),setTimeout(()=>this.readyToRun=!0,0),e}runTask(){if(!this._sync)return void(this.readyToRun=!1);try{if(!this._sync.poll())return l}catch(e){return this.readyToRun=!1,void(this._sync=i(this._sync))}this.readyToRun=!1,this._sync=i(this._sync);const t=this.gl;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pixelBuffer),this._cpuBuffer=new Float32Array(this._width*this._height*(6403===this._format?1:4)),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._cpuBuffer),t.bindBuffer(t.PIXEL_PACK_BUFFER,null),this.done=!0}init(t,e){const i=this._textureWidth;if(this._width=i,this._height=Math.ceil(t/i),this._counter=0,this._texture?.dispose(),0===this._height)return;const r=new w(this._width,this._height);r.pixelFormat=6407,r.dataType=g.FLOAT,r.samplingMode=9728,this._texture=new T(this.renderingContext,r),this.done=!1,u(this._origin,Math.fround(e[0]),Math.fround(e[1]),Math.fround(e[2]))}addPosition(t){const e=this._width;if(this._counter>=e*this._height)return-1;const i=this._counter%e;return f(j,t,this._origin),this._uploadBuffer[3*i+0]=j[0],this._uploadBuffer[3*i+1]=j[1],this._uploadBuffer[3*i+2]=j[2],i===e-1&&this._flush(),this._counter++}start(){if(0===this._width||0===this._height)return;const t=this._width;this._counter%t>0&&this._flush(),this.produces=this.category,this.requestRender(1)}getOcclusion(t){return this._cpuBuffer?.[6403===this._format?t:4*t]??-1}get usedMemory(){return(this._texture?.usedMemory??0)+this._pixelBufferSize+4*(this._uploadBuffer?.length??0)+4*(this._cpuBuffer?.length??0)}_flush(){const t=this._width,e=Math.floor(this._counter/t);this._texture?.updateData(0,0,e,t,1,this._uploadBuffer)}_ensureProgram(t){return this._program??=t.programCache.acquire(P,b,_),this._program}};t([r()],B.prototype,"category",void 0),t([r()],B.prototype,"formatOverride",void 0),t([r()],B.prototype,"readyToRun",void 0),t([r()],B.prototype,"done",void 0),B=t([s("esri.views.3d.webgl-engine.lib.GPUPointOcclusionQuery")],B);const P="#version 300 es\nprecision highp float;\nin vec2 position;\n\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n}",b="#version 300 es\nprecision highp float;\nout highp vec4 fragColor;\n\nuniform highp mat4 proj;\nuniform highp mat4 view;\n\nuniform highp int count;\n\nuniform highp sampler2D depthTex;\nuniform highp sampler2D positionTex;\n\nfloat linearizeDepth(float depth) {\n float depthNdc = depth * 2.0 - 1.0;\n float c1 = proj[3][2];\n float c2 = proj[2][2];\n return -c1 / (depthNdc + c2 + 1e-7);\n}\n\nvoid main() {\n int u = int(floor(gl_FragCoord.x));\n int v = int(floor(gl_FragCoord.y));\n if (u + v * textureSize(positionTex, 0).x >= count) {\n fragColor = vec4(-1);\n return;\n }\n vec4 posWorld = vec4(texelFetch(positionTex, ivec2(u, v), 0).rgb, 1.0);\n\n vec4 posView = view * posWorld;\n vec4 projected = proj * posView;\n\n vec3 clipPos = projected.xyz / projected.w;\n\n if (clipPos.x < -1.0 || clipPos.x > 1.0 || clipPos.y < -1.0 || clipPos.y > 1.0) {\n fragColor = vec4(-1);\n return;\n }\n\n vec3 uvDepth = 0.5 * clipPos + vec3(0.5);\n\n float depth = texture(depthTex, uvDepth.xy).r;\n\n if (uvDepth.z <= depth) {\n fragColor = vec4(0);\n return;\n }\n\n fragColor = vec4(linearizeDepth(depth) - linearizeDepth(uvDepth.z));\n}\n",j=a(),C=h();export{B as GPUPointOcclusionQuery};
|