@arcgis/core 6.0.0-next.30 → 6.0.0-next.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0694c7bcfe71692e2ccf.js +1 -0
- package/assets/esri/core/workers/chunks/{e2c6cd8dac01e129ccfe.js → 0e445ec3523de9f2dfa2.js} +1 -1
- package/assets/esri/core/workers/chunks/0f6c0d42100c21367e5c.js +1 -0
- package/assets/esri/core/workers/chunks/{242a77066ac5cdb5b7d7.js → 14d81280807a3d3c1b7e.js} +1 -1
- package/assets/esri/core/workers/chunks/16cda273927ab0a39544.js +1 -0
- package/assets/esri/core/workers/chunks/1a3f71c4d97c36050030.js +1 -0
- package/assets/esri/core/workers/chunks/{ba4520ddcb6a49988da6.js → 1a8d8274df292d65f82e.js} +1 -1
- package/assets/esri/core/workers/chunks/{0b4481b57a611b15f65c.js → 1eaf8bfdd3765a90ccc2.js} +1 -1
- package/assets/esri/core/workers/chunks/29cc6b1705418b1be5d7.js +1 -0
- package/assets/esri/core/workers/chunks/2de077c7b971f2c215a6.js +1 -0
- package/assets/esri/core/workers/chunks/{fefdd10bdd5a4c8d8ed0.js → 360c944c610efa2051fc.js} +3 -3
- package/assets/esri/core/workers/chunks/{8ca2bb3c0551bb1898b6.js → 3fdcc383bbd9cf0d274c.js} +1 -1
- package/assets/esri/core/workers/chunks/{cc97e4fd0dacad970a23.js → 46453ebfee17b5421d9d.js} +1 -1
- package/assets/esri/core/workers/chunks/{64b360625c68cb863a08.js → 487c46d5245cfb35c4bb.js} +1 -1
- package/assets/esri/core/workers/chunks/{ad21757d78e372fa2ed6.js → 4a979fce1c971b614a18.js} +1 -1
- package/assets/esri/core/workers/chunks/{b5eff28cf482d920b9ea.js → 4d18b48d4a282a0f341c.js} +1 -1
- package/assets/esri/core/workers/chunks/4d8833f48348cbbcc947.js +1 -0
- package/assets/esri/core/workers/chunks/52a0aa2d19a495e48ab1.js +1 -0
- package/assets/esri/core/workers/chunks/{865cebc5c982c040ab6f.js → 55a9eaeb152a3abada67.js} +1 -1
- package/assets/esri/core/workers/chunks/572aec57593a08b8045b.js +1 -0
- package/assets/esri/core/workers/chunks/{9d40786c5ceface786ba.js → 601e1d020b8115497944.js} +1 -1
- package/assets/esri/core/workers/chunks/6029773458ab98600f67.js +1 -0
- package/assets/esri/core/workers/chunks/6b5c073dddd89d06ed80.js +1 -0
- package/assets/esri/core/workers/chunks/{7030a4d0714a35995a58.js → 6bb191b19ce43a27f205.js} +1 -1
- package/assets/esri/core/workers/chunks/6f6d1873753a9c6994aa.js +1 -0
- package/assets/esri/core/workers/chunks/7084dd6e10c6c1393e92.js +1 -0
- package/assets/esri/core/workers/chunks/7cc9d7a88b64e25fce14.js +1 -0
- package/assets/esri/core/workers/chunks/7e211d8a8ad6c6a7cf3e.js +1 -0
- package/assets/esri/core/workers/chunks/853563c66ecf58d53d36.js +1 -0
- package/assets/esri/core/workers/chunks/{c90388932a7825d9d933.js → 85de980c5b296ec69323.js} +1 -1
- package/assets/esri/core/workers/chunks/89dc49e784f7ba3b93ea.js +1 -0
- package/assets/esri/core/workers/chunks/8da2a10318f49d0dc73a.js +1 -0
- package/assets/esri/core/workers/chunks/8e6276ddd8d094c61f08.js +1 -0
- package/assets/esri/core/workers/chunks/{71f792a20077aa739f87.js → a607541959169741a943.js} +1 -1
- package/assets/esri/core/workers/chunks/b2d6b1ac9fbb50c7c8ab.js +1 -0
- package/assets/esri/core/workers/chunks/b657363113f4a37e634b.js +1 -0
- package/assets/esri/core/workers/chunks/b9cb92858a576eb6aa06.js +1 -0
- package/assets/esri/core/workers/chunks/{12b84262dedc6b393136.js → d9a240a3c6bf85124474.js} +1 -1
- package/assets/esri/core/workers/chunks/{8f008eedb11685ee2048.js → e096c1d9d53af74d3207.js} +1 -1
- package/assets/esri/core/workers/chunks/e4e2edfdc85dd14e66d4.js +1 -0
- package/assets/esri/core/workers/chunks/f4d91d470ca5fea0bd26.js +1 -0
- package/assets/esri/core/workers/chunks/f717005e14a7e9141df7.js +1 -0
- package/assets/esri/core/workers/chunks/f75eec2cbc541eec9712.js +1 -0
- package/assets/esri/core/workers/chunks/fcc3902d6d9eda6f09f5.js +1 -0
- package/assets/esri/core/workers/chunks/{28a821de9dbf10324033.js → fd031150d3a7f896e6b3.js} +1 -1
- package/config.js +1 -1
- package/core/scheduling.js +1 -1
- package/geometry/Mesh.d.ts +2 -125
- package/geometry/Mesh.js +1 -1
- package/geometry/support/GlobalCoordinateSystem.js +2 -0
- package/geometry/support/LocalCoordinateSystem.js +2 -0
- package/geometry/support/boundedPlane.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/geometry/support/meshErrors.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/geometry/support/polygonUtils.js +1 -1
- package/geometry/support/ray.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/interfaces.d.ts +0 -3
- package/kernel.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/raster/functions/rasterProjectionHelper.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/package.json +2 -2
- package/support/arcadeUtils.js +1 -1
- package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightConfiguration.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceController.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
- package/views/3d/environment/SunLighting.d.ts +10 -8
- package/views/3d/environment/VirtualLighting.d.ts +10 -8
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
- package/views/3d/state/ScreenSizePerspective.js +1 -1
- package/views/3d/support/RenderCoordsHelper.js +1 -1
- package/views/3d/support/ViewSlice.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/renderInfoUtils/polygon.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PlanarPatch.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/webgl-engine/lib/Path.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
- package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
- package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
- package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
- package/views/support/TextureCompressionWorker.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/webscene/Environment.d.ts +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/02335385b1476fe322eb.js +0 -1
- package/assets/esri/core/workers/chunks/07b726a46864501b90a0.js +0 -1
- package/assets/esri/core/workers/chunks/189321d88026bd7e6d3e.js +0 -1
- package/assets/esri/core/workers/chunks/18d47ab571b613fbe719.js +0 -1
- package/assets/esri/core/workers/chunks/1967b9c96045a5802d08.js +0 -1
- package/assets/esri/core/workers/chunks/199a7f97916679e0257c.js +0 -1
- package/assets/esri/core/workers/chunks/1d96fbad881a7d14a950.js +0 -1
- package/assets/esri/core/workers/chunks/1dc6f093028530a492e6.js +0 -1
- package/assets/esri/core/workers/chunks/2cd60fd062d954322c1f.js +0 -1
- package/assets/esri/core/workers/chunks/2d3e0e4442dbc6ec6def.js +0 -1
- package/assets/esri/core/workers/chunks/2f5d014d6a72108b0b3a.js +0 -1
- package/assets/esri/core/workers/chunks/3105336a05f38a95ebea.js +0 -1
- package/assets/esri/core/workers/chunks/4419732baf3459a80e6d.js +0 -1
- package/assets/esri/core/workers/chunks/4fb2fcc95f852bf8f86c.js +0 -1
- package/assets/esri/core/workers/chunks/59bc55880e6fd8ce20c0.js +0 -1
- package/assets/esri/core/workers/chunks/5f787809b74eed7b9a91.js +0 -1
- package/assets/esri/core/workers/chunks/6a7de221cea4426cb490.js +0 -1
- package/assets/esri/core/workers/chunks/7a0b4dc0cda190367a39.js +0 -1
- package/assets/esri/core/workers/chunks/7d3f7940815fa5dc244e.js +0 -1
- package/assets/esri/core/workers/chunks/999c23da883eb11cb29e.js +0 -1
- package/assets/esri/core/workers/chunks/9bc3afe7013ef4ae737b.js +0 -1
- package/assets/esri/core/workers/chunks/bab1d010970d98c25470.js +0 -1
- package/assets/esri/core/workers/chunks/c4f78a481f43cfae7b63.js +0 -1
- package/assets/esri/core/workers/chunks/dcf6024dc19428ff2b9d.js +0 -1
- package/assets/esri/core/workers/chunks/e04fb83ab2634bc15cc7.js +0 -1
- package/assets/esri/core/workers/chunks/ee0dc906cc7979080329.js +0 -1
- package/assets/esri/core/workers/chunks/f0d0ed155275c2e6d3da.js +0 -1
- package/chunks/boundedPlane.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../analysis/SlicePlane.js";import{clock as n}from"../../../../core/clock.js";import{destroyMaybe as r,removeMaybe as i}from"../../../../core/maybe.js";import{watch as a,sync as o,when as s,syncAndInitial as c}from"../../../../core/reactiveUtils.js";import{addFrameTask as l}from"../../../../core/scheduling.js";import{createScreenPoint as u,screenPointObjectToArray as d}from"../../../../core/screenUtils.js";import{property as f,subclass as ee}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as p,fromScaling as m,multiply as te}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{dot as h,length as g,copy as _,scale as v,add as y,transformMat4 as b,normalize as x,set as ne}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as re,create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as ie,ZEROS as ae}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as oe}from"../../../../core/support/UpdatingHandles.js";import{c as C,a as w,n as T,f as E}from"../../../../chunks/boundedPlane.js";import{signedDistance as D,create as O,intersectRay as k,getNormal as A}from"../../../../geometry/support/plane.js";import{create as se}from"../../../../geometry/support/ray.js";import{sv3d as j,sm4d as M,sv2d as ce}from"../../../../geometry/support/vectorStacks.js";import{getSliceableContainer as le}from"../../../../graphic/getSliceableContainer.js";import{getRotateHeadingTexture as ue,getTiltRotateTexture as de}from"../images/Factory.js";import{getOutlineColor as fe,planeColor as N}from"./settings.js";import{pointerMoveTimerMs as P,planePreviewOutlineWidth as F,forceVerticalModifier as I,forceHorizontalModifier as L,previewFadeDurationSeconds as R,previewFadeDotThreshold as z,initialDepthOffsetFrac as B}from"./sliceToolConfig.js";import{createGridVisualElement as V,createOutlineVisualElement as pe,planeToShape as me,createRotatePlane as H,resizePlane as he,calculatePlaneHalfSize as ge,createPlane as _e,DidPointerMoveRecentlyFlag as U,calculateBoundedPlaneTranslateRotate as W,updateShiftRestartHandle as ve,updateRotateHeadingHandle as ye,updateRotateTiltHandle as be,updateResizeHandle as xe,createShiftPlane as Se}from"./sliceToolUtils.js";import{calculateInputRotationTransform as Ce}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as G}from"../../interactive/editingTools/dragEventPipeline3D.js";import{ResizeManipulator as we}from"../../interactive/manipulators/ResizeManipulator.js";import{RotateManipulator as K}from"../../interactive/manipulators/RotateManipulator.js";import{ShiftManipulator as Te}from"../../interactive/manipulators/ShiftManipulator.js";import{fromScreenNormalized as q}from"../../support/geometryUtils/ray.js";import{AnalysisToolBase as J}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as Y}from"../../../interactive/dragEventPipeline.js";import{newToolIntersector as Ee}from"../../../interactive/ToolIntersector.js";import{createScreenPointFromEvent as X}from"../../../support/screenUtils.js";var Z;let Q=class extends J{static{Z=this}constructor(e){super(e),this._clock=n,this._previewPlaneOpacity=1,this.multiTouchEnabled=!1,this.removeIncompleteOnCancel=!1,this._mode=`none`,this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=P,this._prevPointerMoveTimeout=null,this._updatingHandles=new oe,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=C(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=u(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=Ee(e.view.state.viewingMode)}initialize(){if(this.analysis==null)throw Error(`SliceTool requires valid analysis, but null was provided.`);let e=e=>{this._updateManipulatorsInteractive(e),e.grabbing||(this.analysisViewData.plane!=null&&w(this.analysisViewData.plane,this._startPlane),this.inputState=null)},t=new Te(this.view,1);this.shiftManipulator=t,this.manipulators.add(t),this.addHandles([this._createShiftDragPipeline(t),t.events.on(`grab-changed`,n=>{this._onShiftGrab(n),e(t)})]);let n=!this.view.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,r=new K(this.view,(e,t)=>ue(this.view.stage.textures,{accentColor:e,contrastColor:t,preMultiplyAlpha:n}));this.rotateHeadingManipulator=r,this.manipulators.add(r),this.addHandles([this._createRotateHeadingDragPipeline(r),r.events.on(`grab-changed`,t=>{this._onRotateHeadingGrab(t),e(r)})]);let i=new K(this.view,(e,t)=>de(this.view.stage.textures,{accentColor:e,contrastColor:t,preMultiplyAlpha:n}));this.rotateTiltManipulator=i,this.manipulators.add(i),this.addHandles([this._createRotateTiltDragPipeline(i),i.events.on(`grab-changed`,t=>{this._onRotateTiltGrab(t),e(i)})]),this.resizeManipulators=this._resizeHandles.map((t,n)=>{let r=new we(this.view,t);return this.addHandles([this._createResizeDragPipeline(r),r.events.on(`grab-changed`,t=>{this._onResizeGrab(t,n),e(r)})]),r}),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=V(this.view),this._previewPlaneOutlineVisualElement=pe(this.view),this._previewPlaneOutlineVisualElement.width=F,this.addHandles(a(()=>[this.analysisViewData.plane,this.analysis.tiltEnabled],()=>this._updateManipulators(),o)),this.addHandles([s(()=>this.state===`sliced`,()=>{this.finishToolCreation(),this.stop()},c),this._updatingHandles.add(()=>this.view.state.camera,()=>this._onCameraChange())])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=r(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=r(this._previewPlaneGridVisualElement),this._updatingHandles.destroy()}get state(){let e=!!this.analysisViewData.plane,t=!!this.inputState;return e?e&&t?`slicing`:e&&!t?`sliced`:`ready`:`ready`}get cursor(){return this.active&&(this._placingSlicePlane||this.mode===`exclude`)?`crosshair`:null}set analysis(e){if(e==null)throw Error(`SliceTool requires valid analysis, but null was provided.`);this.removeHandles(`analysis`),this._set(`analysis`,e)}get updating(){return this._updatingHandles.updating}get mode(){return this._mode}static{this.disableEngineLayers=!1}get inputState(){return this._get(`inputState`)}set inputState(e){this._set(`inputState`,e),this.analysisViewData.showGrid=e!=null&&e.type===`resize`,this._updateMaterials()}get _placingSlicePlane(){return this.active&&!this.inputState&&this._mode===`place`}start(e){this._finishToolCreationIfValid(),this._mode=e,this.active||(this.view.activeTool=this)}stop(){this.active&&(this.view.activeTool=null)}onActivate(){this._finishToolCreationIfValid(),this._mode===`none`&&this.analysisViewData.plane==null&&(this._mode=`place`)}onDeactivate(){this._mode=`none`,this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(e){this._updateManipulators(),e||this._clearPointerMoveTimeout()}onInputEvent(e){switch(e.type){case`pointer-move`:this._onPointerMove(e);break;case`immediate-click`:if(!ke(e))return;this._mode===`exclude`?e.defer(async()=>{await this._onClickExcludeLayer(e)&&e.stopPropagation()}):this._onClickPlacePlane(e)&&e.stopPropagation();break;case`drag`:this.inputState&&e.stopPropagation();break;case`key-down`:this._onKeyDown(e)&&e.stopPropagation();break;case`key-up`:this._onKeyUp(e)&&e.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerMove(e){this._lastCursorPosition.x=e.x,this._lastCursorPosition.y=e.y,this._resetPointerMoveTimeout(),e.pointerType!==`touch`&&this._updatePreviewPlane(X(e),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onClickPlacePlane(e){if(!this._placingSlicePlane)return!1;let n=X(e),r=C();return this._pickPlane(n,!1,this._activeKeyModifiers,r)?(w(r,this._startPlane),this.analysis.shape=me(r,this.view,this.view.spatialReference,new t),this.stop(),!0):!1}async _onClickExcludeLayer(e){if(this.mode!==`exclude`)return!1;let t=await this.view.hitTest(X(e)),n=t.results.at(0);if(n){let e=(n.type===`graphic`?le(n.graphic.origin)??n.graphic.sourceLayer??null:null)??n.layer;e&&e.type!==`subtype-sublayer`&&this.analysis.excludedLayers.push(e)}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0;return this.stop(),!0}_onKeyDown(e){return this._placingSlicePlane&&(e.key===I||e.key===L)?(this._activeKeyModifiers[e.key]=!0,this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0):!1}_onKeyUp(e){return this._placingSlicePlane&&(e.key===I||e.key===L)&&this._activeKeyModifiers[e.key]?(delete this._activeKeyModifiers[e.key],this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0):!1}_onShiftGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=q(this.view.state.camera,e.screenPoint,$);w(this.analysisViewData.plane,this._startPlane),this.inputState=Oe(t,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`shift`)return;let i=this.analysisViewData.plane==null?null:w(this.analysisViewData.plane,C());t.next(G(this.view,r.shiftPlane)).next(this._shiftDragAdjustSensitivity(r)).next(this._shiftDragUpdatePlane(r)),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_shiftDragAdjustSensitivity(e){return t=>{if(this.analysisViewData.plane==null)return null;let n=Math.min((1-Math.abs(h(T(this.analysisViewData.plane),t.ray.direction)/g(t.ray.direction)))/.001,1),r=-D(this._startPlane.plane,t.renderEnd),i=-D(this._startPlane.plane,e.startPoint);return e.depth=e.depth*(1-n)+r*n-i,t}}_shiftDragUpdatePlane(e){return()=>{if(this.analysisViewData.plane==null)return;let t=_(j.get(),this._startPlane.origin),n=_(j.get(),T(this._startPlane));v(n,n,-e.depth),y(n,n,t);let r=E(n,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,C());this._updateBoundedPlane(r)}}_onRotateHeadingGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=H(this.analysisViewData.plane,this.view.renderCoordsHelper,1,O()),n=q(this.view.state.camera,e.screenPoint,$),r=S();k(t,n,r)&&(w(this.analysisViewData.plane,this._startPlane),this.inputState={type:`rotate`,rotatePlane:t,startPoint:r})}_createRotateHeadingDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`rotate`)return;let i=this.analysisViewData.plane==null?null:w(this.analysisViewData.plane,C());t.next(G(this.view,r.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(r)).next(this._rotateDragUpdatePlaneFromRotate()),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_onRotateTiltGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=H(this.analysisViewData.plane,this.view.renderCoordsHelper,2,O()),n=q(this.view.state.camera,e.screenPoint,$),r=S();k(t,n,r)&&(w(this.analysisViewData.plane,this._startPlane),this.inputState={type:`rotate`,rotatePlane:t,startPoint:r})}_createRotateTiltDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`rotate`)return;let i=this.analysisViewData.plane==null?null:w(this.analysisViewData.plane,C());t.next(G(this.view,r.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(r)).next(this._rotateDragUpdatePlaneFromRotate()),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_rotateDragRenderPlaneToRotate(e){return t=>{if(this.analysisViewData.plane==null)return null;let n=A(e.rotatePlane),r=Ce(e.startPoint,t.renderEnd,this.analysisViewData.plane.origin,n);return{...t,rotateAxis:n,rotateAngle:r}}}_rotateDragUpdatePlaneFromRotate(){return e=>{if(this.analysisViewData.plane==null)return;let t=p(M.get(),e.rotateAngle,e.rotateAxis);if(t==null)return;let n=b(j.get(),this._startPlane.basis1,t),r=b(j.get(),this._startPlane.basis2,t),i=E(this.analysisViewData.plane.origin,n,r,C());this._updateBoundedPlane(i)}}_onResizeGrab(e,t){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let n=q(this.view.state.camera,e.screenPoint,$),r=j.get();k(this.analysisViewData.plane.plane,n,r)&&(w(this.analysisViewData.plane,this._startPlane),this.inputState={type:`resize`,activeHandleIdx:t,startPoint:re(r)})}_createResizeDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`resize`||this.analysisViewData.plane==null)return;let i=w(this.analysisViewData.plane,C());t.next(G(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(r)),n.next(()=>{this._updateBoundedPlane(i)})})}_resizeDragUpdatePlane(e){return t=>{if(this.analysisViewData.plane==null)return;let n=this._resizeHandles[e.activeHandleIdx],r=he(n,e.startPoint,t.renderEnd,this.view.state.camera,this._startPlane,w(this.analysisViewData.plane));this._updateBoundedPlane(r)}}_updateBoundedPlane(e){let t=this.analysisViewData;if(t!=null)t.plane=e;else throw Error(`valid internal object expected`)}_updatePreviewPlane(e,t={}){if(this.mode===`exclude`)return;let n=this._previewPlane;if(this._previewPlane=null,e==null)this._removeFrameTask(),this._updateManipulators();else{if(this.active){let r=n??C();if(n=n==null?null:w(n,Ae),this._pickPlane(e,!0,t,r)){let e=z,t=!1;n!=null&&(t=h(A(n.plane),A(r.plane))<e||h(x(j.get(),n.basis1),x(j.get(),r.basis1))<e),t&&(this._previewPlaneOpacity=0),this._previewPlane=r}}this._previewPlane!=null&&this._frameTask==null&&this._previewPlaneOpacity===0?this._frameTask=l({update:({deltaTime:e})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+e/(R*1e3),1),this._updateManipulators(),this._previewPlaneOpacity===1&&this._removeFrameTask()}}):this._previewPlane==null&&this._frameTask!=null?this._removeFrameTask():this._previewPlane!=null&&this._updateManipulators()}}_removeFrameTask(){this._frameTask=i(this._frameTask)}_pickMinResult(e){let t=d(e,ce.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector),this._intersector.results.min}_pickPlane(e,t,n,r){let i=this._pickMinResult(e),a=j.get();if(!i.getIntersectionPoint(a))return!1;let o=i.getTransformedNormal(j.get()),s=this.view.state.camera;h(o,s.viewForward)>0&&v(o,o,-1);let c=ge(a,s),l=(t?1:-1)*c*B,u=v(j.get(),o,l);y(u,u,a);let d=this.analysis.tiltEnabled?3:0,f=n[I]?2:n[L]?1:d;return _e(u,o,c,c,s,f,this.view.renderCoordsHelper,r),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=i(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=U,this.rotateHeadingManipulator.state|=U,this.rotateTiltManipulator.state|=U,this._prevPointerMoveTimeout=this._clock.setTimeout(()=>{this.shiftManipulator.state&=~U,this.rotateHeadingManipulator.state&=~U,this.rotateTiltManipulator.state&=~U},this._pointerMoveTimerMs)}_updateManipulators(){if(Z.disableEngineLayers)return;let e,t,n=!1;if(this.analysisViewData.plane!=null)e=this.analysisViewData.plane,t=this._previewPlane??e,n=!1;else if(this._previewPlane!=null)t=e=this._previewPlane,n=!0;else{this._setManipulatorVisibility(!1),this._setPreviewPlaneVisibility(!1);return}if(this._setManipulatorVisibility(!n),!n){let t=W(e,M.get());ve(this.shiftManipulator,t,e,this.view.state.camera),ye(this.rotateHeadingManipulator,t,e,this.view.renderCoordsHelper),be(this.rotateTiltManipulator,t,e),this.resizeManipulators.forEach((n,r)=>xe(n,this._resizeHandles[r],t,e))}this._setPreviewPlaneVisibility(n||this._mode===`place`),this._updatePreviewPlaneTransform(t),this._updateMaterials()}_setManipulatorVisibility(e){this.shiftManipulator.available=e,this.rotateHeadingManipulator.available=e,this.rotateTiltManipulator.available=e&&this.analysis.tiltEnabled,this.resizeManipulators.forEach(t=>t.available=e)}_updatePreviewPlaneTransform(e){let t=W(e,M.get()),n=ne(j.get(),g(e.basis1),g(e.basis2),1),r=m(M.get(),n),i=te(r,t,r);this._previewPlaneOutlineVisualElement.transform=i,this._previewPlaneGridVisualElement.transform=i}_setPreviewPlaneVisibility(e){let t=this._previewPlaneOutlineVisualElement,n=this._previewPlaneGridVisualElement;e&&(t.attached=!0,n.attached=!0),t.visible=e,n.visible=e}_updateMaterials(){let e=fe(this.view.effectiveTheme);e[3]*=this._previewPlaneOpacity;let t=ie(N);t[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=e,this._previewPlaneGridVisualElement.backgroundColor=t,this._previewPlaneGridVisualElement.gridColor=ae}_updateManipulatorsInteractive(e){e.grabbing?(this.shiftManipulator.interactive=this.shiftManipulator===e,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===e,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===e,this.resizeManipulators.forEach(t=>{t.interactive=t===e})):(this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,this.resizeManipulators.forEach(e=>{e.interactive=!0}))}_finishToolCreationIfValid(){this.analysis.valid&&this.finishToolCreation()}get test(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:e=>{this._pointerMoveTimerMs=e}}}};e([f()],Q.prototype,`_clock`,void 0),e([f({constructOnly:!0})],Q.prototype,`view`,void 0),e([f()],Q.prototype,`analysisViewData`,void 0),e([f({readOnly:!0})],Q.prototype,`state`,null),e([f({readOnly:!0})],Q.prototype,`cursor`,null),e([f()],Q.prototype,`analysis`,null),e([f()],Q.prototype,`multiTouchEnabled`,void 0),e([f()],Q.prototype,`removeIncompleteOnCancel`,void 0),e([f()],Q.prototype,`updating`,null),e([f()],Q.prototype,`_mode`,void 0),e([f()],Q.prototype,`mode`,null),e([f({value:null})],Q.prototype,`inputState`,null),e([f()],Q.prototype,`_placingSlicePlane`,null),Q=Z=e([ee(`esri.views.3d.analysis.Slice.SliceTool`)],Q);const De=Q;function Oe(e,t,n){let r=Se(t,T(n),e.direction,O()),i=S();return k(r,e,i)?{type:`shift`,shiftPlane:r,depth:0,startPoint:i}:null}function ke(e){return e.pointerType!==`mouse`||e.button===0}const Ae=C(),$=se();export{De as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../analysis/SlicePlane.js";import{clock as n}from"../../../../core/clock.js";import{destroyMaybe as r,removeMaybe as i}from"../../../../core/maybe.js";import{watch as a,sync as o,when as s,syncAndInitial as c}from"../../../../core/reactiveUtils.js";import{addFrameTask as l}from"../../../../core/scheduling.js";import{createScreenPoint as u,screenPointObjectToArray as d}from"../../../../core/screenUtils.js";import{property as f,subclass as ee}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as p,fromScaling as m,multiply as te}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{dot as h,length as g,copy as _,scale as v,add as y,transformMat4 as b,normalize as x,set as ne}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as re,create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as ie,ZEROS as ae}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as oe}from"../../../../core/support/UpdatingHandles.js";import{create as C,copy as w,normal as T,fromValues as E}from"../../../../geometry/support/boundedPlane.js";import{signedDistance as D,create as O,intersectRay as k,getNormal as A}from"../../../../geometry/support/plane.js";import{create as se}from"../../../../geometry/support/ray.js";import{sv3d as j,sm4d as M,sv2d as ce}from"../../../../geometry/support/vectorStacks.js";import{getSliceableContainer as le}from"../../../../graphic/getSliceableContainer.js";import{getRotateHeadingTexture as ue,getTiltRotateTexture as de}from"../images/Factory.js";import{getOutlineColor as fe,planeColor as N}from"./settings.js";import{pointerMoveTimerMs as P,planePreviewOutlineWidth as F,forceVerticalModifier as I,forceHorizontalModifier as L,previewFadeDurationSeconds as R,previewFadeDotThreshold as z,initialDepthOffsetFrac as B}from"./sliceToolConfig.js";import{createGridVisualElement as V,createOutlineVisualElement as pe,planeToShape as me,createRotatePlane as H,resizePlane as he,calculatePlaneHalfSize as ge,createPlane as _e,DidPointerMoveRecentlyFlag as U,calculateBoundedPlaneTranslateRotate as W,updateShiftRestartHandle as ve,updateRotateHeadingHandle as ye,updateRotateTiltHandle as be,updateResizeHandle as xe,createShiftPlane as Se}from"./sliceToolUtils.js";import{calculateInputRotationTransform as Ce}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as G}from"../../interactive/editingTools/dragEventPipeline3D.js";import{ResizeManipulator as we}from"../../interactive/manipulators/ResizeManipulator.js";import{RotateManipulator as K}from"../../interactive/manipulators/RotateManipulator.js";import{ShiftManipulator as Te}from"../../interactive/manipulators/ShiftManipulator.js";import{fromScreenNormalized as q}from"../../support/geometryUtils/ray.js";import{AnalysisToolBase as J}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as Y}from"../../../interactive/dragEventPipeline.js";import{newToolIntersector as Ee}from"../../../interactive/ToolIntersector.js";import{createScreenPointFromEvent as X}from"../../../support/screenUtils.js";var Z;let Q=class extends J{static{Z=this}constructor(e){super(e),this._clock=n,this._previewPlaneOpacity=1,this.multiTouchEnabled=!1,this.removeIncompleteOnCancel=!1,this._mode=`none`,this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=P,this._prevPointerMoveTimeout=null,this._updatingHandles=new oe,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=C(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=u(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=Ee(e.view.state.viewingMode)}initialize(){if(this.analysis==null)throw Error(`SliceTool requires valid analysis, but null was provided.`);let e=e=>{this._updateManipulatorsInteractive(e),e.grabbing||(this.analysisViewData.plane!=null&&w(this.analysisViewData.plane,this._startPlane),this.inputState=null)},t=new Te(this.view,1);this.shiftManipulator=t,this.manipulators.add(t),this.addHandles([this._createShiftDragPipeline(t),t.events.on(`grab-changed`,n=>{this._onShiftGrab(n),e(t)})]);let n=!this.view.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,r=new K(this.view,(e,t)=>ue(this.view.stage.textures,{accentColor:e,contrastColor:t,preMultiplyAlpha:n}));this.rotateHeadingManipulator=r,this.manipulators.add(r),this.addHandles([this._createRotateHeadingDragPipeline(r),r.events.on(`grab-changed`,t=>{this._onRotateHeadingGrab(t),e(r)})]);let i=new K(this.view,(e,t)=>de(this.view.stage.textures,{accentColor:e,contrastColor:t,preMultiplyAlpha:n}));this.rotateTiltManipulator=i,this.manipulators.add(i),this.addHandles([this._createRotateTiltDragPipeline(i),i.events.on(`grab-changed`,t=>{this._onRotateTiltGrab(t),e(i)})]),this.resizeManipulators=this._resizeHandles.map((t,n)=>{let r=new we(this.view,t);return this.addHandles([this._createResizeDragPipeline(r),r.events.on(`grab-changed`,t=>{this._onResizeGrab(t,n),e(r)})]),r}),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=V(this.view),this._previewPlaneOutlineVisualElement=pe(this.view),this._previewPlaneOutlineVisualElement.width=F,this.addHandles(a(()=>[this.analysisViewData.plane,this.analysis.tiltEnabled],()=>this._updateManipulators(),o)),this.addHandles([s(()=>this.state===`sliced`,()=>{this.finishToolCreation(),this.stop()},c),this._updatingHandles.add(()=>this.view.state.camera,()=>this._onCameraChange())])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=r(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=r(this._previewPlaneGridVisualElement),this._updatingHandles.destroy()}get state(){let e=!!this.analysisViewData.plane,t=!!this.inputState;return e?e&&t?`slicing`:e&&!t?`sliced`:`ready`:`ready`}get cursor(){return this.active&&(this._placingSlicePlane||this.mode===`exclude`)?`crosshair`:null}set analysis(e){if(e==null)throw Error(`SliceTool requires valid analysis, but null was provided.`);this.removeHandles(`analysis`),this._set(`analysis`,e)}get updating(){return this._updatingHandles.updating}get mode(){return this._mode}static{this.disableEngineLayers=!1}get inputState(){return this._get(`inputState`)}set inputState(e){this._set(`inputState`,e),this.analysisViewData.showGrid=e!=null&&e.type===`resize`,this._updateMaterials()}get _placingSlicePlane(){return this.active&&!this.inputState&&this._mode===`place`}start(e){this._finishToolCreationIfValid(),this._mode=e,this.active||(this.view.activeTool=this)}stop(){this.active&&(this.view.activeTool=null)}onActivate(){this._finishToolCreationIfValid(),this._mode===`none`&&this.analysisViewData.plane==null&&(this._mode=`place`)}onDeactivate(){this._mode=`none`,this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(e){this._updateManipulators(),e||this._clearPointerMoveTimeout()}onInputEvent(e){switch(e.type){case`pointer-move`:this._onPointerMove(e);break;case`immediate-click`:if(!ke(e))return;this._mode===`exclude`?e.defer(async()=>{await this._onClickExcludeLayer(e)&&e.stopPropagation()}):this._onClickPlacePlane(e)&&e.stopPropagation();break;case`drag`:this.inputState&&e.stopPropagation();break;case`key-down`:this._onKeyDown(e)&&e.stopPropagation();break;case`key-up`:this._onKeyUp(e)&&e.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerMove(e){this._lastCursorPosition.x=e.x,this._lastCursorPosition.y=e.y,this._resetPointerMoveTimeout(),e.pointerType!==`touch`&&this._updatePreviewPlane(X(e),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onClickPlacePlane(e){if(!this._placingSlicePlane)return!1;let n=X(e),r=C();return this._pickPlane(n,!1,this._activeKeyModifiers,r)?(w(r,this._startPlane),this.analysis.shape=me(r,this.view,this.view.spatialReference,new t),this.stop(),!0):!1}async _onClickExcludeLayer(e){if(this.mode!==`exclude`)return!1;let t=await this.view.hitTest(X(e)),n=t.results.at(0);if(n){let e=(n.type===`graphic`?le(n.graphic.origin)??n.graphic.sourceLayer??null:null)??n.layer;e&&e.type!==`subtype-sublayer`&&this.analysis.excludedLayers.push(e)}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0;return this.stop(),!0}_onKeyDown(e){return this._placingSlicePlane&&(e.key===I||e.key===L)?(this._activeKeyModifiers[e.key]=!0,this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0):!1}_onKeyUp(e){return this._placingSlicePlane&&(e.key===I||e.key===L)&&this._activeKeyModifiers[e.key]?(delete this._activeKeyModifiers[e.key],this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0):!1}_onShiftGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=q(this.view.state.camera,e.screenPoint,$);w(this.analysisViewData.plane,this._startPlane),this.inputState=Oe(t,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`shift`)return;let i=this.analysisViewData.plane==null?null:w(this.analysisViewData.plane,C());t.next(G(this.view,r.shiftPlane)).next(this._shiftDragAdjustSensitivity(r)).next(this._shiftDragUpdatePlane(r)),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_shiftDragAdjustSensitivity(e){return t=>{if(this.analysisViewData.plane==null)return null;let n=Math.min((1-Math.abs(h(T(this.analysisViewData.plane),t.ray.direction)/g(t.ray.direction)))/.001,1),r=-D(this._startPlane.plane,t.renderEnd),i=-D(this._startPlane.plane,e.startPoint);return e.depth=e.depth*(1-n)+r*n-i,t}}_shiftDragUpdatePlane(e){return()=>{if(this.analysisViewData.plane==null)return;let t=_(j.get(),this._startPlane.origin),n=_(j.get(),T(this._startPlane));v(n,n,-e.depth),y(n,n,t);let r=E(n,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,C());this._updateBoundedPlane(r)}}_onRotateHeadingGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=H(this.analysisViewData.plane,this.view.renderCoordsHelper,1,O()),n=q(this.view.state.camera,e.screenPoint,$),r=S();k(t,n,r)&&(w(this.analysisViewData.plane,this._startPlane),this.inputState={type:`rotate`,rotatePlane:t,startPoint:r})}_createRotateHeadingDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`rotate`)return;let i=this.analysisViewData.plane==null?null:w(this.analysisViewData.plane,C());t.next(G(this.view,r.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(r)).next(this._rotateDragUpdatePlaneFromRotate()),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_onRotateTiltGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=H(this.analysisViewData.plane,this.view.renderCoordsHelper,2,O()),n=q(this.view.state.camera,e.screenPoint,$),r=S();k(t,n,r)&&(w(this.analysisViewData.plane,this._startPlane),this.inputState={type:`rotate`,rotatePlane:t,startPoint:r})}_createRotateTiltDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`rotate`)return;let i=this.analysisViewData.plane==null?null:w(this.analysisViewData.plane,C());t.next(G(this.view,r.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(r)).next(this._rotateDragUpdatePlaneFromRotate()),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_rotateDragRenderPlaneToRotate(e){return t=>{if(this.analysisViewData.plane==null)return null;let n=A(e.rotatePlane),r=Ce(e.startPoint,t.renderEnd,this.analysisViewData.plane.origin,n);return{...t,rotateAxis:n,rotateAngle:r}}}_rotateDragUpdatePlaneFromRotate(){return e=>{if(this.analysisViewData.plane==null)return;let t=p(M.get(),e.rotateAngle,e.rotateAxis);if(t==null)return;let n=b(j.get(),this._startPlane.basis1,t),r=b(j.get(),this._startPlane.basis2,t),i=E(this.analysisViewData.plane.origin,n,r,C());this._updateBoundedPlane(i)}}_onResizeGrab(e,t){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let n=q(this.view.state.camera,e.screenPoint,$),r=j.get();k(this.analysisViewData.plane.plane,n,r)&&(w(this.analysisViewData.plane,this._startPlane),this.inputState={type:`resize`,activeHandleIdx:t,startPoint:re(r)})}_createResizeDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`resize`||this.analysisViewData.plane==null)return;let i=w(this.analysisViewData.plane,C());t.next(G(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(r)),n.next(()=>{this._updateBoundedPlane(i)})})}_resizeDragUpdatePlane(e){return t=>{if(this.analysisViewData.plane==null)return;let n=this._resizeHandles[e.activeHandleIdx],r=he(n,e.startPoint,t.renderEnd,this.view.state.camera,this._startPlane,w(this.analysisViewData.plane));this._updateBoundedPlane(r)}}_updateBoundedPlane(e){let t=this.analysisViewData;if(t!=null)t.plane=e;else throw Error(`valid internal object expected`)}_updatePreviewPlane(e,t={}){if(this.mode===`exclude`)return;let n=this._previewPlane;if(this._previewPlane=null,e==null)this._removeFrameTask(),this._updateManipulators();else{if(this.active){let r=n??C();if(n=n==null?null:w(n,Ae),this._pickPlane(e,!0,t,r)){let e=z,t=!1;n!=null&&(t=h(A(n.plane),A(r.plane))<e||h(x(j.get(),n.basis1),x(j.get(),r.basis1))<e),t&&(this._previewPlaneOpacity=0),this._previewPlane=r}}this._previewPlane!=null&&this._frameTask==null&&this._previewPlaneOpacity===0?this._frameTask=l({update:({deltaTime:e})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+e/(R*1e3),1),this._updateManipulators(),this._previewPlaneOpacity===1&&this._removeFrameTask()}}):this._previewPlane==null&&this._frameTask!=null?this._removeFrameTask():this._previewPlane!=null&&this._updateManipulators()}}_removeFrameTask(){this._frameTask=i(this._frameTask)}_pickMinResult(e){let t=d(e,ce.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector),this._intersector.results.min}_pickPlane(e,t,n,r){let i=this._pickMinResult(e),a=j.get();if(!i.getIntersectionPoint(a))return!1;let o=i.getTransformedNormal(j.get()),s=this.view.state.camera;h(o,s.viewForward)>0&&v(o,o,-1);let c=ge(a,s),l=(t?1:-1)*c*B,u=v(j.get(),o,l);y(u,u,a);let d=this.analysis.tiltEnabled?3:0,f=n[I]?2:n[L]?1:d;return _e(u,o,c,c,s,f,this.view.renderCoordsHelper,r),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=i(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=U,this.rotateHeadingManipulator.state|=U,this.rotateTiltManipulator.state|=U,this._prevPointerMoveTimeout=this._clock.setTimeout(()=>{this.shiftManipulator.state&=~U,this.rotateHeadingManipulator.state&=~U,this.rotateTiltManipulator.state&=~U},this._pointerMoveTimerMs)}_updateManipulators(){if(Z.disableEngineLayers)return;let e,t,n=!1;if(this.analysisViewData.plane!=null)e=this.analysisViewData.plane,t=this._previewPlane??e,n=!1;else if(this._previewPlane!=null)t=e=this._previewPlane,n=!0;else{this._setManipulatorVisibility(!1),this._setPreviewPlaneVisibility(!1);return}if(this._setManipulatorVisibility(!n),!n){let t=W(e,M.get());ve(this.shiftManipulator,t,e,this.view.state.camera),ye(this.rotateHeadingManipulator,t,e,this.view.renderCoordsHelper),be(this.rotateTiltManipulator,t,e),this.resizeManipulators.forEach((n,r)=>xe(n,this._resizeHandles[r],t,e))}this._setPreviewPlaneVisibility(n||this._mode===`place`),this._updatePreviewPlaneTransform(t),this._updateMaterials()}_setManipulatorVisibility(e){this.shiftManipulator.available=e,this.rotateHeadingManipulator.available=e,this.rotateTiltManipulator.available=e&&this.analysis.tiltEnabled,this.resizeManipulators.forEach(t=>t.available=e)}_updatePreviewPlaneTransform(e){let t=W(e,M.get()),n=ne(j.get(),g(e.basis1),g(e.basis2),1),r=m(M.get(),n),i=te(r,t,r);this._previewPlaneOutlineVisualElement.transform=i,this._previewPlaneGridVisualElement.transform=i}_setPreviewPlaneVisibility(e){let t=this._previewPlaneOutlineVisualElement,n=this._previewPlaneGridVisualElement;e&&(t.attached=!0,n.attached=!0),t.visible=e,n.visible=e}_updateMaterials(){let e=fe(this.view.effectiveTheme);e[3]*=this._previewPlaneOpacity;let t=ie(N);t[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=e,this._previewPlaneGridVisualElement.backgroundColor=t,this._previewPlaneGridVisualElement.gridColor=ae}_updateManipulatorsInteractive(e){e.grabbing?(this.shiftManipulator.interactive=this.shiftManipulator===e,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===e,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===e,this.resizeManipulators.forEach(t=>{t.interactive=t===e})):(this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,this.resizeManipulators.forEach(e=>{e.interactive=!0}))}_finishToolCreationIfValid(){this.analysis.valid&&this.finishToolCreation()}get test(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:e=>{this._pointerMoveTimerMs=e}}}};e([f()],Q.prototype,`_clock`,void 0),e([f({constructOnly:!0})],Q.prototype,`view`,void 0),e([f()],Q.prototype,`analysisViewData`,void 0),e([f({readOnly:!0})],Q.prototype,`state`,null),e([f({readOnly:!0})],Q.prototype,`cursor`,null),e([f()],Q.prototype,`analysis`,null),e([f()],Q.prototype,`multiTouchEnabled`,void 0),e([f()],Q.prototype,`removeIncompleteOnCancel`,void 0),e([f()],Q.prototype,`updating`,null),e([f()],Q.prototype,`_mode`,void 0),e([f()],Q.prototype,`mode`,null),e([f({value:null})],Q.prototype,`inputState`,null),e([f()],Q.prototype,`_placingSlicePlane`,null),Q=Z=e([ee(`esri.views.3d.analysis.Slice.SliceTool`)],Q);const De=Q;function Oe(e,t,n){let r=Se(t,T(n),e.direction,O()),i=S();return k(r,e,i)?{type:`shift`,shiftPlane:r,depth:0,startPoint:i}:null}function ke(e){return e.pointerType!==`mouse`||e.button===0}const Ae=C(),$=se();export{De as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../analysis/SlicePlane.js";import t from"../../../../core/Logger.js";import{rad2deg as n,deg2rad as r}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{fromZRotation as a,scale as o,multiply as s,rotateZ as c,rotateX as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{length as u,set as d,add as f,scale as p,copy as m,subtract as h,dot as g,normalize as _,cross as v,squaredLength as y,negate as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as x,create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import C from"../../../../geometry/Point.js";import{tryProject as w}from"../../../../geometry/projectionUtils.js";import{
|
|
2
|
+
import e from"../../../../analysis/SlicePlane.js";import t from"../../../../core/Logger.js";import{rad2deg as n,deg2rad as r}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{fromZRotation as a,scale as o,multiply as s,rotateZ as c,rotateX as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{length as u,set as d,add as f,scale as p,copy as m,subtract as h,dot as g,normalize as _,cross as v,squaredLength as y,negate as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as x,create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import C from"../../../../geometry/Point.js";import{tryProject as w}from"../../../../geometry/projectionUtils.js";import{create as T,rotate as E,normal as D,updateUnboundedPlane as ee,fromValues as te,intersectRay as ne}from"../../../../geometry/support/boundedPlane.js";import{fromPositionAndNormal as O,fromVectorsAndPoint as k}from"../../../../geometry/support/plane.js";import{create as re}from"../../../../geometry/support/ray.js";import{angleAroundAxis as ie}from"../../../../geometry/support/vector.js";import{sv3d as A,sm4d as j}from"../../../../geometry/support/vectorStacks.js";import{planeColor as ae,getGridColor as oe,getOutlineColor as M}from"./settings.js";import{resizeHandleEdgePaddingFrac as se,planeOutlineWidth as ce,planeMinBasisScreenLen2 as N,initialPlaneHalfSizeViewProportion as le,shiftRestartOffsetDistance as ue,smallAngleDotThreshold as P,verticalDotThreshold as de}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as fe}from"../support/projectionUtils.js";import{calculateTranslateRotateFromBases as pe}from"../../interactive/manipulatorUtils.js";import{LineVisualElement as F}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as I}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as L}from"../../support/RenderCoordsHelper.js";import{fromRender as R}from"../../support/geometryUtils/ray.js";function z(e,t,n,r,i,a,o,s){return V(t,o.worldUpAtPosition(e,A.get()),i,a,s.basis1,s.basis2),p(s.basis1,s.basis1,n),p(s.basis2,s.basis2,r),m(s.origin,e),k(s.basis2,s.basis1,s.origin,s.plane),s}const B=S();function V(e,t,n,r,i,a){let o=g(e,t),s=A.get(),c=A.get();switch(r===0?Math.abs(o)>de?1:2:r){case 2:{let r=Math.abs(o)<=P?e:b(B,n.viewUp);v(s,t,r),m(c,t);break}case 1:v(s,n.viewUp,t),v(c,t,s);break;case 3:{let r=Math.abs(o)<=P?t:n.viewUp;v(s,r,e),v(c,e,s);break}}let l=v(A.get(),s,c);g(l,n.viewForward)>0&&p(c,c,-1),_(i,s),_(a,c)}function H(e,t,n){let r=t.worldUpAtPosition(e.origin,A.get()),i=e.basis1,a=J(e,r),o=Math.round(a/$)*$;return E(e,o-a,i,n)}function me(e,t,n,r,i,a){let o=m(A.get(),i.origin);f(o,o,p(A.get(),i.basis1,e.direction[0]<0?1:-1)),f(o,o,p(A.get(),i.basis2,e.direction[1]<0?1:-1));let s=u(i.basis1),c=u(i.basis2),l=h(A.get(),n,o),d=h(A.get(),t,o),_=0,v=0;if(q(e)){let t=K(i),n=K(a);_=s-.5*e.direction[0]*g(i.basis1,d)/s,v=c-.5*e.direction[1]*g(i.basis2,d)/c;let r=n/t;_*=r,v*=r}let y=.5*e.direction[0]*g(i.basis1,l)/s,b=.5*e.direction[1]*g(i.basis2,l)/c,x=_+y,S=v+b,C=p(A.get(),i.basis1,x/s),w=p(A.get(),i.basis2,S/c);(x<=0||W(a.origin,C,r)<=N)&&m(C,a.basis1),(S<=0||W(a.origin,w,r)<=N)&&m(w,a.basis2);let T=m(A.get(),o);return f(T,T,p(A.get(),C,e.direction[0]<0?-1:1)),f(T,T,p(A.get(),w,e.direction[1]<0?-1:1)),te(T,C,w,a)}function he(e,t){return le*Math.min(t.width,t.height)*t.computeRenderPixelSizeAt(e)}function ge(e,t,n,r){let i=v(A.get(),t,n);return v(i,i,t),O(e,i,r)}function _e(e,t){return pe(e.basis1,e.basis2,e.origin,t)}function ve(e,t,n,r){let i=t.worldUpAtPosition(e.origin,A.get()),a=A.get();switch(n){case 1:m(a,i);break;case 2:m(a,e.basis1)}return O(e.origin,a,r)}function ye(e,t,n,r){let a=U(n,2),o=j.get();c(o,t,a.edge*Math.PI/2);let s=_(A.get(),a.basis),l=p(A.get(),s,a.direction*r.computeScreenPixelSizeAt(a.position)*ue);f(l,l,a.position);let u=r.projectToRenderScreen(l,i(A.get())),d=be(r,u);R(r,u,Q),_(Q.direction,Q.direction);let m=A.get();!d&&ne(n,Q,m)&&(l=m),o[12]=0,o[13]=0,o[14]=0,e.modelTransform=o,e.renderLocation=x(l),d?e.state|=Z:e.state&=~Z}function be(e,t){if(t==null)return!1;let[n,r,i,a]=e.viewport,o=Math.min(i,a)/16,s=!0;return t[0]<n+o?(t[0]=n+o,s=!1):t[0]>n+i-o&&(t[0]=n+i-o,s=!1),t[1]<r+o?(t[1]=r+o,s=!1):t[1]>r+a-o&&(t[1]=r+a-o,s=!1),s}function xe(e,t,n,r){let i=u(r.basis1),c=u(r.basis2),l=G(r),m=K(r),h=d(A.get(),0,0,0);f(h,p(A.get(),r.basis1,t.direction[0]),p(A.get(),r.basis2,t.direction[1])),f(h,r.origin,h);let g=0,_=1;if(q(t))t.direction[0]===1&&t.direction[1]===-1?g=$:t.direction[0]===1&&t.direction[1]===1?g=Math.PI:t.direction[0]===-1&&t.direction[1]===1&&(g=3*Math.PI/2),_=m;else{let e=t.direction[0]===0?2:1,n=e===1?c:i;g=e===1?$:0,_=n-l}let v=a(j.get(),g);o(v,v,d(A.get(),_,_,_)),s(v,n,v),v[12]=0,v[13]=0,v[14]=0,e.modelTransform=v,e.renderLocation=h}function Se(e,t,n,r){let i=r.worldUpAtPosition(n.origin,A.get()),o=U(n,0),c=a(j.get(),o.edge*Math.PI/2);l(c,c,-J(n,i)),s(c,t,c),c[12]=0,c[13]=0,c[14]=0,e.modelTransform=c,e.renderLocation=o.position}function Ce(e,t,n){let r=U(n,1),i=a(j.get(),r.edge*Math.PI/2);l(i,i,$),s(i,t,i),i[12]=0,i[13]=0,i[14]=0,e.modelTransform=i,e.renderLocation=r.position}function U(e,t){switch(t){case 0:return{basis:e.basis1,direction:1,position:f(A.get(),e.origin,e.basis1),edge:t};case 1:return{basis:e.basis2,direction:1,position:f(A.get(),e.origin,e.basis2),edge:t};case 2:return{basis:e.basis1,direction:-1,position:h(A.get(),e.origin,e.basis1),edge:t};case 3:return{basis:e.basis2,direction:-1,position:h(A.get(),e.origin,e.basis2),edge:t}}}function W(e,t,n){let r=n.projectToRenderScreen(f(A.get(),e,t),i(A.get())),a=n.projectToRenderScreen(h(A.get(),e,t),i(A.get()));return r&&a?y(h(r,r,a)):0}function G(e){let t=u(e.basis1),n=u(e.basis2);return se*Math.min(t,n)}function K(e){return G(e)}function q(e){return e.direction[0]!==0&&e.direction[1]!==0}function we(e){return new F({view:e,attached:!1,color:M(e.effectiveTheme),width:ce,renderOccluded:4,geometry:[[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]]],isDecoration:!0})}function Te(e){return new I({view:e,attached:!1,backgroundColor:ae,gridColor:oe(e.effectiveTheme),gridWidth:4,renderOccluded:4,isDecoration:!0})}function Ee(t,r,i,a=new e){if(t==null)return null;let{renderCoordsHelper:o}=r,s=o.fromRenderCoords(t.origin,new C({spatialReference:r.spatialReference}));if(s==null)return null;let c=w(s,i);if(c==null)return null;a.position=c;let l=u(t.basis1)*2,d=u(t.basis2)*2,f=L.renderUnitScaleFactor(r.spatialReference,i);a.width=l*f,a.height=d*f;let p=o.worldUpAtPosition(t.origin,A.get());return a.tilt=n(J(t,p)),a.heading=o.headingAtPosition(t.origin,t.basis1)-90,a}function J(e,t){return ie(t,e.basis2,e.basis1)+$}function De(e,n,i,a,o,s,c=T()){return s.toRenderCoords(e,c.origin)?(s.worldBasisAtPosition(c.origin,0,c.basis1),s.worldBasisAtPosition(c.origin,1,c.basis2),k(c.basis2,c.basis1,c.origin,c.plane),E(c,-r(n),D(c),c),E(c,r(i),c.basis1,c),p(c.basis1,c.basis1,a/2),p(c.basis2,c.basis2,o/2),ee(c),c):(t.getLogger(`esri.views.3d.analysis.Slice.sliceToolUtils`).error(`Failed to project slice plane position, projection from ${e.spatialReference.wkid} is not supported`),null)}function Y(e,t){if(e?.position==null)return null;let n=fe(e.position,t.spatialReference,t.elevationProvider);if(n==null)return null;let r=L.renderUnitScaleFactor(e.position.spatialReference,t.spatialReference),i=e.width*r,a=e.height*r;return{position:n,heading:e.heading,tilt:e.tilt,renderWidth:i,renderHeight:a}}function Oe(e,t,n,r=T()){let i=Y(e,t);return i==null?null:X(i,t,n,r)}function X(e,t,n,r=T()){if(e==null)return null;let i=De(e.position,e.heading,e.tilt,e.renderWidth,e.renderHeight,t.renderCoordsHelper,r);return!n.tiltEnabled&&i!=null&&H(i,t.renderCoordsHelper,i),i}const ke=16,Z=32,Q=re(),$=Math.PI/2,Ae=16,je=32;function Me(e){return(e.type===`building-scene-3d`?e:null)!=null}export{ke as DidPointerMoveRecentlyFlag,Z as IsShiftEdgeOnScreenFlag,_e as calculateBoundedPlaneTranslateRotate,K as calculateDiagonalResizeHandleScale,he as calculatePlaneHalfSize,Te as createGridVisualElement,we as createOutlineVisualElement,z as createPlane,ve as createRotatePlane,ge as createShiftPlane,H as forceHorizontalOrVertical,Me as isBuildingSceneLayerView3D,q as isDiagonalResizeHandle,V as normalToBases,Ee as planeToShape,Y as projectAndElevationAlignShape,X as projectedShapeToPlane,Ae as resizeNormal,je as resizeOutlineOnly,me as resizePlane,Oe as shapeToPlane,xe as updateResizeHandle,Se as updateRotateHeadingHandle,Ce as updateRotateTiltHandle,ye as updateShiftRestartHandle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Handles.js";import{handlesGroup as t}from"../../../../core/handleUtils.js";import{deg2rad as n,clamp as r}from"../../../../core/mathUtils.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a,initial as o}from"../../../../core/reactiveUtils.js";import{fromYRotation as s,fromXRotation as c,fromScaling as l,fromZRotation as u,fromRotation as d,multiply as f}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as m,sub as h,scale as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
2
|
+
import e from"../../../../core/Handles.js";import{handlesGroup as t}from"../../../../core/handleUtils.js";import{deg2rad as n,clamp as r}from"../../../../core/mathUtils.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a,initial as o}from"../../../../core/reactiveUtils.js";import{fromYRotation as s,fromXRotation as c,fromScaling as l,fromZRotation as u,fromRotation as d,multiply as f}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as m,sub as h,scale as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as y}from"../../../../geometry/support/boundedPlane.js";import{viewshedToolManipulatorConfiguration as b}from"./ViewshedConfiguration.js";import{screenToCircleAngle as x,getViewshedRotationMatrix as S}from"./viewshedToolUtils.js";import{Manipulator3D as C}from"../../interactive/Manipulator3D.js";import{RenderObject as w}from"../../interactive/RenderObject.js";import{InteractiveManipulation as T}from"../../interactive/editingTools/manipulations/InteractiveManipulation.js";import{createPolylineGeometry as E}from"../../webgl-engine/lib/GeometryUtil.js";import{assert as D}from"../../webgl-engine/lib/Util.js";import{RibbonLineMaterial as O}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as k}from"../../../interactive/dragEventPipeline.js";class A extends T{constructor(t){super(),this._handles=new e,this._tool=t.tool,this._view=t.view,this._focusedArcMaterial=this._createArcMaterial(!0),this._unfocusedArcMaterial=this._createArcMaterial(!1),this._createManipulators(),this.forEachManipulator(e=>this._tool.manipulators.add(e))}destroy(){this._handles=i(this._handles),this.forEachManipulator(e=>{this._tool.manipulators.remove(e),e.destroy()}),this._tool=null,this._view=null,this._manipulators=null}createDragPipeline(e,n){let r=Object.values(this._manipulators);return t(r.map(({manipulator:t,side:r})=>k(t,(t,i,a,o,s)=>{let c=L(r,n),l=i.next(e=>({...e,manipulatorType:2,side:r}));e(t,x(l,this._view,c,n),a)})))}updateManipulatorsTransform(e){e.arcCentersPoints(H),this._forEachManipulatorInfo(t=>this._updateArcManipulatorTransform(t,e,H[t.side]))}updateManipulatorVisuals(e){this._forEachManipulatorInfo(t=>this._updateArcManipulatorVisuals(t,e))}_updateArcManipulatorVisuals({manipulator:e,side:t},n){let r=[];if(n!=null){let[i,a]=j(t,n,this._unfocusedArcMaterial);r.push(new w(i,1),new w(i.instantiate({material:this._focusedArcMaterial}),2)),e.collisionType={type:`line`,paths:[a]}}e.renderObjects=r,e.radius=b.collisionRadius}_updateArcManipulatorTransform({manipulator:e,side:t},r,i){let a=r.horizontalFieldOfView,o=n(r.verticalFieldOfView/2),h=n(a/2),g=F(t);e.renderLocation=i;let _=p(),v=e=>{f(_,e,_)};v(s(z,n(-90))),g||v(c(z,o));let y=r.farDistanceRenderSpace;v(l(z,m(B,y,y,y))),v(u(z,P(t))),v(S(r,z));let b,x;g?(b=h,x=r.tiltedUpVector):(x=r.rightVector,b=o),b*=t===`right`||t===`bottom`?-1:1;let C=d(z,b,x);C!=null&&v(C),e.modelTransform=_}_createManipulators(){let e=this._createArcManipulator(`left`),t=this._createArcManipulator(`right`),n=this._createArcManipulator(`top`),r=this._createArcManipulator(`bottom`);this._manipulators={left:e,right:t,top:n,bottom:r},[[r.manipulator,n.manipulator],[e.manipulator,t.manipulator]].forEach(([e,t])=>{e.metadata={pairedManipulator:t},t.metadata={pairedManipulator:e}})}_createArcManipulator(e){let t=new C({view:this._view,autoScaleRenderObjects:!1,worldSized:!0}),n={manipulator:t,side:e};return this._updateArcManipulatorVisuals(n),this._handles.add(t.events.on([`focus-changed`,`grab-changed`],e=>{let n=t.metadata?.pairedManipulator;n!=null&&(n.hovering!==t.hovering&&(n.hovering=t.hovering),n.grabbing!==t.grabbing&&(n.grabbing=t.grabbing))})),n}_createArcMaterial(e){let t=b.getFovArcWidth(e),n=new O({renderOccluded:4,isDecoration:!0,width:t},this._view);return this._handles.add(a(()=>this._view.effectiveTheme.accentColor.toUnitRGBA(),e=>n.setParameters({color:e}),o)),n}forEachManipulator(e){Object.values(this._manipulators).forEach(({manipulator:t})=>e(t,2))}_forEachManipulatorInfo(e){Object.values(this._manipulators).forEach(t=>e(t))}get test(){return{manipulators:this._manipulators}}}function j(e,t,i){let{horizontalFieldOfView:a,verticalFieldOfView:o}=t,s=F(e),c=(s?o:a)/2,l=n(r(c,0,15)),u=s?1:Math.max(Math.sin(n(90-o/2)),.1),d=M(-l/2,l/2,u);return[E(i,d),d]}function M(e,t,n,r=10){D(r>1,`createArcPolylineGeometry() needs at least 2 for numVertices`);let i=t-e;if(i<=0||n<=0)return[v(0,0,.01),v(0,0,-.01)];let a=[],o=i/r;for(let i=0;i<r;i++){let s=e+i*o;i===r-1&&(s=t);let c=Math.cos(s)*n,l=Math.sin(s)*n,u=v(c-n,0,l);a.push(u)}return a}function N(e){switch(e){case`left`:return 0;case`bottom`:return 1;case`right`:return 2;case`top`:return 3}}function P(e){return N(e)*R}function F(e){return e===`left`||e===`right`}function I(e){return e===`left`?`right`:e===`right`?`left`:e===`top`?`bottom`:`top`}function L(e,t){let{elevationAlignedObserverRenderSpace:n,elevationAlignedTargetRenderSpace:r,tiltedUpVector:i,rightVector:a,farDistanceRenderSpace:o}=t,s=h(B,r,n),c=F(e)?a:i,l=g(V,c,o);return y(n,s,l)}const R=Math.PI/2,z=p(),B=_(),V=_(),H={top:_(),bottom:_(),left:_(),right:_()};export{A as ViewshedFieldOfViewManipulation,M as createArcPolylineVertices,I as flipSide,F as isSideHorizontal,P as sideToRad};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Handles.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{fromScaling as n,fromTranslation as r,fromZRotation as i,mul as a,fromYRotation as o,multiply as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{add as l,scale as u,sub as d,len as f,dot as p,scaleAndAdd as m,normalize as h,set as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
2
|
+
import e from"../../../../core/Handles.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{fromScaling as n,fromTranslation as r,fromZRotation as i,mul as a,fromYRotation as o,multiply as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{add as l,scale as u,sub as d,len as f,dot as p,scaleAndAdd as m,normalize as h,set as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as v}from"../../../../geometry/support/boundedPlane.js";import{fromValues as y}from"../../../../geometry/support/ray.js";import{displayFocusMultiplier as b}from"../Slice/sliceToolConfig.js";import{ViewshedArrowManipulator as x}from"./ViewshedArrowManipulator.js";import{viewshedToolManipulatorConfiguration as S}from"./ViewshedConfiguration.js";import{screenToCircleAngle as C,getViewshedRotationMatrix as w}from"./viewshedToolUtils.js";import{screenToRenderRay as T}from"../../interactive/editingTools/dragEventPipeline3D.js";import{discRadiusSmall as E,discRadius as D}from"../../interactive/editingTools/manipulations/config.js";import{InteractiveManipulation as O}from"../../interactive/editingTools/manipulations/InteractiveManipulation.js";import{createManipulatorDragEventPipeline as k,dragAtLocation as A}from"../../../interactive/dragEventPipeline.js";class j extends O{constructor(t){super(),this._handles=new e,this._tool=t.tool,this._view=t.view;let n=S.scaleOrientHandleRadius;this._manipulatorHeading=new x(this._view,n),this._manipulatorTilt=new x(this._view,n),this._manipulatorDistance=new x(this._view,n),this.forEachManipulator(e=>this._tool.manipulators.add(e))}destroy(){this._handles.destroy(),this.forEachManipulator(e=>{this._tool.manipulators.remove(e),e.destroy()}),this._manipulatorHeading=null,this._manipulatorTilt=null,this._manipulatorDistance=null,this._tool=null,this._view=null}createHeadingDragPipeline(e,n){return k(this._manipulatorHeading,(r,i,a,o,s)=>{let c=this._view,{tiltParallelToSurface:p,farDistanceRenderSpace:m,upVector:h,elevationAlignedObserverRenderSpace:g,elevationAlignedTargetRenderSpace:_,rightVector:y}=n,b=Math.sin(t(p))*m,x=l(P,g,u(F,h,b)),S=d(F,_,x),w=u(I,y,f(S)),T=v(x,S,w);e(r,C(i,c,T,n).next(e=>({...e,manipulatorType:3})),a)})}createTiltDragPipeline(e,t){return k(this._manipulatorTilt,(n,r,i,a,o)=>{let{elevationAlignedObserverRenderSpace:s,farDistanceRenderSpace:c,upVector:l,targetDirection:d}=t,f=p(d,l),g=m(P,d,l,-f);u(g,h(g,g),c);let _=u(F,l,c),y=v(s,g,_);e(n,C(r,this._view,y,t).next(e=>({...e,manipulatorType:3})),i)})}createDistanceDragPipeline(e,t){return k(this._manipulatorDistance,(n,r,i,a,o)=>{let s=y(t.elevationAlignedObserverRenderSpace,t.targetDirection);e(n,r.next(A(this._view,n.location)).next(T(this._view,s)).next(e=>({...e,manipulatorType:2})),i)})}updateManipulators(e){let{elevationAlignedTargetRenderSpace:t}=e;this._manipulatorHeading.renderLocation=t,this._manipulatorTilt.renderLocation=t,this._manipulatorDistance.renderLocation=t;let l=c(),d=e=>{s(l,e,l)},f=S.scaleOrientSize*(E/D);d(n(M,g(P,f,f,f))),d(w(e,M));let p=S.scaleOrientHandleRadius*b*f,m=u(P,e.targetDirection,p);d(r(M,m));let h=i(M,-L);a(h,h,o(N,-L)),this._manipulatorHeading.modelTransform=a(c(),l,h);let _=o(M,L);a(_,_,i(N,Math.PI)),this._manipulatorTilt.modelTransform=s(c(),l,_),this._manipulatorDistance.modelTransform=l}forEachManipulator(e){e(this._manipulatorHeading,3),e(this._manipulatorTilt,3),e(this._manipulatorDistance,2)}}const M=c(),N=c(),P=_(),F=_(),I=_(),L=Math.PI/2;export{j as ViewshedScaleOrientManipulation};
|
|
@@ -66,24 +66,26 @@ export default class SunLighting extends SunLightingSuperclass {
|
|
|
66
66
|
/**
|
|
67
67
|
* Enables global illumination for more realistic lighting in the scene through ambient occlusion and emissive lighting.
|
|
68
68
|
* * **Ambient occlusion** darkens areas where surrounding geometry blocks ambient light, adding definition to corners, crevices, and spaces between buildings.
|
|
69
|
-
* * **Emissive lighting** illuminates surfaces near emissive materials. The illumination depends on the emitters’ strength and color, as well as their distance from the surfaces they illuminate.
|
|
69
|
+
* * **Emissive lighting** illuminates surfaces near emissive materials. The illumination depends on the emitters’ strength and color, as well as their distance from the surfaces they illuminate. See the [Visualizations with light-emitting symbols sample](/sample-code/light-emitting-symbols/) for more details on configuring emissive symbols.
|
|
70
70
|
*
|
|
71
71
|
* <figure>
|
|
72
72
|
* <img src="https://developers.arcgis.com/javascript/latest/assets/references/core/views/3d/gi-onoff.avif"
|
|
73
73
|
* alt="Comparison of scene lighting with global illumination enabled and disabled" />
|
|
74
|
-
* <figcaption>Global illumination, enabled on the right,
|
|
74
|
+
* <figcaption>Global illumination, enabled on the right, provides more detailed ambient occlusion shading and emissive lighting.</figcaption>
|
|
75
75
|
* </figure>
|
|
76
76
|
*
|
|
77
|
-
* Global illumination
|
|
77
|
+
* Global illumination is a camera-dependent, screen-space approximation based on visible depth, surface normals, and recent frame data. It is not a physically exact lighting simulation or a scene-wide path tracer. Off-screen or hidden geometry cannot reliably provide indirect light.
|
|
78
|
+
* It is meant to be used mainly for visual context, not illumination measurements or lighting-compliance analysis.
|
|
79
|
+
*
|
|
80
|
+
* Global illumination progressively accumulates lighting over multiple frames, reducing noise and improving visual quality. After camera or scene changes, lighting settles over successive rendered frames. During navigation, reduced resolution trades detail for rendering cost.
|
|
78
81
|
*
|
|
79
|
-
* Global illumination progressively accumulates lighting over multiple frames, reducing noise and improving visual quality. Camera movements and animated objects may cause temporary noise or other visual artifacts.
|
|
80
82
|
*
|
|
81
83
|
* **Known limitations**
|
|
82
84
|
*
|
|
83
|
-
* -
|
|
84
|
-
* -
|
|
85
|
-
* -
|
|
86
|
-
* -
|
|
85
|
+
* - Global illumination is not supported with [GaussianSplatLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GaussianSplatLayer/): neither ambient occlusion nor emissive lighting will be computed for this layer.
|
|
86
|
+
* - [SceneView.takeScreenshot()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#takeScreenshot) uses a dedicated accumulation path to compute global illumination. Captures with global illumination enabled can therefore take substantially longer to finish.
|
|
87
|
+
* - Small emitters, or emitters that appear small on screen due to distance may produce only weak illumination. Increasing size, [emissive strength](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/Symbol3DEmissive/#strength) and enabling [glow](https://developers.arcgis.com/javascript/latest/references/core/webscene/Glow/) can help improve visibility, but cannot guarantee a particular light footprint or replace missing screen-space samples from arbitrary distances and angles.
|
|
88
|
+
* - Global illumination is disabled at high camera altitudes.
|
|
87
89
|
*
|
|
88
90
|
* @default false
|
|
89
91
|
* @beta
|
|
@@ -44,24 +44,26 @@ export default class VirtualLighting extends VirtualLightingSuperclass {
|
|
|
44
44
|
/**
|
|
45
45
|
* Enables global illumination for more realistic lighting in the scene through ambient occlusion and emissive lighting.
|
|
46
46
|
* * **Ambient occlusion** darkens areas where surrounding geometry blocks ambient light, adding definition to corners, crevices, and spaces between buildings.
|
|
47
|
-
* * **Emissive lighting** illuminates surfaces near emissive materials. The illumination depends on the emitters’ strength and color, as well as their distance from the surfaces they illuminate.
|
|
47
|
+
* * **Emissive lighting** illuminates surfaces near emissive materials. The illumination depends on the emitters’ strength and color, as well as their distance from the surfaces they illuminate. See the [Visualizations with light-emitting symbols sample](/sample-code/light-emitting-symbols/) for more details on configuring emissive symbols.
|
|
48
48
|
*
|
|
49
49
|
* <figure>
|
|
50
50
|
* <img src="https://developers.arcgis.com/javascript/latest/assets/references/core/views/3d/gi-onoff.avif"
|
|
51
51
|
* alt="Comparison of scene lighting with global illumination enabled and disabled" />
|
|
52
|
-
* <figcaption>Global illumination, enabled on the right,
|
|
52
|
+
* <figcaption>Global illumination, enabled on the right, provides more detailed ambient occlusion shading and emissive lighting.</figcaption>
|
|
53
53
|
* </figure>
|
|
54
54
|
*
|
|
55
|
-
* Global illumination
|
|
55
|
+
* Global illumination is a camera-dependent, screen-space approximation based on visible depth, surface normals, and recent frame data. It is not a physically exact lighting simulation or a scene-wide path tracer. Off-screen or hidden geometry cannot reliably provide indirect light.
|
|
56
|
+
* It is meant to be used mainly for visual context, not illumination measurements or lighting-compliance analysis.
|
|
57
|
+
*
|
|
58
|
+
* Global illumination progressively accumulates lighting over multiple frames, reducing noise and improving visual quality. After camera or scene changes, lighting settles over successive rendered frames. During navigation, reduced resolution trades detail for rendering cost.
|
|
56
59
|
*
|
|
57
|
-
* Global illumination progressively accumulates lighting over multiple frames, reducing noise and improving visual quality. Camera movements and animated objects may cause temporary noise or other visual artifacts.
|
|
58
60
|
*
|
|
59
61
|
* **Known limitations**
|
|
60
62
|
*
|
|
61
|
-
* -
|
|
62
|
-
* -
|
|
63
|
-
* -
|
|
64
|
-
* -
|
|
63
|
+
* - Global illumination is not supported with [GaussianSplatLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GaussianSplatLayer/): neither ambient occlusion nor emissive lighting will be computed for this layer.
|
|
64
|
+
* - [SceneView.takeScreenshot()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#takeScreenshot) uses a dedicated accumulation path to compute global illumination. Captures with global illumination enabled can therefore take substantially longer to finish.
|
|
65
|
+
* - Small emitters, or emitters that appear small on screen due to distance may produce only weak illumination. Increasing size, [emissive strength](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/Symbol3DEmissive/#strength) and enabling [glow](https://developers.arcgis.com/javascript/latest/references/core/webscene/Glow/) can help improve visibility, but cannot guarantee a particular light footprint or replace missing screen-space samples from arbitrary distances and angles.
|
|
66
|
+
* - Global illumination is disabled at high camera altitudes.
|
|
65
67
|
*
|
|
66
68
|
* @default false
|
|
67
69
|
* @beta
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{rad2deg as e}from"../../../../../../core/mathUtils.js";import{rotateX as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{add as n,copy as r}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a}from"../../../../../../
|
|
2
|
+
import{rad2deg as e}from"../../../../../../core/mathUtils.js";import{rotateX as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{add as n,copy as r}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as a}from"../../../../../../geometry/support/boundedPlane.js";import{create as o,intersectRay as s,getNormal as c}from"../../../../../../geometry/support/plane.js";import{sm4d as l,sv3d as u}from"../../../../../../geometry/support/vectorStacks.js";import{getRotateHeadingTexture as d}from"../../../../analysis/images/Factory.js";import{createRotatePlane as f}from"../../../../analysis/Slice/sliceToolUtils.js";import{calculateInputRotationTransform as p}from"../../../manipulatorUtils.js";import{screenToRenderPlane as m}from"../../dragEventPipeline3D.js";import{RotateManipulator as h}from"../../../manipulators/RotateManipulator.js";import{fromScreenNormalized as g}from"../../../../support/geometryUtils/ray.js";import{createManipulatorDragEventPipeline as _}from"../../../../../interactive/dragEventPipeline.js";import{ExtentRotateTooltipInfo as v}from"../../../../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";class y{get _object(){return this._tool.object}get _operations(){return this._object.operations}constructor(e,t,n){this._tool=e,this._bounds=t,this._snapRotation=n,this._rotateTooltipInfo=null,this._startAngle=0,this._endAngle=0;let r=this._tool,i=r.view,a=!i.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this.rotateManipulator=new h(i,(e,t)=>d(i.stage.textures,{accentColor:e,contrastColor:t,preMultiplyAlpha:a})),r.addHandles([this.rotateManipulator.events.on(`grab-changed`,e=>this._onGrabChanged(e)),this._createRotateDragPipeline(this.rotateManipulator)]),r.manipulators.add(this.rotateManipulator),r.addHandles([r.events.on(`rotate-start`,e=>this._startAngle=e.angle),r.events.on(`rotate`,e=>this._endAngle=e.angle),r.events.on(`rotate-stop`,()=>{this._startAngle=0,this._endAngle=0})])}destroy(){this._tool.manipulators.remove(this.rotateManipulator),this.rotateManipulator.destroy()}forEachManipulator(e){e(this.rotateManipulator,3)}updateManipulators(e,r){let i=this._bounds.mapBounds.plane[2]<0?Math.PI:0,a=t(l.get(),e,i);a[12]=0,a[13]=0,a[14]=0,this.rotateManipulator.modelTransform=a,this.rotateManipulator.renderLocation=n(u.get(),r.origin,r.basis1)}getUpdatedTooltipInfo(){return this.rotateManipulator.focused?this._computeRotateTooltipInfo():null}_computeRotateTooltipInfo(){let e=this._rotateTooltipInfo??=new v({toolOptions:this._tool.toolOptions});return e.angle=this._startAngle-this._endAngle,e}_onGrabChanged({action:e,screenPoint:t}){let n=this._tool,r=this._bounds;if(e!==`start`||!t)return;let i=f(r.displayBounds,n.view.renderCoordsHelper,1,o()),a=g(n.view.state.camera,t);s(i,a,u.get())&&(r.backupMapBounds(),n.inputState={type:`rotate`,rotatePlane:i})}_createRotateDragPipeline(t){let{_tool:n,_object:r}=this;return _(t,(t,i,a)=>{let o=n.inputState;o!=null&&(i.next(e=>(e.action===`start`&&n.events.emit(`rotate-start`,{object:r,angle:0}),e)).next(m(n.view,o.rotatePlane)).next(this._renderPlaneToAngle()).next(...this._snapRotation()).next(this._updateGeometry()).next(t=>{let i={object:r,angle:e(t.rotateAngle)};switch(t.action){case`start`:case`update`:n.events.emit(`rotate`,i);break;case`end`:n.inputState=null,n.events.emit(`rotate-stop`,i)}return t}),a.next(()=>{n.inputState!=null&&n.events.emit(`rotate-stop`,{object:r,angle:0}),n.cancelDrag()}))})}_renderPlaneToAngle(){return e=>{let t=p(e.renderStart,e.renderEnd,this._bounds.displayBounds.origin,c(e.plane));return{...e,rotateAngle:t}}}_updateGeometry(){let e=this._bounds;return t=>{let n=r(i(),e.mapBoundsStart.origin),o=t.action===`start`?0:1;if(this._operations){let r=this._operations.rotate(n,t.rotateAngle,o,1);a(e.mapBoundsStart,e.mapBounds),e.updateMapBoundsFromOperation(r)}return t}}}export{y as ExtentRotate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{set as e,normalize as t}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as r,scaleAndAdd as i,subtract as a,length as o,dot as s}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as l}from"../../../../../../core/support/UpdatingHandles.js";import{
|
|
2
|
+
import{set as e,normalize as t}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as r,scaleAndAdd as i,subtract as a,length as o,dot as s}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as l}from"../../../../../../core/support/UpdatingHandles.js";import{create as u,copy as d}from"../../../../../../geometry/support/boundedPlane.js";import{intersectRay as f}from"../../../../../../geometry/support/plane.js";import{sv3d as p}from"../../../../../../geometry/support/vectorStacks.js";import{updateResizeHandle as m,isDiagonalResizeHandle as h,calculateDiagonalResizeHandleScale as g}from"../../../../analysis/Slice/sliceToolUtils.js";import{screenToRenderPlane as _}from"../../dragEventPipeline3D.js";import{mapPlaneAutoSize2D as v}from"./extentUtils.js";import{ResizeManipulator as y}from"../../../manipulators/ResizeManipulator.js";import{fromScreenNormalized as b}from"../../../../support/geometryUtils/ray.js";import{createManipulatorDragEventPipeline as x}from"../../../../../interactive/dragEventPipeline.js";import{ExtentScaleTooltipInfo as S}from"../../../../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{GeometryWorkerHandle as C}from"../../../../../support/GeometryWorkerHandle.js";class w{get _object(){return this._tool.object}get _operations(){return this._object.operations}get updating(){return this._updatingHandles.updating}get zMax(){if(!this._zMaxDirty||!this._operations)return this._zMax;let e=this._operations.data;if(!e.geometry.hasZ)this._zMax=0;else{let t=e.coordinateHelper;this._zMax=-1/0;for(let n of e.parts)for(let e of n.vertices){let n=t.getZ(e.pos)??0;this._zMax=Math.max(n,this._zMax)}}return this._zMaxDirty=!1,this._zMax}constructor(e,t,n){this._tool=e,this._bounds=t,this._preserveAspectRatioStep=n,this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._displayBoundsStart=u(),this._displayBoundsMarginStart=0,this._updatingHandles=new l,this._measurementWorker=new C({preloadGeodetic:!0}),this._zMax=0,this._zMaxDirty=!0;let r=this._tool,i=r.view;this.resizeManipulators=this._resizeHandles.map(e=>{let t=new y(i,e);return r.addHandles([t.events.on(`grab-changed`,e=>this._onGrabChanged(e)),this._createResizeDragPipeline(t,e)]),t}),r.manipulators.addMany(this.resizeManipulators),this._operations&&r.addHandles(this._operations.data.on(`change`,()=>{r.inputState?.type!==`resize`&&(this._zMaxDirty=!0)}))}destroy(){this.forEachManipulator(e=>{this._tool.manipulators.remove(e),e.destroy()}),this._measurementWorker.destroy(),this._updatingHandles.destroy()}forEachManipulator(e){this.resizeManipulators.forEach(t=>e(t,2))}updateManipulators(e,t){this.resizeManipulators.forEach((n,r)=>{m(n,this._resizeHandles[r],e,t)})}getUpdatedTooltipInfo(){if(!this.resizeManipulators.some(e=>e.focused))return null;let e=this._tooltipInfo??=new S({toolOptions:this._tool.toolOptions});return this.resizeManipulators.some(e=>e.dragging)||(e.xScale=1,e.yScale=1),this._updatingHandles.consumePromise(v(this._bounds.mapBounds,this.zMax,this._bounds.spatialReference,this._measurementWorker).then(({width:t,height:n})=>{e.xSize=t,e.ySize=n})),e}_onGrabChanged({action:e,screenPoint:t}){let n=this._tool,r=this._bounds;if(e!==`start`||!t)return;let i=b(n.view.state.camera,t);f(r.displayBounds.plane,i,p.get())&&(r.backupMapBounds(),d(r.displayBounds,this._displayBoundsStart),this._displayBoundsMarginStart=r.displayBoundsMargin,n.inputState={type:`resize`})}_createResizeDragPipeline(e,t){let{_tool:n,_object:r}=this;return x(e,(e,i,a)=>{let o;n.inputState!=null&&(i.next(e=>(e.action===`start`&&n.events.emit(`scale-start`,{object:r,xScale:1,yScale:1}),{...e,handle:t})).next(_(n.view,this._displayBoundsStart.plane)).next(this._renderPlaneToFactors()).next(...this._preserveAspectRatioStep()).next(e=>(e.action===`end`&&o?[e.factor1,e.factor2]=o:o=[e.factor1,e.factor2],e)).next(this._updateGeometry()).next(e=>{let t=this._tooltipInfo;t&&(t.xScale=e.factor1,t.yScale=e.factor2);let i={object:r,xScale:e.factor1,yScale:e.factor2};switch(e.action){case`start`:case`update`:n.events.emit(`scale`,i);break;case`end`:n.inputState=null,n.events.emit(`scale-stop`,i)}return e}),a.next(()=>{n.inputState!=null&&n.events.emit(`scale-stop`,{object:r,xScale:1,yScale:1}),n.cancelDrag()}))})}_renderPlaneToFactors(){let e=this._bounds;return t=>{let n=this._displayBoundsStart,c=t.handle.direction,l=e.displayBoundsMargin,u=this._displayBoundsMarginStart,d=r(p.get(),n.origin);i(d,d,n.basis1,-c[0]),i(d,d,n.basis2,-c[1]);let f=a(p.get(),t.renderEnd,d),m=a(p.get(),t.renderStart,d),_=h(t.handle),v=g(n),y=g(e.displayBounds)/v,b=(e,t)=>{if(e===0)return 1;let n=o(t),r=.5*e*s(t,f)/n,i=r<0?-1:1;if(_){let a=n-.5*e*s(t,m)/n;r+=a*i*y}let a=n<u*1.5?1:T;return n=Math.max(n-u,T),i>0&&(r-=l),i*Math.max(r/n*i,a)};return{...t,factor1:b(c[0],n.basis1),factor2:b(c[1],n.basis2)}}}_updateGeometry(){let a=this._bounds;return o=>{let s=r(c(),a.mapBoundsStart.origin);i(s,s,a.mapBoundsStart.basis1,-o.handle.direction[0]),i(s,s,a.mapBoundsStart.basis2,-o.handle.direction[1]);let l=e(n(),a.mapBoundsStart.basis1[0],a.mapBoundsStart.basis1[1]);t(l,l);let u=o.action===`start`?0:1;if(this._operations){let e=this._operations.scale(s,l,o.factor1,o.factor2,u,1);d(a.mapBoundsStart,a.mapBounds),a.updateMapBoundsFromOperation(e)}return o}}}const T=1e-6;export{w as ExtentScale,T as scaleEpsilon};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{on as e}from"../../../../../../core/reactiveUtils.js";import{scale as t}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{add as n,subtract as r,scale as i,lerp as a,cross as o,normalize as s,dot as c,copy as l,scaleAndAdd as u}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import f from"../../../../../../geometry/Point.js";import{
|
|
2
|
+
import{on as e}from"../../../../../../core/reactiveUtils.js";import{scale as t}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{add as n,subtract as r,scale as i,lerp as a,cross as o,normalize as s,dot as c,copy as l,scaleAndAdd as u}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import f from"../../../../../../geometry/Point.js";import{create as p,copy as m,updateUnboundedPlane as h}from"../../../../../../geometry/support/boundedPlane.js";import{fromPositionAndNormal as g,projectPoint as _}from"../../../../../../geometry/support/plane.js";import{sv3d as v}from"../../../../../../geometry/support/vectorStacks.js";import{mainAxis as y}from"../../geometryUtils.js";import{manipulatedObjectGeometry as b}from"../../manipulatedObjectUtils.js";import{evaluateElevationAlignmentAtPoint as x}from"../../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as S}from"../../../../layers/graphics/ElevationContext.js";import{apply as C,applyInverse as w,calculateOrientedBounds as T}from"../../../../../interactive/editGeometry/support/editPlaneUtils.js";class E{constructor(t,n){this._tool=t,this.mapBounds=p(),this.mapBoundsStart=p(),this.displayBounds=p(),t.addHandles(e(()=>t.object,`modified-externally`,()=>this._resetMapBounds(),{onListenerAdd:()=>this._resetMapBounds()})),this._onDisplayBoundsChanged=n}get displayBoundsMargin(){let{view:e,object:t}=this._tool,n=b(t),r=e.pointsOfInterest?.centerOnSurfaceFrequent.location??n?.extent?.center;return r?D*e.pixelSizeAt(r):0}backupMapBounds(){m(this.mapBounds,this.mapBoundsStart)}updateDisplayBounds(){this._calculateDisplayBounds(),this._onDisplayBoundsChanged?.()}updateMapBoundsFromOperation(e){C(e,this.mapBounds),this.updateDisplayBounds()}updateMapBoundsFromOperationInverse(e){w(e,this.mapBounds),this.updateDisplayBounds()}_resetMapBounds(){this._calculateMapBounds(),this.updateDisplayBounds()}_calculateMapBounds(){let{view:e,attachmentOrigin:n,object:r}=this._tool,i=r.operations?.data;if(!i)return;let a=i.geometry;this.spatialReference=a.spatialReference;let o=y(a);t(o,o,-1);let s=n?e.pixelSizeAt(n,a.spatialReference):0,c=O*s,l=i.coordinateHelper.hasZ()&&r.elevationInfo.mode!==`on-the-ground`;T(o,i,c,this.mapBounds,l)}_calculateDisplayBounds(){let{view:e,attachmentOrigin:t}=this._tool,n=t?.z??x(this.mapBounds.origin,e.elevationProvider,S.fromElevationInfo(this._tool.object.elevationInfo),e.renderCoordsHelper);k(this.mapBounds,n??0,e.renderCoordsHelper,this.spatialReference,this.displayBoundsMargin,this.displayBounds)}}const D=10,O=80;function k(e,t,u,d,f=0,m){m||=p();let y=v.get();n(y,e.origin,e.basis1),n(y,y,e.basis2),u.toRenderCoords(y,d,y);let b=v.get();n(b,e.origin,e.basis1),r(b,b,e.basis2),u.toRenderCoords(b,d,b);let x=v.get();r(x,e.origin,e.basis1),r(x,x,e.basis2),u.toRenderCoords(x,d,x);let S=v.get();r(S,e.origin,e.basis1),n(S,S,e.basis2),u.toRenderCoords(S,d,S),n(m.origin,y,b),n(m.origin,m.origin,x),n(m.origin,m.origin,S),i(m.origin,m.origin,.25),r(y,y,m.origin),r(b,b,m.origin),r(x,x,m.origin),r(S,S,m.origin);let C=a(v.get(),y,b,.5),w=a(v.get(),x,S,.5);i(w,w,-1),a(m.basis1,C,w,.5);let T=a(v.get(),y,S,.5),E=a(v.get(),b,x,.5);i(E,E,-1),a(m.basis2,T,E,.5);let D=o(v.get(),m.basis1,m.basis2);o(m.basis2,D,m.basis1),s(m.basis1,m.basis1);let O=Math.max(Math.abs(c(m.basis1,y)),Math.abs(c(m.basis1,b)),Math.abs(c(m.basis1,x)),Math.abs(c(m.basis1,S)));s(m.basis2,m.basis2);let k=Math.max(Math.abs(c(m.basis2,y)),Math.abs(c(m.basis2,b)),Math.abs(c(m.basis2,x)),Math.abs(c(m.basis2,S)));i(m.basis1,m.basis1,O+f),i(m.basis2,m.basis2,k+f);let A=l(v.get(),e.origin);return A[2]=t,u.toRenderCoords(A,d,A),g(A,D,m.plane),_(m.plane,m.origin,m.origin),h(m),m}async function A(e,t,n,i){return r(F,r(F,e.origin,e.basis1),e.basis2),u(P,F,e.basis1,2),u(N,P,e.basis2,2),u(M,F,e.basis2,2),F[2]=P[2]=N[2]=M[2]=t,i.autoSize2D(j(I,M,n),j(L,N,n),j(R,P,n),j(z,F,n))}function j(e,t,n){return e.x=t[0],e.y=t[1],e.spatialReference=n,e}const M=d(),N=d(),P=d(),F=d(),I=new f,L=new f,R=new f,z=new f;export{E as TransformBounds,A as mapPlaneAutoSize2D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{lerp as n}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as l,scale as u,round as d,copy as f,set as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as m,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as g,transformMat4 as _,scale as v}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as b}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as ee}from"../../../../geometry/ellipsoidUtils.js";import{create as x,empty as te,copy as S,offset as C,width as w,height as ne,expand as T}from"../../../../geometry/support/aaBoundingRect.js";import{h as E,c as re,a as ie}from"../../../../chunks/boundedPlane.js";import{create as D}from"../../../../geometry/support/ray.js";import{Sphere as O,sphereCSO as k}from"../../../../geometry/support/sphere.js";import{InternalRenderCategory as A}from"../../webgl.js";import{DeconflictAABR as j}from"./DeconflictAABR.js";import{prepare as M,drawPoly as N}from"./deconflictorDebug.js";import{isSymbolLayerWithTransparencyMode as P}from"./transparencyUtils.js";import F from"../../webgl/RenderCamera.js";import{getVec3AttributeView as I,getScalarAttributeView as L}from"../../webgl-engine/lib/attributeViewUtils.js";import{GPUPointOcclusionQuery as R}from"../../webgl-engine/lib/GPUPointOcclusionQuery.js";import{SeparateScreenSizePerspectiveEvaluators as z}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{HUDMaterial as B}from"../../webgl-engine/materials/HUDMaterial.js";import{Yield as V}from"../../../support/Yield.js";const H=h(),U=h(),W=h(),G=h(),K=y(),q=y(),J=h(),Y=s(),ae=new O,X=D(),oe=h(),Z=x();class se{constructor(e){this.id=e,this.aabr=x(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1,this.priority=0}}function ce(e,t){let n=e.distanceToOccluder!==0&&e.distance>e.distanceToOccluder,r=t.distanceToOccluder!==0&&t.distance>t.distanceToOccluder;return n===r?e.priority===t.priority?e.distance===t.distance?e.visible===t.visible?e.id-t.id:+t.visible-e.visible:e.distance-t.distance:t.priority-e.priority:+n-r}class le{constructor(e,t){this.graphics3DGraphic=e,this.slicePlaneEnabled=t,this._info=null,this._labelInfo=null}ensureInfo(e){let t=this.getInfo(e);return t||(t=new se(this.graphics3DGraphic.graphic.uid),this._setInfo(e,t)),t}getInfo(e){return e===16?this._labelInfo:this._info}removeInfo(e){this._setInfo(e,null)}_setInfo(e,t){e===16?this._labelInfo=t:this._info=t}}class Q{constructor(){this.camera=new F,this.slicePlane=re(),this.slicePlaneEnabled=!1}copyFrom(e){this.camera.equals(e.camera)||this.camera.copyFrom(e.camera),ie(e.slicePlane,this.slicePlane),this.slicePlaneEnabled=e.slicePlaneEnabled}}let $=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(e){super(e),this._dirty=!1,this._viewState=new Q,this._state=0,this._checkOcclusion=new Map,this._active=new Map,this._checkOcclusionIterator=null,this._activeIterator=null,this._occlusionQueryUids=[],this._updatingHandles=new b,this._deconflictor=new j((e,t)=>{e.visible=t,this._setGraphicVisibility(this._active.get(e.id),t)},(e,t)=>e.id!==t.id,ce),this._baseOccludedVisibility=10,this._altitudeFactor=2,this._minAltitudeDifference=100}initialize(){this._updatingHandles.add(()=>(this.view?.map?.ground?.opacity??0)>0,()=>this.setDirty()),this._updatingHandles.add(()=>this.view.ready,()=>{this._occlusionQuery=null,this._opaqueOcclusionQuery=null,this.setDirty()})}destroy(){this._occlusionQuery=null,this._opaqueOcclusionQuery=null,this._updatingHandles.destroy(),this._deconflictor.destroy(),this._checkOcclusion.clear(),this._active.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._checkOcclusion.size>0)&&(this._dirty=!0,this.notifyChange(`_readyToRun`))}setPriority(e,t){let n=this._active.get(e.graphic.uid)?.getInfo(this.visibilityGroup);n&&(n.priority=t)}get _readyToRun(){return this._state!==0||this._dirty}get updating(){return this._readyToRun||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;let e=this._state/5;return this._dirty?e*.5:e}get readyToRun(){return this.view.ready&&this.view.state!=null&&this._readyToRun}get usedMemory(){return this._occlusionQuery?.usedMemory??0+(this._occlusionQueryUids?.length??0)*4}runTask(e){switch(this._state){case 0:this._startUpdate(),e.madeProgress();case 1:if(this._state=1,!this._processCheckOcclusion(e))return;case 2:if(this._state=2,!(this._occlusionQuery?.done??!0)||!(this._opaqueOcclusionQuery?.done??!0))return V;this._readOcclusionQueryResult(),e.madeProgress();case 3:if(this._state=3,!this._collectActiveGraphics(e))return;case 4:if(this._state=4,this._deconflictor.run(e),!this._deconflictor.done)return;default:this._state=0,this.notifyChange(`_readyToRun`)}}setGraphicsActive(e,t){t?e.forEach(e=>this.addToActiveGraphics(e)):e.forEach(e=>this.removeFromActiveGraphics(e))}isSupportedLayer(e){if(e==null||e.type!==`buffer`||!e.hiddenIfDeconflicted)return!1;let t=e.stageObject;return(t?.geometries.length??0)===1&&t?.geometries[0]?.material instanceof B}_startUpdate(){M(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);let{fullWidth:e,fullHeight:t}=this._viewState.camera;this._deconflictor.reset(e,t),this._resetIterators(),this._occlusionQueryUids.length=0,this._checkOcclusion.size||(this._occlusionQuery=r(this._occlusionQuery),this._opaqueOcclusionQuery=r(this._opaqueOcclusionQuery))}addToActiveGraphics(e){e.ensureInfo(this.visibilityGroup),this._active.set(e.graphics3DGraphic.graphic.uid,e),this.setDirty()}removeFromActiveGraphics(e){this._active.get(e.graphics3DGraphic.graphic.uid)===e&&(ue(e,this.visibilityGroup),e.removeInfo(this.visibilityGroup),this._active.delete(e.graphics3DGraphic.graphic.uid),this.setDirty())}addToCheckOcclusion(e){this._checkOcclusion.set(e.graphics3DGraphic.graphic.uid,e),this.setDirty()}removeFromCheckOcclusion(e){this._checkOcclusion.get(e.graphics3DGraphic.graphic.uid)===e&&this._checkOcclusion.delete(e.graphics3DGraphic.graphic.uid)}_processCheckOcclusion(e){if(this._checkOcclusion.size===0)return!0;let t=this._ensureCheckOcclusionIterator(),n=this._viewState.camera,i=o(Y,n.viewInverseTransposeMatrix),a=this.view.map.ground.opacity>0,s=this.view.viewingMode===`global`&&a&&n.relativeElevation>0?ae:null,c=0;s!=null&&(l(s.center,m,n.viewMatrix),s.radius=ee(this.view.spatialReference).radius,c=k.distanceToSilhouette(s,m));let u=x();for(;;){if(e.done)return!1;e.madeProgress();let r=t.next();if(r.done===!0)break;let a=r.value,o=a.graphics3DGraphic;if(o.destroyed||!o.isVisible(1,8))continue;let d=me(o,this.visibilityGroup),f=null,p=!0,m=!1;for(let e of d){if(!this.isSupportedLayer(e))continue;f=he,this._projectHudLayer(e,n,f),te(u);let t=e.stageObject.geometries[0].material;if(this._expandBoundingRect(u,n,e,t,f),f.isOutsideScreen||this._isCulledBySlice(a,f.positionWorld)||s!=null&&pe(f,s,c)){p=!1;break}f.altitude=this.view.renderCoordsHelper.getAltitude(f.positionWorld);let r=a.ensureInfo(this.visibilityGroup);if(r.altitude=f.altitude,r.distance=f.distance,r.distanceToOccluder=f.distanceToOccluder,r.culled=!1,S(r.aabr,u),!e.occlusionCheck)break;l(U,f.positionView,i);let d=this._ensureOcclusionQuery(),h=this._ensureOpaqueOcclusionQuery();this._occlusionQueryUids.length===0&&(this._initOcclusionQuery(d),this._initOcclusionQuery(h));let g=d.addPosition(U),_=h.addPosition(U);if(g===this._occlusionQueryUids.length&&_===g){let t=e.adaptiveOcclusion;this._occlusionQueryUids.push(t?-o.graphic.uid:o.graphic.uid),m=!0}break}let h=this._active.has(o.graphic.uid);if(!h&&!m)this._setGraphicVisibility(a,p);else if(h&&(!p||!f)){let e=a.ensureInfo(this.visibilityGroup);e.visible=!f,e.culled=!0}}return this._checkOcclusionIterator=null,this._occlusionQueryUids.length||(this._occlusionQuery=r(this._occlusionQuery),this._opaqueOcclusionQuery=r(this._opaqueOcclusionQuery)),this._occlusionQuery?.start(),this._opaqueOcclusionQuery?.start(),!0}_readOcclusionQueryResult(){if(!this._occlusionQuery||!this._occlusionQueryUids.length)return;let e=this._viewState.camera,t=this.view.renderCoordsHelper.getAltitude(e.eye);for(let e=0;e<this._occlusionQueryUids.length;e++){let n=this._occlusionQueryUids[e],r=Math.abs(n),i=n<0,a=this._checkOcclusion.get(r);if(!a)continue;let o=this._occlusionQuery.getOcclusion(e)??-1,s=this._opaqueOcclusionQuery?.getOcclusion(e)??-1,c=a.getInfo(this.visibilityGroup);c&&(c.distanceToOccluder=o>0?c.distance-o:0);let l=s===0||s>0&&this._occludedVisibility(c?c.distance-s:0,c?.distance??s,c?.altitude??0,t,i),u=o===0||o>0&&this._occludedVisibility(c?.distanceToOccluder??0,c?.distance??o,c?.altitude??0,t,i),d=l||u;d&&this._setTransparentMode(a,l&&!u),this._active.has(r)?c&&(c.culled=!d,c.visible=d):this._setGraphicVisibility(a,d)}this._occlusionQueryUids.length=0}_collectActiveGraphics(e){let t=this._ensureActiveGraphicsIterator(),n=this.visibilityGroup===16;for(;!e.done;){e.madeProgress();let r=t.next();if(r.done===!0)return this._activeIterator=null,!0;let i=r.value,a=i.getInfo(this.visibilityGroup);if(!a)continue;let o=!n||i.graphics3DGraphic.isVisible();!o||a.culled?(N(a.aabr,!1,!0),this._setGraphicVisibility(i,o&&a.visible)):this._deconflictor.add(a)}return!1}_occludedVisibility(e,t,n,r,i=!0){let a=Math.max(this._minAltitudeDifference,Math.abs(n-r))-this._minAltitudeDifference,o=i?this._baseOccludedVisibility+this._altitudeFactor*a:0;return e===0||t-e<=o}_resetIterators(){this._checkOcclusionIterator=null,this._activeIterator=null}_ensureCheckOcclusionIterator(){return this._checkOcclusionIterator??=this._checkOcclusion.values(),this._checkOcclusionIterator}_ensureActiveGraphicsIterator(){return this._activeIterator??=this._active.values(),this._activeIterator}_initOcclusionQuery(e){if(!e)return;let{camera:t}=this._viewState,n=Math.max(2,2+Math.round(Math.log2(Math.abs(t.relativeElevation))));u(H,this._viewState.camera.eye,2**-n),u(H,d(H,H),2**n),e.init(this._checkOcclusion.size,H)}_ensureOcclusionQuery(){return this._occlusionQuery??=new R({view:this.view}),this._occlusionQuery}_ensureOpaqueOcclusionQuery(){return this._opaqueOcclusionQuery??=new R({view:this.view,category:A.OPAQUE_OCCLUSION_QUERY}),this._opaqueOcclusionQuery}_getNumVisible(e){return this._checkOcclusion.values().reduce((t,n)=>t+ +!!n.getInfo(e)?.visible,0)}_projectHudLayer(e,t,n){let r=e.stageObject,i=r.geometries[0],a=i.material;f(U,r.boundingVolumeWorldSpace.sphere.center),l(H,U,t.viewMatrix);let o=I(i,`normal`).getVec(0,W),s=I(i,`centerOffset`)?.getVec(0,G)??m,c=L(i,`groundDistance`).get(0);a.applyShaderOffsets(U,H,o,r.transformation,s,c,t,n.screenSizePerspectiveEvaluators),g(K,H[0],H[1],H[2],1),_(q,K,t.projectionMatrix),u(n.positionNDC,q,1/q[3]),a.applyShaderOffsetsNDC(n.positionNDC,s,c,t,n.positionNDC,J),n.distanceWithoutPolygonOffset=t.depthNDCToWorld(J[2]),n.distance=J[2]===n.positionNDC[2]?n.distanceWithoutPolygonOffset:t.depthNDCToWorld(n.positionNDC[2]),g(q,n.positionNDC[0],n.positionNDC[1],n.positionNDC[2],1),_(K,q,t.inverseProjectionMatrix),v(K,K,1/K[3]),p(n.positionView,K[0],K[1],K[2]),f(n.positionWorld,U)}_isCulledBySlice(e,t){return e.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&E(this._viewState.slicePlane,t)}_expandBoundingRect(e,t,r,i,{positionNDC:a,screenSizePerspectiveEvaluators:o}){let s=r.getScreenSize(de);o.evaluator.applyVec2(s,s),s[0]*=t.pixelRatio,s[1]*=t.pixelRatio;let c=C(i.calculateRelativeScreenBounds(s,o.alignmentEvaluator.apply(t.pixelRatio),Z),n(0,t.fullWidth,.5+.5*a[0]),n(0,t.fullHeight,.5+.5*a[1])),l=this.marginFactor;if(l!==0){let e=l*Math.min(w(c),ne(c));c[0]-=e,c[1]-=e,c[2]+=e,c[3]+=e}T(e,c,e)}_setGraphicVisibility(e,t){let n=e?.graphics3DGraphic;n&&!n.destroyed&&(n.setVisibilityFlag(this.visibilityGroup,8,t),this.visibilityGroup===16&&this.view.labeler.setLabelGraphicVisibility(n,t))}_setTransparentMode(e,t){let n=e?.graphics3DGraphic;if(n&&!n.destroyed)for(let e of n.layers){if(e?.type!==`object3d`&&e?.type!==`buffer`)continue;let{graphics3DSymbolLayer:n}=e;P(n)&&n.updateTransparentMode(e,t)}}};e([i({constructOnly:!0})],$.prototype,`view`,void 0),e([i({type:Boolean,readOnly:!0})],$.prototype,`_readyToRun`,null),e([i({type:Boolean,readOnly:!0})],$.prototype,`updating`,null),e([i({readOnly:!0})],$.prototype,`_updatingHandles`,void 0),$=e([a(`esri.views.3d.layers.graphics.Deconflictor`)],$);function ue(e,t){let n=e.graphics3DGraphic;n.destroyed||n.setVisibilityFlag(t,8,!0)}const de=c();class fe{constructor(){this.positionWorld=h(),this.positionView=h(),this.positionNDC=h(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.screenSizePerspectiveEvaluators=new z}get isOutsideScreen(){let e=this.positionNDC;return e[0]<-1||e[1]<-1||e[2]<-1||e[0]>=1||e[1]>=1||e[2]>=1}}function pe(e,t,n){return f(X.direction,e.positionView),p(X.origin,0,0,0),t.intersectRay(X,oe)?e.distanceWithoutPolygonOffset>n:!1}function me(e,t){return t===16?e.labelLayers:e.layers}const he=new fe;export{$ as Deconflictor,le as DeconflictorGraphic,Q as DeconflictorViewState};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{lerp as n}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as l,scale as u,round as d,copy as f,set as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as m,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as g,transformMat4 as _,scale as v}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as b}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{create as S,empty as ee,copy as C,offset as w,width as T,height as te,expand as ne}from"../../../../geometry/support/aaBoundingRect.js";import{extrusionContainsPoint as re,create as ie,copy as E}from"../../../../geometry/support/boundedPlane.js";import{create as D}from"../../../../geometry/support/ray.js";import{Sphere as O}from"../../../../geometry/support/sphere.js";import{InternalRenderCategory as k}from"../../webgl.js";import{DeconflictAABR as A}from"./DeconflictAABR.js";import{prepare as j,drawPoly as M}from"./deconflictorDebug.js";import{isSymbolLayerWithTransparencyMode as N}from"./transparencyUtils.js";import P from"../../webgl/RenderCamera.js";import{getVec3AttributeView as F,getScalarAttributeView as I}from"../../webgl-engine/lib/attributeViewUtils.js";import{GPUPointOcclusionQuery as L}from"../../webgl-engine/lib/GPUPointOcclusionQuery.js";import{SeparateScreenSizePerspectiveEvaluators as R}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{HUDMaterial as z}from"../../webgl-engine/materials/HUDMaterial.js";import{Yield as B}from"../../../support/Yield.js";const V=h(),H=h(),U=h(),W=h(),G=y(),K=y(),q=h(),J=s(),Y=new O,X=D(),ae=h(),oe=S();class se{constructor(e){this.id=e,this.aabr=S(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1,this.priority=0}}function ce(e,t){let n=e.distanceToOccluder!==0&&e.distance>e.distanceToOccluder,r=t.distanceToOccluder!==0&&t.distance>t.distanceToOccluder;return n===r?e.priority===t.priority?e.distance===t.distance?e.visible===t.visible?e.id-t.id:+t.visible-e.visible:e.distance-t.distance:t.priority-e.priority:+n-r}class Z{constructor(e,t){this.graphics3DGraphic=e,this.slicePlaneEnabled=t,this._info=null,this._labelInfo=null}ensureInfo(e){let t=this.getInfo(e);return t||(t=new se(this.graphics3DGraphic.graphic.uid),this._setInfo(e,t)),t}getInfo(e){return e===16?this._labelInfo:this._info}removeInfo(e){this._setInfo(e,null)}_setInfo(e,t){e===16?this._labelInfo=t:this._info=t}}class Q{constructor(){this.camera=new P,this.slicePlane=ie(),this.slicePlaneEnabled=!1}copyFrom(e){this.camera.equals(e.camera)||this.camera.copyFrom(e.camera),E(e.slicePlane,this.slicePlane),this.slicePlaneEnabled=e.slicePlaneEnabled}}let $=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(e){super(e),this._dirty=!1,this._viewState=new Q,this._state=0,this._checkOcclusion=new Map,this._active=new Map,this._checkOcclusionIterator=null,this._activeIterator=null,this._occlusionQueryUids=[],this._updatingHandles=new b,this._deconflictor=new A((e,t)=>{e.visible=t,this._setGraphicVisibility(this._active.get(e.id),t)},(e,t)=>e.id!==t.id,ce),this._baseOccludedVisibility=10,this._altitudeFactor=2,this._minAltitudeDifference=100}initialize(){this._updatingHandles.add(()=>(this.view?.map?.ground?.opacity??0)>0,()=>this.setDirty()),this._updatingHandles.add(()=>this.view.ready,()=>{this._occlusionQuery=null,this._opaqueOcclusionQuery=null,this.setDirty()})}destroy(){this._occlusionQuery=null,this._opaqueOcclusionQuery=null,this._updatingHandles.destroy(),this._deconflictor.destroy(),this._checkOcclusion.clear(),this._active.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._checkOcclusion.size>0)&&(this._dirty=!0,this.notifyChange(`_readyToRun`))}setPriority(e,t){let n=this._active.get(e.graphic.uid)?.getInfo(this.visibilityGroup);n&&(n.priority=t)}get _readyToRun(){return this._state!==0||this._dirty}get updating(){return this._readyToRun||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;let e=this._state/5;return this._dirty?e*.5:e}get readyToRun(){return this.view.ready&&this.view.state!=null&&this._readyToRun}get usedMemory(){return this._occlusionQuery?.usedMemory??0+(this._occlusionQueryUids?.length??0)*4}runTask(e){switch(this._state){case 0:this._startUpdate(),e.madeProgress();case 1:if(this._state=1,!this._processCheckOcclusion(e))return;case 2:if(this._state=2,!(this._occlusionQuery?.done??!0)||!(this._opaqueOcclusionQuery?.done??!0))return B;this._readOcclusionQueryResult(),e.madeProgress();case 3:if(this._state=3,!this._collectActiveGraphics(e))return;case 4:if(this._state=4,this._deconflictor.run(e),!this._deconflictor.done)return;default:this._state=0,this.notifyChange(`_readyToRun`)}}setGraphicsActive(e,t){t?e.forEach(e=>this.addToActiveGraphics(e)):e.forEach(e=>this.removeFromActiveGraphics(e))}isSupportedLayer(e){if(e==null||e.type!==`buffer`||!e.hiddenIfDeconflicted)return!1;let t=e.stageObject;return(t?.geometries.length??0)===1&&t?.geometries[0]?.material instanceof z}_startUpdate(){j(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);let{fullWidth:e,fullHeight:t}=this._viewState.camera;this._deconflictor.reset(e,t),this._resetIterators(),this._occlusionQueryUids.length=0,this._checkOcclusion.size||(this._occlusionQuery=r(this._occlusionQuery),this._opaqueOcclusionQuery=r(this._opaqueOcclusionQuery))}addToActiveGraphics(e){e.ensureInfo(this.visibilityGroup),this._active.set(e.graphics3DGraphic.graphic.uid,e),this.setDirty()}removeFromActiveGraphics(e){this._active.get(e.graphics3DGraphic.graphic.uid)===e&&(le(e,this.visibilityGroup),e.removeInfo(this.visibilityGroup),this._active.delete(e.graphics3DGraphic.graphic.uid),this.setDirty())}addToCheckOcclusion(e){this._checkOcclusion.set(e.graphics3DGraphic.graphic.uid,e),this.setDirty()}removeFromCheckOcclusion(e){this._checkOcclusion.get(e.graphics3DGraphic.graphic.uid)===e&&this._checkOcclusion.delete(e.graphics3DGraphic.graphic.uid)}_processCheckOcclusion(e){if(this._checkOcclusion.size===0)return!0;let t=this._ensureCheckOcclusionIterator(),n=this._viewState.camera,i=o(J,n.viewInverseTransposeMatrix),a=this.view.map.ground.opacity>0,s=this.view.viewingMode===`global`&&a&&n.relativeElevation>0?Y:null,c=0;s!=null&&(l(s.center,m,n.viewMatrix),s.radius=x(this.view.spatialReference).radius,c=s.distanceToSilhouette(m));let u=S();for(;;){if(e.done)return!1;e.madeProgress();let r=t.next();if(r.done===!0)break;let a=r.value,o=a.graphics3DGraphic;if(o.destroyed||!o.isVisible(1,8))continue;let d=pe(o,this.visibilityGroup),f=null,p=!0,m=!1;for(let e of d){if(!this.isSupportedLayer(e))continue;f=me,this._projectHudLayer(e,n,f),ee(u);let t=e.stageObject.geometries[0].material;if(this._expandBoundingRect(u,n,e,t,f),f.isOutsideScreen||this._isCulledBySlice(a,f.positionWorld)||s!=null&&fe(f,s,c)){p=!1;break}f.altitude=this.view.renderCoordsHelper.getAltitude(f.positionWorld);let r=a.ensureInfo(this.visibilityGroup);if(r.altitude=f.altitude,r.distance=f.distance,r.distanceToOccluder=f.distanceToOccluder,r.culled=!1,C(r.aabr,u),!e.occlusionCheck)break;l(H,f.positionView,i);let d=this._ensureOcclusionQuery(),h=this._ensureOpaqueOcclusionQuery();this._occlusionQueryUids.length===0&&(this._initOcclusionQuery(d),this._initOcclusionQuery(h));let g=d.addPosition(H),_=h.addPosition(H);if(g===this._occlusionQueryUids.length&&_===g){let t=e.adaptiveOcclusion;this._occlusionQueryUids.push(t?-o.graphic.uid:o.graphic.uid),m=!0}break}let h=this._active.has(o.graphic.uid);if(!h&&!m)this._setGraphicVisibility(a,p);else if(h&&(!p||!f)){let e=a.ensureInfo(this.visibilityGroup);e.visible=!f,e.culled=!0}}return this._checkOcclusionIterator=null,this._occlusionQueryUids.length||(this._occlusionQuery=r(this._occlusionQuery),this._opaqueOcclusionQuery=r(this._opaqueOcclusionQuery)),this._occlusionQuery?.start(),this._opaqueOcclusionQuery?.start(),!0}_readOcclusionQueryResult(){if(!this._occlusionQuery||!this._occlusionQueryUids.length)return;let e=this._viewState.camera,t=this.view.renderCoordsHelper.getAltitude(e.eye);for(let e=0;e<this._occlusionQueryUids.length;e++){let n=this._occlusionQueryUids[e],r=Math.abs(n),i=n<0,a=this._checkOcclusion.get(r);if(!a)continue;let o=this._occlusionQuery.getOcclusion(e)??-1,s=this._opaqueOcclusionQuery?.getOcclusion(e)??-1,c=a.getInfo(this.visibilityGroup);c&&(c.distanceToOccluder=o>0?c.distance-o:0);let l=s===0||s>0&&this._occludedVisibility(c?c.distance-s:0,c?.distance??s,c?.altitude??0,t,i),u=o===0||o>0&&this._occludedVisibility(c?.distanceToOccluder??0,c?.distance??o,c?.altitude??0,t,i),d=l||u;d&&this._setTransparentMode(a,l&&!u),this._active.has(r)?c&&(c.culled=!d,c.visible=d):this._setGraphicVisibility(a,d)}this._occlusionQueryUids.length=0}_collectActiveGraphics(e){let t=this._ensureActiveGraphicsIterator(),n=this.visibilityGroup===16;for(;!e.done;){e.madeProgress();let r=t.next();if(r.done===!0)return this._activeIterator=null,!0;let i=r.value,a=i.getInfo(this.visibilityGroup);if(!a)continue;let o=!n||i.graphics3DGraphic.isVisible();!o||a.culled?(M(a.aabr,!1,!0),this._setGraphicVisibility(i,o&&a.visible)):this._deconflictor.add(a)}return!1}_occludedVisibility(e,t,n,r,i=!0){let a=Math.max(this._minAltitudeDifference,Math.abs(n-r))-this._minAltitudeDifference,o=i?this._baseOccludedVisibility+this._altitudeFactor*a:0;return e===0||t-e<=o}_resetIterators(){this._checkOcclusionIterator=null,this._activeIterator=null}_ensureCheckOcclusionIterator(){return this._checkOcclusionIterator??=this._checkOcclusion.values(),this._checkOcclusionIterator}_ensureActiveGraphicsIterator(){return this._activeIterator??=this._active.values(),this._activeIterator}_initOcclusionQuery(e){if(!e)return;let{camera:t}=this._viewState,n=Math.max(2,2+Math.round(Math.log2(Math.abs(t.relativeElevation))));u(V,this._viewState.camera.eye,2**-n),u(V,d(V,V),2**n),e.init(this._checkOcclusion.size,V)}_ensureOcclusionQuery(){return this._occlusionQuery??=new L({view:this.view}),this._occlusionQuery}_ensureOpaqueOcclusionQuery(){return this._opaqueOcclusionQuery??=new L({view:this.view,category:k.OPAQUE_OCCLUSION_QUERY}),this._opaqueOcclusionQuery}_getNumVisible(e){return this._checkOcclusion.values().reduce((t,n)=>t+ +!!n.getInfo(e)?.visible,0)}_projectHudLayer(e,t,n){let r=e.stageObject,i=r.geometries[0],a=i.material;f(H,r.boundingVolumeWorldSpace.sphere.center),l(V,H,t.viewMatrix);let o=F(i,`normal`).getVec(0,U),s=F(i,`centerOffset`)?.getVec(0,W)??m,c=I(i,`groundDistance`).get(0);a.applyShaderOffsets(H,V,o,r.transformation,s,c,t,n.screenSizePerspectiveEvaluators),g(G,V[0],V[1],V[2],1),_(K,G,t.projectionMatrix),u(n.positionNDC,K,1/K[3]),a.applyShaderOffsetsNDC(n.positionNDC,s,c,t,n.positionNDC,q),n.distanceWithoutPolygonOffset=t.depthNDCToWorld(q[2]),n.distance=q[2]===n.positionNDC[2]?n.distanceWithoutPolygonOffset:t.depthNDCToWorld(n.positionNDC[2]),g(K,n.positionNDC[0],n.positionNDC[1],n.positionNDC[2],1),_(G,K,t.inverseProjectionMatrix),v(G,G,1/G[3]),p(n.positionView,G[0],G[1],G[2]),f(n.positionWorld,H)}_isCulledBySlice(e,t){return e.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&re(this._viewState.slicePlane,t)}_expandBoundingRect(e,t,r,i,{positionNDC:a,screenSizePerspectiveEvaluators:o}){let s=r.getScreenSize(ue);o.evaluator.applyVec2(s,s),s[0]*=t.pixelRatio,s[1]*=t.pixelRatio;let c=w(i.calculateRelativeScreenBounds(s,o.alignmentEvaluator.apply(t.pixelRatio),oe),n(0,t.fullWidth,.5+.5*a[0]),n(0,t.fullHeight,.5+.5*a[1])),l=this.marginFactor;if(l!==0){let e=l*Math.min(T(c),te(c));c[0]-=e,c[1]-=e,c[2]+=e,c[3]+=e}ne(e,c,e)}_setGraphicVisibility(e,t){let n=e?.graphics3DGraphic;n&&!n.destroyed&&(n.setVisibilityFlag(this.visibilityGroup,8,t),this.visibilityGroup===16&&this.view.labeler.setLabelGraphicVisibility(n,t))}_setTransparentMode(e,t){let n=e?.graphics3DGraphic;if(n&&!n.destroyed)for(let e of n.layers){if(e?.type!==`object3d`&&e?.type!==`buffer`)continue;let{graphics3DSymbolLayer:n}=e;N(n)&&n.updateTransparentMode(e,t)}}};e([i({constructOnly:!0})],$.prototype,`view`,void 0),e([i({type:Boolean,readOnly:!0})],$.prototype,`_readyToRun`,null),e([i({type:Boolean,readOnly:!0})],$.prototype,`updating`,null),e([i({readOnly:!0})],$.prototype,`_updatingHandles`,void 0),$=e([a(`esri.views.3d.layers.graphics.Deconflictor`)],$);function le(e,t){let n=e.graphics3DGraphic;n.destroyed||n.setVisibilityFlag(t,8,!0)}const ue=c();class de{constructor(){this.positionWorld=h(),this.positionView=h(),this.positionNDC=h(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.screenSizePerspectiveEvaluators=new R}get isOutsideScreen(){let e=this.positionNDC;return e[0]<-1||e[1]<-1||e[2]<-1||e[0]>=1||e[1]>=1||e[2]>=1}}function fe(e,t,n){return f(X.direction,e.positionView),p(X.origin,0,0,0),t.intersectRay(X,ae)?e.distanceWithoutPolygonOffset>n:!1}function pe(e,t){return t===16?e.labelLayers:e.layers}const me=new de;export{$ as Deconflictor,Z as DeconflictorGraphic,Q as DeconflictorViewState};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../core/Error.js";import{disposable as r}from"../../../../core/handleUtils.js";import{translate as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as s,scale as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u,fromArray as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as p,create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as h}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as v}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as y,doubleArrayFrom as b}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as x}from"../../../../geometry/support/FloatArray.js";import{getCoordinateEquals as S}from"../../../../geometry/support/geometryUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as C}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{needsElevationUpdates3D as w,evaluateElevationAlignmentAtPoint as ee,SampleElevationInfo as T}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as E}from"./Graphics3DObject3DGraphicLayer.js";import{maxPathLength as D}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as O,nanFallbackColor as k}from"./Graphics3DSymbolLayer.js";import{isValidSize as A}from"./graphicUtils.js";import{ConvertOptions as te,initFastSymbolUpdatesState as ne,updateFastSymbolUpdatesState as re,getSizeAttributeValue as ie,getAttributeValue as j}from"../support/FastSymbolUpdates.js";import{SamplePosition as M}from"../../support/ElevationProvider.js";import{Object3D as N}from"../../webgl-engine/lib/Object3D.js";import{Path as P}from"../../webgl-engine/lib/Path.js";import{PathBuilder as F}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as I,TriangulationCapBuilder as L,NoCapBuilder as R}from"../../webgl-engine/lib/PathCapBuilder.js";import{PathExtruder as z}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as B,isPathGeometry as V}from"../../webgl-engine/lib/PathGeometry.js";import{computeMinimumRotationTangentFrame as H}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as U,circleProfiles as W}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as G}from"../../webgl-engine/lib/PathVertex.js";import{PathMaterial as K}from"../../webgl-engine/materials/PathMaterial.js";const q=[`polyline`];class J extends O{constructor(e,t,n,r){super(e,t,n,r,C(t)),this._intrinsicSize=u(1,1),this._upVectorAlignment=1,this.ensureDrapedStatus(!1)}_validateGeometry(e,t,n){return!super._validateGeometry(e,t,n)||e.type!==`polyline`?!1:!e.paths.some(e=>e.length>D)||(this.logger.warn(`Geometry has a path longer than ${D} vertices and cannot be displayed by PathSymbol3DLayer`),!1)}async doLoad(){let e=this.symbolLayer,t=e.width==null?e.height:e.width,r=e.height==null?t:e.height;this._vvConvertOptions=new te({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[t,1,r],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(k),fallbackSize:[t,1,r]});let i=this._context.renderer?.visualVariables;this._fastUpdates=i?.length?ne(this._context.renderer,this._vvConvertOptions):null;let a=e.anchor||`center`;this._upVectorAlignment=e.profileRotation===`heading`?0:1;let o=e.profile||`circle`;switch(o){default:case`circle`:this._profile=W[a];break;case`quad`:this._profile=U[a]}switch(e.join){case`round`:this._extruder=new z(2);break;default:case`bevel`:this._extruder=new z(1);break;case`miter`:this._extruder=new z(0)}switch(this._cap){case`none`:this._capBuilder=new R;break;case`butt`:default:this._capBuilder=new L(this._profile,1);break;case`square`:this._capBuilder=new L(this._profile,2);break;case`round`:{let e=o===`quad`;this._capBuilder=new I(this._profile,e);break}}let l=this._materialColor,u=this._getCombinedOpacityAndColor(l),f=p(u),m=u[3],h=this.needsDrivenTransparentPass,g=e.material?.emissive,_={diffuse:f,ambient:f,emissiveStrength:(g?.source===`color`?g?.strength:void 0)??0,emissiveSource:1,opacity:m,drivenOpacity:h,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows};if(!this._drivenProperties.size&&(s(this._intrinsicSize,t,r),!(A(this._intrinsicSize[0])&&A(this._intrinsicSize[1]))))throw new n(`graphics3dpathsymbollayer:invalid-size`,`Symbol sizes may not be negative values`);this._fastUpdates?.visualVariables.size||c(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters);let v=this._fastUpdates!=null,y=new K({..._,...this._fastUpdates?.materialParameters,size:d(this._intrinsicSize),upVectorAlignment:this._upVectorAlignment,profile:this._profile,pathCapType:this._capBuilder.type,cutoffAngle:this._extruder.cutoffAngle,pathJoinType:this._extruder.join,hasPathColor:!v&&this._drivenProperties.color,hasPathOpacity:!v&&this._drivenProperties.opacity&&!this._drivenProperties.color,hasPathSize:!v&&this._drivenProperties.size,usePBR:this._context.physicalBasedRenderingEnabled},this._context);this._materials[0]=y,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,q,this.symbolLayer.type))return null;let n=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,n)}layerOpacityChanged(){let e=this._materialColor,t=this._getCombinedOpacity(e),n=this._materials[0];n&&(n.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,w)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled}),!0}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(re(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0;break;default:return 0}return 2}_getVertexData(n){let r=0,i=n.paths,a=[],o=n.spatialReference,s=this._context.elevationProvider.spatialReference,c=this._context.renderCoordsHelper.spatialReference,l=S(n.hasZ),u=i.map(n=>{let r={stack:[],error:void 0,hasError:!1};try{let t=$;e(r,se,!1);for(let e=1;e<n.length;++e)l(n[e],n[e-1])&&t.add(e);return t.size===0?n:n.filter((e,n)=>!t.has(n))}catch(e){r.error=e,r.hasError=!0}finally{t(r)}});for(let e of u)r+=e.length;let d=y(r*3),f=0;for(let e of u){a.push({offset:f,numVertices:e.length});for(let t of e)d[f++]=t[0],d[f++]=t[1],d[f++]=n.hasZ?t[2]:0}if(s!=null&&!o.equals(s)&&!h(d,o,0,d,s,0,r))return null;let p;return s!=null&&!s.equals(c)?(p=y(r*3),h(d,s,0,p,c,0,r)):p=b(d),{pathVertexDataInfos:a,vertexDataES:d,vertexDataRS:p}}_createAs3DShape(e,t){let{graphic:n,renderingInfo:r}=e,s=n.geometry,c=this._getVertexData(s);if(c==null)return this.logger.warn(`PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)`),null;if(c.pathVertexDataInfos.length===0)return s.paths.length!==0&&s.paths.some(e=>e.length>0)||this.logger.warn(`PathSymbol3DLayer geometry failed to be created (no paths were defined)`),null;let l=[],u=g(),d=this._context.renderCoordsHelper,p=new M(c.vertexDataES),m=n.uid,h=x(c.vertexDataRS.length);for(let e of c.pathVertexDataInfos){let n=e.numVertices;if(n<2)continue;let s=e.offset;if(this._context.clippingExtent!=null&&(_(c.vertexDataES,s,n,u),!v(u,this._context.clippingExtent)))continue;let g=[],y=s+n*3;for(let e=s;e<y;e+=3){p.offset=e;let n=ee(p,this._context.elevationProvider,t,d);f(Z,c.vertexDataRS[e],c.vertexDataRS[e+1],c.vertexDataRS[e+2]),d.setAltitude(Z,n),c.vertexDataRS[e]=Z[0],c.vertexDataRS[e+1]=Z[1],c.vertexDataRS[e+2]=Z[2],g.push(G(this._upVectorAlignment))}let b=new P(g,c.vertexDataES,c.vertexDataRS,s,h);Y(b,this._upVectorAlignment,this._context.renderCoordsHelper);let x=new F(b,this._profile,this._extruder,this._capBuilder,this._upVectorAlignment),S=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:m,layerViewUid:this._context.layerViewUid}),C=new B(this._materials[0],x,this._getVisualVariableData(r),S);C.transformation=i(o(),a,x.path.origin),l.push(C)}if(l.length===0)return null;let y=new N({geometries:l,layerViewUid:this._context.layerViewUid,graphicUid:m}),b=new E(this,y,null,(e,t,n,r,i)=>oe(e,t,r,i,this._upVectorAlignment),t,null);return b.alignedSampledElevation=0,b.needsElevationUpdates=w(t.mode),b}_getVisualVariableData(e){if(this._fastUpdates){let{size:t,color:n,opacity:r}=this._fastUpdates.visualVariables;return{sizeAttributeValue:ie(t,e.size),colorAttributeValue:j(n,e.color),opacityAttributeValue:j(r,e.opacity)}}return{size:this._getDrivenSize(e),color:this._getDrivenColor(e),opacity:this._getDrivenOpacity(e)}}_getDrivenSize(e){if(!this._drivenProperties.size)return null;let t=e.size?.output??[`symbol-value`,`symbol-value`,`symbol-value`],n=u(X(t[0],t[2]===`symbol-value`?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),X(t[2],t[0]===`symbol-value`?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0));return l(n,n,this._intrinsicSize),n}_getDrivenColor(e){return this._drivenProperties.color?this._getDrivenUInt8Color(e,this._materialColor,!1):null}_getDrivenOpacity(e){return this._drivenProperties.opacity&&!this._drivenProperties.color?e.opacity?.output??this._materialColor?.a??0:null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}get _cap(){return this.symbolLayer.cap||`butt`}_updateTransparentDepedentMaterialParameters(){let e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||this._cap===`none`?0:2})}}function Y(e,t,n){let{origin:r,positions:i}=e,a=e.offset;switch(t){default:case 0:for(let t of e.vertices)Z[0]=i[a++]+r[0],Z[1]=i[a++]+r[1],Z[2]=i[a++]+r[2],n.worldUpAtPosition(Z,Z),t.setFrameFromUpVector(Z);break;case 1:Z[0]=i[a]+r[0],Z[1]=i[a+1]+r[1],Z[2]=i[a+2]+r[2],n.worldUpAtPosition(Z,Z),H(e,Z)}}function X(e,t,n){switch(e){case`symbol-value`:return n;case`proportional`:return t;default:return e}}function ae(e,t,n,r){let i=0,{origin:a,vertices:o,positions:s,positionsES:c}=e,l=e.offset+o.length*3;for(let t=e.offset;t<l;t+=3)f(Z,c[t],c[t+1],c[t+2]),n(Z,Q),i+=Q.sampledElevation,Z[0]=s[t]+a[0],Z[1]=s[t+1]+a[1],Z[2]=s[t+2]+a[2],r.setAltitude(Z,Q.z),s[t]=Z[0]-a[0],s[t+1]=Z[1]-a[1],s[t+2]=Z[2]-a[2];return e.updatePathVertexInformation(),i/o.length}function oe(e,t,n,r,i){let a=e.stageObject,o=a.geometries,s=0;for(let e of o){if(!V(e))continue;let o=e.builder.path;s+=ae(o,t,n,r),i!==0&&Y(o,i,r),e.onPathChanged(),a.geometryVertexAttributeUpdated(e,`position`)}return s/o.length}const Z=m(),Q=new T,$=new Set,se=r({remove:()=>$.clear()});export{J as Graphics3DPathSymbolLayer};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../core/Error.js";import{disposable as r}from"../../../../core/handleUtils.js";import{translate as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as s,scale as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u,fromArray as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as p,create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as h}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as v}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as y,doubleArrayFrom as b}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as x}from"../../../../geometry/support/FloatArray.js";import{getCoordinateEquals as S}from"../../../../geometry/support/geometryUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as ee}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{needsElevationUpdates3D as C,evaluateElevationAlignmentAtPoint as w,SampleElevationInfo as T}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as E}from"./Graphics3DObject3DGraphicLayer.js";import{maxPathLength as D}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as O,nanFallbackColor as k}from"./Graphics3DSymbolLayer.js";import{isValidSize as A}from"./graphicUtils.js";import{ConvertOptions as j,initFastSymbolUpdatesState as te,updateFastSymbolUpdatesState as ne,getSizeAttributeValue as re,getAttributeValue as M}from"../support/FastSymbolUpdates.js";import{SamplePosition as N}from"../../support/ElevationProvider.js";import{Object3D as P}from"../../webgl-engine/lib/Object3D.js";import{Path as F}from"../../webgl-engine/lib/Path.js";import{PathBuilder as I}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as L,TriangulationCapBuilder as R,NoCapBuilder as z}from"../../webgl-engine/lib/PathCapBuilder.js";import{PathExtruder as B}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as V,isPathGeometry as H}from"../../webgl-engine/lib/PathGeometry.js";import{computeMinimumRotationTangentFrame as U}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as W,circleProfiles as G}from"../../webgl-engine/lib/PathProfile.js";import{PathMaterial as K}from"../../webgl-engine/materials/PathMaterial.js";const q=[`polyline`];class J extends O{constructor(e,t,n,r){super(e,t,n,r,ee(t)),this._intrinsicSize=u(1,1),this._upVectorAlignment=1,this.ensureDrapedStatus(!1)}_validateGeometry(e,t,n){return!super._validateGeometry(e,t,n)||e.type!==`polyline`?!1:!e.paths.some(e=>e.length>D)||(this.logger.warn(`Geometry has a path longer than ${D} vertices and cannot be displayed by PathSymbol3DLayer`),!1)}async doLoad(){let e=this.symbolLayer,t=e.width==null?e.height:e.width,r=e.height==null?t:e.height;this._vvConvertOptions=new j({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[t,1,r],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(k),fallbackSize:[t,1,r]});let i=this._context.renderer?.visualVariables;this._fastUpdates=i?.length?te(this._context.renderer,this._vvConvertOptions):null;let a=e.anchor||`center`;this._upVectorAlignment=e.profileRotation===`heading`?0:1;let o=e.profile||`circle`;switch(o){default:case`circle`:this._profile=G[a];break;case`quad`:this._profile=W[a]}switch(e.join){case`round`:this._extruder=new B(2);break;default:case`bevel`:this._extruder=new B(1);break;case`miter`:this._extruder=new B(0)}switch(this._cap){case`none`:this._capBuilder=new z;break;case`butt`:default:this._capBuilder=new R(this._profile,1);break;case`square`:this._capBuilder=new R(this._profile,2);break;case`round`:{let e=o===`quad`;this._capBuilder=new L(this._profile,e);break}}let l=this._materialColor,u=this._getCombinedOpacityAndColor(l),f=p(u),m=u[3],h=this.needsDrivenTransparentPass,g=e.material?.emissive,_={diffuse:f,ambient:f,emissiveStrength:(g?.source===`color`?g?.strength:void 0)??0,emissiveSource:1,opacity:m,drivenOpacity:h,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows};if(!this._drivenProperties.size&&(s(this._intrinsicSize,t,r),!(A(this._intrinsicSize[0])&&A(this._intrinsicSize[1]))))throw new n(`graphics3dpathsymbollayer:invalid-size`,`Symbol sizes may not be negative values`);this._fastUpdates?.visualVariables.size||c(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters);let v=this._fastUpdates!=null,y=new K({..._,...this._fastUpdates?.materialParameters,size:d(this._intrinsicSize),upVectorAlignment:this._upVectorAlignment,profile:this._profile,pathCapType:this._capBuilder.type,cutoffAngle:this._extruder.cutoffAngle,pathJoinType:this._extruder.join,hasPathColor:!v&&this._drivenProperties.color,hasPathOpacity:!v&&this._drivenProperties.opacity&&!this._drivenProperties.color,hasPathSize:!v&&this._drivenProperties.size,usePBR:this._context.physicalBasedRenderingEnabled},this._context);this._materials[0]=y,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,q,this.symbolLayer.type))return null;let n=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,n)}layerOpacityChanged(){let e=this._materialColor,t=this._getCombinedOpacity(e),n=this._materials[0];n&&(n.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,C)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled}),!0}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(ne(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0;break;default:return 0}return 2}_getVertexData(n){let r=0,i=n.paths,a=[],o=n.spatialReference,s=this._context.elevationProvider.spatialReference,c=this._context.renderCoordsHelper.spatialReference,l=S(n.hasZ),u=i.map(n=>{let r={stack:[],error:void 0,hasError:!1};try{let t=$;e(r,oe,!1);for(let e=1;e<n.length;++e)l(n[e],n[e-1])&&t.add(e);return t.size===0?n:n.filter((e,n)=>!t.has(n))}catch(e){r.error=e,r.hasError=!0}finally{t(r)}});for(let e of u)r+=e.length;let d=y(r*3),f=0;for(let e of u){a.push({offset:f,numVertices:e.length});for(let t of e)d[f++]=t[0],d[f++]=t[1],d[f++]=n.hasZ?t[2]:0}if(s!=null&&!o.equals(s)&&!h(d,o,0,d,s,0,r))return null;let p;return s!=null&&!s.equals(c)?(p=y(r*3),h(d,s,0,p,c,0,r)):p=b(d),{pathVertexDataInfos:a,vertexDataES:d,vertexDataRS:p}}_createAs3DShape(e,t){let{graphic:n,renderingInfo:r}=e,s=n.geometry,c=this._getVertexData(s);if(c==null)return this.logger.warn(`PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)`),null;if(c.pathVertexDataInfos.length===0)return s.paths.length!==0&&s.paths.some(e=>e.length>0)||this.logger.warn(`PathSymbol3DLayer geometry failed to be created (no paths were defined)`),null;let l=[],u=g(),d=this._context.renderCoordsHelper,p=new N(c.vertexDataES),m=n.uid,h=x(c.vertexDataRS.length);for(let e of c.pathVertexDataInfos){let n=e.numVertices;if(n<2)continue;let s=e.offset;if(this._context.clippingExtent!=null&&(_(c.vertexDataES,s,n,u),!v(u,this._context.clippingExtent)))continue;let g=s+n*3;for(let e=s;e<g;e+=3){p.offset=e;let n=w(p,this._context.elevationProvider,t,d);f(Z,c.vertexDataRS[e],c.vertexDataRS[e+1],c.vertexDataRS[e+2]),d.setAltitude(Z,n),c.vertexDataRS[e]=Z[0],c.vertexDataRS[e+1]=Z[1],c.vertexDataRS[e+2]=Z[2]}let y=new F(n,this._upVectorAlignment,c.vertexDataES,c.vertexDataRS,s,h);Y(y,this._upVectorAlignment,this._context.renderCoordsHelper);let b=new I(y,this._profile,this._extruder,this._capBuilder,this._upVectorAlignment),x=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:m,layerViewUid:this._context.layerViewUid}),S=new V(this._materials[0],b,this._getVisualVariableData(r),x);S.transformation=i(o(),a,b.path.origin),l.push(S)}if(l.length===0)return null;let y=new P({geometries:l,layerViewUid:this._context.layerViewUid,graphicUid:m}),b=new E(this,y,null,(e,t,n,r,i)=>ae(e,t,r,i,this._upVectorAlignment),t,null);return b.alignedSampledElevation=0,b.needsElevationUpdates=C(t.mode),b}_getVisualVariableData(e){if(this._fastUpdates){let{size:t,color:n,opacity:r}=this._fastUpdates.visualVariables;return{sizeAttributeValue:re(t,e.size),colorAttributeValue:M(n,e.color),opacityAttributeValue:M(r,e.opacity)}}return{size:this._getDrivenSize(e),color:this._getDrivenColor(e),opacity:this._getDrivenOpacity(e)}}_getDrivenSize(e){if(!this._drivenProperties.size)return null;let t=e.size?.output??[`symbol-value`,`symbol-value`,`symbol-value`],n=u(X(t[0],t[2]===`symbol-value`?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),X(t[2],t[0]===`symbol-value`?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0));return l(n,n,this._intrinsicSize),n}_getDrivenColor(e){return this._drivenProperties.color?this._getDrivenUInt8Color(e,this._materialColor,!1):null}_getDrivenOpacity(e){return this._drivenProperties.opacity&&!this._drivenProperties.color?e.opacity?.output??this._materialColor?.a??0:null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}get _cap(){return this.symbolLayer.cap||`butt`}_updateTransparentDepedentMaterialParameters(){let e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||this._cap===`none`?0:2})}}function Y(e,t,n){let{origin:r,positions:i}=e,a=e.offset;switch(t){default:case 0:for(let t=0;t<e.numVertices;++t)Z[0]=i[a++]+r[0],Z[1]=i[a++]+r[1],Z[2]=i[a++]+r[2],n.worldUpAtPosition(Z,Z),e.setFrameFromUpVector(t,Z);break;case 1:Z[0]=i[a]+r[0],Z[1]=i[a+1]+r[1],Z[2]=i[a+2]+r[2],n.worldUpAtPosition(Z,Z),U(e,Z)}}function X(e,t,n){switch(e){case`symbol-value`:return n;case`proportional`:return t;default:return e}}function ie(e,t,n,r){let i=0,{origin:a,numVertices:o,positions:s,positionsES:c}=e,l=e.offset+o*3;for(let t=e.offset;t<l;t+=3)f(Z,c[t],c[t+1],c[t+2]),n(Z,Q),i+=Q.sampledElevation,Z[0]=s[t]+a[0],Z[1]=s[t+1]+a[1],Z[2]=s[t+2]+a[2],r.setAltitude(Z,Q.z),s[t]=Z[0]-a[0],s[t+1]=Z[1]-a[1],s[t+2]=Z[2]-a[2];return e.updatePathVertexInformation(),i/o}function ae(e,t,n,r,i){let a=e.stageObject,o=a.geometries,s=0;for(let e of o){if(!H(e))continue;let o=e.builder.path;s+=ie(o,t,n,r),i!==0&&Y(o,i,r),e.onPathChanged(),a.geometryVertexAttributeUpdated(e,`position`)}return s/o.length}const Z=m(),Q=new T,$=new Set,oe=r({remove:()=>$.clear()});export{J as Graphics3DPathSymbolLayer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{destroyMaybe as t,removeMaybe as n}from"../../../../core/maybe.js";import{initial as r,watch as i,sync as a}from"../../../../core/reactiveUtils.js";import{subclass as o}from"../../../../core/accessorSupport/decorators.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import{destroyMaybe as t,removeMaybe as n}from"../../../../core/maybe.js";import{initial as r,watch as i,sync as a}from"../../../../core/reactiveUtils.js";import{subclass as o}from"../../../../core/accessorSupport/decorators.js";import{copy as s}from"../../../../geometry/support/boundedPlane.js";import{Deconflictor as c,DeconflictorGraphic as l}from"./Deconflictor.js";import{LabelDeconflictor as u}from"./LabelDeconflictor.js";import{TaskPriority as d}from"../../../support/Scheduler.js";let f=class extends c{constructor(){super(...arguments),this._contexts=new Map,this.visibilityGroup=1,this._marginFactor=-.1,this.test={overrideMarginFactor:e=>{this._marginFactor=e,this.setDirty()},getNumVisibleLabels:()=>this._getNumVisible(16),getNumVisibleGraphics:()=>this._getNumVisible(1)}}get labels(){return this._labels}get viewState(){return this._viewState}initialize(){this._updatingHandles.add(()=>this.view?.state?.camera,()=>{this._updateViewState(),this.setDirty()}),this._updatingHandles.add(()=>this.view?.slice?.plane,()=>{this._updateSlicePlane(),this._slicePlaneChanged(),this.setDirty()},r),this.addHandles(i(()=>this.view.groundView?.updating||this.view.graphicsView?.updating||this.view.allLayerViews.some(e=>e.updating),(e,t)=>{!e&&t&&this.setDirty()},a)),this._frameTask=this.view.resourceController.scheduler.registerTask(d.GRAPHICS_DECONFLICTOR,this),this._labels=new u({view:this.view,parent:this})}destroy(){this._labels=t(this._labels),this._frameTask=n(this._frameTask)}get marginFactor(){return this._marginFactor}get usedMemory(){return super.usedMemory+this._labels.usedMemory}setDirty(){this._contexts.size>0&&(super.setDirty(),this._labels.setDirty())}runTask(e){let t=super.runTask(e);return this.readyToRun||this._labels.setDirty(),t}_updateViewState(){this.view?.state&&(this._viewState.camera.copyFrom(this.view.state.camera),this._updateSlicePlane())}_updateSlicePlane(){let e=this.view?.slice?.plane;e!=null&&s(e,this._viewState.slicePlane),this._viewState.slicePlaneEnabled=e!=null}_slicePlaneChanged(){for(let e of this._contexts.keys())if(e.symbolCreationContext.slicePlaneEnabled){this.setDirty();return}}addGraphicsOwner(e){let t=this._getGraphicsContext(e);return{addGraphic:n=>this._addGraphic(e,t,n),removeGraphic:e=>this._removeGraphic(t,e),labelingInfoChange:()=>this._labelsEnabledChanged(e,t),featureReductionChange:()=>this._enabledChanged(e,t),slicePlaneEnabledChange:()=>this._slicePlaneEnabledChanged(e,t),screenSizePerspectiveEnabledChanged:()=>this._screenSizePerspectiveEnabledChange(),clear:()=>t.forEach(e=>this._removeGraphic(t,e.graphics3DGraphic)),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty(),getState:e=>this._getDeconflictorState(e),setState:(e,t)=>this._setDeconflictorState(e,t)}}_getDeconflictorState(e){let t=e.getVisibilityFlag(1,8),n=e.getVisibilityFlag(16,8);return!!t|(n?16:0)}_setDeconflictorState(e,t){let n=!!(t&1),r=!!(t&16);e.setVisibilityFlag(1,8,n),e.setVisibilityFlag(16,8,r),this.setDirty()}_removeGraphicsOwner(e){let t=this._contexts.get(e);t&&(t.forEach(e=>this._removeGraphic(t,e.graphics3DGraphic)),this._contexts.delete(e),this.setDirty())}_addGraphic(e,t,n){let r=n.graphic.uid,i=new l(n,e.symbolCreationContext.slicePlaneEnabled);t.set(r,i),this.addToCheckOcclusion(i),p(e)&&this.addToActiveGraphics(i),e.labelsEnabled&&(this._labels.addToCheckOcclusion(i),this._labels.addToActiveGraphics(i));let a=this._initialVisibility(e,n);n.setVisibilityFlag(1,8,a)}_removeGraphic(e,t){let n=t.graphic.uid,r=e.get(n);r&&(this.removeFromActiveGraphics(r),this.removeFromCheckOcclusion(r),this._labels.removeFromActiveGraphics(r),this._labels.removeFromCheckOcclusion(r),e.delete(n),this.setDirty())}_enabledChanged(e,t){p(e)?t.forEach(e=>this.addToActiveGraphics(e)):t.forEach(e=>this.removeFromActiveGraphics(e)),this.setDirty()}_labelsEnabledChanged(e,t){e.labelsEnabled?(t.forEach(e=>this._labels.addToCheckOcclusion(e)),t.forEach(e=>this._labels.addToActiveGraphics(e))):(t.forEach(e=>this._labels.removeFromCheckOcclusion(e)),t.forEach(e=>this._labels.removeFromActiveGraphics(e)))}_slicePlaneEnabledChanged(e,t){let n=e.symbolCreationContext.slicePlaneEnabled;t.forEach(e=>e.slicePlaneEnabled=n),this.setDirty()}_screenSizePerspectiveEnabledChange(){this.setDirty()}_initialVisibility(e,t){if(t.isDraped)return!1;let n=t.layers;if(!n?.length)return!1;let r=!1,i=!1;for(let e of n)this.isSupportedLayer(e)&&(r=!0,i||=e.occlusionCheck);return!i&&(!r||!p(e))}_getGraphicsContext(e){let t=this._contexts.get(e);if(t)return t;let n=new Map;return this._contexts.set(e,n),this.setDirty(),n}};f=e([o(`esri.views.3d.layers.graphics.GraphicsDeconflictor`)],f);function p(e){return e.layer?.featureReduction?.type===`selection`}export{f as GraphicsDeconflictor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{deg2rad as n,lerp as r,clamp as i}from"../../../core/mathUtils.js";import{watch as a,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{deg2rad as n,lerp as r,clamp as i}from"../../../core/mathUtils.js";import{watch as a,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{cameraFrustumCoverage as l}from"../../../geometry/support/boundedPlane.js";import{Sphere as u}from"../../../geometry/support/sphere.js";import{ScreenSizePerspectiveParameters as d}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";let f=class extends t{get parameters(){return this._parameters}get labelParameters(){return this._labelParameters}get _calculations(){return this.view.state.isGlobal?new m(this.view.renderCoordsHelper?.referenceEllipsoid.radius??0):new p}constructor(e){super(e),this._parameters=new d,this._labelParameters=new d}initialize(){this.addHandles([a(()=>({distance:this.view.pointsOfInterest?.centerOnSurfaceInfrequent?.distance??0,fovY:this.view.state.camera.fovY}),e=>this._update(e),o)])}_update(e){let t=this._updateParameters(this._parameters,g,e),n=this._updateParameters(this._labelParameters,_,e);return t||n}_updateParameters(e,t,n){if(e&&e.camera.fovY===n.fovY&&e.camera.distance===n.distance)return!1;let{scaleStart:r,scaleFallOffRange:i}=t,{fovY:a,distance:o}=n;this._calculations.calculateCurvatureDependentParameters(v,t,n);let s=this._calculations.surfaceCoverageCompensation(n,v),{tiltAngle:c,scaleFallOffFactor:l}=v,u=Math.sin(c)*o,d=.5*Math.PI-c-a*(.5-r*s),f=u/Math.cos(d),p=d+a*i*s,m=(f-u/Math.cos(p)*l)/(1-l);return e.camera.fovY=n.fovY,e.camera.distance=n.distance,e.offset=m,e.divisor=f-m,e.minPixelSize=t.minPixelSize,!0}};e([s({constructOnly:!0})],f.prototype,`view`,void 0),e([s()],f.prototype,`_calculations`,null),f=e([c(`esri.views.3d.state.ScreenSizePerspective`)],f);class p{surfaceCoverageCompensation(e,t){return l(t.tiltAngle,e.fovY)}calculateCurvatureDependentParameters(e,t){e.tiltAngle=t.curvatureDependent.min.tiltAngle,e.scaleFallOffFactor=t.curvatureDependent.min.scaleFallOffFactor}}class m{constructor(e){this._ellipsoidRadius=e}surfaceCoverageCompensation(e,t){return y.radius=this._ellipsoidRadius,y.frustumCoverage(t.tiltAngle,e.distance,e.fovY)}calculateCurvatureDependentParameters(e,t,n){let a=t.curvatureDependent,o=1+n.distance/this._ellipsoidRadius,s=Math.sqrt(o*o-1),[c,l]=[a.min.curvature,a.max.curvature],u=i((s-c)/(l-c),0,1),[d,f]=[a.min,a.max];e.tiltAngle=r(d.tiltAngle,f.tiltAngle,u),e.scaleFallOffFactor=r(d.scaleFallOffFactor,f.scaleFallOffFactor,u)}}class h{constructor(){this.tiltAngle=0,this.scaleFallOffFactor=0}}const g={curvatureDependent:{min:{curvature:n(10),tiltAngle:n(12),scaleFallOffFactor:.5},max:{curvature:n(70),tiltAngle:n(40),scaleFallOffFactor:.8}},scaleStart:.3,scaleFallOffRange:.65,minPixelSize:0},_={...g,curvatureDependent:{min:{...g.curvatureDependent.min,scaleFallOffFactor:.7},max:{...g.curvatureDependent.max,scaleFallOffFactor:.95}},minPixelSize:14},v=new h,y=new u;export{f as ScreenSizePerspective};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{rad2deg as e}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as t,getMetersPerCartesianUnitForSR as n}from"../../../core/units.js";import{set as r}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{copy as
|
|
2
|
+
import{rad2deg as e}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as t,getMetersPerCartesianUnitForSR as n}from"../../../core/units.js";import{set as r}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as i,copy as a}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as s}from"../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as c}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectPointToVector as l}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPoint as u}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as d}from"../../../geometry/projection/projectVectorToVector.js";import{create as f}from"../../../geometry/support/aaBoundingRect.js";import{GlobalCoordinateSystem as p}from"../../../geometry/support/GlobalCoordinateSystem.js";import{LocalCoordinateSystem as m}from"../../../geometry/support/LocalCoordinateSystem.js";import{intersectRay as h}from"../../../geometry/support/plane.js";import{angleAroundAxis as g}from"../../../geometry/support/vector.js";import{sv3d as _}from"../../../geometry/support/vectorStacks.js";import{isDehydratedPoint as v}from"../../../layers/graphics/dehydratedFeatureUtils.js";class y{constructor(e,t,n,r){this.viewingMode=e,this.spatialReference=t,this.unitInMeters=n,this._coordinateSystem=r,this._tmpCoordinateSystem=r.clone(),this.referenceEllipsoid=s(t),this.sphericalPCPF=c(t)}set extent(e){this._coordinateSystem.setExtent(e)}get extent(){return this._coordinateSystem.getExtent(f())}getAltitude(e){return this._coordinateSystem.altitudeAt(e)}setAltitude(e,t,n=e){return this._coordinateSystem.setAltitudeAt(n,t,e),e}setAltitudeOfTransformation(e,t){i(b,t[12],t[13],t[14]),this._coordinateSystem.setAltitudeAt(b,e,b),t[12]=b[0],t[13]=b[1],t[14]=b[2]}worldUpAtPosition(e,t){return this._coordinateSystem.worldBasisAtPosition(e,2,t),t}worldBasisAtPosition(e,t,n){return this._coordinateSystem.worldBasisAtPosition(e,t,n),n}basisMatrixAtPosition(e,t){let n=this.worldBasisAtPosition(e,0,_.get()),i=this.worldBasisAtPosition(e,1,_.get()),a=this.worldBasisAtPosition(e,2,_.get());return r(t,n[0],n[1],n[2],0,i[0],i[1],i[2],0,a[0],a[1],a[2],0,0,0,0,1),t}headingAtPosition(t,n){let r=this.worldUpAtPosition(t,_.get()),i=this.worldBasisAtPosition(t,1,_.get()),a=g(n,i,r);return e(a)}intersectManifoldClosestSilhouette(e,t,n){return this._coordinateSystem.elevate(t,this._tmpCoordinateSystem),this._tmpCoordinateSystem.intersectRayClosestSilhouette(e,n),n}intersectManifold(e,t,n){this._coordinateSystem.elevate(t,this._tmpCoordinateSystem);let r=_.get();return this._tmpCoordinateSystem.intersectRay(e,r)?a(n,r):null}intersectInfiniteManifold(e,t,n){if(this.viewingMode===1)return this.intersectManifold(e,t,n);this._coordinateSystem.elevate(t,this._tmpCoordinateSystem);let r=this._tmpCoordinateSystem.plane,i=_.get();return h(r,e,i)?a(n,i):null}toRenderCoords(e,t,n){return v(e)?l(e,t,this.spatialReference):d(e,t,n,this.spatialReference)}fromRenderCoords(e,t,n=null){return v(t)?(n!=null&&(t.spatialReference=n),u(e,this.spatialReference,t)?t:null):d(e,this.spatialReference,t,n)?t:null}static create(e,n){switch(e){case 2:return new y(2,n,t(n),new m);case 1:return new y(1,n,1,new p(n))}}static renderUnitScaleFactor(e,t){return n(e)/n(t)}}const b=o();export{y as RenderCoordsHelper};
|