@arcgis/core 4.33.0-next.20250424 → 4.33.0-next.20250425
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/analysis/Analysis.js +1 -1
- package/analysis/support/AnalysisOriginWebScene.d.ts +1 -1
- package/analysis/support/AnalysisOriginWebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/070839cb71c8e764b8d7.js +1 -0
- package/assets/esri/core/workers/chunks/19084a293694c5a00cae.js +1 -0
- package/assets/esri/core/workers/chunks/{5958af341014e13475d2.js → 2bed8a5ed9ae3760fa2f.js} +1 -1
- package/assets/esri/core/workers/chunks/{7ffa68d69c138db1295d.js → 2e3019ce49e972a815ca.js} +1 -1
- package/assets/esri/core/workers/chunks/38f5e6a202ce292edd9f.js +1 -0
- package/assets/esri/core/workers/chunks/415903f481392c72870f.js +1 -0
- package/assets/esri/core/workers/chunks/4351b3e54b309935faed.js +1 -0
- package/assets/esri/core/workers/chunks/4da99f058cca83937e9b.js +1 -0
- package/assets/esri/core/workers/chunks/5acdd49c5f1a49fdc6e7.js +1 -0
- package/assets/esri/core/workers/chunks/968f2f841c011095a6d2.js +1 -0
- package/assets/esri/core/workers/chunks/a2676f3f135ad5fdf872.js +1 -0
- package/assets/esri/core/workers/chunks/a8430e1e2142f1ce9b92.js +1 -0
- package/assets/esri/core/workers/chunks/b53300b46646cfad2526.js +319 -0
- package/assets/esri/core/workers/chunks/bf543bdec3da0fe278fb.js +1 -0
- package/assets/esri/core/workers/chunks/f52e597dca4b32a81881.js +1 -0
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/chunks/ShadowCastAccumulate.glsl.js +13 -9
- package/chunks/ShadowCastVisualize.glsl.js +24 -9
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/interfaces.d.ts +200 -5
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/support/ParquetEncodingLocation.d.ts +4 -0
- package/layers/support/ParquetEncodingLocation.js +1 -1
- package/layers/support/ParquetEncodingWkb.d.ts +4 -0
- package/layers/support/ParquetEncodingWkb.js +1 -1
- package/layers/support/RasterStorageInfo.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/support/parquetUtils.d.ts +3 -0
- package/layers/support/parquetUtils.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
- package/layers/support/rasterDatasets/RawBlockCache.js +1 -1
- package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
- package/package.json +2 -2
- package/portal/schemas/definitions.js +1 -1
- package/portal/schemas/integratedMesh3DTilesLayerItem.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/2d/layers/support/MediaLayerInteraction.js +1 -1
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/Lyr3DWorker.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
- package/views/3d/layers/graphics/pipeline/PipelineCommand.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/Factory.js +5 -0
- package/views/3d/layers/graphics/pipeline/symbolization/SimpleFeatureRenderer.js +5 -0
- package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
- package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
- package/views/3d/webgl/ManagedFBO.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +7 -13
- package/views/3d/webgl-engine/core/shaderLibrary/util/BlendColorsPremultiplied.glsl.js +5 -0
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +5 -0
- package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +1 -1
- package/views/PopupView.js +1 -1
- package/views/SelectionManager.js +1 -1
- package/views/analysis/analysisViewUtils.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/input/ViewEvents.js +1 -1
- package/views/support/selectionUtils.js +1 -1
- package/webscene/support/analysisUtils.js +1 -1
- package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileInteraction.js +1 -1
- package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
- package/widgets/FeatureTable/support/tableUtils.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/ShadowCast/ThresholdOptions.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/VideoPlayer.js +1 -1
- package/widgets/support/AnalysisViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0a48b9734ab4c64a6f4f.js +0 -1
- package/assets/esri/core/workers/chunks/1427e7953c3d8c87c5e8.js +0 -1
- package/assets/esri/core/workers/chunks/146b3699a9e8b1f2dcc2.js +0 -1
- package/assets/esri/core/workers/chunks/22f604726529ee6f8c25.js +0 -1
- package/assets/esri/core/workers/chunks/8dd26b12c625d20196ed.js +0 -319
- package/assets/esri/core/workers/chunks/91f8547a13f0461045ef.js +0 -1
- package/assets/esri/core/workers/chunks/931275cfa2c55eb0f504.js +0 -1
- package/assets/esri/core/workers/chunks/9f416cc5673665f8c37c.js +0 -1
- package/assets/esri/core/workers/chunks/b42ecc7c3eb2fd8d1308.js +0 -1
- package/assets/esri/core/workers/chunks/d04efa51da9b4eb3a8a7.js +0 -1
- package/assets/esri/core/workers/chunks/d8474dca270b25705699.js +0 -1
- package/assets/esri/core/workers/chunks/ed3d1d0465f4a4d8df4a.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as e}from"../../../../core/mathUtils.js";import s from"../../../../core/PooledArray.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{j as l,t as h,c as u,i as p,G as d,h as _}from"../../../../chunks/vec32.js";import{ZEROS as f,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as g,t as m,b}from"../../../../chunks/vec42.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as w}from"../../../../geometry/ellipsoidUtils.js";import{create as G,empty as B,offset as N,width as D,height as S,expand as V,intersects as P}from"../../../../geometry/support/aaBoundingRect.js";import{d as C,a as j,e as T}from"../../../../chunks/boundedPlane.js";import{create as O,fromPoints as A}from"../../../../geometry/support/ray.js";import{a as E,j as x,h as M,c as L}from"../../../../chunks/sphere.js";import{drawAccelerationStruct as z,prepare as H,drawPoly as R}from"./deconflictorDebug.js";import{VisibilityGroup as F,VisibilityFlag as X}from"./enums.js";import Y from"../../webgl/RenderCamera.js";import{newIntersector as k}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as W}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{applyPrecomputedScaleFactor as U}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as q}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as J}from"../../webgl-engine/materials/HUDMaterial.js";import{ScaleInfo as K}from"../../webgl-engine/materials/ScaleInfo.js";const Q=v(),Z=v(),$=I(),ii=I(),ti=v(),ei=c(),si=L(),ri=O(),ai=v(),oi=G();class ci{constructor(){this.aabr=G(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1}}class ni{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this.graphicPositionView=null,this._info=null,this._labelInfo=null}assertInfo(i){let t=this.getInfo(i);return t||(t=new ci,i===F.LABEL?this._labelInfo=t:this._info=t),t}getInfo(i){return i===F.LABEL?this._labelInfo:this._info}removeInfo(i){i===F.LABEL?this._labelInfo=null:this._info=null}}var li;!function(i){i[i.Idle=0]="Idle",i[i.VisibilityInactive=1]="VisibilityInactive",i[i.Process=2]="Process",i[i.Sort=3]="Sort",i[i.Deconflict=4]="Deconflict",i[i.NumStates=5]="NumStates"}(li||(li={}));class hi{constructor(){this.camera=new Y,this.slicePlane=C(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),j(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let ui=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._viewState=new hi,this._state=li.Idle,this._inactive=new Map,this._active=new Map,this._visible=new Map,this._inactiveIterator=null,this._activeIterator=null,this._visibleIterator=null,this._sortIterator=null,this._sortArray=new s({allocator:i=>i||new fi}),this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null,this._accNumTests=0,this._updatingHandles=new y}initialize(){this._updatingHandles.add((()=>(this.view?.map?.ground?.opacity??0)>0),(()=>this.setDirty()))}destroy(){this._updatingHandles.destroy(),this._inactive.clear(),this._active.clear(),this._visible.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._inactive.size>0)&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==li.Idle||this._dirty||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;const i=this._state/li.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case li.Idle:this._startUpdate(),i.madeProgress();case li.VisibilityInactive:if(this._state=li.VisibilityInactive,!this._processInactiveGraphics(i))return;case li.Process:if(this._state=li.Process,!this._processActiveGraphics(i))return;case li.Sort:if(this._state=li.Sort,!this._sortVisibleGraphics(i))return;case li.Deconflict:if(this._state=li.Deconflict,!this._deconflictVisibleGraphics(i))return;default:z((()=>({bins:this._accBins,numX:this._accBinsNumX,numY:this._accBinsNumY,sizeX:this._accBinsSizeX,sizeY:this._accBinsSizeY,numTests:this._accNumTests,numVisible:this._visible.size}))),this._state=li.Idle,this.notifyChange("updating")}}setGraphicsActive(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i)))}setGraphicsInactive(i,t){t?i.forEach((i=>this.addToInactiveGraphics(i))):i.forEach((i=>this.removeFromInactiveGraphics(i)))}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const e=t?.geometries[0],s=e?.material;return s instanceof J}_startUpdate(){H(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._viewState.camera;this._initBins(i,t),this._resetIterators()}addToActiveGraphics(i){i.assertInfo(this.visibilityGroup),this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._visible.delete(i.graphics3DGraphic.graphic.uid),pi(i,this.visibilityGroup),i.removeInfo(this.visibilityGroup),this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}addToInactiveGraphics(i){this._inactive.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromInactiveGraphics(i){this._inactive.delete(i.graphics3DGraphic.graphic.uid)}_createIntersector(){const i=this.view.sceneIntersectionHelper,t=k(this.view.state.viewingMode);t.options.store=W.MIN,t.options.hud=!1,t.options.normalRequired=!1;const e=this.view.state.camera;return s=>{t.reset(e.eye,s,e),i.computeIntersection(A(e.eye,s,ri),t,{enableDraped:!1});const r=t.results.min.dist;return null!=r?r*l(s,e.eye):0}}_processInactiveGraphics(i){if(0===this._inactive.size)return!0;const t=this._ensureInactiveGraphicsIterator(),e=this._viewState.camera,s=this.view.renderCoordsHelper.getAltitude(e.eye),r=o(ei,e.viewInverseTransposeMatrix),a=this.view.map.ground.opacity>0,c="global"===this.view.viewingMode&&a&&e.relativeElevation>0?si:null;let n=0;null!=c&&(h(E(c),f,e.viewMatrix),c[3]=w(this.view.spatialReference).radius,n=x(c,f));const l=a?this._createIntersector():null,u=G();for(;!i.done;){i.madeProgress();const a=t.next();if(!0===a.done)return this._inactiveIterator=null,!0;const o=a.value,p=o.graphics3DGraphic;if(p.destroyed)continue;if(!p.isVisible(F.GRAPHIC,X.DECONFLICTION))continue;const d=this.getGraphicsLayers(p);let _=null,f=!0;for(const i of d){if(!this.layerSupportsDeconfliction(i))continue;_=bi,this._getProjectionInfo(i,e,_),B(u);const t=i.stageObject.geometries[0].material;if(this._expandBoundingRect(u,e,i,t,_),u[0]>e.fullWidth||u[1]>e.fullHeight||u[2]<0||u[3]<0){f=!1;break}if(this._isCulledBySlice(o,_.positionView)){f=!1;break}if(null!=c&&mi(_,c,n)){f=!1;break}h(Z,_.positionView,r),_.altitude=this.view.renderCoordsHelper.getAltitude(Z),_.distanceToOccluder=l?.(Z)??0,f=this._occludedVisibility(_.distanceToOccluder,_.distance,_.altitude,s),this._setCachedGraphicPosition(o,_.positionView);break}R(u,f,!0),this._setGraphicVisibility(o,f)}return!1}_setCachedGraphicPosition(i,t){const e=this.visibilityGroup===F.LABEL||i.getInfo(F.LABEL);this.visibilityGroup===F.GRAPHIC&&e?i.graphicPositionView=u(i.graphicPositionView??v(),t):i.graphicPositionView&&!e?i.graphicPositionView=null:i.graphicPositionView&&p(i.graphicPositionView,NaN,NaN,NaN)}_processActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),e=this._viewState.camera,s=o(ei,e.viewInverseTransposeMatrix),r=e.relativeElevation,a=this.view.renderCoordsHelper.getAltitude(e.eye),c=this.view.map.ground.opacity>0,n="global"===this.view.viewingMode&&c&&r>0,l=c?this._createIntersector():null,u=n?si:null;let p=0;for(null!=u&&(h(E(u),f,e.viewMatrix),u[3]=w(this.view.spatialReference).radius,p=x(u,f));!i.done;){i.madeProgress();const r=t.next();if(!0===r.done)return this._activeIterator=null,!0;const o=r.value,c=o.assertInfo(this.visibilityGroup);this._collectGraphics3DGraphics(o,c,e,s,u,p,l),this._occludedVisibility(c.distanceToOccluder,c.distance,c.altitude,a)||(c.culled=!0),c.culled?(R(c.aabr,!1,!0),this._setGraphicVisibility(o,!1),this._visible.delete(o.graphics3DGraphic.graphic.uid)):this._visible.set(o.graphics3DGraphic.graphic.uid,o)}return!1}_occludedVisibility(i,t,e,s){return 0===i||t<=i+10+2*(Math.max(100,Math.abs(e-s))-100)}_sortVisibleGraphics(i){const t=this._ensureSortGraphicsIterator();for(;!i.done;){const e=t.next();if(i.madeProgress(),!0===e.done)return this._sortIterator=null,!0}return!1}_deconflictVisibleGraphics(i){const t=this._ensureVisibleGraphicsIterator(),e=this.visibilityGroup===F.LABEL;for(;!i.done;){i.madeProgress();const s=t.next();if(!0===s.done)return this._visibleIterator=null,!0;const r=s.value,a=r.getInfo(this.visibilityGroup);if(!a||a.culled){this._setGraphicVisibility(r,!1);continue}const o=r.graphics3DGraphic,c=!e||o.isVisible();a.visible=c&&!this._isConflicted(r.graphics3DGraphic.graphic.uid,a),a.visible&&this._addToBins(r,a),this._setGraphicVisibility(r,a.visible),R(a.aabr,a.visible)}return!1}_resetIterators(){this._inactiveIterator=null,this._activeIterator=null,this._visibleIterator=null,this._sortIterator=null}_ensureInactiveGraphicsIterator(){return this._inactiveIterator||(this._inactiveIterator=di(this._inactive)),this._inactiveIterator}_ensureActiveGraphicsIterator(){return this._activeIterator||(this._activeIterator=di(this._active)),this._activeIterator}_ensureVisibleGraphicsIterator(){return this._visibleIterator||(this._visibleIterator=di(this._visible)),this._visibleIterator}_ensureSortGraphicsIterator(){return this._sortIterator||(this._sortIterator=_i(this._visible,this._sortArray,this.visibilityGroup)),this._sortIterator}_collectGraphics3DGraphics(i,t,e,s,r,a,o){const c=i.graphics3DGraphic;if(c.destroyed)return;if(!c.isVisible(F.GRAPHIC,X.DECONFLICTION))return void(t.culled=!0);const n=this.getGraphicsLayers(c);B(t.aabr);let l=null;for(const u of n){if(!this.layerSupportsDeconfliction(u))continue;if(null==l){if(l=bi,this._getProjectionInfo(u,e,l),l.isOutsideScreen||this._isCulledBySlice(i,l.positionView)||null!=r&&mi(l,r,a))return void(t.culled=!0);const c=this.visibilityGroup===F.LABEL?i.getInfo(F.GRAPHIC):null;c&&i.graphicPositionView&&d(l.positionView,i.graphicPositionView)?(l.altitude=c.altitude,l.distanceToOccluder=c.distanceToOccluder):(h(Z,l.positionView,s),l.altitude=this.view.renderCoordsHelper.getAltitude(Z),l.distanceToOccluder=o?.(Z)??0,this._setCachedGraphicPosition(i,l.positionView))}const c=u.stageObject.geometries[0].material;this._expandBoundingRect(t.aabr,e,u,c,l)}null==l?t.culled=!0:(t.altitude=l.altitude,t.distance=l.distance,t.distanceToOccluder=l.distanceToOccluder,t.culled=!1)}_getProjectionInfo(i,t,e){const s=i.stageObject,r=s.geometries[0],a=r.material,o=E(s.boundingVolumeWorldSpace.bounds);h(Q,o,t.viewMatrix);const c=r.attributes,n=c.get(q.NORMAL).data,l=c.get(q.CENTEROFFSETANDDISTANCE).data;a.applyShaderOffsetsView(Q,n,s.transformation,l,t,e.scaleInfo,Q),g($,Q[0],Q[1],Q[2],1),m(ii,$,t.projectionMatrix),_(e.positionNDC,ii,1/ii[3]),a.applyShaderOffsetsNDC(e.positionNDC,l,t,e.positionNDC,ti),e.distanceWithoutPolygonOffset=t.depthNDCToWorld(ti[2]),e.distance=ti[2]===e.positionNDC[2]?e.distanceWithoutPolygonOffset:t.depthNDCToWorld(e.positionNDC[2]),g(ii,e.positionNDC[0],e.positionNDC[1],e.positionNDC[2],1),m($,ii,t.inverseProjectionMatrix),b($,$,1/$[3]),p(e.positionView,Q[0],Q[1],Q[2])}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&T(this._viewState.slicePlane,t)}_expandBoundingRect(i,t,s,r,{positionNDC:a,scaleInfo:o}){const c=s.getScreenSize(vi);U(c,o.factor,c),c[0]*=t.pixelRatio,c[1]*=t.pixelRatio;const n=N(r.calculateRelativeScreenBounds(c,o.factorAlignment.scale*t.pixelRatio,oi),e(0,t.fullWidth,.5+.5*a[0]),e(0,t.fullHeight,.5+.5*a[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(D(n),S(n));n[0]-=i,n[1]-=i,n[2]+=i,n[3]+=i}V(i,n,i)}_isConflicted(i,t){let e=!0;for(let s=Math.floor(t.aabr[0]/this._accBinsSizeX);s<=Math.floor(t.aabr[2]/this._accBinsSizeX);s++)if(!(s<0||s>=this._accBinsNumX))for(let r=Math.floor(t.aabr[1]/this._accBinsSizeY);r<=Math.floor(t.aabr[3]/this._accBinsSizeY);r++){if(r<0||r>=this._accBinsNumY)continue;e=!1;const a=this._accBins[s][r];for(let e=0;e<a.length;e++){const s=a.data[e],r=s.getInfo(this.visibilityGroup);if(r&&r.visible&&s.graphics3DGraphic.graphic.uid!==i&&(this._accNumTests++,P(r.aabr,t.aabr)))return!0}}return e}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins[this._accBins.length-1];for(let t=0;t<this._accBinsNumY;t++)i.push(new s)}}else for(let e=0;e<this._accBinsNumX;e++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[e][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY,this._accNumTests=0}_addToBins(i,t){const e=Math.floor(t.aabr[0]/this._accBinsSizeX),s=Math.floor(t.aabr[2]/this._accBinsSizeX),r=Math.floor(t.aabr[1]/this._accBinsSizeY),a=Math.floor(t.aabr[3]/this._accBinsSizeY);for(let o=e;o<=s;o++)if(!(o<0||o>=this._accBinsNumX))for(let t=r;t<=a;t++)t<0||t>=this._accBinsNumY||this._accBins[o][t].push(i)}_setGraphicVisibility(i,t){const e=i.graphics3DGraphic;e.destroyed||(e.setVisibilityFlag(this.visibilityGroup,X.DECONFLICTION,t),this.visibilityGroup===F.LABEL&&this.view.labeler.setLabelGraphicVisibility(e,t))}};function pi(i,t){const e=i.graphics3DGraphic;e.destroyed||e.setVisibilityFlag(t,X.DECONFLICTION,!0)}function*di(i){if(Map.prototype.entries){const t=i.entries();for(let i=t.next();!i.done;i=t.next())yield i.value[1]}else yield*i.values()}function*_i(i,t,e){t.clear(),i.forEach(((i,s)=>{const r=t.pushNew();r.id=s,r.visible=i.graphics3DGraphic.getVisibilityFlag(e,X.DECONFLICTION);const a=i.getInfo(e);r.prio=i.graphics3DGraphic.deconflictionPriority,r.distance=a?.distance??Number.MAX_VALUE,r.behindTerrain=!!a&&0!==a.distanceToOccluder&&a.distance>a.distanceToOccluder})),yield;const s=t.iterableSort(((i,t)=>i.behindTerrain!==t.behindTerrain?+i.behindTerrain-+t.behindTerrain:i.prio!==t.prio?t.prio-i.prio:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?+t.visible-+i.visible:i.id-t.id));for(let r=s.next();!r.done;r=s.next())yield;t.forAll((t=>{const e=i.get(t.id);e&&(i.delete(t.id),i.set(t.id,e))})),t.clear()}i([r({constructOnly:!0})],ui.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],ui.prototype,"updating",null),i([r({readOnly:!0})],ui.prototype,"_updatingHandles",void 0),ui=i([a("esri.views.3d.layers.graphics.Deconflictor")],ui);class fi{constructor(){this.id=0,this.visible=!1,this.behindTerrain=!1,this.prio=0,this.distance=0}}const vi=n();class gi{constructor(){this.positionView=v(),this.positionNDC=v(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new K}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1||i[2]>=1}}function mi(i,t,e){return u(ri.direction,i.positionView),p(ri.origin,0,0,0),!!M(t,ri,ai)&&i.distanceWithoutPolygonOffset>e}const bi=new gi;export{ui as Deconflictor,ni as DeconflictorGraphic,hi as DeconflictorViewState,li as State};
|
|
5
|
+
import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as e}from"../../../../core/mathUtils.js";import s from"../../../../core/PooledArray.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{j as l,t as h,c as u,i as p,G as d,h as _}from"../../../../chunks/vec32.js";import{ZEROS as f,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as g,t as m,b}from"../../../../chunks/vec42.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as I}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as w}from"../../../../geometry/ellipsoidUtils.js";import{create as G,empty as B,offset as N,width as D,height as S,expand as V,intersects as P}from"../../../../geometry/support/aaBoundingRect.js";import{d as C,a as j,e as T}from"../../../../chunks/boundedPlane.js";import{create as O,fromPoints as A}from"../../../../geometry/support/ray.js";import{a as E,j as x,h as M,c as L}from"../../../../chunks/sphere.js";import{drawAccelerationStruct as z,prepare as H,drawPoly as R}from"./deconflictorDebug.js";import{VisibilityGroup as F,VisibilityFlag as X}from"./enums.js";import Y from"../../webgl/RenderCamera.js";import{newIntersector as k}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as W}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{applyPrecomputedScaleFactor as U}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as q}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as J}from"../../webgl-engine/materials/HUDMaterial.js";import{ScaleInfo as K}from"../../webgl-engine/materials/ScaleInfo.js";const Q=v(),Z=v(),$=y(),ii=y(),ti=v(),ei=c(),si=L(),ri=O(),ai=v(),oi=G();class ci{constructor(){this.aabr=G(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1}}class ni{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this.graphicPositionView=null,this._info=null,this._labelInfo=null}assertInfo(i){let t=this.getInfo(i);return t||(t=new ci,i===F.LABEL?this._labelInfo=t:this._info=t),t}getInfo(i){return i===F.LABEL?this._labelInfo:this._info}removeInfo(i){i===F.LABEL?this._labelInfo=null:this._info=null}}var li;!function(i){i[i.Idle=0]="Idle",i[i.VisibilityInactive=1]="VisibilityInactive",i[i.Process=2]="Process",i[i.Sort=3]="Sort",i[i.Deconflict=4]="Deconflict",i[i.NumStates=5]="NumStates"}(li||(li={}));class hi{constructor(){this.camera=new Y,this.slicePlane=C(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),j(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let ui=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._viewState=new hi,this._state=li.Idle,this._inactive=new Map,this._active=new Map,this._visible=new Map,this._inactiveIterator=null,this._activeIterator=null,this._visibleIterator=null,this._sortIterator=null,this._sortArray=new s({allocator:i=>i||new fi}),this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null,this._accNumTests=0,this._updatingHandles=new I}initialize(){this._updatingHandles.add((()=>(this.view?.map?.ground?.opacity??0)>0),(()=>this.setDirty()))}destroy(){this._updatingHandles.destroy(),this._inactive.clear(),this._active.clear(),this._visible.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._inactive.size>0)&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==li.Idle||this._dirty||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;const i=this._state/li.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case li.Idle:this._startUpdate(),i.madeProgress();case li.VisibilityInactive:if(this._state=li.VisibilityInactive,!this._processInactiveGraphics(i))return;case li.Process:if(this._state=li.Process,!this._processActiveGraphics(i))return;case li.Sort:if(this._state=li.Sort,!this._sortVisibleGraphics(i))return;case li.Deconflict:if(this._state=li.Deconflict,!this._deconflictVisibleGraphics(i))return;default:z((()=>({bins:this._accBins,numX:this._accBinsNumX,numY:this._accBinsNumY,sizeX:this._accBinsSizeX,sizeY:this._accBinsSizeY,numTests:this._accNumTests,numVisible:this._visible.size}))),this._state=li.Idle,this.notifyChange("updating")}}setGraphicsActive(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i)))}setGraphicsInactive(i,t){t?i.forEach((i=>this.addToInactiveGraphics(i))):i.forEach((i=>this.removeFromInactiveGraphics(i)))}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const e=t?.geometries[0],s=e?.material;return s instanceof J}_startUpdate(){H(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._viewState.camera;this._initBins(i,t),this._resetIterators()}addToActiveGraphics(i){i.assertInfo(this.visibilityGroup),this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._visible.delete(i.graphics3DGraphic.graphic.uid),pi(i,this.visibilityGroup),i.removeInfo(this.visibilityGroup),this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}addToInactiveGraphics(i){this._inactive.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromInactiveGraphics(i){this._inactive.delete(i.graphics3DGraphic.graphic.uid)}_createIntersector(){const i=this.view.sceneIntersectionHelper,t=k(this.view.state.viewingMode);t.options.store=W.MIN,t.options.hud=!1,t.options.normalRequired=!1;const e=this.view.state.camera;return s=>{t.reset(e.eye,s,e),i.computeIntersection(A(e.eye,s,ri),t,{enableDraped:!1});const r=t.results.min.dist;return null!=r?r*l(s,e.eye):0}}_processInactiveGraphics(i){if(0===this._inactive.size)return!0;const t=this._ensureInactiveGraphicsIterator(),e=this._viewState.camera,s=this.view.renderCoordsHelper.getAltitude(e.eye),r=o(ei,e.viewInverseTransposeMatrix),a=this.view.map.ground.opacity>0,c="global"===this.view.viewingMode&&a&&e.relativeElevation>0?si:null;let n=0;null!=c&&(h(E(c),f,e.viewMatrix),c[3]=w(this.view.spatialReference).radius,n=x(c,f));const l=a?this._createIntersector():null,u=G();for(;!i.done;){i.madeProgress();const a=t.next();if(!0===a.done)return this._inactiveIterator=null,!0;const o=a.value,p=o.graphics3DGraphic;if(p.destroyed)continue;if(!p.isVisible(F.GRAPHIC,X.DECONFLICTION))continue;const d=this.getGraphicsLayers(p);let _=null,f=!0;for(const i of d){if(!this.layerSupportsDeconfliction(i))continue;_=bi,this._getProjectionInfo(i,e,_),B(u);const t=i.stageObject.geometries[0].material;if(this._expandBoundingRect(u,e,i,t,_),u[0]>e.fullWidth||u[1]>e.fullHeight||u[2]<0||u[3]<0){f=!1;break}if(this._isCulledBySlice(o,_.positionView)){f=!1;break}if(null!=c&&mi(_,c,n)){f=!1;break}h(Z,_.positionView,r),_.altitude=this.view.renderCoordsHelper.getAltitude(Z),_.distanceToOccluder=l?.(Z)??0,f=this._occludedVisibility(_.distanceToOccluder,_.distance,_.altitude,s),this._setCachedGraphicPosition(o,_.positionView);break}R(u,f,!0),this._setGraphicVisibility(o,f)}return!1}_setCachedGraphicPosition(i,t){const e=this.visibilityGroup===F.LABEL||i.getInfo(F.LABEL);this.visibilityGroup===F.GRAPHIC&&e?i.graphicPositionView=u(i.graphicPositionView??v(),t):i.graphicPositionView&&!e?i.graphicPositionView=null:i.graphicPositionView&&p(i.graphicPositionView,NaN,NaN,NaN)}_processActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),e=this._viewState.camera,s=o(ei,e.viewInverseTransposeMatrix),r=e.relativeElevation,a=this.view.renderCoordsHelper.getAltitude(e.eye),c=this.view.map.ground.opacity>0,n="global"===this.view.viewingMode&&c&&r>0,l=c?this._createIntersector():null,u=n?si:null;let p=0;for(null!=u&&(h(E(u),f,e.viewMatrix),u[3]=w(this.view.spatialReference).radius,p=x(u,f));!i.done;){i.madeProgress();const r=t.next();if(!0===r.done)return this._activeIterator=null,!0;const o=r.value,c=o.assertInfo(this.visibilityGroup);this._collectGraphics3DGraphics(o,c,e,s,u,p,l),this._occludedVisibility(c.distanceToOccluder,c.distance,c.altitude,a)||(c.culled=!0),c.culled?(R(c.aabr,!1,!0),this._setGraphicVisibility(o,c.visible),this._visible.delete(o.graphics3DGraphic.graphic.uid)):this._visible.set(o.graphics3DGraphic.graphic.uid,o)}return!1}_occludedVisibility(i,t,e,s){return 0===i||t<=i+10+2*(Math.max(100,Math.abs(e-s))-100)}_sortVisibleGraphics(i){const t=this._ensureSortGraphicsIterator();for(;!i.done;){const e=t.next();if(i.madeProgress(),!0===e.done)return this._sortIterator=null,!0}return!1}_deconflictVisibleGraphics(i){const t=this._ensureVisibleGraphicsIterator(),e=this.visibilityGroup===F.LABEL;for(;!i.done;){i.madeProgress();const s=t.next();if(!0===s.done)return this._visibleIterator=null,!0;const r=s.value,a=r.getInfo(this.visibilityGroup);if(!a||a.culled){this._setGraphicVisibility(r,a?.visible??!0);continue}const o=r.graphics3DGraphic,c=!e||o.isVisible();a.visible=c&&!this._isConflicted(r.graphics3DGraphic.graphic.uid,a),a.visible&&this._addToBins(r,a),this._setGraphicVisibility(r,a.visible),R(a.aabr,a.visible)}return!1}_resetIterators(){this._inactiveIterator=null,this._activeIterator=null,this._visibleIterator=null,this._sortIterator=null}_ensureInactiveGraphicsIterator(){return this._inactiveIterator||(this._inactiveIterator=di(this._inactive)),this._inactiveIterator}_ensureActiveGraphicsIterator(){return this._activeIterator??=di(this._active),this._activeIterator}_ensureVisibleGraphicsIterator(){return this._visibleIterator??=di(this._visible),this._visibleIterator}_ensureSortGraphicsIterator(){return this._sortIterator??=_i(this._visible,this._sortArray,this.visibilityGroup),this._sortIterator}_collectGraphics3DGraphics(i,t,e,s,r,a,o){const c=i.graphics3DGraphic;if(c.destroyed)return;if(!c.isVisible(F.GRAPHIC,X.DECONFLICTION))return void(t.culled=!0);const n=this.getGraphicsLayers(c);B(t.aabr);let l=null;for(const u of n){if(!this.layerSupportsDeconfliction(u))continue;if(null==l){if(l=bi,this._getProjectionInfo(u,e,l),l.isOutsideScreen||this._isCulledBySlice(i,l.positionView)||null!=r&&mi(l,r,a))return t.culled=!0,void(t.visible=!1);const c=this.visibilityGroup===F.LABEL?i.getInfo(F.GRAPHIC):null;c&&i.graphicPositionView&&d(l.positionView,i.graphicPositionView)?(l.altitude=c.altitude,l.distanceToOccluder=c.distanceToOccluder):(h(Z,l.positionView,s),l.altitude=this.view.renderCoordsHelper.getAltitude(Z),l.distanceToOccluder=o?.(Z)??0,this._setCachedGraphicPosition(i,l.positionView))}const c=u.stageObject.geometries[0].material;this._expandBoundingRect(t.aabr,e,u,c,l)}l?(t.altitude=l.altitude,t.distance=l.distance,t.distanceToOccluder=l.distanceToOccluder,t.culled=!1):(t.culled=!0,t.visible=!0)}_getProjectionInfo(i,t,e){const s=i.stageObject,r=s.geometries[0],a=r.material,o=E(s.boundingVolumeWorldSpace.bounds);h(Q,o,t.viewMatrix);const c=r.attributes,n=c.get(q.NORMAL).data,l=c.get(q.CENTEROFFSETANDDISTANCE).data;a.applyShaderOffsetsView(Q,n,s.transformation,l,t,e.scaleInfo,Q),g($,Q[0],Q[1],Q[2],1),m(ii,$,t.projectionMatrix),_(e.positionNDC,ii,1/ii[3]),a.applyShaderOffsetsNDC(e.positionNDC,l,t,e.positionNDC,ti),e.distanceWithoutPolygonOffset=t.depthNDCToWorld(ti[2]),e.distance=ti[2]===e.positionNDC[2]?e.distanceWithoutPolygonOffset:t.depthNDCToWorld(e.positionNDC[2]),g(ii,e.positionNDC[0],e.positionNDC[1],e.positionNDC[2],1),m($,ii,t.inverseProjectionMatrix),b($,$,1/$[3]),p(e.positionView,Q[0],Q[1],Q[2])}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&T(this._viewState.slicePlane,t)}_expandBoundingRect(i,t,s,r,{positionNDC:a,scaleInfo:o}){const c=s.getScreenSize(vi);U(c,o.factor,c),c[0]*=t.pixelRatio,c[1]*=t.pixelRatio;const n=N(r.calculateRelativeScreenBounds(c,o.factorAlignment.scale*t.pixelRatio,oi),e(0,t.fullWidth,.5+.5*a[0]),e(0,t.fullHeight,.5+.5*a[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(D(n),S(n));n[0]-=i,n[1]-=i,n[2]+=i,n[3]+=i}V(i,n,i)}_isConflicted(i,t){let e=!0;for(let s=Math.floor(t.aabr[0]/this._accBinsSizeX);s<=Math.floor(t.aabr[2]/this._accBinsSizeX);s++)if(!(s<0||s>=this._accBinsNumX))for(let r=Math.floor(t.aabr[1]/this._accBinsSizeY);r<=Math.floor(t.aabr[3]/this._accBinsSizeY);r++){if(r<0||r>=this._accBinsNumY)continue;e=!1;const a=this._accBins[s][r];for(let e=0;e<a.length;e++){const s=a.data[e],r=s.getInfo(this.visibilityGroup);if(r&&r.visible&&s.graphics3DGraphic.graphic.uid!==i&&(this._accNumTests++,P(r.aabr,t.aabr)))return!0}}return e}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins[this._accBins.length-1];for(let t=0;t<this._accBinsNumY;t++)i.push(new s)}}else for(let e=0;e<this._accBinsNumX;e++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[e][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY,this._accNumTests=0}_addToBins(i,t){const e=Math.floor(t.aabr[0]/this._accBinsSizeX),s=Math.floor(t.aabr[2]/this._accBinsSizeX),r=Math.floor(t.aabr[1]/this._accBinsSizeY),a=Math.floor(t.aabr[3]/this._accBinsSizeY);for(let o=e;o<=s;o++)if(!(o<0||o>=this._accBinsNumX))for(let t=r;t<=a;t++)t<0||t>=this._accBinsNumY||this._accBins[o][t].push(i)}_setGraphicVisibility(i,t){const e=i.graphics3DGraphic;e.destroyed||(e.setVisibilityFlag(this.visibilityGroup,X.DECONFLICTION,t),this.visibilityGroup===F.LABEL&&this.view.labeler.setLabelGraphicVisibility(e,t))}};function pi(i,t){const e=i.graphics3DGraphic;e.destroyed||e.setVisibilityFlag(t,X.DECONFLICTION,!0)}function*di(i){if(Map.prototype.entries){const t=i.entries();for(let i=t.next();!i.done;i=t.next())yield i.value[1]}else yield*i.values()}function*_i(i,t,e){t.clear(),i.forEach(((i,s)=>{const r=t.pushNew();r.id=s,r.visible=i.graphics3DGraphic.getVisibilityFlag(e,X.DECONFLICTION);const a=i.getInfo(e);r.prio=i.graphics3DGraphic.deconflictionPriority,r.distance=a?.distance??Number.MAX_VALUE,r.behindTerrain=!!a&&0!==a.distanceToOccluder&&a.distance>a.distanceToOccluder})),yield;const s=t.iterableSort(((i,t)=>i.behindTerrain!==t.behindTerrain?+i.behindTerrain-+t.behindTerrain:i.prio!==t.prio?t.prio-i.prio:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?+t.visible-+i.visible:i.id-t.id));for(let r=s.next();!r.done;r=s.next())yield;t.forAll((t=>{const e=i.get(t.id);e&&(i.delete(t.id),i.set(t.id,e))})),t.clear()}i([r({constructOnly:!0})],ui.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],ui.prototype,"updating",null),i([r({readOnly:!0})],ui.prototype,"_updatingHandles",void 0),ui=i([a("esri.views.3d.layers.graphics.Deconflictor")],ui);class fi{constructor(){this.id=0,this.visible=!1,this.behindTerrain=!1,this.prio=0,this.distance=0}}const vi=n();class gi{constructor(){this.positionView=v(),this.positionNDC=v(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new K}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1||i[2]>=1}}function mi(i,t,e){return u(ri.direction,i.positionView),p(ri.origin,0,0,0),!!M(t,ri,ai)&&i.distanceWithoutPolygonOffset>e}const bi=new gi;export{ui as Deconflictor,ni as DeconflictorGraphic,hi as DeconflictorViewState,li as State};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/Error.js";import{makeHandle as t}from"../../../../../core/handleUtils.js";import{destroyMaybe as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/Error.js";import{makeHandle as t}from"../../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import o from"../../../../../core/Promise.js";import{on as i,watch as a}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as u}from"../../../../../core/accessorSupport/decorators/subclass.js";import{FeatureLayerViewPerformanceInfo as l}from"../../FeatureLayerViewPerformanceInfo.js";import{Feature3DPipelineWorkerHandle as d}from"./Feature3DPipelineWorkerHandle.js";import{FeaturePipelineRenderManager as p}from"./rendering/FeaturePipelineRenderManager.js";import{emptyHighlightHandle as y}from"../../support/highlightUtils.js";import{LayerViewPerformanceInfo as m}from"../../support/LayerViewPerformanceInfo.js";import{UpdatePolicy as c}from"../../../webgl-engine/lib/UpdatePolicy.js";let h=class extends o{constructor(e){super(e),this._renderer=null,this.graphicsQuery={queryForSymbologySnapping:(e,t)=>{throw new r("featurelayer:unsupported-symbology-snapping","Symbology snapping not supported")},executeQuery:async(e,r)=>await this._workerHandle.executeQuery(e,r),executeQueryForIds:async(e,r)=>await this._workerHandle.executeQueryForIds(e,r),executeQueryForCount:async(e,r)=>await this._workerHandle.executeQueryForCount(e,r),executeQueryForExtent:async(e,r)=>await this._workerHandle.executeQueryForExtent(e,r),executeQueryForLatestObservations:async(e,r)=>await this._workerHandle.executeQueryForLatestObservations(e,r)},this.maximumNumberOfFeatures=1e3}initialize(){if("point"!==this.layerView.layer.geometryType)throw new r("featurelayer:unsupported-geometry-type",`${this.layerView.layer.geometryType} is not supported`);this.addResolvingPromise(this.setup())}destroy(){this.removeAllHandles(),this._workerHandle.destroy(),n(this._renderer)}async setup(){const{layer:e,view:t,uid:n}=this.layerView,{spatialReference:o,renderSpatialReference:s,resourceController:u,renderCoordsHelper:l,elevationProvider:y}=t,m=t.state.viewingMode;if(this._renderer=new p({view:t,layerViewUid:n}),"feature"!==e.type)throw new r("featurelayer:unsupported-layertype","Only FeatureLayer is supported");const c=new d({schedule:e=>u.immediate.schedule(e),layer:e,viewSpatialReference:o,renderSpatialReference:s,viewingMode:m,renderer:this._renderer,elevationProvider:y,renderCoordsHelper:l});this._workerHandle=await c.when(),this.addHandles([this.layerView.view.featureTiles.addClient(),i((()=>this.layerView.view.featureTiles.tiles),"change",(e=>{this._workerHandle.onTileTreeChange(e)}),{onListenerAdd:e=>this._workerHandle.onTileTreeChange({added:e.toArray(),removed:[]}),onListenerRemove:e=>this._workerHandle.onTileTreeChange({added:[],removed:e.toArray()})}),t.elevationProvider.on("elevation-change",(e=>this._workerHandle.onElevationChange(e))),a((()=>this.layerView.fullOpacity),(e=>this._workerHandle.onLayerOpacityChange(e)),{sync:!1}),a((()=>e.renderer),(e=>this._workerHandle.onRendererChange(e)),{sync:!1})])}get legendEnabled(){return!1}get hasAllFeatures(){return!1}get hasAllFeaturesInView(){return!1}get hasFullGeometries(){return!1}get symbologySnappingSupported(){return!1}get scaleVisibilitySuspended(){return!1}get suspendInfo(){return{}}get updating(){return this._workerHandle.updating}get dataUpdating(){return!1}get updatePolicy(){return c.ASYNC}get maximumNumberOfFeaturesExceeded(){return!1}get updatingProgressValue(){return 1}get usedMemory(){return this._renderer?.usedMemory??0}get unloadedMemory(){return 0}get ignoresMemoryFactor(){return!0}get totalFeatures(){return this._renderer?.totalFeatures??0}get performanceInfo(){const e=this.totalFeatures;return new l(new m(this.usedMemory,e,e,this.maximumNumberOfFeatures,0,null),e,e,this.maximumNumberOfFeaturesExceeded,"tiles","n/a")}get suspendResumeExtentMode(){return"computed"}forEachGraphic(e){}findGraphic(e){return null}highlight(e){return y}maskOccludee(e){return t()}async whenGraphicBounds(e,r){return null}computeAttachmentOrigin(e,r){return null}elevationAlignPointsInFeatures(e,t){throw new r("featurelayer:unsupported-elevation-alignment","Elevation alignment not supported")}async doRefresh(e){}setVisibility(e,r){}getMissingAttributesForFeature(e){return null}getHydratedGeometry(e){return null}};e([s()],h.prototype,"layerView",void 0),e([s()],h.prototype,"updating",null),e([s()],h.prototype,"totalFeatures",null),h=e([u("esri.views.3d.layers.graphics.pipeline.Feature3DPipeline")],h);export{h as Feature3DPipeline};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Evented.js";import{throwIfAborted as r}from"../../../../../core/promiseUtils.js";import{watch as a,initial as n}from"../../../../../core/reactiveUtils.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../../../geometry/Extent.js";import{initializeProjection as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Evented.js";import{throwIfAborted as r}from"../../../../../core/promiseUtils.js";import{watch as a,initial as n}from"../../../../../core/reactiveUtils.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../../../geometry/Extent.js";import{initializeProjection as l,project as c}from"../../../../../geometry/projection.js";import d from"../../../../../geometry/SpatialReference.js";import{QueryEngine as m}from"../../../../../layers/graphics/data/QueryEngine.js";import u from"../../../../../rest/support/Query.js";import{joinCommands as h,PipelineCommand as p}from"./PipelineCommand.js";import{Tile3DManager as y}from"./Tile3DManager.js";import{TileActionSynchronizer as _,TileActionType as f}from"./TileActionSynchronizer.js";import{TiledFeatureStore as C}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as w}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as g}from"./rendering/RenderCommandContext.js";import{createFeatureRendererFromJSON as S}from"./symbolization/Factory.js";import{RenderCoordsHelper as v}from"../../../support/RenderCoordsHelper.js";import{assert as x}from"../../../webgl-engine/lib/Util.js";let R=class extends t.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new C,this._actionSynchronizer=new _(h,(e=>this._createCommand(e))),this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null,this._mainThreadDelegate=null,this._viewSpatialReference=null,this._renderSpatialReference=null,this._renderCoordsHelper=null,this._elevationInfo=null,this._renderCommandContext=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,baseQuery:i,url:s,objectIdField:h,capabilities:p,fieldsIndex:_,timeInfo:f,elevationInfoJSON:C,fullExtent:x}){const R=d.fromJSON(e);this._viewSpatialReference=R;const j=d.fromJSON(t);this._renderSpatialReference=j,this._fetcher=new w(this._viewSpatialReference,u.fromJSON(i),s,h,p),this._queryEngine=new m({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",objectIdField:h,fieldsIndex:_,availableFields:[h],spatialReference:e,featureStore:this._featureStore,timeInfo:f}),this._mainThreadDelegate={createTexture:async(e,t)=>{const r={data:e,parameters:t};return await this.remoteClient.invoke("createTexture",r,{transferList:[e.buffer]})},releaseTexture:async e=>{const t={uid:e};await this.remoteClient.invoke("releaseTexture",t)},createMaterial:async e=>{const t={materialJSON:e};await this.remoteClient.invoke("createMaterial",t)},destroyMaterial:async e=>{const t={materialId:e};await this.remoteClient.invoke("destroyMaterial",t)},createDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("createDirectRenderer",t)},destroyDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("destroyDirectRenderer",t)},createLodRenderer:async(e,t,r)=>{const a={rendererId:e,lodRenderGeometry:t};await this.remoteClient.invoke("createLoDRenderer",a,{transferList:r})},destroyLodRenderer:async e=>{const t={rendererId:e};await this.remoteClient.invoke("destroyLoDRenderer",t)},executeRenderCommands:async e=>{const t={commands:e.commands};await this.remoteClient.invoke("dispatchRenderCommands",t,{transferList:e.transferList})},applyElevationAlignmentTo:async e=>{const t={mapPoints:e};return await this.remoteClient.invoke("applyElevationAlignment",t,{transferList:[e.buffer]})}};const T=v.create(r,j);this._renderCoordsHelper=T;const Q=new g(r,this._mainThreadDelegate);this._renderCommandContext=Q;const E=C??{};this._elevationInfo=E,this._renderer=S(null,R,j,this._mainThreadDelegate,T,Q,E),this._defaultQueryJSON=new u({outSpatialReference:R}).toJSON();let F=null;if(null!=x){const e=o.fromJSON(x);await l(e.spatialReference,R),F=c(e,R)}return this._tileManager=new y({loadTile:(e,t)=>this._fetcher.fetch(e,t),synchronizer:this._actionSynchronizer,extent:F}),this.addHandles(a((()=>this.updating),(e=>{this.emit("notify-updating",{updating:e})})),n),null!=this._renderer&&await this._renderer.load(),D}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}async onTileTreeChange(e){return await this._tileManager.onTileTreeChange(e),D}async onElevationChange(e){return D}async onLayerOpacityChange(e){const t=this._renderer;if(null==t)return D;const r=await t.createUpdateLayerOpacityCommand(e);return await r.execute(),D}async onRendererChange(e){const{_viewSpatialReference:t,_renderSpatialReference:r,_mainThreadDelegate:a,_renderCoordsHelper:n,_renderCommandContext:i,_elevationInfo:s}=this,o=await this._createDestroyRendererCommand();await o.execute();const l=S(e,t,r,a,n,i,s);this._renderer=l,await this._renderer.load();const c=[];this._tileManager.forEachTile((e=>{c.push(l.createAddCommand(e))}));const d=await Promise.all(c),m=p.join(i,d);return await m.execute(),D}async _createDestroyRendererCommand(){const e=this._renderer;if(null==e)return p.create(this._renderCommandContext);const t=await e.createDestroyCommand();return t.appendPipelineStateCommand((()=>{x(this._renderer===e),this._renderer=null})),t}async _createAddFeatureDataCommand(e,t){const a=this._featureStore,n=this._renderer;let i;return i=null!=n?await n.createAddCommand(e):p.create(this._renderCommandContext),r(t),i.appendPipelineStateCommand((()=>{a.addTile(e)})),i}async _createRemoveFeatureDataCommand(e){const t=this._featureStore,r=this._renderer;let a;return a=null!=r?await r.createRemoveCommand(e):p.create(this._renderCommandContext),a.appendPipelineStateCommand((()=>{t.removeTile(e)})),a}async _createUpdateFeatureDataVisibilityCommand(e,t){const a=this._renderer;let n;return n=null!=a?await a.createUpdateVisibilityCommand(e):p.create(this._renderCommandContext),r(t),n}_ensureQuery(e){return e??this._defaultQueryJSON}async _createCommand(e){switch(e.type){case f.ADD:return await this._createAddFeatureDataCommand(e.data);case f.REMOVE:return await this._createRemoveFeatureDataCommand(e.data.id);case f.UPDATE_VISIBILITY:return await this._createUpdateFeatureDataVisibilityCommand(e.data)}}};e([i()],R.prototype,"updating",null),R=e([s("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],R);const j=R,D={result:void 0};export{j as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/Promise.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WorkerHandle as n}from"../../../../../core/workers/WorkerHandle.js";import a from"../../../../../geometry/Extent.js";import{clone as i}from"../../../../../geometry/support/aaBoundingRect.js";import s from"../../../../../rest/support/FeatureSet.js";import{ElevationContext as d}from"../ElevationContext.js";import{applyElevationAlignment as c}from"./utils.js";let l=class extends r{constructor(e){super(e),this.schedule=null,this._workerUpdating=!0}get updating(){return this._workerUpdating}initialize(){const{layer:e,viewSpatialReference:r,renderSpatialReference:t}=this,o=e.elevationInfo;this._elevationContext=d.fromElevationInfo(o),this._workerHandle=new u(this.schedule,{createTexture:async({data:e,parameters:r})=>({result:await this.renderer.createTexture(e,r),transferList:[]}),releaseTexture:async({uid:e})=>(await this.renderer.releaseTexture(e),y),createMaterial:async({materialJSON:e})=>(await this.renderer.createMaterial(e),y),destroyMaterial:async({materialId:e})=>(await this.renderer.destroyMaterial(e),y),createDirectRenderer:async({materialId:e})=>(await this.renderer.createDirectRenderer(e),y),destroyDirectRenderer:async({materialId:e})=>(await this.renderer.destroyDirectRenderer(e),y),createLoDRenderer:async({rendererId:e,lodRenderGeometry:r},t)=>(await this.renderer.createLoDRenderer(e,r,t?.signal??void 0),y),destroyLoDRenderer:async({rendererId:e},r)=>(await this.renderer.destroyLoDRenderer(e,r?.signal??void 0),y),dispatchRenderCommands:async({commands:e})=>(await this.renderer.executeRenderCommands(e),y),applyElevationAlignment:async({mapPoints:e})=>{const{viewSpatialReference:r,elevationProvider:t,renderCoordsHelper:o}=this,n=c(e,r,this._elevationContext,t,o);return{result:n,transferList:[n.buffer]}}}),this.addResolvingPromise((async()=>{await e.load();const{fullExtent:n}=e;await this._workerHandle.invokeMethod("setup",{url:e.parsedUrl?.path??"",baseQuery:e.createQuery().toJSON(),viewSpatialReference:r.toJSON(),renderSpatialReference:t.toJSON(),viewingMode:this.viewingMode,objectIdField:e.objectIdField,capabilities:e.capabilities,timeInfo:e.timeInfo?.toJSON(),elevationInfoJSON:o?.toJSON(),fieldsIndex:e.fieldsIndex.toJSON(),fullExtent:n?.toJSON()})})()),this.addHandles(this._workerHandle.on("notify-updating",(({updating:e})=>{this._workerUpdating=e})))}onTileTreeChange({added:e,removed:r}){if(0===e.length&&0===r.length)return;const t=e.map(p),o=r.map(p);this._workerHandle.invokeMethod("onTileTreeChange",{added:t,removed:o})}onElevationChange(e){this._workerHandle.invokeMethod("onElevationChange",{context:e.context,spatialReference:e.spatialReference?.toJSON(),extent:i(e.extent)})}onLayerOpacityChange(e){this._workerHandle.invokeMethod("onLayerOpacityChange",e)}onRendererChange(e){const r=e?.toJSON();this._workerHandle.invokeMethod("onRendererChange",r)}async executeQuery(e,r){const t=await this._workerHandle.invokeMethod("executeQuery",e?.toJSON(),r),o=s.fromJSON(t);return this._ensureLayerOnFeatures(o),o}async executeQueryForIds(e,r){return await this._workerHandle.invokeMethod("executeQueryForIds",e?.toJSON(),r)}async executeQueryForCount(e,r){return await this._workerHandle.invokeMethod("executeQueryForCount",e?.toJSON(),r)}async executeQueryForExtent(e,r){const{count:t,extent:o}=await this._workerHandle.invokeMethod("executeQueryForExtent",e?.toJSON(),r);return{count:t,extent:a.fromJSON(o)}}async executeQueryForLatestObservations(e,r){const t=await this._workerHandle.invokeMethod("executeQueryForLatestObservations",e?.toJSON(),r),o=s.fromJSON(t);return this._ensureLayerOnFeatures(o),o}_ensureLayerOnFeatures(e){const{layer:r}=this;for(const t of e.features)t.layer=r,t.sourceLayer=r}};e([t()],l.prototype,"updating",null),e([t({constructOnly:!0})],l.prototype,"schedule",void 0),e([t({constructOnly:!0})],l.prototype,"layer",void 0),e([t({constructOnly:!0})],l.prototype,"viewSpatialReference",void 0),e([t({constructOnly:!0})],l.prototype,"renderSpatialReference",void 0),e([t({constructOnly:!0})],l.prototype,"viewingMode",void 0),e([t({constructOnly:!0})],l.prototype,"renderer",void 0),e([t({constructOnly:!0})],l.prototype,"elevationProvider",void 0),e([t({constructOnly:!0})],l.prototype,"renderCoordsHelper",void 0),e([t()],l.prototype,"_workerUpdating",void 0),l=e([o("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorkerHandle")],l);class u extends n{constructor(e,r){super("Feature3DPipelineWorker","setup",{},e,{strategy:"dedicated",client:r})}}function p({id:e,lij:r,extent:t}){return{id:e,lij:r,extent:t}}const y={result:void 0};export{l as Feature3DPipelineWorkerHandle};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class e{constructor(e,n,t){this.renderCommandContext=e,this.renderCommandBuffer=n,this.pipelineStateCommands=t}append(e){this.appendRenderCommands(e.renderCommandBuffer),this.appendPipelineStateCommands(e.pipelineStateCommands)}appendRenderCommands(e){this.renderCommandBuffer.commands.push(...e.commands),this.renderCommandBuffer.transferList.push(...e.transferList)}appendPipelineStateCommand(e){this.pipelineStateCommands.push(e)}appendPipelineStateCommands(e){for(const n of e)this.appendPipelineStateCommand(n)}async execute(){for(const e of this.pipelineStateCommands)e();await this.renderCommandContext.dispatchRenderCommands(this.renderCommandBuffer)}}function n(e){if(0===e.length)return null;return e.reduce(((e,n)=>(e.append(n),e)))}export{e as PipelineCommand,n as joinCommands};
|
|
5
|
+
class e{constructor(e,n,t){this.renderCommandContext=e,this.renderCommandBuffer=n,this.pipelineStateCommands=t}append(e){this.appendRenderCommands(e.renderCommandBuffer),this.appendPipelineStateCommands(e.pipelineStateCommands)}appendRenderCommands(e){this.renderCommandBuffer.commands.push(...e.commands),this.renderCommandBuffer.transferList.push(...e.transferList)}appendPipelineStateCommand(e){this.pipelineStateCommands.push(e)}appendPipelineStateCommands(e){for(const n of e)this.appendPipelineStateCommand(n)}async execute(){for(const e of this.pipelineStateCommands)e();await this.renderCommandContext.dispatchRenderCommands(this.renderCommandBuffer)}static create(n,t=[]){return new e(n,n.createRenderCommandBuffer(),t)}static join(n,t){if(0===t.length)return e.create(n);return t.reduce(((e,n)=>(e.append(n),e)))}}function n(e){if(0===e.length)return null;return e.reduce(((e,n)=>(e.append(n),e)))}export{e as PipelineCommand,n as joinCommands};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{createTask as o}from"../../../../../core/asyncUtils.js";import has from"../../../../../core/has.js";import{throwIfAborted as s,throwIfNotAbortError as
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{createTask as o}from"../../../../../core/asyncUtils.js";import has from"../../../../../core/has.js";import{throwIfAborted as s,throwIfNotAbortError as a}from"../../../../../core/promiseUtils.js";import i from"../../../../../core/ReactiveMap.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromExtent as l,intersects as c}from"../../../../../geometry/support/aaBoundingRect.js";import{TileAction as d,TileActionType as u}from"./TileActionSynchronizer.js";import{FeatureData as f}from"./featureData/FeatureData.js";let p=class extends e{constructor(t){super(t),this._updatingCount=0,this.extent=null,this._tileHandles=new i,this._wanted=new i}destroy(){this._tileHandles.clear(),this._wanted.clear()}get updating(){return this._updatingCount>0}get _boundingRect(){const{extent:t}=this;return null==t?null:l(t)}get _missingTiles(){const t=new Array,e=this._wanted,o=this._tileHandles;for(const s of e.values())null==o.get(s.id)?.featureData&&t.push(s);return t}async onTileTreeChange(t){++this._updatingCount;try{const{added:e,removed:o}=t,s=this._tileHandles,{_boundingRect:a}=this,i=null!=a?e.filter((t=>c(a,t.extent))):e,r=this._wanted,n=new Array;for(const{id:t}of o)r.delete(t);for(const t of i)r.set(t.id,t);const l=this._missingTiles;for(const t of o){const{id:e}=t;if(l.some((e=>h(e,t)||h(t,e))))continue;const o=s.get(e);null!=o&&n.push(this._removeTile(o))}for(const t of i)n.push(this._addTile(t));const d=await Promise.allSettled(n);for(const t of d)"rejected"===t.status&&console.error(t.reason)}finally{--this._updatingCount}}forEachTile(t){for(const e of this._tileHandles.values()){const o=e.featureData;null!=o&&t(o)}}async _removeTile(t){t.loadTask.abort(),this._tileHandles.delete(t.id),this._validate();const{featureData:e}=t;null!=e&&await this.synchronizer.enqueueActions([new d(t.id,u.REMOVE,e)])}async _addTile(t){const{_tileHandles:e}=this,i=e.get(t.id);if(null!=i){if(!_(i)||i.featureData.isFullyEnabled)return;return i.featureData.enableAll(),void await this._onTileLoad(i)}const r=new m(t,o((async e=>{const o=await this.loadTile(t,e);return s(e),new f(o)})));this._tileHandles.set(r.id,r);try{await r.loadTask.promise}catch(n){return void a(n)}w(r),await this._onTileLoad(r)}async _onTileLoad(t){const{_wanted:e,_tileHandles:o,_missingTiles:s}=this,a=t.descriptor,i=new Array,r=new Set;for(const n of o.values()){if(n===t)continue;const{descriptor:l,id:c}=n;if(e.has(c)||s.some((t=>h(t,l)||h(l,t)))){if(_(n)){if(h(a,l)){const t=n.featureData;for(const e of t.objectIds())r.add(e)}if(h(l,a)){const e=t.featureData,o=new Set(e.objectIds()),{featureData:s}=n;s.disableObjectIds(o),i.push(new d(c,u.UPDATE_VISIBILITY,s)),this._validateRemoval(s,o)}}}else{o.delete(c),n.loadTask.abort();const{featureData:t}=n;null!=t&&i.push(new d(c,u.REMOVE,t))}}r.size>0&&(t.featureData.disableObjectIds(r),this._validateRemoval(t.featureData,r)),this._validate(),i.push(new d(t.id,u.ADD,t.featureData)),await this.synchronizer.enqueueActions(i)}_validate(){if(!has("feature-pipeline-3d-test-validation"))return;const t=new Array;for(const e of this._tileHandles.values()){if(!_(e))continue;const{featureData:o}=e;t.push({featureData:o,objectIds:new Set(o.enabledObjectIds())})}for(let e=0;e<t.length;++e){const{featureData:o,objectIds:s}=t[e];for(let a=e+1;a<t.length;++a){const{featureData:e,objectIds:i}=t[a];for(const t of i)if(s.has(t))throw new Error(`${o.id} and ${e.id} both contain ${t}.`)}}}_validateRemoval(t,e){if(has("feature-pipeline-3d-test-validation"))for(const o of t.enabledObjectIds())if(e.has(o))throw new Error(`Failed to remove ${o} from ${t.id}!`)}};function h({lij:[t,e,o]},{lij:[s,a,i]}){const r=s-t;return r>=0&&e===a>>r&&o===i>>r}t([r()],p.prototype,"updating",null),t([r({constructOnly:!0})],p.prototype,"loadTile",void 0),t([r({constructOnly:!0})],p.prototype,"synchronizer",void 0),t([r()],p.prototype,"_updatingCount",void 0),t([r()],p.prototype,"extent",void 0),t([r()],p.prototype,"_boundingRect",null),t([r()],p.prototype,"_missingTiles",null),p=t([n("esri.views.3d.layers.graphics.pipeline.Tile3DManager")],p);class m{constructor(t,e){this.descriptor=t,this.loadTask=e}get id(){return this.descriptor.id}get featureData(){return this.loadTask.value}}function _(t){return null!=t.featureData}function w(t){if(!_(t))throw new Error}export{p as Tile3DManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../../chunks/tslib.es6.js";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{createAbortError as t}from"../../../../../../core/promiseUtils.js";import{property as s}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as
|
|
5
|
+
import{_ as e}from"../../../../../../chunks/tslib.es6.js";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{createAbortError as t}from"../../../../../../core/promiseUtils.js";import{property as s}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as n}from"../../../../../ViewingMode.js";import{DirectRenderer as o}from"./DirectRenderer.js";import{LodRenderer as l}from"./LodRenderer.js";import{CullFaceOptions as c}from"../../../../webgl-engine/lib/basicInterfaces.js";import{Texture as u}from"../../../../webgl-engine/lib/Texture.js";import{DefaultMaterial as m}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as h}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as f}from"../../../../webgl-engine/materials/pbrUtils.js";let p=class extends r{constructor(e){super(),this.view=null,this.layerViewUid=null,this._stage=null,this._materials=new Map,this._textures=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerViewUid=e.layerViewUid}initialize(){this._stage=this.view.stage}destroy(){this.removeAllHandles(),this._lodRenderers.forEach((e=>e.destroy()))}async createTexture(e,r){const{_textures:t,_stage:s}=this,i=new u(e,r);return t.set(i.id,i),s&&(i.load(s.renderView.renderingContext),s.add(i)),i.id}async releaseTexture(e){const{_textures:r,_stage:t}=this,s=r.get(e);s&&(t&&(s.unload(),t.remove(s)),r.delete(e))}_destroyTexture(e){const{_textures:r,_stage:t}=this,s=r.get(e);s&&(t&&(s.unload(),t.remove(s)),r.delete(e))}async createMaterial(e){const{view:r}=this,t=r.state.viewingMode===n.Global;let s=null;switch(e.type){case"default":{const r=e.parameters,i=new m(r,{spherical:t});i.setParameters({cullFace:i.transparent?c.None:c.Back}),s=i;break}case"hud":{const r=e.parameters;s=new h(r,t)}}this._materials.set(e.materialId,s)}async destroyMaterial(e){this._materials.delete(e)}async updateMaterial(e){}async createDirectRenderer(e){if(this._directRenderers.has(e))return;const r=this._materials.get(e);if(null==r)throw new Error(`material not found ${e}`);const{view:t}=this,s=new o({material:r,layerViewUid:this.layerViewUid});this._directRenderers.set(e,s),t.stage.addRenderPlugin(s),t.stage.renderView.renderer.updateHasFlags()}async destroyDirectRenderer(e){const r=this._directRenderers.get(e);if(null==r)return;const t=this.view;t.stage.removeRenderPlugin(r),this._directRenderers.delete(e),t.stage.renderView.renderer.updateHasFlags()}async createLoDRenderer(e,r,s){const i=new l({view:this.view,layerViewUid:this.layerViewUid}),a=e=>this._materials.get(e);if(await i.doLoad(r,a,s),s?.aborted)throw i.destroy(),t();this._lodRenderers.set(e,i)}async destroyLoDRenderer(e,r){const t=this._lodRenderers.get(e);null!=t&&(t.destroy(),this._lodRenderers.delete(e))}_destroyLodRenderer({rendererId:e}){const r=this._lodRenderers.get(e);null!=r&&(r.destroy(),this._lodRenderers.delete(e))}async executeRenderCommands(e){for(const r of e)switch(r.id){case"destroy-texture":this._destroyTexture(r.textureId);break;case"update-material":this._updateMaterial(r);break;case"destroy-material":this._destroyMaterial(r);break;case"add-direct-renderer-geometry-buffer":this._addDirectRendererGeometryBuffer(r);break;case"update-direct-renderer-geometry-buffer":this._updateDirectRendererGeometryBuffer(r);break;case"remove-direct-renderer-geometry-buffer":this._removeDirectRendererGeometryBuffer(r);break;case"destroy-lod-renderer":this._destroyLodRenderer(r);break;case"add-lod-instances":this._addLodInstances(r);break;case"remove-lod-instances":this._removeLodInstances(r);break;case"update-lod-instance-data":this._updateLodInstanceData(r);break;case"update-visibility":this._updateVisibility(r)}e.length>0&&this._updateFeatureCount()}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}_updateMaterial({materialId:e,parameters:r}){const t=this._materials.get(e);null!=t?t.setParameters(r):console.error("material not found")}_destroyMaterial({materialId:e}){null!=this._materials.get(e)?this._materials.delete(e):console.error("material not found")}_addDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const a=this._directRenderers.get(r);null!=a?(a.addRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_updateDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const a=this._directRenderers.get(r);null!=a?(a.updateRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_removeDirectRendererGeometryBuffer({groupId:e,rendererId:r}){const t=this._directRenderers.get(r);null!=t?(t.removeRenderGeometryBuffer(e),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_addLodInstances({rendererId:e,groupId:r,data:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("no lod renderer assigned to provided lod renderer Id");s.addInstances(r,t),this.view.stage.renderView.requestRender()}_removeLodInstances({rendererId:e,groupId:r}){const t=this._lodRenderers.get(e);if(null==t)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(r),this.view.stage.renderView.requestRender()}_updateLodInstanceData({rendererId:e,groupId:r,globalTransforms:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");null!=t&&s.updateGlobalTransforms(r,t),this.view.stage.renderView.requestRender()}_updateVisibility({rendererId:e,groupId:r,visibility:t}){const s=this._directRenderers.get(e)??this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");s.updateVisibility(r,t),this.view.stage.renderView.requestRender()}};function g(e,r,t){const s={usePBR:r.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:f,ambient:a,diffuse:a,hasSlicePlane:r.slicePlaneEnabled,castShadows:r.castShadows,offsetTransparentBackfaces:!r.isPrimitive};r.screenSizePerspectiveEnabled&&(s.screenSizePerspective=e.screenSizePerspectiveSettings),s.externalColor=d,s.isInstanced=!0;const i=new m(s,{spherical:t});return i.setParameters({cullFace:i.transparent?c.None:c.Back}),i}e([s({readOnly:!0})],p.prototype,"totalFeatures",void 0),p=e([i("esri.views.3d.layers.graphics.pipeline.rendering.FeaturePipelineRenderManager")],p);export{p as FeaturePipelineRenderManager,g as createDefaultMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{copy as e,invert as r,transpose as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{getContinuousIndexArray as a}from"../../../../../../geometry/support/Indices.js";import{ViewingMode as i}from"../../../../../ViewingMode.js";import{
|
|
5
|
+
import{copy as e,invert as r,transpose as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{getContinuousIndexArray as a}from"../../../../../../geometry/support/Indices.js";import{ViewingMode as i}from"../../../../../ViewingMode.js";import{PipelineCommand as s}from"../PipelineCommand.js";import{generateId as o}from"../utils.js";import{BoundingInfo as d}from"../../../../webgl-engine/lib/BoundingInfo.js";import{VertexAttribute as m}from"../../../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as f}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as u}from"../../../../webgl-engine/materials/HUDMaterial.js";class l{constructor(e,r){this._mainThreadDelegate=r,this._bufferWriters=new Map,this._sharedTextures=new Map,this.globalViewingMode=e===i.Global}createRenderCommandBuffer(e=[],r=[]){return{commands:e,transferList:r}}mergeRenderCommandBuffers(e){const r=this.createRenderCommandBuffer();for(const t of e)null!=t&&(r.commands.push(...t.commands),r.transferList.push(...t.transferList));return r}async getOrCreateSharedTexture(e,r){const{data:t,parameters:n}=r(),a=await this._mainThreadDelegate.createTexture(t,n);return this._sharedTextures.set(e,a),a}async releaseSharedTexture(e){const r=this._sharedTextures,t=r.get(e);if(null==t)return s.create(this);const n=this._destroyTexture(t);return new s(this,n,[()=>r.delete(e)])}_destroyTexture(e){return{commands:[{id:"destroy-texture",textureId:e}],transferList:[]}}async createMaterial(e){const{type:r,parameters:t}=e,n=o("material");let a,i;switch(r){case"default":a=new f(e.parameters,{spherical:this.globalViewingMode}),i={type:r,materialId:n,parameters:e.parameters};break;case"hud":a=new u(t,this.globalViewingMode),i={type:r,materialId:n,parameters:e.parameters}}return this._bufferWriters.set(n,a.createBufferWriter()),await this._mainThreadDelegate.createMaterial(i),n}destroyMaterial(e){return{commands:[{id:"destroy-material",materialId:e}],transferList:[]}}updateMaterial(e){return{commands:[{...e,id:"update-material"}],transferList:[]}}async createDirectRenderer(e){return await this._mainThreadDelegate.createDirectRenderer(e),e}async destroyDirectRenderer(e){await this._mainThreadDelegate.destroyDirectRenderer(e)}addDirectRendererGeometry(e,r,t){const{materialId:n}=r;if(null==this._bufferWriters.get(n))throw new Error(`no bufferwriter found for material ${n}`);const{renderGeometryBuffer:a,renderGeometryBufferItems:i}=this.createRenderGeometryBuffer(r,t);return this.addDirectRendererGeometryBuffer(n,e,a,i,t)}updateDirectRendererGeometry(e,r,t){const{materialId:n}=r;if(null==this._bufferWriters.get(n))throw new Error(`no bufferwriter found for material ${n}`);const{renderGeometryBuffer:a,renderGeometryBufferItems:i}=this.createRenderGeometryBuffer(r,t);return this.updateDirectRendererGeometryBuffer(n,e,a,i,t)}addDirectRendererGeometryBuffer(e,r,t,n,a){const{objectIds:i,visibilities:s}=n;return{commands:[{id:"add-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:a}],transferList:[t.data,i.buffer,s.buffer]}}updateDirectRendererGeometryBuffer(e,r,t,n,a){const{objectIds:i,visibilities:s}=n;return{commands:[{id:"update-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:a}],transferList:[t.data,i.buffer,s.buffer]}}removeDirectRendererGeometryBuffer(e,r){return{commands:[{id:"remove-direct-renderer-geometry-buffer",rendererId:e,groupId:r}],transferList:[]}}async createLodRenderer(e){const r=o("lod-renderer"),t=new Set,n={levels:e.levels.map((e=>({components:e.components.map((e=>{const r=e.attributes.get(m.POSITION);if(!r||0===r.indices.length)throw new Error("positions attribute expected");const n=3,i=a(r.indices.length/n),s=new d(i,n,r);if(null==this._bufferWriters.get(e.materialId))throw new Error("writer not found");const{renderGeometryBuffer:o}=this.createRenderGeometryBuffer(e,null);t.add(o.data);return{materialId:e.materialId,renderGeometryBuffer:o,boundingInfo:{bbMax:s.bbMax,bbMin:s.bbMin}}})),minScreenSpaceRadius:e.minScreenSpaceRadius})))};return await this._mainThreadDelegate.createLodRenderer(r,n,Array.from(t)),r}destroyLodRenderer(e){return{commands:[{id:"destroy-lod-renderer",rendererId:e}],transferList:[]}}addLodInstances(e,r,t){return{commands:[{id:"add-lod-instances",rendererId:e,groupId:r,data:t}],transferList:[t.featureIds.buffer,t.globalTransforms.buffer,t.localTransforms.buffer,t.visibility.buffer]}}removeLodInstances(e,r){return{commands:[{id:"remove-lod-instances",rendererId:e,groupId:r}],transferList:[]}}updateLodInstancesData(e,r,t){return{commands:[{id:"update-lod-instance-data",rendererId:e,groupId:r,globalTransforms:t}],transferList:[t.buffer]}}updateVisibility(e,r,t){return{commands:[{id:"update-visibility",rendererId:e,groupId:r,visibility:t}],transferList:[t.buffer]}}async dispatchRenderCommands(e){0!==e.commands.length&&await this._mainThreadDelegate.executeRenderCommands(e)}createRenderGeometryBuffer(n,a){const{materialId:i,visibilities:s,objectIds:o}=n,d=this._bufferWriters.get(i);if(null==d)throw new Error("no registered bufferWriter for material found");let m=null;if(n.transformation&&a)e(c,n.transformation),c[12]-=a[0],c[13]-=a[1],c[14]-=a[2],m=c;else{if(a)throw new Error("not implemented");n.transformation&&(m=n.transformation)}let f=null;m&&(r(b,c),t(b,b),f=b);const u=n.attributes,l=d.elementCount(u),g=d.vertexBufferLayout.stride/4;l>Math.floor(h/g)&&console.warn("geometry with very large number of elements encountered");const p=d.vertexBufferLayout.createBuffer(l),y=0,I=d.write(m,f,u,n.objectAndLayerIdColor,p,y);if(null==I)throw new Error("Bufferwriter.write does not provide item information.");if(s.length!==I.numItems||o.length!==I.numItems)throw new Error("Unexpected mismatch between number of RenderGeometryBufferItems and provided objectIds/visibility flags.");return{renderGeometryBuffer:{data:p.buffer,elementCount:l},renderGeometryBufferItems:{objectIds:o,visibilities:s,ranges:{numVertices:I.numVerticesPerItem,numItems:I.numItems}}}}}const c=n(),b=n(),h=16777216/4;export{l as RenderCommandContext};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{SimpleFeatureRenderer as e}from"./SimpleFeatureRenderer.js";import{UniqueValueFeatureRenderer as r}from"./UniqueValueFeatureRenderer.js";function n(a,i,o,l,d,p,u){const m=a?.type;if(null==m)return n(t,i,o,l,d,p,u);switch(m){case"simple":return new e({viewSpatialReference:i,renderSpatialReference:o,renderCoordsHelper:d,renderCommandContext:p,elevationInfo:u,mainThreadDelegate:l});case"uniqueValue":return new r({viewSpatialReference:i,renderSpatialReference:o,renderCoordsHelper:d,renderCommandContext:p,elevationInfo:u,mainThreadDelegate:l});default:return n(t,i,o,l,d,p,u)}}const t={type:"simple"};export{n as createFeatureRendererFromJSON};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{PipelineCommand as e}from"../PipelineCommand.js";import{TestSymbol as t}from"./TestSymbol.js";class a{constructor(e){this._symbol=null,this._featureData=new Map,this._context=e}async load(){this._symbol=new t(this._context)}async createAddCommand(t){const a=this._context.renderCommandContext,n=await this._provisionSymbol(),o=null==n?a.createRenderCommandBuffer():await n.createAddCommand(t);return new e(a,o,[()=>this._featureData.set(t.id,t)])}async createRemoveCommand(t){const a=this._context.renderCommandContext,n=await this._provisionSymbol(),o=null==n?a.createRenderCommandBuffer():await n.createRemoveCommand(t);return new e(a,o,[()=>this._featureData.delete(t)])}async createUpdateVisibilityCommand(t){const a=this._context.renderCommandContext,n=await this._provisionSymbol(),o=null==n?a.createRenderCommandBuffer():await n.createUpdateVisibilityCommand(t);return new e(a,o,[])}async createUpdateLayerOpacityCommand(t){const a=this._context.renderCommandContext,n=await this._provisionSymbol(),o=null==n?a.createRenderCommandBuffer():await n.createUpdateLayerOpacityCommand(t);return new e(a,o,[])}async createUpdateElevationCommand(){const{_featureData:t,_context:a}=this,n=a.renderCommandContext,o=await this._provisionSymbol();if(null==o)return e.create(n);const r=[];for(const e of t.values())r.push(o.createUpdateElevationCommand(e));const m=await Promise.all(r);return new e(n,n.mergeRenderCommandBuffers(m),[])}async createDestroyCommand(){const{_symbol:t,_context:a,_featureData:n}=this,o=a.renderCommandContext;if(!t)return e.create(o);const r=[];for(const e of n.keys())r.push(this.createRemoveCommand(e));r.push(t.createDestroyCommand());const m=await Promise.all(r);return e.join(o,m)}async _provisionSymbol(){const e=this._symbol;return e?(e.loaded||await e.load(),e):null}}export{a as SimpleFeatureRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{identity as e,scale as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as a,create as i,ONES as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as s}from"../../../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as l,size as d}from"../../../../../../geometry/support/aaBoundingBox.js";import{objectSymbolLayerPrimitiveBoundingBox as
|
|
5
|
+
import{identity as e,scale as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as a,create as i,ONES as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as s}from"../../../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as l,size as d}from"../../../../../../geometry/support/aaBoundingBox.js";import{objectSymbolLayerPrimitiveBoundingBox as m,objectSymbolLayerSizeWithResourceSize as c}from"../../../../../../symbols/support/symbolLayerUtils3D.js";import{computeObjectScale as p}from"../../graphicUtils.js";import{PipelineCommand as f}from"../PipelineCommand.js";import{readMapCoordinates as u,readObjectIds as h}from"../featureData/processingUtils.js";import{createPrimitiveGeometry as _}from"./primitiveObjectUtils.js";import{schematicMRRFactors as y}from"../../../../webgl-engine/materials/pbrUtils.js";class C{constructor(e){this._context=e,this._loaded=!1,this._loadingPromise=null,this._primitive="cone",this._primitiveMaterialId=null,this._lodRendererId=null}_destroy(){this._lodRendererId=null,this._primitiveMaterialId=null}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const e=this._context.renderCommandContext,t={physicalBasedRenderingEnabled:!0,slicePlaneEnabled:!1,castShadows:!0,isPrimitive:!0,screenSizePerspectiveEnabled:!0},r={usePBR:t.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:y,ambient:n,diffuse:n,hasSlicePlane:t.slicePlaneEnabled,castShadows:t.castShadows,offsetTransparentBackfaces:!1,screenSizePerspective:{}};r.externalColor=o,r.isInstanced=!0;const a=await e.createMaterial({type:"default",parameters:r}),i=_(this._primitive,a);this._lodRendererId=await e.createLodRenderer(i),this._primitiveMaterialId=a,this._loaded=!0}async createDestroyCommand(){const{_lodRendererId:e,_primitiveMaterialId:t,_context:r}=this,a=r.renderCommandContext,i=[];return null!=e&&i.push(a.destroyLodRenderer(e)),null!=t&&i.push(a.destroyMaterial(t)),new f(a,a.mergeRenderCommandBuffers(i),[()=>this._destroy()])}async createAddCommand(e){const t=this._context,{renderCommandContext:r,mainThreadDelegate:i}=t;if(null==this._lodRendererId)throw new Error("expected lod renderer id to not be null");const{featureCount:n}=e;if(0===n)return r.createRenderCommandBuffer();const o=!0,s=l(m(this._primitive)),p=a(d(s)),f=a(c(p,{isPrimitive:o,width:100,depth:null,height:null})),_=new Float64Array(16*n),y=new Float64Array(16*n),C=u(e),x=await i.applyElevationAlignmentTo(C);for(let a=0;a<n;++a){const e=a,t=x[3*a+0],r=x[3*a+1],i=x[3*a+2],n=this._computeGlobalTransform(t,r,i,this._context.viewSpatialReference,b),o=this._computeLocalTransform(f,p,g);this._writeMatrixToTypedBuffer(_,e,o),this._writeMatrixToTypedBuffer(y,e,n)}const R=h(e),w=new Uint8Array(n);e.getVisibilityArray(w);const v={featureIds:new Uint32Array(R),visibility:w,localTransforms:_,globalTransforms:y};return r.addLodInstances(this._lodRendererId,e.id,v)}async createRemoveCommand(e){const{_context:t,_lodRendererId:r}=this,a=t.renderCommandContext;return null==r?a.createRenderCommandBuffer():a.removeLodInstances(r,e)}async createUpdateVisibilityCommand(e){const{_lodRendererId:t,_context:r}=this,a=r.renderCommandContext;if(null==t)return a.createRenderCommandBuffer();const i=new Uint8Array(e.featureCount);return e.getVisibilityArray(i),a.updateVisibility(t,e.id,i)}async createUpdateLayerOpacityCommand(e){const{_context:t}=this,r=t.renderCommandContext,a=this._primitiveMaterialId;return null==a?r.createRenderCommandBuffer():r.updateMaterial({type:"default",materialId:a,parameters:{opacity:e}})}async createUpdateElevationCommand(e){const{_context:t,_lodRendererId:r}=this,{renderCommandContext:a,mainThreadDelegate:i}=t,{featureCount:n,id:o}=e;if(null==r||0===n)return a.createRenderCommandBuffer();const s=new Float64Array(16*n),l=u(e),d=await i.applyElevationAlignmentTo(l);for(let m=0;m<n;++m){const e=m,t=d[3*m+0],r=d[3*m+1],a=d[3*m+2],i=this._computeGlobalTransform(t,r,a,this._context.viewSpatialReference,b);this._writeMatrixToTypedBuffer(s,e,i)}return a.updateLodInstancesData(r,o,s)}_writeMatrixToTypedBuffer(e,t,r){let a=16*t;for(let i=0;i<16;i++)e[a++]=r[i]}_computeGlobalTransform(e,t,r,a,i){return x[0]=e,x[1]=t,x[2]=r,s(a,x,i,this._context.renderSpatialReference),i}_computeLocalTransform(t,r,a){return e(a),this._applyObjectScale(t,r,a),a}_applyObjectScale(e,r,a){const i=p(e,e,r,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||t(a,a,i)}}const x=i(),g=r(),b=r();export{C as TestObjectSymbol};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{namedAnchorToHUDMaterialAnchorPos as t}from"../../placementUtils.js";import{PipelineCommand as r}from"../PipelineCommand.js";import{computeTileCenterRenderCoordinates as n,readObjectIds as a,readMapCoordinates as i,projectToRenderCoordinates as o}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as l}from"./symbolizationUtils.js";import{createTextureInfo as s,defaultBoundingBox as d,requiresHalfTexelOffset as c}from"../../../../support/engineContent/sdfPrimitives.js";import{Attribute as m}from"../../../../webgl-engine/lib/Attribute.js";import{VertexAttribute as u}from"../../../../webgl-engine/lib/VertexAttribute.js";class y{constructor(e){this._context=e,this.materialId=null,this._loaded=!1,this._loadingPromise=null,this._iconTextureID=null}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}_destroy(){this._iconTextureID=null}async _load(){const e=this._context.renderCommandContext,r=await e.getOrCreateSharedTexture("circle-icon",(()=>s("circle")));this._iconTextureID=r;const n={anchorPosition:t.center,occlusionTest:!0,hasSlicePlane:!1,color:[1,0,0,1],outlineColor:[0,0,0,1],outlineSize:1,distanceFieldBoundingBox:d,textureId:r,textureIsSignedDistanceField:!0,sampleSignedDistanceFieldTexelCenter:c("circle")};this.materialId=await e.createMaterial({type:"hud",parameters:n}),await e.createDirectRenderer(this.materialId),this._loaded=!0}async createAddCommand(e){const{materialId:t,_context:r}=this,{renderCommandContext:a}=r;if(null==t)throw new Error("expected material not to be null");const i=await this._createGeometry(e);if(null==i)return a.createRenderCommandBuffer();const o=n(e,r);return a.addDirectRendererGeometry(e.id,i,o)}async _createGeometry(t){const{materialId:r,_context:n}=this,{mainThreadDelegate:s}=n,{featureCount:d}=t;if(0===d||null==r)return null;const c=a(t),y=i(t),C=await s.applyElevationAlignmentTo(y),f=o(C,n),h=new Float64Array([0,0,1]),x=new Float64Array([255,255,255,255]),p=new Float64Array([24,24]),w=new Float64Array([0,0,0,1]),_=new Float64Array([0,0]),I=new Float64Array([0]),A=new Uint32Array(d);for(let e=0;e<d;++e)A[e]=e;const g=new Uint32Array(d);for(let e=0;e<d;++e)g[e]=0;const b=new m(f,A,3,!0),T=new m(h,g,3,!0),D=new m(_,g,2,!0),R=new m(x,g,4,!0),F=new m(I,g,1,!0),S=new m(p,g,2,!0),U=new m(w,g,4,!0),j=[[u.POSITION,b],[u.NORMAL,T],[u.UV0,D],[u.COLOR,R],[u.ROTATION,F],[u.SIZE,S],[u.CENTEROFFSETANDDISTANCE,U]],O=new Uint8Array(d);t.getVisibilityArray(O);return{attributes:l(j),objectAndLayerIdColor:void 0,transformation:e(),materialId:r,objectIds:c,visibilities:O}}async createRemoveCommand(e){const{materialId:t,_context:r}=this,n=r.renderCommandContext;return null==t?n.createRenderCommandBuffer():n.removeDirectRendererGeometryBuffer(t,e)}async createUpdateVisibilityCommand(e){const{materialId:t,_context:r}=this,n=r.renderCommandContext;if(null==t)return n.createRenderCommandBuffer();const a=new Uint8Array(e.featureCount);return e.getVisibilityArray(a),n.updateVisibility(t,e.id,a)}async createUpdateLayerOpacityCommand(e){const{_context:t}=this;return t.renderCommandContext.createRenderCommandBuffer()}async createUpdateElevationCommand(e){const{materialId:t,_context:r}=this,{renderCommandContext:a}=r,{featureCount:i,id:o}=e;if(null==t||0===i)return a.createRenderCommandBuffer();const l=await this._createGeometry(e);if(null==l)return a.createRenderCommandBuffer();const s=n(e,r);return a.updateDirectRendererGeometry(o,l,s)}async createDestroyCommand(){const{_iconTextureID:e,_context:t}=this,n=t.renderCommandContext;let a;return a=null!=e?await n.releaseSharedTexture("circle-icon"):r.create(n),a.appendPipelineStateCommand((()=>this._destroy())),a}}export{y as TestSymbol};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{PipelineCommand as e}from"../PipelineCommand.js";import{readObjectIds as t}from"../featureData/processingUtils.js";import{TestObjectSymbol as n}from"./TestObjectSymbol.js";import{TestSymbol as a}from"./TestSymbol.js";class
|
|
5
|
+
import{PipelineCommand as e}from"../PipelineCommand.js";import{readObjectIds as t}from"../featureData/processingUtils.js";import{TestObjectSymbol as n}from"./TestObjectSymbol.js";import{TestSymbol as a}from"./TestSymbol.js";class o{constructor(e){this._symbols=new Array,this._featureDataPartitioning=new Map,this._context=e}async load(){this._symbols[0]=new a(this._context),this._symbols[1]=new n(this._context)}async createAddCommand(t){const n=this._partition(t),a=await Promise.all(n.map((async({index:e,features:t})=>{const n=await this._provisionSymbol(e);return await(n?.createAddCommand(t))}))),o=this._context.renderCommandContext;return new e(o,o.mergeRenderCommandBuffers(a),[()=>this._featureDataPartitioning.set(t.id,n)])}async createRemoveCommand(t){const{_featureDataPartitioning:n,_context:a}=this,o=a.renderCommandContext,r=n.get(t);if(null==r)return new e(o,o.createRenderCommandBuffer(),[]);const s=await Promise.all(r.map((async({index:e,features:t})=>{const n=this._getLoadedSymbol(e);return await(n?.createRemoveCommand(t.id))})));return new e(o,o.mergeRenderCommandBuffers(s),[()=>n.delete(t)])}async createUpdateVisibilityCommand(t){const{_featureDataPartitioning:n,_context:a}=this,o=a.renderCommandContext,r=n.get(t.id);if(null==r)return new e(o,o.createRenderCommandBuffer(),[]);const s=await Promise.all(r.map((async({index:e,features:t})=>{const n=this._getLoadedSymbol(e);return await(n?.createUpdateVisibilityCommand(t))})));return new e(o,o.mergeRenderCommandBuffers(s),[])}async createUpdateLayerOpacityCommand(t){const n=this._context.renderCommandContext,a=[];for(let e=0;e<this._symbols.length;++e){const n=this._symbols[e];null!=n&&n.loaded&&a.push(n.createUpdateLayerOpacityCommand(t))}const o=await Promise.all(a);return new e(n,n.mergeRenderCommandBuffers(o),[])}async createUpdateElevationCommand(){const{_featureDataPartitioning:t,_context:n}=this,a=n.renderCommandContext,o=[];for(const e of t.values()){const t=e.map((async({index:e,features:t})=>{const n=this._getLoadedSymbol(e);return await(n?.createUpdateElevationCommand(t))}));o.push(...t)}const r=await Promise.all(o);return new e(a,a.mergeRenderCommandBuffers(r),[])}async createDestroyCommand(){const{_featureDataPartitioning:t,_context:n}=this,a=n.renderCommandContext,o=[];for(const e of t.keys())o.push(this.createRemoveCommand(e));for(const e of this._symbols)o.push(e.createDestroyCommand());const r=await Promise.all(o);return e.join(a,r)}async _provisionSymbol(e){if(null==e)return null;const t=this._symbols[e];return t?(t.loaded||await t.load(),t):null}_getLoadedSymbol(e){if(null==e)return null;const t=this._symbols[e];return null!=t&&t.loaded?t:null}_partition(e){const n=t(e);if(null==n)throw new Error("unable to fetch objectIds");const{featureCount:a}=e,o=[[],[]];for(let t=0;t<a;++t){o[n[t]%2].push(t)}return o.map(((t,n)=>new r(n,e.subset(new Uint32Array(t))))).filter((e=>e.features.featureCount>0))}}class r{constructor(e,t){this.index=e,this.features=t}}export{o as UniqueValueFeatureRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{destroyHandle as o,makeHandle as i}from"../../../../core/handleUtils.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{abortMaybe as r,destroyMaybe as n}from"../../../../core/maybe.js";import{debounce as a}from"../../../../core/promiseUtils.js";import{initial as l,watch as d,syncAndInitial as c}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as p}from"../../../../core/unitUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as _}from"../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/mat2df64.js";import{set as g,transformMat2d as y}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{ControlPointOperations as T}from"../../interactive/editingTools/media/ControlPointOperations.js";import{ViewEventPriorities as b}from"../../../input/InputManager.js";import{mediaKeys as j,KeyBindings as w}from"../../../interactive/keybindings.js";import{acquire as E}from"../../../interactive/snapping/SnappingManagerPool.js";const O=Symbol(),P=Symbol(),S=1,M=10;let H=class extends t{get editSourcePoints(){return!!this.options?.reshapeOptions.editSourcePoints!==this._isEditSourcePointsToggled}get updating(){return this._updatingHandles.updating}get _preferredInteractionTool(){return this.options?.tool??"transform"}get _toolType(){switch(this._preferredInteractionTool){case"transform":return"transform-3d";case"reshape":return"reshape-3d"}}get _validatedSelectedElement(){const e=this.selectedElement;if(!e)return null;const{layer:{source:t}}=this;return t?"hasElement"in t?t.hasElement(e)?e:null:t===e?e:null:null}constructor(e){super(e),this.enabled=!1,this._isEditSourcePointsToggled=!1,this._updatingHandles=new v,this._isOpacityToggled=!1,this._factor=S,this._tool=null,this._object=null,this._createToolAbortController=null,this._onPointerMove=a((async e=>{const t=await this._updatingHandles.addPromise(this._findElementAtScreenPoint(e));this.destroyed||(this.removeHandles(P),t&&t!==this.selectedElement&&(this.view.cursor="pointer",this.addHandles(i((()=>this.view.cursor=null)),P)))})),this._tmpMat2=u(),this._tmpVec2=f()}destroy(){this._createToolAbortController=r(this._createToolAbortController)}initialize(){this.addHandles([o(this._updatingHandles),this._updatingHandles.add((()=>this.enabled),(e=>this._enableDisable(e)),l),this._updatingHandles.add((()=>this._preferredInteractionTool),(e=>this._preferredInteractionToolChanged(e)))])}_enableDisable(e){if(!e)return void this.removeHandles(O);this._dynamicImports();const{view:t}=this,o=new w;o.add(j.undo,(()=>{this._object?.operations?.undo(),this._object?.emit("modified-externally")})),o.add(j.redo,(()=>{this._object?.operations?.redo(),this._object?.emit("modified-externally")})),o.addToggle(j.preserveAspectRatio,(e=>{"transform-3d"===this._tool?.type&&(this._tool.preserveAspectRatio="key-down"===e.type)})),o.addToggle(j.editSourcePoints,(e=>{"reshape-3d"===this._tool?.type&&(this._isEditSourcePointsToggled="key-down"===e.type)})),o.addToggle(j.rotateIncrements,(e=>{"transform-3d"===this._tool?.type&&(this._tool.snapRotation="key-down"===e.type)})),o.add(j.toggleOpacity,(()=>{const e=this._object?.element;e&&(e.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)})),o.add(j.moveUp,(()=>this._move(0,this._factor))),o.add(j.moveDown,(()=>this._move(0,-this._factor))),o.add(j.moveRight,(()=>this._move(this._factor,0))),o.add(j.moveLeft,(()=>this._move(-this._factor,0))),o.addToggle(j.factorModifier,(e=>this._factor="key-down"===e.type?M:S)),this._isOpacityToggled=!1,this.addHandles([o.register(t,b.TOOL),i((()=>{this._isOpacityToggled&&this.selectedElement&&(this.selectedElement.opacity*=2,this._isOpacityToggled=!1)})),t.on("immediate-click",(e=>this._onClick(e)),b.TOOL),t.on("pointer-move",(e=>this._onPointerMove(e).catch((()=>{}))),b.TOOL),this._updatingHandles.add((()=>this._validatedSelectedElement),((e,t)=>{t&&e!==t&&this._isOpacityToggled&&(t.opacity*=2,this._isOpacityToggled=!1),this._selectedElementChanged(e)}),l),i((()=>{t.cursor=null,this._removeTool()}))],O)}async _onClick(e){await this._updatingHandles.addPromise(e.
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{destroyHandle as o,makeHandle as i}from"../../../../core/handleUtils.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{abortMaybe as r,destroyMaybe as n}from"../../../../core/maybe.js";import{debounce as a}from"../../../../core/promiseUtils.js";import{initial as l,watch as d,syncAndInitial as c}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as p}from"../../../../core/unitUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as _}from"../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/mat2df64.js";import{set as g,transformMat2d as y}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{ControlPointOperations as T}from"../../interactive/editingTools/media/ControlPointOperations.js";import{ViewEventPriorities as b}from"../../../input/InputManager.js";import{mediaKeys as j,KeyBindings as w}from"../../../interactive/keybindings.js";import{acquire as E}from"../../../interactive/snapping/SnappingManagerPool.js";const O=Symbol(),P=Symbol(),S=1,M=10;let H=class extends t{get editSourcePoints(){return!!this.options?.reshapeOptions.editSourcePoints!==this._isEditSourcePointsToggled}get updating(){return this._updatingHandles.updating}get _preferredInteractionTool(){return this.options?.tool??"transform"}get _toolType(){switch(this._preferredInteractionTool){case"transform":return"transform-3d";case"reshape":return"reshape-3d"}}get _validatedSelectedElement(){const e=this.selectedElement;if(!e)return null;const{layer:{source:t}}=this;return t?"hasElement"in t?t.hasElement(e)?e:null:t===e?e:null:null}constructor(e){super(e),this.enabled=!1,this._isEditSourcePointsToggled=!1,this._updatingHandles=new v,this._isOpacityToggled=!1,this._factor=S,this._tool=null,this._object=null,this._createToolAbortController=null,this._onPointerMove=a((async e=>{const t=await this._updatingHandles.addPromise(this._findElementAtScreenPoint(e));this.destroyed||(this.removeHandles(P),t&&t!==this.selectedElement&&(this.view.cursor="pointer",this.addHandles(i((()=>this.view.cursor=null)),P)))})),this._tmpMat2=u(),this._tmpVec2=f()}destroy(){this._createToolAbortController=r(this._createToolAbortController)}initialize(){this.addHandles([o(this._updatingHandles),this._updatingHandles.add((()=>this.enabled),(e=>this._enableDisable(e)),l),this._updatingHandles.add((()=>this._preferredInteractionTool),(e=>this._preferredInteractionToolChanged(e)))])}_enableDisable(e){if(!e)return void this.removeHandles(O);this._dynamicImports();const{view:t}=this,o=new w;o.add(j.undo,(()=>{this._object?.operations?.undo(),this._object?.emit("modified-externally")})),o.add(j.redo,(()=>{this._object?.operations?.redo(),this._object?.emit("modified-externally")})),o.addToggle(j.preserveAspectRatio,(e=>{"transform-3d"===this._tool?.type&&(this._tool.preserveAspectRatio="key-down"===e.type)})),o.addToggle(j.editSourcePoints,(e=>{"reshape-3d"===this._tool?.type&&(this._isEditSourcePointsToggled="key-down"===e.type)})),o.addToggle(j.rotateIncrements,(e=>{"transform-3d"===this._tool?.type&&(this._tool.snapRotation="key-down"===e.type)})),o.add(j.toggleOpacity,(()=>{const e=this._object?.element;e&&(e.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)})),o.add(j.moveUp,(()=>this._move(0,this._factor))),o.add(j.moveDown,(()=>this._move(0,-this._factor))),o.add(j.moveRight,(()=>this._move(this._factor,0))),o.add(j.moveLeft,(()=>this._move(-this._factor,0))),o.addToggle(j.factorModifier,(e=>this._factor="key-down"===e.type?M:S)),this._isOpacityToggled=!1,this.addHandles([o.register(t,b.TOOL),i((()=>{this._isOpacityToggled&&this.selectedElement&&(this.selectedElement.opacity*=2,this._isOpacityToggled=!1)})),t.on("immediate-click",(e=>this._onClick(e)),b.TOOL),t.on("pointer-move",(e=>this._onPointerMove(e).catch((()=>{}))),b.TOOL),this._updatingHandles.add((()=>this._validatedSelectedElement),((e,t)=>{t&&e!==t&&this._isOpacityToggled&&(t.opacity*=2,this._isOpacityToggled=!1),this._selectedElementChanged(e)}),l),i((()=>{t.cursor=null,this._removeTool()}))],O)}async _onClick(e){await this._updatingHandles.addPromise(e.defer((async()=>{const t=await this._findElementAtScreenPoint(e);this.destroyed||(t&&e.stopPropagation(),this.selectedElement=t,this.selectedElement&&(this.view.cursor=null))})))}async _selectedElementChanged(e){e?.georeference?this._object?.element!==e&&await this._updatingHandles.addPromise(this._recreateTool()):this._removeTool()}async _recreateTool(){this._createToolAbortController=r(this._createToolAbortController),this._removeTool();const e=this._validatedSelectedElement;if(!e)return;const t=new AbortController;this._createToolAbortController=t;const{ManipulatedObject3DMediaElement:o,ExtentTransformTool:s,ReshapeTool3D:a}=await this._dynamicImports();if(t.signal.aborted)return;const{view:l,layer:p,_toolType:h}=this;switch(this._object=new o({view:l,layer:p,element:e,tool:this._preferredInteractionTool}),h){case"transform-3d":{this._tool=new s({view:l,object:this._object});const e=l.inputManager;e.isModifierKeyDown(j.rotateIncrements.key)&&(this._tool.snapRotation=!0),e.isModifierKeyDown(j.preserveAspectRatio.key)&&(this._tool.preserveAspectRatio=!0)}break;case"reshape-3d":{const e=E(l),{snappingManager:t}=e;this._tool=new a({view:l,object:this._object,enableMidpoints:!1,enableZShape:!1,snappingManager:t,enableMoveObject:!1,autoHideManipulators:!0,enableDeleteVertices:!1,sketchOptions:{tooltips:{enabled:!0,inputEnabled:!0,visibleElements:{area:!1}}}}),this.addHandles([e,d((()=>({editSourcePoints:this.editSourcePoints,operations:this._object?.operations})),(e=>{e.operations instanceof T&&(e.operations.editSourcePoints=e.editSourcePoints)}),c)],this._tool)}}this.addHandles([i((()=>{this._object=n(this._object),this._tool&&(l.tools.remove(this._tool),this._tool=null)}))],this._tool),l.addAndActivateTool(this._tool)}_preferredInteractionToolChanged(e){const{_tool:t}=this;if(!t)return;if(this._toolType!==t.type)return void this._updatingHandles.addPromise(this._recreateTool());const{_object:o}=this;o&&(o.tool=e)}async _dynamicImports(){const[{ManipulatedObject3DMediaElement:e},{ExtentTransformTool:t,ReshapeTool3D:o}]=await Promise.all([import("../../interactive/editingTools/ManipulatedObject3DMediaElement.js"),import("../../interactive/editingTools.js")]);return{ManipulatedObject3DMediaElement:e,ExtentTransformTool:t,ReshapeTool3D:o}}async _findElementAtScreenPoint(e){const t=(await this.view.hitTest(e,{include:[this.layer]})).results[0];return"media"===t?.type?t.element:null}_removeTool(){this._tool&&this.removeHandles(this._tool)}_move(e,t){const{view:o,_object:i}=this,r=i?.operations;if(!r)return;const n=o.overlayPixelSizeInMapUnits(o.pointsOfInterest.focus.location)*p(o.spatialReference)/p(r.data.spatialReference),{_tmpMat2:a,_tmpVec2:l}=this,d=_(a,s(360-this.view.camera.heading)),c=g(l,n*e,n*t);y(c,c,d),r.move(c[0],c[1],0),i.emit("modified-externally")}};e([h({constructOnly:!0})],H.prototype,"view",void 0),e([h({constructOnly:!0})],H.prototype,"layer",void 0),e([h()],H.prototype,"selectedElement",void 0),e([h()],H.prototype,"enabled",void 0),e([h()],H.prototype,"options",void 0),e([h()],H.prototype,"editSourcePoints",null),e([h()],H.prototype,"_isEditSourcePointsToggled",void 0),e([h()],H.prototype,"updating",null),e([h()],H.prototype,"_preferredInteractionTool",null),e([h()],H.prototype,"_validatedSelectedElement",null),H=e([m("esri.views.3d.layers.support.MediaLayerInteraction")],H);export{H as MediaLayerInteraction};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{someMap as t}from"../../../core/MapUtils.js";import{releaseMaybe as e}from"../../../core/maybe.js";import{RenderCategory as h}from"../webgl.js";import{isManagedDepthTexture as o}from"./ManagedDepthTexture.js";import{ManagedFBOResource as r,AttachmentType as s}from"./ManagedFBOResource.js";import{DepthStencilAttachment as i,ColorAttachment0 as a}from"../../webgl/enums.js";class c extends r{constructor(t,e,o,r,i,a){super(t,a),this.fbo=o,this.type=s.FBO,this._colors=new Map,this._name=h.COMPOSITE,this.acquireColor=null,this.acquireDepth=null,this._name=e,this.
|
|
5
|
+
import{someMap as t}from"../../../core/MapUtils.js";import{releaseMaybe as e}from"../../../core/maybe.js";import{RenderCategory as h}from"../webgl.js";import{isManagedDepthTexture as o}from"./ManagedDepthTexture.js";import{ManagedFBOResource as r,AttachmentType as s}from"./ManagedFBOResource.js";import{DepthStencilAttachment as i,ColorAttachment0 as a}from"../../webgl/enums.js";class c extends r{constructor(t,e,o,r,i,a){super(t,a),this.fbo=o,this.type=s.FBO,this._colors=new Map,this._name=h.COMPOSITE,this.acquireColor=null,this.acquireDepth=null,this._name=e,this.acquireColor=r,this.acquireDepth=i}dispose(){this.fbo?.dispose()}get cachedMemory(){return this.fbo?.usedMemory||0}get numberOfColorAttachments(){return this._colors.size}get name(){return this._name}setName(t){this._name=t}getTexture(t=a){return t===i?this.fbo?.depthStencilTexture:this.fbo?.getColorTexture(t)}getAttachment(t=a){return t===i?this._depth:this._colors.get(t)}hasAttachment(e){return t(this._colors,(t=>t.name===e))}attachDepth(t){return t?.retain(),this.detachDepth(),t&&this.fbo?.attachDepthStencil(t.attachment),this._depth=t,this}detachDepth(){this.fbo?.detachDepthStencilTexture(),this.fbo?.detachDepthStencilBuffer(),this._depth=e(this._depth)}obtainDepthTexture(){const t=this._depth;return o(t)?(this.fbo?.detachDepthStencilTexture(),this._depth=null,t):null}attachColor(t,e){return t.retain(),this.detachColor(e),this.fbo?.attachColorTexture(t.attachment,e),this._colors.set(e,t),this}detachColor(t){this.fbo?.detachColorTexture(t);const e=this._colors.get(t);this._colors.delete(t),e?.release()}detachAll(){this._colors.forEach(((t,e)=>this.detachColor(e))),this.detachDepth()}detachAllButColor0(){this._colors.forEach(((t,e)=>{e!==a&&this.detachColor(e)})),this.detachDepth()}}export{c as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import{ManagedColorAttachment as t}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthAttachment as r}from"../../webgl/ManagedDepthAttachment.js";import a from"../../webgl/ManagedFBO.js";import{AttachmentType as c}from"../../webgl/ManagedFBOResource.js";import{
|
|
5
|
+
import e from"../../../../core/Error.js";import{ManagedColorAttachment as t}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthAttachment as r}from"../../webgl/ManagedDepthAttachment.js";import a from"../../webgl/ManagedFBO.js";import{AttachmentType as c}from"../../webgl/ManagedFBOResource.js";import{isDepthFormat as h,ColorFormat as o,isDepthTextureFormat as s,DepthTextureFormats as i,DepthRenderbufferFormats as n,ColorFormats as l,DepthTextureFormat as m}from"./FBOCacheFormats.js";import{FBOPool as u}from"./FBOPool.js";import{ColorAttachment0 as d}from"../../../webgl/enums.js";import{FramebufferObject as f}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as p}from"../../../webgl/Renderbuffer.js";import{Texture as C}from"../../../webgl/Texture.js";class _{constructor(e){this.rctx=e,this._acquired=new Set,this._cache=new u(e.newCache,"FBOCache"),this._depthCache=new u(e.newCache,"DepthAttachmentCache"),this._colorCache=new u(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.()}frameEnd(){const e=this.debugCallback;e&&this._acquired.forEach((t=>t.type===c.FBO&&e(t.name,t.fbo,t.numberOfColorAttachments)))}get usedMemory(){return Array.from(this._acquired.values()).reduce(((e,t)=>e+t.cachedMemory),this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e}acquire(t,r,c,s=o.RGBA8UNORM){const i=b(s,t,r);let n=this._cache.pop(i);const{rctx:l}=this;if(n){n.retain(),n.setName(c);const{fbo:t}=n;if(!t)throw new e("renderer","attempt to use a not existing framebuffer");l.temporaryBindFramebufferObject(t,(()=>{l.setDrawBuffers([d]),l.unbindTexture(t.colorTexture)}))}else{const e=new f(l),u=(e,a,c)=>{a??=o.RGBA8UNORM;const h=this._acquireColor(a,t,r,c??`${n.name} color ${e}`);return this.rctx.unbindTexture(h.attachment),n.attachColor(h,e),h.release(),n},p=e=>{e??=m.DEPTH24_STENCIL8;const a=this.acquireDepth(e,t,r,`${n.name} depth`);return n.attachDepth(a),a.release(),n},C=()=>{this.debugCallback?.(n.name,n.fbo,n.numberOfColorAttachments),this._acquired.delete(n),null!=n?.getAttachment(d)?(n.fbo?.invalidateAttachments([d],!0),n.detachAllButColor0(),this._cache.put(n)):n?.dispose()};n=new a(i,c,e,u,p,C),h(s)?n.acquireDepth(s):n.acquireColor(d,s,c)}return this._trackHandle(n)}acquireDepth(e,t,a,c){const h=b(e,t,a);let o=this._depthCache.pop(h);if(o)o.retain();else{const c=s(e)?new C(this.rctx,{...i[e],width:t,height:a}):new p(this.rctx,{...n[e],width:t,height:a});o=new r(h,c,(()=>this._depthCache.put(o)))}return o.name=c,o}_acquireColor(e,r,a,c){const h=b(e,r,a),o=this._colorCache.pop(h);if(o)return o.retain(),o.name=c,o;const s=new t(h,new C(this.rctx,{...l[e],width:r,height:a}),(()=>{this._colorCache.put(s)}));return s.name=c,s}_trackHandle(e){return this._acquired.add(e),e}}const w=new a("default","default",null,(()=>w),(()=>w),(()=>{}));function b(e,t,r){return`${e}x${t}x${r}`}w.release=()=>!1;export{_ as FBOCache,w as defaultWebGLFBO};
|
|
@@ -2,25 +2,19 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ReadDepth as o}from"./output/ReadDepth.glsl.js";import{
|
|
6
|
-
float oneMinusSourceAlpha = 1.0 - source.a;
|
|
7
|
-
return vec4(
|
|
8
|
-
source.rgb + dest.rgb * oneMinusSourceAlpha,
|
|
9
|
-
source.a + dest.a * oneMinusSourceAlpha
|
|
10
|
-
);
|
|
11
|
-
}`),p.code.add(r`vec4 premultipliedColor(vec3 rgb, float alpha) {
|
|
5
|
+
import{ReadDepth as o}from"./output/ReadDepth.glsl.js";import{BlendColorsPremultiplied as e}from"./util/BlendColorsPremultiplied.glsl.js";import{CameraSpace as l}from"./util/CameraSpace.glsl.js";import{Float3PassUniform as t}from"../shaderModules/Float3PassUniform.js";import{FloatPassUniform as r}from"../shaderModules/FloatPassUniform.js";import{glsl as a}from"../shaderModules/glsl.js";import{Texture2DBindUniform as n}from"../shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as i}from"../shaderModules/Texture2DPassUniform.js";function p(p,d){const s=p.fragment;s.include(o),p.include(l),s.include(e),s.uniforms.add(new r("globalAlpha",(o=>o.globalAlpha)),new t("glowColor",(o=>o.glowColor)),new r("glowWidth",((o,e)=>o.glowWidth*e.camera.pixelRatio)),new r("glowFalloff",(o=>o.glowFalloff)),new t("innerColor",(o=>o.innerColor)),new r("innerWidth",((o,e)=>o.innerWidth*e.camera.pixelRatio)),new n("depthMap",(o=>o.depth?.attachment)),new i("normalMap",(o=>o.normals))),s.code.add(a`vec4 premultipliedColor(vec3 rgb, float alpha) {
|
|
12
6
|
return vec4(rgb * alpha, alpha);
|
|
13
|
-
}`),
|
|
7
|
+
}`),s.code.add(a`vec4 laserlineProfile(float dist) {
|
|
14
8
|
if (dist > glowWidth) {
|
|
15
9
|
return vec4(0.0);
|
|
16
10
|
}
|
|
17
11
|
float innerAlpha = (1.0 - smoothstep(0.0, innerWidth, dist));
|
|
18
12
|
float glowAlpha = pow(max(0.0, 1.0 - dist / glowWidth), glowFalloff);
|
|
19
|
-
return
|
|
13
|
+
return blendColorsPremultiplied(
|
|
20
14
|
premultipliedColor(innerColor, innerAlpha),
|
|
21
15
|
premultipliedColor(glowColor, glowAlpha)
|
|
22
16
|
);
|
|
23
|
-
}`),
|
|
17
|
+
}`),s.code.add(a`bool laserlineReconstructFromDepth(out vec3 pos, out vec3 normal, out float angleCutoffAdjust, out float depthDiscontinuityAlpha) {
|
|
24
18
|
float depth = depthFromTexture(depthMap, uv);
|
|
25
19
|
if (depth == 1.0) {
|
|
26
20
|
return false;
|
|
@@ -39,13 +33,13 @@ angleCutoffAdjust = mix(0.0, 0.004, blendFactor);
|
|
|
39
33
|
float ddepth = fwidth(linearDepth);
|
|
40
34
|
depthDiscontinuityAlpha = 1.0 - smoothstep(0.0, 0.01, -ddepth / linearDepth);
|
|
41
35
|
return true;
|
|
42
|
-
}`),
|
|
36
|
+
}`),d.contrastControlEnabled?s.uniforms.add(new i("frameColor",((o,e)=>o.colors)),new r("globalAlphaContrastBoost",(o=>o.globalAlphaContrastBoost))).code.add(a`float rgbToLuminance(vec3 color) {
|
|
43
37
|
return dot(vec3(0.2126, 0.7152, 0.0722), color);
|
|
44
38
|
}
|
|
45
39
|
vec4 laserlineOutput(vec4 color) {
|
|
46
40
|
float backgroundLuminance = rgbToLuminance(texture(frameColor, uv).rgb);
|
|
47
41
|
float alpha = clamp(globalAlpha * max(backgroundLuminance * globalAlphaContrastBoost, 1.0), 0.0, 1.0);
|
|
48
42
|
return color * alpha;
|
|
49
|
-
}`):
|
|
43
|
+
}`):s.code.add(a`vec4 laserlineOutput(vec4 color) {
|
|
50
44
|
return color * globalAlpha;
|
|
51
|
-
}`)}export{
|
|
45
|
+
}`)}export{p as Laserline};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
function e(e){e.code.add("\n vec4 blendColorsPremultiplied(vec4 source, vec4 dest) {\n float oneMinusSourceAlpha = 1.0 - source.a;\n return source + dest * oneMinusSourceAlpha;\n }\n ")}function n(e,n){return e[0]=n[0]*n[3],e[1]=n[1]*n[3],e[2]=n[2]*n[3],e[3]=n[3],e}export{e as BlendColorsPremultiplied,n as premultiplyAlpha};
|