@arcgis/core 5.0.0-next.60 → 5.0.0-next.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{1e8ceed33a3657ac02b3.js → 153ff2ceefccd946498b.js} +1 -1
- package/assets/esri/core/workers/chunks/{7147fc7502b385b302b2.js → 23b623637126f8411a30.js} +1 -1
- package/assets/esri/core/workers/chunks/{a7aa87e2c4197ba595ef.js → 2abc205f81f26fc4852b.js} +2 -2
- package/assets/esri/core/workers/chunks/{492d575894c7905bb70c.js → 3d49c6427120edc8eac9.js} +1 -1
- package/assets/esri/core/workers/chunks/{23a9dd9454d5249bbd59.js → 3da53c017f9c5d2d778a.js} +1 -1
- package/assets/esri/core/workers/chunks/{60362c5651ef41fa7e5f.js → 4cf2bec636dd8ceecf0c.js} +1 -1
- package/assets/esri/core/workers/chunks/{3d1a5a3467f3a6585b3e.js → 4f03d19a70dca6c507be.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d31fbabaa875f8627c0.js → 631a11a2b2001c708527.js} +1 -1
- package/assets/esri/core/workers/chunks/{fa95c9248fbfab338f2e.js → 63b8cd7d5cafbaeed894.js} +1 -1
- package/assets/esri/core/workers/chunks/6b4a24248182245167ca.js +1 -0
- package/assets/esri/core/workers/chunks/{352c674730c7b7258ae3.js → 76086517591d0eb35156.js} +1 -1
- package/assets/esri/core/workers/chunks/{436f206898306df019ac.js → 7c47fefbf4c93b63200f.js} +1 -1
- package/assets/esri/core/workers/chunks/7e8573749a02e1f54fb1.js +1 -0
- package/assets/esri/core/workers/chunks/{424daef7b5dec1b99aba.js → af3e93a4ac3ff2addc90.js} +1 -1
- package/assets/esri/core/workers/chunks/{bf82bb1cdd8b31e7f2aa.js → bb08359610a41e304b55.js} +1 -1
- package/assets/esri/core/workers/chunks/{495b11fdecc3ba90d454.js → bfc063d4431bfa162160.js} +1 -1
- package/assets/esri/core/workers/chunks/d13b2ce8a89938b0472b.js +1 -0
- package/assets/esri/core/workers/chunks/{0483a2cfdb8c7158e73a.js → e85da52d9cc7d9396872.js} +1 -1
- package/assets/esri/core/workers/chunks/{1ced78750c61600b2d4e.js → f351007cdcd0938d3b6c.js} +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ar.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_bg.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_bs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ca.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_cs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_da.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_de.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_el.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_es.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_et.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_fi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_fr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_he.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_hr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_hu.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_id.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_it.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ja.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ko.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_lt.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_lv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_nl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_no.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pt-BR.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pt-PT.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ro.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ru.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_th.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_tr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_uk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_vi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-CN.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-HK.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-TW.json +1 -1
- package/chunks/CutFillDepth.glsl.js +13 -10
- package/chunks/CutFillReduction.glsl.js +14 -8
- package/chunks/GaussianSplat.glsl.js +1 -1
- package/chunks/Laserlines.glsl.js +2 -2
- package/chunks/boundedPlane.js +1 -1
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/vec32.js +1 -1
- package/config.js +1 -1
- package/core/libs/gl-matrix-2/math/vec3.js +1 -1
- package/effects/FocusAreas.d.ts +1 -1
- package/geometry/support/lineSegment.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/kernel.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/orientedImagery/transformations/worldToImage.js +1 -1
- package/layers/support/FieldsIndex.d.ts +2 -1
- package/layers/support/tiles3DUtils.js +1 -1
- package/layers/voxel/VoxelVolume.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/flow/dataUtils.js +1 -1
- package/views/2d/engine/flow/utils.js +1 -1
- package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/interactive/SegmentLabels2D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/animation/pointToPoint/Camera.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/environment/ChapmanApproximation.glsl.js +1 -1
- package/views/3d/environment/CloudsParameters.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/interactive/SegmentLabels3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementManipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/state/Frustum.js +1 -1
- package/views/3d/state/controllers/FovController.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/flow/FlowWorker.js +1 -1
- package/views/3d/support/flow/StreamlineResources3D.js +1 -1
- package/views/3d/support/flow/constants.js +1 -1
- package/views/3d/support/flow/geometryUtils.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/support/intersectionUtils.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl/RenderCamera.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
- package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/triangleIntersectionUtils.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +13 -12
- package/views/3d/webgl-engine/shaders/CutFillDepthTechniqueConfiguration.js +5 -0
- package/views/3d/webgl-engine/shaders/CutFillReductionTechniqueConfiguration.js +5 -0
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +1 -1
- package/views/interactive/GraphicManipulator.js +1 -1
- package/views/interactive/coordinateHelper.js +1 -1
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
- package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
- package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
- package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/views/support/euclideanAreaMeasurementUtils.js +1 -1
- package/views/support/euclideanLengthMeasurementUtils.js +1 -1
- package/views/support/geometry3dUtils.js +1 -1
- package/webdoc/widgets/FloorFilter.js +1 -1
- package/widgets/Expand/ExpandViewModel.d.ts +1 -0
- package/widgets/Expand/ExpandViewModel.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/1e17ad6cdffa5016a3db.js +0 -1
- package/assets/esri/core/workers/chunks/21ebd234cf32ae52b3ea.js +0 -1
- package/assets/esri/core/workers/chunks/262c5794650853457acc.js +0 -1
- /package/effects/{FocusAreaStyle.d.ts → types.d.ts} +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{throwIfAborted as e}from"../../../../core/promiseUtils.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{identity as s,scale as r,translate as i,copy as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{b as n,q as l,d as c,B as h,i as d,h as m}from"../../../../chunks/vec32.js";import{fromArray as u,ONES as p,create as f,ZEROS as y,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as g,ONES as b,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as P}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as x}from"../../../../geometry/projection/projectPointToVector.js";import{create as R,size as S,containsPoint as C,center as L}from"../../../../geometry/support/aaBoundingBox.js";import{getEmissiveMode as w}from"../../../../symbols/support/materialUtils.js";import{defaultPrimitive as O}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as U,objectSymbolLayerSizeWithResourceSize as j}from"../../../../symbols/support/symbolLayerUtils3D.js";import{estimateNumVerticesForLods as E,defaultSymbolLayerMemoryComplexity as T}from"./defaultSymbolComplexity.js";import{perLodInstanceElevationAligner as B}from"./ElevationAligners.js";import{needsElevationUpdates3D as G,SampleElevationInfo as z,evaluateElevationInfoAtPoint as D}from"./elevationAlignmentUtils.js";import{Graphics3DLodInstanceGraphicLayer as V}from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as F,nanFallbackColor as A}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as I,computeObjectScale as k,computeObjectRotation as H}from"./graphicUtils.js";import{makeLodResources as M}from"./lodResourceUtils.js";import{fetch as W}from"./objectResourceUtils.js";import{placePointOnGeometry as N,extendPointGraphicElevationContext as q}from"./pointUtils.js";import{isValidPrimitive as $,primitiveLodResources as Z}from"./primitiveObjectSymbolUtils.js";import{SymbolComplexity as J}from"./SymbolComplexity.js";import{getResourceUrlFromSymbolStyle as K}from"./webStyleUtils.js";import{initFastSymbolUpdatesState as Q,updateFastSymbolUpdatesState as X,ConvertOptions as Y,evaluateModelTransformScale as ee,evaluateModelTransform as te}from"../support/FastSymbolUpdates.js";import{VerticalOffsetParameters as se}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{LodRenderer as re}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{schematicMRRFactors as ae}from"../../webgl-engine/materials/pbrUtils.js";class oe{constructor(e,t,s,r,i,a,o,n,l,c,h=null){this.lodResources=e,this.lodRenderer=t,this.stageResources=s,this.resourceSize=r,this.isEsriSymbolResource=i,this.isWosr=a,this.resourceBoundingBox=o,this.symbolSize=n,this.extentPadding=l,this.physicalBasedRenderingEnabled=c,this.pivotOffset=h}}class ne extends F{getCachedSize(){const[e,t,s]=null!=this._resources?this._resources.symbolSize:[1,1,1];return{width:e,depth:t,height:s}}constructor(e,t,s,r){super(e,t,s,r,he(t)),this._resources=null,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=new Array,this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){const e=I(this.symbolLayer);if(e)throw new Error(e)}if(this._isPrimitive){const t=this.symbolLayer.resource,s=t&&$(t?.primitive)?t.primitive:O;this._resources=await this._createResourcesForPrimitive(s,e)}else{const t=await K(this.symbol.styleOrigin),s=t?.href??this.symbolLayer.resource?.href;this._resources=await this._createResourcesForUrl(s,e)}this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.updateComplexity()}get extentPadding(){return null!=this._resources?this._resources.extentPadding:0}get _isPrimitive(){return null!=this._primitive}get lodRenderer(){return this._resources?.lodRenderer}get materials(){return this._resources?.stageResources.materials??[]}async _createResourcesForPrimitive(e,t){const s=this.symbolLayer,r=R(U(e)),i=u(S(r)),a=u(j(i,s)),o=n(a),l=!1,c=!1,h=s?.material,d={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:ae,ambient:p,diffuse:p,opacity:1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:s.castShadows,emissiveStrengthFromSymbol:h?.emissive?.strength??0,emissiveSource:1,offsetTransparentBackfaces:!1,drivenOpacity:this.needsDrivenTransparentPass},m=!!d.usePBR,f=this.symbol;"point-3d"===f.type&&f.verticalOffset&&(d.verticalOffset=new se(f.verticalOffset),d.castShadows=!1),this._context.screenSizePerspectiveEnabled&&(d.screenSizePerspective=this.view.screenSizePerspective.parameters),this._hasDrivenColorOrOpacity?d.externalColor=A:d.externalColor=this._materialColor?.toUnitRGBA()??g,this._fastUpdates=Q(this._context.renderer,this._fastVisualVariableConvertOptions(r,a,i,null)),d.instanced=!0,this._fastUpdates?(Object.assign(d,this._fastUpdates.materialParameters),d.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(d.instancedColor=!0);const y=new ie(d,this._context);y.setParameters({cullFace:de(y.transparent)});const _=Z(e,y);if(!_)throw new Error(`Unknown object symbol primitive: ${e}`);const b=await this._createStageResources(_,m,t),v=await this._createLodRenderer(_,t);return new oe(_,v,b,i,l,c,r,a,o,m)}async _createResourcesForUrl(e,s){const r={instanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},i={spherical:this._context.spherical,materialParameters:r,cache:this._context.sharedResources.objectResourceCache,compressionOptions:{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}};this._fastUpdates=Q(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(i.materialParameters,this._fastUpdates.materialParameters),i.materialParameters.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(i.materialParameters.instancedColor=!0);const a=this.symbol;if("point-3d"===a.type&&a.verticalOffset){const{screenLength:e,minWorldLength:s,maxWorldLength:r}=a.verticalOffset;i.materialParameters.verticalOffset={screenLength:t(e),minWorldLength:s||0,maxWorldLength:null!=r?r:1/0},i.materialParameters.castShadows=!1}const o=this._context.physicalBasedRenderingEnabled;i.signal=s,i.usePBR=o,i.useEmissive=this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result,i.skipHighLods=this._context.skipHighSymbolLods;const l=this.symbolLayer.material;i.materialParameters.emissiveStrengthFromSymbol=l?.emissive?.strength??1,i.materialParameters.emissiveSource=w(l?.emissive?.source??"emissive");const c=await W(e,i),h=c.isEsriSymbolResource,d=c.isWosr,m=M(c.lods),p=this._context,f=this._getExternalColorParameters(l),y=this.needsDrivenTransparentPass,_=m.getMaterials();_.forEach(e=>{e.setParameters({...f,drivenOpacity:y}),p.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:this.view.screenSizePerspective.parameters})});const g=c.referenceBoundingBox,b=u(S(g)),v=u(m.levels[0].pivotOffset),P=u(j(b,this.symbolLayer)),x=n(P),R=this._fastUpdates;X(R,this._context.renderer,this._fastVisualVariableConvertOptions(g,P,b,v))&&_.forEach(e=>e.setParameters(R.materialParameters));const C=await this._createStageResources(m,o,s),L=await this._createLodRenderer(m,s);return new oe(m,L,C,b,h,d,g,P,x,o,v)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(t,s,r){const i=this._context.stage,a=t.getMaterials();s!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged();const o=t.getTextures();i.addTextures(o),this._addDisposeResource(()=>{o.forEach(e=>e.unload()),i.removeTextures(o)}),await Promise.all(o.map(e=>this._context.stage.schedule(()=>e.load(i.renderView.renderingContext),r))),e(r);const n=t.getEngineGeometries();return{materials:a,textures:o,geometries:n}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerViewUid:this._context.layerViewUid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates,o=new re({symbol:e,metadata:r,shaderTransformation:i?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,fe),a(s,te(i.materialParameters,fe,s))},scaleFactor:(e,t,s)=>{t.getFeatureAttribute(s,fe),ee(e,i.materialParameters,fe)}}:null},this._context.scheduler);return o.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource(()=>{s.removeRenderPlugin(o),o.destroy()}),await s.addRenderPlugin(o,t),o}_getExternalColorParameters(e){const t={};if(t.externalColor=A,!this._drivenProperties.color&&null!=e?.color){const s=e.color.toUnitRGBA();this._drivenProperties.opacity&&(s[3]=NaN),t.externalColor=s}return t}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach(e=>e()),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=N(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for object symbol: ${t.geometry.type}`),null;const r=this.createElevationContextForGraphic(t),i=e.renderingInfo;return this._createAs3DShape(t,s,i,r,t.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(null==this._resources)return;const e=this._getLayerOpacity(),t=this._resources.stageResources.materials;for(let s=0;s<t.length;s++){const r=t[s];r.setParameters({layerOpacity:e}),this._isPrimitive&&r.setParameters({cullFace:de(r.transparent)})}}layerScreenSizePerspectiveChanged(){if(null==this._resources)return;const e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;for(const t of this._resources.stageResources.materials)t.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,G)}slicePlaneEnabledChanged(){if(null==this._resources)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(null==this._resources)return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this._isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this._hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this._hasLoadedPBRTextures=!0,!1)}applyRendererDiff(e,t){if(null==this._resources)return 0;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:i,symbolSize:a,resourceSize:o,pivotOffset:n}=this._resources;for(const l in e.diff){if("visualVariables"!==l)return 0;if(!X(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,a,o,n)))return 0;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return 2}computeComplexity(){if(null==this._resources)return super.computeComplexity();const e=this._resources.lodResources,t=E(e.levels),s=e.computeUsedMemory(),r={...T(this.symbol,this.symbolLayer),resourceBytes:s};return new J({verticesPerFeature:t,memory:r})}_hasLodRenderer(){return null!=this._resources}_createAs3DShape(e,t,s,r,i){if(!this._hasLodRenderer()||null==this._resources)return null;const a=this.getFastUpdateAttrValues(e),o=this._context.clippingExtent;if(x(t,me,this._context.elevationProvider.spatialReference),null!=o&&!C(o,me))return null;const n=ce(r),l=this._computeGlobalTransform(t,r,pe,ye),c=this._computeLocalTransform(this._resources,this.symbolLayer,s,ue),h=this._resources.lodRenderer.instanceData,d=h.addInstance();this._instanceIndexToGraphicUid.set(d,i),h.setLocalTransform(d,c,!1),h.setGlobalTransform(d,l),a&&h.setFeatureAttribute(d,a),null==this._fastUpdates&&this._hasDrivenColorOrOpacity&&h.setColor(d,this._getDrivenUInt8ColorWithNaNSupport(s,this._materialColor,!this._isPrimitive));const m=this._context.stage.renderView.olidRenderHelper;if(m){const e=m.getObjectAndLayerIdColor({graphicUid:i,layerViewUid:this._context.layerViewUid});h.setObjectAndLayerIdColor(d,e)}const u=new V(this,d,B,r,this._context.stage.view.state.highlightOrderMap);return n&&(u.alignedSampledElevation=ye.sampledElevation),u.needsElevationUpdates=G(r.mode),q(u,t,this._context.elevationProvider),u}_computeGlobalTransform(e,t,s,r){return D(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),me[0]=e.x,me[1]=e.y,me[2]=r.z,P(e.spatialReference,me,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,r,i){return s(i),this._applyObjectRotation(r,!1,i),this._applyObjectRotation(t,!0,i),this._applyObjectScale(e,r,i),this._applyAnchor(e,t,i),i}_applyObjectScale(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const i=this._drivenProperties.size&&t.size?t.size:e.symbolSize,a=k(i,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===a[0]&&1===a[1]&&1===a[2]||r(s,s,a)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(null==this._resources)return!0;const s=e.geometry;if(!s)return!1;const r=N(s);if(null==r)return!1;const i=this.getGeometryElevationMode(s),{elevationContext:a}=t;return a.mode===i&&(a.updateFeatureExpressionFeature(e,this._context.layer),this._computeGlobalTransform(r,a,pe,ye),ce(a)&&(t.alignedSampledElevation=ye.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(t.instanceIndex,pe,!0),q(t,r,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(null==this._resources)return;const s=(e,t,s)=>(null!=e&&"complete"===e.type?e.newValue:t)??s,r=s(t.heading,this.symbolLayer.heading,0),i=s(t.tilt,this.symbolLayer.tilt,0),a=s(t.roll,this.symbolLayer.roll,0),o=s(t.width,this.symbolLayer.width,void 0),n=s(t.height,this.symbolLayer.height,void 0),l=s(t.depth,this.symbolLayer.depth,void 0),c=s(t.anchor,this.symbolLayer.anchor,void 0),h=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const d={heading:r,tilt:i,roll:a,anchor:c,anchorPosition:h},m=this._resources;1===this.loadStatus&&e.symbolLayerStatePatches.push(()=>{m.symbolSize=u(j(m.resourceSize,{width:o,height:n,depth:l,isPrimitive:this._isPrimitive}))}),e.graphics3DGraphicPatches.push(({instanceIndex:e},t)=>{const s=this._computeLocalTransform(m,d,t,ue);m.lodRenderer.instanceData.setLocalTransform(e,s,!0)})}_preparePatchColor(e,t){if(!t.material||"partial"!==t.material.type)return;const s=t.material.diff;if(!s.color||"complete"!==s.color.type||null==s.color.newValue||null==s.color.oldValue)return;const r=s.color.newValue,i=null!=r?r.toUnitRGBA():b;delete s.color;const a=this._resources;if(null==a)return;const o=this._isPrimitive;e.graphics3DGraphicPatches.push(({instanceIndex:e})=>{if(this._hasDrivenColorOrOpacity)a.lodRenderer.instanceData.setColor(e,i);else{const e={externalColor:i};for(const t of a.stageResources.materials)t.setParameters(e),o&&t.setParameters({cullFace:de(t.transparent)})}})}_applyObjectRotation(e,t,s){if(!this._fastUpdates?.requiresShaderTransformation||!t)return H(e.heading,e.tilt,e.roll,s)}_applyAnchor(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=le(e.resourceBoundingBox,e.pivotOffset,t);r&&i(s,s,r)}_fastVisualVariableConvertOptions(e,t,s,r){const i=null!=e?u(S(e)):p,a=null!=e?le(e,r,this.symbolLayer):y,o=this._context.renderCoordsHelper.unitInMeters,n=k(null!=t?t:void 0,t,s,o),l=_(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new Y({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:i,symbolSize:t??p,unitInMeters:o,anchor:a,scale:n,rotation:l,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:n})}get _primitive(){const{resource:e}=this.symbolLayer;return null!=e?.href?null:e?.primitive??O}_getFallbackOpacityAndColor(){return this._materialColor?.toUnitRGBA()??(this._isPrimitive?g:A)}get _materialColor(){return this.symbolLayer.material?.color}}function le(e,t,s){const r=f();switch(s.anchor){case"center":c(r,L(e)),l(r,r);break;case"top":{const t=L(e);m(r,-t[0],-t[1],-e[5]);break}case"bottom":{const t=L(e);m(r,-t[0],-t[1],-e[2]);break}case"relative":{const t=L(e),i=S(e),a=s.anchorPosition,o=a?_(a.x,a.y,a.z):y;h(r,i,o),d(r,r,t),l(r,r);break}default:null!=t?l(r,t):c(r,y)}return r}function ce(e){return"absolute-height"!==e.mode}function he(e){return 1===(e.material?.color?.a??0)&&null==e.resource?.href}function de(e){return e?0:2}const me=f(),ue=o(),pe=o(),fe=v(),ye=new z;export{ne as Graphics3DObjectSymbolLayer};
|
|
5
|
+
import{throwIfAborted as e}from"../../../../core/promiseUtils.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{identity as s,scale as r,translate as i,copy as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{b as n,q as l,d as c,z as h,i as d,h as m}from"../../../../chunks/vec32.js";import{fromArray as u,ONES as p,create as f,ZEROS as y,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as g,ONES as b,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as P}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as x}from"../../../../geometry/projection/projectPointToVector.js";import{create as R,size as S,containsPoint as C,center as L}from"../../../../geometry/support/aaBoundingBox.js";import{getEmissiveMode as w}from"../../../../symbols/support/materialUtils.js";import{defaultPrimitive as O}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as U,objectSymbolLayerSizeWithResourceSize as j}from"../../../../symbols/support/symbolLayerUtils3D.js";import{estimateNumVerticesForLods as E,defaultSymbolLayerMemoryComplexity as T}from"./defaultSymbolComplexity.js";import{perLodInstanceElevationAligner as B}from"./ElevationAligners.js";import{needsElevationUpdates3D as G,SampleElevationInfo as z,evaluateElevationInfoAtPoint as D}from"./elevationAlignmentUtils.js";import{Graphics3DLodInstanceGraphicLayer as V}from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as F,nanFallbackColor as A}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as I,computeObjectScale as k,computeObjectRotation as H}from"./graphicUtils.js";import{makeLodResources as M}from"./lodResourceUtils.js";import{fetch as W}from"./objectResourceUtils.js";import{placePointOnGeometry as N,extendPointGraphicElevationContext as q}from"./pointUtils.js";import{isValidPrimitive as $,primitiveLodResources as Z}from"./primitiveObjectSymbolUtils.js";import{SymbolComplexity as J}from"./SymbolComplexity.js";import{getResourceUrlFromSymbolStyle as K}from"./webStyleUtils.js";import{initFastSymbolUpdatesState as Q,updateFastSymbolUpdatesState as X,ConvertOptions as Y,evaluateModelTransformScale as ee,evaluateModelTransform as te}from"../support/FastSymbolUpdates.js";import{VerticalOffsetParameters as se}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{LodRenderer as re}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{schematicMRRFactors as ae}from"../../webgl-engine/materials/pbrUtils.js";class oe{constructor(e,t,s,r,i,a,o,n,l,c,h=null){this.lodResources=e,this.lodRenderer=t,this.stageResources=s,this.resourceSize=r,this.isEsriSymbolResource=i,this.isWosr=a,this.resourceBoundingBox=o,this.symbolSize=n,this.extentPadding=l,this.physicalBasedRenderingEnabled=c,this.pivotOffset=h}}class ne extends F{getCachedSize(){const[e,t,s]=null!=this._resources?this._resources.symbolSize:[1,1,1];return{width:e,depth:t,height:s}}constructor(e,t,s,r){super(e,t,s,r,he(t)),this._resources=null,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=new Array,this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){const e=I(this.symbolLayer);if(e)throw new Error(e)}if(this._isPrimitive){const t=this.symbolLayer.resource,s=t&&$(t?.primitive)?t.primitive:O;this._resources=await this._createResourcesForPrimitive(s,e)}else{const t=await K(this.symbol.styleOrigin),s=t?.href??this.symbolLayer.resource?.href;this._resources=await this._createResourcesForUrl(s,e)}this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.updateComplexity()}get extentPadding(){return null!=this._resources?this._resources.extentPadding:0}get _isPrimitive(){return null!=this._primitive}get lodRenderer(){return this._resources?.lodRenderer}get materials(){return this._resources?.stageResources.materials??[]}async _createResourcesForPrimitive(e,t){const s=this.symbolLayer,r=R(U(e)),i=u(S(r)),a=u(j(i,s)),o=n(a),l=!1,c=!1,h=s?.material,d={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:ae,ambient:p,diffuse:p,opacity:1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:s.castShadows,emissiveStrengthFromSymbol:h?.emissive?.strength??0,emissiveSource:1,offsetTransparentBackfaces:!1,drivenOpacity:this.needsDrivenTransparentPass},m=!!d.usePBR,f=this.symbol;"point-3d"===f.type&&f.verticalOffset&&(d.verticalOffset=new se(f.verticalOffset),d.castShadows=!1),this._context.screenSizePerspectiveEnabled&&(d.screenSizePerspective=this.view.screenSizePerspective.parameters),this._hasDrivenColorOrOpacity?d.externalColor=A:d.externalColor=this._materialColor?.toUnitRGBA()??g,this._fastUpdates=Q(this._context.renderer,this._fastVisualVariableConvertOptions(r,a,i,null)),d.instanced=!0,this._fastUpdates?(Object.assign(d,this._fastUpdates.materialParameters),d.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(d.instancedColor=!0);const y=new ie(d,this._context);y.setParameters({cullFace:de(y.transparent)});const _=Z(e,y);if(!_)throw new Error(`Unknown object symbol primitive: ${e}`);const b=await this._createStageResources(_,m,t),v=await this._createLodRenderer(_,t);return new oe(_,v,b,i,l,c,r,a,o,m)}async _createResourcesForUrl(e,s){const r={instanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},i={spherical:this._context.spherical,materialParameters:r,cache:this._context.sharedResources.objectResourceCache,compressionOptions:{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}};this._fastUpdates=Q(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(i.materialParameters,this._fastUpdates.materialParameters),i.materialParameters.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(i.materialParameters.instancedColor=!0);const a=this.symbol;if("point-3d"===a.type&&a.verticalOffset){const{screenLength:e,minWorldLength:s,maxWorldLength:r}=a.verticalOffset;i.materialParameters.verticalOffset={screenLength:t(e),minWorldLength:s||0,maxWorldLength:null!=r?r:1/0},i.materialParameters.castShadows=!1}const o=this._context.physicalBasedRenderingEnabled;i.signal=s,i.usePBR=o,i.useEmissive=this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result,i.skipHighLods=this._context.skipHighSymbolLods;const l=this.symbolLayer.material;i.materialParameters.emissiveStrengthFromSymbol=l?.emissive?.strength??1,i.materialParameters.emissiveSource=w(l?.emissive?.source??"emissive");const c=await W(e,i),h=c.isEsriSymbolResource,d=c.isWosr,m=M(c.lods),p=this._context,f=this._getExternalColorParameters(l),y=this.needsDrivenTransparentPass,_=m.getMaterials();_.forEach(e=>{e.setParameters({...f,drivenOpacity:y}),p.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:this.view.screenSizePerspective.parameters})});const g=c.referenceBoundingBox,b=u(S(g)),v=u(m.levels[0].pivotOffset),P=u(j(b,this.symbolLayer)),x=n(P),R=this._fastUpdates;X(R,this._context.renderer,this._fastVisualVariableConvertOptions(g,P,b,v))&&_.forEach(e=>e.setParameters(R.materialParameters));const C=await this._createStageResources(m,o,s),L=await this._createLodRenderer(m,s);return new oe(m,L,C,b,h,d,g,P,x,o,v)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(t,s,r){const i=this._context.stage,a=t.getMaterials();s!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged();const o=t.getTextures();i.addTextures(o),this._addDisposeResource(()=>{o.forEach(e=>e.unload()),i.removeTextures(o)}),await Promise.all(o.map(e=>this._context.stage.schedule(()=>e.load(i.renderView.renderingContext),r))),e(r);const n=t.getEngineGeometries();return{materials:a,textures:o,geometries:n}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerViewUid:this._context.layerViewUid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates,o=new re({symbol:e,metadata:r,shaderTransformation:i?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,fe),a(s,te(i.materialParameters,fe,s))},scaleFactor:(e,t,s)=>{t.getFeatureAttribute(s,fe),ee(e,i.materialParameters,fe)}}:null},this._context.scheduler);return o.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource(()=>{s.removeRenderPlugin(o),o.destroy()}),await s.addRenderPlugin(o,t),o}_getExternalColorParameters(e){const t={};if(t.externalColor=A,!this._drivenProperties.color&&null!=e?.color){const s=e.color.toUnitRGBA();this._drivenProperties.opacity&&(s[3]=NaN),t.externalColor=s}return t}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach(e=>e()),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=N(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for object symbol: ${t.geometry.type}`),null;const r=this.createElevationContextForGraphic(t),i=e.renderingInfo;return this._createAs3DShape(t,s,i,r,t.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(null==this._resources)return;const e=this._getLayerOpacity(),t=this._resources.stageResources.materials;for(let s=0;s<t.length;s++){const r=t[s];r.setParameters({layerOpacity:e}),this._isPrimitive&&r.setParameters({cullFace:de(r.transparent)})}}layerScreenSizePerspectiveChanged(){if(null==this._resources)return;const e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;for(const t of this._resources.stageResources.materials)t.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,G)}slicePlaneEnabledChanged(){if(null==this._resources)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(null==this._resources)return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this._isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this._hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this._hasLoadedPBRTextures=!0,!1)}applyRendererDiff(e,t){if(null==this._resources)return 0;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:i,symbolSize:a,resourceSize:o,pivotOffset:n}=this._resources;for(const l in e.diff){if("visualVariables"!==l)return 0;if(!X(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,a,o,n)))return 0;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return 2}computeComplexity(){if(null==this._resources)return super.computeComplexity();const e=this._resources.lodResources,t=E(e.levels),s=e.computeUsedMemory(),r={...T(this.symbol,this.symbolLayer),resourceBytes:s};return new J({verticesPerFeature:t,memory:r})}_hasLodRenderer(){return null!=this._resources}_createAs3DShape(e,t,s,r,i){if(!this._hasLodRenderer()||null==this._resources)return null;const a=this.getFastUpdateAttrValues(e),o=this._context.clippingExtent;if(x(t,me,this._context.elevationProvider.spatialReference),null!=o&&!C(o,me))return null;const n=ce(r),l=this._computeGlobalTransform(t,r,pe,ye),c=this._computeLocalTransform(this._resources,this.symbolLayer,s,ue),h=this._resources.lodRenderer.instanceData,d=h.addInstance();this._instanceIndexToGraphicUid.set(d,i),h.setLocalTransform(d,c,!1),h.setGlobalTransform(d,l),a&&h.setFeatureAttribute(d,a),null==this._fastUpdates&&this._hasDrivenColorOrOpacity&&h.setColor(d,this._getDrivenUInt8ColorWithNaNSupport(s,this._materialColor,!this._isPrimitive));const m=this._context.stage.renderView.olidRenderHelper;if(m){const e=m.getObjectAndLayerIdColor({graphicUid:i,layerViewUid:this._context.layerViewUid});h.setObjectAndLayerIdColor(d,e)}const u=new V(this,d,B,r,this._context.stage.view.state.highlightOrderMap);return n&&(u.alignedSampledElevation=ye.sampledElevation),u.needsElevationUpdates=G(r.mode),q(u,t,this._context.elevationProvider),u}_computeGlobalTransform(e,t,s,r){return D(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),me[0]=e.x,me[1]=e.y,me[2]=r.z,P(e.spatialReference,me,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,r,i){return s(i),this._applyObjectRotation(r,!1,i),this._applyObjectRotation(t,!0,i),this._applyObjectScale(e,r,i),this._applyAnchor(e,t,i),i}_applyObjectScale(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const i=this._drivenProperties.size&&t.size?t.size:e.symbolSize,a=k(i,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===a[0]&&1===a[1]&&1===a[2]||r(s,s,a)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(null==this._resources)return!0;const s=e.geometry;if(!s)return!1;const r=N(s);if(null==r)return!1;const i=this.getGeometryElevationMode(s),{elevationContext:a}=t;return a.mode===i&&(a.updateFeatureExpressionFeature(e,this._context.layer),this._computeGlobalTransform(r,a,pe,ye),ce(a)&&(t.alignedSampledElevation=ye.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(t.instanceIndex,pe,!0),q(t,r,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(null==this._resources)return;const s=(e,t,s)=>(null!=e&&"complete"===e.type?e.newValue:t)??s,r=s(t.heading,this.symbolLayer.heading,0),i=s(t.tilt,this.symbolLayer.tilt,0),a=s(t.roll,this.symbolLayer.roll,0),o=s(t.width,this.symbolLayer.width,void 0),n=s(t.height,this.symbolLayer.height,void 0),l=s(t.depth,this.symbolLayer.depth,void 0),c=s(t.anchor,this.symbolLayer.anchor,void 0),h=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const d={heading:r,tilt:i,roll:a,anchor:c,anchorPosition:h},m=this._resources;1===this.loadStatus&&e.symbolLayerStatePatches.push(()=>{m.symbolSize=u(j(m.resourceSize,{width:o,height:n,depth:l,isPrimitive:this._isPrimitive}))}),e.graphics3DGraphicPatches.push(({instanceIndex:e},t)=>{const s=this._computeLocalTransform(m,d,t,ue);m.lodRenderer.instanceData.setLocalTransform(e,s,!0)})}_preparePatchColor(e,t){if(!t.material||"partial"!==t.material.type)return;const s=t.material.diff;if(!s.color||"complete"!==s.color.type||null==s.color.newValue||null==s.color.oldValue)return;const r=s.color.newValue,i=null!=r?r.toUnitRGBA():b;delete s.color;const a=this._resources;if(null==a)return;const o=this._isPrimitive;e.graphics3DGraphicPatches.push(({instanceIndex:e})=>{if(this._hasDrivenColorOrOpacity)a.lodRenderer.instanceData.setColor(e,i);else{const e={externalColor:i};for(const t of a.stageResources.materials)t.setParameters(e),o&&t.setParameters({cullFace:de(t.transparent)})}})}_applyObjectRotation(e,t,s){if(!this._fastUpdates?.requiresShaderTransformation||!t)return H(e.heading,e.tilt,e.roll,s)}_applyAnchor(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=le(e.resourceBoundingBox,e.pivotOffset,t);r&&i(s,s,r)}_fastVisualVariableConvertOptions(e,t,s,r){const i=null!=e?u(S(e)):p,a=null!=e?le(e,r,this.symbolLayer):y,o=this._context.renderCoordsHelper.unitInMeters,n=k(null!=t?t:void 0,t,s,o),l=_(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new Y({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:i,symbolSize:t??p,unitInMeters:o,anchor:a,scale:n,rotation:l,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:n})}get _primitive(){const{resource:e}=this.symbolLayer;return null!=e?.href?null:e?.primitive??O}_getFallbackOpacityAndColor(){return this._materialColor?.toUnitRGBA()??(this._isPrimitive?g:A)}get _materialColor(){return this.symbolLayer.material?.color}}function le(e,t,s){const r=f();switch(s.anchor){case"center":c(r,L(e)),l(r,r);break;case"top":{const t=L(e);m(r,-t[0],-t[1],-e[5]);break}case"bottom":{const t=L(e);m(r,-t[0],-t[1],-e[2]);break}case"relative":{const t=L(e),i=S(e),a=s.anchorPosition,o=a?_(a.x,a.y,a.z):y;h(r,i,o),d(r,r,t),l(r,r);break}default:null!=t?l(r,t):c(r,y)}return r}function ce(e){return"absolute-height"!==e.mode}function he(e){return 1===(e.material?.color?.a??0)&&null==e.resource?.href}function de(e){return e?0:2}const me=f(),ue=o(),pe=o(),fe=v(),ye=new z;export{ne as Graphics3DObjectSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{delinearize as e,colorGamma as r}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as t}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as o}from"../../../../core/mathUtils.js";import{normalFromMat4 as s,fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as c,e as m,
|
|
5
|
+
import{delinearize as e,colorGamma as r}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as t}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as o}from"../../../../core/mathUtils.js";import{normalFromMat4 as s,fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as c,e as m,A as f,b as d,n as p,l as g}from"../../../../chunks/vec32.js";import{create as x}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as T,expandWithVec3 as b}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as h}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec3f as y,BufferViewVec4f as v,BufferViewVec4u8 as w,BufferViewVec4u16 as R,BufferViewVec3u8 as S,BufferViewVec3u16 as B}from"../../../../geometry/support/buffer/BufferView.js";import{t as j,b as M,n as F,f as A}from"../../../../chunks/vec3.js";import{t as E,b as C}from"../../../../chunks/vec4.js";import{a as I}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as L}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as P}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as U}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as O}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as k}from"./ProcessedObjectResource.js";import{load as V,processLoadResult as _}from"./wosrLoader.js";import{Attribute as H}from"../../webgl-engine/lib/Attribute.js";import{Geometry as D}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as K}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as G}from"../../webgl-engine/materials/DefaultMaterial.js";import{useSchematicPBR as W,schematicMRRFactors as N,esriSymbologyMRRFactors as Q,advancedMRRFactors as $}from"../../webgl-engine/materials/pbrUtils.js";async function z(e,r){const o=q(t(e));if("wosr"===o.fileType){const e=await(r.cache?r.cache.loadWOSR(o.url,r):V(o.url,r)),{engineResources:t,referenceBoundingBox:s}=_(e,r);return{lods:t,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(r.cache)s=await r.cache.loadGLTF(o.url,r,!!r.usePBR,!!r.useEmissive);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new L,o.url,r,r.usePBR,r.useEmissive)}const{engineResources:i,referenceBoundingBox:n}=J(s,r,o.specifiedLodIndex);return{lods:i,referenceBoundingBox:n,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function q(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function J(e,r,t){const o=e.model,s=e.meta,i=o.meta?.ESRI_proxyEllipsoid,n=s.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.ESRI_webstyle;n&&!e.customMeta.esriTreeRendering&&(e.customMeta.esriTreeRendering=!0,re(e,i));const l=!!r.usePBR,a=s.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:Q}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:$},u={...r.materialParameters,treeRendering:n},c=new Array,m=new Map,f=new Map,d=o.lods.length,p=T();return o.lods.forEach((e,s)=>{const i=!0===r.skipHighLods&&(d>1&&0===s||d>3&&1===s)||!1===r.skipHighLods&&null!=t&&s!==t;if(i&&0!==s)return;const l=new k(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{const t=i?new G({},r):X(o,e,l,a,u,m,f,r,n),{geometry:c,vertexCount:d}=Y(e,t??new G({},r)),g=c.boundingInfo;null!=g&&0===s&&(b(p,g.bbMin),b(p,g.bbMax)),null!=t&&(l.stageResources.geometries.push(c),l.numberOfVertices+=d)}),i||c.push(l)}),{engineResources:c,referenceBoundingBox:p}}function X(r,t,o,s,i,n,l,a,c){const m=r.materials.get(t.material);if(null==m)return null;const{normal:f,color:d,texCoord0:p,tangent:g}=t.attributes,x=t.material+(f?"_normal":"")+(d?"_color":"")+(p?"_texCoord0":"")+(g?"_tangent":""),T=null!=t.attributes.texCoord0,b=null!=t.attributes.normal,h=ee(m.alphaMode);if(!n.has(x)){if(T){const e=(e,t=!1,o=!1)=>{if(null!=e&&!l.has(e)){const s=r.textures.get(e);if(s){const r=s.data,i=t&&!U(r)?a.compressionOptions:void 0;l.set(e,new K(U(r)?r.data:r,{...s.parameters,preMultiplyAlpha:!U(r)&&o,encoding:U(r)?r.encoding:void 0,compressionOptions:i}))}}},t=1!==h&&!c;e(m.colorTexture,t,1!==h),e(m.normalTexture),e(m.occlusionTexture,!0),e(m.emissiveTexture),e(m.metallicRoughnessTexture,!0)}const o=e(m.color[0]),f=e(m.color[1]),d=e(m.color[2]),p=null!=m.colorTexture&&T?l.get(m.colorTexture):null,g=W(m),y=null!=m.normalTextureTransform?.scale?m.normalTextureTransform?.scale:u;n.set(x,new G({...s,customDepthTest:1,textureAlphaMode:h,textureAlphaCutoff:m.alphaCutoff,diffuse:[o,f,d],ambient:[o,f,d],opacity:"OPAQUE"===m.alphaMode?1:m.opacity,doubleSided:m.doubleSided,doubleSidedType:"winding-order",cullFace:m.doubleSided?0:2,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:b?0:2,castShadows:!0,receiveShadows:m.receiveShadows,receiveAmbientOcclusion:m.receiveAmbientOcclusion,textureId:null!=p?p.id:void 0,colorMixMode:m.colorMixMode,normalTextureId:null!=m.normalTexture&&T?l.get(m.normalTexture).id:void 0,textureAlphaPremultiplied:null!=p&&!!p.parameters.preMultiplyAlpha,occlusionTextureId:null!=m.occlusionTexture&&T?l.get(m.occlusionTexture).id:void 0,emissiveTextureId:null!=m.emissiveTexture&&T?l.get(m.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=m.metallicRoughnessTexture&&T?l.get(m.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[m.emissiveFactor[0],m.emissiveFactor[1],m.emissiveFactor[2]],emissiveStrengthKHR:null!=m.emissiveStrengthKHR?m.emissiveStrengthKHR:1,emissiveStrengthFromSymbol:null!=i.emissiveStrengthFromSymbol?i.emissiveStrengthFromSymbol:void 0,mrrFactors:g?N:[m.metallicFactor,m.roughnessFactor,s.mrrFactors[2]],isSchematic:g,colorTextureTransformMatrix:O(m.colorTextureTransform),normalTextureTransformMatrix:O(m.normalTextureTransform),scale:[y[0],y[1]],occlusionTextureTransformMatrix:O(m.occlusionTextureTransform),emissiveTextureTransformMatrix:O(m.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:O(m.metallicRoughnessTextureTransform),...i},a))}const y=n.get(x);if(o.stageResources.materials.push(y),T){const e=e=>{null!=e&&o.stageResources.textures.push(l.get(e))};e(m.colorTexture),e(m.normalTexture),e(m.occlusionTexture),e(m.emissiveTexture),e(m.metallicRoughnessTexture)}return y}function Y(e,r){const t=e.attributes.position.count,n=P(e.indices||t,e.primitiveType),l=h(3*t),{typedBuffer:a,typedBufferStride:u}=e.attributes.position;j(l,a,e.transform,3,u);const c=[["position",new H(l,n,3,!0)]];if(null!=e.attributes.normal){const r=h(3*t),{typedBuffer:i,typedBufferStride:l}=e.attributes.normal;s(Z,e.transform),M(r,i,Z,3,l),o(Z)&&F(r,r),c.push(["normal",new H(r,n,3,!0)])}if(null!=e.attributes.tangent){const r=h(4*t),{typedBuffer:s,typedBufferStride:l}=e.attributes.tangent;i(Z,e.transform),E(r,s,Z,4,l),o(Z)&&F(r,r,4),c.push(["tangent",new H(r,n,4,!0)])}if(null!=e.attributes.texCoord0){const r=h(2*t),{typedBuffer:o,typedBufferStride:s}=e.attributes.texCoord0;I(r,o,2,s),c.push(["uv0",new H(r,n,2,!0)])}const m=e.attributes.color;if(null!=m){const r=new Uint8Array(4*t);4===m.elementCount?m instanceof v?C(r,m,1,255):(m instanceof w||m instanceof R)&&C(r,m,1/255,255):(r.fill(255),m instanceof y?A(r,m.typedBuffer,1,255,4,m.typedBufferStride):(e.attributes.color instanceof S||e.attributes.color instanceof B)&&A(r,m.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push(["color",new H(r,n,4,!0)])}return{geometry:new D(r,c),vertexCount:t}}const Z=n();function ee(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}function re(e,t){for(let o=0;o<e.model.lods.length;++o){const s=e.model.lods[o];for(const i of s.parts){const s=i.attributes.normal;if(null==s)return;const n=i.attributes.position,u=n.count,T=x(),b=x(),h=x(),w=new Float32Array(4*u),R=new Float32Array(3*u),S=l(a(),i.transform);let B=0,j=0;for(let l=0;l<u;l++){n.getVec(l,b),s.getVec(l,T),c(b,b,i.transform),m(h,b,t.center),f(h,h,t.radius);const a=h[2],u=d(h),x=Math.min(.45+.55*u*u,1)**r;f(h,h,t.radius),null!==S&&c(h,h,S),p(h,h),o+1!==e.model.lods.length&&e.model.lods.length>1&&g(h,h,T,a>-1?.2:Math.min(-4*a-3.8,1)),R[B]=h[0],R[B+1]=h[1],R[B+2]=h[2],B+=3,w[j]=x,w[j+1]=x,w[j+2]=x,w[j+3]=1,j+=4}i.attributes.normal=new y(R.buffer),i.attributes.color=new v(w.buffer)}}}export{z as fetch,q as parseUrl};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{n as e,a as t,g as i,c as s,h as r,G as n,e as o,d as a,u as c,w as u,j as l,H as h,s as d,D as m,b as _,F as p,i as f}from"../../../../chunks/vec32.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as R}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as S}from"../../../../geometry/projection/projectors.js";import{create as M,fromMatrix as x,createPoints as I,intersectsSphere as C}from"../../../../geometry/support/frustum.js";import{getNormal as D,signedDistance as P}from"../../../../geometry/support/plane.js";import{isPlateCarree as E}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as O}from"../../../../geometry/support/sphere.js";import{evaluateElevationAlignmentAtPoint as F}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as V}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as A,extractExpressionInfo as B}from"../graphics/featureExpressionInfoUtils.js";import{intersectBoundingRectWithMbs as L}from"./I3SUtil.js";import{Obb as j,computeOffsetObb as y}from"../../support/orientedBoundingBox.js";const w=1e5;class q{get _frustumMbsCenter(){return this._frustumMbs.center}get _frustumMbsRadius(){return this._frustumMbs.radius}get _frustumPlanes(){return this._frustum}constructor(e,t,i,s,r,n,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=r,this._elevationProvider=n,this._viewingMode=o,this._options=c,this._frustum=M(),this._frustumMbs=new O,this._viewDirection=v(),this._useFrustumCulling=!1,this._poi=v(),this._cameraPOIDirection=v(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const u=this._renderCoordsHelper.spatialReference;this._renderSR=u,this._renderSRSphericalPCPF=R(u),this._isGlobalMode=u===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(u.isWebMercator||E(u)),this._indexSREllipsoidRadius=g(this._indexSR).radius,this._indexSRSphericalPCPF=R(e),this._projectorIndexSRToIndexSRSphericalPCPF=S(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=V.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(A(B(e,!1)))):this._elevationContext=null}updateCamera(r,n){if(this._useFrustumCulling=n,e(this._viewDirection,r.viewForward),n){x(r.viewMatrix,r.projectionMatrix,this._frustum,U);{const e=r.eye,n=N;t(n,U[4],e);const o=.5*i(n,n)/i(this._viewDirection,n),a=this._frustumMbs,c=a.center;s(c,e,this._viewDirection,o);const u=1+o;a.radius=u}}this._screenSizeFactor=1/(r.perScreenPixelRatio/2),this._camPos=r.eye,this._updateCameraPOIDirection(),this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const r="relative-to-scene"===this._elevationContext.mode?"scene":"ground",n=this._elevationProvider;if(n.getSphereElevationRange){const e=n.getSphereElevationRange(s,this._indexSR,r);if(e)return void i.expandElevationRange(e)}const[o,a,c]=s.center,u=n.getElevation(o,a,c,this._indexSR,r);u&&i.expandElevationRangeValues(u,u);const l=t?null:n.getRootElevationRange?.();l&&i.expandElevationRange(l)}calculateServiceMbsInRenderSR(e){const{serviceMbsInRenderSR:t}=e;if(t.isValid)return t;const{serviceMbsInIndexSR:i}=e;if(!i)return t;const s=ee;s.copyFrom(i);const{minElevation:r}=e,{_elevationContext:n,_renderCoordsHelper:o}=this,{center:a}=s;if(n&&Number.isFinite(r)){let t=0,i=0;const{maxElevation:c}=e;switch(n.mode){case"relative-to-ground":case"relative-to-scene":t=n.geometryZWithOffset(a[2],o)+r-a[2],i=c-r;break;case"on-the-ground":t=r-a[2],i=c-r}a[2]+=t+.5*i,s.radius+=.5*i}else n&&s.radius<w&&(a[2]=F(a,this._elevationProvider,n,o));return b(s,this._indexSR,s,this._renderSR),e.updateServiceMbsInRenderSR(s)}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new j,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const n=i.radius;let o=0,a=0;const c=s.centerZ,u=this._renderCoordsHelper,l=this._elevationContext;if(l&&e.elevationRangeValid){const{minElevation:t,maxElevation:i}=e;switch(l.mode){case"relative-to-ground":case"relative-to-scene":o=l.geometryZWithOffset(c,u)+t-c,a=i-t;break;case"on-the-ground":o=t-c,a=i-t}}else if(l&&n<w){const e=r(Z,s.centerX,s.centerY,c);o=F(e,this._elevationProvider,l,u)-c}const h=a>0,d=h?W:t;return s.transform(d,this._indexSR,this._renderSR,o,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),h&&y(d,0,a,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;return t?(t.transform(W,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),W):null}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(1===this._viewingMode?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){n(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(o(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),r=t.elevationAgnosticBoundingVolume;let n,o=-1;if(s){const t=Z;s.getCenter(t),e(t,t),n=t,s.getCorners(X);for(const s of X){e(s,s);const n=i(s,t);if(n<=0)return void r.invalidate();const a=Math.sqrt(1-n*n);o=Math.max(o,a)}}else{const i=t.serviceMbsInRenderSR;if(!i.isValid)return void r.invalidate();const s=a(Z,i.center),u=i.radius,l=c(s);if(l<u)return void r.invalidate();o=u/l,e(s,s),n=s}const u=.001;r.set(n,o+u)}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(Z);e[2]=0;let s=0;const r=Y;i.getCorners(X);for(const t of X){t[2]=0;const e=u(r,t);s=Math.max(s,e)}t.set(e,Math.sqrt(s))}else{const i=e.serviceMbsInRenderSR;if(i.isValid){const e=a(Z,i.center);e[2]=0,t.set(e,i.radius)}}}isNodeVisible(e){const t=this.calculateServiceMbsInRenderSR(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getAndUpdateVisibilityObbInRenderSR(e);return i?i.doesIntersectFrustumConservativeApproximation(this._frustum):C(this._frustum,t)}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||(!e.valid||(1===this._viewingMode?this._isConeVisibleInFrustum(e):this._isCylinderVisibleInFrustum(e)))}_isConeVisibleInFrustum(r){if(!this._isConeVisibleInFrustumMbs(r))return!1;const n=r.radius;if(-1===n||n>.9)return!0;const o=this._frustumPlanes,a=this._frustumMbsCenter,c=r.getAxis($),u=i(c,a),h=this._frustumMbsRadius,d=u-h,m=u+h;if(d<=0)return!0;const _=l(k,c,d),p=l(z,c,m),f=n/Math.sqrt(1-n*n);for(const v of o){const r=D(v),n=e(H,r),o=i(n,c);if(Math.abs(1-o)<.01)continue;const a=J;l(a,c,o),t(a,a,n),e(a,a);const u=K;s(u,_,a,d*f);if(P(v,u)<=0)continue;s(u,p,a,m*f);if(P(v,u)<=0)continue;return!1}return!0}_isConeVisibleInFrustumMbs(e){const t=e.radius;if(t>.9)return!0;const s=this._frustumMbsRadius,r=this._frustumMbsCenter,n=c(r);if(n<=s)return!0;const o=e.getAxis($),a=i(o,r);{const e=l(T,o,a);if(h(e,r)<s)return!0}const u=a/n;if(a<=0){return-u<s}const d=Math.sqrt(1-u*u);if(d<t)return!0;const m=s/n;return d*Math.sqrt(1-m*m)-m*u<t}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling)return!0;if(!e.valid)return!0;const s=this._frustumMbsRadius,r=this._frustumMbsCenter,n=this._frustumPlanes,o=X;if(t.getCorners(o),1===this._viewingMode){const t=e.getAxis($),a=i(t,r),c=a-s,u=a+s;if(c<=0)return!0;for(const e of n){let s=!0;for(const r of o){const n=i(r,t),o=Q;if(l(o,r,c/n),P(e,o)<=0){s=!1;break}const a=Q;if(l(a,r,u/n),P(e,a)<=0){s=!1;break}}if(s)return!1}}else{const e=r[2]-s,t=r[2]+s;for(const i of n){let s=!0;const r=D(i),n=r[0],a=r[1],c=r[2],u=i[3];for(const i of o){const r=n*i[0]+a*i[1]+u;if(r+c*e<=0||r+c*t<=0){s=!1;break}}if(s)return!1}}return!0}_isCylinderVisibleInFrustum(e){const t=this._frustumMbsCenter,i=this._frustumMbsRadius,s=a(T,t);s[2]=0;const r=e.radius,n=e.getAxis($);return h(s,n)<=r+i}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.doesIntersectFrustumConservativeApproximation(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||0!==L(this._clippingArea,e)}_screenSpaceDiameterMbs(e,t){const i=this.calculateServiceMbsInRenderSR(e),s=Math.sqrt(d(i.center,this._camPos)),r=s-i.radius;return this._updateMinMaxDistance(s),r<0?.5*Number.MAX_VALUE:t/r*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.calculateServiceMbsInRenderSR(e).radius}calcCameraDistanceToCenter(e){const t=this.calculateServiceMbsInRenderSR(e),i=m(t.center,this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const{center:s,radius:r}=this.calculateServiceMbsInRenderSR(e),n=t(Y,s,this._camPos),o=(Math.abs(i(s,n))/_(s)+r)/_(n);return Math.min(1,o)}hasLOD(e){return 0!==e.lodMetric}_getDistanceGlobeMode(e,t){const s=_(t.center),r=_(e)-s;l(te,e,i(e,t.center)/p(e));const n=d(t.center,te),a=t.radius;if(n<=a*a)return Math.abs(r);{const n=l(te,t.center,1/s),c=l(ie,n,s-a*a/2/s),u=e,h=o(se,u,c),d=o(se,h,l(re,n,i(n,h))),p=f(se,c,l(se,d,a/_(d)));let v=m(u,p);if(r>=2e5){const e=o(ie,u,p);let t=i(e,n)/_(e);t<.08&&(t=1e-4),v/=t}return v}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):G(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(0===e.lodMetric)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 2:{const i=this.calculateServiceMbsInRenderSR(e),s=this._getDistance(this._camPos,i),r=2*s/this._screenSizeFactor,n=s+i.radius;return this._updateMinMaxDistance(n),e.maxError*t<=r}case 1:{let i=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case 4:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(null==e)return 0;const t=this.calculateServiceMbsInRenderSR(e),s=t.center,r=i(s,this._cameraPOIDirection),n=r*r,o=p(s)-n;return Math.sqrt(o)-t.radius}distCameraToPOI(){return m(this._camPos,this._poi)}}function G(e,t){const i=e[0]-t.center[0],s=e[1]-t.center[1],r=e[2]-t.center[2],n=i*i+s*s,o=t.radius;if(n<=o*o)return Math.abs(r);const a=Math.sqrt(n)-o;return Math.sqrt(r*r+a*a)}const U=I(),N=v(),T=v(),k=v(),z=v(),H=v(),W=new j,Z=v(),X=[v(),v(),v(),v(),v(),v(),v(),v()],Y=v(),J=v(),K=v(),Q=v(),$=v(),ee=new O,te=v(),ie=v(),se=v(),re=v();export{q as default};
|
|
5
|
+
import{n as e,a as t,g as i,c as s,h as r,E as n,e as o,d as a,u as c,G as u,j as l,F as h,s as d,B as m,b as _,D as p,i as f}from"../../../../chunks/vec32.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as R}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as S}from"../../../../geometry/projection/projectors.js";import{create as M,fromMatrix as x,createPoints as I,intersectsSphere as C}from"../../../../geometry/support/frustum.js";import{getNormal as D,signedDistance as P}from"../../../../geometry/support/plane.js";import{isPlateCarree as E}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as O}from"../../../../geometry/support/sphere.js";import{evaluateElevationAlignmentAtPoint as F}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as V}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as A,extractExpressionInfo as B}from"../graphics/featureExpressionInfoUtils.js";import{intersectBoundingRectWithMbs as L}from"./I3SUtil.js";import{Obb as j,computeOffsetObb as y}from"../../support/orientedBoundingBox.js";const w=1e5;class q{get _frustumMbsCenter(){return this._frustumMbs.center}get _frustumMbsRadius(){return this._frustumMbs.radius}get _frustumPlanes(){return this._frustum}constructor(e,t,i,s,r,n,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=r,this._elevationProvider=n,this._viewingMode=o,this._options=c,this._frustum=M(),this._frustumMbs=new O,this._viewDirection=v(),this._useFrustumCulling=!1,this._poi=v(),this._cameraPOIDirection=v(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const u=this._renderCoordsHelper.spatialReference;this._renderSR=u,this._renderSRSphericalPCPF=R(u),this._isGlobalMode=u===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(u.isWebMercator||E(u)),this._indexSREllipsoidRadius=g(this._indexSR).radius,this._indexSRSphericalPCPF=R(e),this._projectorIndexSRToIndexSRSphericalPCPF=S(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=V.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(A(B(e,!1)))):this._elevationContext=null}updateCamera(r,n){if(this._useFrustumCulling=n,e(this._viewDirection,r.viewForward),n){x(r.viewMatrix,r.projectionMatrix,this._frustum,U);{const e=r.eye,n=N;t(n,U[4],e);const o=.5*i(n,n)/i(this._viewDirection,n),a=this._frustumMbs,c=a.center;s(c,e,this._viewDirection,o);const u=1+o;a.radius=u}}this._screenSizeFactor=1/(r.perScreenPixelRatio/2),this._camPos=r.eye,this._updateCameraPOIDirection(),this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const r="relative-to-scene"===this._elevationContext.mode?"scene":"ground",n=this._elevationProvider;if(n.getSphereElevationRange){const e=n.getSphereElevationRange(s,this._indexSR,r);if(e)return void i.expandElevationRange(e)}const[o,a,c]=s.center,u=n.getElevation(o,a,c,this._indexSR,r);u&&i.expandElevationRangeValues(u,u);const l=t?null:n.getRootElevationRange?.();l&&i.expandElevationRange(l)}calculateServiceMbsInRenderSR(e){const{serviceMbsInRenderSR:t}=e;if(t.isValid)return t;const{serviceMbsInIndexSR:i}=e;if(!i)return t;const s=ee;s.copyFrom(i);const{minElevation:r}=e,{_elevationContext:n,_renderCoordsHelper:o}=this,{center:a}=s;if(n&&Number.isFinite(r)){let t=0,i=0;const{maxElevation:c}=e;switch(n.mode){case"relative-to-ground":case"relative-to-scene":t=n.geometryZWithOffset(a[2],o)+r-a[2],i=c-r;break;case"on-the-ground":t=r-a[2],i=c-r}a[2]+=t+.5*i,s.radius+=.5*i}else n&&s.radius<w&&(a[2]=F(a,this._elevationProvider,n,o));return b(s,this._indexSR,s,this._renderSR),e.updateServiceMbsInRenderSR(s)}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new j,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const n=i.radius;let o=0,a=0;const c=s.centerZ,u=this._renderCoordsHelper,l=this._elevationContext;if(l&&e.elevationRangeValid){const{minElevation:t,maxElevation:i}=e;switch(l.mode){case"relative-to-ground":case"relative-to-scene":o=l.geometryZWithOffset(c,u)+t-c,a=i-t;break;case"on-the-ground":o=t-c,a=i-t}}else if(l&&n<w){const e=r(Z,s.centerX,s.centerY,c);o=F(e,this._elevationProvider,l,u)-c}const h=a>0,d=h?W:t;return s.transform(d,this._indexSR,this._renderSR,o,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),h&&y(d,0,a,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;return t?(t.transform(W,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),W):null}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(1===this._viewingMode?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){n(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(o(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),r=t.elevationAgnosticBoundingVolume;let n,o=-1;if(s){const t=Z;s.getCenter(t),e(t,t),n=t,s.getCorners(X);for(const s of X){e(s,s);const n=i(s,t);if(n<=0)return void r.invalidate();const a=Math.sqrt(1-n*n);o=Math.max(o,a)}}else{const i=t.serviceMbsInRenderSR;if(!i.isValid)return void r.invalidate();const s=a(Z,i.center),u=i.radius,l=c(s);if(l<u)return void r.invalidate();o=u/l,e(s,s),n=s}const u=.001;r.set(n,o+u)}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(Z);e[2]=0;let s=0;const r=Y;i.getCorners(X);for(const t of X){t[2]=0;const e=u(r,t);s=Math.max(s,e)}t.set(e,Math.sqrt(s))}else{const i=e.serviceMbsInRenderSR;if(i.isValid){const e=a(Z,i.center);e[2]=0,t.set(e,i.radius)}}}isNodeVisible(e){const t=this.calculateServiceMbsInRenderSR(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getAndUpdateVisibilityObbInRenderSR(e);return i?i.intersectsFrustumConservativeApproximation(this._frustum):C(this._frustum,t)}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||(!e.valid||(1===this._viewingMode?this._isConeVisibleInFrustum(e):this._isCylinderVisibleInFrustum(e)))}_isConeVisibleInFrustum(r){if(!this._isConeVisibleInFrustumMbs(r))return!1;const n=r.radius;if(-1===n||n>.9)return!0;const o=this._frustumPlanes,a=this._frustumMbsCenter,c=r.getAxis($),u=i(c,a),h=this._frustumMbsRadius,d=u-h,m=u+h;if(d<=0)return!0;const _=l(k,c,d),p=l(z,c,m),f=n/Math.sqrt(1-n*n);for(const v of o){const r=D(v),n=e(H,r),o=i(n,c);if(Math.abs(1-o)<.01)continue;const a=J;l(a,c,o),t(a,a,n),e(a,a);const u=K;s(u,_,a,d*f);if(P(v,u)<=0)continue;s(u,p,a,m*f);if(P(v,u)<=0)continue;return!1}return!0}_isConeVisibleInFrustumMbs(e){const t=e.radius;if(t>.9)return!0;const s=this._frustumMbsRadius,r=this._frustumMbsCenter,n=c(r);if(n<=s)return!0;const o=e.getAxis($),a=i(o,r);{const e=l(T,o,a);if(h(e,r)<s)return!0}const u=a/n;if(a<=0){return-u<s}const d=Math.sqrt(1-u*u);if(d<t)return!0;const m=s/n;return d*Math.sqrt(1-m*m)-m*u<t}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling)return!0;if(!e.valid)return!0;const s=this._frustumMbsRadius,r=this._frustumMbsCenter,n=this._frustumPlanes,o=X;if(t.getCorners(o),1===this._viewingMode){const t=e.getAxis($),a=i(t,r),c=a-s,u=a+s;if(c<=0)return!0;for(const e of n){let s=!0;for(const r of o){const n=i(r,t),o=Q;if(l(o,r,c/n),P(e,o)<=0){s=!1;break}const a=Q;if(l(a,r,u/n),P(e,a)<=0){s=!1;break}}if(s)return!1}}else{const e=r[2]-s,t=r[2]+s;for(const i of n){let s=!0;const r=D(i),n=r[0],a=r[1],c=r[2],u=i[3];for(const i of o){const r=n*i[0]+a*i[1]+u;if(r+c*e<=0||r+c*t<=0){s=!1;break}}if(s)return!1}}return!0}_isCylinderVisibleInFrustum(e){const t=this._frustumMbsCenter,i=this._frustumMbsRadius,s=a(T,t);s[2]=0;const r=e.radius,n=e.getAxis($);return h(s,n)<=r+i}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.intersectsFrustumConservativeApproximation(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||0!==L(this._clippingArea,e)}_screenSpaceDiameterMbs(e,t){const i=this.calculateServiceMbsInRenderSR(e),s=Math.sqrt(d(i.center,this._camPos)),r=s-i.radius;return this._updateMinMaxDistance(s),r<0?.5*Number.MAX_VALUE:t/r*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.calculateServiceMbsInRenderSR(e).radius}calcCameraDistanceToCenter(e){const t=this.calculateServiceMbsInRenderSR(e),i=m(t.center,this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const{center:s,radius:r}=this.calculateServiceMbsInRenderSR(e),n=t(Y,s,this._camPos),o=(Math.abs(i(s,n))/_(s)+r)/_(n);return Math.min(1,o)}hasLOD(e){return 0!==e.lodMetric}_getDistanceGlobeMode(e,t){const s=_(t.center),r=_(e)-s;l(te,e,i(e,t.center)/p(e));const n=d(t.center,te),a=t.radius;if(n<=a*a)return Math.abs(r);{const n=l(te,t.center,1/s),c=l(ie,n,s-a*a/2/s),u=e,h=o(se,u,c),d=o(se,h,l(re,n,i(n,h))),p=f(se,c,l(se,d,a/_(d)));let v=m(u,p);if(r>=2e5){const e=o(ie,u,p);let t=i(e,n)/_(e);t<.08&&(t=1e-4),v/=t}return v}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):G(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(0===e.lodMetric)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 2:{const i=this.calculateServiceMbsInRenderSR(e),s=this._getDistance(this._camPos,i),r=2*s/this._screenSizeFactor,n=s+i.radius;return this._updateMinMaxDistance(n),e.maxError*t<=r}case 1:{let i=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case 4:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(null==e)return 0;const t=this.calculateServiceMbsInRenderSR(e),s=t.center,r=i(s,this._cameraPOIDirection),n=r*r,o=p(s)-n;return Math.sqrt(o)-t.radius}distCameraToPOI(){return m(this._camPos,this._poi)}}function G(e,t){const i=e[0]-t.center[0],s=e[1]-t.center[1],r=e[2]-t.center[2],n=i*i+s*s,o=t.radius;if(n<=o*o)return Math.abs(r);const a=Math.sqrt(n)-o;return Math.sqrt(r*r+a*a)}const U=I(),N=v(),T=v(),k=v(),z=v(),H=v(),W=new j,Z=v(),X=[v(),v(),v(),v(),v(),v(),v(),v()],Y=v(),J=v(),K=v(),Q=v(),$=v(),ee=new O,te=v(),ie=v(),se=v(),re=v();export{q as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{e as n,b as o,j as a,q as h,g as l,
|
|
5
|
+
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{e as n,b as o,j as a,q as h,g as l,D as c}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as u}from"../../../../chunks/vec42.js";import{create as p,offset as m,contains as g,containsPoint as _,set as f,positiveInfinity as P,equals as x}from"../../../../geometry/support/aaBoundingBox.js";import{create as b}from"../../../../geometry/support/plane.js";import{fromPoints as S}from"../../../../geometry/support/ray.js";import{Sphere as w}from"../../../../geometry/support/sphere.js";import{PclTarget as z}from"./Intersector.js";import{PointCloudHighlights as y}from"./PointCloudHighlights.js";import{isDepth as R,isColor as j}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as v}from"../../webgl-engine/effects/RenderPlugin.js";import{IntersectorResult as q}from"../../webgl-engine/lib/IntersectorResult.js";import{VertexArrayObject as F}from"../../webgl-engine/lib/VertexArrayObject.js";import{P as A,g as E}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as B,positionsLayout as H,colorsLayout as M}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as O}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{PrimitiveType as I}from"../../../webgl/enums.js";import{VertexBuffer as N}from"../../../webgl/VertexBuffer.js";let V=class extends v{constructor(e){super(e),this.type=6,this.isGround=!1,this._passParameters=new A,this._highlights=new y({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.produces=new Map([[2,e=>!(R(e)||8===e&&this._highlights.empty)],[3,e=>R(e)]]),this.point=d(),this.intersectionRayDir=d(),this.intersectionPlane=b(),this.nodeOriginOffset=d(),this.nodeBoundingBox=p(),this.layerViewUid="",this._slicePlaneEnabled=!1,this._configuration=new O,this._nodes=new s}destroy(){this._nodes.prune()}hasHighlight(e){return this._highlights.has(e)}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,s,i){const{point:r,intersectionRayDir:f,nodeOriginOffset:P,intersectionPlane:x,layerViewUid:b,nodeBoundingBox:y}=this,R=S(s,i),j=e.camera.perScreenPixelRatio/2,v=e.camera.near;n(f,i,s);const F=1/o(f);a(f,f,F);const A=d();h(A,f),u(x,f[0],f[1],f[2],-l(f,s));const E=new U,B=new U,H=new Array,M=p(this._passParameters.clipBox);m(M,-s[0],-s[1],-s[2],M),this._nodes.forAll(o=>{const{isLeaf:a,coordinates:h}=o,d=o.splatSize*this._passParameters.scaleFactor;let u=o.obb.minimumDistancePlane(x),p=o.obb.maximumDistancePlane(x);u-=C(d,u+v,this._passParameters,j,a),p-=C(d,p+v,this._passParameters,j,a);const S=p<0,z=null!=E.dist&&null!=B.dist&&E.dist<u*F&&B.dist>p*F;if(S||z)return;const q=T(d,p+v,this._passParameters,j,a);if(!new w(o.obb.center,o.obb.radius+q).intersectRay(R))return;if(!o.obb.intersectRay(s,f,q))return;const O=q*q;o.obb.toAaBoundingBox(y),m(y,-s[0],-s[1],-s[2],y);const I=!g(M,y);n(P,o.origin,s);const N=h.length/3;for(let n=0;n<N;n++){const u=3*n;if(r[0]=P[0]+h[u],r[1]=P[1]+h[u+1],r[2]=P[2]+h[u+2],I&&!_(M,r))continue;const p=l(r,f),m=p*p,g=c(r)-m;if(g>O)continue;let x=p+v;const S=C(d,x,this._passParameters,j,a);if(p-S<0)continue;x-=S;const w=T(d,x,this._passParameters,j,a);if(g>w*w)continue;const z=(p-S)*F,y=e=>(e.point=e.point?D(o,n,e.point):D(o,n),e.dist=z,e.normal=A,e.node=o,e.pointId=n,e.layerViewUid=b,e);if((null==E.dist||z<E.dist)&&(null==t||t(s,i,z))&&y(E),0!==e.options.store&&(null==B.dist||z>B.dist)&&(null==t||t(s,i,z))&&y(B),2===e.options.store&&(null==t||t(s,i,z))){const e=new U;H.push(y(e))}}});const O=e=>{const{layerViewUid:t,node:s,pointId:i}=e;return new z(e.point,t,i,()=>this.createGraphic(s,i,e.point))},I=(e,t)=>{const s=O(t);e.set(this.type,s,t.dist,t.normal)};if(W(E)){const t=e.results.min;(null==t.distance||E.dist<t.distance)&&I(t,E)}if(W(B)&&0!==e.options.store){const t=e.results.max;(null==t.distance||B.dist>t.distance)&&I(t,B)}if(2===e.options.store)for(const n of H){const t=new q(R);I(t,n),e.results.all.push(t)}}acquireTechniques(e){const t=8===e.output;return 0!==this._nodes.length&&(j(e.output)||R(e.output)&&3===e.bind.slot||t)?(this._nodes.forAll(t=>this._initNode(e,t)),this._configuration.drawScreenSize=this._passParameters.drawScreenSpace,this._configuration.useFixedSizes=this._passParameters.useFixedSizes,this._configuration.hasSlicePlane=this._slicePlaneEnabled,this._configuration.hasOccludees=e.bind.hasOccludees,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasHighlightMixTexture=t&&null!=e.bind.highlightMixTexture,this._configuration.output=e.output,this._context.techniques.get(B,this._configuration)):null}render(e,t){const{rctx:s,bind:i,output:r}=e,n=s.bindTechnique(t,i,this._passParameters),o=8===r,a=i.highlight?.name??null;o&&!a||this._nodes.forAll(t=>{0===t.coordinates.length||null==t.vao||o&&!t.highlightMap.has(a)||(n.assertCompatibleVertexAttributeLocations(t.vao),n.bindDraw(i,this._passParameters,t),s.bindVAO(t.vao),o?this._renderHighlightFragments(e,t):s.drawArrays(I.POINTS,0,t.coordinates.length/3))})}_renderHighlightFragments(e,t){const{highlightMap:s}=t,{rctx:i,bind:r}=e,{highlight:n}=r;if(!n)return;const o=n.name,a=s.get(o);if(!a||0===a.length)return;const{highlightOrderMap:h,highlightLevel:l}=r;if(null==l)return;for(const g of s.keys())if(g!==o){const e=h.get(g);if(void 0!==e&&e>l)return}let c=0,d=a[0].componentIndex,u=d+1;const p=()=>{for(;c<a.length&&a[c].id.highlightName!==o;)d=a[c].componentIndex,++c;u=d+1};p();const m=(e,t)=>{const s=t-e;s>0&&i.drawArrays(I.POINTS,e,s)};for(;c<a.length;){const e=a[c];if(e.id.highlightName!==o){m(d,u),++c,p();continue}const t=e.componentIndex;t!==u&&(m(d,u),d=t),u=t+1,++c}m(d,u)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!x(this._passParameters.clipBox,P,(e,t)=>e===t)}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let s=null;return this._nodes.filterInPlace(i=>i.id!==e||(s=i,i.vao=t(i.vao),this._highlights.nodeRemoved(i),!1)),this._requestRender(),s}forEachNode(e){this._nodes.forEach(e)}removeAll(){this._nodes.forAll(e=>e.vao=t(e.vao)),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e,t){return this._highlights.add(e,t)}_addHighlight(e,t,s){e.addHighlight(t,s),this._requestRender()}_removeHighlight(e,t){e.removeHighlight(t),this._requestRender()}_initNode(e,t){t.vao??=new F(e.rctx,new Map([["positions",new N(e.rctx,H,t.coordinates)],["colors",new N(e.rctx,M,t.rgb)]]))}_requestRender(){this._context&&this._context.requestRender()}};function T(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=E(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function C(e,t,s,i,r){return s.drawScreenSpace?0:T(e,t,s,i,r)}function D(e,t,s=d()){return s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}e([i({constructOnly:!0})],V.prototype,"createGraphic",void 0),V=e([r("esri.views.3d.layers.i3s.PointCloudRenderer")],V);class U{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}function W(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{V as PointCloudRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{u as e,h as t,n as s,g as i,j as o,d as r,
|
|
5
|
+
import{u as e,h as t,n as s,g as i,j as o,d as r,F as a}from"../../../../chunks/vec32.js";import{create as n,freeze as l,ZEROS as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{distance as d}from"../../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as h}from"../../../../geometry/support/frustum.js";import{fromValues as m}from"../../../../geometry/support/ray.js";import{FeatureTileVisibility3D as p,minTileLOD as u}from"./FeatureTileVisibility3D.js";import _ from"../../webgl/RenderCamera.js";class f{constructor(e,t,s){this._renderCoordsHelper=e,this._tilingScheme=t,this._camera=new _,this._surfaceElevation=0,this._focusOnMap=[0,0],this._visibility=new p(e,s)}set opaqueGround(e){this._visibility.opaqueGround=e}setup(e,t,s){this._camera.copyFrom(e),this._surfaceElevation=s,this._focusOnMap[0]=t.x,this._focusOnMap[1]=t.y,this._visibility.setup(this._camera)}done(){this._visibility.done()}update(e){const{measures:t,extent:s,level:i}=e;s&&(t.visible=this._visibility.compute(e),t.distance=d(s,this._focusOnMap),t.mergeable=!0,t.lodLevel=u,t.splitPriority=Math.max(0,u-i),t.visible&&(this._isGlobal?this._updateSplitAndLodGlobal(e):this._updateSplitAndLodLocal(e)))}_updateSplitAndLodGlobal(r){const a=r.level,n=this._renderCoordsHelper,{eye:l,fov:c}=this._camera,d=n.referenceEllipsoid.radius,h=e(l)-d;if(2*Math.atan(d/h)<c&&h>0)return void(r.measures.lodLevel=Math.max(a,u));const m=v,{extent:p}=r;if(!p)return;const{_surfaceElevation:_}=this;t(m[0],p[0],p[1],_),t(m[1],p[2],p[1],_),t(m[2],p[2],p[3],_),t(m[3],p[0],p[3],_);const f=t(M,.5*(p[0]+p[2]),.5*(p[1]+p[3]),_),y=this._tilingScheme.spatialReference;for(let e=0;e<4;++e)n.toRenderCoords(m[e],y,m[e]);n.toRenderCoords(f,y,f);const x=s(b.direction,f),L=i(l,x),S=o(g,x,L);this._updateSplitAndLod(r,m,f,S)}_updateSplitAndLodLocal(e){const s=v,{extent:i}=e;if(!i)return;const{_surfaceElevation:o}=this;t(s[0],i[0],i[1],o),t(s[1],i[2],i[1],o),t(s[2],i[2],i[3],o),t(s[3],i[0],i[3],o);const a=this._tilingScheme.spatialReference;for(let t=0;t<4;++t)this._renderCoordsHelper.toRenderCoords(s[t],a,s[t]);const n=t(M,.5*(s[0][0]+s[2][0]),.5*(s[0][1]+s[2][1]),.25*(s[0][2]+s[1][2]+s[2][2]+s[3][2])),l=t(y,n[0],n[1],0),{eye:c,far:d}=this._camera,h=t(g,l[0],l[1],c[2]);t(b.origin,l[0],l[1],c[2]-2*d),r(b.direction,x),this._updateSplitAndLod(e,s,n,h)}_updateSplitAndLod(e,t,s,o){const r=Math.max(a(t[0],t[2]),a(t[1],t[3]),a(t[0],s)+a(s,t[2]),a(t[1],s)+a(s,t[3])),{eye:n,near:l,fov:c,viewForward:d,width:m,height:p,pixelRatio:u,frustum:_}=this._camera,f=i(n,d),v=i(s,d)-f,M=a(s,n);let y=v,g=v,x=M,b=M;const C=(e,t)=>t<l?1:Math.sqrt(e*e-t*t)/t;let R=C(M,v);for(const h of t){const e=i(h,d)-f;y=Math.min(y,e),g=Math.max(g,e);const t=a(h,n);b=Math.max(b,t),x=Math.min(x,t);const s=C(t,e);R=Math.min(R,s)}if(g<l)return void(e.measures.lodLevel=0);const w=Math.cos(.5*c),A=a(n,o);R>w&&A>S*r&&(g=j*b,y=j*x);const G=.5*Math.sqrt(m*m+p*p)/u,E=2*Math.tan(.5*c),q=e=>Math.max(l,e)*L/G*E,F=e.level,H=r*2**F*Math.max(1,E),O=q(y),P=Math.ceil(Math.log2(Math.max(1,H/O)));if(e.measures.lodLevel=Math.max(P,e.measures.lodLevel),e.measures.splitPriority+=e.measures.lodLevel-F,F<P){const s=+h(_,t[0])+ +h(_,t[1])+ +h(_,t[2])+ +h(_,t[3]);e.measures.splitPriority+=s}const k=q(g)/O;k>2.5&&(e.measures.splitPriority+=k)}get _isGlobal(){return 1===this._renderCoordsHelper.viewingMode}}const v=[n(),n(),n(),n()],M=n(),y=n(),g=n(),x=l(0,0,1),b=m(c,x),L=312,S=.5,j=2;export{f as FeatureTileMeasurements3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{n as t,d as r,h as n,
|
|
5
|
+
import{n as t,d as r,h as n,F as e,a as s,g as o,c as i,f as u,i as c,j as f,u as a}from"../../../../chunks/vec32.js";import{create as h,fromValues as l,freeze as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as p}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as _}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as g}from"../../../../geometry/projection/projectVec3Array.js";import{fromValues as b,signedDistance as S}from"../../../../geometry/support/plane.js";import{Frustum as F}from"../../state/Frustum.js";class M{constructor(t,r){this._renderCoordsHelper=t,this.opaqueGround=r,this._cache=new Map,this._cameraForward=h(),this._cameraEye=h(),this._cameraFovY=55*Math.PI/180,this._frustumBoundingSphereCenter=h(),this._frustumBoundingSphereRadius=0,this._frustum=new F(t),this._renderSR=t.spatialReference;const n=p(this._renderSR);this._renderSREllipsoidRadius=d(n).radius}setup(n){this._aboveGround=n.aboveGround,this._frustum.update(n),t(this._cameraForward,n.viewForward),r(this._cameraEye,n.eye),this._cameraFovY=n.fovY,this._updateFrustumBoundingSphere()}done(){this._cache.clear()}compute(t){if(this._cache.has(t.id))return this._cache.get(t.id);const r=this._isVisibleInFrustum(t);return this._cache.set(t.id,r),r}_isVisibleInFrustum(t){return 2===this._renderCoordsHelper.viewingMode?this._isTileVisibleInFrustumLocal(t):this._isTileVisibleInFrustumGlobal(t)}_updateFrustumBoundingSphere(){const t=this._frustum.boundingSphere;r(this._frustumBoundingSphereCenter,t.center),this._frustumBoundingSphereRadius=t.radius+Bt}_isTileVisibleInFrustumLocal(t){const r=t.spatialReference,u=t.extent,c=this._renderSR;if(!u)return!0;if(C[0]=u[0],C[1]=u[1],C[2]=0,C[3]=u[2],C[4]=u[3],C[5]=0,!_(C,r,0,C,c,0))return!1;n(E[0],C[0],C[1],0),n(E[1],C[3],C[1],0),n(E[2],C[3],C[4],0),n(E[3],C[0],C[4],0),n(k,.5*(C[0]+C[3]),.5*(C[1]+C[4]),.5*(C[2]+C[5]));const f=St,a=.5*e(E[0],E[2]),h=this._frustum,l=this._frustumBoundingSphereRadius,m=this._frustumBoundingSphereCenter,d=W;s(d,m,k);const p=o(f,d),g=A;i(g,k,f,p);if(e(g,m)>a+l)return!1;const b=this._cameraForward,S=o(b,St),F=this._cameraFovY,M=this._cameraEye;if(Math.abs(S)<Math.abs(Math.cos(.5*F))){let t=!0;const r=n(Ft,b[0],b[1],0),e=o(M,r);for(let n=0;n<4;++n){const s=E[n];if(o(s,r)-e>0){t=!1;break}}if(t)return!1}{const t=E[0],r=E[2];if(t[0]<=M[0]&&M[0]<=r[0]&&t[1]<=M[1]&&M[1]<=r[1])return!0}const R=x,v=this.opaqueGround&&this._aboveGround,j=this.opaqueGround&&!this._aboveGround,G=Math.min(j?pt:1/0,p+l),B=Math.max(v?-pt:-1/0,p-l);for(let n=0;n<4;++n)i(R[n],E[n],f,G),i(R[n+4],E[n],f,B);if(y(h.planes,R,8))return!1;if(q(h.planes,R,8))return!0;for(let n=0;n<4;++n){const t=R[n],r=R[n+4];if(Mt(h.planes,t,r))return!0;const e=R[(n+1)%4];if(Mt(h.planes,t,e))return!0;const s=R[4+(n+1)%4];if(Mt(h.planes,r,s))return!0}if(jt[0][3]=+E[0][0],jt[1][3]=-E[2][0],jt[2][3]=+E[0][1],jt[3][3]=-E[2][1],jt[4][3]=+B,jt[5][3]=-G,q(jt,h.points))return!0;if(q(jt,h.points))return!0;for(let n=0;n<4;++n){const t=M,r=h.points[n+4];if(Rt(jt,t,r))return!0;const e=h.points[4+(n+1)%4];if(Rt(jt,r,e))return!0}return!1}_isTileVisibleInFrustumGlobal(r){if(r.level<w)return!0;const l=r.spatialReference,m=r.extent;if(!m||!l)return!0;const d=this.opaqueGround&&this._aboveGround,p=this.opaqueGround&&!this._aboveGround,_=E,b=.5*(m[0]+m[2]);if(n(_[0],m[0],m[1],0),n(_[1],m[2],m[1],0),n(_[2],m[2],m[3],0),n(_[3],m[0],m[3],0),n(_[4],b,m[1],0),n(_[5],b,m[3],0),!g(_,l,0,_,this._renderSR,0,6))return!1;const F=_[0][2]>0,M=_[3][2]<0,G=F||M,B=this._renderSREllipsoidRadius;if(G){const t=T;R(t,Gt,_[0]);const r=Y;if(R(r,Gt,_[1]),F){const n=P,e=_[4],s=H;R(s,e,Gt),R(n,s,e);const o=_[0];u(o,t,n),j(o,B);const i=_[1];u(i,r,n),j(i,B)}else if(M){const n=P,e=_[5],s=H;R(s,e,Gt),R(n,e,s);const o=_[3];u(o,n,t),j(o,B);const i=_[2];u(i,n,r),j(i,B)}}const q=k,I=s(N,_[3],_[0]);t(I,I);const x=c(O,_[0],_[3]);f(x,x,.5);const C=-o(x,I),A=c(Q,_[0],_[1]);f(A,A,.5);const W=c(X,_[2],_[3]);f(W,W,.5);const et=s(Z,W,A);t(et,et);const ht=-(C+o(I,A))/o(I,et);i(q,A,et,ht),j(q,B);const lt=this._frustumBoundingSphereRadius,mt=this._frustumBoundingSphereCenter,St=this._frustum,Ft=St.planes,Mt=L;t(Mt,q);const Rt=o(_[0],Mt)/a(_[0]),vt=St.origin,jt=St.points;let Bt=!1;if(d){{Bt=!0;const r=t(_t,vt);for(let n=0;n<4;++n){const e=jt[4+n],i=s(h(),e,vt);t(i,i);const c=u(h(),r,i);t(c,c);const f=u(h(),i,c);t(f,f);if(o(vt,f)>B){Bt=!1;break}}}if(Bt){if(o(vt,Mt)<B*Rt-pt)return!1}const r=t(_t,St.origin);if(o(r,Mt)<0)return!1;{const r=t(gt,St.direction);if(o(r,Mt)>bt)return!1}}const yt=Math.sqrt(1-Rt*Rt);if(yt>.9)return!0;let qt=!1;const wt=o(Mt,mt),It=a(mt);if(It<=lt&&!Ft.some(t=>S(t,z)>0)){if(!d)return!0;qt=!0}const Vt=wt/It;if(!qt&&wt<=0){if(-wt>lt)return!1}const xt=lt/It;if(Math.sqrt(1-Vt*Vt)*Math.sqrt(1-xt*xt)-xt*Vt>yt)return!1;if(!Bt){if(_.some(t=>St.intersectsPoint(t)))return!0;if(St.intersectsPoint(q))return!0}const Ct=D;s(Ct,mt,z);const Et=o(Ct,Mt),kt=U;f(kt,Mt,Et);const Pt=e(kt,mt),Tt=l.isWGS84,Yt=r.lij,Ht=Tt&&Yt[2]===2**Yt[0]-1,Lt=Tt&&0===Yt[2],Ut=Lt?ct:Ht?it:st,At=Lt?ft:Ht?ut:ot;if(!qt){const t=_,r=at,n=$,e=tt,s=z;for(const o of Ut){const i=t[o];if(v(n,t[(o+1)%4],i),v(e,s,i),R(r,e,n),V(r,jt,1))return!1}}let Wt=null;if(!d&&Et<1.01*lt){const t=2.5*lt;if(Pt>Rt*t+lt)return!1;const r=K,e=t/Rt;for(let n=0;n<4;++n)f(r[n],_[n],e/B);n(r[4],0,0,0),Wt=r}else{const t=(p?B+pt:Et+lt)/Rt,r=d?B-pt:(Et-lt)/Rt,n=J;for(let e=0;e<4;++e){const s=_[e];f(n[e],s,r/B),f(n[e+4],s,t/B)}Wt=n}if(y(Ft,Wt,Wt.length))return!1;const zt=St.lines,Dt=rt,Jt=nt;for(const n of zt){t(Jt,n.direction);for(const r of At){const n=Wt[r];if(t(Dt,n),dt(Jt,Dt,Wt,jt))return!1;const e=(r+1)%4;if(d){const r=Wt[e];if(s(Dt,r,n),t(Dt,Dt),dt(Jt,Dt,Wt,jt))return!1}if(p){const n=Wt[4+r],o=Wt[4+e];if(s(Dt,o,n),t(Dt,Dt),dt(Jt,Dt,Wt,jt))return!1}}}return!0}}function R(r,n,e){return u(r,n,e),t(r,r),r}function v(r,n,e){return s(r,n,e),t(r,r),r}function j(t,r){return f(t,t,r/a(t)),t}const G=[0,1,2,3,5];function B(t,r,n){for(let e=0;e<n;++e)if(S(t,r[e])<=0)return!1;return!0}function y(t,r,n){for(const e of G)if(B(t[e],r,n))return!0;return!1}function q(t,r,n=r.length){for(let e=0;e<n;++e){const n=r[e];let s=!0;for(const r of t){if(S(r,n)>0){s=!1;break}}if(s)return!0}return!1}const w=2,I=4;function V(t,r,n){for(const e of r)if(o(e,t)<n)return!1;return!0}const x=[h(),h(),h(),h(),h(),h(),h(),h()],C=[0,0,0,0,0,0],E=[h(),h(),h(),h(),h(),h()],k=h(),P=h(),T=h(),Y=h(),H=h(),L=h(),U=h(),A=h(),W=h(),z=m(0,0,0),D=h(),J=[h(),h(),h(),h(),h(),h(),h(),h()],K=[h(),h(),h(),h(),h()],N=h(),O=h(),Q=h(),X=h(),Z=h(),$=h(),tt=h(),rt=h(),nt=h(),et=h(),st=[0,1,2,3],ot=[0,1,2,3],it=[0,1,3],ut=[0,1,3],ct=[1,2,3],ft=[1,2,3],at=h();function ht(t,r,n){let e=1/0,s=-1/0;for(const i of n){const t=o(r,i);e=Math.min(e,t),s=Math.max(s,t)}t[0]=e,t[1]=s}function lt(t,r,n,e){let s=1/0,i=-1/0;for(const u of e){const e=o(n,u);if(s=Math.min(s,e),i=Math.max(i,e),s<=r&&i>=t)return!1}return!0}const mt=[0,0];function dt(t,r,n,e){const s=n.length,o=e.length;if(0===s||0===o)return!0;const i=et;R(i,t,r);const u=o<s,c=u?n:e,f=mt;return ht(f,i,u?e:n),lt(f[0],f[1],i,c)}const pt=430,_t=h(),gt=h(),bt=Math.cos(.25*Math.PI),St=l(0,0,1),Ft=h();function Mt(t,r,n){const e={t0:0,t1:1};for(const s of G){if(!vt(t[s],r,n,e))return!1}return e.t0<e.t1}function Rt(t,r,n){const e={t0:0,t1:1};for(const s of t){if(!vt(s,r,n,e))return!1}return e.t0<e.t1}function vt(t,r,n,e){let{t0:s,t1:o}=e;const i=S(t,r),u=S(t,n);if(i>=0&&u>=0)return!1;if(i<0&&u>=0){const t=-i/(u-i);if(t<s)return!1;t<o&&(o=t)}else if(i>=0&&u<0){const t=i/(i-u);if(t>o)return!1;t>s&&(s=t)}return e.t0=s,e.t1=o,!0}const jt=[b(-1,0,0,1),b(1,0,0,-1),b(0,-1,0,1),b(0,1,0,-1),b(0,0,-1,1),b(0,0,1,-1)],Gt=m(0,0,1),Bt=1;export{M as FeatureTileVisibility3D,q as isAnyVertexInPolyhedron,y as isConvexHullOutsideOfFrustum,I as maxLODLevelDelta,w as minTileLOD};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{d as t,n as i,a as e,g as s,c as r,
|
|
5
|
+
import{d as t,n as i,a as e,g as s,c as r,C as n}from"../../../chunks/vec32.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h,createPoints as u,fromMatrix as p,computePlanes as d,intersectsSphere as a,intersectsRay as c,intersectsLineSegment as g,intersectsPoint as _,planePointIndices as l}from"../../../geometry/support/frustum.js";import{Sphere as m}from"../../../geometry/support/sphere.js";class f{get planes(){return this.frustum}get points(){return this._points}get mutablePoints(){return this._points}get direction(){return this._direction}get origin(){return this._origin}get boundingSphere(){return this._boundingSphereDirty&&this._updateBoundingSphere(),this._boundingSphere}constructor(t){this.renderCoordsHelper=t,this.frustum=h(),this._points=u(),this.lines=new Array(12),this._origin=o(),this._direction=o(),this._boundingSphere=new m,this._altitude=null,this._boundingSphereDirty=!0;for(let i=0;i<12;i++)this.lines[i]={origin:null,direction:o(),endpoint:null}}update(i){p(i.viewMatrix,i.projectionMatrix,this.frustum,this._points),t(this._origin,i.eye),t(this._direction,i.viewForward),this._altitude=this.renderCoordsHelper.getAltitude(this._origin),this._updateLines(),this._boundingSphereDirty=!0}updatePoints(i){for(let e=0;e<this._points.length;e++)t(this._points[e],i[e]);d(this.frustum,this._points),this._updateLines()}get altitude(){return this._altitude}intersectsSphere(t){return a(this.frustum,t)}intersectsRay(t){return c(this.frustum,t)}intersectsLineSegment(t,i){return g(this.frustum,t,i)}intersectsPoint(t){return _(this.frustum,t)}_updateLines(){const t=this._points;for(let i=0;i<4;i++){const e=i+4;S(this.lines[i],t[i],t[e]),S(this.lines[i+4],t[i],3===i?t[0]:t[i+1]),S(this.lines[i+8],t[e],3===i?t[4]:t[e+1])}}_updateBoundingSphere(){const{origin:t}=this,n=y;i(n,this.direction);const o=b;e(o,this.points[4],t);const h=.5*s(o,o)/s(n,o),u=this._boundingSphere,p=r(j,t,n,h);u.center=p,u.radius=h}static{this.planePointIndices=l}static{this.nearFarLineIndices=[[0,4],[1,5],[2,6],[3,7]]}}function S(t,i,e){t.origin=i,t.endpoint=e,n(t.direction,i,e)}const b=o(),y=o(),j=o();export{f as Frustum};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import i from"../../../../Camera.js";import{deg2rad as e,rad2deg as r,clamp as s}from"../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{property as a,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{i as h,j as l,d as m,
|
|
5
|
+
import{__decorate as t}from"tslib";import i from"../../../../Camera.js";import{deg2rad as e,rad2deg as r,clamp as s}from"../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{property as a,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{i as h,j as l,d as m,B as v}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{pixelDistanceToInteractionFactor as _,applyAll as u}from"../../camera/constraintUtils.js";import{ConstraintOptions as p}from"../../camera/constraintUtils/ConstraintOptions.js";import{InteractiveController as d}from"./InteractiveController.js";import{pivotSearchAreaSize as f}from"../utils/navigationUtils.js";import w from"../../../ui/Component.js";import{FovOverlay as y}from"../../../../widgets/FovOverlay.js";let g=class extends d{constructor(t){super(t),this.onStop=null,this._timeOutId=void 0,this._onReset=()=>{this._startSize=this._lastDrag=null,this._setFov(S),this.updateTimeout()},this._center=c(),this._viewForward=c(),this._constraints=new p(15,1)}begin(t){j(t)?this._showOverlay().fov=t.fov:(this._lastDrag=t[1],this._startSize=null,this._ensureStartSize(this.view.state.camera))}updateTimeout(){clearTimeout(this._timeOutId),this._timeOutId=setTimeout(this.onStop,1500)}update(t){if(null==this._lastDrag)return this._lastDrag=t[1],this._startSize=null,void this._ensureStartSize(this.view.state.camera);const i=-(this._lastDrag-t[1])/2;this._lastDrag=t[1],this.step(i)}step(t){if(!this.running)return void(this._startSize=this._lastDrag=null);const i=this.view.state,o=this.currentCamera.copyFrom(i.camera),a=r(o.fov)+t,n=e(s(a,C,F));n!==o.fov?this._setFov(n):this._showOverlay().fov=o.fov}finish(){this.running&&(this._startSize=this._lastDrag=null,this.finishController())}destroy(){this.hideOverlay()}onControllerEnd(t){super.onControllerEnd(t),this._startSize=this._lastDrag=null,this.hideOverlay()}_showOverlay(){return this._overlay||(this._overlay=new w({id:"esri.FovOverlay",node:new y({onReset:this._onReset})}),this.view.ui.add(this._overlay)),this._overlay.widget}hideOverlay(){this._overlay&&(this.view.ui.remove(this._overlay),this._overlay=o(this._overlay))}_setFov(t){const i=this.view.state,e=this.currentCamera.copyFrom(i.camera),r=this._ensureStartSize(e)/Math.tan(t/2),s=h(O,this._center,l(O,this._viewForward,-r));e.eye=s,e.fov=t,this._constraints.interactionStartCamera=i.camera,this._constraints.interactionFactor=_(this.currentCamera.height-i.camera.height),u(this.view,this.currentCamera,this._constraints),this.begin(e),this.commitCamera()}_ensureStartSize(t){if(null==this._startSize){m(this._viewForward,t.viewForward);const i=this.view.stage.renderView.getMinimalDepthForArea(null,t.fullWidth/t.pixelRatio*.5,t.fullHeight/t.pixelRatio*.5,t,f),e=v(t.eye,this.view.pointsOfInterest.centerOnContent.renderLocation),r=i??e;h(this._center,t.eye,l(O,this._viewForward,r)),this._startSize=r*Math.tan(t.fov/2)}return this._startSize}};t([a()],g.prototype,"onStop",void 0),g=t([n("esri.views.3d.state.controllers.FovController")],g);const S=e((new i).fov),C=10,F=150,O=c();function j(t){return!Array.isArray(t)}export{g as FovController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{translate as s,rotate as c,identity as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{e as h,p,i as d,j as u,d as f,q as _,b as v,h as g,n as C,f as y,D as w,E as b,g as S}from"../../../../chunks/vec32.js";import{create as O}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as M}from"../../../../geometry/support/ray.js";import{Sphere as j}from"../../../../geometry/support/sphere.js";import{angle as z}from"../../../../geometry/support/vector.js";import{sv3d as T}from"../../../../geometry/support/vectorStacks.js";import{applyAll as A}from"../../camera/constraintUtils.js";import{ConstraintOptions as D}from"../../camera/constraintUtils/ConstraintOptions.js";import{TiltRange as R}from"../Constraints.js";import{InteractiveController as E}from"./InteractiveController.js";import{panMotionToRotationMatrix as H,onSurfaceTiltToEyeTiltGlobal as U,offSurfaceTiltToEyeTiltGlobal as k}from"../utils/navigationUtils.js";import{viewAngle as F}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as G}from"../../support/cameraUtils.js";import{createDirectionUp as P}from"../../support/cameraUtilsInternal.js";import B from"../../webgl/RenderCamera.js";import{extractTransformation as I,isZeroTransformation as V,extractTransformationKeyboard as q}from"../../../navigation/gamepadAndKeyboardUtils.js";let L=class extends E{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new B,this._headingStart=0,this._constraintOptions=new D(15,0,0,new B,null,1)}handleEventGamepad(t){const e=I(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||V(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,q(this._keysButtonState,this._transformation)}directionActive(t){return 1===this._keysButtonState[t]}countActiveDirections(){return this._keysButtonState.reduce((t,e)=>e>0?t+1:t,0)}deactivateDirection(t){this._keysButtonState[t]=0;const e=q(this._keysButtonState,this._transformation);V(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,Y),this._applyDisabledMovementTypes(Y),this._applyPan(Y.pan),this._applyRotate(Y.rotate),this._applyZoom(Y.zoom),this._applyAscend(Y.ascend),this._constraintOptions.interactionType=0,this._constraintOptions.selection=8,A(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;h($,e.center,e.eye),p($,$,t.matrix),e.center=d($,$,e.eye),e.up=p($,e.up,t.matrix),this._constraintOptions.interactionType=3,this._constraintOptions.selection=7,A(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=p($,e.eye,t.matrix),e.center=p($,e.center,t.matrix);this.view.state.isGlobal&&(e.up=p($,e.up,t.matrix)),this._constraintOptions.interactionType=4,this._constraintOptions.selection=15,A(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d($,this.currentCamera.eye,u(T.get(),e,t)),f(tt,e),_(tt,tt),this._constraintOptions.interactionDirection=tt,this._constraintOptions.interactionType=1,this._constraintOptions.selection=7,A(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,T.get());this._constraintOptions.interactionDirection=f(tt,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u($,this.currentCamera.eye,i),this.currentCamera.center=u($,this.currentCamera.center,i)}else{const i=u(T.get(),e,t);this.currentCamera.eye=d($,this.currentCamera.eye,i),this.currentCamera.center=d($,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=5,this._constraintOptions.selection=8,A(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=7,A(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){at(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,$)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:n}=a,l=this._transformation,m=this.view.navigation.gamepad,h=g(T.get(),n[0],n[1],0);C(h,h);const p=l.translation[0]*t.pan;if(0!==p){const t=u(T.get(),o,p);s(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(m.mode){case"pan":{const e=-l.translation[1]*t.pan;if(0!==e){const t=u(T.get(),h,e);s(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=l.zoom*t.zoom;break}case"zoom":r.zoom=(-l.translation[1]+l.zoom)*t.zoom;break;default:e(m.mode)}const d=l.translation[2]*t.ascend;r.ascend=d;const f=-l.heading*t.rotate;0!==f&&(c(r.rotate.matrix,r.rotate.matrix,f,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,T.get())),r.rotate.enabled=!0);const _=l.tilt*t.rotate,v=F(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+_,R.min,R.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,n=this.view.navigation.gamepad,s=y(T.get(),r,a);C(s,s),_(s,s),H(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,n),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(Y.pan,this._tmpCamera);const l=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,m=o.translation[2]*t.ascend;i.ascend=m;const h=-o.heading*t.rotate;0!==h&&(c(i.rotate.matrix,i.rotate.matrix,h,this._tmpCamera.eye),i.rotate.enabled=!0);const p=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(p,e.ray,l);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=U(R.min,e.origin,a,r);let n=0,s=0;const c=T.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=F(this.view.renderCoordsHelper,c,e.origin);n=U(t,e.origin,a,r),s=U(R.max,e.origin,a,r)}else{it.radius=a+r.radius,it.closestPointOnSilhouette(e,c);const t=Math.PI+z(e.direction,c);n=k(t,e.origin,a,r),s=k(R.max,e.origin,a,r)}return i(n+t,o,s)-n}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=G(this.view,e,0,Z,et),o=i.intersectManifoldClosestSilhouette(M(e,r),t,T.get()),n=w(e,o),s=i.intersectManifoldClosestSilhouette(M(e,b(T.get(),e,a.center)),t,T.get()),c=w(e,s);return Math.min(n,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,n=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,T.get());if(o){const e=h(T.get(),t,n),i=v(e);u(e,e,1/i);const r=C(T.get(),t),o=a(S(r,e));return i*Math.sin(Math.min(X,o))}{const i=f(T.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(n,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:N}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,n=T.get(),s=this._getPointAbsoluteSurfaceElevation(r.eye,e,n),c=this._clampedDistanceToSurface(e,n),l=r.width/2,m=J*r.width,h=J*r.width,p=c*Math.tan(.5*r.fovX)/l,d=p/a,u=p/this._computeHeadingRotateRadius(n),f=s-e;return{pan:(o?d:p)*m*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(m*t/l)*f-f),zoom:2**(m*t/l)*c-c,rotate:i(u*h,Q,W)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&l(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&l(t.rotate.matrix))}static activatesFor(t,e){const i=I(e,t.navigation.gamepad,K);return!("end"===e.action||V(i))}};t([o({constructOnly:!0})],L.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],L.prototype,"disableMovements",void 0),L=t([n("esri.views.3d.state.controllers.GamepadKeyboardController")],L);const K={translation:[0,0,0],heading:0,tilt:0,zoom:0},Z=80,X=r(Z),J=.75,N=5,Q=r(30),W=r(80),Y={zoom:0,ascend:0,pan:{enabled:!1,matrix:m()},rotate:{enabled:!1,matrix:m()}},$=O(),tt=O(),et=P(),it=new j;function at(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,l(t.pan.matrix),t.rotate.enabled=!1,l(t.rotate.matrix)}export{L as GamepadKeyboardController};
|
|
5
|
+
import{__decorate as t}from"tslib";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{translate as s,rotate as c,identity as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{e as h,p,i as d,j as u,d as f,q as _,b as v,h as C,n as g,f as y,B as w,C as b,g as S}from"../../../../chunks/vec32.js";import{create as O}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as M}from"../../../../geometry/support/ray.js";import{Sphere as j}from"../../../../geometry/support/sphere.js";import{angle as z}from"../../../../geometry/support/vector.js";import{sv3d as T}from"../../../../geometry/support/vectorStacks.js";import{applyAll as A}from"../../camera/constraintUtils.js";import{ConstraintOptions as D}from"../../camera/constraintUtils/ConstraintOptions.js";import{TiltRange as R}from"../Constraints.js";import{InteractiveController as H}from"./InteractiveController.js";import{panMotionToRotationMatrix as E,onSurfaceTiltToEyeTiltGlobal as U,offSurfaceTiltToEyeTiltGlobal as k}from"../utils/navigationUtils.js";import{viewAngle as F}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as G}from"../../support/cameraUtils.js";import{createDirectionUp as P}from"../../support/cameraUtilsInternal.js";import B from"../../webgl/RenderCamera.js";import{extractTransformation as I,isZeroTransformation as V,extractTransformationKeyboard as q}from"../../../navigation/gamepadAndKeyboardUtils.js";let L=class extends H{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new B,this._headingStart=0,this._constraintOptions=new D(15,0,0,new B,null,1)}handleEventGamepad(t){const e=I(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||V(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,q(this._keysButtonState,this._transformation)}directionActive(t){return 1===this._keysButtonState[t]}countActiveDirections(){return this._keysButtonState.reduce((t,e)=>e>0?t+1:t,0)}deactivateDirection(t){this._keysButtonState[t]=0;const e=q(this._keysButtonState,this._transformation);V(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,Y),this._applyDisabledMovementTypes(Y),this._applyPan(Y.pan),this._applyRotate(Y.rotate),this._applyZoom(Y.zoom),this._applyAscend(Y.ascend),this._constraintOptions.interactionType=0,this._constraintOptions.selection=8,A(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;h($,e.center,e.eye),p($,$,t.matrix),e.center=d($,$,e.eye),e.up=p($,e.up,t.matrix),this._constraintOptions.interactionType=3,this._constraintOptions.selection=7,A(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=p($,e.eye,t.matrix),e.center=p($,e.center,t.matrix);this.view.state.isGlobal&&(e.up=p($,e.up,t.matrix)),this._constraintOptions.interactionType=4,this._constraintOptions.selection=15,A(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d($,this.currentCamera.eye,u(T.get(),e,t)),f(tt,e),_(tt,tt),this._constraintOptions.interactionDirection=tt,this._constraintOptions.interactionType=1,this._constraintOptions.selection=7,A(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,T.get());this._constraintOptions.interactionDirection=f(tt,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u($,this.currentCamera.eye,i),this.currentCamera.center=u($,this.currentCamera.center,i)}else{const i=u(T.get(),e,t);this.currentCamera.eye=d($,this.currentCamera.eye,i),this.currentCamera.center=d($,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=5,this._constraintOptions.selection=8,A(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=7,A(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){at(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,$)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:n}=a,l=this._transformation,m=this.view.navigation.gamepad,h=C(T.get(),n[0],n[1],0);g(h,h);const p=l.translation[0]*t.pan;if(0!==p){const t=u(T.get(),o,p);s(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(m.mode){case"pan":{const e=-l.translation[1]*t.pan;if(0!==e){const t=u(T.get(),h,e);s(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=l.zoom*t.zoom;break}case"zoom":r.zoom=(-l.translation[1]+l.zoom)*t.zoom;break;default:e(m.mode)}const d=l.translation[2]*t.ascend;r.ascend=d;const f=-l.heading*t.rotate;0!==f&&(c(r.rotate.matrix,r.rotate.matrix,f,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,T.get())),r.rotate.enabled=!0);const _=l.tilt*t.rotate,v=F(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+_,R.min,R.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,n=this.view.navigation.gamepad,s=y(T.get(),r,a);g(s,s),_(s,s),E(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,n),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(Y.pan,this._tmpCamera);const l=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,m=o.translation[2]*t.ascend;i.ascend=m;const h=-o.heading*t.rotate;0!==h&&(c(i.rotate.matrix,i.rotate.matrix,h,this._tmpCamera.eye),i.rotate.enabled=!0);const p=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(p,e.ray,l);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=U(R.min,e.origin,a,r);let n=0,s=0;const c=T.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=F(this.view.renderCoordsHelper,c,e.origin);n=U(t,e.origin,a,r),s=U(R.max,e.origin,a,r)}else{it.radius=a+r.radius,it.closestPointOnSilhouette(e,c);const t=Math.PI+z(e.direction,c);n=k(t,e.origin,a,r),s=k(R.max,e.origin,a,r)}return i(n+t,o,s)-n}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=G(this.view,e,0,Z,et),o=i.intersectManifoldClosestSilhouette(M(e,r),t,T.get()),n=w(e,o),s=i.intersectManifoldClosestSilhouette(M(e,b(T.get(),e,a.center)),t,T.get()),c=w(e,s);return Math.min(n,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,n=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,T.get());if(o){const e=h(T.get(),t,n),i=v(e);u(e,e,1/i);const r=g(T.get(),t),o=a(S(r,e));return i*Math.sin(Math.min(X,o))}{const i=f(T.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(n,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:N}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,n=T.get(),s=this._getPointAbsoluteSurfaceElevation(r.eye,e,n),c=this._clampedDistanceToSurface(e,n),l=r.width/2,m=J*r.width,h=J*r.width,p=c*Math.tan(.5*r.fovX)/l,d=p/a,u=p/this._computeHeadingRotateRadius(n),f=s-e;return{pan:(o?d:p)*m*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(m*t/l)*f-f),zoom:2**(m*t/l)*c-c,rotate:i(u*h,Q,W)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&l(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&l(t.rotate.matrix))}static activatesFor(t,e){const i=I(e,t.navigation.gamepad,K);return!("end"===e.action||V(i))}};t([o({constructOnly:!0})],L.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],L.prototype,"disableMovements",void 0),L=t([n("esri.views.3d.state.controllers.GamepadKeyboardController")],L);const K={translation:[0,0,0],heading:0,tilt:0,zoom:0},Z=80,X=r(Z),J=.75,N=5,Q=r(30),W=r(80),Y={zoom:0,ascend:0,pan:{enabled:!1,matrix:m()},rotate:{enabled:!1,matrix:m()}},$=O(),tt=O(),et=P(),it=new j;function at(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,l(t.pan.matrix),t.rotate.enabled=!1,l(t.rotate.matrix)}export{L as GamepadKeyboardController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as o,subclass as e}from"../../../../../core/accessorSupport/decorators.js";import{d as r,
|
|
5
|
+
import{__decorate as t}from"tslib";import{property as o,subclass as e}from"../../../../../core/accessorSupport/decorators.js";import{d as r,C as s}from"../../../../../chunks/vec32.js";import{create as i,clone as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MomentumController as m}from"./MomentumController.js";import{applyZoomToPoint as c}from"../../utils/navigationUtils.js";let a=class extends m{constructor(t){super(t),this.interactionType=1,this.constraintOptions.interactionDirection=i()}momentumStep(t,o){const{interactionDirection:e}=this.constraintOptions;if(!e)return;r(e,o.eye);const i=this.momentum.valueDelta(0,t);c(o,this.zoomCenter,i,this.view.state.constraints.minimumPoiDistance),s(e,o.eye,e)}set zoomCenter(t){this._set("zoomCenter",n(t))}};t([o({constructOnly:!0})],a.prototype,"momentum",void 0),t([o({constructOnly:!0})],a.prototype,"zoomCenter",null),a=t([e("esri.views.3d.state.controllers.momentum.ZoomPlanarMomentumController")],a);export{a as ZoomPlanarMomentumController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{neverReached as t}from"../../../core/compilerUtils.js";import{lerp as e}from"../../../core/mathUtils.js";import{invert as i}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as n,j as o,
|
|
5
|
+
import{neverReached as t}from"../../../core/compilerUtils.js";import{lerp as e}from"../../../core/mathUtils.js";import{invert as i}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as n,j as o,C as s,p as a,h as c,g as l}from"../../../chunks/vec32.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as d}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as _}from"../../../geometry/projection/projectBoundingRect.js";import{projectVectorToVector as m}from"../../../geometry/projection/projectVectorToVector.js";import{empty as g,create as x,expandWithVec3 as f}from"../../../geometry/support/aaBoundingBox.js";import{center as u,create as y}from"../../../geometry/support/aaBoundingRect.js";import{fromPoints as j,create as R}from"../../../geometry/support/lineSegment.js";import{create as b,fromVectorsAndPoint as S,copy as C,negate as B,signedDistance as H}from"../../../geometry/support/plane.js";import{wrap as w}from"../../../geometry/support/ray.js";import{frustumLineSegment as M}from"./intersectionUtils.js";const A=.5*Math.PI,G=A/Math.PI*180;class E{constructor(t){this._extent=new Array(4),this._planes=new Array(6),this._maxSpan=0,this._center={origin:p(),direction:p()},this._renderCoordsHelper=t.renderCoordsHelper;for(let e=0;e<4;e++)this._extent[e]={origin:p(),direction:p(),cap:{next:null,direction:p()}},this._planes[e]=b();this._planes[4]=b(),this._planes[5]=b(),this._planesWithoutFar=this._planes.slice(0,5)}update(t,e,i,r=!0){const a=this._extent;this._toRenderBoundingExtent(t,e,i),n(this._center.origin,a[0].origin,a[2].origin),o(this._center.origin,this._center.origin,.5),this._renderCoordsHelper.worldUpAtPosition(this._center.origin,this._center.direction),r||o(this._center.direction,this._center.direction,-1);for(let n=0;n<4;n++){const t=a[n];this._renderCoordsHelper.worldUpAtPosition(t.origin,t.direction);const e=a[3===n?0:n+1];t.cap.next=e.origin,s(t.cap.direction,t.origin,e.origin),S(t.direction,t.cap.direction,t.origin,this._planes[n]),r||o(t.direction,t.direction,-1)}S(a[0].cap.direction,a[1].cap.direction,a[0].origin,this._planes[4]),r?B(this._planes[4],this._planes[5]):(C(this._planes[5],this._planes[4]),B(this._planes[4],this._planes[4])),this._maxSpan=Math.max(Math.abs(t[0]-t[2]),Math.abs(t[1]-t[3])),this._maxSpanSpatialReference=e,this._minGlobalAltitude=.9*h(this._maxSpanSpatialReference).radius}isVisibleInFrustum(t,e,i=!1){if(null==t)return!1;if(1===this._renderCoordsHelper.viewingMode){const i=this._maxSpanSpatialReference.isGeographic?G:A*e;if(this._maxSpan>i)return!0;if(null!=t.altitude&&t.altitude>=this._minGlobalAltitude)return this._isVisibleInFrustumGlobal(t)}if(0===this._maxSpan){const e=this._extent[0];return!(i||!t.intersectsRay(w(e.origin,e.direction)))}for(let n=0;n<this._extent.length;n++){const e=this._extent[n];if(!i&&t.intersectsRay(w(e.origin,e.direction)))return!0;if(t.intersectsLineSegment(j(e.origin,e.cap.next,k),e.cap.direction))return!0}const r=i?this._planes:this._planesWithoutFar;for(let n=0;n<t.lines.length;n++){const e=t.lines[n];if(M(r,e.origin,e.endpoint,e.direction))return!0}return!1}_toRenderBoundingExtentGlobal(t,r,n){const o=5;u(t,v),v[2]=n,d(r,v,F,this._renderCoordsHelper.spatialReference),i(I,F),g(V);for(const{x0:i,x1:s,y0:c,y1:l}of U)for(let p=0;p<o;p++){const h=p/(o-1);v[0]=e(t[i],t[s],h),v[1]=e(t[c],t[l],h),v[2]=n,m(v,r,v,this._renderCoordsHelper.spatialReference),a(v,v,I),f(V,v)}c(this._extent[0].origin,V[0],V[1],V[2]),c(this._extent[1].origin,V[3],V[1],V[2]),c(this._extent[2].origin,V[3],V[4],V[2]),c(this._extent[3].origin,V[0],V[4],V[2]);for(let e=0;e<4;++e)a(this._extent[e].origin,this._extent[e].origin,F)}_toRenderBoundingExtentLocal(t,e,i){_(t,e,P,this._renderCoordsHelper.spatialReference),c(this._extent[0].origin,P[0],P[1],i),c(this._extent[1].origin,P[2],P[1],i),c(this._extent[2].origin,P[2],P[3],i),c(this._extent[3].origin,P[0],P[3],i)}_toRenderBoundingExtent(e,i,r){switch(this._renderCoordsHelper.viewingMode){case 1:this._toRenderBoundingExtentGlobal(e,i,r);break;case 2:this._toRenderBoundingExtentLocal(e,i,r);break;default:t(this._renderCoordsHelper.viewingMode)}}_isVisibleInFrustumGlobal(t){if(H(t.planes[4],this._center.origin)<0&&l(this._center.direction,t.direction)<0)return!0;for(let e=0;e<4;e++){const i=this._extent[e];if(H(t.planes[4],i.origin)<0&&l(i.direction,t.direction)<0)return!0}return!1}}const U=[{x0:0,y0:1,x1:2,y1:1},{x0:0,y0:3,x1:2,y1:3},{x0:0,y0:1,x1:0,y1:3},{x0:2,y0:1,x1:2,y1:3}],v=p(),F=r(),I=r(),V=x(),P=y(),k=R();export{E as FrustumExtentIntersection};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Camera.js";import t from"../../../core/Logger.js";import{deg2rad as n,rad2deg as r,asinClamped as i}from"../../../core/mathUtils.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{d as o,
|
|
5
|
+
import e from"../../../Camera.js";import t from"../../../core/Logger.js";import{deg2rad as n,rad2deg as r,asinClamped as i}from"../../../core/mathUtils.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{d as o,B as c,F as s,b as l}from"../../../chunks/vec32.js";import{create as u,clone as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import p from"../../../geometry/Point.js";import{projectAsync as d,project as h}from"../../../geometry/projectionUtils.js";import g from"../../../geometry/SpatialReference.js";import{projectPointToVectorAsync as y,projectPointToVector as v}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPointAsync as R,projectVectorToPoint as w}from"../../../geometry/projection/projectVectorToPoint.js";import{gcsCyclical as x,webMercatorCyclical as M}from"../../../geometry/support/normalizeUtils.js";import{toRenderCamera as j}from"../webgl.js";import{getGreatCircleSpanAt as T}from"./earthUtils.js";import{getElevationAtPoint as z}from"./ElevationProvider.js";import{viewModeDependentUtil as S,directionToHeadingTilt as C}from"./viewingModeUtils.js";import{isSpatialReferenceSupported as b}from"../../support/spatialReferenceSupport.js";const P=()=>t.getLogger("esri.views.3d.support.cameraUtils"),A=96*39.37,L=1,U=8,H=5,q=1,F=u();function I(e){return e.spatialReference??g.WGS84}function E(e,t,n,r,i){return S(e).headingTiltToDirectionUp(t,n,r,i)}function G(e,t){const{camera:n}=e.state,{unitInMeters:r}=e.renderCoordsHelper;t/=r;return n.width/2/n.pixelRatio/(A/t)/Math.tan(n.fovX/2)}function O(e,t){const{camera:n}=e.state,{unitInMeters:r}=e.renderCoordsHelper,i=t*Math.tan(n.fovX/2),a=n.width/2/n.pixelRatio;return A/(a/i)*r}function X(e,t,n,r){const i=r.levelAtScale(t),a=D(C(e,n.eye,n.viewForward,n.up).tilt),o=Math.max(i-a,0);return r.scaleAtLevel(o)}function k(e,t,n){const r=n.levelAtScale(e),i=D(t);return n.scaleAtLevel(r+i)}function D(e){return 2*((e>90?180-e:e)/90)**2}function V(e,t,n=0){const r=e.basemapTerrain?.tilingScheme;if(!r)return 0;const i=m(e.spatialReference).radius,a=2===e.state.viewingMode?t.eye[2]:l(t.eye)-i;return X(e,O(e,Math.abs(a-n)),t,r)}function W(e,t,n=0){const r=j(e,t);return r?V(e,r,n):0}const Y=1,B=100;function N(e,t,a,o){if(0===t)return 0;const s=e.state.contentCamera,u=c(s.eye,a),f=e.basemapTerrain?.tilingScheme;if(!f)return P().error("#scaleToTargetDistance()","Cannot compute distance from scale without a tiling scheme"),u;let p=u;const d=C(e,s.eye,s.viewForward,s.up),h=d.tilt>90;if(e.state.isLocal){const r=(G(e,k(t,d.tilt,f))-Math.abs(s.eye[2]-o[2]))/Math.cos(n(d.tilt));return p=h?p-r:p+r,p}let g=1/0,y=0,v=te(e,d.heading,d.tilt,a,u,1);if(!v)return p;const R=l(o);for(;g>Y&&y<B;){const o=l(v.eye),u=h?180-v.tilt:v.tilt,w=n(u),x=Math.sin(w)*o,M=Math.cos(w)*o,j=G(e,k(t,v.tilt,f)),T=h?R-j:R+j,z=i(x/T),S=Math.cos(z)*T-M,C=c(v.eye,a);p=h?C-S:C+S,v=te(e,d.heading,d.tilt,a,p,1);const b=Me(e,v,r(s.fov));if(!v||!b)return p;const P=W(e,b,R-m(e.spatialReference).radius);g=Math.abs(t-P),++y}return p}async function Z(e,t,n,r,i,a){return K(e,t,G(e,n),r,i,a)}function J(e,t,n,r,i,a){return Me(e,te(e,r.heading,r.tilt,t,n,i),r.fov,a)}async function K(e,t,n,r,i,o){const c=await ne(e,r.heading,r.tilt,t,n,i,o);return a(o),je(e,c,r.fov,o)}function Q(e,t){return!!(e.basemapTerrain&&e.renderCoordsHelper.fromRenderCoords(t,F,e.spatialReference)&&e.elevationProvider&&(z(e.elevationProvider,F)??0)>F[2]-q)}async function $(e,t,n){if(Q(e,t))return!0;const{elevationProvider:r,spatialReference:i,renderCoordsHelper:o}=e;if(null==r||!o.fromRenderCoords(t,F,i))return!1;const[c,s,l]=F,u=await r.queryElevation(c,s,l,i,"ground",n)??0;return a(n),u>l-q}async function _(e,t,n){const r=u();if(null==t)return o(r,e.state.camera.center);if(t instanceof p){const{renderSpatialReference:i,basemapTerrain:o,elevationProvider:c}=e,s=t.spatialReference;if(await y(t,r,i,{signal:n}),a(n),null==t.z&&null!=o&&null!=c){const i=await c.queryElevation(t.x,t.y,t.z??0,s,"ground",n);a(n),null!=i&&e.renderCoordsHelper.setAltitude(r,i)}return r}return o(r,t)}function ee(e,t){const n=u();if(null==t)return o(n,e.state.camera.center);if(t instanceof p){if(!v(t,n,e.renderSpatialReference))return null;const{basemapTerrain:r,elevationProvider:i}=e;if(null==t.z&&null!=r&&null!=i){const r=z(i,t);null!=r&&e.renderCoordsHelper.setAltitude(n,r)}return n}return o(n,t)}function te(e,t,n,r,i,a){return re(e,t,n,r instanceof p?r:null,ee(e,r),i,a)}async function ne(e,t,n,r,i,o,c){const s=r instanceof p?r:null,l=await _(e,r,c);return a(c),ie(e,t,n,s,l,i,o,c)}function re(e,t,n,r,i,a,o){if(null==i)return null;if(!r&&(r=new p({spatialReference:I(e)}),!w(i,e.renderSpatialReference,r)))return null;const c=ae(e,t,n,i,a,o);if(oe(e,n,o)&&Q(e,c.eye)){const{tilt:o,mode:c}=ce(e,n,i,a);return re(e,t,o,r,i,a,c)}return se(c,i)}async function ie(e,t,n,r,i,o,c,s){r||(r=new p({spatialReference:I(e)}),await R(i,e.renderSpatialReference,r,{signal:s})||(r=null)),a(s);const l=ae(e,t,n,i,o,c);if(oe(e,n,c)&&await $(e,l.eye,s)){a(s);const{tilt:c,mode:l}=ce(e,n,i,o);return ie(e,t,c,r,i,o,l,s)}return se(l,i)}function ae(e,t,n,r,i,a){const o=ge(e,t,n,r,i=Math.max(i,e.state.constraints.minimumPoiDistance),a);return(0,S(e).eyeForCenterWithHeadingTilt)(r,i,o.heading,o.tilt)}function oe(e,t,n){const r=e.map.ground.navigationConstraint;return 1===n&&e.state.isGlobal&&t>0&&(null==r||"stay-above"===r.type)}function ce(e,t,n,r){const i=we(e,n,r,Re(e,r,t,n));return{tilt:i,mode:t-i<1?0:1}}function se(e,t){return{...e,center:f(t)}}function le(e,t){const{state:n,spatialReference:r}=e,i=t.spatialReference;return n.isGlobal&&b(i,1)||n.isLocal&&r.equals(i)}function ue(e,t){let n,r,i;if(e.state.isGlobal){const e=new p(t.xmin,t.ymin,t.spatialReference),a=new p(t.xmax,t.ymax,t.spatialReference),o=t.spatialReference.isGeographic?x:M;n=new p({x:o.center(e.x,a.x),y:(a.y+e.y)/2,z:null!=t.zmax&&null!=t.zmin?(t.zmax+t.zmin)/2:void 0,spatialReference:t.spatialReference});const c=m(t.spatialReference),s=T(n,e,a);r=s.lon,i=s.lat,o.diff(e.x,a.x)>o.range/2&&(r+=c.halfCircumference),r=Math.min(r,c.halfCircumference),i=Math.min(i,c.halfCircumference)}else{const a=e.renderSpatialReference??t.spatialReference;a.equals(t.spatialReference)||(t=h(t,a)),r=t.xmax-t.xmin,i=t.ymax-t.ymin;const o=null!=t.zmax&&null!=t.zmin?(t.zmax+t.zmin)/2:void 0;n=new p({x:t.xmin+.5*r,y:t.ymin+.5*i,z:o,spatialReference:a})}const a=null!=t.zmax&&null!=t.zmin?t.zmax-t.zmin:0,o=e.state.camera,c=1/Math.tan(o.fovX/2),s=1/Math.tan(o.fovY/2),l=1/Math.tan(o.fov/2);return{center:n,distance:Math.max(.5*r*c,.5*i*s,.5*a*l)/L}}async function fe(e,t,n,r,i,o){const c=le(e,t)?t:await d(t,e.spatialReference,{signal:o});a(o);const{center:s,distance:l}=ue(e,c),u=await ne(e,n,r,s,l,i,o);return a(o),je(e,u,e.camera.fov,o)}function me(e,t,n,r,i,a){let o;try{o=le(e,t)?t:h(t,e.spatialReference)}catch(u){return null}const{center:c,distance:s}=ue(e,o),l=te(e,n,r,c,s,i);return null==l?null:Me(e,l,e.camera.fov,a)}function pe(e,t,n){const r=e.renderSpatialReference,i=new p({spatialReference:I(e)});if(!w(n,r,i))return null;const a=Math.tan(t.fovX/2),o=Math.tan(t.fovY/2),c=s(t.eye,n),l=2*c*a*L,u=2*c*o*L;return S(e).toExtent(e,i,l,u)}function de(e,t){return S(e).toArea(e,t)}function he(e,t,n){const r=e.pointsOfInterest.centerOnSurfaceFrequent.distance;if(Math.log(n/r)/Math.LN2>U)return!0;const i=t,a=e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation;return c(i,a)/(Math.tan(.5*e.state.camera.fov)*r)>H}function ge(e,t,n,r,i,a){let o=0;return 1===a&&he(e,r,i)?(t=0,o=ve(e,i,n,r)):o=xe(e,r,i,n),o=e.state.constraints.clampTilt(i,o),{heading:t,tilt:n=we(e,r,i,o)}}const ye=.7;function ve(e,t,n,r){const i=xe(e,r,t,n);if(!e.state.constraints.tilt)return i;const a=e.state.constraints.tilt(t);a.max=Math.min(a.max,.5*Math.PI);const o=a.min*(1-ye)+a.max*ye;return Math.min(i,o)}function Re(e,t,n,r){let i=xe(e,r,t,n);if(!e.state.constraints.tilt)return i;const a=e.state.constraints.tilt(t);return i=Math.min(i,.5*Math.PI),a.min*(1-ye)+i*ye}function we(e,t,n,r){return S(e).lookAtTiltToEyeTilt(r,t,n)}function xe(e,t,n,r){return S(e).eyeTiltToLookAtTilt(r,t,n)}function Me(t,n,r,i){if(null==n)return null;const a=t.renderSpatialReference,o=new p({spatialReference:I(t)});return w(n.eye,a,o)?(i??=new e,i.position=o,i.heading=n.heading,i.tilt=n.tilt,i.fov=r,i):null}async function je(t,n,r,i){const o=t.renderSpatialReference,c=new p({spatialReference:I(t)});return await R(n.eye,o,c,{signal:i}),a(i),new e(c,n.heading,n.tilt,r)}function Te(e,t){const n=e.basemapTerrain?.tilingScheme;if(n)return n.levelAtScale(t);P().error("#scaleToZoom()","Cannot compute zoom from scale without a tiling scheme")}function ze(e,t){const n=e.basemapTerrain?.tilingScheme;if(n)return n.scaleAtLevel(t);P().error("#zoomToScale()","Cannot compute scale from zoom without a tiling scheme")}export{X as applyTiltAdjustToScale,O as distanceToScale,K as fromCenterDistanceAsync,J as fromCenterDistanceSync,Z as fromCenterScale,fe as fromExtentAsync,me as fromExtentSync,ne as getObserverForPointAtDistanceAsync,te as getObserverForPointAtDistanceSync,I as getViewSR,E as headingTiltToDirectionUp,k as removeTiltAdjustFromScale,Y as scaleErrorThreshold,G as scaleToDistance,Te as scaleToZoom,de as toArea,pe as toExtent,N as viewScaleToCameraDistance,ze as zoomToScale};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{set as t,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as s}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as l}from"../../../../geometry/support/Indices.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{Geometry as p}from"../../webgl-engine/lib/Geometry.js";function f(t,e,r=null){const o=[],n=e.mapPositions,i=m(e,o),a=i.data,u=i.indices.length,s=l(u);return h(e,o,s),y(e,o,s),g(e,o,s),b(e,o,i.indices,s),w(e,o,i.indices,s),D(e,o),F(e,o,i.indices,s),d(e,o,a),new p(t,o,n,2,r)}function m(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=j(r)&&o,i=r.length/3-(n?1:0),a=new Array(2*(i-1)),u=n?r.slice(0,-3):r;let s=0;for(let c=0;c<i-1;c++)a[s++]=c,a[s++]=c+1;const l=new c(u,a,3,n);return e.push(["position",l]),l}function h(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push(["color",new c(n??o,r,4)])}function g(t,e,r){t.attributeData.normal&&e.push(["normal",new c(t.attributeData.normal,r,3)])}function b(t,e,r,o){const n=t.attributeData.colorFeature;null!=n&&("number"==typeof n?e.push(["colorFeatureAttribute",new c([n],o,1,!0)]):e.push(["colorFeatureAttribute",new c(n,r,1,!0)]))}function y(t,e,r){null==t.attributeData.sizeFeature&&e.push(["size",new c([t.attributeData.size??1],r,1,!0)])}function w(t,e,r,o){const n=t.attributeData.sizeFeature;null!=n&&("number"==typeof n?e.push(["sizeFeatureAttribute",new c([n],o,1,!0)]):e.push(["sizeFeatureAttribute",new c(n,r,1,!0)]))}function D(t,e){const{attributeData:{position:r,timeStamps:o}}=t;if(!o)return;const n=r.length/3,i=new Array(2*(n-1));let a=0;for(let u=0;u<n-1;u++)i[a++]=u,i[a++]=u+1;e.push(["timeStamps",new c(o,i,z,!0)])}function F(t,e,r,o){const n=t.attributeData.opacityFeature;null!=n&&("number"==typeof n?e.push(["opacityFeatureAttribute",new c([n],o,1,!0)]):e.push(["opacityFeatureAttribute",new c(n,r,1,!0)]))}function d(r,o,s){if(null==r.overlayInfo||1!==r.overlayInfo.renderCoordsHelper.viewingMode||!r.overlayInfo.spatialReference.isGeographic)return;const l=a(s.length),p=n(r.overlayInfo.spatialReference);for(let t=0;t<l.length;t+=3)i(s,t,l,t,p);const f=s.length/3,m=u(f+1);let h=A,g=v,b=0,y=0;t(h,l[y++],l[y++]),y++,m[0]=0;for(let n=1;n<f+1;++n)n===f&&(y=0),t(g,l[y++],l[y++]),y++,b+=e(h,g),m[n]=b,[h,g]=[g,h];o.push(["distanceToStart",new c(m,o[0][1].indices,1,!0)])}function j(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const A=r(),v=r(),z=4;function S(t,e,r,o,n){if(null==t||0===t.length)return[];const i=[];return t.forEach((t,u)=>{const s=t.length,l=a(3*s);t.forEach((t,e)=>{l[3*e]=t[0],l[3*e+1]=t[1],l[3*e+2]=t[2]});const c={attributeData:{position:l,normal:e,colorFeature:r?.[u],opacityFeature:o?.[u],sizeFeature:n?.[u]},removeDuplicateStartEnd:!1};i.push(c)}),i}function E(t,e,r,o,n,i){if(null==t||0===t.length)return[];const a=S(t,e,o,n,i);return t.forEach((t,e)=>{const o=r?.[e],n=null!=o?x(o.timeStamps,o.
|
|
5
|
+
import{set as t,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as s}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as l}from"../../../../geometry/support/Indices.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{Geometry as p}from"../../webgl-engine/lib/Geometry.js";function f(t,e,r=null){const o=[],n=e.mapPositions,i=m(e,o),a=i.data,u=i.indices.length,s=l(u);return h(e,o,s),y(e,o,s),g(e,o,s),b(e,o,i.indices,s),w(e,o,i.indices,s),D(e,o),F(e,o,i.indices,s),d(e,o,a),new p(t,o,n,2,r)}function m(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=j(r)&&o,i=r.length/3-(n?1:0),a=new Array(2*(i-1)),u=n?r.slice(0,-3):r;let s=0;for(let c=0;c<i-1;c++)a[s++]=c,a[s++]=c+1;const l=new c(u,a,3,n);return e.push(["position",l]),l}function h(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push(["color",new c(n??o,r,4)])}function g(t,e,r){t.attributeData.normal&&e.push(["normal",new c(t.attributeData.normal,r,3)])}function b(t,e,r,o){const n=t.attributeData.colorFeature;null!=n&&("number"==typeof n?e.push(["colorFeatureAttribute",new c([n],o,1,!0)]):e.push(["colorFeatureAttribute",new c(n,r,1,!0)]))}function y(t,e,r){null==t.attributeData.sizeFeature&&e.push(["size",new c([t.attributeData.size??1],r,1,!0)])}function w(t,e,r,o){const n=t.attributeData.sizeFeature;null!=n&&("number"==typeof n?e.push(["sizeFeatureAttribute",new c([n],o,1,!0)]):e.push(["sizeFeatureAttribute",new c(n,r,1,!0)]))}function D(t,e){const{attributeData:{position:r,timeStamps:o}}=t;if(!o)return;const n=r.length/3,i=new Array(2*(n-1));let a=0;for(let u=0;u<n-1;u++)i[a++]=u,i[a++]=u+1;e.push(["timeStamps",new c(o,i,z,!0)])}function F(t,e,r,o){const n=t.attributeData.opacityFeature;null!=n&&("number"==typeof n?e.push(["opacityFeatureAttribute",new c([n],o,1,!0)]):e.push(["opacityFeatureAttribute",new c(n,r,1,!0)]))}function d(r,o,s){if(null==r.overlayInfo||1!==r.overlayInfo.renderCoordsHelper.viewingMode||!r.overlayInfo.spatialReference.isGeographic)return;const l=a(s.length),p=n(r.overlayInfo.spatialReference);for(let t=0;t<l.length;t+=3)i(s,t,l,t,p);const f=s.length/3,m=u(f+1);let h=A,g=v,b=0,y=0;t(h,l[y++],l[y++]),y++,m[0]=0;for(let n=1;n<f+1;++n)n===f&&(y=0),t(g,l[y++],l[y++]),y++,b+=e(h,g),m[n]=b,[h,g]=[g,h];o.push(["distanceToStart",new c(m,o[0][1].indices,1,!0)])}function j(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const A=r(),v=r(),z=4;function S(t,e,r,o,n){if(null==t||0===t.length)return[];const i=[];return t.forEach((t,u)=>{const s=t.length,l=a(3*s);t.forEach((t,e)=>{l[3*e]=t[0],l[3*e+1]=t[1],l[3*e+2]=t[2]});const c={attributeData:{position:l,normal:e,colorFeature:r?.[u],opacityFeature:o?.[u],sizeFeature:n?.[u]},removeDuplicateStartEnd:!1};i.push(c)}),i}function E(t,e,r,o,n,i){if(null==t||0===t.length)return[];const a=S(t,e,o,n,i);return t.forEach((t,e)=>{const o=r?.[e],n=null!=o?x(o.timeStamps,o.stage):void 0;a[e].attributeData.timeStamps=n}),a}function I(t,e=0,r=.01){const o=s(t.length);o[0]=0;for(let i=1;i<t.length;i++){const e=t[i-1],r=t[i],n=Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2+(r[2]-e[2])**2);o[i]=o[i-1]+n}const n=o.map(t=>t*r);if(0!==e&&e<n.length){const t=n[e];for(let e=0;e<n.length;e++)n[e]-=t}return n}function x(t,e){const r=s(t.length*z),o=t[0],n=t[t.length-1];for(let i=0;i<t.length;i++)r[i*z]=t[i],r[i*z+1]=o,r[i*z+2]=n,r[i*z+3]=e+.5;return r}export{E as animatedLineStripsToParameters,f as createGeometry,I as getLinearTimeStamps,S as lineStripsToParameters,z as numTimeStampValuesPerVertex,x as timeStampsToAttribute};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{subclass as e}from"../../../../core/accessorSupport/decorators.js";import{createFlowFieldFromData as s,traceFlowPaths as a}from"../../../2d/engine/flow/dataUtils.js";import{createFlowFieldFromDataTiled as i,valuesPerFlowVertex as r}from"./loadUtils.js";let o=class{constructor(){this._tileData=new Map}async generateStreamlines(t){const{flowData:e,flowExtentInfo:a,needsMagnitude:i,simulationSettings:r,startPositions:o}=t,n=l(s(r,e),r,a.modelSize,i,o);return{result:{streamlines:n},transferList:n?.map(t=>t.vertices.buffer)}}async generateTiledStreamlines(t){const{flowDataTiles:e,flowExtentInfo:s,needsMagnitude:a,reset:r,simulationSettings:o,startPositions:n}=t;this._updateTileData(e,r);const f=l(i(o,this._tileData,s),o,s.modelSize,a,n);return{result:{streamlines:f},transferList:f?.map(t=>t.vertices.buffer)??[]}}_updateTileData(t,e){if(e)for(const s of this._tileData.keys())t.has(s)||this._tileData.delete(s);t.forEach((t,e)=>{"delete"===t.type?this._tileData.delete(e):"on-worker"!==t.type&&"invalid"!==t.type&&this._tileData.set(e,t.data)})}};o=t([e("esri.views.3d.support.flow.FlowWorker")],o);const n=o;function l(t,e,s,i,o){if(null==t)return;const n=a(e,t,s[0],s[1],{positions:o}),l=[],f=r(i);for(const{vertices:a,stage:r}of n){const t=new Float32Array(a.length*f);for(let e=0;e<a.length;e++)t[e*f]=a[e].x,t[e*f+1]=a[e].y,t[e*f+2]=a[e].
|
|
5
|
+
import{__decorate as t}from"tslib";import{subclass as e}from"../../../../core/accessorSupport/decorators.js";import{createFlowFieldFromData as s,traceFlowPaths as a}from"../../../2d/engine/flow/dataUtils.js";import{createFlowFieldFromDataTiled as i,valuesPerFlowVertex as r}from"./loadUtils.js";let o=class{constructor(){this._tileData=new Map}async generateStreamlines(t){const{flowData:e,flowExtentInfo:a,needsMagnitude:i,simulationSettings:r,startPositions:o}=t,n=l(s(r,e),r,a.modelSize,i,o);return{result:{streamlines:n},transferList:n?.map(t=>t.vertices.buffer)}}async generateTiledStreamlines(t){const{flowDataTiles:e,flowExtentInfo:s,needsMagnitude:a,reset:r,simulationSettings:o,startPositions:n}=t;this._updateTileData(e,r);const f=l(i(o,this._tileData,s),o,s.modelSize,a,n);return{result:{streamlines:f},transferList:f?.map(t=>t.vertices.buffer)??[]}}_updateTileData(t,e){if(e)for(const s of this._tileData.keys())t.has(s)||this._tileData.delete(s);t.forEach((t,e)=>{"delete"===t.type?this._tileData.delete(e):"on-worker"!==t.type&&"invalid"!==t.type&&this._tileData.set(e,t.data)})}};o=t([e("esri.views.3d.support.flow.FlowWorker")],o);const n=o;function l(t,e,s,i,o){if(null==t)return;const n=a(e,t,s[0],s[1],{positions:o}),l=[],f=r(i);for(const{vertices:a,stage:r}of n){const t=new Float32Array(a.length*f);for(let e=0;e<a.length;e++)t[e*f]=a[e].x,t[e*f+1]=a[e].y,t[e*f+2]=a[e].time,i&&(t[e*f+3]=a[e].speed);l.push({vertices:t,stage:r,hasMagnitude:i})}return l}export{n as default};
|