@arcgis/core 4.33.0-next.20250414 → 4.33.0-next.20250416
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/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/geometry/functions.js +1 -1
- package/arcade/geometry/operatorsWorker.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0252d853419adc203f04.js +1 -0
- package/assets/esri/core/workers/chunks/030f5b9a9757eead436b.js +1 -0
- package/assets/esri/core/workers/chunks/{3a84ee5d0434362286a6.js → 07f206719763173faa8d.js} +1 -1
- package/assets/esri/core/workers/chunks/{4403b3f08907e88d0d91.js → 0b34c8356b8492ce7b16.js} +1 -1
- package/assets/esri/core/workers/chunks/{fb65796296b0422cf266.js → 272a309760dacb13dee3.js} +1 -1
- package/assets/esri/core/workers/chunks/{fe1ad9ed0d32f557e5a3.js → 29283c19e1ccdc6cfbde.js} +33 -33
- package/assets/esri/core/workers/chunks/2bdbf678d4f013543dbb.js +1 -0
- package/assets/esri/core/workers/chunks/2fd5b48976cefe7cc0ab.js +1 -0
- package/assets/esri/core/workers/chunks/321f6f6d268755482c27.js +1 -0
- package/assets/esri/core/workers/chunks/{b7a1185ac49480fc1410.js → 35a59f0df087e3c588a9.js} +1 -1
- package/assets/esri/core/workers/chunks/{626e33ece2c49d40f6cd.js → 42aab2a336ee22fd9055.js} +1 -1
- package/assets/esri/core/workers/chunks/{083548c5eea5aca6404c.js → 45d64b72b7e93e9c64d7.js} +1 -1
- package/assets/esri/core/workers/chunks/56fdbe61ac84b036a1a2.js +1 -0
- package/assets/esri/core/workers/chunks/57fd5a52be41ddd6a11b.js +1 -0
- package/assets/esri/core/workers/chunks/5fb9bb3ac2f60dbd59c4.js +1 -0
- package/assets/esri/core/workers/chunks/{0a675f9f69b8b13b7443.js → 601fc99426f0213b0769.js} +1 -1
- package/assets/esri/core/workers/chunks/68d7babbe7e0d934e056.js +1 -0
- package/assets/esri/core/workers/chunks/6fc39a58f3011291c602.js +1 -0
- package/assets/esri/core/workers/chunks/8221f2e540abe1e0f048.js +1 -0
- package/assets/esri/core/workers/chunks/83e13baab4b90a88d967.js +1 -0
- package/assets/esri/core/workers/chunks/851baab753d9c8e967bd.js +1 -0
- package/assets/esri/core/workers/chunks/8ba7d44eff348004f084.js +1 -0
- package/assets/esri/core/workers/chunks/{9050dad7e4f093568026.js → 97267911d03c2426d319.js} +1 -1
- package/assets/esri/core/workers/chunks/984c5047ab1fa632ca09.js +1 -0
- package/assets/esri/core/workers/chunks/{5aae4e127e888f69435a.js → 9a1c058d3ecd1db0e996.js} +1 -1
- package/assets/esri/core/workers/chunks/9b21dc4659922cc577cb.js +1 -0
- package/assets/esri/core/workers/chunks/{ff62b813fff4a015a8a6.js → a4239e301728d594afa5.js} +1 -1
- package/assets/esri/core/workers/chunks/aca3ccb9599bcc444617.js +1 -0
- package/assets/esri/core/workers/chunks/{a3421383e48379012c9c.js → b6dd25bccb9f6e19c18e.js} +1 -1
- package/assets/esri/core/workers/chunks/bf4947fe446dcb477031.js +1 -0
- package/assets/esri/core/workers/chunks/d053c23fce77fb77cc00.js +1 -0
- package/assets/esri/core/workers/chunks/e31bb256921807464715.js +1 -0
- package/assets/esri/core/workers/chunks/{8aae03e347ab18ae6ee2.js → e3d25d027885eb1a415f.js} +1 -1
- package/assets/esri/core/workers/chunks/{d88544ac332be633e3fe.js → e64e0c3240f8e577a61c.js} +1 -1
- package/assets/esri/core/workers/chunks/e9fba86036b8fe700a41.js +1 -0
- package/assets/esri/themes/base/widgets/_Expand.scss +6 -1
- package/assets/esri/themes/base/widgets/_TimeSlider.scss +97 -107
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ar.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_bg.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_bs.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ca.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_cs.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_da.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_de.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_el.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_en.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_es.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_et.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_fi.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_fr.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_he.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_hr.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_hu.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_id.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_it.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ja.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ko.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_lt.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_lv.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_nl.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_no.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_pl.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_pt-BR.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_pt-PT.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ro.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ru.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sk.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sl.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sr.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sv.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_th.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_tr.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_uk.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_vi.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_zh-CN.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_zh-HK.json +1 -1
- package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_zh-TW.json +1 -1
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ar.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_bg.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_bs.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ca.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_cs.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_da.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_de.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_el.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_es.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_et.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_fi.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_fr.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_he.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_hr.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_hu.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_id.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_it.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ja.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ko.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_lt.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_lv.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_nl.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_no.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_pl.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_pt-BR.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_pt-PT.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ro.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ru.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sk.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sl.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sr.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sv.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_th.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_tr.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_uk.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_vi.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_zh-CN.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_zh-HK.json +1 -0
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_zh-TW.json +1 -0
- package/chunks/BloomComposition.glsl.js +4 -13
- package/chunks/Theme.js +1 -1
- package/chunks/Tick.js +1 -1
- package/geometry/support/HalfFloatArray.js +1 -1
- package/geometry/support/MeshTexture.js +1 -1
- package/geometry/support/buffer/BufferView.js +1 -1
- package/geometry/support/float16.js +1 -1
- package/interfaces.d.ts +266 -139
- package/layers/FeatureLayer.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
- package/layers/graphics/sources/OGCFeatureSource.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/support/capabilities.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/package.json +2 -2
- package/support/revision.js +1 -1
- package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
- package/views/3d/layers/DrapedSubView3D.js +1 -1
- package/views/3d/layers/DynamicLayerView3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +5 -0
- package/views/3d/layers/ImageryLayerView3D.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/WMSLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.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/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/LabelDeconflictor.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/MeshFastUpdateProcessor.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomPresets.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/ContentObjectType.js +1 -1
- package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
- package/views/3d/webgl-engine/lib/IntersectableGeometry.js +5 -0
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
- package/views/3d/webgl-engine/lib/RenderContext.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RendererBase.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
- package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/Search/types.d.ts +10 -0
- package/widgets/Search/types.js +5 -0
- package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
- package/widgets/TimeSlider/css.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/support/SelectionList/FeatureItem.js +5 -0
- package/widgets/support/SelectionList/GroupLayerItem.js +5 -0
- package/widgets/support/SelectionList/{SelectionListItemBase.js → ItemBase.js} +1 -1
- package/widgets/support/SelectionList/LayerItem.js +5 -0
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList/selectionListUtils.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0db4c0071282dd94f3b2.js +0 -1
- package/assets/esri/core/workers/chunks/10631680abe7607616ca.js +0 -1
- package/assets/esri/core/workers/chunks/277b61af8982092a4c81.js +0 -1
- package/assets/esri/core/workers/chunks/290aed587aa647226b46.js +0 -1
- package/assets/esri/core/workers/chunks/345f428dfcaa594ee617.js +0 -1
- package/assets/esri/core/workers/chunks/358a3a9326615d5e6d3b.js +0 -1
- package/assets/esri/core/workers/chunks/39fbac918ebd1b0e3a18.js +0 -1
- package/assets/esri/core/workers/chunks/544771f64a86b541d5bb.js +0 -1
- package/assets/esri/core/workers/chunks/6275114e8ed9dd31465d.js +0 -1
- package/assets/esri/core/workers/chunks/72b5e43741ce3a0da8f7.js +0 -1
- package/assets/esri/core/workers/chunks/72d7e45e7eb28f2cc0b0.js +0 -1
- package/assets/esri/core/workers/chunks/7e63e3d759c874077b52.js +0 -1
- package/assets/esri/core/workers/chunks/7f8c7e3e41e51ab4d612.js +0 -1
- package/assets/esri/core/workers/chunks/80a5fd4fb79e90086538.js +0 -1
- package/assets/esri/core/workers/chunks/80aaf31c8eec3cff2add.js +0 -1
- package/assets/esri/core/workers/chunks/b6361cec92003997bfe5.js +0 -1
- package/assets/esri/core/workers/chunks/bbbb1aa2569ebf01ad8b.js +0 -1
- package/assets/esri/core/workers/chunks/d59aeb46bf2fb0931a9b.js +0 -1
- package/assets/esri/core/workers/chunks/ee277dd58aa69281163f.js +0 -1
- package/assets/esri/core/workers/chunks/f718d41f665d5df25f79.js +0 -1
- package/assets/esri/core/workers/chunks/fa9ef9e8eae505371965.js +0 -1
- package/assets/esri/core/workers/chunks/fb5b852d0f72df014377.js +0 -1
- package/assets/esri/core/workers/chunks/fb603edd374e24f366ff.js +0 -1
- package/views/3d/webgl-engine/lib/MaterialCollection.js +0 -5
- package/widgets/support/SelectionList/SelectionListFeatureItem.js +0 -5
- package/widgets/support/SelectionList/SelectionListGroupLayerItem.js +0 -5
- package/widgets/support/SelectionList/SelectionListLayerItem.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Evented.js";import t from"../../../../core/Handles.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import i from"../../../../core/PooledArray.js";import{ContentObject as r}from"./ContentObject.js";import{ContentObjectType as o}from"./ContentObjectType.js";import{DirtyEventNames as h}from"./DirtyEvents.js";import d from"./Octree.js";import{UpdatePolicy as c}from"./UpdatePolicy.js";class a extends r{constructor(s,r,d=""){super(),this.stage=s,this.apiLayerViewUid=d,this.type=o.Layer,this.events=new e,this.visible=!0,this.sliceable=!1,this._objectsAdded=new i,this._handles=new t,this._objects=new i,this._pickable=!0,this.visible=r?.visible??!0,this._pickable=r?.pickable??!0,this.updatePolicy=r?.updatePolicy??c.ASYNC,s.add(this);for(const e of h)this._handles.add(this.events.on(e,(t=>s.handleEvent(e,t))))}destroy(){this._handles.size&&(this._handles.destroy(),this.stage.remove(this),this.invalidateSpatialQueryAccelerator())}get objects(){return this._objects}set pickable(e){this._pickable=e}get pickable(){return this._pickable&&this.visible}add(e){this._objects.push(e),e.parentLayer=this,this.events.emit("layerObjectAdded",{layer:this,object:e}),null!=this._octree&&this._objectsAdded.push(e)}remove(e){this._objects.removeUnordered(e)&&(e.parentLayer=null,this.events.emit("layerObjectRemoved",{layer:this,object:e}),null!=this._octree&&(this._objectsAdded.removeUnordered(e)||this._octree.remove([e])))}addMany(e){this._objects.pushArray(e);for(const t of e)t.parentLayer=this;this.events.emit("layerObjectsAdded",{layer:this,objects:e}),null!=this._octree&&this._objectsAdded.pushArray(e)}removeMany(e){const t=new Array;if(this._objects.removeUnorderedMany(e,e.length,t),0!==t.length){for(const e of t)e.parentLayer=null;if(this.events.emit("layerObjectsRemoved",{layer:this,objects:t}),null!=this._octree){for(let e=0;e<t.length;)this._objectsAdded.removeUnordered(t[e])?(t[e]=t[t.length-1],t.length-=1):++e;this._octree.remove(t)}}}sync(){this.updatePolicy!==c.SYNC&&this.stage.syncLayer(this.id)}notifyObjectBBChanged(e,t){null==this._octree||this._objectsAdded.includes(e)||this._octree.update(e,t)}getSpatialQueryAccelerator(){return null==this._octree&&this._objects.length>50?(this._octree=new d((e=>e.boundingVolumeWorldSpace.bounds)),this._octree.add(this._objects.data,this._objects.length)):null!=this._octree&&this._objectsAdded.length>0&&(this._octree.add(this._objectsAdded.data,this._objectsAdded.length),this._objectsAdded.clear()),this._octree}invalidateSpatialQueryAccelerator(){this._octree=s(this._octree),this._objectsAdded.clear()}}function n(e){return
|
|
5
|
+
import e from"../../../../core/Evented.js";import t from"../../../../core/Handles.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import i from"../../../../core/PooledArray.js";import{ContentObject as r}from"./ContentObject.js";import{ContentObjectType as o}from"./ContentObjectType.js";import{DirtyEventNames as h}from"./DirtyEvents.js";import d from"./Octree.js";import{UpdatePolicy as c}from"./UpdatePolicy.js";class a extends r{constructor(s,r,d=""){super(),this.stage=s,this.apiLayerViewUid=d,this.type=o.Layer,this.events=new e,this.visible=!0,this.sliceable=!1,this._objectsAdded=new i,this._handles=new t,this._objects=new i,this._pickable=!0,this.visible=r?.visible??!0,this._pickable=r?.pickable??!0,this.updatePolicy=r?.updatePolicy??c.ASYNC,s.add(this);for(const e of h)this._handles.add(this.events.on(e,(t=>s.handleEvent(e,t))))}destroy(){this._handles.size&&(this._handles.destroy(),this.stage.remove(this),this.invalidateSpatialQueryAccelerator())}get objects(){return this._objects}set pickable(e){this._pickable=e}get pickable(){return this._pickable&&this.visible}add(e){this._objects.push(e),e.parentLayer=this,this.events.emit("layerObjectAdded",{layer:this,object:e}),null!=this._octree&&this._objectsAdded.push(e)}remove(e){this._objects.removeUnordered(e)&&(e.parentLayer=null,this.events.emit("layerObjectRemoved",{layer:this,object:e}),null!=this._octree&&(this._objectsAdded.removeUnordered(e)||this._octree.remove([e])))}addMany(e){this._objects.pushArray(e);for(const t of e)t.parentLayer=this;this.events.emit("layerObjectsAdded",{layer:this,objects:e}),null!=this._octree&&this._objectsAdded.pushArray(e)}removeMany(e){const t=new Array;if(this._objects.removeUnorderedMany(e,e.length,t),0!==t.length){for(const e of t)e.parentLayer=null;if(this.events.emit("layerObjectsRemoved",{layer:this,objects:t}),null!=this._octree){for(let e=0;e<t.length;)this._objectsAdded.removeUnordered(t[e])?(t[e]=t[t.length-1],t.length-=1):++e;this._octree.remove(t)}}}sync(){this.updatePolicy!==c.SYNC&&this.stage.syncLayer(this.id)}notifyObjectBBChanged(e,t){null==this._octree||this._objectsAdded.includes(e)||this._octree.update(e,t)}getSpatialQueryAccelerator(){return null==this._octree&&this._objects.length>50?(this._octree=new d((e=>e.boundingVolumeWorldSpace.bounds)),this._octree.add(this._objects.data,this._objects.length)):null!=this._octree&&this._objectsAdded.length>0&&(this._octree.add(this._objectsAdded.data,this._objectsAdded.length),this._objectsAdded.clear()),this._octree}invalidateSpatialQueryAccelerator(){this._octree=s(this._octree),this._objectsAdded.clear()}}function n(e){return e?.type===o.Layer}export{a as WebGLLayer,n as isWebGLLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{makeFloat16Array as
|
|
5
|
+
import{hasNativeFloat16Array as e,makeFloat16Array as r}from"../../../../geometry/support/float16.js";import{Default3D as o}from"./DefaultVertexAttributeLocations.js";import{Pos2 as t,Pos2Tex as s}from"./DefaultVertexBufferLayouts.js";import{VertexArrayObject as n}from"./VertexArrayObject.js";import{BufferObject as f}from"../../../webgl/BufferObject.js";import{Usage as m,TextureSamplingMode as a}from"../../../webgl/enums.js";import{Texture as u}from"../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../webgl/TextureDescriptor.js";function p(t,s=x.Pos2,a=o,u=-1,i=1){const p=s===x.Pos2?new Float32Array([u,u,i,u,u,i,i,i]):e?new Float32Array([u,u,0,i,u,0,u,i,0,i,i,0]):new Float32Array([u,u,0,0,i,u,1,0,u,i,0,1,i,i,1,1]);if(s===x.Pos2Tex&&e){const e=r(p.buffer);e[10]=e[17]=e[22]=e[23]=1}return new n(t,a,new Map([["geometry",l.get(s)]]),new Map([["geometry",f.createVertex(t,m.STATIC_DRAW,p)]]))}const c=4;function w(e){const r=new i(c);return r.samplingMode=a.NEAREST,new u(e,r)}var x;!function(e){e[e.Pos2=0]="Pos2",e[e.Pos2Tex=1]="Pos2Tex"}(x||(x={}));const l=new Map([[x.Pos2,t],[x.Pos2Tex,s]]);export{x as Layout,w as createEmptyTexture,p as createQuadVAO};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{i as e,G as t,t as r}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as a}from"../../../../geometry/support/float16.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as n,isColor as o,isDepth as h,isColorHighlightOrDepth as c,isColorOrColorEmission as p}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as m,RenderOccludedFlag as u}from"../lib/Material.js";import{RenderSlot as T}from"../lib/RenderSlot.js";import{VertexAttribute as f}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as d}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as
|
|
5
|
+
import{i as e,G as t,t as r}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as a}from"../../../../geometry/support/float16.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as n,isColor as o,isDepth as h,isColorHighlightOrDepth as c,isColorOrColorEmission as p}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as m,RenderOccludedFlag as u}from"../lib/Material.js";import{RenderSlot as T}from"../lib/RenderSlot.js";import{VertexAttribute as f}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as d}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as E}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as A,LineMarkerTechnique as _}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as v,LineMarkerSpace as g,LineMarkerAnchor as S}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as O}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as R}from"../../../../webscene/support/AlphaCutoff.js";class I extends m{constructor(e){super(e,C),this._configuration=new v,this.vertexAttributeLocations=A,this.produces=new Map([[T.OPAQUE_MATERIAL,e=>e===n.Highlight||o(e)&&this.parameters.renderOccluded===u.OccludeAndTransparentStencil],[T.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>h(e)],[T.OCCLUDER_MATERIAL,e=>c(e)&&this.parameters.renderOccluded===u.OccludeAndTransparentStencil],[T.TRANSPARENT_OCCLUDER_MATERIAL,e=>c(e)&&this.parameters.renderOccluded===u.OccludeAndTransparentStencil],[T.TRANSPARENT_MATERIAL,e=>o(e)&&this.parameters.writeDepth],[T.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>o(e)&&!this.parameters.writeDepth],[T.DRAPED_MATERIAL,e=>p(e)||e===n.Highlight]]),this._layout=this.createLayout()}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.space=t.slot===T.DRAPED_MATERIAL?g.Draped:this.parameters.worldSpace?g.World:g.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==O.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=t.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===u.OccludeAndTransparentStencil,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest&&p(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}get visible(){return this.parameters.color[3]>=R}intersect(){}createLayout(){const e=s().vec3f(f.POSITION).vec4f16(f.PREVIOUSDELTA).vec2f16(f.UV0);return this.parameters.worldSpace&&e.vec3f16(f.NORMAL),this.parameters.vvSize?e.f16(f.SIZEFEATUREATTRIBUTE):e.f16(f.SIZE),this.parameters.vvColor?e.f16(f.COLORFEATUREATTRIBUTE):e.vec4u8(f.COLOR,{glNormalized:!0}),this.parameters.vvOpacity&&e.f16(f.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new P(this._layout,this.parameters)}createGLMaterial(e){return new L(e)}}class L extends l{dispose(){super.dispose(),this._markerTextures.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(_,e)}}class C extends d{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=O.BUTT,this.anchor=S.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.markerTexture=null}}class P{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,s,n,o,h,c){const p=n.get(f.POSITION).data,l=p.length/3;let m=[1,0,0];const u=n.get(f.NORMAL);this._parameters.worldSpace&&null!=u&&(m=u.data);let T=1,d=0;this._parameters.vvSize?d=n.get(f.SIZEFEATUREATTRIBUTE).data[0]:n.has(f.SIZE)&&(T=n.get(f.SIZE).data[0]);let A=[1,1,1,1],_=0;this._parameters.vvColor?_=n.get(f.COLORFEATUREATTRIBUTE).data[0]:n.has(f.COLOR)&&(A=n.get(f.COLOR).data);let v=0;this._parameters.vvOpacity&&(v=n.get(f.OPACITYFEATUREATTRIBUTE).data[0]);const g=new Float32Array(h.buffer),S=a(h.buffer),O=new Uint8Array(h.buffer);let R=c*(this.vertexBufferLayout.stride/4);const I=g.BYTES_PER_ELEMENT/S.BYTES_PER_ELEMENT,L=4/I,C=(e,t,r,i)=>{g[R++]=e[0],g[R++]=e[1],g[R++]=e[2],E(t,e,S,R*I),R+=L;let a=R*I;if(S[a++]=r[0],S[a++]=r[1],this._parameters.worldSpace&&(S[a++]=m[0],S[a++]=m[1],S[a++]=m[2]),this._parameters.vvSize?S[a++]=d:S[a++]=T,this._parameters.vvColor)S[a++]=_;else{const e=Math.min(4*i,A.length-4),t=a/I*4;a+=I,O[t]=255*A[e],O[t+1]=255*A[e+1],O[t+2]=255*A[e+2],O[t+3]=255*A[e+3]}this._parameters.vvOpacity&&(S[a++]=v),R=Math.ceil(a/I)};let P;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(P||(P={}));const D=(a,s)=>{const n=e(N,p[3*a],p[3*a+1],p[3*a+2]),o=b;let h=a+s;do{e(o,p[3*h],p[3*h+1],p[3*h+2]),h+=s}while(t(n,o)&&h>=0&&h<l);i&&(r(n,n,i),r(o,o,i)),C(n,o,[-1,-1],a),C(n,o,[1,-1],a),C(n,o,[1,1],a),C(n,o,[-1,-1],a),C(n,o,[1,1],a),C(n,o,[-1,1],a)},U=this._parameters.placement;return"begin"!==U&&"begin-end"!==U||D(0,P.ASCENDING),"end"!==U&&"begin-end"!==U||D(l-1,P.DESCENDING),null}}const N=i(),b=i();export{I as LineMarkerMaterial,C as Parameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{i as s,d as a,f as n,h as o,g as l,c,l as p,j as h,t as f}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as T}from"../../../../geometry/support/float16.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as _,distance2 as E,fromPoints as A,closestLineSegmentPoint as R}from"../../../../geometry/support/lineSegment.js";import{create as g,fromPoints as S,signedDistance as O,getNormal as I}from"../../../../geometry/support/plane.js";import{newLayout as v}from"../../support/buffer/InterleavedLayout.js";import{isHighlightOrOID as P,isColorOrColorEmission as N,isDepth as L,isColorEmissionHighlightOIDOrDepth as b,is2DGeometryOutput as C,ShaderOutput as U}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as y}from"../effects/geometry/olidUtils.js";import j from"../lib/GLMaterial.js";import{Material as D,RenderOccludedFlag as F}from"../lib/Material.js";import{RenderSlot as w}from"../lib/RenderSlot.js";import{isTranslationMatrix as M}from"../lib/Util.js";import{VertexAttribute as x}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as B}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as J}from"./internal/bufferWriterUtils.js";import{LineMarkerAnchor as z}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as H}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as G,RibbonLineTechnique as k}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as Z,CapType as V}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as W}from"../../../../webscene/support/AlphaCutoff.js";var Y;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(Y||(Y={}));class q extends D{constructor(e){super(e,Q),this._configuration=new Z,this.vertexAttributeLocations=G,this.produces=new Map([[w.OPAQUE_MATERIAL,e=>P(e)||N(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>L(e)],[w.OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.TRANSPARENT_OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.TRANSPARENT_MATERIAL,e=>N(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==F.OccludeAndTransparentStencil],[w.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>N(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==F.OccludeAndTransparentStencil],[w.DRAPED_MATERIAL,e=>C(e)]])}getConfiguration(e,t){super.getConfiguration(e,t,this._configuration),this._configuration.oitPass=t.oitPass,this._configuration.draped=t.slot===w.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==U.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&te(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=this.parameters.renderOccluded===F.OccludeAndTransparentStencil,this._configuration.terrainDepthTest=t.terrainDepthTest&&N(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration}get visible(){return this.parameters.color[3]>=W||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>W}intersectDraped({attributes:e,screenToWorldRatio:r},i,s,a,n,o){if(!s.options.selectionMode)return;const l=e.get(x.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.get(x.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(r)?c*=this.parameters.vvSize.fallback[0]:c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const p=a[0],h=a[1],f=(c/2+4)*r;let m=Number.MAX_VALUE,u=0;const T=e.get(x.POSITION).data,d=ee(this.parameters,e)?T.length-2:T.length-5;for(let _=0;_<d;_+=3){const e=T[_],r=T[_+1],i=(_+3)%T.length,s=p-e,a=h-r,n=T[i]-e,o=T[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,f=o*l-a,d=c*c+f*f;d<m&&(m=d,u=_/3)}m<f*f&&n(o.dist,o.normal,u,!1)}intersect(r,f,m,u,T,_){if(!m.options.selectionMode||!r.visible)return;if(!M(f))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const g=r.attributes,v=g.get(x.POSITION).data;let P=this.parameters.width;if(this.parameters.vvSize){const e=g.get(x.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(e)||(P*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else g.has(x.SIZE)&&(P*=g.get(x.SIZE).data[0]);const N=m.camera,L=ne;i(L,m.point);const b=P*N.pixelRatio/2+4*N.pixelRatio;s(de[0],L[0]-b,L[1]+b,0),s(de[1],L[0]+b,L[1]+b,0),s(de[2],L[0]+b,L[1]-b,0),s(de[3],L[0]-b,L[1]-b,0);for(let e=0;e<4;e++)if(!N.unprojectFromRenderScreen(de[e],_e[e]))return;S(N.eye,_e[0],_e[1],Ee),S(N.eye,_e[1],_e[2],Ae),S(N.eye,_e[2],_e[3],Re),S(N.eye,_e[3],_e[0],ge);let C=Number.MAX_VALUE,U=0;const y=ee(this.parameters,g)?v.length-2:v.length-5;for(let e=0;e<y;e+=3){re[0]=v[e]+f[12],re[1]=v[e+1]+f[13],re[2]=v[e+2]+f[14];const t=(e+3)%v.length;if(ie[0]=v[t]+f[12],ie[1]=v[t+1]+f[13],ie[2]=v[t+2]+f[14],O(Ee,re)<0&&O(Ee,ie)<0||O(Ae,re)<0&&O(Ae,ie)<0||O(Re,re)<0&&O(Re,ie)<0||O(ge,re)<0&&O(ge,ie)<0)continue;if(N.projectToRenderScreen(re,oe),N.projectToRenderScreen(ie,le),oe[2]<0&&le[2]>0){a(se,re,ie);const e=N.frustum,t=-O(e[d.NEAR],re)/n(se,I(e[d.NEAR]));o(se,se,t),l(re,re,se),N.projectToRenderScreen(re,oe)}else if(oe[2]>0&&le[2]<0){a(se,ie,re);const e=N.frustum,t=-O(e[d.NEAR],ie)/n(se,I(e[d.NEAR]));o(se,se,t),l(ie,ie,se),N.projectToRenderScreen(ie,le)}else if(oe[2]<0&&le[2]<0)continue;oe[2]=0,le[2]=0;const r=E(A(oe,le,he),L);r<C&&(C=r,c(ce,re),c(pe,ie),U=e/3)}const j=m.rayBegin,D=m.rayEnd;if(C<b*b){let e=Number.MAX_VALUE;if(R(A(ce,pe,he),A(j,D,fe),ae)){a(ae,ae,j);const t=p(ae);o(ae,ae,1/t),e=t/h(j,D)}_(e,ae,U,!1)}}get _layout(){const e=v().vec3f(x.POSITION).vec4f16(x.PREVIOUSDELTA).vec4f16(x.NEXTDELTA).f32(x.U0).vec2f16(x.LINEPARAMETERS);return this.parameters.vvSize?e.f32(x.SIZEFEATUREATTRIBUTE):e.f16(x.SIZE),this.parameters.vvColor?e.f16(x.COLORFEATUREATTRIBUTE):e.vec4u8(x.COLOR,{glNormalized:!0}),this.parameters.vvOpacity&&e.f16(x.OPACITYFEATUREATTRIBUTE),y()&&e.vec4u8(x.OLIDCOLOR),e}createBufferWriter(){return new K(this._layout,this.parameters)}createGLMaterial(e){return new X(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class X extends j{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(k,e)}}class Q extends B{constructor(){super(...arguments),this.width=0,this.color=u,this.join="miter",this.cap=V.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1}get transparent(){return this.color[3]<1||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}}class K{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=H+r}}_isClosed(e){return ee(this._parameters,e)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.get(x.POSITION).indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,a,n){const o=r.get(x.POSITION),l=o.indices,p=o.data.length/3,m=r.get(x.DISTANCETOSTART)?.data;l&&l.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const u=this.vertexBufferLayout.fields.has(x.SIZEFEATUREATTRIBUTE),d=(u?r.get(x.SIZEFEATUREATTRIBUTE)?.data[0]:r.get(x.SIZE)?.data[0])??1;let _=[1,1,1,1],E=0;const A=this.vertexBufferLayout.fields.has(x.COLORFEATUREATTRIBUTE);A?E=r.get(x.COLORFEATUREATTRIBUTE).data[0]:r.has(x.COLOR)&&(_=r.get(x.COLOR).data);const R=this.vertexBufferLayout.fields.has(x.OPACITYFEATUREATTRIBUTE),g=R?r.get(x.OPACITYFEATUREATTRIBUTE).data[0]:0,S=new Float32Array(a.buffer),O=T(a.buffer),I=new Uint8Array(a.buffer),v=this.vertexBufferLayout.stride/4;let P=n*v;const N=P;let L=0;const b=m?(e,t,r)=>L=m[r]:(e,t,r)=>L+=h(e,t),C=(e,t,r,s,a,n,o)=>{S[P++]=t[0],S[P++]=t[1],S[P++]=t[2],J(e,t,O,2*P),P+=2,J(r,t,O,2*P),P+=2,S[P++]=o;let l=2*P;if(O[l++]=s,O[l++]=a,u?(P=Math.ceil(.5*l),S[P]=d,l+=2):O[l++]=d,A)O[l++]=E;else{const e=Math.min(4*n,_.length-4),t=2*l;l+=2,I[t]=255*_[e],I[t+1]=255*_[e+1],I[t+2]=255*_[e+2],I[t+3]=255*_[e+3]}R&&(O[l++]=g);let c=2*l;y()&&i&&(I[c++]=i[0],I[c++]=i[1],I[c++]=i[2],I[c++]=i[3]),P=Math.ceil(.25*c)};P+=v,s(ue,o.data[0],o.data[1],o.data[2]),e&&f(ue,ue,e);const U=this._isClosed(r);if(U){const t=o.data.length-3;s(me,o.data[t],o.data[t+1],o.data[t+2]),e&&f(me,me,e)}else s(Te,o.data[3],o.data[4],o.data[5]),e&&f(Te,Te,e),C(ue,ue,Te,1,Y.LEFT_CAP_START,0,0),C(ue,ue,Te,1,Y.RIGHT_CAP_START,0,0),c(me,ue),c(ue,Te);const j=U?0:1,D=U?p:p-1;for(let h=j;h<D;h++){const t=(h+1)%p*3;s(Te,o.data[t],o.data[t+1],o.data[t+2]),e&&f(Te,Te,e),b(me,ue,h),C(me,ue,Te,0,Y.LEFT_JOIN_END,h,L),C(me,ue,Te,0,Y.RIGHT_JOIN_END,h,L);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);C(me,ue,Te,t,Y.LEFT_JOIN_END,h,L),C(me,ue,Te,t,Y.RIGHT_JOIN_END,h,L)}C(me,ue,Te,1,Y.LEFT_JOIN_START,h,L),C(me,ue,Te,1,Y.RIGHT_JOIN_START,h,L),c(me,ue),c(ue,Te)}U?(s(Te,o.data[3],o.data[4],o.data[5]),e&&f(Te,Te,e),L=b(me,ue,D),C(me,ue,Te,0,Y.LEFT_JOIN_END,j,L),C(me,ue,Te,0,Y.RIGHT_JOIN_END,j,L)):(L=b(me,ue,D),C(me,ue,ue,0,Y.LEFT_CAP_END,D,L),C(me,ue,ue,0,Y.RIGHT_CAP_END,D,L)),$(S,N+v,S,N,v);return P=$(S,P-v,S,P,v),this._parameters.wireframe&&this._addWireframeVertices(a,N,P,v),null}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=$(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function $(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function ee(e,t){if(!e.isClosed)return!1;return t.get(x.POSITION).indices.length>2}function te(e){return e.anchor===z.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const re=m(),ie=m(),se=m(),ae=m(),ne=m(),oe=r(),le=r(),ce=m(),pe=m(),he=_(),fe=_(),me=m(),ue=m(),Te=m(),de=[r(),r(),r(),r()],_e=[m(),m(),m(),m()],Ee=g(),Ae=g(),Re=g(),ge=g();export{Q as Parameters,q as RibbonLineMaterial};
|
|
5
|
+
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{i as s,d as a,f as n,h as o,g as l,c,l as p,j as h,t as f}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as T}from"../../../../geometry/support/float16.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as E,distance2 as _,fromPoints as A,closestLineSegmentPoint as R}from"../../../../geometry/support/lineSegment.js";import{create as g,fromPoints as S,signedDistance as O,getNormal as I}from"../../../../geometry/support/plane.js";import{newLayout as v}from"../../support/buffer/InterleavedLayout.js";import{isHighlightOrOID as P,isColorOrColorEmission as N,isDepth as L,isColorEmissionHighlightOIDOrDepth as b,is2DGeometryOutput as C,ShaderOutput as U}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as y}from"../effects/geometry/olidUtils.js";import j from"../lib/GLMaterial.js";import{Material as D,RenderOccludedFlag as F}from"../lib/Material.js";import{RenderSlot as w}from"../lib/RenderSlot.js";import{isTranslationMatrix as M}from"../lib/Util.js";import{VertexAttribute as B}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as x}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as J}from"./internal/bufferWriterUtils.js";import{LineMarkerAnchor as z}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as H}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as G,RibbonLineTechnique as k}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as Z,CapType as V}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as W}from"../../../../webscene/support/AlphaCutoff.js";var Y;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(Y||(Y={}));class q extends D{constructor(e){super(e,Q),this._configuration=new Z,this.vertexAttributeLocations=G,this.produces=new Map([[w.OPAQUE_MATERIAL,e=>P(e)||N(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>L(e)],[w.OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.TRANSPARENT_OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.TRANSPARENT_MATERIAL,e=>N(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==F.OccludeAndTransparentStencil],[w.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>N(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==F.OccludeAndTransparentStencil],[w.DRAPED_MATERIAL,e=>C(e)]])}getConfiguration(e,t){super.getConfiguration(e,t,this._configuration),this._configuration.oitPass=t.oitPass,this._configuration.draped=t.slot===w.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==U.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&te(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=this.parameters.renderOccluded===F.OccludeAndTransparentStencil,this._configuration.terrainDepthTest=t.terrainDepthTest&&N(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration}get visible(){return this.parameters.color[3]>=W||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>W}intersectDraped({attributes:e,screenToWorldRatio:r},i,s,a,n,o){if(!s.options.selectionMode)return;const l=e.get(B.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.get(B.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(r)?c*=this.parameters.vvSize.fallback[0]:c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const p=a[0],h=a[1],f=(c/2+4)*r;let m=Number.MAX_VALUE,u=0;const T=e.get(B.POSITION).data,d=ee(this.parameters,e)?T.length-2:T.length-5;for(let E=0;E<d;E+=3){const e=T[E],r=T[E+1],i=(E+3)%T.length,s=p-e,a=h-r,n=T[i]-e,o=T[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,f=o*l-a,d=c*c+f*f;d<m&&(m=d,u=E/3)}m<f*f&&n(o.dist,o.normal,u,!1)}intersect(r,f,m,u,T,E){if(!m.options.selectionMode||!r.visible)return;if(!M(f))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const g=r.attributes,v=g.get(B.POSITION).data;let P=this.parameters.width;if(this.parameters.vvSize){const e=g.get(B.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(e)||(P*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else g.has(B.SIZE)&&(P*=g.get(B.SIZE).data[0]);const N=m.camera,L=ne;i(L,m.point);const b=P*N.pixelRatio/2+4*N.pixelRatio;s(de[0],L[0]-b,L[1]+b,0),s(de[1],L[0]+b,L[1]+b,0),s(de[2],L[0]+b,L[1]-b,0),s(de[3],L[0]-b,L[1]-b,0);for(let e=0;e<4;e++)if(!N.unprojectFromRenderScreen(de[e],Ee[e]))return;S(N.eye,Ee[0],Ee[1],_e),S(N.eye,Ee[1],Ee[2],Ae),S(N.eye,Ee[2],Ee[3],Re),S(N.eye,Ee[3],Ee[0],ge);let C=Number.MAX_VALUE,U=0;const y=ee(this.parameters,g)?v.length-2:v.length-5;for(let e=0;e<y;e+=3){re[0]=v[e]+f[12],re[1]=v[e+1]+f[13],re[2]=v[e+2]+f[14];const t=(e+3)%v.length;if(ie[0]=v[t]+f[12],ie[1]=v[t+1]+f[13],ie[2]=v[t+2]+f[14],O(_e,re)<0&&O(_e,ie)<0||O(Ae,re)<0&&O(Ae,ie)<0||O(Re,re)<0&&O(Re,ie)<0||O(ge,re)<0&&O(ge,ie)<0)continue;if(N.projectToRenderScreen(re,oe),N.projectToRenderScreen(ie,le),oe[2]<0&&le[2]>0){a(se,re,ie);const e=N.frustum,t=-O(e[d.NEAR],re)/n(se,I(e[d.NEAR]));o(se,se,t),l(re,re,se),N.projectToRenderScreen(re,oe)}else if(oe[2]>0&&le[2]<0){a(se,ie,re);const e=N.frustum,t=-O(e[d.NEAR],ie)/n(se,I(e[d.NEAR]));o(se,se,t),l(ie,ie,se),N.projectToRenderScreen(ie,le)}else if(oe[2]<0&&le[2]<0)continue;oe[2]=0,le[2]=0;const r=_(A(oe,le,he),L);r<C&&(C=r,c(ce,re),c(pe,ie),U=e/3)}const j=m.rayBegin,D=m.rayEnd;if(C<b*b){let e=Number.MAX_VALUE;if(R(A(ce,pe,he),A(j,D,fe),ae)){a(ae,ae,j);const t=p(ae);o(ae,ae,1/t),e=t/h(j,D)}E(e,ae,U,!1)}}get _layout(){const e=v().vec3f(B.POSITION).vec4f16(B.PREVIOUSDELTA).vec4f16(B.NEXTDELTA).f32(B.U0).vec2f16(B.LINEPARAMETERS);return this.parameters.vvSize?e.f32(B.SIZEFEATUREATTRIBUTE):e.f16(B.SIZE),this.parameters.vvColor?e.f16(B.COLORFEATUREATTRIBUTE):e.vec4u8(B.COLOR,{glNormalized:!0}),this.parameters.vvOpacity&&e.f16(B.OPACITYFEATUREATTRIBUTE),y()&&e.vec4u8(B.OLIDCOLOR),e}createBufferWriter(){return new K(this._layout,this.parameters)}createGLMaterial(e){return new X(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class X extends j{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(k,e)}}class Q extends x{constructor(){super(...arguments),this.width=0,this.color=u,this.join="miter",this.cap=V.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1}get transparent(){return this.color[3]<1||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}}class K{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=H+r}}_isClosed(e){return ee(this._parameters,e)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.get(B.POSITION).indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,a,n){const o=r.get(B.POSITION),l=o.indices,p=o.data.length/3,m=r.get(B.DISTANCETOSTART)?.data;l&&l.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const u=this.vertexBufferLayout.fields.has(B.SIZEFEATUREATTRIBUTE),d=(u?r.get(B.SIZEFEATUREATTRIBUTE)?.data[0]:r.get(B.SIZE)?.data[0])??1;let E=[1,1,1,1],_=0;const A=this.vertexBufferLayout.fields.has(B.COLORFEATUREATTRIBUTE);A?_=r.get(B.COLORFEATUREATTRIBUTE).data[0]:r.has(B.COLOR)&&(E=r.get(B.COLOR).data);const R=this.vertexBufferLayout.fields.has(B.OPACITYFEATUREATTRIBUTE),g=R?r.get(B.OPACITYFEATUREATTRIBUTE).data[0]:0,S=new Float32Array(a.buffer),O=T(a.buffer),I=new Uint8Array(a.buffer),v=this.vertexBufferLayout.stride/4;let P=n*v;const N=P;let L=0;const b=m?(e,t,r)=>L=m[r]:(e,t,r)=>L+=h(e,t),C=S.BYTES_PER_ELEMENT/O.BYTES_PER_ELEMENT,U=4/C,j=(e,t,r,s,a,n,o)=>{S[P++]=t[0],S[P++]=t[1],S[P++]=t[2],J(e,t,O,P*C),P+=U,J(r,t,O,P*C),P+=U,S[P++]=o;let l=P*C;if(O[l++]=s,O[l++]=a,u?(P=Math.ceil(l/C),S[P]=d,l+=C):O[l++]=d,A)O[l++]=_;else{const e=Math.min(4*n,E.length-4),t=l/C*4;l+=C,I[t]=255*E[e],I[t+1]=255*E[e+1],I[t+2]=255*E[e+2],I[t+3]=255*E[e+3]}R&&(O[l++]=g);let c=l/C*4;y()&&i&&(I[c++]=i[0],I[c++]=i[1],I[c++]=i[2],I[c++]=i[3]),P=Math.ceil(.25*c)};P+=v,s(ue,o.data[0],o.data[1],o.data[2]),e&&f(ue,ue,e);const D=this._isClosed(r);if(D){const t=o.data.length-3;s(me,o.data[t],o.data[t+1],o.data[t+2]),e&&f(me,me,e)}else s(Te,o.data[3],o.data[4],o.data[5]),e&&f(Te,Te,e),j(ue,ue,Te,1,Y.LEFT_CAP_START,0,0),j(ue,ue,Te,1,Y.RIGHT_CAP_START,0,0),c(me,ue),c(ue,Te);const F=D?0:1,w=D?p:p-1;for(let h=F;h<w;h++){const t=(h+1)%p*3;s(Te,o.data[t],o.data[t+1],o.data[t+2]),e&&f(Te,Te,e),b(me,ue,h),j(me,ue,Te,0,Y.LEFT_JOIN_END,h,L),j(me,ue,Te,0,Y.RIGHT_JOIN_END,h,L);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);j(me,ue,Te,t,Y.LEFT_JOIN_END,h,L),j(me,ue,Te,t,Y.RIGHT_JOIN_END,h,L)}j(me,ue,Te,1,Y.LEFT_JOIN_START,h,L),j(me,ue,Te,1,Y.RIGHT_JOIN_START,h,L),c(me,ue),c(ue,Te)}D?(s(Te,o.data[3],o.data[4],o.data[5]),e&&f(Te,Te,e),L=b(me,ue,w),j(me,ue,Te,0,Y.LEFT_JOIN_END,F,L),j(me,ue,Te,0,Y.RIGHT_JOIN_END,F,L)):(L=b(me,ue,w),j(me,ue,ue,0,Y.LEFT_CAP_END,w,L),j(me,ue,ue,0,Y.RIGHT_CAP_END,w,L)),$(S,N+v,S,N,v);return P=$(S,P-v,S,P,v),this._parameters.wireframe&&this._addWireframeVertices(a,N,P,v),null}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=$(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function $(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function ee(e,t){if(!e.isClosed)return!1;return t.get(B.POSITION).indices.length>2}function te(e){return e.anchor===z.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const re=m(),ie=m(),se=m(),ae=m(),ne=m(),oe=r(),le=r(),ce=m(),pe=m(),he=E(),fe=E(),me=m(),ue=m(),Te=m(),de=[r(),r(),r(),r()],Ee=[m(),m(),m(),m()],_e=g(),Ae=g(),Re=g(),ge=g();export{Q as Parameters,q as RibbonLineMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{d as e,l as t,h as f}from"../../../../../chunks/vec32.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{hasIdentityRotation as o,isOrthoNormal as i}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{BufferViewVec4u8 as s,BufferViewVec3f16 as n,BufferViewVec3f as c,BufferViewVec4f16 as l,BufferViewVec4f as d,BufferViewFloat16 as u,BufferViewFloat as a,BufferViewVec2i16 as p,BufferViewVec2f16 as g,BufferViewVec2f as B}from"../../../../../geometry/support/buffer/BufferView.js";import{assert as y}from"../../lib/Util.js";import{VertexAttribute as b}from"../../lib/VertexAttribute.js";function m(e,t,f,r=1){const{data:o,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===r)for(let l=0;l<c;++l)s[f]=o[i[l]],f+=n;else for(let l=0;l<c;++l){const e=o[i[l]];for(let t=0;t<r;t++)s[f]=e,f+=n}}function O(e,t,f){const{data:r,indices:o}=e,i=t.typedBuffer,s=t.typedBufferStride,n=o.length;f*=s;for(let c=0;c<n;++c){const e=2*o[c];i[f]=r[e],i[f+1]=r[e+1],f+=s}}function h(e,t,f,r=1){const{data:o,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===r)for(let l=0;l<c;++l){const e=3*i[l];s[f]=o[e],s[f+1]=o[e+1],s[f+2]=o[e+2],f+=n}else for(let l=0;l<c;++l){const e=3*i[l];for(let t=0;t<r;++t)s[f]=o[e],s[f+1]=o[e+1],s[f+2]=o[e+2],f+=n}}function F(e,t,f,r=1){const{data:o,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===r)for(let l=0;l<c;++l){const e=4*i[l];s[f]=o[e],s[f+1]=o[e+1],s[f+2]=o[e+2],s[f+3]=o[e+3],f+=n}else for(let l=0;l<c;++l){const e=4*i[l];for(let t=0;t<r;++t)s[f]=o[e],s[f+1]=o[e+1],s[f+2]=o[e+2],s[f+3]=o[e+3],f+=n}}function I(e,t,f){const r=e.typedBuffer,o=e.typedBufferStride;t*=o;for(let i=0;i<f;++i)r[t]=0,r[t+1]=0,r[t+2]=0,r[t+3]=0,t+=o}function T(e,t,f){const{data:r,indices:o}=e,i=t.typedBuffer,s=t.typedBufferStride,n=o.length;f*=s;for(let c=0;c<n;++c){const e=9*o[c];for(let t=0;t<9;++t)i[f+t]=r[e+t];f+=s}}function N(e,t,f){const{data:r,indices:o}=e,i=t.typedBuffer,s=t.typedBufferStride,n=o.length;f*=s;for(let c=0;c<n;++c){const e=16*o[c];for(let t=0;t<16;++t)i[f+t]=r[e+t];f+=s}}function R(e,t,f,r,i=1){if(!t)return void h(e,f,r,i);const{data:s,indices:n}=e,c=f.typedBuffer,l=f.typedBufferStride,d=n.length,u=t[0],a=t[1],p=t[2],g=t[4],B=t[5],y=t[6],b=t[8],m=t[9],O=t[10],F=t[12],I=t[13],T=t[14];r*=l;let N=0,R=0,S=0;const E=o(t)?e=>{N=s[e]+F,R=s[e+1]+I,S=s[e+2]+T}:e=>{const t=s[e],f=s[e+1],r=s[e+2];N=u*t+g*f+b*r+F,R=a*t+B*f+m*r+I,S=p*t+y*f+O*r+T};if(1===i)for(let o=0;o<d;++o)E(3*n[o]),c[r]=N,c[r+1]=R,c[r+2]=S,r+=l;else for(let o=0;o<d;++o){E(3*n[o]);for(let e=0;e<i;++e)c[r]=N,c[r+1]=R,c[r+2]=S,r+=l}}function S(e,t,f,r,s=1){if(!t)return void h(e,f,r,s);const{data:n,indices:c}=e,l=t,d=f.typedBuffer,u=f.typedBufferStride,a=c.length,p=l[0],g=l[1],B=l[2],y=l[4],b=l[5],m=l[6],O=l[8],F=l[9],I=l[10],T=!i(l),N=1e-6,R=1-N;r*=u;let S=0,E=0,A=0;const v=o(l)?e=>{S=n[e],E=n[e+1],A=n[e+2]}:e=>{const t=n[e],f=n[e+1],r=n[e+2];S=p*t+y*f+O*r,E=g*t+b*f+F*r,A=B*t+m*f+I*r};if(1===s)if(T)for(let o=0;o<a;++o){v(3*c[o]);const e=S*S+E*E+A*A;if(e<R&&e>N){const t=1/Math.sqrt(e);d[r]=S*t,d[r+1]=E*t,d[r+2]=A*t}else d[r]=S,d[r+1]=E,d[r+2]=A;r+=u}else for(let o=0;o<a;++o)v(3*c[o]),d[r]=S,d[r+1]=E,d[r+2]=A,r+=u;else for(let o=0;o<a;++o){if(v(3*c[o]),T){const e=S*S+E*E+A*A;if(e<R&&e>N){const t=1/Math.sqrt(e);S*=t,E*=t,A*=t}}for(let e=0;e<s;++e)d[r]=S,d[r+1]=E,d[r+2]=A,r+=u}}function E(e,t,f,r,o=1){if(!t)return void F(e,f,r,o);const{data:s,indices:n}=e,c=t,l=f.typedBuffer,d=f.typedBufferStride,u=n.length,a=c[0],p=c[1],g=c[2],B=c[4],y=c[5],b=c[6],m=c[8],O=c[9],h=c[10],I=!i(c),T=1e-6,N=1-T;if(r*=d,1===o)for(let i=0;i<u;++i){const e=4*n[i],t=s[e],f=s[e+1],o=s[e+2],c=s[e+3];let u=a*t+B*f+m*o,F=p*t+y*f+O*o,R=g*t+b*f+h*o;if(I){const e=u*u+F*F+R*R;if(e<N&&e>T){const t=1/Math.sqrt(e);u*=t,F*=t,R*=t}}l[r]=u,l[r+1]=F,l[r+2]=R,l[r+3]=c,r+=d}else for(let i=0;i<u;++i){const e=4*n[i],t=s[e],f=s[e+1],c=s[e+2],u=s[e+3];let F=a*t+B*f+m*c,R=p*t+y*f+O*c,S=g*t+b*f+h*c;if(I){const e=F*F+R*R+S*S;if(e<N&&e>T){const t=1/Math.sqrt(e);F*=t,R*=t,S*=t}}for(let i=0;i<o;++i)l[r]=F,l[r+1]=R,l[r+2]=S,l[r+3]=u,r+=d}}function A(e,t,f,r,o=1){const{data:i,indices:s}=e,n=f.typedBuffer,c=f.typedBufferStride,l=s.length;if(r*=c,t!==i.length||4!==t)if(1!==o)if(4!==t)for(let d=0;d<l;++d){const e=3*s[d];for(let t=0;t<o;++t)n[r]=i[e],n[r+1]=i[e+1],n[r+2]=i[e+2],n[r+3]=255,r+=c}else for(let d=0;d<l;++d){const e=4*s[d];for(let t=0;t<o;++t)n[r]=i[e],n[r+1]=i[e+1],n[r+2]=i[e+2],n[r+3]=i[e+3],r+=c}else{if(4===t){for(let e=0;e<l;++e){const t=4*s[e];n[r]=i[t],n[r+1]=i[t+1],n[r+2]=i[t+2],n[r+3]=i[t+3],r+=c}return}for(let e=0;e<l;++e){const t=3*s[e];n[r]=i[t],n[r+1]=i[t+1],n[r+2]=i[t+2],n[r+3]=255,r+=c}}else{n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3];const e=new Uint32Array(f.typedBuffer.buffer,f.start),t=c/4,s=e[r/=4];r+=t;const d=l*o;for(let f=1;f<d;++f)e[r]=s,r+=t}}function v(e,t,f){const{data:r,indices:o}=e,i=t.typedBuffer,s=t.typedBufferStride,n=o.length,c=r[0];f*=s;for(let l=0;l<n;++l)i[f]=c,f+=s}function w(r,o,i,s){e(k,r,o);const n=Math.max(Math.sqrt(t(k)),1e-4);f(k,k,1/n),i[s++]=k[0],i[s++]=k[1],i[s++]=k[2],i[s++]=n}const k=r();function z(e,t,f,r,o=1){const i=t.typedBuffer,s=t.typedBufferStride;if(r*=s,1===o)for(let n=0;n<f;++n)i[r]=e[0],i[r+1]=e[1],i[r+2]=e[2],i[r+3]=e[3],r+=s;else for(let n=0;n<f;++n)for(let t=0;t<o;++t)i[r]=e[0],i[r+1]=e[1],i[r+2]=e[2],i[r+3]=e[3],r+=s}function L(e,t,f,r,o,i,n){let c={numItems:0,numVerticesPerItem:0};for(const l of f.fields.keys()){const f=e.get(l),d=f?.indices;if(f&&d)l===b.POSITION&&(c={numItems:1,numVerticesPerItem:d.length}),P(l,f,r,o,i,n);else if(l===b.OLIDCOLOR&&null!=t){const f=e.get(b.POSITION)?.indices;if(f){const e=f.length;z(t,i.getField(l,s),e,n)}}}return c}function P(e,t,f,r,o,i){switch(e){case b.POSITION:{y(3===t.size);const r=o.getField(e,c);y(!!r,`No buffer view for ${e}`),R(t,f,r,i);break}case b.NORMAL:{y(3===t.size);const f=o.getField(e,c);y(!!f,`No buffer view for ${e}`),S(t,r,f,i);break}case b.NORMALCOMPRESSED:case b.PROFILERIGHT:case b.PROFILEUP:{y(2===t.size);const f=o.getField(e,p);y(!!f,`No buffer view for ${e}`),O(t,f,i);break}case b.UV0:{y(2===t.size);const f=o.getField(e,g)??o.getField(e,B);y(!!f,`No buffer view for ${e}`),O(t,f,i);break}case b.UVI:{y(2===t.size);const f=o.getField(e,p);y(!!f,`No buffer view for ${e}`),O(t,f,i);break}case b.COLOR:case b.SYMBOLCOLOR:{const f=o.getField(e,s);y(!!f,`No buffer view for ${e}`),y(3===t.size||4===t.size),A(t,t.size,f,i);break}case b.SIZEFEATUREATTRIBUTE:{const f=o.getField(e,a);y(!!f,`No buffer view for ${e}`),y(1===t.size),v(t,f,i);break}case b.COLORFEATUREATTRIBUTE:case b.OPACITYFEATUREATTRIBUTE:{const f=o.getField(e,u)??o.getField(e,a);y(!!f,`No buffer view for ${e}`),y(1===t.size),v(t,f,i);break}case b.TANGENT:{y(4===t.size);const r=o.getField(e,d);y(!!r,`No buffer view for ${e}`),E(t,f,r,i);break}case b.PROFILEVERTEXANDNORMAL:{y(4===t.size);const f=o.getField(e,l)??o.getField(e,d);y(!!f,`No buffer view for ${e}`),F(t,f,i);break}case b.PROFILEAUXDATA:{y(3===t.size);const f=o.getField(e,n)??o.getField(e,c);y(!!f,`No buffer view for ${e}`),h(t,f,i);break}}}export{m as writeBufferFloat,T as writeBufferMat3f,N as writeBufferMat4f,O as writeBufferVec2,h as writeBufferVec3,F as writeBufferVec4,I as writeBufferVec4Zeros,A as writeColor,v as writeColorFeatureAttribute,P as writeDefaultAttribute,L as writeDefaultAttributes,w as writeDeltaF16Vector,S as writeNormal,z as writeOlidColor,R as writePosition,E as writeTangent};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{removeUnordered as t,filterInPlace as r}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTwo as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{NestedMap as o}from"../../../../../core/NestedMap.js";import a from"../../../../../core/PooledArray.js";import{addMany as n}from"../../../../../core/SetUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{copy as u,invert as f,transpose as c}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as m}from"../../../support/buffer/glUtil.js";import{ShaderOutput as g}from"../../core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as p}from"../../effects/RenderPlugin.js";import{GLMaterials as y}from"../../lib/GLMaterials.js";import{DirtyState as _}from"../../lib/ModelDirtyTypes.js";import{RenderSlot as b}from"../../lib/RenderSlot.js";import{assert as w}from"../../lib/Util.js";import{DrawParameters as v}from"../DrawParameters.js";import{BufferRange as C,mergeAdjacentRanges as O}from"./BufferRange.js";import{Instance as A}from"./Instance.js";import{PerBufferData as E,hasVao as B}from"./PerBufferData.js";import{PerOriginData as M}from"./PerOriginData.js";import{defaultHighlightName as x}from"../../../../support/HighlightDefaults.js";let D=class extends p{get _hasHighlights(){return this._highlightNames.size>0}hasHighlight(e){return this._highlightNames.has(e)}constructor(e){super(e),this._dataByOrigin=new Map,this._drawParameters=new v,this._highlightNames=new Set,this.drapedPriority=0,this._produces=new Map,this._hasOccludees=!1}destroy(){this._glMaterials=s(this._glMaterials),this._dataByOrigin.forEach((e=>e.dispose())),this._dataByOrigin.clear(),this._vaoCache=null}initialize(){this._updateProduces()}_updateProduces(){this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>!(0===this._dataByOrigin.size||!(t!==g.Highlight&&t!==g.ShadowHighlight||this._hasHighlights))&&e(t)))}))}initializeRenderContext(e,t){q??=e.renderContext.rctx.isAssumedMetalDriver,this._glMaterials=new y(this.material,t??e.materials),this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,m(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}get produces(){return this._produces}get hasOccludees(){return this._hasOccludees}get hasEmissions(){return this.material.hasEmissions}get isDecoration(){return this.material.parameters.isDecoration}queryRenderOccludedState(e){return this.material.queryRenderOccludedState(e)}get numGeometries(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.instances.size),0))),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.vao.cachedMemory),0))),e}forEachGeometry(e){this._dataByOrigin.forEach((t=>t.buffers.forEach((t=>t.instances.forEach((({geometry:t})=>e(t)))))))}modify(e,t){this._applyUpdates(e,t),this._applyAddsAndRemoves(e),this._updateDrawCommands()}get canCompact(){for(const e of this._dataByOrigin.values())if(e.buffers.some((e=>e.holes.length>1)))return!0;return!1}compact(e){if(!this.canCompact)return!1;let t=!1;for(const r of this._dataByOrigin.values()){const i=new Array;for(let t=0;t<r.buffers.length&&!e.done;){const s=r.buffers[t];s.holes.length<=1?++t:(s.instances.forEach((({geometry:e})=>i.push(e))),this._vaoCache.deleteVao(s.vao),r.buffers[t]=r.buffers[r.buffers.length-1],--r.buffers.length,e.madeProgress())}if(i.length>0){for(r.buffers.forEach((e=>this._applyAdds(e,i)));i.length>0;)r.buffers.push(this._applyAndRebuild(new E,i,null));t=!0}}return t}updateHighlights(e){this.highlightOrderMap=e,this._highlightNames.clear(),this._dataByOrigin.forEach((t=>{t.buffers.forEach((t=>{t.updateHighlights(e),t.highlightNames.forEach((e=>this._highlightNames.add(e)))}))})),this._updateProduces()}_applyUpdates(e,t){const r=this._bufferWriter;if(null==r)return void e.clearUpdates();const i=r.vertexBufferLayout.stride/4;for(const s of e.updates){if(t.done)return;const{renderGeometry:o,updateType:a}=s;e.pending.updates.removeUnordered(s),t.madeProgress();const n=this._dataByOrigin.get(o.localOrigin.id),l=n?.findBuffer(o.id);if(null==l)return;const h=l.instances.get(o.id);if(a&(_.GEOMETRY|_.TRANSFORMATION)){const e=U(r.elementCount(h.geometry.geometry.attributes)*i),t=r.vertexBufferLayout.createView(e.buffer);this._writeGeometry(o,t,0),l.vao.vertexBuffers.get("geometry").setSubData(e,h.from*i,0,h.numElements*i)}a&(_.HIGHLIGHT|_.OCCLUDEE|_.VISIBILITY)&&(l.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new o;for(const i of e){const e=i.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new R(e.vec3),r.set(e.id,null,t)),t.changes.push(i)}for(const i of t){const e=i.localOrigin;if(null==e)continue;const t=this._dataByOrigin.get(e.id),s=t?.findBuffer(i.id);if(null==s)continue;let o=r.get(e.id,s);null==o&&(o=new R(e.vec3),r.set(e.id,s,o)),o.changes.push(i)}return r}_applyAddsAndRemoves(e){const{_bufferWriter:r,_dataByOrigin:i,_vaoCache:s}=this;if(null==r||null==s)return void e.clearAddsAndRemoves();const o=r.vertexBufferLayout.stride/4,a=this._computeDeltas(e.adds,e.removes);a.forEach(((e,n)=>{const l=e.get(null),h=l?.changes??[];a.delete(n,null);let u=i.get(n);if(e.forEach(((e,l)=>{if(a.delete(n,l),null==l)return void w(!1,"No VAO for removed geometries");if(l.instances.size===e.changes.length)return s.deleteVao(l.vao),t(u.buffers,l),void(0===u.buffers.length&&0===h.length&&i.delete(n));const f=l.numElements,c=l.vao.getByteLength("geometry")/4,d=h.reduce(((e,t)=>e+r.elementCount(t.geometry.attributes)),0),m=e.changes.reduce(((e,t)=>e+r.elementCount(t.geometry.attributes)),0),g=Math.min((f+d-m)*o,W),p=g>c;g>N&&g<c/2?(e.changes.forEach((({id:e})=>l.deleteInstance(e))),l.instances.forEach((({geometry:e})=>h.push(e))),this._vaoCache.deleteVao(l.vao),t(u.buffers,l)):p?this._applyAndRebuild(l,h,e):this._applyRemoves(l,e)})),h.length>0)for(null==u&&(u=new M(l.origin),i.set(n,u)),u.buffers.forEach((e=>this._applyAdds(e,h)));h.length>0;)u.buffers.push(this._applyAndRebuild(new E,h,null))})),e.clearAddsAndRemoves()}_updateDrawCommands(){this._highlightNames.clear(),this._hasOccludees=!1,this._dataByOrigin.forEach((e=>{e.buffers.forEach((e=>{e.updateIfDrawCommandsDirty(this.highlightOrderMap,this._bufferWriter.vertexBufferLayout.stride),e.hasHighlights&&n(this._highlightNames,e.highlightNames),this._hasOccludees=this._hasOccludees||e.hasOccludees}))}))}_applyAndRebuild(e,t,r){if(r)for(const d of r.changes)e.deleteInstance(d.id);const i=this._bufferWriter,s=i.vertexBufferLayout.stride,o=s/4,a=Math.floor(W/o);let n=e.numElements;for(;t.length>0;){const r=t.pop(),s=i.elementCount(r.geometry.attributes);if(n+s>a&&n>0){t.push(r);break}n+=s;const o=new A(r,0,0,this.highlightOrderMap);w(null==e.instances.get(r.id)),e.addInstance(r.id,o)}const l=n*o,h=U(l),u=i.vertexBufferLayout.createView(h.buffer);let f=0;e.resetInstanceSummary(),e.instances.forEach(((t,r)=>{this._writeGeometry(t.geometry,u,f);const s=f;f+=i.elementCount(t.geometry.geometry.attributes),e.updateInstance(r,s,f),e.updateDrawState(t)})),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(V(l)),e.vao.vertexBuffers.get("geometry").setSubData(h,0,0,f*o),e.holes.clear();const c=e.holes.pushNew();return c.from=f,c.to=Math.floor(e.vao.getByteLength("geometry")/s),e.updateDrawCommands(this.highlightOrderMap,s),e}_applyRemoves(e,t){if(0===t.changes.length||null==this._bufferWriter)return;let r=1/0,i=-1/0;for(const a of t.changes){const t=a.id,s=e.instances.get(t);if(!s)continue;e.deleteInstance(t),q&&(r=Math.min(r,s.from),i=Math.max(i,s.to));const o=j.back();if(o){if(o.to===s.from){o.to=s.to;continue}if(o.from===s.to){o.from=s.from;continue}}const n=j.pushNew();n.from=s.from,n.to=s.to}O(j);const s=this._bufferWriter.vertexBufferLayout.stride/4,o=e.vao.vertexBuffers.get("geometry");if(q){const t=(i-r)*s,a=U(t),n=this._bufferWriter.vertexBufferLayout.createView(a.buffer);a.fill(0,0,t),e.instances.forEach((e=>{if(!(e.from>=r&&e.to<=i))return;const t=e.from-r;this._writeGeometry(e.geometry,n,t)})),o.setSubData(a,r*s,0,t)}else{const e=j.reduce(((e,t)=>Math.max(e,t.numElements)),0)*s,t=U(e);t.fill(0,0,e),j.forAll((e=>o.setSubData(t,e.from*s,0,e.numElements*s)))}e.holes.pushArray(j.data,j.length),j.forAll(((e,t)=>j.data[t]=null)),j.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t){if(0===t.length||null==this._bufferWriter)return;if(!B(e))return void this._applyAndRebuild(e,t,null);const i=this._bufferWriter,s=i.vertexBufferLayout.stride/4,o=e.numElements,a=t.reduce(((e,t)=>e+i.elementCount(t.geometry.attributes)),0),n=Math.min((o+a)*s,W),l=4*n;if(e.vao.getByteLength("geometry")<V(W-N)&&l>e.vao.getByteLength("geometry"))return void this._applyAndRebuild(e,t,null);O(e.holes);const h=new Array;let u=1/0,f=-1/0;for(const r of t){const t=i.elementCount(r.geometry.attributes),s=H(e.holes,t);h.push(s),q&&null!=s&&(u=Math.min(s,u),f=Math.max(s+t,f))}const c=e.vao.vertexBuffers.get("geometry");let d=0,m=0,g=0;const p=U(q?(f-u)*s:n),y=i.vertexBufferLayout.createView(p.buffer);if(t.forEach(((t,r)=>{const o=h[r];if(null==o)return;const a=i.elementCount(t.geometry.attributes);if(!q){if(!(g===o)){const e=g-m;e>0&&c.setSubData(p,m*s,0,e*s),m=o,d=0}this._writeGeometry(t,y,d),d+=a,g=o+a}const n=new A(t,o,o+a,this.highlightOrderMap);w(null==e.instances.get(t.id)),e.addInstance(t.id,n),e.drawCommandsDirty=!0})),q){const t=(f-u)*s;p.fill(0,0,t),e.instances.forEach((e=>{if(!(e.from>=u&&e.to<=f))return;const t=e.from-u;this._writeGeometry(e.geometry,y,t)})),m=u,g=f}const _=g-m;_>0&&c.setSubData(p,m*s,0,_*s),r(t,((e,t)=>null==h[t]))}_writeGeometry(e,t,r){null!=this._bufferWriter&&(u(S,e.transformation),S[12]-=e.localOrigin.vec3[0],S[13]-=e.localOrigin.vec3[1],S[14]-=e.localOrigin.vec3[2],f(L,S),c(L,L),this._bufferWriter.write(S,L,e.geometry.attributes,e.geometry.objectAndLayerIdColor,t,r))}updateAnimation(e){return this.material.update(e)}acquireTechniques(e){if(!this.material.shouldRender(e))return null;const{output:t,bind:r}=e,i=this.material.produces.get(r.slot);if(!i?.(t))return null;const{highlight:s,slot:o}=r,a=t===g.ShadowHighlight,n=t===g.Highlight,l=n||a,h=s?.name;if(l&&(0===this._highlightNames.size||n&&h&&!this._highlightNames.has(h)))return null;const u=e=>n&&!!h&&!e.has(h),f=t===g.ShadowExcludeHighlight,c=!(l||f);for(const{buffers:d}of this._dataByOrigin.values())for(const i of d){if(u(i.highlightNames))continue;const s=a?i.drawCommandsHighlights.get(x):l?h?i.drawCommandsHighlights.get(h):i.drawCommandsHighlights.size>0:((f&&i.needsMultipleCommands()?i.drawCommandsShadowHighlightRest:i.drawCommandsDefault)||null)?.length??!1,n=c&&i.drawCommandsOccludees||null;if(s||n?.length){const i=this._glMaterials.load(e.rctx,o,t),s=i?.beginSlot(r);if(s)return s}}return null}render(e,t){const{output:r,bind:i}=e,{slot:s,highlight:o}=i,n=r===g.Highlight,l=o?.name??"";if(n&&!o)return;const h=r===g.ShadowHighlight,u=n||h,f=r===g.ShadowExcludeHighlight,c=!(u||f),d=s===b.OCCLUDER_MATERIAL||s===b.TRANSPARENT_OCCLUDER_MATERIAL?s:null,{rctx:m}=e;m.runAppleAmdDriverHelper();const p=m.bindTechnique(t,i,this.material.parameters);for(const g of this._dataByOrigin.values())for(const e of g.buffers){if(n&&(!e.hasHighlights||!e.drawCommandsHighlights.has(l)))continue;if(h&&(!e.hasHighlights||!e.drawCommandsHighlights.has(x)))continue;const r=()=>{const t=[],r=e.drawCommandsHighlights.get(x)??new a;return r&&t.push(r),t},s=u&&!h?e.drawCommandsHighlights.get(l)??null:null,o=h?r():u?s?[s]:z:f&&e.needsMultipleCommands()?[e.drawCommandsShadowHighlightRest]:[e.drawCommandsDefault],y=o.some((e=>e.length>0)),_=c&&e.drawCommandsOccludees||null;if(y||_?.length){if(this._drawParameters.origin=g.origin,p.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e.vao),m.bindVAO(e.vao),y)for(const e of o)m.setPipelineState(t.getPipeline(!1,d)),e.forAll((e=>m.drawArrays(t.primitiveType,e.first,e.count)));_?.length&&(m.setPipelineState(t.getPipeline(!0,d)),_.forAll((e=>m.drawArrays(t.primitiveType,e.first,e.count))))}}}static prune(){G=new Float32Array(N)}get test(){}};e([l({constructOnly:!0})],D.prototype,"material",void 0),e([l({})],D.prototype,"highlightOrderMap",void 0),D=e([h("esri.views.3d.webgl-engine.materials.renderers.MergedRenderer")],D);class R{constructor(e){this.origin=e,this.changes=new Array}}function H(e,t){const r=e.find((e=>e.numElements>=t));if(null==r)return null;const i=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),i}const S=d(),L=d(),j=new a({allocator:e=>e||new C,deallocator:null}),N=65536,I=4*N,P=1024,T=16777216,W=T/4;let G=new Float32Array(N);function U(e){return G.length<e&&(G=new Float32Array(e)),G}function V(e){const t=4*e;return t<=P?P:t<I?i(t):Math.max(Math.min(Math.ceil(1.5*t/I)*I,T),t)}const z=[];let q;export{D as MergedRenderer,V as sizeForVao};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{removeUnordered as t,filterInPlace as r}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTwo as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{NestedMap as o}from"../../../../../core/NestedMap.js";import a from"../../../../../core/PooledArray.js";import{addMany as n}from"../../../../../core/SetUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{copy as u,invert as f,transpose as c}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as m}from"../../../support/buffer/glUtil.js";import{ShaderOutput as g}from"../../core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as p}from"../../effects/RenderPlugin.js";import{GLMaterials as y}from"../../lib/GLMaterials.js";import{DirtyState as _}from"../../lib/ModelDirtyTypes.js";import{RenderSlot as b}from"../../lib/RenderSlot.js";import{assert as w}from"../../lib/Util.js";import{DrawParameters as v}from"../DrawParameters.js";import{BufferRange as C,mergeAdjacentRanges as O}from"./BufferRange.js";import{Instance as A}from"./Instance.js";import{PerBufferData as E,hasVao as B}from"./PerBufferData.js";import{PerOriginData as M}from"./PerOriginData.js";import{defaultHighlightName as x}from"../../../../support/HighlightDefaults.js";let D=class extends p{get _hasHighlights(){return this._highlightNames.size>0}hasHighlight(e){return this._highlightNames.has(e)}constructor(e){super(e),this._dataByOrigin=new Map,this._drawParameters=new v,this._highlightNames=new Set,this.drapedPriority=0,this._produces=new Map,this._hasOccludees=!1}destroy(){this._glMaterials=s(this._glMaterials),this._dataByOrigin.forEach((e=>e.dispose())),this._dataByOrigin.clear(),this._vaoCache=null}initialize(){this._updateProduces()}_updateProduces(){this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>!(0===this._dataByOrigin.size||!(t!==g.Highlight&&t!==g.ShadowHighlight||this._hasHighlights))&&e(t)))}))}initializeRenderContext(e){q??=e.renderContext.rctx.isAssumedMetalDriver,this._glMaterials=new y(this.material,e.materials),this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,m(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}get produces(){return this._produces}get hasOccludees(){return this._hasOccludees}get hasEmissions(){return this.material.hasEmissions}get isDecoration(){return this.material.parameters.isDecoration}queryRenderOccludedState(e){return this.material.queryRenderOccludedState(e)}get numGeometries(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.instances.size),0))),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.vao.cachedMemory),0))),e}forEachGeometry(e){this._dataByOrigin.forEach((t=>t.buffers.forEach((t=>t.instances.forEach((({geometry:t})=>e(t)))))))}modify(e,t){this._applyUpdates(e,t),this._applyAddsAndRemoves(e),this._updateDrawCommands()}get canCompact(){for(const e of this._dataByOrigin.values())if(e.buffers.some((e=>e.holes.length>1)))return!0;return!1}compact(e){if(!this.canCompact)return!1;let t=!1;for(const r of this._dataByOrigin.values()){const i=new Array;for(let t=0;t<r.buffers.length&&!e.done;){const s=r.buffers[t];s.holes.length<=1?++t:(s.instances.forEach((({geometry:e})=>i.push(e))),this._vaoCache.deleteVao(s.vao),r.buffers[t]=r.buffers[r.buffers.length-1],--r.buffers.length,e.madeProgress())}if(i.length>0){for(r.buffers.forEach((e=>this._applyAdds(e,i)));i.length>0;)r.buffers.push(this._applyAndRebuild(new E,i,null));t=!0}}return t}updateHighlights(e){this.highlightOrderMap=e,this._highlightNames.clear(),this._dataByOrigin.forEach((t=>{t.buffers.forEach((t=>{t.updateHighlights(e),t.highlightNames.forEach((e=>this._highlightNames.add(e)))}))})),this._updateProduces()}_applyUpdates(e,t){const r=this._bufferWriter;if(null==r)return void e.clearUpdates();const i=r.vertexBufferLayout.stride/4;for(const s of e.updates){if(t.done)return;const{renderGeometry:o,updateType:a}=s;e.pending.updates.removeUnordered(s),t.madeProgress();const n=this._dataByOrigin.get(o.localOrigin.id),l=n?.findBuffer(o.id);if(null==l)return;const h=l.instances.get(o.id);if(a&(_.GEOMETRY|_.TRANSFORMATION)){const e=U(r.elementCount(h.geometry.geometry.attributes)*i),t=r.vertexBufferLayout.createView(e.buffer);this._writeGeometry(o,t,0),l.vao.vertexBuffers.get("geometry").setSubData(e,h.from*i,0,h.numElements*i)}a&(_.HIGHLIGHT|_.OCCLUDEE|_.VISIBILITY)&&(l.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new o;for(const i of e){const e=i.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new R(e.vec3),r.set(e.id,null,t)),t.changes.push(i)}for(const i of t){const e=i.localOrigin;if(null==e)continue;const t=this._dataByOrigin.get(e.id),s=t?.findBuffer(i.id);if(null==s)continue;let o=r.get(e.id,s);null==o&&(o=new R(e.vec3),r.set(e.id,s,o)),o.changes.push(i)}return r}_applyAddsAndRemoves(e){const{_bufferWriter:r,_dataByOrigin:i,_vaoCache:s}=this;if(null==r||null==s)return void e.clearAddsAndRemoves();const o=r.vertexBufferLayout.stride/4,a=this._computeDeltas(e.adds,e.removes);a.forEach(((e,n)=>{const l=e.get(null),h=l?.changes??[];a.delete(n,null);let u=i.get(n);if(e.forEach(((e,l)=>{if(a.delete(n,l),null==l&&w(!1,"No VAO for removed geometries"),l.instances.size===e.changes.length)return s.deleteVao(l.vao),t(u.buffers,l),void(0===u.buffers.length&&0===h.length&&i.delete(n));const f=l.numElements,c=l.vao.getByteLength("geometry")/4,d=h.reduce(((e,t)=>e+r.elementCount(t.geometry.attributes)),0),m=e.changes.reduce(((e,t)=>e+r.elementCount(t.geometry.attributes)),0),g=Math.min((f+d-m)*o,W),p=g>c;g>N&&g<c/2?(e.changes.forEach((({id:e})=>l.deleteInstance(e))),l.instances.forEach((({geometry:e})=>h.push(e))),this._vaoCache.deleteVao(l.vao),t(u.buffers,l)):p?this._applyAndRebuild(l,h,e):this._applyRemoves(l,e)})),h.length>0)for(null==u&&(u=new M(l.origin),i.set(n,u)),u.buffers.forEach((e=>this._applyAdds(e,h)));h.length>0;)u.buffers.push(this._applyAndRebuild(new E,h,null))})),e.clearAddsAndRemoves()}_updateDrawCommands(){this._highlightNames.clear(),this._hasOccludees=!1,this._dataByOrigin.forEach((e=>{e.buffers.forEach((e=>{e.updateIfDrawCommandsDirty(this.highlightOrderMap,this._bufferWriter.vertexBufferLayout.stride),e.hasHighlights&&n(this._highlightNames,e.highlightNames),this._hasOccludees=this._hasOccludees||e.hasOccludees}))}))}_applyAndRebuild(e,t,r){if(r)for(const d of r.changes)e.deleteInstance(d.id);const i=this._bufferWriter,s=i.vertexBufferLayout.stride,o=s/4,a=Math.floor(W/o);let n=e.numElements;for(;t.length>0;){const r=t.pop(),s=i.elementCount(r.geometry.attributes);if(n+s>a&&n>0){t.push(r);break}n+=s;const o=new A(r,0,0,this.highlightOrderMap);w(null==e.instances.get(r.id)),e.addInstance(r.id,o)}const l=n*o,h=U(l),u=i.vertexBufferLayout.createView(h.buffer);let f=0;e.resetInstanceSummary(),e.instances.forEach(((t,r)=>{this._writeGeometry(t.geometry,u,f);const s=f;f+=i.elementCount(t.geometry.geometry.attributes),e.updateInstance(r,s,f),e.updateDrawState(t)})),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(V(l)),e.vao.vertexBuffers.get("geometry").setSubData(h,0,0,f*o),e.holes.clear();const c=e.holes.pushNew();return c.from=f,c.to=Math.floor(e.vao.getByteLength("geometry")/s),e.updateDrawCommands(this.highlightOrderMap,s),e}_applyRemoves(e,t){if(0===t.changes.length||null==this._bufferWriter)return;let r=1/0,i=-1/0;for(const a of t.changes){const t=a.id,s=e.instances.get(t);if(!s)continue;e.deleteInstance(t),q&&(r=Math.min(r,s.from),i=Math.max(i,s.to));const o=j.back();if(o){if(o.to===s.from){o.to=s.to;continue}if(o.from===s.to){o.from=s.from;continue}}const n=j.pushNew();n.from=s.from,n.to=s.to}O(j);const s=this._bufferWriter.vertexBufferLayout.stride/4,o=e.vao.vertexBuffers.get("geometry");if(q){const t=(i-r)*s,a=U(t),n=this._bufferWriter.vertexBufferLayout.createView(a.buffer);a.fill(0,0,t),e.instances.forEach((e=>{if(!(e.from>=r&&e.to<=i))return;const t=e.from-r;this._writeGeometry(e.geometry,n,t)})),o.setSubData(a,r*s,0,t)}else{const e=j.reduce(((e,t)=>Math.max(e,t.numElements)),0)*s,t=U(e);t.fill(0,0,e),j.forAll((e=>o.setSubData(t,e.from*s,0,e.numElements*s)))}e.holes.pushArray(j.data,j.length),j.forAll(((e,t)=>j.data[t]=null)),j.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t){if(0===t.length||null==this._bufferWriter)return;if(!B(e))return void this._applyAndRebuild(e,t,null);const i=this._bufferWriter,s=i.vertexBufferLayout.stride/4,o=e.numElements,a=t.reduce(((e,t)=>e+i.elementCount(t.geometry.attributes)),0),n=Math.min((o+a)*s,W),l=4*n;if(e.vao.getByteLength("geometry")<V(W-N)&&l>e.vao.getByteLength("geometry"))return void this._applyAndRebuild(e,t,null);O(e.holes);const h=new Array;let u=1/0,f=-1/0;for(const r of t){const t=i.elementCount(r.geometry.attributes),s=H(e.holes,t);h.push(s),q&&null!=s&&(u=Math.min(s,u),f=Math.max(s+t,f))}const c=e.vao.vertexBuffers.get("geometry");let d=0,m=0,g=0;const p=U(q?(f-u)*s:n),y=i.vertexBufferLayout.createView(p.buffer);if(t.forEach(((t,r)=>{const o=h[r];if(null==o)return;const a=i.elementCount(t.geometry.attributes);if(!q){if(!(g===o)){const e=g-m;e>0&&c.setSubData(p,m*s,0,e*s),m=o,d=0}this._writeGeometry(t,y,d),d+=a,g=o+a}const n=new A(t,o,o+a,this.highlightOrderMap);w(null==e.instances.get(t.id)),e.addInstance(t.id,n),e.drawCommandsDirty=!0})),q){const t=(f-u)*s;p.fill(0,0,t),e.instances.forEach((e=>{if(!(e.from>=u&&e.to<=f))return;const t=e.from-u;this._writeGeometry(e.geometry,y,t)})),m=u,g=f}const _=g-m;_>0&&c.setSubData(p,m*s,0,_*s),r(t,((e,t)=>null==h[t]))}_writeGeometry(e,t,r){null!=this._bufferWriter&&(u(S,e.transformation),S[12]-=e.localOrigin.vec3[0],S[13]-=e.localOrigin.vec3[1],S[14]-=e.localOrigin.vec3[2],f(L,S),c(L,L),this._bufferWriter.write(S,L,e.geometry.attributes,e.geometry.objectAndLayerIdColor,t,r))}updateAnimation(e){return this.material.update(e)}acquireTechniques(e){if(!this.material.shouldRender(e))return null;const{output:t,bind:r}=e,i=this.material.produces.get(r.slot);if(!i?.(t))return null;const{highlight:s,slot:o}=r,a=t===g.ShadowHighlight,n=t===g.Highlight,l=n||a,h=s?.name;if(l&&(0===this._highlightNames.size||n&&h&&!this._highlightNames.has(h)))return null;const u=e=>n&&!!h&&!e.has(h),f=t===g.ShadowExcludeHighlight,c=!(l||f);for(const{buffers:d}of this._dataByOrigin.values())for(const i of d){if(u(i.highlightNames))continue;const s=a?i.drawCommandsHighlights.get(x):l?h?i.drawCommandsHighlights.get(h):i.drawCommandsHighlights.size>0:((f&&i.needsMultipleCommands()?i.drawCommandsShadowHighlightRest:i.drawCommandsDefault)||null)?.length??!1,n=c&&i.drawCommandsOccludees||null;if(s||n?.length){const i=this._glMaterials.load(e.rctx,o,t),s=i?.beginSlot(r);if(s)return s}}return null}render(e,t){const{output:r,bind:i}=e,{slot:s,highlight:o}=i,n=r===g.Highlight,l=o?.name??"";if(n&&!o)return;const h=r===g.ShadowHighlight,u=n||h,f=r===g.ShadowExcludeHighlight,c=!(u||f),d=s===b.OCCLUDER_MATERIAL||s===b.TRANSPARENT_OCCLUDER_MATERIAL?s:null,{rctx:m}=e;m.runAppleAmdDriverHelper();const p=m.bindTechnique(t,i,this.material.parameters);for(const g of this._dataByOrigin.values())for(const e of g.buffers){if(n&&(!e.hasHighlights||!e.drawCommandsHighlights.has(l)))continue;if(h&&(!e.hasHighlights||!e.drawCommandsHighlights.has(x)))continue;const r=()=>{const t=[],r=e.drawCommandsHighlights.get(x)??new a;return r&&t.push(r),t},s=u&&!h?e.drawCommandsHighlights.get(l)??null:null,o=h?r():u?s?[s]:z:f&&e.needsMultipleCommands()?[e.drawCommandsShadowHighlightRest]:[e.drawCommandsDefault],y=o.some((e=>e.length>0)),_=c&&e.drawCommandsOccludees||null;if(y||_?.length){if(this._drawParameters.origin=g.origin,p.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e.vao),m.bindVAO(e.vao),y)for(const e of o)m.setPipelineState(t.getPipeline(!1,d)),e.forAll((e=>m.drawArrays(t.primitiveType,e.first,e.count)));_?.length&&(m.setPipelineState(t.getPipeline(!0,d)),_.forAll((e=>m.drawArrays(t.primitiveType,e.first,e.count))))}}}static prune(){G=new Float32Array(N)}get test(){}};e([l({constructOnly:!0})],D.prototype,"material",void 0),e([l({})],D.prototype,"highlightOrderMap",void 0),D=e([h("esri.views.3d.webgl-engine.materials.renderers.MergedRenderer")],D);class R{constructor(e){this.origin=e,this.changes=new Array}}function H(e,t){const r=e.find((e=>e.numElements>=t));if(null==r)return null;const i=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),i}const S=d(),L=d(),j=new a({allocator:e=>e||new C,deallocator:null}),N=65536,I=4*N,P=1024,T=16777216,W=T/4;let G=new Float32Array(N);function U(e){return G.length<e&&(G=new Float32Array(e)),G}function V(e){const t=4*e;return t<=P?P:t<I?i(t):Math.max(Math.min(Math.ceil(1.5*t/I)*I,T),t)}const z=[];let q;export{D as MergedRenderer,V as sizeForVao};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import{unpackFloatRGBA as s}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{removeMaybe as n,destroyMaybe as o}from"../../../../core/maybe.js";import{watch as a,initial as h,syncAndInitial as p}from"../../../../core/reactiveUtils.js";import{addFrameTask as d}from"../../../../core/scheduling.js";import{Milliseconds as c}from"../../../../core/time.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{isMoon as u,isMars as f}from"../../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as _}from"../../../ViewingMode.js";import{ChapmanAtmosphere as g}from"../../environment/ChapmanAtmosphere.js";import{CloudsComposition as w}from"../../environment/CloudsComposition.js";import{Fog as x}from"../../environment/Fog.js";import{LocalAtmosphere as v}from"../../environment/LocalAtmosphere.js";import j from"../../environment/MarsAtmosphere.js";import{ComponentObjectCollection as y}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as b}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as R}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{BloomRenderNode as A}from"../effects/bloom/BloomRenderNode.js";import{ObjectAndLayerIDRenderNode as S}from"../effects/geometry/ObjectAndLayerIDRenderNode.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{RenderOccludedRenderNode as T}from"../effects/geometry/RenderOccludedRenderNode.js";import{Haze as O}from"../effects/haze/Haze.js";import{Highlight as U}from"../effects/highlight/Highlight.js";import{ShadowHighlight as q}from"../effects/highlight/ShadowHighlight.js";import{Magnifier as D}from"../effects/magnifier/Magnifier.js";import{SMAA as L}from"../effects/smaa/SMAA.js";import{SSAO as M}from"../effects/ssao/SSAO.js";import{Stars as k}from"../effects/stars/Stars.js";import{RenderRequestType as E}from"../lib/basicInterfaces.js";import B from"../lib/CompositingHelper.js";import{GLMaterialRepository as F}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as H}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as W}from"../lib/Renderer.js";import{RenderingContext as G}from"../lib/RenderingContext.js";import{TextureRepository as N}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as z}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as I}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as P}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as K}from"./contextCache.js";import{removeLoadedShaderModules as V}from"./renderUtils.js";import{ScreenshotManager as X,ScreenshotContext as Q}from"./ScreenshotManager.js";import{contextCache as J}from"./testUtils.js";import{RenderState as Y}from"../../../support/RenderState.js";let Z=class extends t{constructor(e){super(e),this.events=new r,this.waterTextures=new P,this.olidRenderHelper=C()?new H:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.bloom=null,this.test=null;const t=e.stage;try{this._initializeContext(t)}catch(n){return void console.error("Failed to initialize context",n)}const{memoryController:s}=t.view.resourceController;this.stippleTextures=I(this._rctx,s),this.markerTextures=z(this._rctx,s),this._techniques=new R(new b(this._rctx,t.viewingMode,this.stippleTextures,this.waterTextures,this.markerTextures)),this._textures=new N(t),this.addHandles(this._textures.events.on("changed",(e=>this.requestRender(e)))),this._materials=new F(this._textures,this._techniques,(()=>this.requestRender()),(()=>this.requestRender())),this._compositingHelper=new B(this._rctx,this._techniques),this.renderer=new W(t,this._materials,this._techniques,this._rctx,this._compositingHelper,(e=>this.requestRender(e))),this.addHandles([a((()=>t.view.ready),(e=>{e&&this._createRenderNodes()}),h),a((()=>this.waterTextures?.updating),(()=>this.requestRender()),h),a((()=>t.view.qualityProfile),(e=>this.renderer?.updateRenderFeatures(e)),p)]);const i={renderScene:(e,t,r,s)=>this.renderer.render(e,t,r,s),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,s)=>t.options.screenshot.renderOverlay(e,r,s)};this._screenshotManager=new X(this._rctx,i,(e=>this.events.emit("force-camera-for-screenshot",e))),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=n(this._frameTask),this._techniques=o(this._techniques),this._componentObjects=o(this._componentObjects),this._screenshotManager=o(this._screenshotManager),o(this.renderer),this._textures=o(this._textures),o(this.waterTextures),o(this.markerTextures),o(this.stippleTextures),this._canvas=null,this._rctx=o(this._rctx)}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new k({view:e}),u(e.spatialReference)||(t===_.Local?(new v({view:e}),this.bloom=new A({view:e})):f(e.spatialReference)?(new j({view:e}),this.bloom=new A({view:e})):(new g({view:e}),new w({view:e}),this.bloom=new A({view:e}),new O({view:e}),new x({view:e}))),new M({view:e,isEnabled:()=>this.renderer.hasSSAO}),new L({view:e,isEnabled:()=>this.renderer.hasSMAA}),new D({view:e}),new U({view:e}),new q({view:e,viewingMode:t}),new T({view:e}),C()&&new S({view:e})}requestRender(e=E.UPDATE){this._needsRender=!0,e===E.UPDATE&&(this._needsUpdate=!0)}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textures.updating||this.waterTextures.updating}get textures(){return this._textures}get techniques(){return this._techniques}get compositingHelper(){return this._compositingHelper}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(e).then((e=>e[0]))}takeScreenshotWithOID(e){return e.objectAndLayerIdColor=!0,this._screenshotManager.takeScreenshot(e)}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,r,i,n,o=n){const a=i.constrainWindowSize(t,r,n*i.pixelRatio,o*i.pixelRatio),h=this._ensureLinearDepthArrayBuffer(a);this.renderer.readMainDepth(a,h);const p=(e,t,r)=>s(t,e)*(r[1]-r[0])+r[0];let d=Number.MAX_VALUE;for(let s=0;s<a[2]*a[3];s++){const e=p(4*s,h,i.nearFar);d>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(d=e)}if(e){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);null!=s&&d>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(d=s)}return d===Number.MAX_VALUE?void 0:d}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){V(),await this._techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,s=E.BACKGROUND,i=!1;const n={preRender:({time:i})=>{r=this.updating,s=this._needsUpdate?E.UPDATE:E.BACKGROUND,e.commitSyncLayers(),i=this.test?.time??i;(c(i-this._lastAnimationUpdate)>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,i)&&this.requestRender(E.BACKGROUND),this._lastAnimationUpdate=i)},render:({time:e})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const r=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,e=this.test?.time??e,this.renderer.render(t,e),i=!0,r&&this.renderer.hasReflections&&(this.requestRender(E.BACKGROUND),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this._textures.update();const r=new Q(t,this.renderer.fboCache);e=this.test?.time??e,this._screenshotManager.update(r,e)},finish:()=>{i&&(this.renderer.finish(t.mode===Y.IDLE?s:E.UPDATE),i=!1)}};this._frameTask=d(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const s={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",s);if(null==n)return void i.getLogger(this).error("A WebGL2 context could not be created.");this._rctx=$(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&i.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get componentObjectCollection(){return null==this._componentObjects&&(this._componentObjects=new y(this.renderer.renderPassManager,this._viewingMode)),this._componentObjects}set componentObjectCollection(e){this._componentObjects=e}updateQualitySettings(e){this.test&&null!=this.test.time&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=c(0)),this._rctx.updateOptions({maxPreferredTextureSize:this.stage.view.qualitySettings.maxTextureSize})}};function $(e,t){const r=(e,r)=>t.view.resourceController.memoryController.newCache(e,r),s={disabledExtensions:t.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:t.options.debugWebGLExtensions||{},maxAnisotropy:8,maxPreferredTextureSize:t.view.qualitySettings.maxTextureSize,newCache:r};if(J.enabled){let t=ee.get(e);return t?(t.configure(s),t.ref(),t):(t=new G(e,s),ee.set(e,t),t.ref(),t)}return new G(e,s)}e([l({type:Boolean,readOnly:!0})],Z.prototype,"updating",null),e([l({constructOnly:!0})],Z.prototype,"stage",void 0),e([l()],Z.prototype,"_rctx",void 0),e([l()],Z.prototype,"_canvas",void 0),e([l()],Z.prototype,"stippleTextures",void 0),e([l()],Z.prototype,"markerTextures",void 0),e([l()],Z.prototype,"waterTextures",void 0),e([l({readOnly:!0})],Z.prototype,"olidRenderHelper",void 0),e([l()],Z.prototype,"_textures",void 0),e([l({readOnly:!0})],Z.prototype,"renderer",void 0),e([l()],Z.prototype,"_screenshotManager",void 0),e([l()],Z.prototype,"componentObjectCollection",null),e([l()],Z.prototype,"_componentObjects",void 0),e([l()],Z.prototype,"_needsUpdate",void 0),e([l()],Z.prototype,"_needsWaterReflectionUpdate",void 0),Z=e([m("esri.views.3d.webgl-engine.parts.RenderView")],Z);const ee=K();export{Z as RenderView};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import{unpackFloatRGBA as s}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{removeMaybe as n,destroyMaybe as o}from"../../../../core/maybe.js";import{watch as a,initial as h,syncAndInitial as p}from"../../../../core/reactiveUtils.js";import{addFrameTask as d}from"../../../../core/scheduling.js";import{Milliseconds as c}from"../../../../core/time.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{isMoon as u,isMars as f}from"../../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as _}from"../../../ViewingMode.js";import{ChapmanAtmosphere as g}from"../../environment/ChapmanAtmosphere.js";import{CloudsComposition as w}from"../../environment/CloudsComposition.js";import{Fog as x}from"../../environment/Fog.js";import{LocalAtmosphere as v}from"../../environment/LocalAtmosphere.js";import j from"../../environment/MarsAtmosphere.js";import{ComponentObjectCollection as y}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as b}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as R}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{BloomRenderNode as A}from"../effects/bloom/BloomRenderNode.js";import{ObjectAndLayerIDRenderNode as S}from"../effects/geometry/ObjectAndLayerIDRenderNode.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{RenderOccludedRenderNode as T}from"../effects/geometry/RenderOccludedRenderNode.js";import{Haze as O}from"../effects/haze/Haze.js";import{Highlight as U}from"../effects/highlight/Highlight.js";import{ShadowHighlight as q}from"../effects/highlight/ShadowHighlight.js";import{Magnifier as D}from"../effects/magnifier/Magnifier.js";import{SMAA as L}from"../effects/smaa/SMAA.js";import{SSAO as M}from"../effects/ssao/SSAO.js";import{Stars as k}from"../effects/stars/Stars.js";import{RenderRequestType as E}from"../lib/basicInterfaces.js";import B from"../lib/CompositingHelper.js";import{GLMaterialRepository as F}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as H}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as W}from"../lib/Renderer.js";import{RenderingContext as G}from"../lib/RenderingContext.js";import{TextureRepository as N}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as z}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as I}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as P}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as K}from"./contextCache.js";import{removeLoadedShaderModules as V}from"./renderUtils.js";import{ScreenshotManager as X,ScreenshotContext as Q}from"./ScreenshotManager.js";import{contextCache as J}from"./testUtils.js";import{RenderState as Y}from"../../../support/RenderState.js";let Z=class extends t{constructor(e){super(e),this.events=new r,this.waterTextures=new P,this.olidRenderHelper=C()?new H:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.bloom=null,this.test=null;const t=e.stage;try{this._initializeContext(t)}catch(o){return void console.error("Failed to initialize context",o)}const{memoryController:s}=t.view.resourceController;this.stippleTextures=I(this._rctx,s),this.markerTextures=z(this._rctx,s),this._techniques=new R(new b(this._rctx,t.viewingMode,this.stippleTextures,this.waterTextures,this.markerTextures)),this._textures=new N(t),this.addHandles(this._textures.events.on("changed",(e=>this.requestRender(e))));const i=new F(this._textures,this._techniques,(()=>this.requestRender()),(()=>this.requestRender()));this._compositingHelper=new B(this._rctx,this._techniques),this.renderer=new W(t,i,this._techniques,this._rctx,this._compositingHelper,(e=>this.requestRender(e))),this.addHandles([a((()=>t.view.ready),(e=>{e&&this._createRenderNodes()}),h),a((()=>this.waterTextures?.updating),(()=>this.requestRender()),h),a((()=>t.view.qualityProfile),(e=>this.renderer?.updateRenderFeatures(e)),p)]);const n={renderScene:(e,t,r,s)=>this.renderer.render(e,t,r,s),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,s)=>t.options.screenshot.renderOverlay(e,r,s)};this._screenshotManager=new X(this._rctx,n,(e=>this.events.emit("force-camera-for-screenshot",e))),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=n(this._frameTask),this._techniques=o(this._techniques),this._componentObjects=o(this._componentObjects),this._screenshotManager=o(this._screenshotManager),o(this.renderer),this._textures=o(this._textures),o(this.waterTextures),o(this.markerTextures),o(this.stippleTextures),this._canvas=null,this._rctx=o(this._rctx)}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new k({view:e}),u(e.spatialReference)||(t===_.Local?(new v({view:e}),this.bloom=new A({view:e})):f(e.spatialReference)?(new j({view:e}),this.bloom=new A({view:e})):(new g({view:e}),new w({view:e}),this.bloom=new A({view:e}),new O({view:e}),new x({view:e}))),new M({view:e,isEnabled:()=>this.renderer.hasSSAO}),new L({view:e,isEnabled:()=>this.renderer.hasSMAA}),new D({view:e}),new U({view:e}),new q({view:e,viewingMode:t}),new T({view:e}),C()&&new S({view:e})}requestRender(e=E.UPDATE){this._needsRender=!0,e===E.UPDATE&&(this._needsUpdate=!0)}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textures.updating||this.waterTextures.updating}get textures(){return this._textures}get techniques(){return this._techniques}get compositingHelper(){return this._compositingHelper}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(e).then((e=>e[0]))}takeScreenshotWithOID(e){return e.objectAndLayerIdColor=!0,this._screenshotManager.takeScreenshot(e)}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,r,i,n,o=n){const a=i.constrainWindowSize(t,r,n*i.pixelRatio,o*i.pixelRatio),h=this._ensureLinearDepthArrayBuffer(a);this.renderer.readMainDepth(a,h);const p=(e,t,r)=>s(t,e)*(r[1]-r[0])+r[0];let d=Number.MAX_VALUE;for(let s=0;s<a[2]*a[3];s++){const e=p(4*s,h,i.nearFar);d>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(d=e)}if(e){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);null!=s&&d>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(d=s)}return d===Number.MAX_VALUE?void 0:d}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){V(),await this._techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,s=E.BACKGROUND,i=!1;const n={preRender:({time:i})=>{r=this.updating,s=this._needsUpdate?E.UPDATE:E.BACKGROUND,e.commitSyncLayers(),i=this.test?.time??i;(c(i-this._lastAnimationUpdate)>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,i)&&this.requestRender(E.BACKGROUND),this._lastAnimationUpdate=i)},render:({time:e})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const r=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,e=this.test?.time??e,this.renderer.render(t,e),i=!0,r&&this.renderer.hasReflections&&(this.requestRender(E.BACKGROUND),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this._textures.update();const r=new Q(t,this.renderer.fboCache);e=this.test?.time??e,this._screenshotManager.update(r,e)},finish:()=>{i&&(this.renderer.finish(t.mode===Y.IDLE?s:E.UPDATE),i=!1)}};this._frameTask=d(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const s={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",s);if(null==n)return void i.getLogger(this).error("A WebGL2 context could not be created.");this._rctx=$(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&i.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get componentObjectCollection(){return null==this._componentObjects&&(this._componentObjects=new y(this.renderer.renderPassManager,this._viewingMode)),this._componentObjects}set componentObjectCollection(e){this._componentObjects=e}updateQualitySettings(e){this.test&&null!=this.test.time&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=c(0)),this._rctx.updateOptions({maxPreferredTextureSize:this.stage.view.qualitySettings.maxTextureSize})}};function $(e,t){const r=(e,r)=>t.view.resourceController.memoryController.newCache(e,r),s={disabledExtensions:t.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:t.options.debugWebGLExtensions||{},maxAnisotropy:8,maxPreferredTextureSize:t.view.qualitySettings.maxTextureSize,newCache:r};if(J.enabled){let t=ee.get(e);return t?(t.configure(s),t.ref(),t):(t=new G(e,s),ee.set(e,t),t.ref(),t)}return new G(e,s)}e([l({type:Boolean,readOnly:!0})],Z.prototype,"updating",null),e([l({constructOnly:!0})],Z.prototype,"stage",void 0),e([l()],Z.prototype,"_rctx",void 0),e([l()],Z.prototype,"_canvas",void 0),e([l()],Z.prototype,"stippleTextures",void 0),e([l()],Z.prototype,"markerTextures",void 0),e([l()],Z.prototype,"waterTextures",void 0),e([l({readOnly:!0})],Z.prototype,"olidRenderHelper",void 0),e([l()],Z.prototype,"_textures",void 0),e([l({readOnly:!0})],Z.prototype,"renderer",void 0),e([l()],Z.prototype,"_screenshotManager",void 0),e([l()],Z.prototype,"componentObjectCollection",null),e([l()],Z.prototype,"_componentObjects",void 0),e([l()],Z.prototype,"_needsUpdate",void 0),e([l()],Z.prototype,"_needsWaterReflectionUpdate",void 0),Z=e([m("esri.views.3d.webgl-engine.parts.RenderView")],Z);const ee=K();export{Z as RenderView};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../core/Error.js";import{property as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../core/Error.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{commonRasterFieldNames as a,addMultidimensionalFieldValues as o,rasterFieldPrefix as n}from"../../layers/support/rasterFieldUtils.js";import{combineTimeExtent as l}from"../../layers/support/timeSupport.js";import{isFunctionRaster as u}from"../../layers/support/rasterDatasets/datasetUtils.js";import{getDefaultDatumTransformationForDataset as p,projectDatasetExtent as c,getSourceScale as m}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{getFetchPopupTemplate as y}from"./support/popupUtils.js";const f=f=>{let d=class extends f{constructor(){super(...arguments),this.layer=null,this.tileInfo=null}get fullExtent(){try{return this.layer.loaded?this._getFullExtent():null}catch{return null}}get timeExtent(){return l(this.layer,this.view?.timeExtent,this._get("timeExtent"))}get hasTilingEffects(){return!!(this.layer.renderer&&"dynamicRangeAdjustment"in this.layer.renderer&&this.layer.renderer.dynamicRangeAdjustment)}get datumTransformation(){try{return this.layer.loaded?p(this.layer.fullExtent,this.view.spatialReference,!0):null}catch{return null}}supportsSpatialReference(e){try{return!this.layer.loaded||!!c(this.layer.serviceRasterInfo,e)}catch{return!1}}async fetchPopupFeaturesAtLocation(e,s){const{layer:i}=this;if(!e)throw new r("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:i});const{popupEnabled:l}=i,p=y(i,s);if(!l||null==p)return[];const c=[],{value:m,magdirValue:f,processedValue:d}=await i.identify(e,{timeExtent:this.timeExtent,signal:s?.signal});let h="";if(m?.length){h="imagery-tile"===i.type&&i.hasStandardTime()&&null!=m[0]?m.map((e=>i.getStandardTimeValue(e))).join(", "):m.join(", ");const e={ObjectId:0};e[a.servicePixelValue]="imagery-tile"===i.type&&u(i.raster)?d?.join(", "):h,e[a.rawServicePixelValue]=h;const r=i.raster?.rasterInfo??i.serviceRasterInfo,s=r?.attributeTable;if(null!=s){const{fields:t,features:r}=s,i=t.find((({name:e})=>"value"===e.toLowerCase())),o=e[a.servicePixelValue],l=i?r.find((e=>String(e.attributes[i.name])===o)):null;if(l)for(const s in l.attributes)if(l.attributes.hasOwnProperty(s)){e[n+s]=l.attributes[s]}}const l=r?.dataType;"vector-magdir"!==l&&"vector-uv"!==l||(e[a.magnitude]=f?.[0],e[a.direction]=f?.[1]);const{multidimensionalDefinition:p}=this.layer.normalizeRasterFetchOptions({timeExtent:this.timeExtent});o(i.rasterFields,e,p);const y=new t({geometry:this.fullExtent?.clone(),attributes:e,layer:i,sourceLayer:i});c.push(y)}return c}async getSourceScale(){return await this.layer.load(),m(this.layer.serviceRasterInfo,this.view.spatialReference)}_getFullExtent(){return c(this.layer.serviceRasterInfo,this.view.spatialReference)}};return e([s()],d.prototype,"fullExtent",null),e([s()],d.prototype,"layer",void 0),e([s({readOnly:!0})],d.prototype,"timeExtent",null),e([s()],d.prototype,"tileInfo",void 0),e([s({readOnly:!0})],d.prototype,"hasTilingEffects",null),e([s()],d.prototype,"datumTransformation",null),d=e([i("esri.views.layers.ImageryTileLayerView")],d),d};export{f 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Handles.js";import"../../core/has.js";import t from"../../core/Logger.js";import{removeMaybe as s}from"../../core/maybe.js";import r from"../../core/PerformanceSampler.js";import i from"../../core/PooledArray.js";import{isAborted as a,createAbortError as n,when as _}from"../../core/promiseUtils.js";import{watch as h,initial as u,when as o}from"../../core/reactiveUtils.js";import{signal as d}from"../../core/signal.js";import{Milliseconds as E}from"../../core/time.js";import{PromiseQueue as l}from"../../layers/support/PromiseQueue.js";import T from"./debugFlags.js";import{RenderState as m}from"./RenderState.js";import{Yield as c}from"./Yield.js";function I(){return new U.Scheduler}var g;!function(e){e.RESOURCE_CONTROLLER_IMMEDIATE="immediate",e.RESOURCE_CONTROLLER="schedule",e.SLIDE="slide",e.STREAM_DATA_LOADER="stream loader",e.ELEVATION_QUERY="elevation query",e.TERRAIN_SURFACE="terrain",e.SURFACE_GEOMETRY_UPDATES="surface geometry updates",e.LOD_RENDERER="LoD renderer",e.GRAPHICS_CORE="Graphics3D",e.I3S_CONTROLLER="I3S",e.POINT_CLOUD_LAYER="point cloud",e.FEATURE_TILE_FETCHER="feature fetcher",e.OVERLAY="overlay",e.STAGE="stage",e.GRAPHICS_DECONFLICTOR="graphics deconflictor",e.FILTER_VISIBILITY="Graphics3D filter visibility",e.SCALE_VISIBILITY="Graphics3D scale visibility",e.FRUSTUM_VISIBILITY="Graphics3D frustum visibility",e.POINT_OF_INTEREST_FREQUENT="POI frequent",e.POINT_OF_INTEREST_INFREQUENT="POI infrequent",e.LABELER="labeler",e.FEATURE_QUERY_ENGINE="feature query",e.FEATURE_TILE_TREE="feature tile tree",e.FEATURE_TILE_TREE_ACTIVE="fast feature tile tree",e.ELEVATION_ALIGNMENT="elevation alignment",e.ELEVATION_ALIGNMENT_SCENE="elevation alignment scene",e.TEXT_TEXTURE_ATLAS="text texture atlas",e.TEXTURE_UNLOAD="texture unload",e.LINE_OF_SIGHT_TOOL="line of sight tool",e.LINE_OF_SIGHT_TOOL_INTERACTIVE="interactive line of sight tool",e.ELEVATION_PROFILE="elevation profile",e.SNAPPING="snapping",e.SHADOW_ACCUMULATOR="shadow accumulator",e.CLOUDS_GENERATOR="clouds generator",e.MAPVIEW_FETCH_QUEUE="mapview fetch queue",e.MAPVIEW_LAYERVIEW_UPDATE="mapview layerview update",e.MAPVIEW_VECTOR_TILE_PARSING_QUEUE="mapview vector tile parsing queue",e[e.NONE=0]="NONE",e[e.TEST_PRIO=1]="TEST_PRIO"}(g||(g={}));const R=0,p=new Map([[g.RESOURCE_CONTROLLER_IMMEDIATE,R],[g.RESOURCE_CONTROLLER,4],[g.SLIDE,R],[g.STREAM_DATA_LOADER,R],[g.ELEVATION_QUERY,R],[g.TERRAIN_SURFACE,1],[g.SURFACE_GEOMETRY_UPDATES,1],[g.LOD_RENDERER,2],[g.GRAPHICS_CORE,2],[g.I3S_CONTROLLER,2],[g.POINT_CLOUD_LAYER,2],[g.FEATURE_TILE_FETCHER,2],[g.CLOUDS_GENERATOR,2],[g.OVERLAY,4],[g.STAGE,4],[g.GRAPHICS_DECONFLICTOR,4],[g.FILTER_VISIBILITY,4],[g.SCALE_VISIBILITY,4],[g.FRUSTUM_VISIBILITY,4],[g.POINT_OF_INTEREST_FREQUENT,6],[g.POINT_OF_INTEREST_INFREQUENT,30],[g.LABELER,8],[g.FEATURE_QUERY_ENGINE,8],[g.FEATURE_TILE_TREE,16],[g.FEATURE_TILE_TREE_ACTIVE,R],[g.ELEVATION_ALIGNMENT,12],[g.ELEVATION_ALIGNMENT_SCENE,14],[g.TEXT_TEXTURE_ATLAS,12],[g.TEXTURE_UNLOAD,12],[g.LINE_OF_SIGHT_TOOL,16],[g.LINE_OF_SIGHT_TOOL_INTERACTIVE,R],[g.SNAPPING,R],[g.SHADOW_ACCUMULATOR,30],[g.MAPVIEW_FETCH_QUEUE,R],[g.MAPVIEW_LAYERVIEW_UPDATE,2],[g.MAPVIEW_VECTOR_TILE_PARSING_QUEUE,R]]);function A(e){return p.has(e)?p.get(e):"number"==typeof e?e:1}const f=E(6.5),L=E(1),N=E(30),O=E(1e3/30),S=E(100),b=.9;var U,k;!function(a){class n{get updating(){return this._updating.value}_updatingChanged(){this._updating.value=this._tasks.some((e=>e.needsUpdate))}constructor(){this._updating=d(!0),this._microTaskQueued=!1,this._frameNumber=0,this.performanceInfo={total:new r("total"),tasks:new Map},this._frameTaskTimes=new Map,this._budget=new I,this._state=m.INTERACTING,this._tasks=new i,this._runQueue=new i,this._load=0,this._idleStateCallbacks=new i,this._idleUpdatesStartFired=!1,this._forceTask=!1,this._debug=!1,this._debugHandle=h((()=>T.SCHEDULER_LOG_SLOW_TASKS),(e=>this._debug=e),u);for(const e of Object.keys(g))this.performanceInfo.tasks.set(g[e],new r(g[e]))}destroy(){this._tasks.toArray().forEach((e=>e.remove())),this._tasks.clear(),s(this._debugHandle),this._microTaskQueued=!1,this._updatingChanged()}taskRunningChanged(e){this._updatingChanged(),e&&this._budget.remaining>0&&!this._microTaskQueued&&(this._microTaskQueued=!0,queueMicrotask((()=>{this._microTaskQueued&&(this._microTaskQueued=!1,this._budget.remaining>0&&this._schedule()&&this._runFrame())})))}registerTask(e,t){const s=new _(this,e,t);return this._tasks.push(s),this._updatingChanged(),this.performanceInfo.tasks.has(e)||this.performanceInfo.tasks.set(e,new r(e)),s}registerIdleStateCallbacks(e,t){const s={idleBegin:e,idleEnd:t};this._idleStateCallbacks.push(s),this.state===m.IDLE&&this._idleUpdatesStartFired&&s.idleBegin();const r=this;return{remove:()=>this._removeIdleStateCallbacks(s),set idleBegin(e){r._idleUpdatesStartFired&&(s.idleEnd(),r._state===m.IDLE&&e()),s.idleBegin=e},set idleEnd(e){s.idleEnd=e}}}get load(){return this._load}set state(e){this._state!==e&&(this._state=e,this.state!==m.IDLE&&this._idleUpdatesStartFired&&(this._idleUpdatesStartFired=!1,this._idleStateCallbacks.forAll((e=>e.idleEnd()))))}get state(){return this._state}frame(e){this._startFrameTaskTimes();const t=this._updateBudget(e);if(t){const e=this._budget.now();this._runFrame(),this._recordFrameTaskTimes(this._budget.now()-e)}else this._recordFrameTaskTimes(0);return t}_updateBudget(e){this._test&&(this._test.usedBudget=0),++this._frameNumber;let t=f,s=e.frameDuration,r=L;switch(this.state){case m.IDLE:t=E(0),s=E(Math.max(S,e.frameDuration)),r=N;break;case m.INTERACTING:s=E(Math.max(O,e.frameDuration));case m.ANIMATING:}return s=E(s-e.elapsedFrameTime-t),this.state!==m.IDLE&&s<L&&!this._forceTask?(this._forceTask=!0,!1):(s=E(Math.max(s,r)),this._budget.reset(s,this.state),this._updateLoad(),this._schedule())}_runFrame(){switch(this._forceTask=!1,this._microTaskQueued=!1,this.state){case m.IDLE:this._idleUpdatesStartFired||(this._idleUpdatesStartFired=!0,this._idleStateCallbacks.forAll((e=>e.idleBegin()))),this._runIdle();break;case m.INTERACTING:this._runInteracting();break;default:this._runAnimating()}this._test&&(this._test.usedBudget=this._budget.elapsed)}stopFrame(){this._budget.reset(E(0),this._state),this._budget.madeProgress()}_removeIdleStateCallbacks(e){this._idleUpdatesStartFired&&e.idleEnd(),this._idleStateCallbacks.removeUnordered(e)}removeTask(e){this._tasks.removeUnordered(e),this._runQueue.removeUnordered(e),this._updatingChanged()}_updateTask(e){this._tasks.forAll((t=>{t.name===e&&t.setPriority(e)}))}_getState(e){if(this._runQueue.some((t=>t.name===e)))return k.SCHEDULED;let t=k.IDLE;return this._tasks.forAll((s=>{s.name===e&&s.needsUpdate&&(s.schedulePriority<=1?t=k.READY:t!==k.READY&&(t=k.WAITING))})),t}_getRuntime(e){let t=0;return this._tasks.forAll((s=>{s.name===e&&(t+=s.runtime)})),t}_resetRuntimes(){this._tasks.forAll((e=>e.runtime=0))}_getRunning(){const e=new Map;if(this._tasks.forAll((t=>{t.needsUpdate&&e.set(t.name,(e.get(t.name)||0)+1)})),0===e.size)return null;let t="";return e.forEach(((e,s)=>{t+=e>1?` ${e}x ${s}`:` ${s}`})),t}_runIdle(){this._run()}_runInteracting(){this._run()}_runAnimating(){this._run()}_updateLoad(){const e=this._tasks.reduce(((e,t)=>t.needsUpdate?++e:e),0);this._load=this._load*b+e*(1-b)}_schedule(){for(this._runQueue.filterInPlace((e=>!!e.needsUpdate||(e.schedulePriority=e.basePriority,!1))),this._tasks.forAll((e=>{e.basePriority===R&&e.needsUpdate&&!this._runQueue.includes(e)&&e.blockFrame!==this._frameNumber&&this._runQueue.unshift(e)}));0===this._runQueue.length;){let e=!1,t=0;if(this._tasks.forAll((s=>{if(s.needsUpdate&&0!==s.schedulePriority&&s.basePriority!==R&&s.blockFrame!==this._frameNumber)if(e=!0,t=Math.max(t,s.basePriority),1===s.schedulePriority)s.schedulePriority=0,this._runQueue.push(s);else--s.schedulePriority})),!e)return this._updatingChanged(),!1}return this._updatingChanged(),!0}_run(){do{for(;this._runQueue.length>0;){const s=this._budget.now(),r=this._runQueue.pop();this._budget.resetProgress();try{r.task.runTask(this._budget)===c&&(r.blockFrame=this._frameNumber)}catch(e){t.getLogger("esri.views.support.Scheduler").error(`Exception in task "${r.name}"`,e),r.blockFrame=this._frameNumber}!this._budget.hasProgressed&&r.blockFrame!==this._frameNumber&&r.needsUpdate&&(r.name,g.I3S_CONTROLLER,r.blockFrame=this._frameNumber),r.schedulePriority=r.basePriority;const i=this._budget.now()-s;if(r.runtime+=i,this._frameTaskTimes.set(r.priority,this._frameTaskTimes.get(r.priority)+i),this._budget.remaining<=0)return void this._updatingChanged()}}while(this._schedule());this._updatingChanged()}_startFrameTaskTimes(){for(const e of Object.keys(g))this._frameTaskTimes.set(g[e],0)}_recordFrameTaskTimes(e){this._frameTaskTimes.forEach(((e,t)=>this.performanceInfo.tasks.get(t).push(e))),this.performanceInfo.total.push(e)}get test(){return this._test}}a.Scheduler=n;class _{get task(){return this._task.value}get updating(){return this._queue.running}constructor(t,s,r){this._scheduler=t,this.name=s,this.blockFrame=0,this.runtime=0,this._queue=new l,this._handles=new e,this._basePriority=A(s),this.schedulePriority=this._basePriority,this._task=d(null!=r?r:this._queue),this._handles.add(o((()=>this.task.running),(e=>t.taskRunningChanged(e))))}remove(){this.processQueue(C),this._scheduler.removeTask(this),this.schedule=F.schedule,this.reschedule=F.reschedule,this._handles.destroy()}get basePriority(){return this._basePriority}setPriority(e){if(this.name===e)return;this.name=e;const t=A(e);this._basePriority!==R&&0===this.schedulePriority||(this.schedulePriority=t),this._basePriority=t}get priority(){return this.name}set priority(e){this.setPriority(e)}get needsUpdate(){return this.updating||this.task.running}schedule(e,t,s){return this._queue.push(e,t,s)}reschedule(e,t,s){return this._queue.unshift(e,t,s)}processQueue(e){return this._queue.runTask(e)}}class I{constructor(){this._begin="undefined"!=typeof performance?performance.now():0,this._budget=0,this._state=m.IDLE,this._done=!1,this._progressed=!1,this._enabled=!0}run(e){return!this.done&&(!0===e()&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){return this._progressed=!0,this._done=this.elapsed>=this._budget&&this._enabled,this._done}get state(){return this._state}get enabled(){return this._enabled}set enabled(e){this._enabled=e}reset(e,t){this._begin=this.now(),this._budget=e,this._state=t,this.resetProgress()}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return this.now()-this._begin}resetProgress(){this._progressed=!1,this._done=!1}get hasProgressed(){return this._progressed}}a.Budget=I}(U||(U={})),function(e){e.SCHEDULED="s",e.READY="r",e.WAITING="w",e.IDLE="i"}(k||(k={}));const C=new U.Budget;C.enabled=!1;class P{remove(){}processQueue(){}schedule(e,t,s){try{if(a(t)){const e=n();return s?Promise.resolve(s(e)):Promise.reject(e)}return _(e(C))}catch(r){return Promise.reject(r)}}reschedule(e,t,s){return this.schedule(e,t,s)}}const F=new P;export{F as ImmediateTask,g as TaskPriority,k as TaskState,A as getTaskPriority,I as newScheduler,C as noBudget,p as taskPriorities};
|
|
5
|
+
import e from"../../core/Handles.js";import"../../core/has.js";import t from"../../core/Logger.js";import{removeMaybe as s}from"../../core/maybe.js";import r from"../../core/PerformanceSampler.js";import i from"../../core/PooledArray.js";import{isAborted as a,createAbortError as n,when as _}from"../../core/promiseUtils.js";import{watch as u,initial as h,when as o}from"../../core/reactiveUtils.js";import{signal as d}from"../../core/signal.js";import{Milliseconds as E}from"../../core/time.js";import{PromiseQueue as l}from"../../layers/support/PromiseQueue.js";import T from"./debugFlags.js";import{RenderState as m}from"./RenderState.js";import{Yield as c}from"./Yield.js";function I(){return new U.Scheduler}var g;!function(e){e.RESOURCE_CONTROLLER_IMMEDIATE="immediate",e.RESOURCE_CONTROLLER="schedule",e.SLIDE="slide",e.STREAM_DATA_LOADER="stream loader",e.ELEVATION_QUERY="elevation query",e.TERRAIN_SURFACE="terrain",e.SURFACE_GEOMETRY_UPDATES="surface geometry updates",e.LOD_RENDERER="LoD renderer",e.GRAPHICS_CORE="Graphics3D",e.I3S_CONTROLLER="I3S",e.POINT_CLOUD_LAYER="point cloud",e.FEATURE_TILE_FETCHER="feature fetcher",e.OVERLAY="overlay",e.OVERLAY_RENDERER="overlay renderer",e.STAGE="stage",e.GRAPHICS_DECONFLICTOR="graphics deconflictor",e.FILTER_VISIBILITY="Graphics3D filter visibility",e.SCALE_VISIBILITY="Graphics3D scale visibility",e.FRUSTUM_VISIBILITY="Graphics3D frustum visibility",e.POINT_OF_INTEREST_FREQUENT="POI frequent",e.POINT_OF_INTEREST_INFREQUENT="POI infrequent",e.LABELER="labeler",e.FEATURE_QUERY_ENGINE="feature query",e.FEATURE_TILE_TREE="feature tile tree",e.FEATURE_TILE_TREE_ACTIVE="fast feature tile tree",e.ELEVATION_ALIGNMENT="elevation alignment",e.ELEVATION_ALIGNMENT_SCENE="elevation alignment scene",e.TEXT_TEXTURE_ATLAS="text texture atlas",e.TEXTURE_UNLOAD="texture unload",e.LINE_OF_SIGHT_TOOL="line of sight tool",e.LINE_OF_SIGHT_TOOL_INTERACTIVE="interactive line of sight tool",e.ELEVATION_PROFILE="elevation profile",e.SNAPPING="snapping",e.SHADOW_ACCUMULATOR="shadow accumulator",e.CLOUDS_GENERATOR="clouds generator",e.MAPVIEW_FETCH_QUEUE="mapview fetch queue",e.MAPVIEW_LAYERVIEW_UPDATE="mapview layerview update",e.MAPVIEW_VECTOR_TILE_PARSING_QUEUE="mapview vector tile parsing queue",e[e.NONE=0]="NONE",e[e.TEST_PRIO=1]="TEST_PRIO"}(g||(g={}));const R=0,p=new Map([[g.RESOURCE_CONTROLLER_IMMEDIATE,R],[g.RESOURCE_CONTROLLER,4],[g.SLIDE,R],[g.STREAM_DATA_LOADER,R],[g.ELEVATION_QUERY,R],[g.TERRAIN_SURFACE,1],[g.SURFACE_GEOMETRY_UPDATES,1],[g.LOD_RENDERER,2],[g.GRAPHICS_CORE,2],[g.I3S_CONTROLLER,2],[g.POINT_CLOUD_LAYER,2],[g.FEATURE_TILE_FETCHER,2],[g.CLOUDS_GENERATOR,2],[g.OVERLAY,4],[g.OVERLAY_RENDERER,4],[g.STAGE,4],[g.GRAPHICS_DECONFLICTOR,4],[g.FILTER_VISIBILITY,4],[g.SCALE_VISIBILITY,4],[g.FRUSTUM_VISIBILITY,4],[g.POINT_OF_INTEREST_FREQUENT,6],[g.POINT_OF_INTEREST_INFREQUENT,30],[g.LABELER,8],[g.FEATURE_QUERY_ENGINE,8],[g.FEATURE_TILE_TREE,16],[g.FEATURE_TILE_TREE_ACTIVE,R],[g.ELEVATION_ALIGNMENT,12],[g.ELEVATION_ALIGNMENT_SCENE,14],[g.TEXT_TEXTURE_ATLAS,12],[g.TEXTURE_UNLOAD,12],[g.LINE_OF_SIGHT_TOOL,16],[g.LINE_OF_SIGHT_TOOL_INTERACTIVE,R],[g.SNAPPING,R],[g.SHADOW_ACCUMULATOR,30],[g.MAPVIEW_FETCH_QUEUE,R],[g.MAPVIEW_LAYERVIEW_UPDATE,2],[g.MAPVIEW_VECTOR_TILE_PARSING_QUEUE,R]]);function A(e){return p.has(e)?p.get(e):"number"==typeof e?e:1}const f=E(6.5),L=E(1),N=E(30),O=E(1e3/30),S=E(100),b=.9;var U,k;!function(a){class n{get updating(){return this._updating.value}_updatingChanged(){this._updating.value=this._tasks.some((e=>e.needsUpdate))}constructor(){this._updating=d(!0),this._microTaskQueued=!1,this._frameNumber=0,this.performanceInfo={total:new r("total"),tasks:new Map},this._frameTaskTimes=new Map,this._budget=new I,this._state=m.INTERACTING,this._tasks=new i,this._runQueue=new i,this._load=0,this._idleStateCallbacks=new i,this._idleUpdatesStartFired=!1,this._forceTask=!1,this._debug=!1,this._debugHandle=u((()=>T.SCHEDULER_LOG_SLOW_TASKS),(e=>this._debug=e),h);for(const e of Object.keys(g))this.performanceInfo.tasks.set(g[e],new r(g[e]))}destroy(){this._tasks.toArray().forEach((e=>e.remove())),this._tasks.clear(),s(this._debugHandle),this._microTaskQueued=!1,this._updatingChanged()}taskRunningChanged(e){this._updatingChanged(),e&&this._budget.remaining>0&&!this._microTaskQueued&&(this._microTaskQueued=!0,queueMicrotask((()=>{this._microTaskQueued&&(this._microTaskQueued=!1,this._budget.remaining>0&&this._schedule()&&this._runFrame())})))}registerTask(e,t){const s=new _(this,e,t);return this._tasks.push(s),this._updatingChanged(),this.performanceInfo.tasks.has(e)||this.performanceInfo.tasks.set(e,new r(e)),s}registerIdleStateCallbacks(e,t){const s={idleBegin:e,idleEnd:t};this._idleStateCallbacks.push(s),this.state===m.IDLE&&this._idleUpdatesStartFired&&s.idleBegin();const r=this;return{remove:()=>this._removeIdleStateCallbacks(s),set idleBegin(e){r._idleUpdatesStartFired&&(s.idleEnd(),r._state===m.IDLE&&e()),s.idleBegin=e},set idleEnd(e){s.idleEnd=e}}}get load(){return this._load}set state(e){this._state!==e&&(this._state=e,this.state!==m.IDLE&&this._idleUpdatesStartFired&&(this._idleUpdatesStartFired=!1,this._idleStateCallbacks.forAll((e=>e.idleEnd()))))}get state(){return this._state}frame(e){this._startFrameTaskTimes();const t=this._updateBudget(e);if(t){const e=this._budget.now();this._runFrame(),this._recordFrameTaskTimes(this._budget.now()-e)}else this._recordFrameTaskTimes(0);return t}_updateBudget(e){this._test&&(this._test.usedBudget=0),++this._frameNumber;let t=f,s=e.frameDuration,r=L;switch(this.state){case m.IDLE:t=E(0),s=E(Math.max(S,e.frameDuration)),r=N;break;case m.INTERACTING:s=E(Math.max(O,e.frameDuration));case m.ANIMATING:}return s=E(s-e.elapsedFrameTime-t),this.state!==m.IDLE&&s<L&&!this._forceTask?(this._forceTask=!0,!1):(s=E(Math.max(s,r)),this._budget.reset(s),this._updateLoad(),this._schedule())}_runFrame(){switch(this._forceTask=!1,this._microTaskQueued=!1,this.state){case m.IDLE:this._idleUpdatesStartFired||(this._idleUpdatesStartFired=!0,this._idleStateCallbacks.forAll((e=>e.idleBegin()))),this._runIdle();break;case m.INTERACTING:this._runInteracting();break;default:this._runAnimating()}this._test&&(this._test.usedBudget=this._budget.elapsed)}stopFrame(){this._budget.reset(E(0)),this._budget.madeProgress()}_removeIdleStateCallbacks(e){this._idleUpdatesStartFired&&e.idleEnd(),this._idleStateCallbacks.removeUnordered(e)}removeTask(e){this._tasks.removeUnordered(e),this._runQueue.removeUnordered(e),this._updatingChanged()}_updateTask(e){this._tasks.forAll((t=>{t.name===e&&t.setPriority(e)}))}_getState(e){if(this._runQueue.some((t=>t.name===e)))return k.SCHEDULED;let t=k.IDLE;return this._tasks.forAll((s=>{s.name===e&&s.needsUpdate&&(s.schedulePriority<=1?t=k.READY:t!==k.READY&&(t=k.WAITING))})),t}_getRuntime(e){let t=0;return this._tasks.forAll((s=>{s.name===e&&(t+=s.runtime)})),t}_resetRuntimes(){this._tasks.forAll((e=>e.runtime=0))}_getRunning(){const e=new Map;if(this._tasks.forAll((t=>{t.needsUpdate&&e.set(t.name,(e.get(t.name)||0)+1)})),0===e.size)return null;let t="";return e.forEach(((e,s)=>{t+=e>1?` ${e}x ${s}`:` ${s}`})),t}_runIdle(){this._run()}_runInteracting(){this._run()}_runAnimating(){this._run()}_updateLoad(){const e=this._tasks.reduce(((e,t)=>t.needsUpdate?++e:e),0);this._load=this._load*b+e*(1-b)}_schedule(){for(this._runQueue.filterInPlace((e=>!!e.needsUpdate||(e.schedulePriority=e.basePriority,!1))),this._tasks.forAll((e=>{e.basePriority===R&&e.needsUpdate&&!this._runQueue.includes(e)&&e.blockFrame!==this._frameNumber&&this._runQueue.unshift(e)}));0===this._runQueue.length;){let e=!1,t=0;if(this._tasks.forAll((s=>{if(s.needsUpdate&&0!==s.schedulePriority&&s.basePriority!==R&&s.blockFrame!==this._frameNumber)if(e=!0,t=Math.max(t,s.basePriority),1===s.schedulePriority)s.schedulePriority=0,this._runQueue.push(s);else--s.schedulePriority})),!e)return this._updatingChanged(),!1}return this._updatingChanged(),!0}_run(){do{for(;this._runQueue.length>0;){const s=this._budget.now(),r=this._runQueue.pop();this._budget.resetProgress();try{r.task.runTask(this._budget)===c&&(r.blockFrame=this._frameNumber)}catch(e){t.getLogger("esri.views.support.Scheduler").error(`Exception in task "${r.name}"`,e),r.blockFrame=this._frameNumber}!this._budget.hasProgressed&&r.blockFrame!==this._frameNumber&&r.needsUpdate&&(r.name,g.I3S_CONTROLLER,r.blockFrame=this._frameNumber),r.schedulePriority=r.basePriority;const i=this._budget.now()-s;if(r.runtime+=i,this._frameTaskTimes.set(r.priority,this._frameTaskTimes.get(r.priority)+i),this._budget.remaining<=0)return void this._updatingChanged()}}while(this._schedule());this._updatingChanged()}_startFrameTaskTimes(){for(const e of Object.keys(g))this._frameTaskTimes.set(g[e],0)}_recordFrameTaskTimes(e){this._frameTaskTimes.forEach(((e,t)=>this.performanceInfo.tasks.get(t).push(e))),this.performanceInfo.total.push(e)}get test(){return this._test}}a.Scheduler=n;class _{get task(){return this._task.value}get updating(){return this._queue.running}constructor(t,s,r){this._scheduler=t,this.name=s,this.blockFrame=0,this.runtime=0,this._queue=new l,this._handles=new e,this._basePriority=A(s),this.schedulePriority=this._basePriority,this._task=d(null!=r?r:this._queue),this._handles.add(o((()=>this.task.running),(e=>t.taskRunningChanged(e))))}remove(){this.processQueue(C),this._scheduler.removeTask(this),this.schedule=D.schedule,this.reschedule=D.reschedule,this._handles.destroy()}get basePriority(){return this._basePriority}setPriority(e){if(this.name===e)return;this.name=e;const t=A(e);this._basePriority!==R&&0===this.schedulePriority||(this.schedulePriority=t),this._basePriority=t}get priority(){return this.name}set priority(e){this.setPriority(e)}get needsUpdate(){return this.updating||this.task.running}schedule(e,t,s){return this._queue.push(e,t,s)}reschedule(e,t,s){return this._queue.unshift(e,t,s)}processQueue(e){return this._queue.runTask(e)}}class I{constructor(){this._begin=performance?.now()??0,this._budget=0,this._done=!1,this._progressed=!1,this._enabled=!0}run(e){return!this.done&&(!0===e()&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){return this._progressed=!0,this._done=this.elapsed>=this._budget&&this._enabled,this._done}get enabled(){return this._enabled}set enabled(e){this._enabled=e}reset(e){this._begin=this.now(),this._budget=e,this.resetProgress()}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return this.now()-this._begin}resetProgress(){this._progressed=!1,this._done=!1}get hasProgressed(){return this._progressed}}a.Budget=I}(U||(U={})),function(e){e.SCHEDULED="s",e.READY="r",e.WAITING="w",e.IDLE="i"}(k||(k={}));const C=new U.Budget;function P(e){const t=new U.Budget;return t.reset(e),t}C.enabled=!1;class F{remove(){}processQueue(){}schedule(e,t,s){try{if(a(t)){const e=n();return s?Promise.resolve(s(e)):Promise.reject(e)}return _(e(C))}catch(r){return Promise.reject(r)}}reschedule(e,t,s){return this.schedule(e,t,s)}}const D=new F;export{D as ImmediateTask,g as TaskPriority,k as TaskState,A as getTaskPriority,P as makeBudget,I as newScheduler,C as noBudget,p as taskPriorities};
|
package/webscene/Slide.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as n}from"../core/asyncUtils.js";import r from"../core/Clonable.js";import o from"../core/Collection.js";import{referenceSetter as s}from"../core/collectionUtils.js";import a from"../core/JSONSupport.js";import l from"../core/Logger.js";import{moduloPositive as p}from"../core/mathUtils.js";import{destroyMaybe as m,removeMaybe as c}from"../core/maybe.js";import{onAbortOrThrow as h,createAbortError as u,isAbortError as d}from"../core/promiseUtils.js";import{whenOnce as y,when as g}from"../core/reactiveUtils.js";import{property as v}from"../core/accessorSupport/decorators/property.js";import{cast as b}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as w}from"../core/accessorSupport/ensureType.js";import{s as T}from"../chunks/vec32.js";import{create as j}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import _ from"../layers/Layer.js";import{basemapEnsureType as L,clonePreservingTiledLayers as C}from"../support/basemapEnsureType.js";import{TaskPriority as E}from"../views/support/Scheduler.js";import{SlideThumbnail as S}from"../webdoc/support/SlideThumbnail.js";import{timeExtent as k}from"../webdoc/support/timeProperties.js";import V from"./SunLighting.js";import U from"./VirtualLighting.js";import x from"./support/Description.js";import I from"./support/SlideElements.js";import{SlideEnvironment as A}from"./support/SlideEnvironment.js";import D from"./support/SlideGround.js";import{SlideVisibleLayer as F}from"./support/SlideVisibleLayer.js";import R from"./support/Title.js";let M=0;const P=o.ofType(F),q=["caption","cover","none"];let B=class extends(r.ClonableMixin(a)){constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+M++,this.title=new R,this.description=new x,this.hidden=!1,this.thumbnail=new S,this.viewpoint=null,this.basemap=null,this.ground=null,this.layout="caption",this.environment=new A,this.timeExtent=null,this.elements=null,this.visibleLayers=new P}destroy(){this.visibleLayers.removeAll(),this.basemap=null,this.thumbnail=m(this.thumbnail),this.description=null,this.title=null,this.thumbnail=null,this.elements=null}castTitle(e){return"string"==typeof e?new R({text:e}):w(R,e)}castDescription(e){return"string"==typeof e?new x({text:e}):w(x,e)}castThumbnail(e){return"string"==typeof e?new S({url:e}):w(S,e)}castBasemap(e){return L(e)}set visibleLayers(e){this._set("visibleLayers",s(e,this._get("visibleLayers"),P))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map((e=>{if("string"==typeof e)return{id:e};if(e instanceof _){const t=N(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:"sublayerIds"in e?e.sublayerIds:void 0}:(l.getLogger(this).warn('Invalid visible layer, expected { id }, Layer or "id"'),e)})):null}async _updateVisibleLayersFrom(e){const t=[];await Promise.allSettled(this._getLayers(e.map).map((i=>e.whenLayerView(i).then((e=>{if(e.visible){const n=N(i);t.push(new F({id:e.layer.id,sublayerIds:n}))}})))).toArray()),this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}_updateFocusAreaIDs(e){if(e){this.focusareas=[];for(const t of e)t.enabled&&this.focusareas.push(t.id)}}updateFrom(e,t){const i={format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t?.screenshot};return e.when((()=>(this.viewpoint=e.viewpoint.clone(),this.environment.lighting="virtual"===e.environment.lighting.type?U.prototype.clone.apply(e.environment.lighting):V.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this._updateFocusAreaIDs(e.focusAreas?.areas),this.basemap=e.map.basemap?.clone()||null,this.ground=e.map.ground?D.fromGround(e.map.ground):null,this.timeExtent=e.timeExtent?.clone()??null,this._updateVisibleLayersFrom(e)))).then((()=>e.takeScreenshot(i))).then((e=>(this.thumbnail=new S({url:e.dataUrl}),this)))}async applyTo(e,t){null!=this._applyToController&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const r=h(t,(()=>i?.abort())),o=()=>{this._applyToController===i&&(this._applyToController=null),i=null,r?.remove()};try{await y((()=>e.ready),i.signal)}catch(c){throw o(),c}if(i.signal.aborted)throw o(),u();const s=e.resourceController.scheduler.registerTask(E.SLIDE);let a=!1;const l={animate:!0,...t,signal:this._applyToController.signal},p=async()=>{await Promise.all([s.schedule((async()=>a=await this._setViewpointOfInterest(e,l))),s.schedule((()=>this._applyBasemap(e,l)),l.signal),s.schedule((()=>this._loadLayersWithSublayerVisibility(e)))]),await Promise.all([s.schedule((()=>this._applyLayerVisibility(e)),l.signal),s.schedule((()=>this._applyGround(e)),l.signal),s.schedule((()=>this._applyViewpoint(e,l)),l.signal),s.schedule((()=>e.timeExtent=this.timeExtent?.clone()??null),l.signal),s.schedule((()=>e.environment.weather=this.environment.weather.clone())),s.schedule((()=>this._applyFocusAreaIDs(e.focusAreas?.areas)))])},m=await n(e.addUpdatingPromise(p()));if(a&&(e.contentCamera=null),s.remove(),o(),!1===m.ok)throw m.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(d(i))throw i}e.map.basemap=C(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_applyFocusAreaIDs(e){if(e)for(const t of e)t.enabled=this.focusareas?.includes(t.id)??!1}_getLayers(e){const t=new o;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach((e=>{e.persistenceEnabled&&(t.add(e),"layers"in e&&this._collectLayers(e,t))}))}async _loadLayersWithSublayerVisibility(e){this.visibleLayers&&await Promise.allSettled(this._getLayers(e.map).items.map((e=>{const t=this.visibleLayers.find((t=>t.id===e.id))?.sublayerIds;return t?e.load():null})))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach((e=>{const t=this.visibleLayers.find((t=>t.id===e.id));e.visible=null!=t;const i=t?.sublayerIds,n=G(e);i&&n&&n.forEach((e=>e.visible=i.includes(e.id)))}))}async _setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t?.ignoreViewpoint||!t?.useDestinationCamera)return!1;const{toCameraAsync:i}=await import("../views/3d/support/viewpointUtils.js"),n=await i(e,this.viewpoint);return e.contentCamera=n,null!=n}async _applyViewpoint(e,t){if(this._applyCachedCameraTrackingEnabled(e),this.viewpoint&&!t.ignoreViewpoint){const i=this.environment.lighting;if(t.animate&&"sun"===i.type&&i.date)return this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(i.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"virtual"!==e.environment.lighting.type&&"virtual"!==this.environment.lighting.type&&("global"===e.viewingMode&&(i=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,"virtual"===this.environment.lighting.type||"virtual"===e.environment.lighting.type?(e.environment.applyLighting(this.environment.lighting.clone()),"virtual"!==e.environment.lighting.type&&(e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1)):null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);return e.goTo(this.viewpoint,t).then((()=>{this._applyCachedCameraTrackingEnabled(e),e.environment.applyLighting(this.environment.lighting.clone())})).catch((t=>{throw null==e.animation&&this._applyCachedCameraTrackingEnabled(e),t})).finally((()=>{c(i)}))}_applyCachedCameraTrackingEnabled(e){null!=e.environment.cachedCameraTrackingEnabled&&(e.environment.lighting.cameraTrackingEnabled=e.environment.cachedCameraTrackingEnabled,e.environment.cachedCameraTrackingEnabled=null)}_getTime(e){return[e.getTime(),3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds()]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e,t,i){const n=new Date(t.date.toString()),[r,o]=this._getTime(n),[s,a]=this._getTime(i.date),l=J(o,a),p=e.renderCoordsHelper,m=j();p.toRenderCoords(e.camera.position,m);const c=j(),h=j();null!=this.viewpoint.camera&&p.toRenderCoords(this.viewpoint.camera.position,c);const u=new Date;return g((()=>e.camera),(e=>{p.toRenderCoords(e.position,h);const i=T(m,h),n=T(c,h);let a=0;i+n!==0&&(a=i/(i+n));const d=r+(s-r)*a,y=z(o,l*a);t.date=this._setTime(u,d,y)}))}static createFrom(e,t){return(new this).updateFrom(e,t)}};e([v({type:String,json:{write:{isRequired:!0}}})],B.prototype,"id",void 0),e([v({type:R,json:{default:()=>new R({text:""}),write:{isRequired:!0}}})],B.prototype,"title",void 0),e([b("title")],B.prototype,"castTitle",null),e([v({type:x,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],B.prototype,"description",void 0),e([b("description")],B.prototype,"castDescription",null),e([v({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],B.prototype,"hidden",void 0),e([v({type:S,json:{default:()=>new S({url:""}),write:{isRequired:!0}}})],B.prototype,"thumbnail",void 0),e([b("thumbnail")],B.prototype,"castThumbnail",null),e([v({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],B.prototype,"viewpoint",void 0),e([v({type:t,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],B.prototype,"basemap",void 0),e([b("basemap")],B.prototype,"castBasemap",null),e([v({type:D,json:{write:!0}})],B.prototype,"ground",void 0),e([v({type:q,json:{write:!0,default:"caption"},nonNullable:!0})],B.prototype,"layout",void 0),e([v({type:P,json:{write:{isRequired:!0}}})],B.prototype,"visibleLayers",null),e([b("visibleLayers")],B.prototype,"castVisibleLayers",null),e([v({type:A,json:{write:!0}})],B.prototype,"environment",void 0),e([v({type:[String],json:{write:!1}})],B.prototype,"focusareas",void 0),e([v(k)],B.prototype,"timeExtent",void 0),e([v({type:I,json:{write:!0}})],B.prototype,"elements",void 0),B=e([f("esri.webscene.Slide")],B);const O=B;function G(e){if("building-scene"===e.type||"map-image"===e.type)return e.allSublayers.toArray()}function N(e){const t=G(e);if(t)return t.filter((e=>e.visible)).map((e=>e.id))}const W=86400,H=43200;function J(e,t){let i=t-e;return i>H&&(i-=W),i<-43200&&(i+=W),i}function z(e,t){return p(e+t,W)}export{O as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as n}from"../core/asyncUtils.js";import r from"../core/Clonable.js";import o from"../core/Collection.js";import{referenceSetter as s}from"../core/collectionUtils.js";import a from"../core/JSONSupport.js";import l from"../core/Logger.js";import{moduloPositive as p}from"../core/mathUtils.js";import{destroyMaybe as m,removeMaybe as c}from"../core/maybe.js";import{onAbortOrThrow as h,createAbortError as d,isAbortError as u}from"../core/promiseUtils.js";import{whenOnce as y,when as g}from"../core/reactiveUtils.js";import{property as v}from"../core/accessorSupport/decorators/property.js";import{cast as b}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as w}from"../core/accessorSupport/ensureType.js";import{s as T}from"../chunks/vec32.js";import{create as j}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import _ from"../layers/Layer.js";import{basemapEnsureType as L,clonePreservingTiledLayers as C}from"../support/basemapEnsureType.js";import{TaskPriority as E}from"../views/support/Scheduler.js";import{SlideThumbnail as S}from"../webdoc/support/SlideThumbnail.js";import{timeExtent as k}from"../webdoc/support/timeProperties.js";import A from"./SunLighting.js";import V from"./VirtualLighting.js";import U from"./support/Description.js";import x from"./support/SlideElements.js";import{SlideEnvironment as I}from"./support/SlideEnvironment.js";import D from"./support/SlideGround.js";import{SlideVisibleLayer as F}from"./support/SlideVisibleLayer.js";import R from"./support/Title.js";let M=0;const P=o.ofType(F),q=["caption","cover","none"];let B=class extends(r.ClonableMixin(a)){constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+M++,this.title=new R,this.description=new U,this.hidden=!1,this.thumbnail=new S,this.viewpoint=null,this.basemap=null,this.ground=null,this.layout="caption",this.environment=new I,this.timeExtent=null,this.elements=null,this.visibleLayers=new P}destroy(){this.visibleLayers.removeAll(),this.basemap=null,this.thumbnail=m(this.thumbnail),this.description=null,this.title=null,this.thumbnail=null,this.elements=null}castTitle(e){return"string"==typeof e?new R({text:e}):w(R,e)}castDescription(e){return"string"==typeof e?new U({text:e}):w(U,e)}castThumbnail(e){return"string"==typeof e?new S({url:e}):w(S,e)}castBasemap(e){return L(e)}set visibleLayers(e){this._set("visibleLayers",s(e,this._get("visibleLayers"),P))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map((e=>{if("string"==typeof e)return{id:e};if(e instanceof _){const t=N(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:"sublayerIds"in e?e.sublayerIds:void 0}:(l.getLogger(this).warn('Invalid visible layer, expected { id }, Layer or "id"'),e)})):null}async _updateVisibleLayersFrom(e){const t=[];await Promise.allSettled(this._getLayers(e.map).map((i=>e.whenLayerView(i).then((e=>{if(e.visible){const n=N(i);t.push(new F({id:e.layer.id,sublayerIds:n}))}})))).toArray()),this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}_updateFocusAreaIDs(e){if(e){this.enabledFocusAreas=[];for(const t of e)t.enabled&&this.enabledFocusAreas.push(t.id)}}updateFrom(e,t){const i={format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t?.screenshot};return e.when((()=>(this.viewpoint=e.viewpoint.clone(),this.environment.lighting="virtual"===e.environment.lighting.type?V.prototype.clone.apply(e.environment.lighting):A.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this._updateFocusAreaIDs(e.focusAreas?.areas),this.basemap=e.map.basemap?.clone()||null,this.ground=e.map.ground?D.fromGround(e.map.ground):null,this.timeExtent=e.timeExtent?.clone()??null,this._updateVisibleLayersFrom(e)))).then((()=>e.takeScreenshot(i))).then((e=>(this.thumbnail=new S({url:e.dataUrl}),this)))}async applyTo(e,t){null!=this._applyToController&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const r=h(t,(()=>i?.abort())),o=()=>{this._applyToController===i&&(this._applyToController=null),i=null,r?.remove()};try{await y((()=>e.ready),i.signal)}catch(c){throw o(),c}if(i.signal.aborted)throw o(),d();const s=e.resourceController.scheduler.registerTask(E.SLIDE);let a=!1;const l={animate:!0,...t,signal:this._applyToController.signal},p=async()=>{await Promise.all([s.schedule((async()=>a=await this._setViewpointOfInterest(e,l))),s.schedule((()=>this._applyBasemap(e,l)),l.signal),s.schedule((()=>this._loadLayersWithSublayerVisibility(e)))]),await Promise.all([s.schedule((()=>this._applyLayerVisibility(e)),l.signal),s.schedule((()=>this._applyGround(e)),l.signal),s.schedule((()=>this._applyViewpoint(e,l)),l.signal),s.schedule((()=>e.timeExtent=this.timeExtent?.clone()??null),l.signal),s.schedule((()=>e.environment.weather=this.environment.weather.clone())),s.schedule((()=>this._applyFocusAreaIDs(e.focusAreas?.areas)))])},m=await n(e.addUpdatingPromise(p()));if(a&&(e.contentCamera=null),s.remove(),o(),!1===m.ok)throw m.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(u(i))throw i}e.map.basemap=C(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_applyFocusAreaIDs(e){if(e)for(const t of e)t.enabled=this.enabledFocusAreas?.includes(t.id)??!1}_getLayers(e){const t=new o;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach((e=>{e.persistenceEnabled&&(t.add(e),"layers"in e&&this._collectLayers(e,t))}))}async _loadLayersWithSublayerVisibility(e){this.visibleLayers&&await Promise.allSettled(this._getLayers(e.map).items.map((e=>{const t=this.visibleLayers.find((t=>t.id===e.id))?.sublayerIds;return t?e.load():null})))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach((e=>{const t=this.visibleLayers.find((t=>t.id===e.id));e.visible=null!=t;const i=t?.sublayerIds,n=G(e);i&&n&&n.forEach((e=>e.visible=i.includes(e.id)))}))}async _setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t?.ignoreViewpoint||!t?.useDestinationCamera)return!1;const{toCameraAsync:i}=await import("../views/3d/support/viewpointUtils.js"),n=await i(e,this.viewpoint);return e.contentCamera=n,null!=n}async _applyViewpoint(e,t){if(this._applyCachedCameraTrackingEnabled(e),this.viewpoint&&!t.ignoreViewpoint){const i=this.environment.lighting;if(t.animate&&"sun"===i.type&&i.date)return this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(i.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"virtual"!==e.environment.lighting.type&&"virtual"!==this.environment.lighting.type&&("global"===e.viewingMode&&(i=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,"virtual"===this.environment.lighting.type||"virtual"===e.environment.lighting.type?(e.environment.applyLighting(this.environment.lighting.clone()),"virtual"!==e.environment.lighting.type&&(e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1)):null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);return e.goTo(this.viewpoint,t).then((()=>{this._applyCachedCameraTrackingEnabled(e),e.environment.applyLighting(this.environment.lighting.clone())})).catch((t=>{throw null==e.animation&&this._applyCachedCameraTrackingEnabled(e),t})).finally((()=>{c(i)}))}_applyCachedCameraTrackingEnabled(e){null!=e.environment.cachedCameraTrackingEnabled&&(e.environment.lighting.cameraTrackingEnabled=e.environment.cachedCameraTrackingEnabled,e.environment.cachedCameraTrackingEnabled=null)}_getTime(e){return[e.getTime(),3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds()]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e,t,i){const n=new Date(t.date.toString()),[r,o]=this._getTime(n),[s,a]=this._getTime(i.date),l=J(o,a),p=e.renderCoordsHelper,m=j();p.toRenderCoords(e.camera.position,m);const c=j(),h=j();null!=this.viewpoint.camera&&p.toRenderCoords(this.viewpoint.camera.position,c);const d=new Date;return g((()=>e.camera),(e=>{p.toRenderCoords(e.position,h);const i=T(m,h),n=T(c,h);let a=0;i+n!==0&&(a=i/(i+n));const u=r+(s-r)*a,y=z(o,l*a);t.date=this._setTime(d,u,y)}))}static createFrom(e,t){return(new this).updateFrom(e,t)}};e([v({type:String,json:{write:{isRequired:!0}}})],B.prototype,"id",void 0),e([v({type:R,json:{default:()=>new R({text:""}),write:{isRequired:!0}}})],B.prototype,"title",void 0),e([b("title")],B.prototype,"castTitle",null),e([v({type:U,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],B.prototype,"description",void 0),e([b("description")],B.prototype,"castDescription",null),e([v({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],B.prototype,"hidden",void 0),e([v({type:S,json:{default:()=>new S({url:""}),write:{isRequired:!0}}})],B.prototype,"thumbnail",void 0),e([b("thumbnail")],B.prototype,"castThumbnail",null),e([v({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],B.prototype,"viewpoint",void 0),e([v({type:t,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],B.prototype,"basemap",void 0),e([b("basemap")],B.prototype,"castBasemap",null),e([v({type:D,json:{write:!0}})],B.prototype,"ground",void 0),e([v({type:q,json:{write:!0,default:"caption"},nonNullable:!0})],B.prototype,"layout",void 0),e([v({type:P,json:{write:{isRequired:!0}}})],B.prototype,"visibleLayers",null),e([b("visibleLayers")],B.prototype,"castVisibleLayers",null),e([v({type:I,json:{write:!0}})],B.prototype,"environment",void 0),e([v({type:[String],json:{write:!1}})],B.prototype,"enabledFocusAreas",void 0),e([v(k)],B.prototype,"timeExtent",void 0),e([v({type:x,json:{write:!0}})],B.prototype,"elements",void 0),B=e([f("esri.webscene.Slide")],B);const O=B;function G(e){if("building-scene"===e.type||"map-image"===e.type)return e.allSublayers.toArray()}function N(e){const t=G(e);if(t)return t.filter((e=>e.visible)).map((e=>e.id))}const W=86400,H=43200;function J(e,t){let i=t-e;return i>H&&(i-=W),i<-43200&&(i+=W),i}function z(e,t){return p(e+t,W)}export{O 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Error.js";import{makeHandle as i}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as o}from"../../core/maybe.js";import{watch as s}from"../../core/reactiveUtils.js";import{property as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Error.js";import{makeHandle as i}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as o}from"../../core/maybe.js";import{watch as s}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import l from"../../layers/GraphicsLayer.js";import{hasEffectiveFeatureExpressionInfo as d}from"../../support/elevationInfoUtils.js";import{highlightsSupported as n}from"../../views/support/layerViewUtils.js";import h from"./UpdateFeatureWorkflowData.js";import{handleKeys as c,UpdateRecordWorkflow as p}from"./UpdateRecordWorkflow.js";import{getVisualVariableAttributes as w,setUpGeometryUpdate as m,isTerminalUpdateEventType as u,updateGraphicSymbolWhenRequired as y,swapForEditingSession as f,cloneGraphicExceptMesh as g,canCreateInteractiveEditSession as k}from"./workflowUtils.js";import _ from"../Sketch/SketchViewModel.js";var V;const v={...c,highlights:Symbol(),sketchGraphics:Symbol(),sketchViewModel:Symbol(),waitingForTool:Symbol()};let M=V=class extends p{constructor(e){super(e),this.type="update-feature",this._layerViewEditSession=null,this._sketchGraphicClone=null,this._sketchViewModel=null,this._webStyleCache=new Map}destroy(){this._layerViewEditSession?.rollback()}async commit(){this.removeHandles(v.sketchGraphics);try{const e=this.data.edits.stagedForDelete;await super.commit();const t=this._layerViewEditSession;e?t?.rollback():t?.commit()}catch(e){throw await this._configureSketchViewModel(),new t("editor-workflow:failed-to-commit","An error occurred when sending the updates to the service",{error:e})}}async start(){return await super.start(),await this._initializeSketchViewModel()}_initializeFeatureFormViewModel(){super._initializeFeatureFormViewModel(),this.addHandles([this._featureFormViewModel.on("value-change",(e=>{this._layerViewEditSession?.setAttribute(e.fieldName,e.value)})),s((()=>this._featureFormViewModel.feature?.sourceLayer),(e=>this._sketchGraphicClone.sourceLayer=e))])}_configureHighlight(){const{edits:e,layerView:t}=this.data;n(t)&&this.addHandles(t.highlight(e.feature),v.highlights)}async _configureSketchViewModel(){const e=this._sketchViewModel;if(!e)return;const{data:t,_featureFormViewModel:i,_sketchGraphicClone:o}=this,{edits:s,viewModel:a}=t,r=s.feature,{view:l}=a,d=w(r),n=await m({feature:r,featureClone:o,visualVariableAttributes:d,sketchViewModel:e,view:l,onUpdate:({geometry:e,attributes:t},o)=>{if(s.updateAttributes(t),s.updateGeometry(e),i.feature&&(i.feature.geometry=e),null!=d.rotation){const{field:e}=d.rotation;i.setValue(e,t[e])}if(null!=d.size){const{field:e}=d.size;i.setValue(e,t[e])}("undo"===o.type||"redo"===o.type||"update"===o.type&&null!=o.toolEventInfo&&u(o.toolEventInfo.type))&&i.notifyFeatureGeometryChanged()},addUpdatingPromise:e=>{this._updatingHandles.addPromise(e)},addHandle:e=>{this.addHandles(e,v.waitingForTool)},webStyleCache:this._webStyleCache});this.addHandles(n,v.sketchGraphics),e.addHandles(n)}async _initializeSketchViewModel(){const{data:e,_sketchGraphicClone:t}=this,s=e.edits.feature,{capabilities:a,layer:r}=e.editorItem,{view:n}=e.viewModel;if(this.removeHandles([v.highlights,v.sketchGraphics,v.sketchViewModel,v.waitingForTool]),!a.update.geometry||"3d"===n?.type&&d(r.elevationInfo))return{enter:async()=>{this.hasHandles(v.highlights)||this._configureHighlight()},exit:()=>this.removeHandles([v.highlights])};const h=new l({elevationInfo:r.elevationInfo,internal:!0,listMode:"hide"}),c=new _({allowDeleteKey:!1,layer:h,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,updateOnGraphicClick:!1,view:n});return this._sketchViewModel=c,n?.map.add(h),await(n?.whenLayerView(h)),this.addHandles(i((()=>{n?.destroyed||n?.map.remove(h),h.destroy(),this._sketchViewModel=o(c)})),v.sketchViewModel),await y(t,this._webStyleCache,"2d"===n?.type?n.scale:null),this.addHandles([await f(c,s,t)]),{enter:async()=>{this.hasHandles(v.sketchGraphics)||await this._configureSketchViewModel()},exit:()=>this.removeHandles([v.sketchGraphics]),viewModel:c}}_onFullFeatureLoaded(e){super._onFullFeatureLoaded(e);const t=this._sketchGraphicClone=g(e),{edits:i,layerView:o}=this.data;i.updateGeometry(e.geometry),i.trackChanges(),k(o)&&(this._layerViewEditSession=o.createInteractiveEditSession(t))}static async create(e){const t=new V({data:await h.create(e),onCommit:this._onCommitFactory(e.applyEdits)});return t._set("steps",this._createWorkflowSteps(t)),t}get test(){}};e([a()],M.prototype,"_layerViewEditSession",void 0),e([a()],M.prototype,"_sketchGraphicClone",void 0),e([a()],M.prototype,"_sketchViewModel",void 0),M=V=e([r("esri.widgets.Editor.UpdateFeatureWorkflow")],M);export{M as UpdateFeatureWorkflow,v as handleKeys};
|