@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{__decorate as e}from"tslib";import{onLocaleChange as t,fetchMessageBundle as i}from"../../../../../intl.js";import s from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as r,getContrast as n,multiplyOpacity as a}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTen as o}from"../../../../../core/mathUtils.js";import{destroyMaybe as l}from"../../../../../core/maybe.js";import{formatDecimal as h}from"../../../../../core/quantityFormatUtils.js";import{watch as m,syncAndInitial as c,initial as d}from"../../../../../core/reactiveUtils.js";import{lengthUnitFromSpatialReference as p,convertUnit as u,adaptiveAreaUnit as g}from"../../../../../core/units.js";import{property as _,subclass as v}from"../../../../../core/accessorSupport/decorators.js";import{fromTranslation as L}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as b}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{e as f}from"../../../../../chunks/vec32.js";import{create as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{toPreferredAreaUnit as S,preferredLengthUnit as y}from"./utils.js";import{LabelVisualElement as j}from"../../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as C}from"../../../interactive/visualElements/LineVisualElement.js";import{MeasurementAreaVisualElement as D}from"../../../interactive/visualElements/MeasurementAreaVisualElement.js";import{GeodesicSegment as A,EuclideanSegment as V}from"../../../interactive/visualElements/support/Segment.js";import{midpoint3d as M}from"../../../support/mathUtils.js";import{createStipplePatternSimple as x}from"../../../webgl-engine/materials/lineStippleUtils.js";let P=class extends s{get _parameters(){const{accentColor:e,textColor:t}=this.view.effectiveTheme,i=e.toUnitRGBA(),s=r(e,.5),o=r(n(e),.5),l=n(t,160);return{accentColor:i,transparentAccentColor:s,transparentContrastColor:o,intersectingLineColor:[1,.2,0,1],textColor:t,textBackgroundColor:a(l,.6),textCalloutColor:a(l,.5),pathLineWidth:3,perimeterLineWidth:2,projectionLineWidth:2,projectionLineStippleSize:5,labelDistance:25}}get visible(){return this.analysisViewData.visible}get _renderUnits(){const e=this.view.renderCoordsHelper.spatialReference;return p(e)??"meters"}get testData(){}constructor(e){super(e),this._path=null,this._intersectedPath=null,this._perimeter=null,this._intersectedPerimeter=null,this._projectionLines=null,this._measurementArea=null,this._areaLabel=null,this._perimeterLengthLabel=null,this._pathSegments=[],this._perimeterSegments=[],this._origin=w(),this._originTransform=b(),this.messages=null,this.viewData=z,this.areaLabel=null,this.perimeterLengthLabel=null,this.loadingMessages=!0}initialize(){const{analysisViewData:e,_parameters:i,view:s}=this;this._path=new C({view:s,attached:!0,width:i.pathLineWidth,polygonOffset:!0,renderOccluded:4,isDecoration:!0}),this._intersectedPath=new C({view:s,attached:!0,width:i.pathLineWidth,polygonOffset:!0,renderOccluded:4,isDecoration:!0}),this._perimeter=new C({view:s,attached:!0,width:i.perimeterLineWidth,polygonOffset:!0,renderOccluded:4,isDecoration:!0}),this._intersectedPerimeter=new C({view:s,attached:!0,width:i.perimeterLineWidth,color:i.intersectingLineColor,polygonOffset:!0,renderOccluded:4,isDecoration:!0}),this._projectionLines=new C({view:s,attached:!0,width:i.projectionLineWidth,stipplePattern:x(i.projectionLineStippleSize),polygonOffset:!0,renderOccluded:4,isDecoration:!0}),this._measurementArea=new D({view:s,attached:!0,isDecoration:!0});const r={attached:!0,view:s,isDecoration:!0};this._areaLabel=new j({...r,fontSize:16}),this._perimeterLengthLabel=new j({...r,fontSize:12}),this.addHandles([m(()=>[e.mode,this.visible,e.unit,e.measurementData,e.stagedPoint],()=>this._update(),c),m(()=>s.state?.camera,()=>this._updateLabels(),c),t(()=>this._updateMessageBundle()),m(()=>this._parameters,({accentColor:e,transparentAccentColor:t,transparentContrastColor:i,textColor:s,textBackgroundColor:r,textCalloutColor:n})=>{const{_path:a,_intersectedPath:o,_perimeter:l,_projectionLines:h,_measurementArea:m,_areaLabel:c,_perimeterLengthLabel:d}=this;a.color=e,o.color=e,l.color=e,h.color=e,m.color1=t,m.color2=i,c.textColor=s,c.backgroundColor=r,c.calloutColor=n,d.textColor=s,d.backgroundColor=r,d.calloutColor=n},d)]),this._updateMessageBundle()}destroy(){this._measurementArea=l(this._measurementArea),this._path=l(this._path),this._intersectedPath=l(this._intersectedPath),this._perimeter=l(this._perimeter),this._intersectedPerimeter=l(this._intersectedPerimeter),this._areaLabel=l(this._areaLabel),this._perimeterLengthLabel=l(this._perimeterLengthLabel),this._projectionLines=l(this._projectionLines),this.set("view",null)}_update(){if(this.destroyed||!this.view.ready||!this.view.renderCoordsHelper)return;const{analysisViewData:{measurementData:e},analysisViewData:t}=this;null!=e&&(this._updateViewData(e,t.path),this._updateOrigin(),this._updatePathSegments(),this._updatePerimeterSegments(),this._updateArea(),this._updateProjectionLines(),this._updateLabels())}_updateViewData(e,t){const i=e.validMeasurement,s="geodesic"===e.actualMeasurementMode,r=s?e.geodesicArea:e.area;let n=1;if(r){const e=S(r,this.analysisViewData.unit);n=o(Math.sqrt(e.value)/Math.sqrt(300)),n*=Math.sqrt(u(1,e.unit,"square-meters")),n=u(n,"meters",this._renderUnits)}const a={validMeasurement:i,numVertices:e.numVertices,hasStagedVertex:e.hasStagedVertex,path:t,mode:e.actualMeasurementMode,positionsRender:e.positionsRender,positionsFittedWorld:e.positionsFittedWorld,positionsFittedRender:e.positionsFittedRender,intersectingSegments:s?e.geodesicIntersectingSegments:e.intersectingSegments,triangleIndices:s?e.geodesicTriangleIndices:e.triangleIndices,areaCentroid:s?e.geodesicAreaCentroidRenderCoords:e.areaCentroidRenderCoords,perimeterLengthLabelSegmentIndex:0,area:s?e.geodesicArea:e.area,pathLength:s?e.geodesicPathLength:e.pathLength,perimeterLength:e.perimeterLength,checkerSize:n};this._set("viewData",a)}_updateOrigin(){const e=this.viewData;M(e.positionsRender,this._origin),L(this._originTransform,this._origin),this._measurementArea.transform=this._originTransform,this._projectionLines.transform=this._originTransform}_createSegments(e){const t=this.viewData,i=this.view.renderCoordsHelper.spatialReference,s=t.mode,r=[],n=[],a=[],o=t.numVertices,l=t.validMeasurement?o:o-1;for(let m=0;m<l;++m){const l=t[e][m],h=t[e][(m+1)%o];let c=null;switch(s){case"euclidean":c=new V(l,h);break;case"geodesic":c=new A(l,h,i)}t.intersectingSegments.has(m)?a.push(c):n.push(c),r.push(c)}let h=null;return t.validMeasurement&&t.hasStagedVertex&&l>=2?h=r[r.length-2]:t.hasStagedVertex&&l>=1&&(h=r[r.length-1]),{all:r,nonIntersecting:n,intersecting:a,stagedSegment:h}}_updatePathSegments(){const{visible:e}=this,t=this._createSegments("positionsRender");this._path.setGeometryFromSegments(t.nonIntersecting,this._origin),this._path.visible=e,this._intersectedPath.setGeometryFromSegments(t.intersecting,this._origin),this._intersectedPath.visible=e,this._pathSegments=t.all}_updatePerimeterSegments(){const e=this.visible&&"euclidean"===this.viewData.mode&&this.viewData.path.numVertices>2,t=this._createSegments("positionsFittedRender");this._perimeter.setGeometryFromSegments(t.nonIntersecting,this._origin),this._perimeter.visible=e,this._intersectedPerimeter.setGeometryFromSegments(t.intersecting,this._origin),this._intersectedPerimeter.visible=e,this._perimeterSegments=t.all}_updateArea(){const e=this.viewData;switch(e.mode){case"euclidean":this._updateAreaEuclidean(e);break;case"geodesic":this._updateAreaGeodesic()}}_updateAreaEuclidean(e){const t=this.visible;e.validMeasurement&&0===e.intersectingSegments.size&&e.triangleIndices?(this._measurementArea.geometry={uv:e.positionsFittedWorld,position:e.positionsFittedRender,triangleIndices:e.triangleIndices},this._measurementArea.size=[e.checkerSize,e.checkerSize],this._measurementArea.visible=t):this._measurementArea.visible=!1}_updateAreaGeodesic(){this._measurementArea.visible=!1}_updateProjectionLines(){const e=this.viewData,t=this.visible,i=e.mode,s=e.numVertices;if(s>0&&e.validMeasurement&&"euclidean"===i){const i=[];for(let t=0;t<s;++t){const s=w();f(s,e.positionsRender[t],this._origin);const r=w();f(r,e.positionsFittedRender[t],this._origin),i.push([s,r])}this._projectionLines.geometry=i,this._projectionLines.visible=t}else this._projectionLines.geometry=null,this._projectionLines.visible=!1}_updateLabels(){if(this.destroyed)return;const{viewData:e}=this,{area:t,path:i}=e;if(!i)return;const s=this.visible,r=this._areaLabel,n=this._perimeterLengthLabel,a=e.validMeasurement;r.visible=!0,n.visible=!0;let o=!1;const l=R(this.messages,t,this.analysisViewData.unit);if(null!=l&&s&&(r.geometry={type:"point",point:e.areaCentroid},r.text=l,o=e.validMeasurement&&0===e.intersectingSegments.size),this._set("areaLabel",l),s&&a&&0===e.intersectingSegments.size){const t="geodesic"===e.mode,i=t?e.pathLength:e.perimeterLength,s=F(this.messages,i,this.analysisViewData.unit);this._set("perimeterLengthLabel",s),n.distance=this._parameters.labelDistance,n.anchor="top",n.text=s;let r=!0;for(let a=0;a<e.numVertices;++a){const i=(e.perimeterLengthLabelSegmentIndex+a)%e.numVertices,s=t?this._pathSegments[i]:this._perimeterSegments[i];if(r=!0,n.geometry={type:"segment",segment:s,sampleLocation:"center"},!n.overlaps(this._areaLabel))break;r=!1}n.visible=r}else n.visible=!1;r.visible=o}_updateMessageBundle(){this.loadingMessages=!0,i("esri/core/t9n/Units").then(e=>{this.messages=e,this.view&&this._update()}).finally(()=>{this.loadingMessages=!1})}};function R(e,t,i){return e&&t&&h(e,t,g(t.value,t.unit,i))}function F(e,t,i){return e&&t&&h(e,t,y(t,i))}e([_()],P.prototype,"_parameters",null),e([_()],P.prototype,"view",void 0),e([_()],P.prototype,"messages",void 0),e([_()],P.prototype,"analysis",void 0),e([_()],P.prototype,"viewData",void 0),e([_()],P.prototype,"analysisViewData",void 0),e([_({readOnly:!0})],P.prototype,"areaLabel",void 0),e([_({readOnly:!0})],P.prototype,"perimeterLengthLabel",void 0),e([_()],P.prototype,"loadingMessages",void 0),e([_()],P.prototype,"visible",null),e([_()],P.prototype,"_renderUnits",null),P=e([v("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementVisualization")],P);const z={validMeasurement:!1,numVertices:0,hasStagedVertex:!1,path:null,mode:null,positionsRender:null,positionsFittedWorld:null,positionsFittedRender:null,intersectingSegments:null,triangleIndices:null,areaCentroid:null,perimeterLengthLabelSegmentIndex:null,checkerSize:null,area:null,pathLength:null,perimeterLength:null};export{P as AreaMeasurementVisualization};
|
|
5
|
+
import{__decorate as e}from"tslib";import{onLocaleChange as t,fetchMessageBundle as i}from"../../../../../intl.js";import s from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as r,getContrast as n,multiplyOpacity as a}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTen as o}from"../../../../../core/mathUtils.js";import{destroyMaybe as l}from"../../../../../core/maybe.js";import{formatDecimal as h}from"../../../../../core/quantityFormatUtils.js";import{watch as m,syncAndInitial as c,initial as d}from"../../../../../core/reactiveUtils.js";import{lengthUnitFromSpatialReference as p,convertUnit as u,adaptiveAreaUnit as g}from"../../../../../core/units.js";import{property as _,subclass as v}from"../../../../../core/accessorSupport/decorators.js";import{fromTranslation as L}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as b}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{e as f}from"../../../../../chunks/vec32.js";import{create as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{toPreferredAreaUnit as S,preferredLengthUnit as y}from"./utils.js";import{LabelVisualElement as j}from"../../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as C}from"../../../interactive/visualElements/LineVisualElement.js";import{MeasurementAreaVisualElement as D}from"../../../interactive/visualElements/MeasurementAreaVisualElement.js";import{GeodesicSegment as A,EuclideanSegment as V}from"../../../interactive/visualElements/support/Segment.js";import{midpoint3d as M}from"../../../support/mathUtils.js";import{createStipplePatternSimple as x}from"../../../webgl-engine/materials/lineStippleUtils.js";let P=class extends s{get _parameters(){const{accentColor:e,textColor:t}=this.view.effectiveTheme,i=e.toUnitRGBA(),s=r(e,.5),o=r(n(e),.5),l=n(t,160);return{accentColor:i,transparentAccentColor:s,transparentContrastColor:o,intersectingLineColor:[1,.2,0,1],textColor:t,textBackgroundColor:a(l,.6),textCalloutColor:a(l,.5),pathLineWidth:3,perimeterLineWidth:2,projectionLineWidth:2,projectionLineStippleSize:5,labelDistance:25}}get visible(){return this.analysisViewData.visible}get _renderUnits(){const e=this.view.renderCoordsHelper.spatialReference;return p(e)??"meters"}get testData(){}constructor(e){super(e),this._path=null,this._intersectedPath=null,this._perimeter=null,this._intersectedPerimeter=null,this._projectionLines=null,this._measurementArea=null,this._areaLabel=null,this._perimeterLengthLabel=null,this._pathSegments=[],this._perimeterSegments=[],this._origin=w(),this._originTransform=b(),this.messages=null,this.viewData=z,this.areaLabel=null,this.perimeterLengthLabel=null,this.loadingMessages=!0}initialize(){const{analysisViewData:e,_parameters:i,view:s}=this;this._path=new C({view:s,attached:!0,width:i.pathLineWidth,polygonOffset:!0,renderOccluded:4,isDecoration:!0}),this._intersectedPath=new C({view:s,attached:!0,width:i.pathLineWidth,polygonOffset:!0,renderOccluded:4,isDecoration:!0}),this._perimeter=new C({view:s,attached:!0,width:i.perimeterLineWidth,polygonOffset:!0,renderOccluded:4,isDecoration:!0}),this._intersectedPerimeter=new C({view:s,attached:!0,width:i.perimeterLineWidth,color:i.intersectingLineColor,polygonOffset:!0,renderOccluded:4,isDecoration:!0}),this._projectionLines=new C({view:s,attached:!0,width:i.projectionLineWidth,stipplePattern:x(i.projectionLineStippleSize),polygonOffset:!0,renderOccluded:4,isDecoration:!0}),this._measurementArea=new D({view:s,attached:!0,isDecoration:!0});const r={attached:!0,view:s,isDecoration:!0};this._areaLabel=new j({...r,fontSize:16,distance:0}),this._perimeterLengthLabel=new j({...r,fontSize:12}),this.addHandles([m(()=>[e.mode,this.visible,e.unit,e.measurementData,e.stagedPoint],()=>this._update(),c),m(()=>s.state?.camera,()=>this._updateLabels(),c),t(()=>this._updateMessageBundle()),m(()=>this._parameters,({accentColor:e,transparentAccentColor:t,transparentContrastColor:i,textColor:s,textBackgroundColor:r,textCalloutColor:n})=>{const{_path:a,_intersectedPath:o,_perimeter:l,_projectionLines:h,_measurementArea:m,_areaLabel:c,_perimeterLengthLabel:d}=this;a.color=e,o.color=e,l.color=e,h.color=e,m.color1=t,m.color2=i,c.textColor=s,c.backgroundColor=r,c.calloutColor=n,d.textColor=s,d.backgroundColor=r,d.calloutColor=n},d)]),this._updateMessageBundle()}destroy(){this._measurementArea=l(this._measurementArea),this._path=l(this._path),this._intersectedPath=l(this._intersectedPath),this._perimeter=l(this._perimeter),this._intersectedPerimeter=l(this._intersectedPerimeter),this._areaLabel=l(this._areaLabel),this._perimeterLengthLabel=l(this._perimeterLengthLabel),this._projectionLines=l(this._projectionLines),this.set("view",null)}_update(){if(this.destroyed||!this.view.ready||!this.view.renderCoordsHelper)return;const{analysisViewData:{measurementData:e},analysisViewData:t}=this;null!=e&&(this._updateViewData(e,t.path),this._updateOrigin(),this._updatePathSegments(),this._updatePerimeterSegments(),this._updateArea(),this._updateProjectionLines(),this._updateLabels())}_updateViewData(e,t){const i=e.validMeasurement,s="geodesic"===e.actualMeasurementMode,r=s?e.geodesicArea:e.area;let n=1;if(r){const e=S(r,this.analysisViewData.unit);n=o(Math.sqrt(e.value)/Math.sqrt(300)),n*=Math.sqrt(u(1,e.unit,"square-meters")),n=u(n,"meters",this._renderUnits)}const a={validMeasurement:i,numVertices:e.numVertices,hasStagedVertex:e.hasStagedVertex,path:t,mode:e.actualMeasurementMode,positionsRender:e.positionsRender,positionsFittedWorld:e.positionsFittedWorld,positionsFittedRender:e.positionsFittedRender,intersectingSegments:s?e.geodesicIntersectingSegments:e.intersectingSegments,triangleIndices:s?e.geodesicTriangleIndices:e.triangleIndices,areaCentroid:s?e.geodesicAreaCentroidRenderCoords:e.areaCentroidRenderCoords,perimeterLengthLabelSegmentIndex:0,area:s?e.geodesicArea:e.area,pathLength:s?e.geodesicPathLength:e.pathLength,perimeterLength:e.perimeterLength,checkerSize:n};this._set("viewData",a)}_updateOrigin(){const e=this.viewData;M(e.positionsRender,this._origin),L(this._originTransform,this._origin),this._measurementArea.transform=this._originTransform,this._projectionLines.transform=this._originTransform}_createSegments(e){const t=this.viewData,i=this.view.renderCoordsHelper.spatialReference,s=t.mode,r=[],n=[],a=[],o=t.numVertices,l=t.validMeasurement?o:o-1;for(let m=0;m<l;++m){const l=t[e][m],h=t[e][(m+1)%o];let c=null;switch(s){case"euclidean":c=new V(l,h);break;case"geodesic":c=new A(l,h,i)}t.intersectingSegments.has(m)?a.push(c):n.push(c),r.push(c)}let h=null;return t.validMeasurement&&t.hasStagedVertex&&l>=2?h=r[r.length-2]:t.hasStagedVertex&&l>=1&&(h=r[r.length-1]),{all:r,nonIntersecting:n,intersecting:a,stagedSegment:h}}_updatePathSegments(){const{visible:e}=this,t=this._createSegments("positionsRender");this._path.setGeometryFromSegments(t.nonIntersecting,this._origin),this._path.visible=e,this._intersectedPath.setGeometryFromSegments(t.intersecting,this._origin),this._intersectedPath.visible=e,this._pathSegments=t.all}_updatePerimeterSegments(){const e=this.visible&&"euclidean"===this.viewData.mode&&this.viewData.path.numVertices>2,t=this._createSegments("positionsFittedRender");this._perimeter.setGeometryFromSegments(t.nonIntersecting,this._origin),this._perimeter.visible=e,this._intersectedPerimeter.setGeometryFromSegments(t.intersecting,this._origin),this._intersectedPerimeter.visible=e,this._perimeterSegments=t.all}_updateArea(){const e=this.viewData;switch(e.mode){case"euclidean":this._updateAreaEuclidean(e);break;case"geodesic":this._updateAreaGeodesic()}}_updateAreaEuclidean(e){const t=this.visible;e.validMeasurement&&0===e.intersectingSegments.size&&e.triangleIndices?(this._measurementArea.geometry={uv:e.positionsFittedWorld,position:e.positionsFittedRender,triangleIndices:e.triangleIndices},this._measurementArea.size=[e.checkerSize,e.checkerSize],this._measurementArea.visible=t):this._measurementArea.visible=!1}_updateAreaGeodesic(){this._measurementArea.visible=!1}_updateProjectionLines(){const e=this.viewData,t=this.visible,i=e.mode,s=e.numVertices;if(s>0&&e.validMeasurement&&"euclidean"===i){const i=[];for(let t=0;t<s;++t){const s=w();f(s,e.positionsRender[t],this._origin);const r=w();f(r,e.positionsFittedRender[t],this._origin),i.push([s,r])}this._projectionLines.geometry=i,this._projectionLines.visible=t}else this._projectionLines.geometry=null,this._projectionLines.visible=!1}_updateLabels(){if(this.destroyed)return;const{viewData:e}=this,{area:t,path:i}=e;if(!i)return;const s=this.visible,r=this._areaLabel,n=this._perimeterLengthLabel,a=e.validMeasurement;r.visible=!0,n.visible=!0;let o=!1;const l=R(this.messages,t,this.analysisViewData.unit);if(null!=l&&s&&(r.geometry={type:"point",point:e.areaCentroid},r.text=l,o=e.validMeasurement&&0===e.intersectingSegments.size),this._set("areaLabel",l),s&&a&&0===e.intersectingSegments.size){const t="geodesic"===e.mode,i=t?e.pathLength:e.perimeterLength,s=F(this.messages,i,this.analysisViewData.unit);this._set("perimeterLengthLabel",s),n.distance=this._parameters.labelDistance,n.anchor="top",n.text=s;let r=!0;for(let a=0;a<e.numVertices;++a){const i=(e.perimeterLengthLabelSegmentIndex+a)%e.numVertices,s=t?this._pathSegments[i]:this._perimeterSegments[i];if(r=!0,n.geometry={type:"segment",segment:s,sampleLocation:"center"},!n.overlaps(this._areaLabel))break;r=!1}n.visible=r}else n.visible=!1;r.visible=o}_updateMessageBundle(){this.loadingMessages=!0,i("esri/core/t9n/Units").then(e=>{this.messages=e,this.view&&this._update()}).finally(()=>{this.loadingMessages=!1})}};function R(e,t,i){return e&&t&&h(e,t,g(t.value,t.unit,i))}function F(e,t,i){return e&&t&&h(e,t,y(t,i))}e([_()],P.prototype,"_parameters",null),e([_()],P.prototype,"view",void 0),e([_()],P.prototype,"messages",void 0),e([_()],P.prototype,"analysis",void 0),e([_()],P.prototype,"viewData",void 0),e([_()],P.prototype,"analysisViewData",void 0),e([_({readOnly:!0})],P.prototype,"areaLabel",void 0),e([_({readOnly:!0})],P.prototype,"perimeterLengthLabel",void 0),e([_()],P.prototype,"loadingMessages",void 0),e([_()],P.prototype,"visible",null),e([_()],P.prototype,"_renderUnits",null),P=e([v("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementVisualization")],P);const z={validMeasurement:!1,numVertices:0,hasStagedVertex:!1,path:null,mode:null,positionsRender:null,positionsFittedWorld:null,positionsFittedRender:null,intersectingSegments:null,triangleIndices:null,areaCentroid:null,perimeterLengthLabelSegmentIndex:null,checkerSize:null,area:null,pathLength:null,perimeterLength:null};export{P as AreaMeasurementVisualization};
|
|
@@ -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{deg2rad as e}from"../../../../../core/mathUtils.js";import{createLength as t,toUnit as s,createArea as i}from"../../../../../core/quantity.js";import{lengthUnitFromSpatialReference as o,areaUnitFromSpatialReference as n}from"../../../../../core/units.js";import{set as r,distance as h}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{D as l,d,f as g,q as c,e as p,g as m,j as u,i as _,n as f}from"../../../../../chunks/vec32.js";import{create as S}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as L}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as M}from"../../../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as C}from"../../../../../geometry/projectionUtils.js";import{getSphericalPCPF as P}from"../../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectDirection as R}from"../../../../../geometry/projection/projectDirection.js";import{projectPointToVector as j}from"../../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as U}from"../../../../../geometry/projection/projectVectorToVector.js";import{compactIndices as A}from"../../../../../geometry/support/Indices.js";import{segmentIntersects as v}from"../../../../../geometry/support/intersectsBase.js";import{Sphere as I}from"../../../../../geometry/support/sphere.js";import{areaPoints2d as V}from"../../../../../geometry/support/triangle.js";import{bestFitPlane as w,fitHemisphere as W,triangleAreaGeodesic as F,planePointDistance as y,boundingSphere as G}from"../../support/measurementUtils.js";import{getElevationAtPoint as T}from"../../../support/ElevationProvider.js";import{midpoint3d as x,makeOrthonormal as q,tangentFrame as z}from"../../../support/mathUtils.js";import{triangulate as b}from"../../../../support/euclideanAreaMeasurementUtils.js";import{euclideanDistanceBetweenPoints as E}from"../../../../support/euclideanLengthMeasurementUtils.js";import{supportsGeodesicMeasurement as D}from"../../../../support/geodesicMeasurementUtils.js";import{computeEuclideanMeasurementSR as B}from"../../../../support/measurementUtils.js";class H{get numVertices(){return this._length}get hasStagedVertex(){return null!=this._lastCursorPoint}constructor(e,t,s){this._sceneView=e,this._geodesicAreaMeasurementUtils=t,this._geodesicLengthMeasurementUtils=s,this.validMeasurement=!1,this.positionsWorld=[],this.positionsRender=[],this.positionsFittedWorld=[],this.positionsFittedRender=[],this.positionsGeodesic=[],this.positionsSpherical=[],this.positionsStereographic=[],this.pathSegmentLengths=[],this.geodesicPathSegmentLengths=[],this.perimeterSegmentLengths=[],this.intersectingSegments=new Set,this.geodesicIntersectingSegments=new Set,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.areaCentroidWorldCoords=S(),this.areaCentroidRenderCoords=S(),this.geodesicAreaCentroidRenderCoords=S(),this.fittingMode=null,this.area=null,this.geodesicArea=null,this.pathLength=null,this.geodesicPathLength=null,this.perimeterLength=null,this._length=0,this._centroidRenderCoords=S(),this._planeWorldCoords=L(),this._worldUp=S(),this._worldTangent=S(),this._frame=[S(),S(),S()],this._lastPathVersion=-1,this._lastCursorPoint=null,this._mode=null,this._tempU=S(),this._tempV=S(),this._tempVec3=S(),this._tempSphere=new I;const i=B(e.spatialReference);this._measurementSR=i,this._lengthMeasurementUnit=o(i)??"meters",this._areaMeasurementUnit=n(i)??"square-meters"}update(e,t,s,i,o,n){const r=this._lastPathVersion===e.version,h=t?t.equals(this._lastCursorPoint):null==this._lastCursorPoint,a=this._mode===o;return!(r&&!n&&a&&h)&&(this._lastPathVersion=e.version,this._lastCursorPoint=t,this._updateCursorSegmentLength(e,t),this._update(e,t,s,i,o),!0)}_update(e,s,i,o,n){const r=this._sceneView.renderSpatialReference,h=this._measurementSR,a=i.spatialReference;let l=e.numVertices;const d=!(null==s||s.equals(e.lastPoint)||l>2&&s.equals(e.firstPoint)||e.polygonIsClosed);d&&(l+=1);const g=!e.polygonIsClosed&&l>2,c=e.polygonIsClosed||g;this._resize(l);const p=P(a),m=null!=a&&D(a)?a:null,u=null!=m&&C(a,p),{positionsGeodesic:_,positionsWorld:S,positionsRender:L,positionsSpherical:M}=this,R=(e,t)=>{k(i.elevationProvider,e),j(e,S[t],h),j(e,L[t],r),u&&(j(e,_[t],m),j(e,M[t],p),f(M[t],M[t]))};e.forEachVertexPosition((e,t)=>R(e,t)),d&&R(s,l-1);const U=this._updatePathLengths(c);if(this.pathLength=this._length>1?t(U,this._lengthMeasurementUnit):null,u){const e=this._updateGeodesicPathLengths(c,m);this.geodesicPathLength=null!=e&&this._length>1?e:null}else this.geodesicPathLength=null;if(this._updateMode(n),!c)return this.area=null,this.geodesicArea=null,this.perimeterLength=null,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.intersectingSegments.clear(),this.geodesicIntersectingSegments.clear(),void(this.validMeasurement=!1);this._updateAreaAndPerimeterLength(i,r,h,o),u&&this._updateGeodesicArea(i,m),this.validMeasurement=!0}getData(){return{validMeasurement:this.validMeasurement,numVertices:this.numVertices,hasStagedVertex:this.hasStagedVertex,positionsRender:this.positionsRender,positionsFittedWorld:this.positionsFittedWorld,positionsFittedRender:this.positionsFittedRender,intersectingSegments:this.intersectingSegments,geodesicIntersectingSegments:this.geodesicIntersectingSegments,triangleIndices:this.triangleIndices,geodesicTriangleIndices:this.geodesicTriangleIndices,areaCentroidRenderCoords:this.areaCentroidRenderCoords,geodesicAreaCentroidRenderCoords:this.geodesicAreaCentroidRenderCoords,area:this.area,geodesicArea:this.geodesicArea,pathLength:this.pathLength,geodesicPathLength:this.geodesicPathLength,perimeterLength:this.perimeterLength,actualMeasurementMode:this.actualMeasurementMode}}_resize(e){for(e<this._length&&(this.positionsWorld.length=e,this.positionsRender.length=e,this.positionsFittedWorld.length=e,this.positionsFittedRender.length=e,this.positionsGeodesic.length=e,this.positionsSpherical.length=e,this.positionsStereographic.length=e,this.pathSegmentLengths.length=e,this.geodesicPathSegmentLengths.length=e,this.perimeterSegmentLengths.length=e,this._length=e);this._length<e;)this.positionsWorld.push(S()),this.positionsRender.push(S()),this.positionsFittedWorld.push(a()),this.positionsFittedRender.push(S()),this.positionsGeodesic.push(S()),this.positionsSpherical.push(S()),this.positionsStereographic.push(a()),this.pathSegmentLengths.push(0),this.geodesicPathSegmentLengths.push(0),this.perimeterSegmentLengths.push(0),++this._length}_updatePathLengths(e){const t=this.positionsWorld,s=this.pathSegmentLengths;let i=0;const o=this._length;for(let n=0;n<o;++n){const r=s[n]=l(t[n],t[(n+1)%o]);(n<o-1||e)&&(i+=r)}return i}_updateGeodesicPathLengths(e,i){const o=this.positionsGeodesic,n=this.geodesicPathSegmentLengths;let r=0;const h=this._length;for(let t=0;t<h;++t){const a=this._geodesicLengthMeasurementUtils.geodesicDistance(o[t],o[(t+1)%h],i);if(null==a)return null;const l=s(a,"meters").value,d=n[t]=l;(t<h-1||e)&&(r+=d)}return t(r,"meters")}_updateAreaAndPerimeterLength(e,t,s,i){const o=e.renderCoordsHelper,n=this.positionsWorld,h=this.positionsRender,a=this.positionsFittedWorld,l=this.positionsFittedRender,f=this._planeWorldCoords,S=this._centroidRenderCoords;x(h,S),o.worldUpAtPosition(S,this._worldUp),o.worldBasisAtPosition(S,0,this._worldTangent),R(S,this._worldUp,t,this._worldUp,s),R(S,this._worldTangent,t,this._worldTangent,s),n.length>2&&w(n,f),this.fittingMode=this._selectFittingMode(f,n,this._worldUp,i);let L=0;if("horizontal"===this.fittingMode){let e=-1/0;h.forEach((t,s)=>{const i=o.getAltitude(h[s]);i>e&&(e=i,L=s)})}const M=n[L];let C=f,P=this._worldTangent;"horizontal"===this.fittingMode?C=this._worldUp:"vertical"===this.fittingMode&&(C=this._tempVec3,P=this._worldUp,q(f,this._worldUp,C)),d(this._frame[2],C),q(P,C,this._frame[0]),g(this._frame[1],this._frame[0],this._frame[2]),c(this._frame[1],this._frame[1]);const j=this._tempVec3,A=this._tempU,v=this._tempV;for(let d=0;d<this._length;++d){const e=a[d],i=l[d];p(j,n[d],M),r(e,m(this._frame[0],j),m(this._frame[1],j)),u(A,this._frame[0],e[0]),u(v,this._frame[1],e[1]),_(j,A,v),_(j,j,M),U(j,s,i,t)}this.perimeterLength=this._length>0?this._updatePerimeterLengths():null,x(l,this.areaCentroidRenderCoords),U(this.areaCentroidRenderCoords,t,this.areaCentroidWorldCoords,s),this._updateIntersectingSegments(),this.area=0===this.intersectingSegments.size?this._computeArea():null}_updateGeodesicArea(e,t){const{renderCoordsHelper:s,spatialReference:i}=e,{positionsSpherical:o,positionsStereographic:n}=this,h=this._tempVec3,a=W(o,h);if(!a)return void(this.geodesicArea=null);const l=this._tempU,d=this._tempV;z(h,l,d);for(let g=0;g<this._length;++g){const e=m(o[g],l),t=m(o[g],d),s=m(o[g],h);r(n[g],e/s,t/s)}u(h,h,M(i).radius),s.toRenderCoords(h,P(i),this.geodesicAreaCentroidRenderCoords),this._updateGeodesicIntersectingSegments(),this.geodesicArea=a&&0===this.geodesicIntersectingSegments.size?this._computeGeodesicArea(t):null}_updatePerimeterLengths(){const e=this.positionsFittedWorld,s=this.perimeterSegmentLengths;let i=0;for(let t=0;t<this._length;++t){i+=s[t]=h(e[t],e[(t+1)%this._length])}return t(i,this._lengthMeasurementUnit)}_updateIntersectingSegments(){const e=this.positionsFittedWorld,t=this.intersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],n=e[(s+1)%this._length],r=e[i],h=e[(i+1)%this._length];v(o,n,r,h)&&(t.add(s),t.add(i))}}_computeArea(){const e=this.positionsFittedWorld,t=this.triangleIndices=A(b(e));let s=0;for(let i=0;i<t.length;i+=3)s+=V(e[t[i]],e[t[i+1]],e[t[i+2]]);return i(s,this._areaMeasurementUnit)}_updateGeodesicIntersectingSegments(){const e=this.positionsStereographic,t=this.geodesicIntersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],n=e[(s+1)%this._length],r=e[i],h=e[(i+1)%this._length];v(o,n,r,h)&&(t.add(s),t.add(i))}}_computeGeodesicArea(e){const t=this.positionsGeodesic,o=this.positionsStereographic,n=this.geodesicTriangleIndices=A(b(o));let r=0;for(let i=0;i<n.length;i+=3){const o=F(t[n[i]],t[n[i+1]],t[n[i+2]],e,this._geodesicAreaMeasurementUtils);if(null==o)return null;r+=s(o,"square-meters").value}return i(r,"square-meters")}_selectFittingMode(t,s,i,o){const n=s.map(e=>Math.abs(y(t,e))).reduce((e,t)=>Math.max(e,t),0);G(s,this._tempSphere);const r=n/(2*this._tempSphere.radius),h=r<o.maxRelativeErrorCoplanar,a=r<o.maxRelativeErrorAlmostCoplanar;let l="horizontal";if(h)l="oblique";else if(a){l=Math.abs(m(i,t))>Math.cos(e(o.verticalAngleThreshold))?"horizontal":"vertical"}return l}_updateCursorSegmentLength(e,t){const s=e.lastPoint;e.isValidPolygon||null==s||null==t?(this.geodesicStagedSegmentLength=null,this.stagedSegmentLength=null):(this.geodesicStagedSegmentLength=this._geodesicLengthMeasurementUtils.geodesicDistanceBetweenPoints(s,t),this.stagedSegmentLength=E(s,t)?.direct)}_updateMode(e){if(0===e){this.actualMeasurementMode="euclidean";let e=0;null!=this.geodesicPathLength&&(e+=this.geodesicPathLength.value),e>Z&&(this.actualMeasurementMode="geodesic")}else this.actualMeasurementMode=1===e?"euclidean":"geodesic";null==this.geodesicPathLength&&(this.actualMeasurementMode="euclidean"),this._mode=e}}function k(e,t){t.hasZ||(t.z=T(e,t,"ground")??0)}const Z=1e5;export{H as MeasurementDataManager};
|
|
5
|
+
import{deg2rad as e}from"../../../../../core/mathUtils.js";import{createLength as t,toUnit as s,createArea as i}from"../../../../../core/quantity.js";import{lengthUnitFromSpatialReference as o,areaUnitFromSpatialReference as n}from"../../../../../core/units.js";import{set as r,distance as h}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{B as l,d,f as g,q as c,e as p,g as m,j as u,i as _,n as f}from"../../../../../chunks/vec32.js";import{create as S}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as L}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as M}from"../../../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as C}from"../../../../../geometry/projectionUtils.js";import{getSphericalPCPF as P}from"../../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectDirection as R}from"../../../../../geometry/projection/projectDirection.js";import{projectPointToVector as j}from"../../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as U}from"../../../../../geometry/projection/projectVectorToVector.js";import{compactIndices as A}from"../../../../../geometry/support/Indices.js";import{segmentIntersects as v}from"../../../../../geometry/support/intersectsBase.js";import{Sphere as I}from"../../../../../geometry/support/sphere.js";import{areaPoints2d as V}from"../../../../../geometry/support/triangle.js";import{bestFitPlane as w,fitHemisphere as W,triangleAreaGeodesic as F,planePointDistance as y,boundingSphere as G}from"../../support/measurementUtils.js";import{getElevationAtPoint as T}from"../../../support/ElevationProvider.js";import{midpoint3d as x,makeOrthonormal as q,tangentFrame as z}from"../../../support/mathUtils.js";import{triangulate as b}from"../../../../support/euclideanAreaMeasurementUtils.js";import{euclideanDistanceBetweenPoints as E}from"../../../../support/euclideanLengthMeasurementUtils.js";import{supportsGeodesicMeasurement as B}from"../../../../support/geodesicMeasurementUtils.js";import{computeEuclideanMeasurementSR as D}from"../../../../support/measurementUtils.js";class H{get numVertices(){return this._length}get hasStagedVertex(){return null!=this._lastCursorPoint}constructor(e,t,s){this._sceneView=e,this._geodesicAreaMeasurementUtils=t,this._geodesicLengthMeasurementUtils=s,this.validMeasurement=!1,this.positionsWorld=[],this.positionsRender=[],this.positionsFittedWorld=[],this.positionsFittedRender=[],this.positionsGeodesic=[],this.positionsSpherical=[],this.positionsStereographic=[],this.pathSegmentLengths=[],this.geodesicPathSegmentLengths=[],this.perimeterSegmentLengths=[],this.intersectingSegments=new Set,this.geodesicIntersectingSegments=new Set,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.areaCentroidWorldCoords=S(),this.areaCentroidRenderCoords=S(),this.geodesicAreaCentroidRenderCoords=S(),this.fittingMode=null,this.area=null,this.geodesicArea=null,this.pathLength=null,this.geodesicPathLength=null,this.perimeterLength=null,this._length=0,this._centroidRenderCoords=S(),this._planeWorldCoords=L(),this._worldUp=S(),this._worldTangent=S(),this._frame=[S(),S(),S()],this._lastPathVersion=-1,this._lastCursorPoint=null,this._mode=null,this._tempU=S(),this._tempV=S(),this._tempVec3=S(),this._tempSphere=new I;const i=D(e.spatialReference);this._measurementSR=i,this._lengthMeasurementUnit=o(i)??"meters",this._areaMeasurementUnit=n(i)??"square-meters"}update(e,t,s,i,o,n){const r=this._lastPathVersion===e.version,h=t?t.equals(this._lastCursorPoint):null==this._lastCursorPoint,a=this._mode===o;return!(r&&!n&&a&&h)&&(this._lastPathVersion=e.version,this._lastCursorPoint=t,this._updateCursorSegmentLength(e,t),this._update(e,t,s,i,o),!0)}_update(e,s,i,o,n){const r=this._sceneView.renderSpatialReference,h=this._measurementSR,a=i.spatialReference;let l=e.numVertices;const d=!(null==s||s.equals(e.lastPoint)||l>2&&s.equals(e.firstPoint)||e.polygonIsClosed);d&&(l+=1);const g=!e.polygonIsClosed&&l>2,c=e.polygonIsClosed||g;this._resize(l);const p=P(a),m=null!=a&&B(a)?a:null,u=null!=m&&C(a,p),{positionsGeodesic:_,positionsWorld:S,positionsRender:L,positionsSpherical:M}=this,R=(e,t)=>{k(i.elevationProvider,e),j(e,S[t],h),j(e,L[t],r),u&&(j(e,_[t],m),j(e,M[t],p),f(M[t],M[t]))};e.forEachVertexPosition((e,t)=>R(e,t)),d&&R(s,l-1);const U=this._updatePathLengths(c);if(this.pathLength=this._length>1?t(U,this._lengthMeasurementUnit):null,u){const e=this._updateGeodesicPathLengths(c,m);this.geodesicPathLength=null!=e&&this._length>1?e:null}else this.geodesicPathLength=null;if(this._updateMode(n),!c)return this.area=null,this.geodesicArea=null,this.perimeterLength=null,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.intersectingSegments.clear(),this.geodesicIntersectingSegments.clear(),void(this.validMeasurement=!1);this._updateAreaAndPerimeterLength(i,r,h,o),u&&this._updateGeodesicArea(i,m),this.validMeasurement=!0}getData(){return{validMeasurement:this.validMeasurement,numVertices:this.numVertices,hasStagedVertex:this.hasStagedVertex,positionsRender:this.positionsRender,positionsFittedWorld:this.positionsFittedWorld,positionsFittedRender:this.positionsFittedRender,intersectingSegments:this.intersectingSegments,geodesicIntersectingSegments:this.geodesicIntersectingSegments,triangleIndices:this.triangleIndices,geodesicTriangleIndices:this.geodesicTriangleIndices,areaCentroidRenderCoords:this.areaCentroidRenderCoords,geodesicAreaCentroidRenderCoords:this.geodesicAreaCentroidRenderCoords,area:this.area,geodesicArea:this.geodesicArea,pathLength:this.pathLength,geodesicPathLength:this.geodesicPathLength,perimeterLength:this.perimeterLength,actualMeasurementMode:this.actualMeasurementMode}}_resize(e){for(e<this._length&&(this.positionsWorld.length=e,this.positionsRender.length=e,this.positionsFittedWorld.length=e,this.positionsFittedRender.length=e,this.positionsGeodesic.length=e,this.positionsSpherical.length=e,this.positionsStereographic.length=e,this.pathSegmentLengths.length=e,this.geodesicPathSegmentLengths.length=e,this.perimeterSegmentLengths.length=e,this._length=e);this._length<e;)this.positionsWorld.push(S()),this.positionsRender.push(S()),this.positionsFittedWorld.push(a()),this.positionsFittedRender.push(S()),this.positionsGeodesic.push(S()),this.positionsSpherical.push(S()),this.positionsStereographic.push(a()),this.pathSegmentLengths.push(0),this.geodesicPathSegmentLengths.push(0),this.perimeterSegmentLengths.push(0),++this._length}_updatePathLengths(e){const t=this.positionsWorld,s=this.pathSegmentLengths;let i=0;const o=this._length;for(let n=0;n<o;++n){const r=s[n]=l(t[n],t[(n+1)%o]);(n<o-1||e)&&(i+=r)}return i}_updateGeodesicPathLengths(e,i){const o=this.positionsGeodesic,n=this.geodesicPathSegmentLengths;let r=0;const h=this._length;for(let t=0;t<h;++t){const a=this._geodesicLengthMeasurementUtils.geodesicDistance(o[t],o[(t+1)%h],i);if(null==a)return null;const l=s(a,"meters").value,d=n[t]=l;(t<h-1||e)&&(r+=d)}return t(r,"meters")}_updateAreaAndPerimeterLength(e,t,s,i){const o=e.renderCoordsHelper,n=this.positionsWorld,h=this.positionsRender,a=this.positionsFittedWorld,l=this.positionsFittedRender,f=this._planeWorldCoords,S=this._centroidRenderCoords;x(h,S),o.worldUpAtPosition(S,this._worldUp),o.worldBasisAtPosition(S,0,this._worldTangent),R(S,this._worldUp,t,this._worldUp,s),R(S,this._worldTangent,t,this._worldTangent,s),n.length>2&&w(n,f),this.fittingMode=this._selectFittingMode(f,n,this._worldUp,i);let L=0;if("horizontal"===this.fittingMode){let e=-1/0;h.forEach((t,s)=>{const i=o.getAltitude(h[s]);i>e&&(e=i,L=s)})}const M=n[L];let C=f,P=this._worldTangent;"horizontal"===this.fittingMode?C=this._worldUp:"vertical"===this.fittingMode&&(C=this._tempVec3,P=this._worldUp,q(f,this._worldUp,C)),d(this._frame[2],C),q(P,C,this._frame[0]),g(this._frame[1],this._frame[0],this._frame[2]),c(this._frame[1],this._frame[1]);const j=this._tempVec3,A=this._tempU,v=this._tempV;for(let d=0;d<this._length;++d){const e=a[d],i=l[d];p(j,n[d],M),r(e,m(this._frame[0],j),m(this._frame[1],j)),u(A,this._frame[0],e[0]),u(v,this._frame[1],e[1]),_(j,A,v),_(j,j,M),U(j,s,i,t)}this.perimeterLength=this._length>0?this._updatePerimeterLengths():null,x(l,this.areaCentroidRenderCoords),U(this.areaCentroidRenderCoords,t,this.areaCentroidWorldCoords,s),this._updateIntersectingSegments(),this.area=0===this.intersectingSegments.size?this._computeArea():null}_updateGeodesicArea(e,t){const{renderCoordsHelper:s,spatialReference:i}=e,{positionsSpherical:o,positionsStereographic:n}=this,h=this._tempVec3,a=W(o,h);if(!a)return void(this.geodesicArea=null);const l=this._tempU,d=this._tempV;z(h,l,d);for(let g=0;g<this._length;++g){const e=m(o[g],l),t=m(o[g],d),s=m(o[g],h);r(n[g],e/s,t/s)}u(h,h,M(i).radius),s.toRenderCoords(h,P(i),this.geodesicAreaCentroidRenderCoords),this._updateGeodesicIntersectingSegments(),this.geodesicArea=a&&0===this.geodesicIntersectingSegments.size?this._computeGeodesicArea(t):null}_updatePerimeterLengths(){const e=this.positionsFittedWorld,s=this.perimeterSegmentLengths;let i=0;for(let t=0;t<this._length;++t){i+=s[t]=h(e[t],e[(t+1)%this._length])}return t(i,this._lengthMeasurementUnit)}_updateIntersectingSegments(){const e=this.positionsFittedWorld,t=this.intersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],n=e[(s+1)%this._length],r=e[i],h=e[(i+1)%this._length];v(o,n,r,h)&&(t.add(s),t.add(i))}}_computeArea(){const e=this.positionsFittedWorld,t=this.triangleIndices=A(b(e));let s=0;for(let i=0;i<t.length;i+=3)s+=V(e[t[i]],e[t[i+1]],e[t[i+2]]);return i(s,this._areaMeasurementUnit)}_updateGeodesicIntersectingSegments(){const e=this.positionsStereographic,t=this.geodesicIntersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],n=e[(s+1)%this._length],r=e[i],h=e[(i+1)%this._length];v(o,n,r,h)&&(t.add(s),t.add(i))}}_computeGeodesicArea(e){const t=this.positionsGeodesic,o=this.positionsStereographic,n=this.geodesicTriangleIndices=A(b(o));let r=0;for(let i=0;i<n.length;i+=3){const o=F(t[n[i]],t[n[i+1]],t[n[i+2]],e,this._geodesicAreaMeasurementUtils);if(null==o)return null;r+=s(o,"square-meters").value}return i(r,"square-meters")}_selectFittingMode(t,s,i,o){const n=s.map(e=>Math.abs(y(t,e))).reduce((e,t)=>Math.max(e,t),0);G(s,this._tempSphere);const r=n/(2*this._tempSphere.radius),h=r<o.maxRelativeErrorCoplanar,a=r<o.maxRelativeErrorAlmostCoplanar;let l="horizontal";if(h)l="oblique";else if(a){l=Math.abs(m(i,t))>Math.cos(e(o.verticalAngleThreshold))?"horizontal":"vertical"}return l}_updateCursorSegmentLength(e,t){const s=e.lastPoint;e.isValidPolygon||null==s||null==t?(this.geodesicStagedSegmentLength=null,this.stagedSegmentLength=null):(this.geodesicStagedSegmentLength=this._geodesicLengthMeasurementUtils.geodesicDistanceBetweenPoints(s,t),this.stagedSegmentLength=E(s,t)?.direct)}_updateMode(e){if(0===e){this.actualMeasurementMode="euclidean";let e=0;null!=this.geodesicPathLength&&(e+=this.geodesicPathLength.value),e>Z&&(this.actualMeasurementMode="geodesic")}else this.actualMeasurementMode=1===e?"euclidean":"geodesic";null==this.geodesicPathLength&&(this.actualMeasurementMode="euclidean"),this._mode=e}}function k(e,t){t.hasZ||(t.z=T(e,t,"ground")??0)}const Z=1e5;export{H as MeasurementDataManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import{m as e,j as n,g as t,e as i,
|
|
5
|
+
import"../../../../core/has.js";import{m as e,j as n,g as t,e as i,D as o}from"../../../../chunks/vec32.js";import r from"../../../../geometry/Point.js";import{sv3d as a}from"../../../../geometry/support/vectorStacks.js";import{automaticHeadingFromCamera as s}from"./lengthDimensionManipulatorUtils.js";import{isGeodesicDimension as l,directUp as d,directStartToEnd as c}from"./lengthDimensionUtils.js";import{constraintThresholdPx as u}from"./settings.js";function m(e,n){return{enabled:n.effectiveFeatureEnabled,elevationAlignedStartPoint:e.elevationAlignedStartPoint,elevationAlignedEndPoint:e.elevationAlignedEndPoint,geometry:e.geometry}}function P(r,s){if(l(r))return 2;if(!r.enabled)return null;const{geometry:m}=r;if(null==m||e(m.directSegment.startRenderSpace,m.directSegment.endRenderSpace))return null;const{camera:P}=s.state,p=d(a.get(),m,s.renderCoordsHelper),f=c(a.get(),m),g=n(a.get(),p,t(f,p)),S=i(a.get(),f,g),v=o(S),y=o(g),{startRenderSpace:A,endRenderSpace:R}=m.directSegment,j=Math.max(P.computeScreenPixelSizeAt(A)*u,P.computeScreenPixelSizeAt(R)*u)**2;return v<j?1:y<j?0:null}function p(e,n,{constraint:t,view:i}){const{unconstrainedGeometry:o}=e;if(null==o)return;const{renderCoordsHelper:a,spatialReference:s}=i,{startRenderSpace:l,endRenderSpace:d}=o.directSegment,c=a.fromRenderCoords(l,new r({spatialReference:s})),u=a.fromRenderCoords(d,new r({spatialReference:s}));let m;m="start"===n?{startPoint:c}:{endPoint:u},f(e,m,{constraint:t,elevationAlignedStartPoint:e.elevationAlignedStartPoint,elevationAlignedEndPoint:e.elevationAlignedEndPoint,unconstrainedGeometry:o,view:i})}function f(e,n,t){const{constraint:i,elevationAlignedStartPoint:o,elevationAlignedEndPoint:r,unconstrainedGeometry:a,view:l}=t,{dimension:d,previousConstraint:c,preConstraintProperties:u}=e;if(null==o||null==r)return;const m=()=>{"startPoint"in n?d.startPoint=n.startPoint:"endPoint"in n&&(d.endPoint=n.endPoint)};if(null==i)m(),null!=c&&null!=u&&(d.measureType=u.measureType,d.orientation=u.orientation);else switch(d.measureType="direct",i){case 0:if(i!==c&&(d.orientation=0),"startPoint"in n){const e=n.startPoint;null!=e&&(e.z=r.z),d.startPoint=e}else if("endPoint"in n){const e=n.endPoint;null!=e&&(e.z=o.z),d.endPoint=e}break;case 1:if(i!==c&&(d.orientation=s(a,l)),"startPoint"in n){const e=n.startPoint;null!=e&&(e.x=r.x,e.y=r.y),d.startPoint=e}else if("endPoint"in n){const e=n.endPoint;null!=e&&(e.x=o.x,e.y=o.y),d.endPoint=e}break;case 2:i!==c&&null!=u&&(d.orientation=u.orientation),m()}e.previousConstraint=i,e.unconstrainedGeometry=a}export{f as applyConstraint,P as computeConstraint,m as constraintDependencies,p as reapplyConstraint};
|
|
@@ -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{deg2rad as e}from"../../../../core/mathUtils.js";import{toUnit as t}from"../../../../core/quantity.js";import{adaptiveVerticalLengthUnit as n,adaptiveLengthUnit as r}from"../../../../core/units.js";import{ensureType as i}from"../../../../core/accessorSupport/ensureType.js";import{fromRotation as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as s,
|
|
5
|
+
import{deg2rad as e}from"../../../../core/mathUtils.js";import{toUnit as t}from"../../../../core/quantity.js";import{adaptiveVerticalLengthUnit as n,adaptiveLengthUnit as r}from"../../../../core/units.js";import{ensureType as i}from"../../../../core/accessorSupport/ensureType.js";import{fromRotation as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as s,D as d,c,p as l,a as u,f as p,g as m,E as g,n as S,G as f}from"../../../../chunks/vec32.js";import{create as v,ZEROS as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import A from"../../../../geometry/Point.js";import{sv3d as P}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{clonePoint as h}from"../../../../layers/graphics/hydratedFeatures.js";import{EuclideanSegment as E}from"../../interactive/visualElements/support/Segment.js";import{euclideanDirectDistanceBetweenPoints as j,euclideanDirectDistance as w}from"../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistanceThreshold as x}from"../../../support/geodesicMeasurementUtils.js";class z{constructor(e,t,n,r,i,o){this.elevationAlignedStartPoint=e,this.elevationAlignedEndPoint=t,this.directSegment=n,this.dimensionSegment=r,this.primaryOffsetAxis=i,this.spatialReference=o}}const T=i(A);function b(e,i,o,a){if(null==e)return null;let s;if("horizontal"===i)s=a.autoDistanceBetweenPoints2D(T(e.elevationAlignedStartPoint),T(e.elevationAlignedEndPoint));else{const{startRenderSpace:t,endRenderSpace:n}=e.dimensionSegment;s=w(t,n,e.spatialReference)}if(null==s)return null;const d="vertical"===i?n(s.value,s.unit,o):r(s.value,s.unit,o);return t(s,d)}function C(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,dimension:{offset:r,measureType:i,orientation:o}}=e;return{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o}}function U({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,offset:n,measureType:r,orientation:i},o,a=null){if(null==e||null==t)return null;const d=H(a?.directSegment??new E,{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t},o),c=a?.primaryOffsetAxis??v();G(c,{measureType:r,elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,directSegment:d,orientation:i,renderCoordsHelper:o});const l=a?.dimensionSegment??new E;return J({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t})&&"vertical"===r?(s(l.startRenderSpace,d.startRenderSpace),s(l.endRenderSpace,d.endRenderSpace)):K(l,c,n,d,o),new z(e,t,d,l,c,o.spatialReference)}function k(e,t,n,r){return 0===t?(s(e.startRenderSpace,n.startRenderSpace),s(e.endRenderSpace,r.startRenderSpace)):(s(e.startRenderSpace,n.endRenderSpace),s(e.endRenderSpace,r.endRenderSpace)),e}function M(e,t,n,r){c(e.startRenderSpace,t.startRenderSpace,n,r),c(e.endRenderSpace,t.endRenderSpace,n,r)}function D(e,t,n,r){switch(t){case"direct":return H(e,n,r);case"horizontal":case"vertical":{const{elevationAlignedStartPoint:i,elevationAlignedEndPoint:o,dimension:a,geometry:s}=n;let d;if("direct"===a.measureType){d=O(s,r)===i.z>o.z,"horizontal"===t&&(d=!d)}else d=!B(s);const[c,l]=d?[i,o]:[o,i],u=h(l,I);return"horizontal"===t?u.z=c.z:(u.x=c.x,u.y=c.y),r.toRenderCoords(c,e.startRenderSpace),r.toRenderCoords(u,e.endRenderSpace),e}}}function H(e,t,n){return n.toRenderCoords(t.elevationAlignedStartPoint,e.startRenderSpace),n.toRenderCoords(t.elevationAlignedEndPoint,e.endRenderSpace),e}function O(e,t){const n=e.directSegment.eval(.5,P.get()),r=t.worldUpAtPosition(n,P.get()),i=e.dimensionSegment.eval(.5,P.get()),o=u(P.get(),i,n);return!g(o,R)&&m(o,r)>0}function B(e){const{startRenderSpace:t,endRenderSpace:n}=e.dimensionSegment,{startRenderSpace:r,endRenderSpace:i}=e.directSegment;return f(r,t)<f(i,n)}const I=y(0,0,0,null);function q(e,t,n,r){const{directSegment:i}=n,o=G(P.get(),{measureType:t,directSegment:i,renderCoordsHelper:r}),a=K(F,o,0,i,r).eval(.5,P.get()),s=u(P.get(),e,a);return m(s,o)*r.unitInMeters}const F=new E;function G(t,n){const{measureType:r,elevationAlignedStartPoint:i,elevationAlignedEndPoint:a,directSegment:{startRenderSpace:d,endRenderSpace:c},directSegment:f,renderCoordsHelper:v}=n,A=f.eval(.5,P.get()),y=v.worldUpAtPosition(A,P.get()),h=v.worldBasisAtPosition(A,1,P.get());switch(r){case"horizontal":s(t,y);break;case"vertical":m(d,y)<m(c,y)?u(t,c,d):u(t,d,c),p(t,t,y),p(t,t,y);break;case"direct":{const r=n.orientation??0;if(J({elevationAlignedStartPoint:i,elevationAlignedEndPoint:a}))o(L,-e(r),y),l(t,h,L);else{const n=u(P.get(),c,d),i=p(P.get(),n,y);p(i,i,n),o(L,e(r),n),l(t,i,L)}break}}return g(t,R)?s(t,h):S(t,t)}const L=a();function J({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}){return null!=e&&null!=t&&e.x===t.x&&e.y===t.y}function K(e,t,n,r,i){const{startRenderSpace:o,endRenderSpace:a}=r,s=n/i.unitInMeters,[d,l]=N(o,a,t,s);return c(e.startRenderSpace,r.startRenderSpace,t,d),c(e.endRenderSpace,r.endRenderSpace,t,l),e}function N(e,t,n,r=0){const i=m(t,n),o=m(e,n),a=Math.abs(i-o)+r;return i>o?[a,r]:[r,a]}function Q(e,t,n){const r=t.directSegment.eval(.5,P.get());return n.worldUpAtPosition(r,e)}function V(e,t){const{startRenderSpace:n,endRenderSpace:r}=t.directSegment;return u(e,r,n)}function W(e,t,n={invert:!1}){const{startRenderSpace:r,endRenderSpace:i}=t.dimensionSegment;return n.invert?u(e,r,i):u(e,i,r)}function X(e,t){const n=e.directSegment.eval(.5,P.get());return t.headingAtPosition(n,e.primaryOffsetAxis)}function Y(e,t){return d(W(Z,e))/t**2}const Z=v();function $(e){const{elevationAlignedStartPoint:n,elevationAlignedEndPoint:r}=e;if(null==n||null==r)return!1;const i=j(n,r);return null!=i&&t(i,"meters").value>x}function _(e){return null!=e.geometry}export{z as LengthDimensionGeometry,J as arePointsVerticallyAligned,C as computationToGeometryDependencies,U as computeGeometryFromDimension,b as computeLength,G as computeOffsetAxis,q as computeOffsetForPoint,D as computeSegmentForMeasureType,k as computeSpanningSegment,W as dimensionStartToEnd,V as directStartToEnd,Q as directUp,X as headingFromGeometry,$ as isGeodesicDimension,_ as isValidComputation,Y as maxScreenLengthSquaredFromGeometry,M as offsetSegment};
|
|
@@ -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{updatePointsFromFeatureReference as t,getFeatureId as n}from"../../../../analysis/featureReferenceUtils.js";import{createTask as o}from"../../../../core/asyncUtils.js";import{EventedAccessor as i}from"../../../../core/Evented.js";import r from"../../../../core/Handles.js";import{handlesGroup as s,makeHandle as a}from"../../../../core/handleUtils.js";import l from"../../../../core/Logger.js";import{abortMaybe as u}from"../../../../core/maybe.js";import{ignoreAbortErrors as d}from"../../../../core/promiseUtils.js";import{initial as c,on as p}from"../../../../core/reactiveUtils.js";import{property as g,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{d as v,e as m,n as f,j as _,i as b,H as y,a as C}from"../../../../chunks/vec32.js";import{create as T}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as O}from"../../../../core/support/UpdatingHandles.js";import P from"../../../../geometry/Point.js";import{projectOrLoad as I}from"../../../../geometry/projectionUtils.js";import{projectBoundingRect as S}from"../../../../geometry/projection/projectBoundingRect.js";import{intersectsSegment as j}from"../../../../geometry/support/aaBoundingBox.js";import{empty as w,containsPointObject as R,intersectsSegment as A}from"../../../../geometry/support/aaBoundingRect.js";import{fromPoints as H,create as E}from"../../../../geometry/support/ray.js";import{zValueInAbsoluteHeightMode as L}from"../../../../support/elevationInfoUtils.js";import V from"../LineOfSightAnalysisResult.js";import{LineOfSightComputation as F}from"./LineOfSightComputation.js";import{LineOfSightRayIntersector as x}from"./LineOfSightRayIntersector.js";import{logFailedGeometryProjectionError as D}from"../support/projectionUtils.js";import{toGraphic as G}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{ImmediateTask as U,TaskPriority as z}from"../../../support/Scheduler.js";let N=class extends i{constructor(e){super(e),this.updateOnCameraChange=!0,this._observerGroundOffsetRenderSpace=0,this._effectiveObserverElevationMode="absolute-height",this._observerFeatureId=null,this._updatingHandles=new O,this._frameTask=U,this._computationHandles=new r,this._externalObserverUpdate=!0}initialize(){const e=this.view.resourceController?.scheduler;this._frameTask=e?e.registerTask(z.LINE_OF_SIGHT_TOOL):U,this._intersector=new x({view:this.view}),this.addHandles([this._connectObserver(),this._connectComputations(),this._connectTargets()])}destroy(){this._computationHandles.destroy(),this._computations.removeAll(),this._updatingHandles.destroy()}get updating(){return this._frameTask.updating||this._updatingHandles.updating}get priority(){return this._frameTask.priority}set priority(e){this._frameTask.priority=e}get _computations(){return this.analysisViewData.computations}get _elevationAlignedObserverPositionRenderSpace(){return this.analysisViewData.observerEngineLocation}set _elevationAlignedObserverPositionRenderSpace(e){this.analysisViewData.observerEngineLocation=e}get _screenPixelSize(){return this.view.state.camera.computeScreenPixelSizeAt(this._elevationAlignedObserverPositionRenderSpace)}_computeResult(e){const t=e.computation,{inputPoints:n,computationResult:o}=t,{observerAdjusted:i,targetAdjusted:r}=n,{start:s,end:a}=o;v(s,i),v(a,r);this._canCompute(t)?this._computeIntersection(e):M(e),t.notifyResultChanged(),this.emit("result-changed",{target:e.computation.target,result:t.result})}_adjustStartEndPositions(e){const{view:n}=this,{inputPoints:o}=e,{observer:i,target:r,observerAdjusted:s,targetAdjusted:a}=o;v(s,i),v(a,r),t(n,this._intersector.intersector,o);const{observerSurfaceNormal:l,targetSurfaceNormal:u}=o,d=this._screenPixelSize,c=Z;null!=l?v(c,l):m(c,a,s);const p=d;f(c,c),_(c,c,Math.min(p,1)),b(s,s,c),null!=u?v(c,u):m(c,s,a);const g=n.state.camera.computeScreenPixelSizeAt(a);f(c,c),_(c,c,Math.min(g,1)),b(a,a,c)}_computeIntersection({computation:e,interpolationInfo:t}){const{view:n}=this,{sceneIntersectionHelper:o,renderCoordsHelper:i}=n;if(null==o)return;const r=this._intersector.intersector,{computationResult:s,inputPoints:a}=e,{observer:l,target:u}=a,{start:d,end:c}=s,p=H(d,c,q);r.options.store=0,o.intersectToolIntersectorRay(p,r);const g=r.results.min,h=s.intersection,m=Z;let f=!0;if(null!=g&&g.getIntersectionPoint(h)){v(t.originalIntersection,h),v(t.originalObserver,d),v(t.originalTarget,c),i.fromRenderCoords(h,m,n.spatialReference);const e=1-y(c,u)/y(d,u);f=y(l,h)>=e*y(l,u)}const _=new P(m,n.spatialReference);{const{result:t,target:o}=e;null!=t?(t.target=o,t.intersectedGraphic=f?null:G(g,n),t.intersectedLocation=f?null:_,t.visible=f):e.result=new V({target:o,elevationAlignedTargetLocation:e.elevationAlignedTargetLocation,intersectedGraphic:f?null:G(g,n),intersectedLocation:f?null:_,visible:f})}s.isValid=a.isValid=!0,s.isTargetVisible=f}_canCompute(e){const t=this.analysisViewData.elevationAlignedObserver,{frustum:n}=this.view;if(null==t||null==e.elevationAlignedTargetLocation||null==n)return!1;const{observerAdjusted:o,targetAdjusted:i}=e.inputPoints,r=n.intersectsPoint(o),s=n.intersectsPoint(i);return r&&s}_onObserverPositionChange(e,t,o,i,r){if(this._externalObserverUpdate=r,null==e)return this.analysisViewData.elevationAlignedObserver=null,void(this._observerFeatureId=null);if(null==t)return D(this.analysis,e.spatialReference,l.getLogger(this)),void(this.analysisViewData.elevationAlignedObserver=null);const s=k(t,o),{absoluteZ:a,elevation:u}=L(t.x,t.y,t.z,this.view.spatialReference,this.view,s),d=t.clone();d.z=a,this._effectiveObserverElevationMode=s.mode,this.analysisViewData.elevationAlignedObserver=d;const c=T();this.view.renderCoordsHelper.toRenderCoords(d,c),this._elevationAlignedObserverPositionRenderSpace=c,this._observerGroundOffsetRenderSpace=a-u,this._observerFeatureId=n(i),this.priority=z.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onObserverRenderSpacePositionChangeForComputation(e,t,n,o,i){const{inputPoints:r}=e;switch(v(r.observer,t),r.observerFeatureId=i,r.observerSurfaceNormal=null,o){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(r.observer,n,r.observer);null==r.observerFeatureId&&(r.observerSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=z.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetPositionChange(e,t,o,i,r,s=!0){const a=e.inputPoints;if(s&&(a.isValid=!1),null==o)return null!=t&&D(this.analysis,t.spatialReference,l.getLogger(this)),e.elevationAlignedTargetLocation=null,void e.notifyInputPointsChanged();const u=k(o,i),{absoluteZ:d,elevation:c}=L(o.x,o.y,o.z,this.view.spatialReference,this.view,u),p=o.clone();switch(p.z=d,e.elevationAlignedTargetLocation=p,this.view.renderCoordsHelper.toRenderCoords(e.elevationAlignedTargetLocation,a.target),a.targetFeatureId=n(r),a.targetSurfaceNormal=null,u.mode){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(a.target,d-c,a.target);null==a.targetFeatureId&&(a.targetSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=z.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectComputationToTarget(e){return s([this._updatingHandles.add(()=>({computation:e,targetPosition:e.target.position,targetElevationInfo:e.target.elevationInfo,targetFeatureInfo:e.target.feature,projectedTargetPosition:I(e.target.position,this.view.spatialReference)}),({computation:e,targetPosition:t,targetElevationInfo:n,targetFeatureInfo:o,projectedTargetPosition:i})=>{null==i.pending?this._onTargetPositionChange(e,t,i.geometry,n,o):this._updatingHandles.addPromise(i.pending)},c)])}_connectComputationToObserver(e){return this._updatingHandles.add(()=>({computation:e,observer:this.analysisViewData.elevationAlignedObserver}),({computation:e})=>{this._externalObserverUpdate&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())},c)}_connectComputationToRenderSpaceObserver(e){return this._updatingHandles.add(()=>({computation:e,observer:this._elevationAlignedObserverPositionRenderSpace,observerGroundOffset:this._observerGroundOffsetRenderSpace,observerElevationMode:this._effectiveObserverElevationMode,observerFeatureId:this._observerFeatureId}),({computation:e,observer:t,observerGroundOffset:n,observerElevationMode:o,observerFeatureId:i})=>{this._onObserverRenderSpacePositionChangeForComputation(e,t,n,o,i)},c)}_connectComputationToCamera(e){return this._updatingHandles.add(()=>({camera:this.view.state.camera,isDirty:this._isCameraDirty}),({isDirty:t})=>{!this.updateOnCameraChange||e.inputPoints.isValid&&!t||e.notifyInputPointsChanged()})}_connectComputationToSlicePlane(e){return this._updatingHandles.add(()=>this.view.slice.plane,()=>{e.inputPoints.isValid=!1,e.notifyInputPointsChanged()})}_connectComputationToElevation(e){const t=(n,o)=>{const i=this.analysis.observer,r=e.target;let s=null,a=null,l=null,u=null,d=null,c=null;if(null!=i?.position){const e=I(i.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally(()=>t(n,o));s=e.geometry,a=i.elevationInfo,l=i.feature}if(null!=r.position){const e=I(r.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally(()=>t(n,o));u=e.geometry,d=r.elevationInfo,c=r.feature}null==s&&null==u||(S(n,o,J,this.view.spatialReference),null!=s&&R(J,s)&&this._onObserverPositionChange(null!=i?i.position:null,s,a,l,!1),null!=u&&R(J,u)&&this._onTargetPositionChange(e,r.position,u,d,c,!1),null!=s&&null!=u&&A(J,s,u)&&e.notifyInputPointsChanged())};return this.view.elevationProvider.on("elevation-change",({extent:e,spatialReference:n})=>t(e,n))}_connectComputationToTask(e){let t=null;const n={computation:e,interpolationInfo:{originalIntersection:T(),originalObserver:T(),originalTarget:T()}};return s([this._updatingHandles.add(()=>e.inputPoints,()=>{t=u(t),t=o(async e=>{await d(this._frameTask.schedule(()=>this._computeResult(n),e))})},{initial:!0,equals:()=>!1}),a(()=>t=u(t))])}_connectComputationToContent(e){return p(()=>this.view.pointsOfInterest?.contentGeometryUpdates.events,"request-update",t=>{const n=t?.renderBounds,{observerAdjusted:o,targetAdjusted:i}=e.inputPoints;(null==n||j(n,o,i))&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())})}_connectComputation(e){const t=this._computationHandles;t.has(e)||t.add([this._connectComputationToTarget(e),this._connectComputationToObserver(e),this._connectComputationToRenderSpaceObserver(e),this._connectComputationToCamera(e),this._connectComputationToSlicePlane(e),this._connectComputationToElevation(e),this._connectComputationToTask(e),this._connectComputationToContent(e)],e)}_disconnectComputation(e){this._computationHandles.remove(e)}_onComputationCollectionChange({added:e,removed:t}){for(const n of t)this._disconnectComputation(n);for(const n of e)this._connectComputation(n)}_onTargetCollectionChange({added:e,removed:t}){for(const n of t)this._removeTarget(n);for(const n of e)this._addTarget(n)}_onCursorTargetChange(e,t){null!=t&&this._removeTarget(t),null!=e&&this._addTarget(e)}_addTarget(e){this._computations.some(t=>t.target===e)||this._computations.add(new F({target:e}))}_removeTarget(e){const t=this._computations.findIndex(t=>t.target===e);this._computations.removeAt(t)}_connectObserver(){return s([this._updatingHandles.add(()=>({observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,projectedObserverPosition:I(null!=this.analysis.observer?this.analysis.observer.position:null,this.view.spatialReference),observerElevationInfo:null!=this.analysis.observer?this.analysis.observer.elevationInfo:null,observerFeatureInfo:null!=this.analysis.observer?this.analysis.observer.feature:null}),({observerPosition:e,projectedObserverPosition:t,observerElevationInfo:n,observerFeatureInfo:o})=>{null==t.pending?this._onObserverPositionChange(e,t.geometry,n,o,!0):this._updatingHandles.addPromise(t.pending)},c)])}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this._computations,e=>this._onComputationCollectionChange(e),{initial:!0,final:!0})}_connectTargets(){return s([this._updatingHandles.addOnCollectionChange(()=>this.analysis.targets,e=>this._onTargetCollectionChange(e),{initial:!0,final:!0}),this._updatingHandles.add(()=>this.analysisViewData.cursorTarget,(e,t)=>{this._onCursorTargetChange(e,t)})])}get _isCameraDirty(){const e=this.analysisViewData.elevationAlignedObserver,{view:t}=this,{renderCoordsHelper:n}=t;if(null==e||null==n)return!1;const o=Z;n.toRenderCoords(e,o);const i=t.state.camera.computeScreenPixelSizeAt(o);return Math.abs((i-this._screenPixelSize)/this._screenPixelSize)>B}};function k(e,t){return e.hasZ?t??{mode:"absolute-height",offset:0}:{mode:"on-the-ground",offset:0}}function M({computation:e,interpolationInfo:t}){const{computationResult:n,inputPoints:o}=e,{start:i,end:r,intersection:s}=n,{originalIntersection:a,originalObserver:l,originalTarget:u}=t;if(v(s,a),o.isValid){const e=Z,t=y(l,a)/y(l,u);C(e,i,l),_(e,e,1-t),b(s,s,e),C(e,r,u),_(e,e,t),b(s,s,e),n.isValid=!0}else e.result=null,n.isValid=!1,n.isTargetVisible=!1}e([g({constructOnly:!0})],N.prototype,"analysis",void 0),e([g({constructOnly:!0})],N.prototype,"analysisViewData",void 0),e([g({constructOnly:!0})],N.prototype,"view",void 0),e([g()],N.prototype,"updating",null),e([g()],N.prototype,"priority",null),e([g()],N.prototype,"updateOnCameraChange",void 0),e([g()],N.prototype,"_computations",null),e([g()],N.prototype,"_elevationAlignedObserverPositionRenderSpace",null),e([g()],N.prototype,"_observerGroundOffsetRenderSpace",void 0),e([g()],N.prototype,"_effectiveObserverElevationMode",void 0),e([g()],N.prototype,"_observerFeatureId",void 0),e([g()],N.prototype,"_screenPixelSize",null),e([g({readOnly:!0})],N.prototype,"_updatingHandles",void 0),e([g()],N.prototype,"_frameTask",void 0),e([g()],N.prototype,"_isCameraDirty",null),N=e([h("esri.views.3d.analysis.LineOfSight.LineOfSightController")],N);const B=.1,Z=T(),q=E(),J=w();export{N as LineOfSightController};
|
|
5
|
+
import{__decorate as e}from"tslib";import{updatePointsFromFeatureReference as t,getFeatureId as n}from"../../../../analysis/featureReferenceUtils.js";import{createTask as o}from"../../../../core/asyncUtils.js";import{EventedAccessor as i}from"../../../../core/Evented.js";import r from"../../../../core/Handles.js";import{handlesGroup as s,makeHandle as a}from"../../../../core/handleUtils.js";import l from"../../../../core/Logger.js";import{abortMaybe as u}from"../../../../core/maybe.js";import{ignoreAbortErrors as d}from"../../../../core/promiseUtils.js";import{initial as c,on as p}from"../../../../core/reactiveUtils.js";import{property as g,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{d as v,e as m,n as f,j as _,i as b,F as y,a as C}from"../../../../chunks/vec32.js";import{create as T}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as O}from"../../../../core/support/UpdatingHandles.js";import P from"../../../../geometry/Point.js";import{projectOrLoad as I}from"../../../../geometry/projectionUtils.js";import{projectBoundingRect as S}from"../../../../geometry/projection/projectBoundingRect.js";import{intersectsSegment as j}from"../../../../geometry/support/aaBoundingBox.js";import{empty as w,containsPointObject as R,intersectsSegment as A}from"../../../../geometry/support/aaBoundingRect.js";import{fromPoints as H,create as E}from"../../../../geometry/support/ray.js";import{zValueInAbsoluteHeightMode as L}from"../../../../support/elevationInfoUtils.js";import V from"../LineOfSightAnalysisResult.js";import{LineOfSightComputation as F}from"./LineOfSightComputation.js";import{LineOfSightRayIntersector as x}from"./LineOfSightRayIntersector.js";import{logFailedGeometryProjectionError as D}from"../support/projectionUtils.js";import{toGraphic as G}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{ImmediateTask as U,TaskPriority as z}from"../../../support/Scheduler.js";let N=class extends i{constructor(e){super(e),this.updateOnCameraChange=!0,this._observerGroundOffsetRenderSpace=0,this._effectiveObserverElevationMode="absolute-height",this._observerFeatureId=null,this._updatingHandles=new O,this._frameTask=U,this._computationHandles=new r,this._externalObserverUpdate=!0}initialize(){const e=this.view.resourceController?.scheduler;this._frameTask=e?e.registerTask(z.LINE_OF_SIGHT_TOOL):U,this._intersector=new x({view:this.view}),this.addHandles([this._connectObserver(),this._connectComputations(),this._connectTargets()])}destroy(){this._computationHandles.destroy(),this._computations.removeAll(),this._updatingHandles.destroy()}get updating(){return this._frameTask.updating||this._updatingHandles.updating}get priority(){return this._frameTask.priority}set priority(e){this._frameTask.priority=e}get _computations(){return this.analysisViewData.computations}get _elevationAlignedObserverPositionRenderSpace(){return this.analysisViewData.observerEngineLocation}set _elevationAlignedObserverPositionRenderSpace(e){this.analysisViewData.observerEngineLocation=e}get _screenPixelSize(){return this.view.state.camera.computeScreenPixelSizeAt(this._elevationAlignedObserverPositionRenderSpace)}_computeResult(e){const t=e.computation,{inputPoints:n,computationResult:o}=t,{observerAdjusted:i,targetAdjusted:r}=n,{start:s,end:a}=o;v(s,i),v(a,r);this._canCompute(t)?this._computeIntersection(e):M(e),t.notifyResultChanged(),this.emit("result-changed",{target:e.computation.target,result:t.result})}_adjustStartEndPositions(e){const{view:n}=this,{inputPoints:o}=e,{observer:i,target:r,observerAdjusted:s,targetAdjusted:a}=o;v(s,i),v(a,r),t(n,this._intersector.intersector,o);const{observerSurfaceNormal:l,targetSurfaceNormal:u}=o,d=this._screenPixelSize,c=Z;null!=l?v(c,l):m(c,a,s);const p=d;f(c,c),_(c,c,Math.min(p,1)),b(s,s,c),null!=u?v(c,u):m(c,s,a);const g=n.state.camera.computeScreenPixelSizeAt(a);f(c,c),_(c,c,Math.min(g,1)),b(a,a,c)}_computeIntersection({computation:e,interpolationInfo:t}){const{view:n}=this,{sceneIntersectionHelper:o,renderCoordsHelper:i}=n;if(null==o)return;const r=this._intersector.intersector,{computationResult:s,inputPoints:a}=e,{observer:l,target:u}=a,{start:d,end:c}=s,p=H(d,c,q);r.options.store=0,o.intersectToolIntersectorRay(p,r);const g=r.results.min,h=s.intersection,m=Z;let f=!0;if(null!=g&&g.getIntersectionPoint(h)){v(t.originalIntersection,h),v(t.originalObserver,d),v(t.originalTarget,c),i.fromRenderCoords(h,m,n.spatialReference);const e=1-y(c,u)/y(d,u);f=y(l,h)>=e*y(l,u)}const _=new P(m,n.spatialReference);{const{result:t,target:o}=e;null!=t?(t.target=o,t.intersectedGraphic=f?null:G(g,n),t.intersectedLocation=f?null:_,t.visible=f):e.result=new V({target:o,elevationAlignedTargetLocation:e.elevationAlignedTargetLocation,intersectedGraphic:f?null:G(g,n),intersectedLocation:f?null:_,visible:f})}s.isValid=a.isValid=!0,s.isTargetVisible=f}_canCompute(e){const t=this.analysisViewData.elevationAlignedObserver,{frustum:n}=this.view;if(null==t||null==e.elevationAlignedTargetLocation||null==n)return!1;const{observerAdjusted:o,targetAdjusted:i}=e.inputPoints,r=n.intersectsPoint(o),s=n.intersectsPoint(i);return r&&s}_onObserverPositionChange(e,t,o,i,r){if(this._externalObserverUpdate=r,null==e)return this.analysisViewData.elevationAlignedObserver=null,void(this._observerFeatureId=null);if(null==t)return D(this.analysis,e.spatialReference,l.getLogger(this)),void(this.analysisViewData.elevationAlignedObserver=null);const s=k(t,o),{absoluteZ:a,elevation:u}=L(t.x,t.y,t.z,this.view.spatialReference,this.view,s),d=t.clone();d.z=a,this._effectiveObserverElevationMode=s.mode,this.analysisViewData.elevationAlignedObserver=d;const c=T();this.view.renderCoordsHelper.toRenderCoords(d,c),this._elevationAlignedObserverPositionRenderSpace=c,this._observerGroundOffsetRenderSpace=a-u,this._observerFeatureId=n(i),this.priority=z.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onObserverRenderSpacePositionChangeForComputation(e,t,n,o,i){const{inputPoints:r}=e;switch(v(r.observer,t),r.observerFeatureId=i,r.observerSurfaceNormal=null,o){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(r.observer,n,r.observer);null==r.observerFeatureId&&(r.observerSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=z.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetPositionChange(e,t,o,i,r,s=!0){const a=e.inputPoints;if(s&&(a.isValid=!1),null==o)return null!=t&&D(this.analysis,t.spatialReference,l.getLogger(this)),e.elevationAlignedTargetLocation=null,void e.notifyInputPointsChanged();const u=k(o,i),{absoluteZ:d,elevation:c}=L(o.x,o.y,o.z,this.view.spatialReference,this.view,u),p=o.clone();switch(p.z=d,e.elevationAlignedTargetLocation=p,this.view.renderCoordsHelper.toRenderCoords(e.elevationAlignedTargetLocation,a.target),a.targetFeatureId=n(r),a.targetSurfaceNormal=null,u.mode){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(a.target,d-c,a.target);null==a.targetFeatureId&&(a.targetSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=z.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectComputationToTarget(e){return s([this._updatingHandles.add(()=>({computation:e,targetPosition:e.target.position,targetElevationInfo:e.target.elevationInfo,targetFeatureInfo:e.target.feature,projectedTargetPosition:I(e.target.position,this.view.spatialReference)}),({computation:e,targetPosition:t,targetElevationInfo:n,targetFeatureInfo:o,projectedTargetPosition:i})=>{null==i.pending?this._onTargetPositionChange(e,t,i.geometry,n,o):this._updatingHandles.addPromise(i.pending)},c)])}_connectComputationToObserver(e){return this._updatingHandles.add(()=>({computation:e,observer:this.analysisViewData.elevationAlignedObserver}),({computation:e})=>{this._externalObserverUpdate&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())},c)}_connectComputationToRenderSpaceObserver(e){return this._updatingHandles.add(()=>({computation:e,observer:this._elevationAlignedObserverPositionRenderSpace,observerGroundOffset:this._observerGroundOffsetRenderSpace,observerElevationMode:this._effectiveObserverElevationMode,observerFeatureId:this._observerFeatureId}),({computation:e,observer:t,observerGroundOffset:n,observerElevationMode:o,observerFeatureId:i})=>{this._onObserverRenderSpacePositionChangeForComputation(e,t,n,o,i)},c)}_connectComputationToCamera(e){return this._updatingHandles.add(()=>({camera:this.view.state.camera,isDirty:this._isCameraDirty}),({isDirty:t})=>{!this.updateOnCameraChange||e.inputPoints.isValid&&!t||e.notifyInputPointsChanged()})}_connectComputationToSlicePlane(e){return this._updatingHandles.add(()=>this.view.slice.plane,()=>{e.inputPoints.isValid=!1,e.notifyInputPointsChanged()})}_connectComputationToElevation(e){const t=(n,o)=>{const i=this.analysis.observer,r=e.target;let s=null,a=null,l=null,u=null,d=null,c=null;if(null!=i?.position){const e=I(i.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally(()=>t(n,o));s=e.geometry,a=i.elevationInfo,l=i.feature}if(null!=r.position){const e=I(r.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally(()=>t(n,o));u=e.geometry,d=r.elevationInfo,c=r.feature}null==s&&null==u||(S(n,o,J,this.view.spatialReference),null!=s&&R(J,s)&&this._onObserverPositionChange(null!=i?i.position:null,s,a,l,!1),null!=u&&R(J,u)&&this._onTargetPositionChange(e,r.position,u,d,c,!1),null!=s&&null!=u&&A(J,s,u)&&e.notifyInputPointsChanged())};return this.view.elevationProvider.on("elevation-change",({extent:e,spatialReference:n})=>t(e,n))}_connectComputationToTask(e){let t=null;const n={computation:e,interpolationInfo:{originalIntersection:T(),originalObserver:T(),originalTarget:T()}};return s([this._updatingHandles.add(()=>e.inputPoints,()=>{t=u(t),t=o(async e=>{await d(this._frameTask.schedule(()=>this._computeResult(n),e))})},{initial:!0,equals:()=>!1}),a(()=>t=u(t))])}_connectComputationToContent(e){return p(()=>this.view.pointsOfInterest?.contentGeometryUpdates.events,"request-update",t=>{const n=t?.renderBounds,{observerAdjusted:o,targetAdjusted:i}=e.inputPoints;(null==n||j(n,o,i))&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())})}_connectComputation(e){const t=this._computationHandles;t.has(e)||t.add([this._connectComputationToTarget(e),this._connectComputationToObserver(e),this._connectComputationToRenderSpaceObserver(e),this._connectComputationToCamera(e),this._connectComputationToSlicePlane(e),this._connectComputationToElevation(e),this._connectComputationToTask(e),this._connectComputationToContent(e)],e)}_disconnectComputation(e){this._computationHandles.remove(e)}_onComputationCollectionChange({added:e,removed:t}){for(const n of t)this._disconnectComputation(n);for(const n of e)this._connectComputation(n)}_onTargetCollectionChange({added:e,removed:t}){for(const n of t)this._removeTarget(n);for(const n of e)this._addTarget(n)}_onCursorTargetChange(e,t){null!=t&&this._removeTarget(t),null!=e&&this._addTarget(e)}_addTarget(e){this._computations.some(t=>t.target===e)||this._computations.add(new F({target:e}))}_removeTarget(e){const t=this._computations.findIndex(t=>t.target===e);this._computations.removeAt(t)}_connectObserver(){return s([this._updatingHandles.add(()=>({observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,projectedObserverPosition:I(null!=this.analysis.observer?this.analysis.observer.position:null,this.view.spatialReference),observerElevationInfo:null!=this.analysis.observer?this.analysis.observer.elevationInfo:null,observerFeatureInfo:null!=this.analysis.observer?this.analysis.observer.feature:null}),({observerPosition:e,projectedObserverPosition:t,observerElevationInfo:n,observerFeatureInfo:o})=>{null==t.pending?this._onObserverPositionChange(e,t.geometry,n,o,!0):this._updatingHandles.addPromise(t.pending)},c)])}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this._computations,e=>this._onComputationCollectionChange(e),{initial:!0,final:!0})}_connectTargets(){return s([this._updatingHandles.addOnCollectionChange(()=>this.analysis.targets,e=>this._onTargetCollectionChange(e),{initial:!0,final:!0}),this._updatingHandles.add(()=>this.analysisViewData.cursorTarget,(e,t)=>{this._onCursorTargetChange(e,t)})])}get _isCameraDirty(){const e=this.analysisViewData.elevationAlignedObserver,{view:t}=this,{renderCoordsHelper:n}=t;if(null==e||null==n)return!1;const o=Z;n.toRenderCoords(e,o);const i=t.state.camera.computeScreenPixelSizeAt(o);return Math.abs((i-this._screenPixelSize)/this._screenPixelSize)>B}};function k(e,t){return e.hasZ?t??{mode:"absolute-height",offset:0}:{mode:"on-the-ground",offset:0}}function M({computation:e,interpolationInfo:t}){const{computationResult:n,inputPoints:o}=e,{start:i,end:r,intersection:s}=n,{originalIntersection:a,originalObserver:l,originalTarget:u}=t;if(v(s,a),o.isValid){const e=Z,t=y(l,a)/y(l,u);C(e,i,l),_(e,e,1-t),b(s,s,e),C(e,r,u),_(e,e,t),b(s,s,e),n.isValid=!0}else e.result=null,n.isValid=!1,n.isTargetVisible=!1}e([g({constructOnly:!0})],N.prototype,"analysis",void 0),e([g({constructOnly:!0})],N.prototype,"analysisViewData",void 0),e([g({constructOnly:!0})],N.prototype,"view",void 0),e([g()],N.prototype,"updating",null),e([g()],N.prototype,"priority",null),e([g()],N.prototype,"updateOnCameraChange",void 0),e([g()],N.prototype,"_computations",null),e([g()],N.prototype,"_elevationAlignedObserverPositionRenderSpace",null),e([g()],N.prototype,"_observerGroundOffsetRenderSpace",void 0),e([g()],N.prototype,"_effectiveObserverElevationMode",void 0),e([g()],N.prototype,"_observerFeatureId",void 0),e([g()],N.prototype,"_screenPixelSize",null),e([g({readOnly:!0})],N.prototype,"_updatingHandles",void 0),e([g()],N.prototype,"_frameTask",void 0),e([g()],N.prototype,"_isCameraDirty",null),N=e([h("esri.views.3d.analysis.LineOfSight.LineOfSightController")],N);const B=.1,Z=T(),q=E(),J=w();export{N as LineOfSightController};
|
|
@@ -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 o from"../../../../core/Accessor.js";import{equals as r}from"../../../../core/arrayUtils.js";import{equalsMaybe as s}from"../../../../core/maybe.js";import{property as e,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{
|
|
5
|
+
import{__decorate as t}from"tslib";import o from"../../../../core/Accessor.js";import{equals as r}from"../../../../core/arrayUtils.js";import{equalsMaybe as s}from"../../../../core/maybe.js";import{property as e,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{E as n}from"../../../../chunks/vec32.js";import{equals as c}from"../../../../geometry/support/ray.js";let p=class extends o{constructor(t){super(t)}clone(){return this}equals(t){return this.context?.type===t.context?.type&&(!this.context||!t.context||this.context.equals(t.context))&&this.id===t.id&&s(this.mapPoint,t.mapPoint)&&n(this.renderPoint,t.renderPoint)&&r(this.normal,t.normal)&&c(this.ray,t.ray)}};t([e({constructOnly:!0})],p.prototype,"context",void 0),t([e({constructOnly:!0})],p.prototype,"id",void 0),t([e({constructOnly:!0})],p.prototype,"mapPoint",void 0),t([e({constructOnly:!0})],p.prototype,"renderPoint",void 0),t([e({constructOnly:!0})],p.prototype,"normal",void 0),t([e({constructOnly:!0})],p.prototype,"ray",void 0),p=t([i("esri.views.3d.analysis.LineOfSight.LineOfSightIntersectionResult")],p);class a{constructor(t){this.graphic=t,this.type="graphic"}equals(t){return t.type===this.type&&this.graphic===t.graphic}}class y{constructor(){this.type="ground"}equals(t){return t.type===this.type}}const u=new y;export{a as LineOfSightIntersectionContextGraphic,p as LineOfSightIntersectionResult,u as lineOfSightIntersectionContextGround};
|
|
@@ -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 i from"../../../../analysis/SlicePlane.js";import"../../../../core/has.js";import e from"../../../../core/Logger.js";import{rad2deg as t,deg2rad as n}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{fromZRotation as s,scale as r,multiply as a,rotateZ as c,rotateX as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{b as u,h as d,i as g,j as m,d as p,e as f,g as b,n as h,f as j,
|
|
5
|
+
import i from"../../../../analysis/SlicePlane.js";import"../../../../core/has.js";import e from"../../../../core/Logger.js";import{rad2deg as t,deg2rad as n}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{fromZRotation as s,scale as r,multiply as a,rotateZ as c,rotateX as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{b as u,h as d,i as g,j as m,d as p,e as f,g as b,n as h,f as j,D as w,a as v}from"../../../../chunks/vec32.js";import{clone as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import M from"../../../../geometry/Extent.js";import U from"../../../../geometry/Point.js";import{tryProject as y}from"../../../../geometry/projectionUtils.js";import{d as R,r as x,n as S,u as T,f as A,i as C}from"../../../../chunks/boundedPlane.js";import{fromPositionAndNormal as k,fromVectorsAndPoint as L}from"../../../../geometry/support/plane.js";import{create as E}from"../../../../geometry/support/ray.js";import{angleAroundAxis as H}from"../../../../geometry/support/vector.js";import{sv3d as I,sm4d as z}from"../../../../geometry/support/vectorStacks.js";import{getGridColor as F,planeColor as D,getOutlineColor as W}from"./settings.js";import{resizeHandleEdgePaddingFrac as B,planeOutlineWidth as O,planeMinBasisScreenLen2 as V,initialPlaneHalfSizeViewProportion as $,shiftRestartOffsetDistance as q,smallAngleDotThreshold as G,verticalDotThreshold as J}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as K}from"../support/projectionUtils.js";import{calculateTranslateRotateFromBases as N}from"../../interactive/manipulatorUtils.js";import{LineVisualElement as Q}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as X}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as Y}from"../../support/RenderCoordsHelper.js";import{fromRender as Z}from"../../support/geometryUtils/ray.js";function _(i,e,t,n,o,s,r,a){return ii(e,r.worldUpAtPosition(i,I.get()),o,s,a.basis1,a.basis2),m(a.basis1,a.basis1,t),m(a.basis2,a.basis2,n),p(a.origin,i),L(a.basis2,a.basis1,a.origin,a.plane),a}function ii(i,e,t,n,o,s){const r=b(i,e),a=I.get(),c=I.get();switch(0===n?Math.abs(r)>J?1:2:n){case 2:{const n=Math.abs(r)<=G?i:t.viewUp;j(a,n,e),p(c,e);break}case 1:j(a,t.viewUp,e),j(c,e,a);break;case 3:{const n=Math.abs(r)<=G?e:t.viewUp;j(a,n,i),j(c,i,a);break}}const l=j(I.get(),a,c);b(l,t.viewForward)>0&&m(c,c,-1),h(o,a),h(s,c)}function ei(i,e,t){const n=e.worldUpAtPosition(i.origin,I.get()),o=i.basis1,s=Pi(i,n),r=Math.round(s/Ai)*Ai;return x(i,r-s,o,t)}function ti(i,e,t,n,o,s){const r=p(I.get(),o.origin);g(r,r,m(I.get(),o.basis1,i.direction[0]<0?1:-1)),g(r,r,m(I.get(),o.basis2,i.direction[1]<0?1:-1));const a=u(o.basis1),c=u(o.basis2),l=f(I.get(),t,r),d=f(I.get(),e,r);let h=0,j=0;if(bi(i)){const e=fi(o),t=fi(s);h=a-.5*i.direction[0]*b(o.basis1,d)/a,j=c-.5*i.direction[1]*b(o.basis2,d)/c;const n=t/e;h*=n,j*=n}const w=h+.5*i.direction[0]*b(o.basis1,l)/a,v=j+.5*i.direction[1]*b(o.basis2,l)/c,P=m(I.get(),o.basis1,w/a),M=m(I.get(),o.basis2,v/c);(w<=0||mi(s.origin,P,n)<=V)&&p(P,s.basis1),(v<=0||mi(s.origin,M,n)<=V)&&p(M,s.basis2);const U=p(I.get(),r);return g(U,U,m(I.get(),P,i.direction[0]<0?-1:1)),g(U,U,m(I.get(),M,i.direction[1]<0?-1:1)),A(U,P,M,s)}function ni(i,e){return $*Math.min(e.width,e.height)*e.computeRenderPixelSizeAt(i)}function oi(i,e,t,n){const o=j(I.get(),e,t);return j(o,o,e),k(i,o,n)}function si(i,e){return N(i.basis1,i.basis2,i.origin,e)}function ri(i,e,t,n){const o=e.worldUpAtPosition(i.origin,I.get()),s=I.get();switch(t){case 1:p(s,o);break;case 2:p(s,i.basis1)}return k(i.origin,s,n)}function ai(i,e,t,n){const s=gi(t,2),r=z.get();c(r,e,s.edge*Math.PI/2);const a=h(I.get(),s.basis);let l=m(I.get(),a,s.direction*n.computeScreenPixelSizeAt(s.position)*q);g(l,l,s.position);const u=n.projectToRenderScreen(l,o(I.get())),d=ci(n,u);Z(n,u,Ti),h(Ti.direction,Ti.direction);const p=I.get();!d&&C(t,Ti,p)&&(l=p),r[12]=0,r[13]=0,r[14]=0,i.modelTransform=r,i.renderLocation=P(l),d?i.state|=Si:i.state&=~Si}function ci(i,e){if(null==e)return!1;const[t,n,o,s]=i.viewport,r=Math.min(o,s)/16;let a=!0;return e[0]<t+r?(e[0]=t+r,a=!1):e[0]>t+o-r&&(e[0]=t+o-r,a=!1),e[1]<n+r?(e[1]=n+r,a=!1):e[1]>n+s-r&&(e[1]=n+s-r,a=!1),a}function li(i,e,t,n){const o=u(n.basis1),c=u(n.basis2),l=pi(n),p=fi(n),f=d(I.get(),0,0,0);g(f,m(I.get(),n.basis1,e.direction[0]),m(I.get(),n.basis2,e.direction[1])),g(f,n.origin,f);let b=0,h=1;if(bi(e))1===e.direction[0]&&-1===e.direction[1]?b=Ai:1===e.direction[0]&&1===e.direction[1]?b=Math.PI:-1===e.direction[0]&&1===e.direction[1]&&(b=3*Math.PI/2),h=p;else{const i=0!==e.direction[0]?1:2;b=1===i?Ai:0,h=(1===i?c:o)-l}const j=s(z.get(),b);r(j,j,d(I.get(),h,h,h)),a(j,t,j),j[12]=0,j[13]=0,j[14]=0,i.modelTransform=j,i.renderLocation=f}function ui(i,e,t,n){const o=n.worldUpAtPosition(t.origin,I.get()),r=gi(t,0),c=s(z.get(),r.edge*Math.PI/2);l(c,c,-Pi(t,o)),a(c,e,c),c[12]=0,c[13]=0,c[14]=0,i.modelTransform=c,i.renderLocation=r.position}function di(i,e,t){const n=gi(t,1),o=s(z.get(),n.edge*Math.PI/2);l(o,o,Ai),a(o,e,o),o[12]=0,o[13]=0,o[14]=0,i.modelTransform=o,i.renderLocation=n.position}function gi(i,e){switch(e){case 0:return{basis:i.basis1,direction:1,position:g(I.get(),i.origin,i.basis1),edge:e};case 1:return{basis:i.basis2,direction:1,position:g(I.get(),i.origin,i.basis2),edge:e};case 2:return{basis:i.basis1,direction:-1,position:f(I.get(),i.origin,i.basis1),edge:e};case 3:return{basis:i.basis2,direction:-1,position:f(I.get(),i.origin,i.basis2),edge:e}}}function mi(i,e,t){const n=t.projectToRenderScreen(g(I.get(),i,e),o(I.get())),s=t.projectToRenderScreen(f(I.get(),i,e),o(I.get()));return n&&s?w(f(n,n,s)):0}function pi(i){const e=u(i.basis1),t=u(i.basis2);return B*Math.min(e,t)}function fi(i){return pi(i)}function bi(i){return 0!==i.direction[0]&&0!==i.direction[1]}function hi(i){const e=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]];return new Q({view:i,attached:!1,color:W(i.effectiveTheme),width:O,renderOccluded:4,geometry:[e],isDecoration:!0})}function ji(i){return new X({view:i,attached:!1,backgroundColor:D,gridColor:F(i.effectiveTheme),gridWidth:4,renderOccluded:4,isDecoration:!0})}function wi(e,n,o,s=new i){if(null==e)return null;const{renderCoordsHelper:r}=n,a=r.fromRenderCoords(e.origin,new U({spatialReference:n.spatialReference}));if(null==a)return null;const c=y(a,o);if(null==c)return null;s.position=c;const l=2*u(e.basis1),d=2*u(e.basis2),g=Y.renderUnitScaleFactor(n.spatialReference,o);s.width=l*g,s.height=d*g;const m=r.worldUpAtPosition(e.origin,I.get());return s.tilt=t(Pi(e,m)),s.heading=r.headingAtPosition(e.origin,e.basis1)-90,s}function vi(i,e,t){if(null==i)return null;const n=i.origin,o=I.get(),s=I.get(),r=I.get(),a=I.get();let c,l,u,d,m,p;g(o,n,i.basis1),g(o,o,i.basis2),g(s,n,i.basis1),v(s,s,i.basis2),v(r,n,i.basis1),v(r,r,i.basis2),v(a,n,i.basis1),g(a,a,i.basis2);for(const g of[o,s,r,a]){const i=e.fromRenderCoords(g,g,t);if(null==i)return null;c=null==c?i[0]:Math.min(c,i[0]),l=null==l?i[0]:Math.max(l,i[0]),u=null==u?i[1]:Math.min(u,i[1]),d=null==d?i[1]:Math.max(d,i[1]),m=null==m?i[2]:Math.min(m,i[2]),p=null==p?i[2]:Math.max(p,i[2])}return new M({xmin:c,xmax:l,ymin:u,ymax:d,zmin:m,zmax:p,spatialReference:t})}function Pi(i,e){return H(e,i.basis2,i.basis1)+Ai}function Mi(i,t,o,s,r,a,c=R()){return a.toRenderCoords(i,c.origin)?(a.worldBasisAtPosition(c.origin,0,c.basis1),a.worldBasisAtPosition(c.origin,1,c.basis2),L(c.basis2,c.basis1,c.origin,c.plane),x(c,-n(t),S(c),c),x(c,n(o),c.basis1,c),m(c.basis1,c.basis1,s/2),m(c.basis2,c.basis2,r/2),T(c),c):(e.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${i.spatialReference.wkid} is not supported`),null)}function Ui(i,e){if(null==i?.position)return null;const t=K(i.position,e.spatialReference,e.elevationProvider);if(null==t)return null;const n=Y.renderUnitScaleFactor(i.position.spatialReference,e.spatialReference),o=i.width*n,s=i.height*n;return{position:t,heading:i.heading,tilt:i.tilt,renderWidth:o,renderHeight:s}}function yi(i,e,t,n=R()){const o=Ui(i,e);return null==o?null:Ri(o,e,t,n)}function Ri(i,e,t,n=R()){if(null==i)return null;const o=Mi(i.position,i.heading,i.tilt,i.renderWidth,i.renderHeight,e.renderCoordsHelper,n);return t.tiltEnabled||null==o||ei(o,e.renderCoordsHelper,o),o}const xi=16,Si=32,Ti=E(),Ai=Math.PI/2,Ci=16,ki=32;function Li(i){return null!=("building-scene-3d"===i.type?i:null)}export{xi as DidPointerMoveRecentlyFlag,Si as IsShiftEdgeOnScreenFlag,si as calculateBoundedPlaneTranslateRotate,fi as calculateDiagonalResizeHandleScale,ni as calculatePlaneHalfSize,ji as createGridVisualElement,hi as createOutlineVisualElement,_ as createPlane,ri as createRotatePlane,oi as createShiftPlane,ei as forceHorizontalOrVertical,Li as isBuildingSceneLayerView3D,bi as isDiagonalResizeHandle,ii as normalToBases,vi as planeToExtent,wi as planeToShape,Ui as projectAndElevationAlignShape,Ri as projectedShapeToPlane,Ci as resizeNormal,ki as resizeOutlineOnly,ti as resizePlane,yi as shapeToPlane,li as updateResizeHandle,ui as updateRotateHeadingHandle,di as updateRotateTiltHandle,ai as updateShiftRestartHandle};
|
|
@@ -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{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import{property as o,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{h as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,fromExtent as c,width as p,height as d,expand as l}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as
|
|
5
|
+
import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import{property as o,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{h as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,fromExtent as c,width as p,height as d,expand as l}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as m}from"../../../../geometry/support/coordinateSystem.js";import{euclideanDirectDistance as u}from"../../../support/euclideanLengthMeasurementUtils.js";let g=class extends r{constructor(e){super(e)}get localOriginRenderSpace(){const{extent:e,localOrigin:t,renderCoordsHelper:r}=this,o=s();return r.toRenderCoords(t,e.spatialReference,o),o}get cameraPositionRenderSpace(){const{localOriginRenderSpace:e,renderCoordsHelper:t}=this,r=s(),o=1/t.unitInMeters;return t.setAltitude(r,f*o,e),r}get boundingRect(){const{extent:e,renderCoordsHelper:t}=this,r=a();return 2===t.viewingMode?c(e,r):(this._expandBoundingRect(e.xmin,e.ymin,r),this._expandBoundingRect(e.xmax,e.ymin,r),this._expandBoundingRect(e.xmin,e.ymax,r),this._expandBoundingRect(e.xmax,e.ymax,r)),r}get dimensions(){let e,t;const{viewingMode:r,spatialReference:o}=this.renderCoordsHelper;return 2===r&&o.isWebMercator?({width:e,height:t}=h(this.extent)):(e=p(this.boundingRect),t=d(this.boundingRect)),{width:e,height:t}}get cameraDimensions(){const{boundingRect:e}=this;return{width:p(e),height:d(e)}}get cameraNearFar(){const{renderCoordsHelper:{unitInMeters:e}}=this,t=1/e;return{near:C*t,far:v*t}}get upVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,2,s())}get northVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,1,s())}get eastVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,0,s())}_expandBoundingRect(e,t,r){const{extent:o,eastVector:n,northVector:s,upVector:a,renderCoordsHelper:c}=this,p=o.center.z??0;i(x,e,t,p),c.toRenderCoords(x,o.spatialReference,x),m(x,n,s,a,R),l(r,R,r)}};function h(e){const t=u([e.xmin,e.ymin,0],[e.xmax,e.ymin,0],e.spatialReference),r=u([e.xmin,e.ymin,0],[e.xmin,e.ymax,0],e.spatialReference);return{width:t?.value??0,height:r?.value??0}}e([o()],g.prototype,"renderCoordsHelper",void 0),e([o()],g.prototype,"extent",void 0),e([o()],g.prototype,"localOrigin",void 0),e([o()],g.prototype,"localOriginRenderSpace",null),e([o()],g.prototype,"cameraPositionRenderSpace",null),e([o()],g.prototype,"boundingRect",null),e([o()],g.prototype,"dimensions",null),e([o()],g.prototype,"cameraDimensions",null),e([o()],g.prototype,"upVector",null),e([o()],g.prototype,"northVector",null),e([o()],g.prototype,"eastVector",null),g=e([n("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillComputation")],g);const x=s(),R=s(),y=100,f=t.maxTargetElevation,C=0,v=t.targetElevationRange+y;export{g as VolumeMeasurementCutFillComputation};
|
|
@@ -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{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i}from"../../../../core/promiseUtils.js";import{whenOnce as n,watch as s,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{property as p,subclass as u}from"../../../../core/accessorSupport/decorators.js";import{e as m}from"../../../../chunks/earcut.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as d,c as h,G as g}from"../../../../chunks/vec32.js";import{fromValues as y,create as f,clone as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{projectOrLoad as w}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as j}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as E}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as b,create as G,expand as R,width as x,height as L,fromExtent as T,intersects as C}from"../../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as P}from"../../../../geometry/support/DoubleArray.js";import{t as V}from"../../../../chunks/vec3.js";import H from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as A}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as M}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementDistanceTooCloseError as U,VolumeMeasurementDistanceTooFarError as D,VolumeMeasurementPerimeterTooLargeError as I,VolumeMeasurementUnsupportedCoordinateSystemError as O,VolumeMeasurementUnsupportedLayerTransparencyError as F}from"./volumeMeasurementErrors.js";import S from"./VolumeMeasurementResult.js";import{getRawResult as N}from"./volumeMeasurementUtils.js";import{ElevationContext as k}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as z}from"../../support/ElevationProvider.js";import{polygonToRenderInfo as B}from"../../support/renderInfoUtils/polygon.js";import{CutFillDepth as W,TargetGeometryRenderInfo as q}from"../../webgl-engine/lib/CutFillDepth.js";let J=class extends r{constructor(e){super(e),this._getElevationProvider=()=>this.view.elevationProvider,this.labelAnchors=null,this._updatingHandles=new v,this._rawResult=null,this._debouncedUpdate=i(async(e,t,r)=>{if(!this._renderer.done)return;const{renderCoordsHelper:o}=this.view,i=new M({extent:e,localOrigin:t,renderCoordsHelper:o});if(this._renderer.setup(i,r),this._renderer.start(),await n(()=>this._renderer.done),!this._enabled)return;const s=this._renderer.getResults();this._updateResult(i,s),this._updateLabelAnchors(i,s)})}initialize(){const e=this.view;this._renderer=new W({view:e}),this.addHandles([this._createElevationUpdateHandle(),s(()=>this._targetGeometry,e=>this.analysisViewData.targetGeometry=e,l),s(()=>this._elevationAlignedGeometry,e=>this.analysisViewData.elevationAlignedGeometry=e,l),s(()=>({extent:this._projectedGeometry?.extent,localOrigin:this._localOrigin,targetGeometryRenderInfo:this._targetGeometryRenderInfo,enabled:this._enabled}),({extent:e,localOrigin:t,targetGeometryRenderInfo:r,enabled:o})=>{e&&t&&r&&o?this._updatingHandles.addPromise(this._debouncedUpdate(e,t,r)):this._rawResult=null},l)])}destroy(){this._updatingHandles.destroy(),this._renderer.destroy()}get _projectedGeometry(){if(!this.analysis.valid)return null;const e=this.analysis.geometry,t=w(e,this.view.spatialReference);return t.pending?(this._updatingHandles.addPromise(t.pending),null):(e&&!t.geometry&&A(this.analysis,e.spatialReference,o.getLogger(this)),t.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?y(e.center.x,e.center.y,0):null}get _elevationAlignedGeometry(){const e=this._projectedGeometry;if(!e)return null;const t=e.clone();return K(this._getElevationProvider(),t),t}get _targetGeometry(){const e=this._elevationAlignedGeometry;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings[0].forEach(e=>e[2]=r),o}get _targetGeometryRenderInfo(){const e=this._targetGeometry,t=this._projectedGeometry?.extent,r=this._localOrigin;if(!e||!t||!r)return null;const{elevationProvider:o,renderCoordsHelper:i}=this.view,n=B(e,o,i,k.fromElevationInfo(new H({mode:"absolute-height"}))),{polygons:s}=n,l=s[0],a=m(l.position,l.holeIndices,3),p=P(3*l.count),u=c(),d=c();return j(t.spatialReference,r,u,i.spatialReference),d[12]=-u[12],d[13]=-u[13],d[14]=-u[14],V(p,l.position,d),new q(p,a)}get updating(){return this._renderer.updating||this._updatingHandles.updating}get result(){const e=this._rawResult;return e?new S({measureType:this.analysis.measureType,rawResult:e,unit:this.analysisViewData.effectiveDisplayUnits.volume}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._tooNearFarError}get _tooNearFarError(){const e=this._elevationAlignedGeometry;if(!e)return null;const{view:r}=this,{elevationProvider:o,renderCoordsHelper:i}=r,{camera:n}=r.state,s=B(e,o,i,k.fromElevationInfo(new H({mode:"absolute-height"}))),{polygons:l}=s,a=l[0].position;b(te);for(let t=0;t<a.length;t+=3)n.projectToScreen(d(ee,a[t],a[t+1],a[t+2]),re),R(te,re,te);const p=x(te),u=L(te),{maxVolumeExtentSizeVw:m,minVolumeExtentSizePixels:c}=t;return p>n.width/n.pixelRatio*m||u>n.height/n.pixelRatio*m?new U:Math.max(p,u)<c?new D:null}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeter,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new I:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeter,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new I:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new O:null}get _unsupportedLayerTransparencyError(){return(this.view.map?.ground.opacity??1)<1?new F:null}get _perimeter(){const e=this._targetGeometryRenderInfo?.positions,t=e?X(Y(e)):null;return null!=t?t/this.view.renderCoordsHelper.unitInMeters:null}get _enabled(){return!this.error}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(E(e.extent,e.spatialReference,Z,this.view.spatialReference),T(t,$),C(Z,$)&&(this._getElevationProvider=()=>this.view.elevationProvider))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n}}=e,s=r/t.width*(o/t.height),l=Q(t.cut.totalDepth,i,n)*s,a=Q(t.fill.totalDepth,i,n)*s;this._rawResult=N(Math.abs(l),a)}_updateLabelAnchors(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:l,eastVector:a,upVector:p}=e,u=e=>{const{labelDepth:u,labelCoords:m,totalDepth:c}=e,d=_(s);return 0!==c&&(h(d,d,a,r*(m[0]/t.width-.5)),h(d,d,l,o*(m[1]/t.height-.5))),h(d,d,p,-Q(u,i,n)),d};this.labelAnchors={cut:u(t.cut),fill:u(t.fill)}}};function K(e,t){t.rings[0].forEach(t=>{t[2]=z(e,t,"ground")??0})}function Q(e,t,r){return e*(r-t)+t}function X(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1],i[2]??0]),r?o+=g(r,i):r=[0,0,0],r[0]=i[0],r[1]=i[1],r[2]=i[2];return t&&r&&(o+=g(r,t)),Math.sqrt(o)}function*Y(e){const t=f();for(let r=0;r<e.length;r+=3)t[0]=e[r],t[1]=e[r+1],t[2]=e[r+2],yield t}e([p()],J.prototype,"_projectedGeometry",null),e([p()],J.prototype,"_localOrigin",null),e([p()],J.prototype,"_getElevationProvider",void 0),e([p()],J.prototype,"_elevationAlignedGeometry",null),e([p()],J.prototype,"_targetGeometry",null),e([p()],J.prototype,"_targetGeometryRenderInfo",null),e([p({constructOnly:!0})],J.prototype,"analysis",void 0),e([p({constructOnly:!0})],J.prototype,"analysisViewData",void 0),e([p({constructOnly:!0})],J.prototype,"view",void 0),e([p()],J.prototype,"updating",null),e([p()],J.prototype,"result",null),e([p()],J.prototype,"labelAnchors",void 0),e([p()],J.prototype,"error",null),e([p()],J.prototype,"_tooNearFarError",null),e([p()],J.prototype,"_perimeterTooLargeError",null),e([p()],J.prototype,"_perimeterTooLargeLocalError",null),e([p()],J.prototype,"_perimeterTooLargeGlobalError",null),e([p()],J.prototype,"_unsupportedCoordinateSystemError",null),e([p()],J.prototype,"_unsupportedLayerTransparencyError",null),e([p()],J.prototype,"_perimeter",null),e([p()],J.prototype,"_enabled",null),e([p()],J.prototype,"_renderer",void 0),e([p({readOnly:!0})],J.prototype,"_updatingHandles",void 0),e([p()],J.prototype,"_rawResult",void 0),J=e([u("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],J);const Z=b(),$=b(),ee=f(),te=G(),re=a();export{J as VolumeMeasurementCutFillController};
|
|
@@ -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{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../../../intl.js";import{volumeMeasurementConfiguration as o}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import l from"../../../../core/Accessor.js";import{equals as r}from"../../../../core/arrayUtils.js";import{cyclicalPI as n}from"../../../../core/Cyclical.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{formatDecimal as c}from"../../../../core/quantityFormatUtils.js";import{watch as u,initial as m}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as d}from"../../../../core/units.js";import{property as h,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{e as y}from"../../../../chunks/earcut.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as _,n as f,e as v,f as j,g as L}from"../../../../chunks/vec32.js";import{create as b,fromValues as C}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as w}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as G}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as P}from"../../../../geometry/support/Indices.js";import{angleAroundAxis as V}from"../../../../geometry/support/vector.js";import{t as R}from"../../../../chunks/vec3.js";import F from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as A}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as O}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as x}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as D}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as M}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as S}from"../../layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{polygonToRenderInfo as U}from"../../support/renderInfoUtils/polygon.js";import{CutFillColor as E,VolumeGeometry as B}from"../../webgl-engine/lib/CutFillColor.js";import{createStipplePatternSimple as N}from"../../webgl-engine/materials/lineStippleUtils.js";let T=class extends l{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}get updating(){return this.loadingMessages}get hasUnsupportedError(){const{error:e}=this.analysisViewData;return!!e&&["unsupported-coordinate-system","unsupported-layer-transparency"].includes(e.name)}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._elevationContext=M.fromElevationInfo(new F({mode:"absolute-height"})),this._extrusionHeight=o.targetElevationRange,this._projectionLines=[]}initialize(){const{view:e}=this,i={view:e,isDecoration:!0},s=o,l={...i,width:s.geometryOutlineWidth};this._elevationAlignedGeometry=new x({...l,isDraped:!0,color:s.geometryOutlineColor.toUnitRGBA()}),this._targetGeometry=new x(l);const r={...i,attached:!0,width:s.projectionLineWidth,renderOccluded:4,polygonOffset:!0},n={...r,stipplePattern:N(s.projectionLineStippleSize)},a=s.cutProjectionLineColor.toUnitRGBA(),c=s.fillProjectionLineColor.toUnitRGBA();this._cutProjectionLines=new O({...r,color:a}),this._occludedCutProjectionLines=new O({...n,color:a}),this._fillProjectionLines=new O({...r,color:c}),this._occludedFillProjectionLines=new O({...n,color:c});const d={...i,attached:!0};this._cutVolumeLabel=new A(d),this._fillVolumeLabel=new A(d),this._cutFillRenderNode=new E({view:e,cutColor:s.cutColor,fillColor:s.fillColor,borderColor:s.geometryOutlineColor}),this.addHandles([u(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},m),u(()=>({interactive:this.analysisViewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:i})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&"cut-fill"===i,this._cutFillRenderNode.measureType=i},m),u(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:i})=>this._updateProjectionLines(e,t,i),m),u(()=>({interactive:this.analysisViewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.analysisViewData.result}),({interactive:e,accentColor:t,hasResult:i})=>{this._updateColors(e,t,i)},m),u(()=>this.analysisViewData.targetGeometry,()=>this._updateCutFillGeometry(),m),u(()=>this.visible&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),m),u(()=>{const{messages:e,unitsMessages:t,visible:i,analysisViewData:s}=this;return{labelAnchors:s.labelAnchors,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i&&!!s.result}},e=>this._updateLabels(e)),u(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e),m),t(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=a(this._elevationAlignedGeometry),this._targetGeometry=a(this._targetGeometry),this._cutProjectionLines=a(this._cutProjectionLines),this._occludedCutProjectionLines=a(this._occludedCutProjectionLines),this._fillProjectionLines=a(this._fillProjectionLines),this._occludedFillProjectionLines=a(this._occludedFillProjectionLines),this._cutVolumeLabel=a(this._cutVolumeLabel),this._fillVolumeLabel=a(this._fillVolumeLabel),this._cutFillRenderNode.destroy()}_updateProjectionLines(e,t,i){if(this._cutProjectionLines.visible=i,this._occludedCutProjectionLines.visible=i,this._fillProjectionLines.visible=i,this._occludedFillProjectionLines.visible=i,!e||!t)return;const{renderCoordsHelper:s}=this.view,o=[],l=e.spatialReference,n=e.rings[0],a=n.length>1&&r(n[0],n[n.length-1]),c=n.length-(a?1:0);for(let r=0;r<c;++r){const e=n[r],i=_(b(),e[0],e[1],e[2]);s.toRenderCoords(i,l,i);const a=t.rings[0][r],c=_(b(),a[0],a[1],a[2]);s.toRenderCoords(c,l,c);const u=new D(i,c);o.push(u)}e.isClockwise(n)||o.reverse();const u=[],m=[],d=[],h=[],p=[],y=this.view.state.camera;for(let r=0;r<o.length;++r){const i=o[r],s=o[0===r?o.length-1:r-1],l=o[r===o.length-1?0:r+1],n=e.rings[0][r],a=t.rings[0][r],c=n[2]>a[2],g=new k(i,s,l,c);u.push(g),g.updateOccluded(y);const _=g.isOccluded;c?(_?d:m).push(i):(_?p:h).push(i)}this._projectionLines=u,this._cutProjectionLines.setGeometryFromSegments(m),this._occludedCutProjectionLines.setGeometryFromSegments(d),this._fillProjectionLines.setGeometryFromSegments(h),this._occludedFillProjectionLines.setGeometryFromSegments(p)}_updateProjectionLineOcclusion(e){const t=[],i=[],s=[],o=[];let l=!1,r=!1;for(const n of this._projectionLines){n.updateOccluded(e)&&(l||=n.isCut,r||=!n.isCut);const a=n.isOccluded;(n.isCut?a?i:t:a?o:s).push(n.segment)}r&&(this._fillProjectionLines.setGeometryFromSegments(s),this._occludedFillProjectionLines.setGeometryFromSegments(o)),l&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(i))}_updateColors(e,t,i){const{geometryOutlineColor:s,cutColor:l,fillColor:r,cutColorMuted:n,fillColorMuted:a,cutProjectionLineColor:c,fillProjectionLineColor:u}=o;if(this._cutFillRenderNode.cutColor=i?l:n,this._cutFillRenderNode.fillColor=i?r:a,e){const e=t.toUnitRGBA();this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._cutFillRenderNode.borderColor=t}else{this._targetGeometry.color=s.toUnitRGBA();const e=(i?c:n).toUnitRGBA();this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;const t=(i?u:a).toUnitRGBA();this._fillProjectionLines.color=t,this._occludedFillProjectionLines.color=t,this._cutFillRenderNode.borderColor=s}}_updateLabels(e){const{labelDistance:t}=o,{effectiveDisplayUnits:s,labelAnchors:l,messages:r,unitsMessages:n,result:a,visible:c}=e;if(this._cutVolumeLabel.visible=c,this._fillVolumeLabel.visible=c,this._cutVolumeLabel.geometry=l.cut?{type:"point",point:l.cut,callout:{distance:t,offset:0}}:null,this._fillVolumeLabel.geometry=l.fill?{type:"point",point:l.fill,callout:{distance:-t,offset:0}}:null,null==a||null==r||null==n)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const u=s.volume,m=i(r.labels.cut,{volume:H(n,a.cutVolume,u)}),d=i(r.labels.fill,{volume:H(n,a.fillVolume,u)});this._cutVolumeLabel.text=m,this._fillVolumeLabel.text=d}_updateCutFillVisibility(e){e?this._cutFillRenderNode.enable():this._cutFillRenderNode.disable()}_updateCutFillGeometry(){const{renderCoordsHelper:e}=this.view,{targetGeometry:t}=this.analysisViewData;if(!t?.extent)return;const{center:i}=t.extent,s=C(i.x,i.y,0),o=b();e.toRenderCoords(s,t.spatialReference,o);const l=this._getExtrudedVolume(t,this._extrusionHeight,s,o),r=this._getExtrudedVolume(t,-this._extrusionHeight,s,o);this._cutFillRenderNode.updateGeometries(l,r,o)}_getExtrudedVolume(e,t,i,s){const{renderCoordsHelper:o,spatialReference:l,elevationProvider:r}=this.view,n=b(),a=1===o.viewingMode;o.worldUpAtPosition(s,n);const c=U(e,r,o,this._elevationContext),{polygons:u,mapPositions:m,position:d}=c,h=u[0],p=h.count,_=y(h.mapPositions,h.holeIndices,3),f=_.length,v=6*p,j=P(v+f),L=P(f),C=G(3*v),V=G(3*v);S(d,m,_,h,C,null,V,null,j,L,t,n,a);const F=g(),A=g();if(w(l,i,F,o.spatialReference),A[12]=-F[12],A[13]=-F[13],A[14]=-F[14],R(C,C,A),"stockpile"===this.analysis.measureType)for(let y=0;y<V.length;y+=3)V[y]=n[0],V[y+1]=n[1],V[y+2]=n[2];return new B(C,L,j,V)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await s("esri/core/t9n/Units"),this.messages=await s("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function H(e,t,i){if(!t||!e)return null;const s=d(t.value,t.unit,i),l=o.labelPrecisions[s];return c(e,t,s,l)}e([h({constructOnly:!0})],T.prototype,"view",void 0),e([h({constructOnly:!0})],T.prototype,"analysis",void 0),e([h({constructOnly:!0})],T.prototype,"analysisViewData",void 0),e([h()],T.prototype,"unitsMessages",void 0),e([h()],T.prototype,"messages",void 0),e([h()],T.prototype,"loadingMessages",void 0),e([h({readOnly:!0})],T.prototype,"visible",null),e([h()],T.prototype,"updating",null),e([h()],T.prototype,"hasUnsupportedError",null),T=e([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],T);class k{constructor(e,t,i,s){this.segment=e,this.previous=t,this.next=i,this.isCut=s,this._isOccluded=!1,this._n1=b(),this._n2=b();const o=f(I,v(I,e.endRenderSpace,e.startRenderSpace));f(this._n1,j(this._n1,o,f(z,v(z,t.startRenderSpace,e.startRenderSpace)))),f(this._n2,j(this._n2,o,f(z,v(z,e.startRenderSpace,i.startRenderSpace)))),this._isConvex=n.normalize(V(this._n1,this._n2,o))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){v(I,this.segment.startRenderSpace,e.eye);const t=L(this._n1,I)<0,i=L(this._n2,I)<0,s=this._isOccluded;return this._isOccluded=this._isConvex?t&&i:t||i,this._isOccluded!==s}}const I=b(),z=b();export{T as VolumeMeasurementCutFillVisualization};
|
|
5
|
+
import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../../../intl.js";import{volumeMeasurementConfiguration as o}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import{equals as l}from"../../../../core/arrayUtils.js";import{cyclicalPI as n}from"../../../../core/Cyclical.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{formatDecimal as c}from"../../../../core/quantityFormatUtils.js";import{watch as u,initial as m}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as d}from"../../../../core/units.js";import{property as h,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{e as y}from"../../../../chunks/earcut.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as _,n as f,e as v,f as j,g as b}from"../../../../chunks/vec32.js";import{create as L,fromValues as C}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as w}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as G}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as P}from"../../../../geometry/support/Indices.js";import{angleAroundAxis as V}from"../../../../geometry/support/vector.js";import{t as R}from"../../../../chunks/vec3.js";import F from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as A}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as O}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as x}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as D}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as M}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as S}from"../../layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{polygonToRenderInfo as U}from"../../support/renderInfoUtils/polygon.js";import{CutFillColor as E,VolumeGeometry as B}from"../../webgl-engine/lib/CutFillColor.js";import{createStipplePatternSimple as N}from"../../webgl-engine/materials/lineStippleUtils.js";let T=class extends r{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}get updating(){return this.loadingMessages}get hasUnsupportedError(){const{error:e}=this.analysisViewData;return!!e&&["unsupported-coordinate-system","unsupported-layer-transparency"].includes(e.name)}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._elevationContext=M.fromElevationInfo(new F({mode:"absolute-height"})),this._extrusionHeight=o.targetElevationRange,this._projectionLines=[]}initialize(){const{view:e}=this,i={view:e,isDecoration:!0},s=o,r={...i,width:s.geometryOutlineWidth};this._elevationAlignedGeometry=new x({...r,isDraped:!0,color:s.geometryOutlineColor.toUnitRGBA()}),this._targetGeometry=new x(r);const l={...i,attached:!0,width:s.projectionLineWidth,renderOccluded:4,polygonOffset:!0},n={...l,stipplePattern:N(s.projectionLineStippleSize)},a=s.cutProjectionLineColor.toUnitRGBA(),c=s.fillProjectionLineColor.toUnitRGBA();this._cutProjectionLines=new O({...l,color:a}),this._occludedCutProjectionLines=new O({...n,color:a}),this._fillProjectionLines=new O({...l,color:c}),this._occludedFillProjectionLines=new O({...n,color:c});const d={...i,attached:!0};this._cutVolumeLabel=new A({...d,distance:s.labelDistance}),this._fillVolumeLabel=new A({...d,distance:-s.labelDistance}),this._cutFillRenderNode=new E({view:e,cutColor:s.cutColor,fillColor:s.fillColor,borderColor:s.geometryOutlineColor}),this.addHandles([u(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},m),u(()=>({interactive:this.analysisViewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:i})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&"cut-fill"===i,this._cutFillRenderNode.measureType=i},m),u(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:i})=>this._updateProjectionLines(e,t,i),m),u(()=>({interactive:this.analysisViewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.analysisViewData.result}),({interactive:e,accentColor:t,hasResult:i})=>{this._updateColors(e,t,i)},m),u(()=>this.analysisViewData.targetGeometry,()=>this._updateCutFillGeometry(),m),u(()=>this.visible&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),m),u(()=>{const{messages:e,unitsMessages:t,visible:i,analysisViewData:s}=this;return{labelAnchors:s.labelAnchors,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i&&!!s.result}},e=>this._updateLabels(e)),u(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e),m),t(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=a(this._elevationAlignedGeometry),this._targetGeometry=a(this._targetGeometry),this._cutProjectionLines=a(this._cutProjectionLines),this._occludedCutProjectionLines=a(this._occludedCutProjectionLines),this._fillProjectionLines=a(this._fillProjectionLines),this._occludedFillProjectionLines=a(this._occludedFillProjectionLines),this._cutVolumeLabel=a(this._cutVolumeLabel),this._fillVolumeLabel=a(this._fillVolumeLabel),this._cutFillRenderNode.destroy()}_updateProjectionLines(e,t,i){if(this._cutProjectionLines.visible=i,this._occludedCutProjectionLines.visible=i,this._fillProjectionLines.visible=i,this._occludedFillProjectionLines.visible=i,!e||!t)return;const{renderCoordsHelper:s}=this.view,o=[],r=e.spatialReference,n=e.rings[0],a=n.length>1&&l(n[0],n[n.length-1]),c=n.length-(a?1:0);for(let l=0;l<c;++l){const e=n[l],i=_(L(),e[0],e[1],e[2]);s.toRenderCoords(i,r,i);const a=t.rings[0][l],c=_(L(),a[0],a[1],a[2]);s.toRenderCoords(c,r,c);const u=new D(i,c);o.push(u)}e.isClockwise(n)||o.reverse();const u=[],m=[],d=[],h=[],p=[],y=this.view.state.camera;for(let l=0;l<o.length;++l){const i=o[l],s=o[0===l?o.length-1:l-1],r=o[l===o.length-1?0:l+1],n=e.rings[0][l],a=t.rings[0][l],c=n[2]>a[2],g=new k(i,s,r,c);u.push(g),g.updateOccluded(y);const _=g.isOccluded;c?(_?d:m).push(i):(_?p:h).push(i)}this._projectionLines=u,this._cutProjectionLines.setGeometryFromSegments(m),this._occludedCutProjectionLines.setGeometryFromSegments(d),this._fillProjectionLines.setGeometryFromSegments(h),this._occludedFillProjectionLines.setGeometryFromSegments(p)}_updateProjectionLineOcclusion(e){const t=[],i=[],s=[],o=[];let r=!1,l=!1;for(const n of this._projectionLines){n.updateOccluded(e)&&(r||=n.isCut,l||=!n.isCut);const a=n.isOccluded;(n.isCut?a?i:t:a?o:s).push(n.segment)}l&&(this._fillProjectionLines.setGeometryFromSegments(s),this._occludedFillProjectionLines.setGeometryFromSegments(o)),r&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(i))}_updateColors(e,t,i){const{geometryOutlineColor:s,cutColor:r,fillColor:l,cutColorMuted:n,fillColorMuted:a,cutProjectionLineColor:c,fillProjectionLineColor:u}=o;if(this._cutFillRenderNode.cutColor=i?r:n,this._cutFillRenderNode.fillColor=i?l:a,e){const e=t.toUnitRGBA();this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._cutFillRenderNode.borderColor=t}else{this._targetGeometry.color=s.toUnitRGBA();const e=(i?c:n).toUnitRGBA();this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;const t=(i?u:a).toUnitRGBA();this._fillProjectionLines.color=t,this._occludedFillProjectionLines.color=t,this._cutFillRenderNode.borderColor=s}}_updateLabels(e){const{effectiveDisplayUnits:t,labelAnchors:s,messages:o,unitsMessages:r,result:l,visible:n}=e;if(this._cutVolumeLabel.visible=n,this._fillVolumeLabel.visible=n,this._cutVolumeLabel.geometry=s?{type:"point",point:s.cut}:null,this._fillVolumeLabel.geometry=s?{type:"point",point:s.fill}:null,null==l||null==o||null==r)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const a=t.volume,c=i(o.labels.cut,{volume:H(r,l.cutVolume,a)}),u=i(o.labels.fill,{volume:H(r,l.fillVolume,a)});this._cutVolumeLabel.text=c,this._fillVolumeLabel.text=u}_updateCutFillVisibility(e){e?this._cutFillRenderNode.enable():this._cutFillRenderNode.disable()}_updateCutFillGeometry(){const{renderCoordsHelper:e}=this.view,{targetGeometry:t}=this.analysisViewData;if(!t?.extent)return;const{center:i}=t.extent,s=C(i.x,i.y,0),o=L();e.toRenderCoords(s,t.spatialReference,o);const r=this._getExtrudedVolume(t,this._extrusionHeight,s,o),l=this._getExtrudedVolume(t,-this._extrusionHeight,s,o);this._cutFillRenderNode.updateGeometries(r,l,o)}_getExtrudedVolume(e,t,i,s){const{renderCoordsHelper:o,spatialReference:r,elevationProvider:l}=this.view,n=L(),a=1===o.viewingMode;o.worldUpAtPosition(s,n);const c=U(e,l,o,this._elevationContext),{polygons:u,mapPositions:m,position:d}=c,h=u[0],p=h.count,_=y(h.mapPositions,h.holeIndices,3),f=_.length,v=6*p,j=P(v+f),b=P(f),C=G(3*v),V=G(3*v);S(d,m,_,h,C,null,V,null,j,b,t,n,a);const F=g(),A=g();if(w(r,i,F,o.spatialReference),A[12]=-F[12],A[13]=-F[13],A[14]=-F[14],R(C,C,A),"stockpile"===this.analysis.measureType)for(let y=0;y<V.length;y+=3)V[y]=n[0],V[y+1]=n[1],V[y+2]=n[2];return new B(C,b,j,V)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await s("esri/core/t9n/Units"),this.messages=await s("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function H(e,t,i){if(!t||!e)return null;const s=d(t.value,t.unit,i),r=o.labelPrecisions[s];return c(e,t,s,r)}e([h({constructOnly:!0})],T.prototype,"view",void 0),e([h({constructOnly:!0})],T.prototype,"analysis",void 0),e([h({constructOnly:!0})],T.prototype,"analysisViewData",void 0),e([h()],T.prototype,"unitsMessages",void 0),e([h()],T.prototype,"messages",void 0),e([h()],T.prototype,"loadingMessages",void 0),e([h({readOnly:!0})],T.prototype,"visible",null),e([h()],T.prototype,"updating",null),e([h()],T.prototype,"hasUnsupportedError",null),T=e([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],T);class k{constructor(e,t,i,s){this.segment=e,this.previous=t,this.next=i,this.isCut=s,this._isOccluded=!1,this._n1=L(),this._n2=L();const o=f(I,v(I,e.endRenderSpace,e.startRenderSpace));f(this._n1,j(this._n1,o,f(z,v(z,t.startRenderSpace,e.startRenderSpace)))),f(this._n2,j(this._n2,o,f(z,v(z,e.startRenderSpace,i.startRenderSpace)))),this._isConvex=n.normalize(V(this._n1,this._n2,o))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){v(I,this.segment.startRenderSpace,e.eye);const t=b(this._n1,I)<0,i=b(this._n2,I)<0,s=this._isOccluded;return this._isOccluded=this._isConvex?t&&i:t||i,this._isOccluded!==s}}const I=L(),z=L();export{T as VolumeMeasurementCutFillVisualization};
|
|
@@ -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"../../../core/has.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{verticalLengthUnitFromSpatialReference as i,convertUnit as s}from"../../../core/units.js";import{property as l,subclass as
|
|
5
|
+
import{__decorate as e}from"tslib";import"../../../core/has.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{verticalLengthUnitFromSpatialReference as i,convertUnit as s}from"../../../core/units.js";import{property as l,subclass as n}from"../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as r}from"../../../support/getDefaultUnitForView.js";import{AnalysisView3D as a}from"./AnalysisView3D.js";import{VolumeMeasurementCutFillController as o}from"./VolumeMeasurement/VolumeMeasurementCutFillController.js";import{VolumeMeasurementCutFillVisualization as u}from"./VolumeMeasurement/VolumeMeasurementCutFillVisualization.js";import y from"./VolumeMeasurement/VolumeMeasurementTool.js";let p=class extends a{constructor(e){super(e),this.type="volume-measurement-view-3d",this.analysis=null,this.elevationAlignedGeometry=null,this.targetGeometry=null}initialize(){const{analysis:e,view:t}=this;this._analysisController=new o({view:t,analysis:e,analysisViewData:this}),this._analysisTool=new y({analysis:e,view:t,analysisViewData:this}),this._analysisVisualization=new u({view:t,analysis:e,analysisViewData:this})}destroy(){this._analysisController=t(this._analysisController),this._analysisVisualization=t(this._analysisVisualization),this._analysisTool.destroy()}get error(){return this._analysisController?.error??null}get result(){return this._analysisController?.result}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get visible(){return super.visible}set visible(e){super.visible=e}get effectiveTargetElevation(){const{cutFillOptions:e,inputUnits:t}=this.analysis,{targetElevation:l}=e,n=t?.elevation??"meters",r=i(this.view.spatialReference);if(null!=l&&null!=r)return s(l,n,r);const a=this.elevationAlignedGeometry?.extent;return null==a?.zmin||null==a?.zmax?null:(a.zmax+a.zmin)/2}get effectiveDisplayUnits(){const{displayUnits:e}=this.analysis,t=r(this.view);return{elevation:e.elevation??t,volume:e.volume??t}}get labelAnchors(){return this._analysisController.labelAnchors}get updating(){return null!=this._analysisController&&this._analysisController.updating||this._analysisTool.updating||this._analysisVisualization.updating}place(e){return this._analysisTool.place(e)}get test(){}};e([l()],p.prototype,"error",null),e([l({readOnly:!0})],p.prototype,"type",void 0),e([l({constructOnly:!0,nonNullable:!0})],p.prototype,"analysis",void 0),e([l({readOnly:!0})],p.prototype,"result",null),e([l()],p.prototype,"elevationAlignedGeometry",void 0),e([l({type:Number})],p.prototype,"effectiveTargetElevation",null),e([l()],p.prototype,"targetGeometry",void 0),e([l()],p.prototype,"effectiveDisplayUnits",null),e([l()],p.prototype,"labelAnchors",null),e([l()],p.prototype,"updating",null),p=e([n("esri.views.3d.analysis.VolumeMeasurementAnalysisView3D")],p);const m=p;export{m 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{lerp as t}from"../../../../core/mathUtils.js";import{transpose as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{b as s,
|
|
5
|
+
import{lerp as t}from"../../../../core/mathUtils.js";import{transpose as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{b as s,B as a,l as h,d as o,e as n,t as r,j as c,f as _,g as p,i as m,n as f}from"../../../../chunks/vec32.js";import{create as d,clone as l,UNIT_Y as v,UNIT_X as M,UNIT_Z as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{angle as u,slerp as w}from"../../support/mathUtils.js";class y{get pitch(){return this._pitch}get yaw(){return this._yaw}get distance(){return this._distance}get fov(){return this._fov}get size(){return this._size}constructor(t){this.viewingMode=t,this.center=d(),this._pitch=0,this._yaw=0,this._distance=0,this.direction=l(V),this._fov=55,this._size=1}pixelsPerPanAtZoom(t){return this._size/2/(this._zoomToPanScale*t)}zoomAtPixelsPerPan(t){return this._size/2/(this._zoomToPanScale*t)}pixelsPerRotate(){const t=Math.max(Math.cos(Math.abs(this._pitch)),.5);return this._size/2/t}compareTo(t,i){if(1===this.viewingMode){const e=(s(this.center)+s(t.center))/2;i.pan=u(this.center,t.center)*e}else i.pan=a(this.center,t.center);let e=Math.abs(t._yaw-this._yaw);e>=Math.PI&&(e=2*Math.PI-e);const h=Math.abs(t._pitch-this._pitch);i.rotate=Math.max(e,h),i.fov=t.fov-this.fov,i.sourceZoom=this._distance,i.targetZoom=t._distance}interpolate(i,e,s){1===this.viewingMode?w(i.center,e.center,s.pan,this.center):h(this.center,i.center,e.center,s.pan),this._distance=isFinite(e.distance)?t(i.distance,e.distance+s.zoomOffset,s.zoom):i.distance,this._pitch=t(i.pitch,e.pitch,s.rotate);let a=i._yaw;const o=e._yaw;Math.abs(o-a)>=Math.PI&&(a+=2*(a<o?1:-1)*Math.PI),this._yaw=t(a,o,s.rotate),this._fov=t(i.fov,e.fov,s.fov)}copyFrom(t){o(this.center,t.center),this._pitch=t.pitch,this._yaw=t.yaw,this._distance=t.distance,o(this.direction,t.direction),this._size=t.size,this._fov=t.fov,this._zoomToPanScale=Math.atan(.5*this._fov),this.viewingMode=t.viewingMode}copyFromRenderCamera(t){const i=this._lookAtOrientation(t.center,S);o(this.center,t.center),n(j,t.center,t.eye),r(j,j,i),r(I,t.up,i),this._distance=s(j),0!==this._distance&&(j[0]/=this._distance,j[1]/=this._distance,j[2]/=this._distance),this._pitch=P(j),this._yaw=z(j,I),this._size=Math.sqrt(t.width*t.width+t.height*t.height),this._fov=t.fov,this._zoomToPanScale=Math.atan(.5*this._fov)}copyToRenderCamera(t){const e=this._lookAtOrientation(this.center,S);i(e,e),this._axisAngleVec3(O,this._pitch-Math.PI/2,V,j),this._axisAngleVec3(T,this._yaw,j,j),this._axisAngleVec3(O,this._pitch-Math.PI/2,T,I),this._axisAngleVec3(T,this._yaw,I,I),c(j,j,this._distance),r(j,j,e),r(I,I,e),t.center=this.center,t.eye=n(j,this.center,j),t.up=I,t.fov=this._fov}_axisAngleVec3(t,i,e,s){const a=Math.cos(i),h=Math.sin(i);return c(x,e,a),_(A,t,e),c(A,A,h),c(b,t,(1-a)*p(t,e)),m(s,m(s,x,A),b)}_lookAtOrientation(t,i=e()){return this._upAtLookAt(t,b),_(x,this.direction,b),f(x,x),0===x[0]&&0===x[1]&&0===x[2]&&o(x,O),_(A,b,x),f(A,A),i[0]=x[0],i[1]=A[0],i[2]=b[0],i[3]=x[1],i[4]=A[1],i[5]=b[1],i[6]=x[2],i[7]=A[2],i[8]=b[2],i}_upAtLookAt(t,i){return 2===this.viewingMode?o(i,T):f(i,t)}}function P(t){return Math.PI-u(T,t)}function z(t,i){const e=k;return Math.abs(i[2])<.5?(o(e,i),t[2]>0&&c(e,e,-1)):o(e,t),_(A,e,T),f(A,A),u(O,A,T)}const x=d(),A=d(),b=d(),j=d(),I=d(),k=d(),T=g,V=v,O=M,S=e();export{y as Camera};
|
|
@@ -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 e,e as r,i as t,
|
|
5
|
+
import{d as e,e as r,i as t,B as n,C as o}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrap as c}from"../../../../geometry/support/ray.js";import{Sphere as s}from"../../../../geometry/support/sphere.js";import{defaultConstraintOptions as a,interactionDirectionTowardsConstraintMinimization as f,adjustRangeForInteraction as m}from"./common.js";function u(e,r,t=a){if(!e.state.isLocal)return 0;const n=e.state.constraints.distance;if(!e.pointsOfInterest.surfaceOrigin.renderLocation||n===1/0)return 0;g.min=0,g.max=n,d(e,t,g);const o=y(e,r),i=g.max-o;return i>=-1e-6?0:i}function p(n,o,i=a){const m=u(n,o,i);if(0===m)return!1;const p=n.pointsOfInterest.surfaceOrigin;if(!p.renderLocation)return!1;const d=y(n,o)+m,g=e(x,o.eye),I=f(o,i.interactionDirection,l(o,p.renderLocation,j),O);if(!new s(p.renderLocation,d).intersectRay(c(o.eye,I),C))return!1;o.eye=C;const h=r(L,o.eye,g);o.center=t(C,o.center,h);const v=n.renderCoordsHelper.getAltitude(o.center),H=n.renderCoordsHelper.intersectInfiniteManifold(o.ray,v,C);return null!=H&&(o.center=H),!0}function d(e,r,t){const n=r.interactionType;if(0===n)return;const{min:o,max:i}=t,{interactionStartCamera:c,interactionFactor:s}=r;if(!c)return;const a=1===n||4===n,f=u(e,c),p=0===f?0:y(e,c);t.min=o,t.max=i;m(f,p,a,s,.05*p,t)}function y(e,r){const t=e.pointsOfInterest.surfaceOrigin;return t.renderLocation?n(r.eye,t.renderLocation):0}function l(e,r,t){return o(t,e.eye,r)}const g={min:0,max:0},x=i(),L=i(),O=i(),j=i(),C=i();export{p as applyDistanceConstraint,u as getDistanceConstraintError};
|
|
@@ -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 e}from"../../../../core/compilerUtils.js";import{acosClamped as t,clamp as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{fromRotation as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{e as o,p as c,j as u,i as l,
|
|
5
|
+
import{neverReached as e}from"../../../../core/compilerUtils.js";import{acosClamped as t,clamp as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{fromRotation as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{e as o,p as c,j as u,i as l,D as m,B as d,g as f,n as p,b as h}from"../../../../chunks/vec32.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as y}from"../../../../geometry/ellipsoidUtils.js";import{Sphere as C}from"../../../../geometry/support/sphere.js";import{defaultConstraintOptions as I,hasConstraintType as S,adjustRangeForInteraction as x}from"./common.js";import{viewAngle as v}from"../../state/utils/viewUtils.js";function w(t,r,n,i=!0){N.eyeCenterDistance=0,N.requiresTwoSteps=!1;const s=A(t,r,n,I,N);if(0===s)return!1;switch(a(L,-s,r.viewRight),n.tiltMode){case 1:c(k,r.viewForward,L),u(k,k,N.eyeCenterDistance),r.center=l(B,r.eye,k);break;case 0:o(k,r.center,r.eye),c(k,k,L),r.eye=o(B,r.center,k);break;default:e(n.tiltMode)}return r.up=c(B,r.up,L),!N.requiresTwoSteps||!i||w(t,r,n,!1)}function A(e,t,r,n=I,i){if(!e.state.constraints.tilt)return 0;const a=Math.min(t.relativeElevation*G,t.distance),s=e.state.constraints.tilt(a,J);return E(e,r,s),2===n.interactionType&&S(n.selection,2)&&U(e,n.interactionStartCamera,s),1===r.tiltMode||1===n.tiltMode?R(e,t,s,i):P(e,t,s)}function P(e,t,n){const i=v(e.renderCoordsHelper,t.center,t.eye),a=i-r(i,n.min,n.max);return O(a)?a:0}function R(e,t,r,n){switch(n&&(n.requiresTwoSteps=!1),e.viewingMode){case"global":return j(e,t,r,n);case"local":return T(e,t,r,n)}}function T(e,t,n,i){const a=v(e.renderCoordsHelper,t.center,t.eye),s=r(a,n.min,n.max),o=a-s;if(!O(o))return 0;if(i){const r=Math.abs(e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude),n=e.renderCoordsHelper.getAltitude(t.eye)-r,a=Math.max(Math.cos(s),1e-4);Math.abs(a)>1e-4?i.eyeCenterDistance=n/a:i.eyeCenterDistance=t.distance}return o}function j(e,t,n,i){const a=b(e,t,K),s=r(a.tiltAtCenter,n.min,n.max);if(!O(a.tiltAtCenter-s))return 0;let o,c;return a.centerIsOnSurface?(o=q(a),c=H(a,o)):(o=a.constraints.clampTilt(a.distance,a.tiltAtCenter),i&&o<Math.PI/2&&(i.requiresTwoSteps=!0,o=Math.PI/2-1e-5),c=F(a,o)),i&&(i.eyeCenterDistance=D(a,o)),c}function b(e,r,n){const i=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,a=i+y(e.spatialReference).radius,s=e.renderCoordsHelper.intersectManifold(r.ray,i,B);return n.distance=Math.min(r.relativeElevation*G,r.distance),n.centerIsOnSurface=!1,null!=s?(n.distance=Math.min(r.relativeElevation*G,d(r.eye,s)),n.tiltAtCenter=v(e.renderCoordsHelper,s,r.eye),n.centerIsOnSurface=!0):e.state.isLocal?n.tiltAtCenter=v(e.renderCoordsHelper,r.center,r.eye):(g.radius=a,g.closestPointOnSilhouette(r.ray,B),n.distance=Math.min(r.relativeElevation*G,d(r.eye,B)),n.tiltAtCenter=t(-f(r.viewForward,p(B,B)))),n.radius=a,n.eyeRadius=h(r.eye),n.constraints=e.state.constraints,n}const g=new C;function O(e){return Math.abs(e)>1e-9}function q(e){const{constraints:t,distance:r,tiltAtCenter:n}=e;let i=n,a=t.clampTilt(r,n);const s=D(e,a);if(t.clampTilt(s,n)===a)return a;let o=0;for(;o<10&&O(a-i);){const r=(i+a)/2,n=D(e,r);O(t.clampTilt(n,r)-r)?i=r:a=r,o++}return a}function D(e,t){if(!e.centerIsOnSurface)return e.distance;const i=Math.PI-r(t,0,Math.PI),a=n(e.radius/e.eyeRadius*Math.sin(i)),s=Math.PI-i-a,o=Math.sin(s)/Math.sin(i);if(e.eyeRadius<e.radius&&o>1){const t=Math.PI-a,r=Math.PI-i-t;return Math.sin(r)/Math.sin(i)*e.eyeRadius}return o*e.eyeRadius}function H(e,t){const r=n(e.radius/e.eyeRadius*Math.sin(e.tiltAtCenter)),i=n(e.radius/e.eyeRadius*Math.sin(t));return e.eyeRadius>e.radius?r-i:i-r}function F(e,t){return e.tiltAtCenter-Math.PI/2-(t-Math.PI/2)}function E(e,t,r){if(0===t.interactionType)return;const{interactionStartCamera:n,interactionFactor:i}=t;if(!n)return;const{min:a,max:s}=r,o=A(e,n,I,t),c=0===o?0:v(e.renderCoordsHelper,n.center,n.eye);r.min=a,r.max=s,2===t.interactionType?(S(t.selection,2)&&U(e,n,r),x(o,c,!0,i,z,r)):x(o,c,!1,i,z,r)}function U(e,r,n){const i=e.state.constraints;if(e.state.isLocal||!i.altitude||!r)return;const a=m(r.center),s=Math.sqrt(a),o=r.distance,c=y(e.spatialReference).radius,u=i.altitude.min+c,l=i.altitude.max+c,d=(u*u-o*o-a)/(-2*s*o),f=(l*l-o*o-a)/(-2*s*o);n.min=Math.max(n.min,Math.min(Math.PI-t(f),n.max)),n.max=Math.min(n.max,Math.PI-t(d))}const k=M(),L=s(),B=M(),z=i(5),G=30,J={min:0,max:0},K={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,distance:0,tiltAtCenter:0},N={eyeCenterDistance:0,requiresTwoSteps:!1};export{w as applyTiltConstraint,A as getTiltConstraintError};
|