@arcgis/core 5.0.0-next.30 → 5.0.0-next.32
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/Basemap.js +1 -1
- package/applications/SceneViewer/sceneViewerUtils.d.ts +3 -0
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{406d270ae2b3cf9e1f1b.js → 05e55118dc0023d500fc.js} +1 -1
- package/assets/esri/core/workers/chunks/{93fe46be3c7fe34b5361.js → 1432e789aa4cba627337.js} +1 -1
- package/assets/esri/core/workers/chunks/1dd867fa7c58c06b79ea.js +1 -0
- package/assets/esri/core/workers/chunks/{6e9d731cb20307b83ab0.js → 1e55f152b60145f33b61.js} +1 -1
- package/assets/esri/core/workers/chunks/22d66d1c8dfccdbbcf30.js +1 -0
- package/assets/esri/core/workers/chunks/27bd88e1101873d4ce12.js +1 -0
- package/assets/esri/core/workers/chunks/{5f2cf73fb2944f82661d.js → 433d249c35c56bf15806.js} +34 -34
- package/assets/esri/core/workers/chunks/444026d1938c1078ca97.js +1 -0
- package/assets/esri/core/workers/chunks/{a425ffec91d07bbfeb80.js → 565358ea8d1bdc4d1ebc.js} +1 -1
- package/assets/esri/core/workers/chunks/{b2fbb44e219232e61cbd.js → 794960ec36e11f4416c2.js} +1 -1
- package/assets/esri/core/workers/chunks/{0bfb7db0a151a5e85dd1.js → 8ad6595ad44c2d60c1ce.js} +1 -1
- package/assets/esri/core/workers/chunks/{11bb437437272d8f3e2c.js → 9252854b512237b6a0ef.js} +1 -1
- package/assets/esri/core/workers/chunks/{e615983fab688d515205.js → 944dfa9309da8f49a616.js} +1 -1
- package/assets/esri/core/workers/chunks/{f2f4e34247882eceb50d.js → a2cee5ac0d4df0108425.js} +3 -3
- package/assets/esri/core/workers/chunks/a4b7ba8aec109beb5b4d.js +1 -0
- package/assets/esri/core/workers/chunks/{d769c1b18e2710e0388b.js → a6324f5f560ffadc6e5d.js} +1 -1
- package/assets/esri/core/workers/chunks/{a091623bbfb3d771c8d8.js → d8db2c51b2fb42f37b2a.js} +1 -1
- package/assets/esri/core/workers/chunks/da517b4b07d4d27ce94c.js +1 -0
- package/assets/esri/core/workers/chunks/{984bb0943d07c86b7e77.js → ded3ef385d5a3a2ec8ca.js} +1 -1
- package/assets/esri/core/workers/chunks/defc6b50df5018bd9e86.js +1 -0
- package/assets/esri/core/workers/chunks/ed1dabed10ff9f4e0369.js +1 -0
- package/assets/esri/core/workers/chunks/{14dc21fe66c7b98fb456.js → f3127bdf28a1d9b8db27.js} +1 -1
- package/assets/esri/core/workers/chunks/fee942ef802a162e0248.js +1 -0
- package/assets/esri/themes/base/widgets/_Attribution.scss +8 -0
- 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/chunks/BlendLayers.glsl.js +1 -1
- package/config.js +1 -1
- package/core/Message.js +1 -1
- package/core/deprecate.js +1 -1
- package/core/keyboard.js +5 -0
- package/geometry/Circle.js +1 -1
- package/geometry/Extent.js +1 -1
- package/geometry/geodesicUtils.js +5 -0
- package/geometry/support/geodesicUtils.js +1 -1
- package/interfaces.d.ts +482 -190
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/graphics/OptimizedGeometry.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/knowledgeGraph/SessionMemoryStorage.js +1 -1
- package/layers/support/BuildingFilterBlock.js +1 -1
- package/package.json +2 -2
- package/rest/support/QueryMixin.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/analysis/AreaMeasurement/AreaMeasurementController.js +1 -1
- package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementController.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/SymbolRepository.js +1 -1
- package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/grid/gridUtils.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/OGCFeatureLayerView2D.js +1 -1
- package/views/2d/layers/StreamLayerView2D.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/environment/SceneViewEnvironment.js +1 -1
- package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
- package/views/3d/layers/DimensionLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/ImageryLayerView3D.js +1 -1
- package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/OGCFeatureLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/StreamLayerView3D.js +1 -1
- package/views/3d/layers/ViewshedLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
- package/views/3d/layers/graphics/LabelDeconflictor.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/support/Attribution3D.js +5 -0
- package/views/3d/terrain/TileBlendTechniqueConfiguration.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +4 -4
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +4 -4
- package/views/Attribution.js +5 -0
- package/views/DOMContainer.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
- package/views/draw/support/managers/DrawTooltipManager.js +5 -0
- package/views/interactive/sketch/constraintUtils.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDynamic.js +5 -0
- package/views/interactive/tooltip/content/tooltipContentFactory.js +1 -1
- package/views/interactive/tooltip/fields/TooltipField.js +1 -1
- package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +5 -0
- package/views/layers/DimensionLayerView.js +1 -1
- package/views/layers/DimensionLayerViewMixin.js +5 -0
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/layers/FeatureLayerViewMixin.d.ts +2 -2
- package/views/layers/FeatureLayerViewMixin.js +5 -0
- package/views/layers/ImageryLayerView.js +1 -1
- package/views/layers/ImageryLayerViewMixin.js +5 -0
- package/views/layers/LayerView.js +1 -1
- package/views/layers/LineOfSightLayerView.js +1 -1
- package/views/layers/LineOfSightLayerViewMixin.js +5 -0
- package/views/layers/MediaLayerView.js +1 -1
- package/views/layers/MediaLayerViewMixin.js +5 -0
- package/views/layers/OGCFeatureLayerView.js +1 -1
- package/views/layers/PointCloudLayerView.js +1 -1
- package/views/layers/StreamLayerView.js +1 -1
- package/views/layers/ViewshedLayerView.js +1 -1
- package/views/layers/ViewshedLayerViewMixin.js +5 -0
- package/views/support/AttributionItem.d.ts +4 -0
- package/views/support/AttributionItem.js +5 -0
- package/views/support/LayerLayerViewInfo.js +1 -1
- package/views/support/LayerViewManager.js +1 -1
- package/views/support/PromiseQueue.js +1 -1
- package/views/support/angularMeasurementUtils.js +1 -1
- package/views/support/attributionUtils.js +5 -0
- package/views/support/drapedUtils.js +1 -1
- package/views/support/geodesicAreaMeasurementUtils.js +1 -1
- package/views/support/geodesicLengthMeasurementUtils.js +1 -1
- package/views/support/geodesicMeasurementUtils.js +1 -1
- package/views/ui/2d/DefaultUI2D.js +1 -1
- package/views/ui/3d/DefaultUI3D.js +1 -1
- package/webscene/Environment.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/Attribution/AttributionViewModel.js +1 -1
- package/widgets/Attribution.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLine.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/support/decorators/accessibleHandler.js +1 -1
- package/widgets/support/forms/expressions/FormExpressionArcadeExecutor.js +1 -1
- package/widgets/support/jsxWidgetSupport.js +1 -1
- package/widgets/support/widget.js +1 -1
- package/widgets/support/widgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/25143b919e75d5d2da05.js +0 -1
- package/assets/esri/core/workers/chunks/2d17ed5321ca05acb8e3.js +0 -1
- package/assets/esri/core/workers/chunks/447b53a9280b2b19b7a6.js +0 -1
- package/assets/esri/core/workers/chunks/6ce7ca6bebdc61d8eada.js +0 -1
- package/assets/esri/core/workers/chunks/8fbda0b85731ac77e1d8.js +0 -1
- package/assets/esri/core/workers/chunks/98c32d10a2344cd7a50b.js +0 -1
- package/assets/esri/core/workers/chunks/b66e41d626a7d1b81d48.js +0 -1
- package/assets/esri/core/workers/chunks/d5b464ff83ce29b51968.js +0 -1
- package/assets/esri/core/workers/chunks/d777d7cb8df3f21ac97e.js +0 -1
- package/layers/support/attributionUtils.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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{EventEmitter as i}from"../../../../core/Evented.js";import{watch as r}from"../../../../core/reactiveUtils.js";import{property as s,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{ExtentSet as n}from"./ExtentSet.js";import{TaskPriority as o}from"../../../support/Scheduler.js";let h=class extends e{constructor(t){super(t),this._dirtyExtents=new n,this._globalDirty=!1,this._averageExtentUpdateSize=0,this._dirtyGraphicsSet=new Set,this._updateElevation=!1,this.graphicsCoreOwner=null,this.graphicsCore=null,this.events=new i}initialize(){const t=this.elevationProvider,e=this.graphicsCoreOwner.view.resourceController.scheduler;this._task=e.registerTask(p(this.graphicsCore.layer.elevationInfo?.mode),this),this.addHandles([t.on("elevation-change",t=>this._elevationChanged(t)),r(()=>this.graphicsCoreOwner.suspended,()=>this._suspendedChange()),this._task,r(()=>p(this.graphicsCore.layer.elevationInfo?.mode),t=>this._task.priority=t)])}destroy(){this._dirtyGraphicsSet.clear(),this.graphicsCoreOwner=null,this.graphicsCore=null,this.queryGraphicUIDsInExtent=null,this.elevationProvider=null,this._dirtyExtents.destroy()}clear(){this._dirtyGraphicsSet.clear(),this.notifyChange("updating")}_suspendedChange(){!0===this.graphicsCoreOwner.suspended?this._updateElevation=!1:!1===this.graphicsCoreOwner.suspended&&this._updateElevation&&(this._globalDirty=!0,this.notifyChange("updating"))}elevationInfoChange(){this._globalDirty=!0,this.notifyChange("updating")}get updating(){return this.readyToRun}get readyToRun(){return this._dirtyGraphicsSet.size>0||this._dirtyExtents&&!this._dirtyExtents.empty||this._globalDirty}get updatingRemaining(){return this._dirtyGraphicsSet.size+this._dirtyExtents.size*this._averageExtentUpdateSize}runTask(t){for(this._globalDirty&&(this._markAllGraphicsElevationDirty(),this._globalDirty=!1,t.madeProgress()),t.run(()=>this._dirtyExtents.merge(t));this.readyToRun&&!t.done;)this._updateDirtyGraphics(t),this._updateDirtyExtents(t);this.notifyChange("updating")}_updateDirtyGraphics(t){const e=this.graphicsCoreOwner.view.renderCoordsHelper,i=0===this.graphicsCore.effectiveUpdatePolicy;for(const r of this._dirtyGraphicsSet.keys()){const s=this.graphicsCore.getGraphics3DGraphicById(r);if(this._dirtyGraphicsSet.delete(r),null!=s&&(s.alignWithElevation(this.elevationProvider,e,i),this.graphicsCore.deconflictor?.setDirty(),t.madeProgress()),t.done)return}}_updateDirtyExtents(t){for(;!this._dirtyExtents.empty&&!t.done;){const e=this._dirtyExtents.pop(),i=this.elevationProvider
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{EventEmitter as i}from"../../../../core/Evented.js";import{watch as r}from"../../../../core/reactiveUtils.js";import{property as s,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{ExtentSet as n}from"./ExtentSet.js";import{TaskPriority as o}from"../../../support/Scheduler.js";let h=class extends e{constructor(t){super(t),this._dirtyExtents=new n,this._globalDirty=!1,this._averageExtentUpdateSize=0,this._dirtyGraphicsSet=new Set,this._updateElevation=!1,this.graphicsCoreOwner=null,this.graphicsCore=null,this.events=new i}initialize(){const t=this.elevationProvider,e=this.graphicsCoreOwner.view.resourceController.scheduler;this._task=e.registerTask(p(this.graphicsCore.layer.elevationInfo?.mode),this),this.addHandles([t.on("elevation-change",t=>this._elevationChanged(t)),r(()=>this.graphicsCoreOwner.suspended,()=>this._suspendedChange()),this._task,r(()=>p(this.graphicsCore.layer.elevationInfo?.mode),t=>this._task.priority=t)])}destroy(){this._dirtyGraphicsSet.clear(),this.graphicsCoreOwner=null,this.graphicsCore=null,this.queryGraphicUIDsInExtent=null,this.elevationProvider=null,this._dirtyExtents.destroy()}clear(){this._dirtyGraphicsSet.clear(),this.notifyChange("updating")}_suspendedChange(){!0===this.graphicsCoreOwner.suspended?this._updateElevation=!1:!1===this.graphicsCoreOwner.suspended&&this._updateElevation&&(this._globalDirty=!0,this.notifyChange("updating"))}elevationInfoChange(){this._globalDirty=!0,this.notifyChange("updating")}get updating(){return this.readyToRun}get readyToRun(){return this._dirtyGraphicsSet.size>0||this._dirtyExtents&&!this._dirtyExtents.empty||this._globalDirty}get updatingRemaining(){return this._dirtyGraphicsSet.size+this._dirtyExtents.size*this._averageExtentUpdateSize}runTask(t){for(this._globalDirty&&(this._markAllGraphicsElevationDirty(),this._globalDirty=!1,t.madeProgress()),t.run(()=>this._dirtyExtents.merge(t));this.readyToRun&&!t.done;)this._updateDirtyGraphics(t),this._updateDirtyExtents(t);this.notifyChange("updating")}_updateDirtyGraphics(t){const e=this.graphicsCoreOwner.view.renderCoordsHelper,i=0===this.graphicsCore.effectiveUpdatePolicy;for(const r of this._dirtyGraphicsSet.keys()){const s=this.graphicsCore.getGraphics3DGraphicById(r);if(this._dirtyGraphicsSet.delete(r),null!=s&&(s.alignWithElevation(this.elevationProvider,e,i),this.graphicsCore.deconflictor?.setDirty(),t.madeProgress()),t.done)return}}_updateDirtyExtents(t){for(;!this._dirtyExtents.empty&&!t.done;){const e=this._dirtyExtents.pop(),{spatialReference:i}=this.elevationProvider;this.events.emit("invalidate-elevation",{extent:e,spatialReference:i});const r=this._dirtyGraphicsSet.size;this.queryGraphicUIDsInExtent(e,i,t=>{const e=this.graphicsCore.getGraphics3DGraphicById(t);null!=e&&e.needsElevationUpdates()&&this._dirtyGraphicsSet.add(t)}),this._averageExtentUpdateSize=.1*(this._dirtyGraphicsSet.size-r)+.9*this._averageExtentUpdateSize,t.madeProgress()}}_markAllGraphicsElevationDirty(){this._dirtyExtents.clear(),this._dirtyGraphicsSet.clear(),this.graphicsCore.graphics3DGraphics.forEach((t,e)=>this._dirtyGraphicsSet.add(e))}_elevationChanged(t){if("scene"===t.context&&(!this.graphicsCore.layer.elevationInfo||"relative-to-scene"!==this.graphicsCore.layer.elevationInfo.mode))return;const e=t.extent;if(this.graphicsCoreOwner.suspended){if(!this._updateElevation){const t=this.graphicsCore.computedExtent;t&&e[2]>t.xmin&&e[0]<t.xmax&&e[3]>t.ymin&&e[1]<t.ymax&&(this._updateElevation=!0)}this.events.emit("invalidate-elevation",t)}else e[0]===-1/0?this._globalDirty=!0:this._dirtyExtents.add(e),this.notifyChange("updating")}};function p(t){return null==t?o.ELEVATION_ALIGNMENT:"relative-to-scene"===t?o.ELEVATION_ALIGNMENT_SCENE:o.ELEVATION_ALIGNMENT}t([s()],h.prototype,"graphicsCoreOwner",void 0),t([s()],h.prototype,"graphicsCore",void 0),t([s()],h.prototype,"queryGraphicUIDsInExtent",void 0),t([s()],h.prototype,"elevationProvider",void 0),t([s({readOnly:!0})],h.prototype,"updating",null),t([s({readOnly:!0})],h.prototype,"updatingRemaining",null),h=t([a("esri.views.3d.layers.graphics.Graphics3DElevationAlignment")],h);export{h as Graphics3DElevationAlignment};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as r,subclass as
|
|
5
|
+
import{__decorate as t}from"tslib";import"../../../../core/has.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{Deconflictor as e}from"./Deconflictor.js";import{Yield as s}from"../../../support/Yield.js";const i=2e3;let n=class extends e{constructor(t){super(t),this.visibilityGroup=16,this.marginFactor=.05,this._lastDeconfliction=0}get viewState(){return this.parent.viewState}runTask(t){if(this.parent.readyToRun)return s;const r=performance.now();if(2!==this.view.state.mode&&r-this._lastDeconfliction<i)return s;const o=super.runTask(t);return 0===this.state&&(this._lastDeconfliction=r),o}};t([r({constructOnly:!0})],n.prototype,"parent",void 0),n=t([o("esri.views.3d.layers.graphics.LabelDeconflictor")],n);export{n as LabelDeconflictor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../request.js";import r from"../../../../core/Accessor.js";import{splitIntoChunks as s}from"../../../../core/arrayUtils.js";import{createTask as i,resultOrAbort as n,result as o}from"../../../../core/asyncUtils.js";import a from"../../../../core/Collection.js";import{makeHandle as d}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import c from"../../../../core/Logger.js";import{abortMaybe as h,destroyMaybe as l}from"../../../../core/maybe.js";import{estimateStringMemory as u,estimateNumberMemory as m}from"../../../../core/memoryEstimations.js";import{whenOrAbort as g,createResolver as p}from"../../../../core/promiseUtils.js";import y from"../../../../core/ReactiveSet.js";import{watch as f,sync as _}from"../../../../core/reactiveUtils.js";import{property as b,subclass as v}from"../../../../core/accessorSupport/decorators.js";import{equals as O}from"../../../../geometry/support/spatialReferenceUtils.js";import{formatNumber as j}from"../../../../intl/number.js";import{getMaximumQuerySize as C,queryAllJSON as w}from"../../../../layers/support/featureQueryAll.js";let I=class extends r{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._maximumNumberOfEditOVerrides=L,this._definitionExpressionDirty=!0,this._interactiveEditingSessions=new a,this.geometryOverrides=new a,this._clientGeometryCache=new Map,this._attributeChangedObjectIds=new y,this._geometryChangedObjectIds=new y,this._pendingFetchChangedObjectIds=null,this._pendingFetchAbortController=new AbortController,this._applyGeometryOverridesTask=null,this._featureIdLocks=new Map}initialize(){this._memCache=new A(this.memoryController.newCache(`i3s-attribute-overrides-${this.layer.uid}`)),this.addHandles(f(()=>this.layer.definitionExpression,async()=>{this._definitionExpressionDirty=!0,this._pendingFetchChangedObjectIds||(this._applyGeometryOverridesTask=h(this._applyGeometryOverridesTask),this._applyGeometryOverridesTask=i(e=>this._queryAndAddGeometryOverrides(e)),await this._applyGeometryOverridesTask.promise)},_)),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.finally(()=>{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null})}destroy(){this._set("layer",null),this._memCache=l(this._memCache),this._pendingFetchAbortController=h(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){return null!=this._associatedLayer?.infoFor3D}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort((e,t)=>e-t):[]}get _associatedLayer(){return null==this.layer?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get updating(){return!!this.is3DOFL&&!!(this._pendingFetchChangedObjectIds||this._applyGeometryOverridesTask&&!this._applyGeometryOverridesTask.finished)}get isEmpty(){return null==this._pendingFetchChangedObjectIds&&0===this._attributeChangedObjectIds.size&&0===this._geometryChangedObjectIds.size}featureHasGeometryChanges(e){return this._geometryChangedObjectIds.has(e)}featureHasAttributeChanges(e){return this._attributeChangedObjectIds.has(e)}createInteractiveEditSession(e){this._attributeChangedObjectIds.add(e);const t=this._interactiveEditingSessions,r=new F(e,()=>{t.remove(r)});return t.unshift(r),r}async applyAttributeOverrides(e,t,r,s=[]){if(this._pendingFetchChangedObjectIds&&await g(this._pendingFetchChangedObjectIds,r),null==t)return;const{attributeData:i,loadedAttributes:n}=t;if(null==n||null==i||0===this._attributeChangedObjectIds.size)return;const o=new Set;for(const d of n)o.add(d.index);for(const d of s)o.has(d.index)||(n.push(d),i[d.name]=new Array(e.length));const a=await this._lockFeatureIds(e);try{const t={attributeData:i,loadedAttributes:n},s=this._getOverridesFromCache(e,t,this._attributeChangedObjectIds),{objectIds:o,fieldNames:a}=s;if(0===o.length||0===a.length)return;const d=await this._queryAttributeOverridesFromAssociatedLayer(o,a,r);if(null==d)return;this._processOverridesFromAssociatedLayer(e,d,a,t)}finally{a.remove()}}updateGeometry(e,t){this._geometryChangedObjectIds.add(e);const r=this._clientGeometryCache.get(e);if(null!=r&&(this.geometryOverrides.remove(r),this._clientGeometryCache.delete(e)),null!=t){const r={oid:e,mesh:t};this.geometryOverrides.add(r),this._clientGeometryCache.set(e,r)}}updateAttributeValue(e,t,r){this._attributeChangedObjectIds.add(e),this._cacheAttributeValue(e,t,r)}featureAdded(e){this.is3DOFL&&this._geometryChangedObjectIds.add(e),this._attributeChangedObjectIds.add(e)}_cacheAttributeValue(e,t,r){this._memCache.put(e,t,r)}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:r},s){const i=new Array;for(const a of t)i[a.index]=r[a.name];const n=new Set,o=new Set;for(let a=0;a<e.length;a++){const r=e[a];if(s.has(r))for(const e of t){const t=this._attributeFromCache(r,e.index);void 0===t?(n.add(r),o.add(e.name)):i[e.index][a]=t}}return{objectIds:Array.from(n),fieldNames:Array.from(o)}}_attributeFromCache(e,t){const r=this._fromInteractiveEditingSession(e,t);return void 0!==r?r:this._memCache.get(e,t)}_fromInteractiveEditingSession(e,t){if(null!=this._interactiveEditingSessions)for(const r of this._interactiveEditingSessions){if(r.objectId!==e)continue;const s=r.getAttribute(t);if(void 0!==s)return s}}async _queryAttributeOverridesFromAssociatedLayer(e,t,r){if(0===e.length)return null;this._logWarningIfMaximumObjectsExceeded();const{associatedLayer:s}=this.layer;if(null==s)return null;const i=s.createQuery(),{objectIdField:n}=s,o=[n,...t];i.where=this.layer.definitionExpression||"1=1",i.returnGeometry=!1,i.outFields=o,i.cacheHint=!0;const a=await this._executeBatchQuery(s,e,i,r),d=[];for(const c of a)if(c.ok)for(const e of c.value.features)d.push(e);return d}async _queryGeometryOverridesFromAssociatedLayer(e,t){if(0===e.length||!this.is3DOFL)return null;const r=this.layer.associatedLayer,s=r.infoFor3D,{spatialReference:i}=r,{state:{viewingMode:n},spatialReference:o}=this.view,a=1===n,d=i.isGeographic;if(a&&!d)return c.getLogger(this).warn("unsupported-pcs-edits-in-global-view",this.layer.title,E(i,o,this.view.viewingMode,0)),null;if(!a&&d)return c.getLogger(this).warn("unsupported-gcs-edits-in-local-view",this.layer.title,E(i,o,this.view.viewingMode,0)),null;if(!(O(i,o)||a&&o.isWebMercator&&i.isWGS84))return c.getLogger(this).warn("unsupported-mismatched-spatial-reference-edits",this.layer.title,E(i,o,this.view.viewingMode,1)),null;this._logWarningIfMaximumObjectsExceeded();const{objectIdField:h,globalIdField:l}=r,u=[h,...null!=l?[l]:[]],m=r.createQuery();m.where=this.layer.definitionExpression||"1=1",m.returnGeometry=!0,m.outFields=u,m.cacheHint=!0,m.returnZ=r.hasZ,m.returnM=r.hasM;const{assetMapFromAssetMapsJSON:g,extractMesh:p}=await import("../../../../rest/support/meshFeatureSet.js"),y=await this._executeBatchQuery(r,e,m,t),f=[];for(const c of y){if(!c.ok)continue;const e=c.value,{assetMaps:t,features:r,globalIdFieldName:n}=e;if(null==t)continue;const o=g(s,t);for(const a of r){const e=p(a,n,i,s,o),t=a;null!=e?(t.geometry=e,f.push(t)):t.geometry=null}}return f}_logWarningIfMaximumObjectsExceeded(){if(!this._warnMaximumChangedObjectsExceeded)return;this._warnMaximumChangedObjectsExceeded=!1;let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${j(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;e+=t?.loaded?` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:` (${this.layer.parsedUrl.path})`,c.getLogger(this).warn("#queryOverrides()",this.layer.title,`${e}.`)}async _executeBatchQuery(e,t,r,i){if(0===t.length)return[];const o=C(e);t=[...t].sort((e,t)=>e-t);const a=s(t,o).map(t=>{const s=r.clone();return s.objectIds=t,n(w(e,s,{signal:i}))});return Promise.all(a)}_processOverridesFromAssociatedLayer(e,t,r,{loadedAttributes:s,attributeData:i}){const n=this._associatedLayer;if(null==n)return;const o=n.objectIdField,a=r.map(t=>(t in i||(i[t]=new Array(e.length)),i[t])),d=new Map(s.map(e=>[e.name,e.index])),c=r.map(e=>d.get(e)),h=new Map(Array.from(e,(e,t)=>[e,t]));for(const l of t){const e=l.attributes[o];for(let t=0;t<r.length;t++){const s=c[t],i=h.get(e),n=l.attributes[r[t]];a[t][i]=n,this._cacheAttributeValue(e,s,n)}}}async _fetchChangedObjectIds(e){const r=this.layer;await r.load({signal:e}),this._geometryChangedObjectIds.clear(),this._attributeChangedObjectIds.clear();const{associatedLayer:s}=r;if(null==s||!s.capabilities?.operations?.supportsChangeTracking)return;const i=this._getFetchChangedObjectIdsServerGen();if(null==i)return;const n=s.layerId,a=this.is3DOFL,d={...s.customParameters,f:"json",returnIdsOnly:!0,layers:`[${n}]`,returnUpdates:!0,returnDeletes:a,returnInserts:a,layerServerGens:JSON.stringify([{id:n,serverGen:i}])};if(null!=s.apiKey&&(d.token=s.apiKey),a){const e=s.infoFor3D;d.fieldsToCompare=JSON.stringify({fields:[...Object.values(e.transformFieldRoles),e.sourceHashField]})}const h=await o(t(`${s.url}/extractChanges`,{method:"post",query:d,timeout:G,signal:e}));if(!h.ok){const e=this.layer.title;c.getLogger(this).warn("extractChanges:timeout",e,": could not obtain edited features that are not cached in the scene service. Display of features may not be up to date with the latest edits. Consider re-caching the scene service.")}if(h.ok&&1===h.value.data?.edits?.length){const t=h.value.data.edits[0],r=t?.objectIds,s=t?.fieldUpdates,i=r?.adds??[],n=r?.updates??[],o=r?.deletes??[],d=[...i,...n,...o],c=a?[...i,...s??n,...o]:[],l=Math.min(this._maximumNumberOfEditOVerrides,d.length);l<d.length&&(this._warnMaximumChangedObjectsExceeded=!0);const u=d.sort((e,t)=>e-t);for(let e=0;e<l;++e){const t=u[e];this._attributeChangedObjectIds.add(t)}for(const e of c)this._geometryChangedObjectIds.add(e);for(;this._definitionExpressionDirty;)await this._queryAndAddGeometryOverrides(e)}}async _queryAndAddGeometryOverrides(e){this._definitionExpressionDirty=!1;const t=this.layer,{associatedLayer:r}=t;if(null!=r&&r.capabilities?.operations?.supportsChangeTracking&&this.is3DOFL&&this._geometryChangedObjectIds.size>0){const t=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),e);if(null!=t)for(const e of t)null!=e.geometry&&this.updateGeometry(e.attributes[r.objectIdField],e.geometry)}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(null!=e.serviceUpdateTimeStamp?.lastUpdate)return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return null!=t?.serverGens?.minServerGen?t.serverGens.minServerGen:null}async _lockFeatureIds(e){const t=this._featureIdLocks;let r=!0;for(;r;){const s=new Array;for(const r of e){const e=t.get(r);e&&s.push(e)}0===s.length?r=!1:await Promise.all(s)}const s=p(),i=s.promise;for(const n of e)t.set(n,i);return d(()=>{for(const r of e)t.delete(r);s.resolve()})}get test(){}};e([b({constructOnly:!0})],I.prototype,"view",void 0),e([b({constructOnly:!0})],I.prototype,"layer",void 0),e([b({readOnly:!0})],I.prototype,"is3DOFL",null),e([b()],I.prototype,"_interactiveEditingSessions",void 0),e([b({readOnly:!0})],I.prototype,"sortedGeometryChangedObjectIds",null),e([b({readOnly:!0})],I.prototype,"geometryOverrides",void 0),e([b()],I.prototype,"_clientGeometryCache",void 0),e([b()],I.prototype,"_associatedLayer",null),e([b({constructOnly:!0})],I.prototype,"memoryController",void 0),e([b()],I.prototype,"_attributeChangedObjectIds",void 0),e([b()],I.prototype,"_geometryChangedObjectIds",void 0),e([b()],I.prototype,"hasGeometryChanges",null),e([b()],I.prototype,"_pendingFetchChangedObjectIds",void 0),e([b()],I.prototype,"_pendingFetchAbortController",void 0),e([b()],I.prototype,"_applyGeometryOverridesTask",void 0),e([b()],I.prototype,"updating",null),e([b()],I.prototype,"isEmpty",null),I=e([v("esri.views.3d.layers.i3s.I3SOverrides")],I);class F{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}class A{constructor(e){this._cache=e}destroy(){this._cache.destroy()}put(e,t,r){this._cache.put(this._getKey(e,t),new x(r))}get(e,t){return this._cache.get(this._getKey(e,t))?.value}_getKey(e,t){return`${e}-${t}`}}class x{constructor(e){this.value=e,this.usedMemory="string"==typeof e?u(e):m}}const G=1e4,L=5e4;function E(e,t,r,s){return`Displaying the edits of a SceneLayer with a${0===s?e.isGeographic?" geographic ":" projected ":" "}spatial reference (wkid:${e.wkid}) in ${r} viewing mode${1===s?` with spatial reference (wkid:${t.wkid}) `:" "}is not supported. No geometry edits will be displayed for this layer.\nPlease consider re-caching the scene service or changing the ${0===s?"viewing mode":"view spatial reference"} to display edits.`}export{I as I3SOverrides};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../request.js";import r from"../../../../core/Accessor.js";import{splitIntoChunks as s}from"../../../../core/arrayUtils.js";import{createTask as i,resultOrAbort as n,result as o}from"../../../../core/asyncUtils.js";import a from"../../../../core/Collection.js";import{makeHandle as d}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import c from"../../../../core/Logger.js";import{abortMaybe as h,destroyMaybe as l}from"../../../../core/maybe.js";import{estimateStringMemory as u,estimateNumberMemory as m}from"../../../../core/memoryEstimations.js";import{whenOrAbort as g,createResolver as p}from"../../../../core/promiseUtils.js";import y from"../../../../core/ReactiveSet.js";import{watch as f,sync as _}from"../../../../core/reactiveUtils.js";import{property as b,subclass as v}from"../../../../core/accessorSupport/decorators.js";import{equals as O}from"../../../../geometry/support/spatialReferenceUtils.js";import{formatNumber as j}from"../../../../intl/number.js";import{getMaximumQuerySize as C,queryAllJSON as w}from"../../../../layers/support/featureQueryAll.js";let I=class extends r{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._maximumNumberOfEditOVerrides=L,this._definitionExpressionDirty=!0,this._interactiveEditingSessions=new a,this.geometryOverrides=new a,this._clientGeometryCache=new Map,this._attributeChangedObjectIds=new y,this._geometryChangedObjectIds=new y,this._pendingFetchChangedObjectIds=null,this._pendingFetchAbortController=new AbortController,this._applyGeometryOverridesTask=null,this._featureIdLocks=new Map}initialize(){this._memCache=new A(this.memoryController.newCache(`i3s-attribute-overrides-${this.layer.uid}`)),this.addHandles(f(()=>this.layer.definitionExpression,async()=>{this._definitionExpressionDirty=!0,this._pendingFetchChangedObjectIds||(this._applyGeometryOverridesTask=h(this._applyGeometryOverridesTask),this._applyGeometryOverridesTask=i(e=>this._queryAndAddGeometryOverrides(e)),await this._applyGeometryOverridesTask.promise)},_)),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.finally(()=>{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null})}destroy(){this._set("layer",null),this._memCache=l(this._memCache),this._pendingFetchAbortController=h(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){return null!=this._associatedLayer?.infoFor3D}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort((e,t)=>e-t):[]}get _associatedLayer(){return null==this.layer?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get updating(){return!!this.is3DOFL&&!!(this._pendingFetchChangedObjectIds||this._applyGeometryOverridesTask&&!this._applyGeometryOverridesTask.finished)}get isEmpty(){return null==this._pendingFetchChangedObjectIds&&0===this._attributeChangedObjectIds.size&&0===this._geometryChangedObjectIds.size}featureHasGeometryChanges(e){return this._geometryChangedObjectIds.has(e)}featureHasAttributeChanges(e){return this._attributeChangedObjectIds.has(e)}createInteractiveEditSession(e){this._attributeChangedObjectIds.add(e);const t=this._interactiveEditingSessions,r=new F(e,()=>{t.remove(r)});return t.unshift(r),r}async applyAttributeOverrides(e,t,r,s=[]){if(this._pendingFetchChangedObjectIds&&await g(this._pendingFetchChangedObjectIds,r),null==t)return;const{attributeData:i,loadedAttributes:n}=t;if(null==n||null==i||0===this._attributeChangedObjectIds.size)return;const o=new Set;for(const d of n)o.add(d.index);for(const d of s)o.has(d.index)||(n.push(d),i[d.name]=new Array(e.length));const a=await this._lockFeatureIds(e);try{const t={attributeData:i,loadedAttributes:n},s=this._getOverridesFromCache(e,t,this._attributeChangedObjectIds),{objectIds:o,fieldNames:a}=s;if(0===o.length||0===a.length)return;const d=await this._queryAttributeOverridesFromAssociatedLayer(o,a,r);if(null==d)return;this._processOverridesFromAssociatedLayer(e,d,a,t)}finally{a.remove()}}updateGeometry(e,t){this._geometryChangedObjectIds.add(e);const r=this._clientGeometryCache.get(e);if(null!=r&&(this.geometryOverrides.remove(r),this._clientGeometryCache.delete(e)),null!=t){const r={oid:e,mesh:t};this.geometryOverrides.add(r),this._clientGeometryCache.set(e,r)}}updateAttributeValue(e,t,r){this._attributeChangedObjectIds.add(e),this._cacheAttributeValue(e,t,r)}featureAdded(e){this.is3DOFL&&this._geometryChangedObjectIds.add(e),this._attributeChangedObjectIds.add(e)}_cacheAttributeValue(e,t,r){this._memCache.put(e,t,r)}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:r},s){const i=new Array;for(const a of t)i[a.index]=r[a.name];const n=new Set,o=new Set;for(let a=0;a<e.length;a++){const r=e[a];if(s.has(r))for(const e of t){const t=this._attributeFromCache(r,e.index);void 0===t?(n.add(r),o.add(e.name)):i[e.index][a]=t}}return{objectIds:Array.from(n),fieldNames:Array.from(o)}}_attributeFromCache(e,t){const r=this._fromInteractiveEditingSession(e,t);return void 0!==r?r:this._memCache.get(e,t)}_fromInteractiveEditingSession(e,t){if(null!=this._interactiveEditingSessions)for(const r of this._interactiveEditingSessions){if(r.objectId!==e)continue;const s=r.getAttribute(t);if(void 0!==s)return s}}async _queryAttributeOverridesFromAssociatedLayer(e,t,r){if(0===e.length)return null;this._logWarningIfMaximumObjectsExceeded();const{associatedLayer:s}=this.layer;if(null==s)return null;const i=s.createQuery(),{objectIdField:n}=s,o=[n,...t];i.where=this.layer.definitionExpression||"1=1",i.returnGeometry=!1,i.outFields=o,i.cacheHint=!0;const a=await this._executeBatchQuery(s,e,i,r),d=[];for(const c of a)if(c.ok)for(const e of c.value.features)d.push(e);return d}async _queryGeometryOverridesFromAssociatedLayer(e,t){if(0===e.length||!this.is3DOFL)return null;const r=this.layer.associatedLayer,s=r.infoFor3D,{spatialReference:i}=r,{state:{viewingMode:n},spatialReference:o}=this.view,a=1===n,d=i.isGeographic;if(a&&!d)return c.getLogger(this).warn("unsupported-pcs-edits-in-global-view",this.layer.title,E(i,o,this.view.viewingMode,0)),null;if(!a&&d)return c.getLogger(this).warn("unsupported-gcs-edits-in-local-view",this.layer.title,E(i,o,this.view.viewingMode,0)),null;if(!(O(i,o)||a&&o.isWebMercator&&i.isWGS84))return c.getLogger(this).warn("unsupported-mismatched-spatial-reference-edits",this.layer.title,E(i,o,this.view.viewingMode,1)),null;this._logWarningIfMaximumObjectsExceeded();const{objectIdField:h,globalIdField:l}=r,u=[h,...null!=l?[l]:[]],m=r.createQuery();m.where=this.layer.definitionExpression||"1=1",m.returnGeometry=!0,m.outFields=u,m.cacheHint=!0,m.returnZ=r.hasZ,m.returnM=r.hasM;const{assetMapFromAssetMapsJSON:g,extractMesh:p}=await import("../../../../rest/support/meshFeatureSet.js"),y=await this._executeBatchQuery(r,e,m,t),f=[];for(const c of y){if(!c.ok)continue;const e=c.value,{assetMaps:t,features:r,globalIdFieldName:n}=e;if(null==t)continue;const o=g(s,t);for(const a of r){const e=p(a,n,i,s,o),t=a;null!=e?(t.geometry=e,f.push(t)):t.geometry=null}}return f}_logWarningIfMaximumObjectsExceeded(){if(!this._warnMaximumChangedObjectsExceeded)return;this._warnMaximumChangedObjectsExceeded=!1;let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${j(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;e+=t?.loaded?` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:` (${this.layer.parsedUrl.path})`,c.getLogger(this).warn("#queryOverrides()",this.layer.title,`${e}.`)}async _executeBatchQuery(e,t,r,i){if(0===t.length)return[];const o=C(e);t=[...t].sort((e,t)=>e-t);const a=s(t,o).map(t=>{const s=r.clone();return s.objectIds=t,n(w(e,s,{signal:i}))});return Promise.all(a)}_processOverridesFromAssociatedLayer(e,t,r,{loadedAttributes:s,attributeData:i}){const n=this._associatedLayer;if(null==n)return;const o=n.objectIdField,a=r.map(t=>(t in i||(i[t]=new Array(e.length)),i[t])),d=new Map(s.map(e=>[e.name,e.index])),c=r.map(e=>d.get(e)),h=new Map(Array.from(e,(e,t)=>[e,t]));for(const l of t){const e=l.attributes[o];for(let t=0;t<r.length;t++){const s=c[t],i=h.get(e),n=l.attributes[r[t]];a[t][i]=n,this._cacheAttributeValue(e,s,n)}}}async _fetchChangedObjectIds(e){const r=this.layer;await r.load({signal:e}),this._geometryChangedObjectIds.clear(),this._attributeChangedObjectIds.clear();const{associatedLayer:s}=r;if(null==s||!s.capabilities?.operations?.supportsChangeTracking)return;const i=this._getFetchChangedObjectIdsServerGen();if(null==i)return;const n=s.layerId,a=this.is3DOFL,d={...s.customParameters,f:"json",returnIdsOnly:!0,layers:`[${n}]`,returnUpdates:!0,returnDeletes:a,returnInserts:a,layerServerGens:JSON.stringify([{id:n,serverGen:i}])};if(null!=s.apiKey&&(d.token=s.apiKey),a){const e=s.infoFor3D;d.fieldsToCompare=JSON.stringify({fields:[...Object.values(e.transformFieldRoles),e.sourceHashField]})}const h=await o(t(`${s.url}/extractChanges`,{method:"post",query:d,timeout:G,signal:e}));if(!h.ok){const e=this.layer.title;c.getLogger(this).warn("extractChanges:unavailable",e,": could not obtain edited features that are not cached in the scene service. Display of features may not be up to date with the latest edits. Consider re-caching the scene service.")}if(h.ok&&1===h.value.data?.edits?.length){const t=h.value.data.edits[0],r=t?.objectIds,s=t?.fieldUpdates,i=r?.adds??[],n=r?.updates??[],o=r?.deletes??[],d=[...i,...n,...o],c=a?[...i,...s??n,...o]:[],l=Math.min(this._maximumNumberOfEditOVerrides,d.length);l<d.length&&(this._warnMaximumChangedObjectsExceeded=!0);const u=d.sort((e,t)=>e-t);for(let e=0;e<l;++e){const t=u[e];this._attributeChangedObjectIds.add(t)}for(const e of c)this._geometryChangedObjectIds.add(e);for(;this._definitionExpressionDirty;)await this._queryAndAddGeometryOverrides(e)}}async _queryAndAddGeometryOverrides(e){this._definitionExpressionDirty=!1;const t=this.layer,{associatedLayer:r}=t;if(null!=r&&r.capabilities?.operations?.supportsChangeTracking&&this.is3DOFL&&this._geometryChangedObjectIds.size>0){const t=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),e);if(null!=t)for(const e of t)null!=e.geometry&&this.updateGeometry(e.attributes[r.objectIdField],e.geometry)}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(null!=e.serviceUpdateTimeStamp?.lastUpdate)return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return null!=t?.serverGens?.minServerGen?t.serverGens.minServerGen:null}async _lockFeatureIds(e){const t=this._featureIdLocks;let r=!0;for(;r;){const s=new Array;for(const r of e){const e=t.get(r);e&&s.push(e)}0===s.length?r=!1:await Promise.all(s)}const s=p(),i=s.promise;for(const n of e)t.set(n,i);return d(()=>{for(const r of e)t.delete(r);s.resolve()})}get test(){}};e([b({constructOnly:!0})],I.prototype,"view",void 0),e([b({constructOnly:!0})],I.prototype,"layer",void 0),e([b({readOnly:!0})],I.prototype,"is3DOFL",null),e([b()],I.prototype,"_interactiveEditingSessions",void 0),e([b({readOnly:!0})],I.prototype,"sortedGeometryChangedObjectIds",null),e([b({readOnly:!0})],I.prototype,"geometryOverrides",void 0),e([b()],I.prototype,"_clientGeometryCache",void 0),e([b()],I.prototype,"_associatedLayer",null),e([b({constructOnly:!0})],I.prototype,"memoryController",void 0),e([b()],I.prototype,"_attributeChangedObjectIds",void 0),e([b()],I.prototype,"_geometryChangedObjectIds",void 0),e([b()],I.prototype,"hasGeometryChanges",null),e([b()],I.prototype,"_pendingFetchChangedObjectIds",void 0),e([b()],I.prototype,"_pendingFetchAbortController",void 0),e([b()],I.prototype,"_applyGeometryOverridesTask",void 0),e([b()],I.prototype,"updating",null),e([b()],I.prototype,"isEmpty",null),I=e([v("esri.views.3d.layers.i3s.I3SOverrides")],I);class F{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}class A{constructor(e){this._cache=e}destroy(){this._cache.destroy()}put(e,t,r){this._cache.put(this._getKey(e,t),new x(r))}get(e,t){return this._cache.get(this._getKey(e,t))?.value}_getKey(e,t){return`${e}-${t}`}}class x{constructor(e){this.value=e,this.usedMemory="string"==typeof e?u(e):m}}const G=1e4,L=5e4;function E(e,t,r,s){return`Displaying the edits of a SceneLayer with a${0===s?e.isGeographic?" geographic ":" projected ":" "}spatial reference (wkid:${e.wkid}) in ${r} viewing mode${1===s?` with spatial reference (wkid:${t.wkid}) `:" "}is not supported. No geometry edits will be displayed for this layer.\nPlease consider re-caching the scene service or changing the ${0===s?"viewing mode":"view spatial reference"} to display edits.`}export{I as I3SOverrides};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{n as e,a as t,g as i,c as s,F as n,e as r,d as o,H as a,v as c,j as u,G as h,s as l,C as d,b as m,E as _,i as p}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as g}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as R}from"../../../../geometry/projection/projectors.js";import{create as S,fromMatrix as M,createPoints as x,intersectsSphere as C}from"../../../../geometry/support/frustum.js";import{getNormal as I,signedDistance as P}from"../../../../geometry/support/plane.js";import{isPlateCarree as D}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as E}from"../../../../geometry/support/sphere.js";import{makeDehydratedPoint as O}from"../../../../layers/graphics/dehydratedPoint.js";import{evaluateElevationAlignmentAtPoint as F}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as A}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as B,extractExpressionInfo as V}from"../graphics/featureExpressionInfoUtils.js";import{isValidMbs as y,intersectBoundingRectWithMbs as j}from"./I3SUtil.js";import{Obb as L,computeOffsetObb as w}from"../../support/orientedBoundingBox.js";const q=1e5;class G{get _frustumMbsCenter(){return this._frustumMbs.center}get _frustumMbsRadius(){return this._frustumMbs.radius}get _frustumPlanes(){return this._frustum}constructor(e,t,i,s,n,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=n,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=S(),this._frustumMbs=new E,this._viewDirection=f(),this._useFrustumCulling=!1,this._poi=f(),this._cameraPOIDirection=f(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=new L,this._tmp1=f(),this._tmp2=f(),this._tmp3=f(),this._tmp0=f(),this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const u=this._renderCoordsHelper.spatialReference;this._renderSR=u,this._renderSRSphericalPCPF=g(u),this._isGlobalMode=u===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._tmpPoint=O(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(u.isWebMercator||D(u)),this._indexSREllipsoidRadius=v(this._indexSR).radius,this._indexSRSphericalPCPF=g(e),this._projectorIndexSRToIndexSRSphericalPCPF=R(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=A.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(B(V(e,!1)))):this._elevationContext=null}updateCamera(n,r){if(this._useFrustumCulling=r,e(this._viewDirection,n.viewForward),r){M(n.viewMatrix,n.projectionMatrix,this._frustum,z);{const e=n.eye,r=N;t(r,z[4],e);const o=.5*i(r,r)/i(this._viewDirection,r),a=this._frustumMbs,c=a.center;s(c,e,this._viewDirection,o);const u=1+o;a.radius=u}}this._screenSizeFactor=1/(n.perScreenPixelRatio/2),this._camPos=n.eye,this._updateCameraPOIDirection(),this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const n="relative-to-scene"===this._elevationContext.mode?"scene":"ground";if(this._elevationProvider.getSphereElevationBounds){const e=this._elevationProvider.getSphereElevationBounds(s,this._indexSR,n);if(e)return void i.expandElevationRange(e)}const[r,o,a]=s.center,c=this._elevationProvider.getElevation(r,o,a,this._indexSR,n);c&&i.expandElevationRangeValues(c,c);const u=t?null:this._elevationProvider.getRootElevationBounds?.();u&&i.expandElevationRange(u)}getServiceMbsInRenderSR(e){const t=e.serviceMbsInRenderSR;if(y(t))return t;const{serviceMbsInIndexSR:i}=e;i&&t.copy(i);const s=e.elevationRangeMin;if(this._elevationContext&&Number.isFinite(s)){let i=0,n=0;const r=e.elevationRangeMax;switch(this._elevationContext.mode){case"relative-to-ground":case"relative-to-scene":i=this._elevationContext.geometryZWithOffset(t.center[2],this._renderCoordsHelper)+s-t.center[2],n=r-s;break;case"on-the-ground":i=s-t.center[2],n=r-s}t.center[2]+=i+.5*n,t.radius+=.5*n}else this._elevationContext&&t.radius<q&&(this._tmpPoint.x=t.center[0],this._tmpPoint.y=t.center[1],this._tmpPoint.z=t.center[2],t.center[2]=F(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper));return b(t,this._indexSR,t,this._renderSR),t}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new L,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const n=i.radius;let r=0,o=0;const a=s.centerZ,c=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){const t=e.elevationRangeMin,i=e.elevationRangeMax;switch(u.mode){case"relative-to-ground":case"relative-to-scene":r=u.geometryZWithOffset(a,c)+t-a,o=i-t;break;case"on-the-ground":r=t-a,o=i-t}}else if(u&&n<q){const e=this._tmpPoint;e.x=s.centerX,e.y=s.centerY,e.z=a,r=F(e,this._elevationProvider,u,c)-a}const h=o>0,l=h?this._tmpObb:t;return s.transform(l,this._indexSR,this._renderSR,r,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),h&&w(l,0,o,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;return t?(t.transform(Z,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),Z):null}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(1===this._viewingMode?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){n(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(r(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),n=t.elevationAgnosticBoundingVolume;let r,c=-1;if(s){const t=X;s.getCenter(t),e(t,t),r=t,s.getCorners(Y);for(const s of Y){e(s,s);const r=i(s,t);if(r<=0)return void n.invalidate();const o=Math.sqrt(1-r*r);c=Math.max(c,o)}}else{const i=t.serviceMbsInRenderSR;if(!y(i))return void n.invalidate();{const t=o(X,i.center),s=i.radius,u=a(t);if(u<s)return void n.invalidate();c=s/u,e(t,t),r=t}}const u=.001;n.set(r,c+u)}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(X);e[2]=0;let s=0;const n=J;i.getCorners(Y);for(const t of Y){t[2]=0;const e=c(n,t);s=Math.max(s,e)}t.set(e,Math.sqrt(s))}else{const i=e.serviceMbsInRenderSR;if(y(i)){const e=o(X,i.center);e[2]=0,t.set(e,i.radius)}}}isNodeVisible(e){const t=this.getServiceMbsInRenderSR(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getAndUpdateVisibilityObbInRenderSR(e);return i?i.doesIntersectFrustumConservativeApproximation(this._frustum):C(this._frustum,t)}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||(!e.valid||(1===this._viewingMode?this._isConeVisibleInFrustum(e):this._isCylinderVisibleInFrustum(e)))}_isConeVisibleInFrustum(n){if(!this._isConeVisibleInFrustumMbs(n))return!1;const r=n.radius;if(-1===r||r>.9)return!0;const o=this._frustumPlanes,a=this._frustumMbsCenter,c=n.getAxis(ee),h=i(c,a),l=this._frustumMbsRadius,d=h-l,m=h+l;if(d<=0)return!0;const _=u(k,c,d),p=u(H,c,m),f=r/Math.sqrt(1-r*r);for(const v of o){const n=I(v),r=e(W,n),o=i(r,c);if(Math.abs(1-o)<.01)continue;const a=K;u(a,c,o),t(a,a,r),e(a,a);const h=Q;s(h,_,a,d*f);if(P(v,h)<=0)continue;s(h,p,a,m*f);if(P(v,h)<=0)continue;return!1}return!0}_isConeVisibleInFrustumMbs(e){const t=e.radius;if(t>.9)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=a(n);if(r<=s)return!0;const o=e.getAxis(ee),c=i(o,n);{const e=u(T,o,c);if(h(e,n)<s)return!0}const l=c/r;if(c<=0){return-l<s}const d=Math.sqrt(1-l*l);if(d<t)return!0;const m=s/r;return d*Math.sqrt(1-m*m)-m*l<t}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling)return!0;if(!e.valid)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=this._frustumPlanes,o=Y;if(t.getCorners(o),1===this._viewingMode){const t=e.getAxis(ee),a=i(t,n),c=a-s,h=a+s;if(c<=0)return!0;for(const e of r){let s=!0;for(const n of o){const r=i(n,t),o=$;if(u(o,n,c/r),P(e,o)<=0){s=!1;break}const a=$;if(u(a,n,h/r),P(e,a)<=0){s=!1;break}}if(s)return!1}}else{const e=n[2]-s,t=n[2]+s;for(const i of r){let s=!0;const n=I(i),r=n[0],a=n[1],c=n[2],u=i[3];for(const i of o){const n=r*i[0]+a*i[1]+u;if(n+c*e<=0||n+c*t<=0){s=!1;break}}if(s)return!1}}return!0}_isCylinderVisibleInFrustum(e){const t=this._frustumMbsCenter,i=this._frustumMbsRadius,s=o(T,t);s[2]=0;const n=e.radius,r=e.getAxis(ee);return h(s,r)<=n+i}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.doesIntersectFrustumConservativeApproximation(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||0!==j(this._clippingArea,e)}_screenSpaceDiameterMbs(e,t){const i=this.getServiceMbsInRenderSR(e),s=Math.sqrt(l(i.center,this._camPos)),n=s-i.radius;return this._updateMinMaxDistance(s),n<0?.5*Number.MAX_VALUE:t/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getServiceMbsInRenderSR(e).radius}calcCameraDistanceToCenter(e){const t=this.getServiceMbsInRenderSR(e),i=d(t.center,this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const t=this.getServiceMbsInRenderSR(e),i=t.radius,s=(Math.abs(t.center[0]*(t.center[0]-this._camPos[0])+t.center[1]*(t.center[1]-this._camPos[1])+t.center[2]*(t.center[2]-this._camPos[2]))/m(t.center)+i)/d(t.center,this._camPos);return Math.min(1,s)}hasLOD(e){return 0!==e.lodMetric}_getDistanceGlobeMode(e,t){const s=m(t.center),n=m(e)-s;u(this._tmp0,e,i(e,t.center)/_(e));const o=l(t.center,this._tmp0),a=t.radius;if(o<=a*a)return Math.abs(n);{const o=u(this._tmp0,t.center,1/s),c=s,h=a*a/2/c,l=u(this._tmp1,o,c-h),_=e,f=r(this._tmp2,_,l),v=r(this._tmp2,f,u(this._tmp3,o,i(o,f))),g=p(this._tmp2,l,u(this._tmp2,v,a/m(v)));let b=d(_,g);if(n>=2e5){const e=r(this._tmp1,_,g);let t=i(e,o)/m(e);t<.08&&(t=1e-4),b/=t}return b}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):U(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(0===e.lodMetric)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 2:{const i=this.getServiceMbsInRenderSR(e),s=this._getDistance(this._camPos,i),n=2*s/this._screenSizeFactor,r=s+i.radius;return this._updateMinMaxDistance(r),e.maxError*t<=n}case 1:{let i=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case 4:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(null==e)return 0;const t=this.getServiceMbsInRenderSR(e),s=t.center,n=i(s,this._cameraPOIDirection),r=n*n,o=_(s)-r;return Math.sqrt(o)-t.radius}distCameraToPOI(){return d(this._camPos,this._poi)}}function U(e,t){const i=e[0]-t.center[0],s=e[1]-t.center[1],n=e[2]-t.center[2],r=i*i+s*s,o=t.radius;if(r<=o*o)return Math.abs(n);const a=Math.sqrt(r)-o;return Math.sqrt(n*n+a*a)}const z=x(),N=f(),T=f(),k=f(),H=f(),W=f(),Z=new L,X=f(),Y=[f(),f(),f(),f(),f(),f(),f(),f()],J=f(),K=f(),Q=f(),$=f(),ee=f();export{G as default};
|
|
5
|
+
import{n as e,a as t,g as i,c as s,F as n,e as r,d as o,H as a,v as c,j as u,G as h,s as l,C as d,b as m,E as _,i as p}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as g}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as R}from"../../../../geometry/projection/projectors.js";import{create as S,fromMatrix as M,createPoints as x,intersectsSphere as C}from"../../../../geometry/support/frustum.js";import{getNormal as I,signedDistance as P}from"../../../../geometry/support/plane.js";import{isPlateCarree as D}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as E}from"../../../../geometry/support/sphere.js";import{makeDehydratedPoint as O}from"../../../../layers/graphics/dehydratedPoint.js";import{evaluateElevationAlignmentAtPoint as F}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as A}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as B,extractExpressionInfo as V}from"../graphics/featureExpressionInfoUtils.js";import{isValidMbs as y,intersectBoundingRectWithMbs as j}from"./I3SUtil.js";import{Obb as L,computeOffsetObb as w}from"../../support/orientedBoundingBox.js";const q=1e5;class G{get _frustumMbsCenter(){return this._frustumMbs.center}get _frustumMbsRadius(){return this._frustumMbs.radius}get _frustumPlanes(){return this._frustum}constructor(e,t,i,s,n,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=n,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=S(),this._frustumMbs=new E,this._viewDirection=f(),this._useFrustumCulling=!1,this._poi=f(),this._cameraPOIDirection=f(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=new L,this._tmp1=f(),this._tmp2=f(),this._tmp3=f(),this._tmp0=f(),this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const u=this._renderCoordsHelper.spatialReference;this._renderSR=u,this._renderSRSphericalPCPF=g(u),this._isGlobalMode=u===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._tmpPoint=O(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(u.isWebMercator||D(u)),this._indexSREllipsoidRadius=v(this._indexSR).radius,this._indexSRSphericalPCPF=g(e),this._projectorIndexSRToIndexSRSphericalPCPF=R(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=A.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(B(V(e,!1)))):this._elevationContext=null}updateCamera(n,r){if(this._useFrustumCulling=r,e(this._viewDirection,n.viewForward),r){M(n.viewMatrix,n.projectionMatrix,this._frustum,z);{const e=n.eye,r=N;t(r,z[4],e);const o=.5*i(r,r)/i(this._viewDirection,r),a=this._frustumMbs,c=a.center;s(c,e,this._viewDirection,o);const u=1+o;a.radius=u}}this._screenSizeFactor=1/(n.perScreenPixelRatio/2),this._camPos=n.eye,this._updateCameraPOIDirection(),this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const n="relative-to-scene"===this._elevationContext.mode?"scene":"ground",r=this._elevationProvider;if(r.getSphereElevationBounds){const e=r.getSphereElevationBounds(s,this._indexSR,n);if(e)return void i.expandElevationRange(e)}const[o,a,c]=s.center,u=r.getElevation(o,a,c,this._indexSR,n);u&&i.expandElevationRangeValues(u,u);const h=t?null:r.getRootElevationBounds?.();h&&i.expandElevationRange(h)}getServiceMbsInRenderSR(e){const t=e.serviceMbsInRenderSR;if(y(t))return t;const{serviceMbsInIndexSR:i}=e;i&&t.copy(i);const s=e.elevationRangeMin;if(this._elevationContext&&Number.isFinite(s)){let i=0,n=0;const r=e.elevationRangeMax;switch(this._elevationContext.mode){case"relative-to-ground":case"relative-to-scene":i=this._elevationContext.geometryZWithOffset(t.center[2],this._renderCoordsHelper)+s-t.center[2],n=r-s;break;case"on-the-ground":i=s-t.center[2],n=r-s}t.center[2]+=i+.5*n,t.radius+=.5*n}else this._elevationContext&&t.radius<q&&(this._tmpPoint.x=t.center[0],this._tmpPoint.y=t.center[1],this._tmpPoint.z=t.center[2],t.center[2]=F(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper));return b(t,this._indexSR,t,this._renderSR),t}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new L,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const n=i.radius;let r=0,o=0;const a=s.centerZ,c=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){const t=e.elevationRangeMin,i=e.elevationRangeMax;switch(u.mode){case"relative-to-ground":case"relative-to-scene":r=u.geometryZWithOffset(a,c)+t-a,o=i-t;break;case"on-the-ground":r=t-a,o=i-t}}else if(u&&n<q){const e=this._tmpPoint;e.x=s.centerX,e.y=s.centerY,e.z=a,r=F(e,this._elevationProvider,u,c)-a}const h=o>0,l=h?this._tmpObb:t;return s.transform(l,this._indexSR,this._renderSR,r,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),h&&w(l,0,o,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;return t?(t.transform(Z,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),Z):null}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(1===this._viewingMode?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){n(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(r(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),n=t.elevationAgnosticBoundingVolume;let r,c=-1;if(s){const t=X;s.getCenter(t),e(t,t),r=t,s.getCorners(Y);for(const s of Y){e(s,s);const r=i(s,t);if(r<=0)return void n.invalidate();const o=Math.sqrt(1-r*r);c=Math.max(c,o)}}else{const i=t.serviceMbsInRenderSR;if(!y(i))return void n.invalidate();{const t=o(X,i.center),s=i.radius,u=a(t);if(u<s)return void n.invalidate();c=s/u,e(t,t),r=t}}const u=.001;n.set(r,c+u)}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(X);e[2]=0;let s=0;const n=J;i.getCorners(Y);for(const t of Y){t[2]=0;const e=c(n,t);s=Math.max(s,e)}t.set(e,Math.sqrt(s))}else{const i=e.serviceMbsInRenderSR;if(y(i)){const e=o(X,i.center);e[2]=0,t.set(e,i.radius)}}}isNodeVisible(e){const t=this.getServiceMbsInRenderSR(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getAndUpdateVisibilityObbInRenderSR(e);return i?i.doesIntersectFrustumConservativeApproximation(this._frustum):C(this._frustum,t)}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||(!e.valid||(1===this._viewingMode?this._isConeVisibleInFrustum(e):this._isCylinderVisibleInFrustum(e)))}_isConeVisibleInFrustum(n){if(!this._isConeVisibleInFrustumMbs(n))return!1;const r=n.radius;if(-1===r||r>.9)return!0;const o=this._frustumPlanes,a=this._frustumMbsCenter,c=n.getAxis(ee),h=i(c,a),l=this._frustumMbsRadius,d=h-l,m=h+l;if(d<=0)return!0;const _=u(k,c,d),p=u(H,c,m),f=r/Math.sqrt(1-r*r);for(const v of o){const n=I(v),r=e(W,n),o=i(r,c);if(Math.abs(1-o)<.01)continue;const a=K;u(a,c,o),t(a,a,r),e(a,a);const h=Q;s(h,_,a,d*f);if(P(v,h)<=0)continue;s(h,p,a,m*f);if(P(v,h)<=0)continue;return!1}return!0}_isConeVisibleInFrustumMbs(e){const t=e.radius;if(t>.9)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=a(n);if(r<=s)return!0;const o=e.getAxis(ee),c=i(o,n);{const e=u(T,o,c);if(h(e,n)<s)return!0}const l=c/r;if(c<=0){return-l<s}const d=Math.sqrt(1-l*l);if(d<t)return!0;const m=s/r;return d*Math.sqrt(1-m*m)-m*l<t}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling)return!0;if(!e.valid)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=this._frustumPlanes,o=Y;if(t.getCorners(o),1===this._viewingMode){const t=e.getAxis(ee),a=i(t,n),c=a-s,h=a+s;if(c<=0)return!0;for(const e of r){let s=!0;for(const n of o){const r=i(n,t),o=$;if(u(o,n,c/r),P(e,o)<=0){s=!1;break}const a=$;if(u(a,n,h/r),P(e,a)<=0){s=!1;break}}if(s)return!1}}else{const e=n[2]-s,t=n[2]+s;for(const i of r){let s=!0;const n=I(i),r=n[0],a=n[1],c=n[2],u=i[3];for(const i of o){const n=r*i[0]+a*i[1]+u;if(n+c*e<=0||n+c*t<=0){s=!1;break}}if(s)return!1}}return!0}_isCylinderVisibleInFrustum(e){const t=this._frustumMbsCenter,i=this._frustumMbsRadius,s=o(T,t);s[2]=0;const n=e.radius,r=e.getAxis(ee);return h(s,r)<=n+i}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.doesIntersectFrustumConservativeApproximation(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||0!==j(this._clippingArea,e)}_screenSpaceDiameterMbs(e,t){const i=this.getServiceMbsInRenderSR(e),s=Math.sqrt(l(i.center,this._camPos)),n=s-i.radius;return this._updateMinMaxDistance(s),n<0?.5*Number.MAX_VALUE:t/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getServiceMbsInRenderSR(e).radius}calcCameraDistanceToCenter(e){const t=this.getServiceMbsInRenderSR(e),i=d(t.center,this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const t=this.getServiceMbsInRenderSR(e),i=t.radius,s=(Math.abs(t.center[0]*(t.center[0]-this._camPos[0])+t.center[1]*(t.center[1]-this._camPos[1])+t.center[2]*(t.center[2]-this._camPos[2]))/m(t.center)+i)/d(t.center,this._camPos);return Math.min(1,s)}hasLOD(e){return 0!==e.lodMetric}_getDistanceGlobeMode(e,t){const s=m(t.center),n=m(e)-s;u(this._tmp0,e,i(e,t.center)/_(e));const o=l(t.center,this._tmp0),a=t.radius;if(o<=a*a)return Math.abs(n);{const o=u(this._tmp0,t.center,1/s),c=s,h=a*a/2/c,l=u(this._tmp1,o,c-h),_=e,f=r(this._tmp2,_,l),v=r(this._tmp2,f,u(this._tmp3,o,i(o,f))),g=p(this._tmp2,l,u(this._tmp2,v,a/m(v)));let b=d(_,g);if(n>=2e5){const e=r(this._tmp1,_,g);let t=i(e,o)/m(e);t<.08&&(t=1e-4),b/=t}return b}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):U(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(0===e.lodMetric)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 2:{const i=this.getServiceMbsInRenderSR(e),s=this._getDistance(this._camPos,i),n=2*s/this._screenSizeFactor,r=s+i.radius;return this._updateMinMaxDistance(r),e.maxError*t<=n}case 1:{let i=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case 4:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(null==e)return 0;const t=this.getServiceMbsInRenderSR(e),s=t.center,n=i(s,this._cameraPOIDirection),r=n*n,o=_(s)-r;return Math.sqrt(o)-t.radius}distCameraToPOI(){return d(this._camPos,this._poi)}}function U(e,t){const i=e[0]-t.center[0],s=e[1]-t.center[1],n=e[2]-t.center[2],r=i*i+s*s,o=t.radius;if(r<=o*o)return Math.abs(n);const a=Math.sqrt(r)-o;return Math.sqrt(n*n+a*a)}const z=x(),N=f(),T=f(),k=f(),H=f(),W=f(),Z=new L,X=f(),Y=[f(),f(),f(),f(),f(),f(),f(),f()],J=f(),K=f(),Q=f(),$=f(),ee=f();export{G as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import r from"../../../../core/Logger.js";import{property as n,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{fromQuat as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as a,p as l}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as p}from"../../../../geometry/projection/projectBoundingSphere.js";import{empty as m,expand as u}from"../../../../geometry/support/aaBoundingRect.js";import{Sphere as h}from"../../../../geometry/support/sphere.js";import{ElevationRange as v}from"../../support/ElevationRange.js";import{ElevationUpdateEventImplementation as f}from"../../terrain/ElevationUpdateEvent.js";import{Intersector as d}from"../../webgl-engine/lib/Intersector.js";let
|
|
5
|
+
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import r from"../../../../core/Logger.js";import{property as n,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{fromQuat as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as a,p as l}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as p}from"../../../../geometry/projection/projectBoundingSphere.js";import{empty as m,expand as u}from"../../../../geometry/support/aaBoundingRect.js";import{Sphere as h}from"../../../../geometry/support/sphere.js";import{ElevationRange as v}from"../../support/ElevationRange.js";import{ElevationUpdateEventImplementation as f}from"../../terrain/ElevationUpdateEvent.js";import{Intersector as d}from"../../webgl-engine/lib/Intersector.js";let g=class extends t{constructor(e){super(e),this._tmpEvent=new f,this._renderCoordsHelper=e.view.renderCoordsHelper,this._renderSR=this._renderCoordsHelper.spatialReference,this._layerElevationSource=e.layerElevationSource}initialize(){this._intersector=new d(this.view.state.viewingMode),this._intersector.options.store=0,this._intersector.options.normalRequired=!1,this._tmpEvent.context=this.intersectionHandler.isGround?"ground":"scene"}get spatialReference(){return this.view?.elevationProvider?.spatialReference}getElevation(e,t,n,i){const o=this._renderCoordsHelper,s=a(x,e,t,n);if(!o.toRenderCoords(s,i,s))return r.getLogger(this).error("could not project point to compute elevation"),null;const{layerElevationSource:l,_intersector:c,intersectionHandler:p}=this,m=l.fullExtent,u=null!=m&&Number.isFinite(m.xmin)&&Number.isFinite(m.xmax)&&Number.isFinite(m.ymin)&&Number.isFinite(m.ymax)&&Number.isFinite(m.zmin)&&Number.isFinite(m.zmax)?new v(m.zmin,m.zmax):l.elevationRange;if(null==u)return null;const h=l.elevationOffset,f=u.elevationRangeMin+h,d=u.elevationRangeMax+h,g=o.setAltitude(R,d,s),E=o.setAltitude(y,f,s);return c.reset(g,E,this.view.state.camera),p.intersect(c,null,g,E,null,!0),c.results.min.getIntersectionPoint(s)?o.getAltitude(s):null}getElevations(e,t,r){const{groundSpatialReference:n}=this.view;for(let i=0;i<t;++i){const t=3*i,o=e[t],s=e[t+1];r(i,this.getElevation(o,s,0,n))}}getSphereElevationBounds(e,t){return p(e,t,_,this._renderSR),this._layerElevationSource.getElevationRange(_)}getRootElevationBounds(){const e=this.layerElevationSource.fullExtent;return e?.hasZ?new v(e.zmin,e.zmax):null}notifyObjectsChanged(e){this.spatialReference&&(this._computeLayerExtent(t=>{for(const r of e)t(r)},this._tmpEvent.extent),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}notifyObjectsChangedFunctional(e){this.spatialReference&&(this._computeLayerExtent(e,this._tmpEvent.extent),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}notifyObjectChanged(e){this.spatialReference&&(this._computeObjectExtent(e,this._tmpEvent.extent),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}_computeObjectExtent(e,t){m(t),this._expandExtent(e,t)}_computeLayerExtent(e,t){m(t),e(e=>{this._expandExtent(e,t)})}_expandExtent(e,t){const r=this.spatialReference;if(null==r)return;if(null==e)return;o(E,e.quaternion),E[12]=e.center[0],E[13]=e.center[1],E[14]=e.center[2];const n=e.halfSize;for(let i=0;i<8;++i)x[0]=1&i?n[0]:-n[0],x[1]=2&i?n[1]:-n[1],x[2]=4&i?n[2]:-n[2],l(x,x,E),this._renderCoordsHelper.fromRenderCoords(x,x,r),u(t,x,t)}};e([n({constructOnly:!0})],g.prototype,"layerElevationSource",void 0),e([n({constructOnly:!0})],g.prototype,"intersectionHandler",void 0),e([n({constructOnly:!0})],g.prototype,"view",void 0),e([n()],g.prototype,"spatialReference",null),g=e([i("esri.views.3d.layers.i3s.LayerElevationProvider")],g);const E=s(),_=new h,x=c(),R=c(),y=c();export{g as LayerElevationProvider};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{equals as i}from"../../../core/arrayUtils.js";import{watch as s,when as o,on as r}from"../../../core/reactiveUtils.js";import{property as a,subclass as n}from"../../../core/accessorSupport/decorators.js";import{getLyr3DWasm as l}from"../layers/Lyr3DWasm.js";import m from"../../support/AttributionItem.js";const h=Symbol("attributions"),u=new m("Google Maps",1e3);let d=class extends e{constructor(t){super(t),this.attributionItems=[],this.view=null,this._allLayerViewsChange=()=>{this.removeHandles("items");const t=this.view?.allLayerViews;let e=!1;if(t)for(const i of t)"integrated-mesh-3dtiles"===i.type&&(e=!0,this.addHandles([s(()=>i.suspended,()=>this._updateAttributionItems()),i.on("visible-geometry-changed",()=>this._updateAttributionItems())],h));e&&this.addHandles(o(()=>!0===this.view?.stationary,()=>this._updateAttributionItems()),h),this._updateAttributionItems()}}initialize(){this.addHandles([r(()=>this.view?.allLayerViews,"change",this._allLayerViewsChange,{onListenerAdd:this._allLayerViewsChange,onListenerRemove:()=>{this.removeHandles(h),this.attributionItems=[]}})])}destroy(){this.view=null,this.attributionItems=[]}_updateAttributionItems(){const t=this.view,e=t?.allLayerViews;if(!t||!e)return void(this.attributionItems.length&&(this.attributionItems=[]));if(!t.stationary)return;const s=[];let o=u.score-1;for(const i of e)if(!i.suspended&&"integrated-mesh-3dtiles"===i.type){i.layer.hasGoogleUrl&&s.push(u);const e=l(t);if(e){const t=e.getAttributionText();for(const e of t)s.push(new m(e,o--))}break}i(this.attributionItems,s,(t,e)=>t.text===e.text)||(this.attributionItems=s)}};t([a()],d.prototype,"attributionItems",void 0),t([a()],d.prototype,"view",void 0),d=t([n("esri.views.3d.support.Attribution3D")],d);const p=d;export{p as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as
|
|
5
|
+
import{__decorate as e}from"tslib";import{BlendModeTechniqueConfiguration as o}from"./BlendModeTechniqueConfiguration.js";import{parameter as t}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";class p extends o{constructor(){super(...arguments),this.output=1,this.premultipliedAlphaSource=!1,this.applyBaseOpacity=!1}}e([t({count:5})],p.prototype,"output",void 0),e([t()],p.prototype,"premultipliedAlphaSource",void 0),e([t()],p.prototype,"applyBaseOpacity",void 0);export{p as TileBlendTechniqueConfiguration};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Logger.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{ZEROS as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{VectorTileRendererHelper3D as i}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechnique as s}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as o}from"./BlendLayersTechniqueConfiguration.js";import{RasterColorizerTechnique as n}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as a}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as h}from"./support/MultiSizeFramebuffer.js";import{BindParameters as
|
|
5
|
+
import e from"../../../core/Logger.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{ZEROS as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{VectorTileRendererHelper3D as i}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechnique as s}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as o}from"./BlendLayersTechniqueConfiguration.js";import{RasterColorizerTechnique as n}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as a}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as h}from"./support/MultiSizeFramebuffer.js";import{BindParameters as l}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as c}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as u}from"../../webgl/enums.js";import{Texture as d}from"../../webgl/Texture.js";const _=()=>e.getLogger("esri.views.3d.terrain");class f{constructor(e,t){this._rctx=e,this._techniques=t,this._fbos=[],this._vectorTileHelper=new i,this._bindParameters=new l(null),this._blendConfiguration=new o,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vao=c(this._rctx,1)}dispose(){this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vao=t(this._vao),this._vectorTileHelper=t(this._vectorTileHelper)}updateHeading(e){this._vectorTileHelper?.updateHeading(e)}_acquireBlendTechnique(e,t,r,i=!1,o=0){return this._blendConfiguration.output=t,this._blendConfiguration.blendMode=e,this._blendConfiguration.applyBaseOpacity=r,this._blendConfiguration.premultipliedAlphaSource=i,this._blendConfiguration.background=o,this._techniques.precompile(s,this._blendConfiguration),this._techniques.get(s,this._blendConfiguration)}drawBackground(e,t){const r=this._acquireBlendTechnique(0,t?2:3,!1,!1,1),i=this._rctx.bindTechnique(r,this._bindParameters,e);this._render(i)}_render(e){this._rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),this._rctx.drawArrays(u.TRIANGLE_STRIP,0,this._vao.vertexCount("geometry"))}drawGroup(e,t,r,i,s=!0){1===t&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(r).colorTexture,null==e.fboTexture&&(e.fboTexture=this._rctx.emptyTexture)),e.texture=this.currentFBO(r).colorTexture,this.closeGroup(r);const o=e.baseOpacity<1,n=this._acquireBlendTechnique(i,t,o,s),a=this._rctx.bindTechnique(n,this._bindParameters,e);this._render(a)}drawImageData(e,t,r,i,s=!1){if(null==e.texture)return;const o=e.baseOpacity<1;e.fboTexture=4===t||0===i&&!o&&!s?null:this.switch(r).colorTexture,null==e.fboTexture&&(e.fboTexture=this._rctx.emptyTexture);const n=this._acquireBlendTechnique(i,t,o,s),a=this._rctx.bindTechnique(n,this._bindParameters,e);this._render(a)}drawRasterData(e,t,r,i,s){const o=s.sourceLayerInfo.data;if(!o.source)return;if(s.tile.surface.layerViewByIndex(s.layerIndex,1).ensureSymbolizerParameters(o),!o.bind(this._rctx))return;const n=e.baseOpacity<1;e.fboTexture=0!==i||n?this.switch(r).colorTexture:null;const a=this._acquireRasterTechnique(o,t,i,n);if(!a)return;o.opacity=e.opacity;const h=o.getUniforms(this._rctx);h.scale=s.scale,h.offset=s.offset,h.backgroundColor=e.backgroundColor,h.fboTexture=e.fboTexture,h.baseOpacity=e.baseOpacity;const l=this._rctx.bindTechnique(a,this._bindParameters,h);this._render(l)}_acquireRasterTechnique(e,t,r,i){if(!this._rctx.capabilities.colorBufferFloat)return null;const s=e.symbolizerParameters,o=["stretch","lut","hillshade"].indexOf(s.type);return this._rasterConfiguration??=new a,this._rasterConfiguration.output=t,this._rasterConfiguration.blendMode=r,this._rasterConfiguration.applyBaseOpacity=i,this._rasterConfiguration.colorizerType=o,this._rasterConfiguration.applyColormap=!!s.colormap,this._rasterConfiguration.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterConfiguration.stretchType=e.hasStretchTypeNone()?0:1,this._techniques.precompile(n,this._rasterConfiguration),this._techniques.get(n,this._rasterConfiguration)}drawVectorData(e,t,i,s,o,n,a,l){const c=this._rctx,u=o.sourceLayerInfo.data,d=o.tile.surface.layerViewByIndex(o.layerIndex,1),f=e.baseOpacity<1,p=f||e.opacity<1||0!==s||1!==t,b=p,g=this._acquireBlendTechnique(s,t,f,b);c.setPipelineState(g.getPipeline());let m=null,x=null;p?(x=this.currentFBO(i),null==this._vtFBO&&(this._vtFBO=new h(this._rctx)),m=this._vtFBO.get(i),c.bindFramebuffer(m),this._clearCurrentFBO()):l&&c.clear(256);try{this._vectorTileHelper.renderBackground(c,o.sourceLod,d.painter,d.layer.styleRepository,d.schemaHelper,Math.round(1/o.scale),o.offset,a,n,d.contentZoom),u&&this._vectorTileHelper.renderContent(c,o.sourceLod,u,o.vtlNeighborInfos,d.painter,d.layer.styleRepository,d.schemaHelper,Math.round(1/o.scale),o.offset,a,n,d.contentZoom)}catch(T){_().warnOnce("A render call containing vector tiles did not resolve correctly.",T)}return!m||(c.bindFramebuffer(x),e.texture=m.colorTexture,e.offset=r,e.scale=1,this.drawImageData(e,t,i,s,b),l)}copyFBOToTexture(e){const t=this._rctx,r=t.bindTexture(e.texture,d.TEXTURE_UNIT_FOR_UPDATES),i=e.descriptor;t.gl.copyTexImage2D(3553,0,i.pixelFormat,0,0,i.width,i.height,0),e.generateMipmap(),t.bindTexture(r,d.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setStencilWriteMask(255),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.setClearStencil(0),this._rctx.clear(17664)}_initFBO(e,t,r){this._rctx.bindFramebuffer(e),r&&(this._rctx.setViewport(0,0,t,t),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,t=0,r=!0){if(this._current=t,t>=this._fbos.length)for(let i=this._fbos.length;i<=t;i++)this._fbos.push(new h(this._rctx));this._initFBO(this._fbos[t].get(e),e,r)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){const t=this.currentFBO(e),r=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(r),t}getLastOnHoldId(){return this._onHoldIds[this._onHoldIds.length-1]}closeGroup(e){const t=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(t),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}}export{f as TileCompositor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../core/has.js";import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{set as r,copy as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as o}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as a,isGroupLayer as n,isReferenceLayer as c}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as u}from"../support/flowUtils.js";import{BlendLayersPassParameters as l}from"./BlendLayersTechnique.js";import{isImageWithType as p}from"./TerrainData.js";import{isBlendableLayerView as h,isVectorTileLayerView as d,isVectorTileRenderInfo as m,isImageryTileRenderInfo as f,isImageSourceRenderInfo as _,isTextureTileRenderInfo as x,isVectorTilePerLayerInfo as T}from"./terrainUtils.js";import{TextureReference as b}from"./TextureReference.js";import{TileCompositor as y}from"./TileCompositor.js";import{TileRenderInfo as g}from"./TileRenderInfo.js";import{TileTexture as w,getCacheKey as k}from"./TileTexture.js";import{fallsWithinLayerView as I}from"./tileUtils.js";import{blendModeFromString as j}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{createEmptyTexture as O}from"../webgl-engine/lib/glUtil3D.js";import{isCompressible as P}from"../../support/TextureCompressionWorkerHandle.js";import{Texture as L}from"../../webgl/Texture.js";import{TextureDescriptor as B}from"../../webgl/TextureDescriptor.js";class C{constructor(e,t,r,s,o,i){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=o,this.baseOpacity=i}}class M{constructor(e,t,r,s,o){this._rctx=e,this.tileSize=t,this._techniques=r,this._cache=s,this._compressionTracker=o,this._passParameters=new l,this._backgroundColor=null,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._compositor=new y(this._rctx,this._techniques)}dispose(){this._compositor=e(this._compositor),this._backgroundTexture=t(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,i=0,l=this.tileSize,p=!1,m=!1;const f=r.view.state.contentPixelRatio;let _=!1;A.clear(),S.length=0;const x=e.layerInfo[1];let T=0,b=null;for(;T<x.length;T++){const t=r.layerViewByIndex(T,1),y=t.layer,g=!I(e,t),w=y.opacity,k=t.fullOpacity;if(m=m||a(y),u(t))continue;if(h(t)){let e="normal"!==t.layer.blendMode;if(n(y.parent)){const t=y.parent.uid;null!=t&&""!==t&&(e=U(y.parent)||e)}e&&(_=e,p=!1)}if((g||0===w)&&!_){x[T].pendingUpdates&=-1;continue}++i;const j=d(t),O=D(e,T,j);if(O){if(x[T].pendingUpdates&=-1,n(y.parent)){const e=y.parent.uid;null!=e&&""!==e&&v(y.parent,T)}j?l=Math.max(l,this.tileSize*f):1===s&&1===k&&(t.isOpaque||this._dataToTexture(O,c(y))&&O.sourceLayerInfo.data.descriptor.isOpaque)&&(p=!0),++o,null===b&&(b=T)}}const y=l/this.tileSize;0!==o&&null!==b?1===o&&!_&&this._useLayerTexture(e,b)||this._composeLayers(e,t,T-1,m,l,y,!p||_,A,_):this._useBackgroundTexture(e,i,0!==t)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundTexture&&this._drawBackgroundTexture(this._backgroundTexture))}_ensureBackgroundTexture(){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(this.tileSize,!1),this._drawBackgroundTexture(this._backgroundTexture)),this._backgroundTexture}_drawBackgroundTexture(e){this._compositor.bind(this.tileSize),this._passParameters.offset=o,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(e),this._compositor.unbind()}_useBackgroundTexture(e,t,r){const s=e.renderData,o=!r&&null!=s.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?5e3:0,i=this._ensureBackgroundTexture();s.setTextureReference(new b(i,0,E,e.surface.baseOpacity,0,1),o)}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,1),s=a(r.layer),o=s?e.surface.baseOpacity:1,n=s?1:e.surface.baseOpacity,u=r.fullOpacity,l=D(e,t,!1);return!!this._dataToTexture(l,c(r.layer))&&(e.renderData.setTextureReference(new b(l.sourceLayerInfo.data,0,i(l.offset[0],l.offset[1],l.scale,l.scale),o,n,u)),!0)}_composeLayers(e,t,r,s,i,n,l,p,_){this._compositor.ensureBuffer(i);const x=e.surface.baseOpacity;let T=!1,y=9987,g=!1,w=0;for(let b=r;b>=0;b--){const t=e.surface.layerViewByIndex(b,1),r=t.layer,k=d(t),O=D(e,b,k),P=r.opacity,L=!I(e,t);if(!O||(0===P||L)&&!_)continue;if(u(t))continue;const B=!a(r)&&!T;B
|
|
5
|
+
import"../../../core/has.js";import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{set as r,copy as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as o}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as a,isGroupLayer as n,isReferenceLayer as c}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as u}from"../support/flowUtils.js";import{BlendLayersPassParameters as l}from"./BlendLayersTechnique.js";import{isImageWithType as p}from"./TerrainData.js";import{isBlendableLayerView as h,isVectorTileLayerView as d,isVectorTileRenderInfo as m,isImageryTileRenderInfo as f,isImageSourceRenderInfo as _,isTextureTileRenderInfo as x,isVectorTilePerLayerInfo as T}from"./terrainUtils.js";import{TextureReference as b}from"./TextureReference.js";import{TileCompositor as y}from"./TileCompositor.js";import{TileRenderInfo as g}from"./TileRenderInfo.js";import{TileTexture as w,getCacheKey as k}from"./TileTexture.js";import{fallsWithinLayerView as I}from"./tileUtils.js";import{blendModeFromString as j}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{createEmptyTexture as O}from"../webgl-engine/lib/glUtil3D.js";import{isCompressible as P}from"../../support/TextureCompressionWorkerHandle.js";import{Texture as L}from"../../webgl/Texture.js";import{TextureDescriptor as B}from"../../webgl/TextureDescriptor.js";class C{constructor(e,t,r,s,o,i){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=o,this.baseOpacity=i}}class M{constructor(e,t,r,s,o){this._rctx=e,this.tileSize=t,this._techniques=r,this._cache=s,this._compressionTracker=o,this._passParameters=new l,this._backgroundColor=null,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._compositor=new y(this._rctx,this._techniques)}dispose(){this._compositor=e(this._compositor),this._backgroundTexture=t(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,i=0,l=this.tileSize,p=!1,m=!1;const f=r.view.state.contentPixelRatio;let _=!1;A.clear(),S.length=0;const x=e.layerInfo[1];let T=0,b=null;for(;T<x.length;T++){const t=r.layerViewByIndex(T,1),y=t.layer,g=!I(e,t),w=y.opacity,k=t.fullOpacity;if(m=m||a(y),u(t))continue;if(h(t)){let e="normal"!==t.layer.blendMode;if(n(y.parent)){const t=y.parent.uid;null!=t&&""!==t&&(e=U(y.parent)||e)}e&&(_=e,p=!1)}if((g||0===w)&&!_){x[T].pendingUpdates&=-1;continue}++i;const j=d(t),O=D(e,T,j);if(O){if(x[T].pendingUpdates&=-1,n(y.parent)){const e=y.parent.uid;null!=e&&""!==e&&v(y.parent,T)}j?l=Math.max(l,this.tileSize*f):1===s&&1===k&&(t.isOpaque||this._dataToTexture(O,c(y))&&O.sourceLayerInfo.data.descriptor.isOpaque)&&(p=!0),++o,null===b&&(b=T)}}const y=l/this.tileSize;0!==o&&null!==b?1===o&&!_&&this._useLayerTexture(e,b)||this._composeLayers(e,t,T-1,m,l,y,!p||_,A,_):this._useBackgroundTexture(e,i,0!==t)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundTexture&&this._drawBackgroundTexture(this._backgroundTexture))}_ensureBackgroundTexture(){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(this.tileSize,!1),this._drawBackgroundTexture(this._backgroundTexture)),this._backgroundTexture}_drawBackgroundTexture(e){this._compositor.bind(this.tileSize),this._passParameters.offset=o,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(e),this._compositor.unbind()}_useBackgroundTexture(e,t,r){const s=e.renderData,o=!r&&null!=s.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?5e3:0,i=this._ensureBackgroundTexture();s.setTextureReference(new b(i,0,E,e.surface.baseOpacity,0,1),o)}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,1),s=a(r.layer),o=s?e.surface.baseOpacity:1,n=s?1:e.surface.baseOpacity,u=r.fullOpacity,l=D(e,t,!1);return!!this._dataToTexture(l,c(r.layer))&&(e.renderData.setTextureReference(new b(l.sourceLayerInfo.data,0,i(l.offset[0],l.offset[1],l.scale,l.scale),o,n,u)),!0)}_composeLayers(e,t,r,s,i,n,l,p,_){this._compositor.ensureBuffer(i);const x=e.surface.baseOpacity;let T=!1,y=9987,g=!1,w=0;for(let b=r;b>=0;b--){const t=e.surface.layerViewByIndex(b,1),r=t.layer,k=d(t),O=D(e,b,k),P=r.opacity,L=!I(e,t);if(!O||(0===P||L)&&!_)continue;if(u(t))continue;const B=!a(r)&&!T;T||=B;let C=!1;p.forEach(e=>{e.start===b&&(e.output=s?1:l&&B?this.backgroundIsGrid?3:2:1,e.baseOpacity=B?x:1,S.push(e),this._compositor.openGroup(i),C=!0)});const M=C?4:l&&0===w?this.backgroundIsGrid?3:2:1,U=j[h(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=B&&!C&&x<1?x:1,this._passParameters.opacity=P,m(O)?g=this._compositor.drawVectorData(this._passParameters,M,i,U,O,n,this.tileSize,g):f(O)?(this._compositor.drawRasterData(this._passParameters,M,i,U,O),R(O)&&(y=9728)):this._dataToTexture(O,c(r))&&(this._passParameters.texture=O.sourceLayerInfo.data.texture,this._passParameters.offset=O.offset,this._passParameters.scale=O.scale,this._compositor.drawImageData(this._passParameters,M,i,U));S.length>0&&S[S.length-1].end===b;){const e=S.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=o,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,i,j[e.blendMode])}w++}const k=e.renderData,O=_||T&&x<1,P=k.ensureTexture(i,O,t,()=>this._buildTexture(i,O,y));this._compositor.copyFBOToTexture(P),this._compositor.unbind(),k.setTextureReference(new b(P,t,E,T?1:x,0,1))}_dataToTexture(e,t){if(_(e)){const r=e.sourceLayerInfo,s=1===e.scale&&!t;r.data=this._buildTexture(r.data,!0,s,e.tile.onCompressionFinished),e.tile.setMemoryDirty()}return x(e)}_buildTexture(e,t,r=9987,s=()=>{}){if(null==e)return null;const o=new B;o.wrapMode=33071,o.samplingMode="boolean"==typeof r?9987:r,o.maxAnisotropy=this._maxAnisotropy,o.preMultiplyAlpha=!0,o.flipped=!0,o.hasMipmap=!0,t||(o.pixelFormat=6407);const i=this._rctx,a="boolean"==typeof r&&r;let n;if("number"==typeof e)o.width=o.height=e,n=this._buildTileTexture(o);else if(p(e))o.isOpaque=e.isOpaque,o.isOpaque&&(o.pixelFormat=6407),o.width=e.element.width,o.height=e.element.height,n=this._buildTileTexture(o,a,s,e.element);else try{o.width=e.width,o.height=e.height,n=this._buildTileTexture(o,a,s,e)}catch(u){n=new w(O(i)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const c=i.bindTexture(n.texture,L.TEXTURE_UNIT_FOR_UPDATES);return n.generateMipmap(),i.bindTexture(c,L.TEXTURE_UNIT_FOR_UPDATES),n}_buildTileTexture(e,t=!1,r=()=>{},s){const o=this._cache.pop(k(e,!1))??this._cache.pop(k(e,!0));if(t&&=P(s,e),o)return o.retain(),t?o.texture.enableCompression({compressionTracker:this._compressionTracker,compressionCallback:r}):o.texture.disableCompression(),o.texture.setData(s),o;e.compress=t?{compressionTracker:this._compressionTracker,compressionCallback:r}:void 0;const i=new L(this._rctx,e,s);return new w(i,this._cache)}get test(){}}function D(e,t,o){q.layerIndex=t,q.vtlNeighborInfos.clear();const i=e.layerInfo[1][t];if(r(q.offset,0,0),q.tile=e,q.scale=1,q.sourceLod=e.lij,q.sourceLayerInfo=i,q.isVTLBackground=o,i.data)return o&&e.forEachLoadedNeighbor((r,s)=>{if(r.level!==e.level)return;const o=r.layerInfo[1][t];if(!T(o)||i.data===o.data)return;const a=q.vtlNeighborInfos.pushNew();a.offset=z[s],a.sourceLod=r.lij,a.sourceLayerInfo=o}),q;const a=i.upsampleInfo,n=a?.tile?.layerInfo[1][t];return n&&a.tile?(q.tile=a.tile,s(q.offset,a.offset),q.scale=a.scale,q.sourceLod=a.tile.lij,q.sourceLayerInfo=n,q):o?q:null}function R(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function U(e){let t="normal"!==e.blendMode;return n(e.parent)&&(t=U(e.parent)||t),t}function v(e,t){n(e.parent)&&v(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=A.get(r);s?s.start=t:A.set(r,new C(t,t,e.blendMode,e.opacity,1,1))}}const A=new Map,S=new Array,q=new g,E=i(0,0,1,1),z=new Array;function F(){q.sourceLayerInfo=null,q.tile=null,q.vtlNeighborInfos.prune()}z[0]=[0,-1],z[1]=[-1,-1],z[2]=[-1,0],z[3]=[-1,1],z[4]=[0,1],z[5]=[1,1],z[6]=[1,0],z[7]=[1,-1];export{C as GroupInfo,M as TileRenderer,F as cleanupTileRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{invert as t,transpose as r}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as s}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{I as o,m as i}from"../../../../../../chunks/vec32.js";import{freeze as a,ZEROS as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as l}from"../../../../../../chunks/vec42.js";import{freeze as h,fromValues as u}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ComponentTechnique as p}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as c}from"./ComponentTechniqueConfiguration.js";import{parameter as d,parameterBlock as m,MaterialBase as v,MaterialParameterBlock as g}from"../../../core/material/MaterialBase.js";import{isColor as f}from"../../../core/shaderLibrary/ShaderOutput.js";import{TextureBackedBufferParameters as x}from"../../../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{TwoVectorPosition as y}from"../../../core/util/TwoVectorPosition.js";import{advancedMRRFactors as M}from"../../../materials/pbrUtils.js";import{defaultHighlightName as b}from"../../../../../support/HighlightDefaults.js";import{alphaCutoff as T}from"../../../../../../webscene/support/AlphaCutoff.js";class S extends v{constructor(e,o,i,n){super(),this.toMapSpace=o,this.useENUForGlobalOverlayUV=i,this.baseColor=h(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.sphereDepthInterpolate=!1,this.mrrFactors=M,this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.normalTexture=null,this.occlusionTexture=null,this.emissionTexture=null,this.emissiveBaseColor=a(0,0,0),this.emissiveStrength=0,this.commonMaterialParameters=new C,this.componentParameters=new O,this.textureBackedBufferParameters=new x,this.objectOpacity=1,this.textureAlphaCutoff=T,this.alphaDiscardMode=1,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=1,this.hasOccludees=!1;const l=s(e.rotationScale);t(l,l),r(l,l),this.transformNormalGlobalFromModel=l;const u=new y(e.position);this.transformWorldFromModelTL=u.low,this.transformWorldFromModelTH=u.high,this.transformWorldFromModelRS=e.rotationScale,this._configuration=new c(n),this._updateMaterialConfiguration()}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get _hasEmissiveBase(){return null!=this.emissionTexture||!i(this.emissiveBaseColor,n)}get _hasEmissiveStrength(){return 2!==this.componentParameters.emissiveOverride}get hasEmissions(){return this._hasEmissiveStrength&&(this._hasEmissiveBase||2!==this.componentParameters.emissiveSourceOverride)}get texture(){return this.baseColorTexture?.texture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.texture}get textureEmissive(){return this.emissionTexture?.texture}get textureOcclusion(){return this.occlusionTexture?.texture}get textureNormal(){return this.normalTexture?.texture}update(e){e(this)}acquireTechnique(e,t,r,s){const o=this._updateConfiguration(t,r,s);return e.get(p,o)}_updateConfiguration(e,t,r){return this._updateMaterialConfiguration(),this._updateDrawConfiguration(e,t,r)}_updateMaterialConfiguration(){if(!this.dirty)return;const e=this._configuration;e.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,e.hasOcclusionTexture=null!=this.occlusionTexture,e.hasNormalTexture=null!=this.normalTexture,e.sphereDepthInterpolate=this.sphereDepthInterpolate&&e.spherical,e.ellipsoidMode=this.ellipsoidMode,e.componentData=this.componentParameters.type,e.textureBackedBufferLayout=this.textureBackedBufferParameters.textureBackedBuffer?.layout.hash??0,e.cullFace=this.commonMaterialParameters.cullFace,e.doubleSidedMode=this.commonMaterialParameters.doubleSided?1:0,e.hasColorTexture=null!=this.baseColorTexture;const t=this._computeWhichMaterialPass();e.blendingEnabled=1===t||2===t,e.alphaDiscardMode=this.alphaDiscardMode,e.hasPolygonOffset=this.polygonOffsetEnabled,this._setClean()}_updateDrawConfiguration(e,t,r){const s=this._configuration,o=e.identifier,i=0===o;s.hasEmission=t.hasEmission&&i,s.renderOccluded=9===t.slot,s.hasVertexColors=r.hasVertexColors,s.hasNormals=r.hasNormals,s.textureCoordinateType=r.textureCoordinateType,s.oitPass=i?t.oitPass:0,s.terrainDepthTest=i&&t.terrainDepthTest,s.cullAboveTerrain=!!i&&t.cullAboveTerrain,s.integratedMeshMode=this.isIntegratedMesh?B(t)?D(t)?3:2:1:0,s.pbrMode=3===s.integratedMeshMode?4:this.usePBR?this.hasParametersFromSource?r.shadeNormals&&this.isIntegratedMesh?0:2:1:0;const a=1===this.componentParameters.emissiveSourceOverride,n=2===this.componentParameters.emissiveSourceOverride,l=null!=this.emissionTexture;s.emissionSource=this.hasEmissions?this._hasEmissiveBase&&1===s.pbrMode?n?l?4:2:a?l?5:7:6:a?7:6:0,s.shadeNormals=r.shadeNormals,s.normalType=s.hasNormals?1:2,s.hasSlicePlane=null!=t.slicePlane&&this.commonMaterialParameters.hasSlicePlane,s.hasHighlightMixTexture=2===o&&null!=t.highlightMixTexture,s.output=
|
|
5
|
+
import{__decorate as e}from"tslib";import{invert as t,transpose as r}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as s}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{I as o,m as i}from"../../../../../../chunks/vec32.js";import{freeze as a,ZEROS as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as l}from"../../../../../../chunks/vec42.js";import{freeze as h,fromValues as u}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ComponentTechnique as p}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as c}from"./ComponentTechniqueConfiguration.js";import{parameter as d,parameterBlock as m,MaterialBase as v,MaterialParameterBlock as g}from"../../../core/material/MaterialBase.js";import{isColor as f}from"../../../core/shaderLibrary/ShaderOutput.js";import{TextureBackedBufferParameters as x}from"../../../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{TwoVectorPosition as y}from"../../../core/util/TwoVectorPosition.js";import{advancedMRRFactors as M}from"../../../materials/pbrUtils.js";import{defaultHighlightName as b}from"../../../../../support/HighlightDefaults.js";import{alphaCutoff as T}from"../../../../../../webscene/support/AlphaCutoff.js";class S extends v{constructor(e,o,i,n){super(),this.toMapSpace=o,this.useENUForGlobalOverlayUV=i,this.baseColor=h(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.sphereDepthInterpolate=!1,this.mrrFactors=M,this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.normalTexture=null,this.occlusionTexture=null,this.emissionTexture=null,this.emissiveBaseColor=a(0,0,0),this.emissiveStrength=0,this.commonMaterialParameters=new C,this.componentParameters=new O,this.textureBackedBufferParameters=new x,this.objectOpacity=1,this.textureAlphaCutoff=T,this.alphaDiscardMode=1,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=1,this.hasOccludees=!1;const l=s(e.rotationScale);t(l,l),r(l,l),this.transformNormalGlobalFromModel=l;const u=new y(e.position);this.transformWorldFromModelTL=u.low,this.transformWorldFromModelTH=u.high,this.transformWorldFromModelRS=e.rotationScale,this._configuration=new c(n),this._updateMaterialConfiguration()}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get _hasEmissiveBase(){return null!=this.emissionTexture||!i(this.emissiveBaseColor,n)}get _hasEmissiveStrength(){return 2!==this.componentParameters.emissiveOverride}get hasEmissions(){return this._hasEmissiveStrength&&(this._hasEmissiveBase||2!==this.componentParameters.emissiveSourceOverride)}get texture(){return this.baseColorTexture?.texture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.texture}get textureEmissive(){return this.emissionTexture?.texture}get textureOcclusion(){return this.occlusionTexture?.texture}get textureNormal(){return this.normalTexture?.texture}update(e){e(this)}acquireTechnique(e,t,r,s){const o=this._updateConfiguration(t,r,s);return e.get(p,o)}_updateConfiguration(e,t,r){return this._updateMaterialConfiguration(),this._updateDrawConfiguration(e,t,r)}_updateMaterialConfiguration(){if(!this.dirty)return;const e=this._configuration;e.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,e.hasOcclusionTexture=null!=this.occlusionTexture,e.hasNormalTexture=null!=this.normalTexture,e.sphereDepthInterpolate=this.sphereDepthInterpolate&&e.spherical,e.ellipsoidMode=this.ellipsoidMode,e.componentData=this.componentParameters.type,e.textureBackedBufferLayout=this.textureBackedBufferParameters.textureBackedBuffer?.layout.hash??0,e.cullFace=this.commonMaterialParameters.cullFace,e.doubleSidedMode=this.commonMaterialParameters.doubleSided?1:0,e.hasColorTexture=null!=this.baseColorTexture;const t=this._computeWhichMaterialPass();e.blendingEnabled=1===t||2===t,e.alphaDiscardMode=this.alphaDiscardMode,e.hasPolygonOffset=this.polygonOffsetEnabled,this._setClean()}_updateDrawConfiguration(e,t,r){const s=this._configuration,o=e.identifier,i=0===o;s.hasEmission=t.hasEmission&&i,s.renderOccluded=9===t.slot,s.hasVertexColors=r.hasVertexColors,s.hasNormals=r.hasNormals,s.textureCoordinateType=r.textureCoordinateType,s.oitPass=i?t.oitPass:0,s.terrainDepthTest=i&&t.terrainDepthTest,s.cullAboveTerrain=!!i&&t.cullAboveTerrain,s.integratedMeshMode=this.isIntegratedMesh?B(t)?D(t)?3:2:1:0,s.pbrMode=3===s.integratedMeshMode?4:this.usePBR?this.hasParametersFromSource?r.shadeNormals&&this.isIntegratedMesh?0:2:1:0;const a=1===this.componentParameters.emissiveSourceOverride,n=2===this.componentParameters.emissiveSourceOverride,l=null!=this.emissionTexture;s.emissionSource=this.hasEmissions?this._hasEmissiveBase&&1===s.pbrMode?n?l?4:2:a?l?5:7:6:a?7:6:0,s.shadeNormals=r.shadeNormals,s.normalType=s.hasNormals?1:2,s.hasSlicePlane=null!=t.slicePlane&&this.commonMaterialParameters.hasSlicePlane,s.hasHighlightMixTexture=2===o&&null!=t.highlightMixTexture,s.output=e.output,s.snowCover=i&&t.snowCover>0;const h=this._computeWhichMaterialPass();s.vertexDiscardMode=i&&2===h?e.transparent?2:1:0,s.olidColor=i&&9===e.output;const u=i&&f(e.output);return s.receiveAmbientOcclusion=u&&r.applySSAO&&null!=t.ssao?.getTexture(),s.hasOccludees=u&&t.hasOccludees,s.receiveShadows=u&&t.shadowMap.ready,s.screenSpaceReflections=u&&null!=t.ssr.lastFrameColor,s.cloudReflections=u&&null!=t.clouds.data?.cubeMap?.colorTexture,s}submit(e,t,r){if(this.objectOpacity<=0)return;const{componentData:s,renderable:o}=r,{geometry:i}=o,a=o.meta.cameraDepthSquared;s.updateHighlights(t.highlights);const{geometryRanges:n,highlightRangesMap:l,shadowmapRanges:h}=s,u=e=>e.submitDraw(this,i,n,a);switch(this._computeWhichMaterialPass()){case 0:u(e.opaque);break;case 1:u(e.transparent);break;case 2:u(e.opaque),u(e.transparent);break;case 3:u(e.integratedMesh),j(t)&&u(e.occludedGround),w(t)&&u(e.highlightIntegratedMesh);break;case 4:u(e.transparentIntegratedMesh)}if(2!==this.componentParameters.castShadows){if(null!=l)for(const t of l)t[0]===b&&e.highlightShadowMap.submitDraw(this,i,t[1],a,t[0]);null!=h&&e.defaultShadowMap.submitDraw(this,i,h,a),u(e.shadowMap)}if(null!=l)for(const p of l)e.highlight.submitDraw(this,i,p[1],a,p[0]);t.viewshedEnabled&&u(e.viewshedShadowMap)}_computeWhichMaterialPass(){if(this.isIntegratedMesh&&this.objectOpacity>=1)return 3;if(this.isIntegratedMesh&&this.objectOpacity<1)return 4;if(this.objectOpacity<1)return 1;if(0===this.componentParameters.opaqueOverride)return 0;if(this.baseColor[3]<1||0===this.alphaDiscardMode||3===this.alphaDiscardMode)return 1;switch(this.componentParameters.transparent){case 2:return 0;case 0:return 1;case 1:return 2}}}e([d({vectorOps:l})],S.prototype,"baseColor",void 0),e([d()],S.prototype,"usePBR",void 0),e([d()],S.prototype,"hasParametersFromSource",void 0),e([d()],S.prototype,"sphereDepthInterpolate",void 0),e([d({vectorOps:o})],S.prototype,"mrrFactors",void 0),e([d({dispose:!0})],S.prototype,"baseColorTexture",void 0),e([d({dispose:!0})],S.prototype,"metallicRoughnessTexture",void 0),e([d({dispose:!0})],S.prototype,"normalTexture",void 0),e([d({dispose:!0})],S.prototype,"occlusionTexture",void 0),e([d({dispose:!0})],S.prototype,"emissionTexture",void 0),e([d({vectorOps:o})],S.prototype,"emissiveBaseColor",void 0),e([d()],S.prototype,"emissiveStrength",void 0),e([m()],S.prototype,"commonMaterialParameters",void 0),e([m()],S.prototype,"componentParameters",void 0),e([m()],S.prototype,"textureBackedBufferParameters",void 0),e([d()],S.prototype,"objectOpacity",void 0),e([d()],S.prototype,"textureAlphaCutoff",void 0),e([d()],S.prototype,"alphaDiscardMode",void 0),e([d()],S.prototype,"isIntegratedMesh",void 0),e([d()],S.prototype,"polygonOffsetEnabled",void 0),e([d()],S.prototype,"ellipsoidMode",void 0),e([d()],S.prototype,"hasOccludees",void 0);class C extends g{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=2,this.hasSlicePlane=!0}}e([d()],C.prototype,"doubleSided",void 0),e([d()],C.prototype,"cullFace",void 0),e([d()],C.prototype,"hasSlicePlane",void 0);class O extends g{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=1,this.emissiveStrength=0,this.emissiveSource=0,this.castShadows=0}get transparent(){return this.externalColor[3]<1?0:2}get opaqueOverride(){return 3===this.externalColorMixMode&&1===this.externalColor[3]?0:2}get emissiveOverride(){return this.emissiveStrength>0?0:2}get emissiveSourceOverride(){return 1===this.emissiveSource?0:2}get visible(){return this.externalColor[3]>0?0:2}get type(){return 0}}e([d({vectorOps:l})],O.prototype,"externalColor",void 0),e([d()],O.prototype,"externalColorMixMode",void 0),e([d()],O.prototype,"emissiveStrength",void 0),e([d()],O.prototype,"emissiveSource",void 0),e([d()],O.prototype,"castShadows",void 0);class P extends g{constructor(){super(...arguments),this.transparent=2,this.opaqueOverride=2,this.emissiveOverride=2,this.emissiveSourceOverride=2,this.castShadows=2}get type(){return 1}}function w(e){return null!=e.overlay?.getTexture(2)}function D(e){return null!=e.overlay?.getTexture(3)}function B(e){return null!=e.overlay?.getTexture(1)}function j(e){return null!=e.overlay?.getTexture(e.overlay?.allSourcesOccluders?1:4)}e([d()],P.prototype,"transparent",void 0),e([d()],P.prototype,"opaqueOverride",void 0),e([d()],P.prototype,"emissiveOverride",void 0),e([d()],P.prototype,"emissiveSourceOverride",void 0),e([d()],P.prototype,"castShadows",void 0);export{C as CommonMaterialParameters,S as ComponentMaterial,O as ComponentParametersUniform,P as ComponentParametersVarying};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../../core/accessorSupport/decorators.js";import{glLayout as o}from"../../../../support/buffer/glUtil.js";import{newLayout as t}from"../../../../support/buffer/InterleavedLayout.js";import{createVertexBufferLayout as s}from"../SourceGeometry.js";import{C as n}from"../../../../../../chunks/ComponentShader.glsl.js";import{isColor as i}from"../../../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as l}from"../../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as
|
|
5
|
+
import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../../core/accessorSupport/decorators.js";import{glLayout as o}from"../../../../support/buffer/glUtil.js";import{newLayout as t}from"../../../../support/buffer/InterleavedLayout.js";import{createVertexBufferLayout as s}from"../SourceGeometry.js";import{C as n}from"../../../../../../chunks/ComponentShader.glsl.js";import{isColor as i}from"../../../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as l}from"../../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as a,depthOnlyOutputBuffersOr as c}from"../../../core/shaderTechnique/ShaderTechnique.js";import{OITPolygonOffset as p,depthTest as m,blending as u,drawBuffers as d}from"../../../lib/OrderIndependentTransparency.js";import{replaceBitWhenDepthTestPasses as f,stencilBaseAllZerosParams as h,stencilWriteMaskOn as b}from"../../../lib/StencilUtils.js";import{makePipelineState as g,defaultColorWrite as j,defaultDepthWrite as S,cullingParams as T,premultipliedAlpha as w}from"../../../../../webgl/renderState.js";import{fromLayouts as y}from"../../../../../webgl/VertexAttributeLocations.js";let O=class extends a{constructor(e,r){super(e,r,y([o(s(r)),C])),this.shader=new l(n,()=>import("./shader/ComponentShader.glsl.js"))}initializePipeline(e){const{integratedMeshMode:r,output:o,blendingEnabled:t,cullFace:s,hasEmission:n,hasOccludees:l,hasPolygonOffset:a,oitPass:y,renderOccluded:O}=e,C=0!==r,q=0===y,x=2===y;return g({blending:O?w:i(o)&&t?u(y):null,culling:T(s),depthTest:O?null:m(y),depthWrite:O||!q&&!x?null:S,drawBuffers:c(o,d(y,n)),colorWrite:j,stencilWrite:!O&&C||l?b:null,stencilTest:C?f(1):l?h:null,polygonOffset:q||x?a?{factor:2,units:2}:null:p})}};O=e([r("esri.views.3d.webgl-engine.collections.Component.Material.ComponentTechnique")],O);const C=o(t().u16("componentIndex"));export{O as ComponentTechnique,C as indexGlLayout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderPass as s}from"./RenderPass.js";import{VertexNormalPassParameters as e,VertexNormalDrawParameters as i}from"../shaderLibrary/attributes/VertexNormal.glsl.js";class r{constructor(t){const e=t.renderContext.rctx,i=t.techniques;this.opaque=new s(e,i),this.transparent=new s(e,i,1),this.integratedMesh=new s(e,i),this.transparentIntegratedMesh=new s(e,i),this.occludedGround=new s(e,i),this.shadowMap=new s(e,i),this.highlight=new s(e,i),this.highlightIntegratedMesh=new s(e,i),this.highlightShadowMap=new s(e,i),this.viewshedShadowMap=new s(e,i),this.defaultShadowMap=new s(e,i)}}class n extends e{constructor(){super(...arguments),this.slicePlaneLocalOrigin=t(),this.origin=this.slicePlaneLocalOrigin}}class h extends i{}class
|
|
5
|
+
import{create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderPass as s}from"./RenderPass.js";import{VertexNormalPassParameters as e,VertexNormalDrawParameters as i}from"../shaderLibrary/attributes/VertexNormal.glsl.js";class r{constructor(t){const e=t.renderContext.rctx,i=t.techniques;this.opaque=new s(e,i),this.transparent=new s(e,i,1),this.integratedMesh=new s(e,i),this.transparentIntegratedMesh=new s(e,i),this.occludedGround=new s(e,i),this.shadowMap=new s(e,i),this.highlight=new s(e,i),this.highlightIntegratedMesh=new s(e,i),this.highlightShadowMap=new s(e,i),this.viewshedShadowMap=new s(e,i),this.defaultShadowMap=new s(e,i)}}class n extends e{constructor(){super(...arguments),this.slicePlaneLocalOrigin=t(),this.origin=this.slicePlaneLocalOrigin}}class h extends i{}class o extends n{constructor(){super(...arguments),this.identifier=0,this.output=0,this.transparent=!1,this.occludedGround=!1}}class a extends n{constructor(){super(...arguments),this.identifier=1,this.output=3}}class c extends n{constructor(){super(...arguments),this.identifier=2,this.output=8}}class d extends n{constructor(){super(...arguments),this.identifier=3,this.output=6}}export{r as AllRenderPasses,h as DrawParameters,c as HighlightPassParameters,o as MaterialPassParameters,n as PassParameters,a as ShadowMapPassParameters,d as ViewshedShadowMapPassParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import{DataType as e}from"../../../../webgl/enums.js";class t{constructor(e,t,s=0){this._rctx=e,this._techniques=t,this._sorting=s,this._draws=new Array,this._previouslyBoundDraw=new Map}submitDraw(e,t,i,r,n){const a=(t.indexed?t.vao.indexBuffer.indexType:null)??0,o=new s(e,t,i,r,a,n);this._draws.push(o)}acquire(e,t){return this._draws.map(s=>s.material.acquireTechnique(this._techniques,e,t,s.geometry.parameters))}dispatch(e,t,s){const r=this._rctx;this._previouslyBoundDraw.clear();let n=null;const a=this._draws.length,o=t.highlight?.name;for(let h=0;h<a;h++){const a=this._draws[h];if(2===e.identifier){const e=a.highlightName;if(e){if(e!==o)continue}else if(!o||!t.overlay?.hasHighlight(o))continue}const u=s[h];u===n&&0===t.oitPass||(r.bindTechnique(u,t,e),n=u);const{geometryRanges:d,indexType:c,geometry:l,material:g}=a;r.bindVAO(l.vao),this._previouslyBoundDraw.get(u)!==g&&(u.program.bindDraw(t,e,g),this._previouslyBoundDraw.set(u,g));const m=d.length,{primitiveType:p}=l;for(let e=0;e<m;e+=2){const t=d[e],s=d[e+1];if(0!==c){const e=i.get(c);r.drawElements(p,s,c,t*e)}else r.drawArrays(p,t,s)}}}prepareSubmit(){this._draws.length=0}finishSubmit(){const e=0===this._sorting?1:-1;this._draws.sort((t,s)=>e*(t.depthSquaredHint-s.depthSquaredHint)||t.geometry.vao.usedMemory-s.geometry.vao.usedMemory)}get count(){return this._draws.length}}class s{constructor(e,t,s,i,r,n){this.material=e,this.geometry=t,this.geometryRanges=s,this.depthSquaredHint=i,this.indexType=r,this.highlightName=n}}const i=new Map;i.set(e.UNSIGNED_BYTE,1),i.set(e.UNSIGNED_SHORT,2),i.set(e.UNSIGNED_INT,4);export{t as RenderPass};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as s}from"tslib";import{subclass as e}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as t,transpose as r,invert as a}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{
|
|
5
|
+
import{__decorate as s}from"tslib";import{subclass as e}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as t,transpose as r,invert as a}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{h,d as o}from"../../../../../chunks/vec32.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MaterialPassParameters as c,ShadowMapPassParameters as m,HighlightPassParameters as u,ViewshedShadowMapPassParameters as l,AllRenderPasses as p}from"./AllRenderPasses.js";import{TwoVectorPosition as _}from"../util/TwoVectorPosition.js";import{SyncRenderPlugin as d}from"../../effects/RenderPlugin.js";import{DepthRange as P}from"../../lib/DepthRange.js";let f=class extends d{constructor(){super(...arguments),this.produces=new Map([[2,s=>this._produces(s,2)],[4,s=>this._produces(s,4)],[0,s=>this._produces(s,0)],[7,s=>this._produces(s,7)],[9,s=>this._produces(s,9)]]),this._materialPassParameters=new c,this._shadowPassParameters=new m,this._highlightPassParameters=new u,this._viewshedPassParameters=new l,this._systems=new Set}initializeRenderContext(s){this._context=s,this._passes=new p(s)}get rctx(){return this._context.renderContext.rctx}uninitializeRenderContext(){}dispose(){this._context=null,this._systems.clear(),this._passes=null}register(s){this._systems.add(s)}_produces(s,e){return!!this._invoke(s,e,s=>s.count>0)}prepareRender(s){const{_systems:e,_passes:t}=this;if(0!==e.size&&null!=t){for(const s of Object.values(t))s.prepareSubmit();e.forEach(e=>e.submit(t,s.bind));for(const s of Object.values(t))s.finishSubmit()}}acquireTechniques(s){if(0===this._systems.size)return null;const e=3===s.output||4===s.output||5===s.output?this._shadowPassParameters:6===s.output?this._viewshedPassParameters:8===s.output?this._highlightPassParameters:this._materialPassParameters,t=s.bind;return this._updateParameters(t.camera,e,t.slot),this._materialPassParameters.output=s.output,this._invoke(s.output,s.bind.slot,(e,t)=>e.acquire(t,s.bind))}render(s,e){this._invoke(s.output,s.bind.slot,(t,r)=>t.dispatch(r,s.bind,e))}_invoke(s,e,t){if(null==this._passes)return null;switch(e){case 2:switch(s){case 0:case 1:case 2:case 9:return t(this._passes.opaque,this._materialPassParameters);case 8:return t(this._passes.highlight,this._highlightPassParameters);case 3:return t(this._passes.shadowMap,this._shadowPassParameters);case 4:return t(this._passes.highlightShadowMap,this._shadowPassParameters);case 5:return t(this._passes.defaultShadowMap,this._shadowPassParameters);case 6:return t(this._passes.viewshedShadowMap,this._viewshedPassParameters)}break;case 4:switch(s){case 0:case 1:case 2:case 9:return t(this._passes.transparent,this._materialPassParameters)}break;case 0:switch(s){case 0:case 1:case 2:case 9:case 7:return t(this._passes.integratedMesh,this._materialPassParameters);case 8:return t(this._passes.highlightIntegratedMesh,this._highlightPassParameters)}break;case 7:if(0===s)return t(this._passes.transparentIntegratedMesh,this._materialPassParameters);break;case 9:switch(s){case 0:case 1:case 2:case 9:return t(this._passes.occludedGround,this._materialPassParameters)}}return null}notifyDirty(){this._context.requestRender()}queryDepthRange(s){const e=new P;return this._systems.forEach(t=>e.union(t.queryDepthRange(s))),e}get hasEmitters(){let s=!1;return this._systems.forEach(e=>s=e.hasEmissions||s),s}_updateParameters(s,e,i){const n=s.viewInverseTransposeMatrix,c=4===i,m=9===i;h(w,n[3],n[7],n[11]),b.set(w),o(e.transformWorldFromViewTH,b.high),o(e.transformWorldFromViewTL,b.low),o(e.slicePlaneLocalOrigin,w),t(e.transformViewFromCameraRelativeRS,s.viewMatrix),0===e.identifier&&(this._materialPassParameters.transparent=c,this._materialPassParameters.occludedGround=m,r(g,e.transformViewFromCameraRelativeRS),a(e.transformNormalViewFromGlobal,g))}hasHighlight(s){for(const e of this._systems)if(e.hasHighlight(s))return!0;return!1}};f=s([e("esri.views.3d.webgl-engine.core.renderPasses.RenderPassManager")],f);const w=n(),g=i(),b=new _;export{f as RenderPassManager};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/
|
|
5
|
+
import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DoublePrecision as e}from"../util/DoublePrecision.glsl.js";import{Float3DrawUniform as a}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as i}from"../../shaderModules/Float3PassUniform.js";import{glsl as t}from"../../shaderModules/glsl.js";import{Matrix3DrawUniform as m}from"../../shaderModules/Matrix3DrawUniform.js";import{Matrix3PassUniform as s}from"../../shaderModules/Matrix3PassUniform.js";import{Matrix4BindUniform as d}from"../../shaderModules/Matrix4BindUniform.js";import{NoParameters as l}from"../../../../../webgl/NoParameters.js";function n(r,o){const{attributes:l,vertex:n,varyings:f,fragment:v}=r;n.include(e,o),l.add("position","vec3"),f.add("vPositionWorldCameraRelative","vec3"),f.add("vPosition_view","vec3",{invariant:!0}),n.uniforms.add(new i("transformWorldFromViewTH",r=>r.transformWorldFromViewTH),new i("transformWorldFromViewTL",r=>r.transformWorldFromViewTL),new s("transformViewFromCameraRelativeRS",r=>r.transformViewFromCameraRelativeRS),new d("transformProjFromView",r=>r.camera.projectionMatrix),new m("transformWorldFromModelRS",r=>r.transformWorldFromModelRS),new a("transformWorldFromModelTH",r=>r.transformWorldFromModelTH),new a("transformWorldFromModelTL",r=>r.transformWorldFromModelTL)),n.code.add(t`vec3 positionWorldCameraRelative() {
|
|
6
6
|
vec3 rotatedModelPosition = transformWorldFromModelRS * position;
|
|
7
7
|
vec3 transform_CameraRelativeFromModel = dpAdd(
|
|
8
8
|
transformWorldFromModelTL,
|
|
@@ -11,18 +11,18 @@ transformWorldFromModelTH,
|
|
|
11
11
|
-transformWorldFromViewTH
|
|
12
12
|
);
|
|
13
13
|
return transform_CameraRelativeFromModel + rotatedModelPosition;
|
|
14
|
-
}`),n.code.add(
|
|
14
|
+
}`),n.code.add(t`
|
|
15
15
|
void forwardPosition(float fOffset) {
|
|
16
16
|
vPositionWorldCameraRelative = positionWorldCameraRelative();
|
|
17
17
|
if (fOffset != 0.0) {
|
|
18
|
-
vPositionWorldCameraRelative += fOffset * ${o.spherical?
|
|
18
|
+
vPositionWorldCameraRelative += fOffset * ${o.spherical?t`normalize(transformWorldFromViewTL + vPositionWorldCameraRelative)`:t`vec3(0.0, 0.0, 1.0)`};
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
vPosition_view = transformViewFromCameraRelativeRS * vPositionWorldCameraRelative;
|
|
22
22
|
gl_Position = transformProjFromView * vec4(vPosition_view, 1.0);
|
|
23
23
|
}
|
|
24
|
-
`),v.uniforms.add(new i("transformWorldFromViewTL",r=>r.transformWorldFromViewTL)),n.code.add(
|
|
24
|
+
`),v.uniforms.add(new i("transformWorldFromViewTL",r=>r.transformWorldFromViewTL)),n.code.add(t`vec3 positionWorld() {
|
|
25
25
|
return transformWorldFromViewTL + vPositionWorldCameraRelative;
|
|
26
|
-
}`),v.code.add(
|
|
26
|
+
}`),v.code.add(t`vec3 positionWorld() {
|
|
27
27
|
return transformWorldFromViewTL + vPositionWorldCameraRelative;
|
|
28
|
-
}`)}class
|
|
28
|
+
}`)}class f extends l{constructor(){super(...arguments),this.transformWorldFromViewTH=o(),this.transformWorldFromViewTL=o(),this.transformViewFromCameraRelativeRS=r()}}class v extends l{constructor(){super(...arguments),this.transformWorldFromModelRS=r(),this.transformWorldFromModelTH=o(),this.transformWorldFromModelTL=o()}}export{n as VertexPosition,v as VertexPositionDrawParameters,f as VertexPositionPassParameters};
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../../core/has.js";import{ZEROS as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BackgroundGrid as r}from"./BackgroundGrid.glsl.js";import{BlendModes as e}from"../util/BlendModes.glsl.js";import{Float3PassUniform as a}from"../../shaderModules/Float3PassUniform.js";import{FloatPassUniform as c}from"../../shaderModules/FloatPassUniform.js";import{glsl as l,If as s}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as t}from"../../shaderModules/Texture2DPassUniform.js";import{NoParameters as i}from"../../../../../webgl/NoParameters.js";class d extends i{constructor(){super(...arguments),this.baseOpacity=1,this.backgroundColor=o,this.fboTexture=null}}function b(o,i){const{output:d,blendMode:b,
|
|
5
|
+
import"../../../../../../core/has.js";import{ZEROS as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BackgroundGrid as r}from"./BackgroundGrid.glsl.js";import{BlendModes as e}from"../util/BlendModes.glsl.js";import{Float3PassUniform as a}from"../../shaderModules/Float3PassUniform.js";import{FloatPassUniform as c}from"../../shaderModules/FloatPassUniform.js";import{glsl as l,If as s}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as t}from"../../shaderModules/Texture2DPassUniform.js";import{NoParameters as i}from"../../../../../webgl/NoParameters.js";class d extends i{constructor(){super(...arguments),this.baseOpacity=1,this.backgroundColor=o,this.fboTexture=null}}function b(o,i){const{output:d,blendMode:b,applyBaseOpacity:g,premultipliedAlphaSource:n}=i,u=o.fragment;g&&u.uniforms.add(new c("baseOpacity",o=>o.baseOpacity));const p=0!==b,m=!p&&!n&&(1===d&&!g||4===d);u.include(e,i);let f="";switch(d){case 4:case 0:f=l`vec4(0.0)`;break;case 2:u.uniforms.add(new a("backgroundColor",o=>o.backgroundColor)),f=l`vec4(backgroundColor, 1.0)`;break;case 3:u.include(r),f=l`vec4(gridColor(uv), 1.0)`;break;case 1:u.uniforms.add(new t("fboColor",o=>o.fboTexture)),f=l`texelFetch(fboColor, ivec2(gl_FragCoord.xy), 0)`}u.code.add(l`
|
|
6
6
|
vec4 getBackground(vec2 uv) {
|
|
7
|
-
return ${s(
|
|
7
|
+
return ${s(g,l`baseOpacity *`)} ${f};
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
vec4 blendLayers(vec2 bgUV, vec4 colorLayer, float opacity) {
|
|
11
|
-
${
|
|
11
|
+
${p?l`
|
|
12
12
|
vec3 cl = colorLayer.a == 0.0 ? colorLayer.rgb : colorLayer.rgb / colorLayer.a;
|
|
13
13
|
vec4 bgColor = getBackground(bgUV);
|
|
14
14
|
vec3 cb = bgColor.a == 0.0 ? bgColor.rgb : bgColor.rgb / bgColor.a;
|
|
15
15
|
return applyBlendMode(clamp(cl, vec3(0.0), vec3(1.0)), colorLayer.a * opacity, cb, bgColor.a);`:l`
|
|
16
16
|
float composeAlpha = colorLayer.a * opacity;
|
|
17
|
-
${
|
|
17
|
+
${m?l`return colorLayer * opacity;`:l`
|
|
18
18
|
vec4 bgColor = getBackground(bgUV);
|
|
19
19
|
return bgColor * (1.0 - composeAlpha) + colorLayer * opacity;`}`}
|
|
20
20
|
}`)}export{b as TileBackground,d as TileBackgroundPassParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ColorAttachment0 as e,ColorAttachment1 as n,ColorAttachment2 as r}from"../../../webgl/enums.js";import{defaultDepthWrite as t,separateBlendingParams as u,premultipliedAlpha as s,unpremultipliedAlphaToPremultipliedAlpha as c}from"../../../webgl/renderState.js";const f=u(1,0,1,771);function l(e,n=!1){switch(e){case 0:return n?s:c;case 1:return f;case 2:case 3:return null}}function o(e){if(e.draped)return null;switch(e.oitPass){case 0:case 2:return e.writeDepth?t:null;case 1:case 3:return null}}
|
|
5
|
+
import{ColorAttachment0 as e,ColorAttachment1 as n,ColorAttachment2 as r}from"../../../webgl/enums.js";import{defaultDepthWrite as t,separateBlendingParams as u,premultipliedAlpha as s,unpremultipliedAlphaToPremultipliedAlpha as c}from"../../../webgl/renderState.js";const f=u(1,0,1,771);function l(e,n=!1){switch(e){case 0:return n?s:c;case 1:return f;case 2:case 3:return null}}function o(e){if(e.draped)return null;switch(e.oitPass){case 0:case 2:return e.writeDepth?t:null;case 1:case 3:return null}}function a(e,n=513){return{func:0===e||2===e?n:515}}const i={factor:-1,units:-2},b=5e5;function m({oitPass:e,enableOffset:n}){return n&&1===e?i:null}function p(t,u){return 1===t?u?{buffers:[e,n,r]}:{buffers:[e,n]}:u?{buffers:[e,n]}:null}export{i as OITPolygonOffset,b as OITPolygonOffsetLimit,l as blending,f as blendingColorAlpha,a as depthTest,o as depthWrite,p as drawBuffers,m as oitPolygonOffset};
|