@arcgis/core 5.0.0-next.87 → 5.0.0-next.89
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/Map.d.ts +4 -0
- package/WebLinkChart.d.ts +6 -3
- package/analysis/ShadowCastAnalysis.d.ts +1 -0
- package/assets/esri/core/t9n/Units_ar.json +1 -1
- package/assets/esri/core/t9n/Units_bg.json +1 -1
- package/assets/esri/core/t9n/Units_bs.json +1 -1
- package/assets/esri/core/t9n/Units_ca.json +1 -1
- package/assets/esri/core/t9n/Units_cs.json +1 -1
- package/assets/esri/core/t9n/Units_da.json +1 -1
- package/assets/esri/core/t9n/Units_de.json +1 -1
- package/assets/esri/core/t9n/Units_el.json +1 -1
- package/assets/esri/core/t9n/Units_en.json +1 -1
- package/assets/esri/core/t9n/Units_es.json +1 -1
- package/assets/esri/core/t9n/Units_et.json +1 -1
- package/assets/esri/core/t9n/Units_fi.json +1 -1
- package/assets/esri/core/t9n/Units_fr.json +1 -1
- package/assets/esri/core/t9n/Units_he.json +1 -1
- package/assets/esri/core/t9n/Units_hr.json +1 -1
- package/assets/esri/core/t9n/Units_hu.json +1 -1
- package/assets/esri/core/t9n/Units_id.json +1 -1
- package/assets/esri/core/t9n/Units_it.json +1 -1
- package/assets/esri/core/t9n/Units_ja.json +1 -1
- package/assets/esri/core/t9n/Units_ko.json +1 -1
- package/assets/esri/core/t9n/Units_lt.json +1 -1
- package/assets/esri/core/t9n/Units_lv.json +1 -1
- package/assets/esri/core/t9n/Units_nl.json +1 -1
- package/assets/esri/core/t9n/Units_no.json +1 -1
- package/assets/esri/core/t9n/Units_pl.json +1 -1
- package/assets/esri/core/t9n/Units_pt-BR.json +1 -1
- package/assets/esri/core/t9n/Units_pt-PT.json +1 -1
- package/assets/esri/core/t9n/Units_ro.json +1 -1
- package/assets/esri/core/t9n/Units_ru.json +1 -1
- package/assets/esri/core/t9n/Units_sk.json +1 -1
- package/assets/esri/core/t9n/Units_sl.json +1 -1
- package/assets/esri/core/t9n/Units_sr.json +1 -1
- package/assets/esri/core/t9n/Units_sv.json +1 -1
- package/assets/esri/core/t9n/Units_th.json +1 -1
- package/assets/esri/core/t9n/Units_tr.json +1 -1
- package/assets/esri/core/t9n/Units_uk.json +1 -1
- package/assets/esri/core/t9n/Units_vi.json +1 -1
- package/assets/esri/core/t9n/Units_zh-CN.json +1 -1
- package/assets/esri/core/t9n/Units_zh-HK.json +1 -1
- package/assets/esri/core/t9n/Units_zh-TW.json +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{1facc1b45345a095b9a7.js → 149c4181eaea32e9ac15.js} +1 -1
- package/assets/esri/core/workers/chunks/{5734aefbce8b6425630c.js → 63b46983155b1672e07a.js} +1 -1
- package/assets/esri/core/workers/chunks/731cab5887c05f221279.js +1 -0
- package/assets/esri/core/workers/chunks/779fe8ccc4041f0b65a0.js +1 -0
- package/assets/esri/core/workers/chunks/{746190bb70aa78ba0bfc.js → 8936f9398414be26b83f.js} +4 -4
- package/assets/esri/core/workers/chunks/{8cb13b3776f07536c79f.js → a0d459bdb91ee892d4b6.js} +1 -1
- package/assets/esri/core/workers/chunks/c267e57eb7f779115aba.js +1 -0
- package/assets/esri/core/workers/chunks/cb6083f7294c8de297e1.js +1 -0
- package/assets/esri/core/workers/chunks/{f9bc4edfdb1590be2d92.js → cb6c9469d7c16727cd12.js} +1 -1
- package/assets/esri/core/workers/chunks/{3b5f24bb824c95996308.js → feba6c9ae162a0a8ea3a.js} +1 -1
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/chunks/{TextureOnly.glsl.js → Texture.glsl.js} +2 -2
- package/chunks/{WaterSurface.glsl.js → Water.glsl.js} +6 -6
- package/config.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/effects/FocusAreas.d.ts +1 -0
- package/form/FormTemplate.js +1 -1
- package/geometry/operators/geodesicBufferOperator.d.ts +1 -0
- package/geometry/operators/geodesicProximityOperator.d.ts +1 -0
- package/geometry/operators/geodeticAreaOperator.d.ts +1 -0
- package/geometry/operators/geodeticDensifyOperator.d.ts +1 -0
- package/geometry/operators/geodeticDistanceOperator.d.ts +1 -0
- package/geometry/operators/geodeticLengthOperator.d.ts +1 -0
- package/geometry/operators/geodeticUtilsOperator.d.ts +1 -0
- package/geometry/operators/shapePreservingProjectOperator.d.ts +1 -0
- package/geometry/operators/support/geographicTransformationUtils.d.ts +1 -0
- package/interfaces.d.ts +2 -2
- package/kernel.js +1 -1
- package/layers/CatalogLayer.d.ts +1 -0
- package/layers/FeatureLayer.d.ts +6 -0
- package/layers/GeoJSONLayer.d.ts +1 -0
- package/layers/Layer.d.ts +1 -0
- package/layers/LinkChartLayer.d.ts +2 -2
- package/layers/MediaLayer.d.ts +1 -0
- package/layers/OGCFeatureLayer.d.ts +1 -0
- package/layers/ParquetLayer.d.ts +6 -0
- package/layers/SubtypeGroupLayer.d.ts +1 -0
- package/layers/WFSLayer.d.ts +1 -0
- package/layers/catalog/CatalogFootprintLayer.d.ts +1 -0
- package/layers/mixins/BlendLayer.d.ts +1 -0
- package/layers/mixins/FeatureEffectLayer.d.ts +2 -0
- package/layers/mixins/ScaleRangeLayer.d.ts +0 -42
- package/layers/raster/datasets/RawBlockCache.js +1 -1
- package/layers/raster/functions/SpectralConversionFunction.js +1 -1
- package/layers/support/FeatureFilter.d.ts +4 -0
- package/layers/support/parquetUtils.d.ts +44 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/layers/support/wmsUtils.js +1 -1
- package/networks/CircuitManager.d.ts +6 -5
- package/networks/CircuitManager.js +1 -1
- package/networks/Network.d.ts +1 -0
- package/networks/UtilityNetwork.js +1 -1
- package/networks/support/Circuit.d.ts +2 -4
- package/networks/support/CircuitLocation.d.ts +1 -7
- package/networks/support/CircuitLocation.js +1 -1
- package/networks/support/CircuitPathConnectivityElement.js +1 -1
- package/networks/support/CircuitSection.d.ts +2 -4
- package/networks/support/Subcircuit.d.ts +2 -2
- package/package.json +4 -4
- package/renderers/FlowRenderer.d.ts +1 -0
- package/renderers/support/colorRampUtils.js +1 -1
- package/rest/featureService/types.d.ts +2 -2
- package/rest/knowledgeGraph/GraphSearch.d.ts +0 -1
- package/rest/knowledgeGraph/GraphSearchStreaming.d.ts +0 -1
- package/rest/networks/circuits/support/QueryCircuitsParameters.js +1 -1
- package/rest/networks/circuits/support/VerifyCircuitsParameters.d.ts +30 -0
- package/rest/networks/circuits/support/VerifyCircuitsParameters.js +1 -1
- package/rest/networks/circuits/verifyCircuits.js +1 -1
- package/rest/networks/support/Association.js +1 -1
- package/rest/networks/support/NetworkElement.d.ts +2 -1
- package/rest/networks/support/TelecomNetworkElement.js +1 -1
- package/rest/networks/support/TraceLocation.d.ts +1 -1
- package/rest/query.d.ts +4 -0
- package/rest/support/BinParametersBase.d.ts +9 -28
- package/rest/support/DateBinParameters.d.ts +0 -17
- package/rest/support/TopFeaturesQuery.d.ts +1 -0
- package/support/revision.js +1 -1
- package/symbols/CIMSymbol.d.ts +1 -0
- package/symbols/LineSymbolMarker.d.ts +2 -2
- package/symbols/SimpleFillSymbol.d.ts +2 -1
- package/symbols/SimpleLineSymbol.d.ts +4 -4
- package/symbols/support/cimSymbolUtils.d.ts +2 -0
- package/symbols/types.d.ts +140 -28
- package/views/2d/constraints/ZoomConstraint.js +1 -1
- package/views/2d/engine/imagery/RasterBitmap.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterProcessorTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/FocalStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/SpectralConversionTechnique.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/StretchTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/SpectralConversionShader.js +5 -0
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/types.d.ts +6 -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/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
- package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
- package/views/3d/layers/SceneLayerWorker.js +1 -1
- package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
- package/views/3d/terrain/BlendLayers.glsl.js +5 -0
- package/views/3d/terrain/BlendLayersTechnique.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/RasterColorizer.glsl.js +5 -0
- package/views/3d/terrain/RasterColorizerTechnique.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/{Water.glsl.js → WaterColor.glsl.js} +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +2 -2
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/HighlightApply.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/highlight/HighlightApplyTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/HighlightBlur.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/HighlightDownsample.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/highlight/HighlightDownsampleTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/HighlightToSingle.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/highlight/HighlightToSingleTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlightTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/Laserline.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePath.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlineTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/MagnifierTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/BlendWeights.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/smaa/Blur.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/smaa/EdgeDetect.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/smaa/SMAABlendWeightsTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAABlurTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAAEdgeDetectTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAOBlur.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/ssao/SSAOBlurTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAOTechnique.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.glsl.js +5 -0
- package/views/3d/webgl-engine/lib/TextureTechnique.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeShader.glsl.js +5 -0
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechnique.js +1 -1
- package/views/3d/webgl-engine/{shaders → materials}/Path.glsl.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/{shaders/WaterSurface.glsl.js → materials/Water.glsl.js} +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
- package/views/3d/webgl.js +1 -1
- package/views/VideoView.d.ts +1 -0
- package/views/interactive/snapping/FeatureSnappingLayerSource.d.ts +1 -0
- package/views/layers/FeatureLayerViewMixin.d.ts +1 -0
- package/views/support/euclideanAreaMeasurementUtils.js +1 -1
- package/views/webgl/ShaderBuilder.js +1 -1
- package/widgets/Attachments.d.ts +1 -0
- package/widgets/BuildingExplorer.d.ts +1 -1
- package/widgets/Editor/AddAssociationWorkflow.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRanges.d.ts +43 -1
- package/widgets/Slider/SliderViewModel.js +1 -1
- package/widgets/Swipe.d.ts +1 -1
- package/widgets/TableList.d.ts +1 -0
- package/widgets/UtilityNetworkAssociations.d.ts +1 -0
- package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
- package/widgets/UtilityNetworkTrace.d.ts +1 -0
- package/widgets/UtilityNetworkValidateTopology.d.ts +1 -0
- package/widgets/support/SnappingControls.d.ts +1 -0
- package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/utils/createAssociation.js +1 -1
- package/assets/esri/core/workers/chunks/165cf8031af160c99d70.js +0 -1
- package/assets/esri/core/workers/chunks/4f4bdf9f5323fa702e6c.js +0 -1
- package/assets/esri/core/workers/chunks/641450da2680ae09b8e7.js +0 -1
- package/assets/esri/core/workers/chunks/cb66a74448a6c0c20d5d.js +0 -1
- package/layers/graphics/sources/ParquetSource.d.ts +0 -45
- package/views/3d/webgl-engine/core/shaderLibrary/raster/RasterColorizer.glsl.js +0 -5
- package/views/3d/webgl-engine/core/shaderLibrary/util/BlendLayers.glsl.js +0 -5
- package/views/3d/webgl-engine/core/shaderLibrary/util/TextureOnly.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/BlendWeights.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/Blur.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/EdgeDetect.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/HighlightBlur.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/HighlightToSingle.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/LaserlinePath.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/Laserlines.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/Magnifier.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/SSAO.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/SSAOBlur.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeShader.glsl.js +0 -5
- /package/chunks/{Laserlines.glsl.js → Laserline.glsl.js} +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 a,multiplyOpacity as n}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTen as o,floatEqualUlp as l}from"../../../../../core/mathUtils.js";import{destroyMaybe as m}from"../../../../../core/maybe.js";import{toAdaptiveAreaUnit as h,adaptiveLengthUnitForArea as c}from"../../../../../core/quantity.js";import{formatDecimal as p}from"../../../../../core/quantityFormatUtils.js";import{watch as d,syncAndInitial as u,initial as _}from"../../../../../core/reactiveUtils.js";import{lengthUnitFromSpatialReference as v,convertUnit as g,adaptiveAreaUnit as b}from"../../../../../core/units.js";import{property as w,subclass as f}from"../../../../../core/accessorSupport/decorators.js";import{fromTranslation as D}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as L}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as y,squaredDistance as S}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as C}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{LabelVisualElement as j}from"../../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as x}from"../../../interactive/visualElements/LineVisualElement.js";import{MeasurementAreaVisualElement as V}from"../../../interactive/visualElements/MeasurementAreaVisualElement.js";import{GeodesicSegment as A,EuclideanSegment as M}from"../../../interactive/visualElements/support/Segment.js";import{midpoint3d as R}from"../../../support/mathUtils.js";import{createStipplePatternSimple as k}from"../../../webgl-engine/materials/lineStippleUtils.js";let z=class extends s{get _parameters(){const{accentColor:e,textColor:t}=this.view.effectiveTheme,i=e.toUnitRGBA(),s=r(e,.5),o=r(a(e),.5),l=a(t,160);return{accentColor:i,transparentAccentColor:s,transparentContrastColor:o,textColor:t,textBackgroundColor:n(l,.6),textCalloutColor:n(l,.5),pathLineWidth:3,perimeterLineWidth:2,projectionLineWidth:2,projectionLineStippleSize:5,labelDistance:25}}get viewData(){return this._viewData}get visible(){return this.analysisViewData.visible}get _renderUnits(){const e=this.view.renderCoordsHelper.spatialReference;return v(e)??"meters"}get testData(){}constructor(e){super(e),this._path=null,this._perimeter=null,this._projectionLines=null,this._measurementArea=null,this._areaLabel=null,this._perimeterLabel=null,this._pathSegments=[],this._perimeterSegments=[],this._origin=C(),this._originTransform=L(),this.messages=null,this._viewData=new U,this.areaLabel=null,this.perimeterLabel=null,this.loadingMessages=!0}initialize(){const{analysisViewData:e,_parameters:i,view:s}=this;this._path=new x({view:s,attached:!0,width:i.pathLineWidth,polygonOffset:!0,renderOccluded:4,tansparentRenderOrder:1,isDecoration:!0}),this._perimeter=new x({view:s,attached:!0,width:i.perimeterLineWidth,polygonOffset:!0,renderOccluded:4,tansparentRenderOrder:2,isDecoration:!0}),this._projectionLines=new x({view:s,attached:!0,width:i.projectionLineWidth,stipplePattern:k(i.projectionLineStippleSize),polygonOffset:!0,renderOccluded:4,tansparentRenderOrder:3,isDecoration:!0}),this._measurementArea=new V({view:s,attached:!0,isDecoration:!0,renderOccluded:4,testsTransparentRenderOrder:5});const r={attached:!0,view:s,isDecoration:!0};this._areaLabel=new j({...r,fontSize:16,distance:0}),this._perimeterLabel=new j({...r,fontSize:12}),this.addHandles([d(()=>[e.mode,this.visible,e.unit,e.measurementData?.updateId,null!=e.measurementData?.measurements,E(e.measurementData?.measurements?.mode)],()=>this._update(),u),d(()=>e.measurementData?.measurements,e=>this._updateMeasurements(e)),d(()=>s.state?.camera,()=>this._updateLabels(),u),t(()=>this._updateMessageBundle()),d(()=>this._parameters,({accentColor:e,transparentAccentColor:t,transparentContrastColor:i,textColor:s,textBackgroundColor:r,textCalloutColor:a})=>{const{_path:n,_perimeter:o,_projectionLines:l,_measurementArea:m,_areaLabel:h,_perimeterLabel:c}=this;n.color=e,o.color=e,l.color=e,m.color1=t,m.color2=i,h.textColor=s,h.backgroundColor=r,h.calloutColor=a,c.textColor=s,c.backgroundColor=r,c.calloutColor=a},_)]),this._updateMessageBundle()}destroy(){this._measurementArea=m(this._measurementArea),this._path=m(this._path),this._perimeter=m(this._perimeter),this._areaLabel=m(this._areaLabel),this._perimeterLabel=m(this._perimeterLabel),this._projectionLines=m(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())}_calculateCheckerSize(e){const t=F(e?.mode)?e?.geodesicArea:e?.area;if(null==t)return 1;const i=h(t,this.analysisViewData.unit),s=Math.sqrt(g(1,i.unit,"square-meters"));return g(o(Math.sqrt(i.value)/Math.sqrt(300))*s,"meters",this._renderUnits)}_updateMeasurements(e){Object.assign(this.viewData,this._getMeasurementsViewData(e)),this._updateCheckerSize(),this._updateLabels()}_updateCheckerSize(){this._measurementArea.size=[this.viewData.checkerSize,this.viewData.checkerSize]}_updateViewData(e,t){const i=e.measurements,s=new U({validMeasurement:!!i,numVertices:e.numVertices,hasStagedVertex:e.hasStagedVertex,path:t,mode:i?.mode,vertexData:e.vertexData,perimeterLabelSegmentIndex:0,...this._getMeasurementsViewData(i)});this._viewData=s}_getMeasurementsViewData(e){const t=F(e?.mode),i=this._calculateCheckerSize(e);return{areaCentroid:t?e?.geodesicAreaCentroidRenderCoords:e?.areaCentroidRenderCoords,area:t?e?.geodesicArea:e?.area,perimeter:t?e?.geodesicPerimeter:e?.perimeter,checkerSize:i}}_updateOrigin(){const e=this.viewData;R(e.vertexData.positionsRender,this._origin),D(this._originTransform,this._origin),this._measurementArea.transform=this._originTransform,this._projectionLines.transform=this._originTransform}_createSegments(e,t){const i=this.viewData,s=this.view.renderCoordsHelper.spatialReference,r=E(i.mode),a=[],n=i.numVertices,o=i.validMeasurement?n:n-1;for(let m=0;m<o;++m){const o=i.vertexData[e][m],h=i.vertexData[e][(m+1)%n];let c=!0;if(t){const e=i.vertexData.positionsRender[m],t=i.vertexData.positionsRender[(m+1)%n];let s=!0;for(let i=0;i<3;++i)s&&=l(e[i],o[i])&&l(t[i],h[i]);s&&(c=!1)}let p=null;switch(r){case"geodesic":p=new A(o,h,s,c);break;case"euclidean":p=new M(o,h,c)}a.push(p)}return a}_updatePathSegments(){const{visible:e}=this,t=this._createSegments("positionsRender");this._path.setGeometryFromSegments(t,this._origin),this._path.visible=e,this._pathSegments=t}_updatePerimeterSegments(){const e=this.visible&&"euclidean"===this.viewData.mode&&!!this.viewData.path&&this.viewData.path.numVertices>2,t=!0,i=this._createSegments("positionsFittedRender",t);this._perimeter.setGeometryFromSegments(i,this._origin),this._perimeter.visible=e,this._perimeterSegments=i}_updateArea(){const e=this.viewData;switch(E(e.mode)){case"euclidean":this._updateAreaEuclidean(e);break;case"geodesic":this._updateAreaGeodesic()}}_updateAreaEuclidean(e){const t=this.visible;e.validMeasurement&&e.vertexData.triangleIndices?(this._measurementArea.geometry={uv:e.vertexData.positionsFittedWorldPlaneProjected,position:e.vertexData.positionsFittedRender,triangleIndices:e.vertexData.triangleIndices},this._updateCheckerSize(),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=C();y(s,e.vertexData.positionsRender[t],this._origin);const r=C();y(r,e.vertexData.positionsFittedRender[t],this._origin),l(S(s,r),0)||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,a=this._perimeterLabel,n=e.validMeasurement;r.visible=!0,a.visible=!0;let o=!1;const l=O(this.messages,t,this.analysisViewData.unit);if(null!=l&&e.areaCentroid&&s&&(r.geometry={type:"point",point:e.areaCentroid},r.text=l,o=e.validMeasurement),this._set("areaLabel",l),s&&n){const t=F(e.mode),i=e.perimeter,s=P(this.messages,i,this.analysisViewData.unit);this._set("perimeterLabel",s),a.distance=this._parameters.labelDistance,a.anchor="top",a.text=s;let r=!0;for(let n=0;n<e.numVertices;++n){const i=(e.perimeterLabelSegmentIndex+n)%e.numVertices,s=t?this._pathSegments[i]:this._perimeterSegments[i];if(r=!0,a.geometry={type:"segment",segment:s,sampleLocation:"center"},!a.overlaps(this._areaLabel))break;r=!1}a.visible=r}else a.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 O(e,t,i){return e&&t&&p(e,t,b(t.value,t.unit,i))}function P(e,t,i){return e&&t&&p(e,t,c(t,i))}e([w()],z.prototype,"_parameters",null),e([w()],z.prototype,"view",void 0),e([w()],z.prototype,"messages",void 0),e([w()],z.prototype,"analysis",void 0),e([w()],z.prototype,"_viewData",void 0),e([w()],z.prototype,"analysisViewData",void 0),e([w({readOnly:!0})],z.prototype,"areaLabel",void 0),e([w({readOnly:!0})],z.prototype,"perimeterLabel",void 0),e([w()],z.prototype,"loadingMessages",void 0),e([w()],z.prototype,"visible",null),e([w()],z.prototype,"_renderUnits",null),z=e([f("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementVisualization")],z);class U{constructor(e){this.validMeasurement=e?.validMeasurement??!1,this.numVertices=e?.numVertices??0,this.hasStagedVertex=e?.hasStagedVertex??!1,this.path=e?.path,this.vertexData=e?.vertexData??{positionsRender:[],positionsFittedWorldPlaneProjected:[],positionsFittedRender:[],triangleIndices:null},this.mode=e?.mode,this.areaCentroid=e?.areaCentroid,this.perimeterLabelSegmentIndex=e?.perimeterLabelSegmentIndex??0,this.checkerSize=e?.checkerSize??1,this.area=e?.area,this.perimeter=e?.perimeter}}function E(e){switch(e){case"euclidean":case void 0:case null:return"euclidean";case"geodesic":return"geodesic"}}function F(e){return"geodesic"===E(e)}export{z as AreaMeasurementVisualization,U as ViewData};
|
|
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 a,multiplyOpacity as n}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTen as o,floatEqualUlp as l}from"../../../../../core/mathUtils.js";import{destroyMaybe as m}from"../../../../../core/maybe.js";import{toAdaptiveAreaUnit as h,adaptiveLengthUnitForArea as c}from"../../../../../core/quantity.js";import{formatDecimal as p}from"../../../../../core/quantityFormatUtils.js";import{watch as d,syncAndInitial as u,initial as _}from"../../../../../core/reactiveUtils.js";import{lengthUnitFromSpatialReference as v,convertUnit as g,adaptiveAreaUnit as b}from"../../../../../core/units.js";import{property as w,subclass as f}from"../../../../../core/accessorSupport/decorators.js";import{fromTranslation as D}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as L}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as y,squaredDistance as S}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as C}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{LabelVisualElement as x}from"../../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as j}from"../../../interactive/visualElements/LineVisualElement.js";import{MeasurementAreaVisualElement as V}from"../../../interactive/visualElements/MeasurementAreaVisualElement.js";import{GeodesicSegment as A,EuclideanSegment as M}from"../../../interactive/visualElements/support/Segment.js";import{midpoint3d as R}from"../../../support/mathUtils.js";import{createStipplePatternSimple as k}from"../../../webgl-engine/materials/lineStippleUtils.js";let z=class extends s{get _parameters(){const{accentColor:e,textColor:t}=this.view.effectiveTheme,i=e.toUnitRGBA(),s=r(e,.5),o=r(a(e),.5),l=a(t,160);return{accentColor:i,transparentAccentColor:s,transparentContrastColor:o,textColor:t,textBackgroundColor:n(l,.6),textCalloutColor:n(l,.5),pathLineWidth:3,perimeterLineWidth:2,projectionLineWidth:2,projectionLineStippleSize:5,labelDistance:25}}get viewData(){return this._viewData}get visible(){return this.analysisViewData.visible}get _renderUnits(){const e=this.view.renderCoordsHelper.spatialReference;return v(e)??"meters"}get testData(){}constructor(e){super(e),this._path=null,this._perimeter=null,this._projectionLines=null,this._measurementArea=null,this._areaLabel=null,this._perimeterLabel=null,this._pathSegments=[],this._perimeterSegments=[],this._origin=C(),this._originTransform=L(),this.messages=null,this._viewData=new P,this.areaLabel=null,this.perimeterLabel=null,this.loadingMessages=!0}initialize(){const{analysisViewData:e,_parameters:i,view:s}=this;this._path=new j({view:s,attached:!0,width:i.pathLineWidth,polygonOffset:!0,renderOccluded:4,tansparentRenderOrder:1,isDecoration:!0}),this._perimeter=new j({view:s,attached:!0,width:i.perimeterLineWidth,polygonOffset:!0,renderOccluded:4,tansparentRenderOrder:2,isDecoration:!0}),this._projectionLines=new j({view:s,attached:!0,width:i.projectionLineWidth,stipplePattern:k(i.projectionLineStippleSize),polygonOffset:!0,renderOccluded:4,tansparentRenderOrder:3,isDecoration:!0}),this._measurementArea=new V({view:s,attached:!0,isDecoration:!0,renderOccluded:4,testsTransparentRenderOrder:5});const r={attached:!0,view:s,isDecoration:!0};this._areaLabel=new x({...r,fontSize:16,distance:0}),this._perimeterLabel=new x({...r,fontSize:12}),this.addHandles([d(()=>[e.mode,this.visible,e.unit,e.measurementData?.updateId,null!=e.measurementData?.measurements,E(e.measurementData?.measurements?.mode)],()=>this._update(),u),d(()=>e.measurementData?.measurements,e=>this._updateMeasurements(e)),d(()=>s.state?.camera,()=>this._updateLabels(),u),t(()=>this._updateMessageBundle()),d(()=>this._parameters,({accentColor:e,transparentAccentColor:t,transparentContrastColor:i,textColor:s,textBackgroundColor:r,textCalloutColor:a})=>{const{_path:n,_perimeter:o,_projectionLines:l,_measurementArea:m,_areaLabel:h,_perimeterLabel:c}=this;n.color=e,o.color=e,l.color=e,m.color1=t,m.color2=i,h.textColor=s,h.backgroundColor=r,h.calloutColor=a,c.textColor=s,c.backgroundColor=r,c.calloutColor=a},_)]),this._updateMessageBundle()}destroy(){this._measurementArea=m(this._measurementArea),this._path=m(this._path),this._perimeter=m(this._perimeter),this._areaLabel=m(this._areaLabel),this._perimeterLabel=m(this._perimeterLabel),this._projectionLines=m(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())}_calculateCheckerSize(e){const t=I(e?.mode)?e?.geodesicArea:e?.area;if(null==t)return 1;const i=h(t,this.analysisViewData.unit),s=Math.sqrt(g(1,i.unit,"square-meters"));return g(o(Math.sqrt(i.value)/Math.sqrt(300))*s,"meters",this._renderUnits)}_updateMeasurements(e){Object.assign(this.viewData,this._getMeasurementsViewData(e)),this._updateCheckerSize(),this._updateLabels()}_updateCheckerSize(){this._measurementArea.size=[this.viewData.checkerSize,this.viewData.checkerSize]}_updateViewData(e,t){const i=e.measurements,s=new P({validMeasurement:!!i,numVertices:e.numVertices,hasStagedVertex:e.hasStagedVertex,path:t,mode:i?.mode,vertexData:e.vertexData,perimeterLabelSegmentIndex:0,...this._getMeasurementsViewData(i)});this._viewData=s}_getMeasurementsViewData(e){const t=I(e?.mode),i=this._calculateCheckerSize(e);return{areaCentroid:t?e?.geodesicAreaCentroidRenderCoords:e?.areaCentroidRenderCoords,area:t?e?.geodesicArea:e?.area,perimeter:t?e?.geodesicPerimeter:e?.perimeter,checkerSize:i}}_updateOrigin(){const e=this.viewData;R(e.vertexData.positionsRender,this._origin),D(this._originTransform,this._origin),this._measurementArea.transform=this._originTransform,this._projectionLines.transform=this._originTransform}_createSegments(e,t){const i=this.viewData,s=this.view.renderCoordsHelper.spatialReference,r=E(i.mode),a=[],n=i.numVertices,o=i.validMeasurement?n:n-1;for(let m=0;m<o;++m){const o=i.vertexData[e][m],h=i.vertexData[e][(m+1)%n];let c=!0;if(t){const e=i.vertexData.positionsRender[m],t=i.vertexData.positionsRender[(m+1)%n];let s=!0;for(let i=0;i<3;++i)s&&=l(e[i],o[i])&&l(t[i],h[i]);s&&(c=!1)}let p=null;switch(r){case"geodesic":p=new A(o,h,s,c);break;case"euclidean":p=new M(o,h,c)}a.push(p)}return a}_updatePathSegments(){const{visible:e}=this,t=this._createSegments("positionsRender");this._path.setGeometryFromSegments(t,this._origin),this._path.visible=e,this._pathSegments=t}_updatePerimeterSegments(){const e=this.visible&&"euclidean"===this.viewData.mode&&!!this.viewData.path&&this.viewData.path.numVertices>2,t=!0,i=this._createSegments("positionsFittedRender",t);this._perimeter.setGeometryFromSegments(i,this._origin),this._perimeter.visible=e,this._perimeterSegments=i}_updateArea(){const e=this.viewData;switch(E(e.mode)){case"euclidean":this._updateAreaEuclidean(e);break;case"geodesic":this._updateAreaGeodesic()}}_updateAreaEuclidean(e){const t=this.visible;e.validMeasurement&&e.vertexData.triangleIndices?(this._measurementArea.geometry={uv:e.vertexData.triangleUvs,position:e.vertexData.trianglePositions,triangleIndices:e.vertexData.triangleIndices},this._updateCheckerSize(),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=C();y(s,e.vertexData.positionsRender[t],this._origin);const r=C();y(r,e.vertexData.positionsFittedRender[t],this._origin),l(S(s,r),0)||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,a=this._perimeterLabel,n=e.validMeasurement;r.visible=!0,a.visible=!0;let o=!1;const l=O(this.messages,t,this.analysisViewData.unit);if(null!=l&&e.areaCentroid&&s&&(r.geometry={type:"point",point:e.areaCentroid},r.text=l,o=e.validMeasurement),this._set("areaLabel",l),s&&n){const t=I(e.mode),i=e.perimeter,s=U(this.messages,i,this.analysisViewData.unit);this._set("perimeterLabel",s),a.distance=this._parameters.labelDistance,a.anchor="top",a.text=s;let r=!0;for(let n=0;n<e.numVertices;++n){const i=(e.perimeterLabelSegmentIndex+n)%e.numVertices,s=t?this._pathSegments[i]:this._perimeterSegments[i];if(r=!0,a.geometry={type:"segment",segment:s,sampleLocation:"center"},!a.overlaps(this._areaLabel))break;r=!1}a.visible=r}else a.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 O(e,t,i){return e&&t&&p(e,t,b(t.value,t.unit,i))}function U(e,t,i){return e&&t&&p(e,t,c(t,i))}e([w()],z.prototype,"_parameters",null),e([w()],z.prototype,"view",void 0),e([w()],z.prototype,"messages",void 0),e([w()],z.prototype,"analysis",void 0),e([w()],z.prototype,"_viewData",void 0),e([w()],z.prototype,"analysisViewData",void 0),e([w({readOnly:!0})],z.prototype,"areaLabel",void 0),e([w({readOnly:!0})],z.prototype,"perimeterLabel",void 0),e([w()],z.prototype,"loadingMessages",void 0),e([w()],z.prototype,"visible",null),e([w()],z.prototype,"_renderUnits",null),z=e([f("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementVisualization")],z);class P{constructor(e){this.validMeasurement=e?.validMeasurement??!1,this.numVertices=e?.numVertices??0,this.hasStagedVertex=e?.hasStagedVertex??!1,this.path=e?.path,this.vertexData=e?.vertexData??{positionsRender:[],positionsFittedWorldPlaneProjected:[],positionsFittedRender:[],triangleIndices:null,trianglePositions:[],triangleUvs:[]},this.mode=e?.mode,this.areaCentroid=e?.areaCentroid,this.perimeterLabelSegmentIndex=e?.perimeterLabelSegmentIndex??0,this.checkerSize=e?.checkerSize??1,this.area=e?.area,this.perimeter=e?.perimeter}}function E(e){switch(e){case"euclidean":case void 0:case null:return"euclidean";case"geodesic":return"geodesic"}}function I(e){return"geodesic"===E(e)}export{z as AreaMeasurementVisualization,P as ViewData};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import{
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import{resizeFilled as r}from"../../../../../core/arrayUtils.js";import{deg2rad as s}from"../../../../../core/mathUtils.js";import{abortMaybe as o}from"../../../../../core/maybe.js";import{debounce as i,throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{valueInUnit as a}from"../../../../../core/quantity.js";import{lengthUnitFromSpatialReference as l,areaUnitFromSpatialReference as d}from"../../../../../core/units.js";import{property as h}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{e as m}from"../../../../../chunks/earcut.js";import{set as c}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as _,set as g,cross as f,subtract as P,dot as j,scale as x,add as v}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as C}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import y from"../../../../../geometry/Polygon.js";import R from"../../../../../geometry/SpatialReference.js";import{isPCPF as U}from"../../../../../geometry/spatialReferenceEllipsoidUtils.js";import{i as M,e as W}from"../../../../../chunks/simplifyOperator.js";import{projectDirection as D}from"../../../../../geometry/projection/projectDirection.js";import{projectPointToVector as A}from"../../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as V}from"../../../../../geometry/projection/projectVectorToVector.js";import{compactIndices as b}from"../../../../../geometry/support/Indices.js";import{Sphere as F}from"../../../../../geometry/support/sphere.js";import{triangulate as S}from"../../../../../geometry/support/triangulationUtils.js";import{bestFitPlane as I,planePointDistance as T,boundingSphere as O}from"../../support/measurementUtils.js";import{getElevationAtPoint as k}from"../../../support/ElevationProvider.js";import{midpoint3d as z,makeOrthonormal as q}from"../../../support/mathUtils.js";import{useGeodesicAreaMeasurement as E}from"../../../../support/automaticAreaMeasurementUtils.js";import{flatten2DVertexDataToArray as H}from"../../../../support/euclideanAreaMeasurementUtils.js";import{computeEuclideanMeasurementSR as L}from"../../../../support/measurementUtils.js";import{MeasurementWorkerHandle as B}from"../../../../support/MeasurementWorkerHandle.js";class Z{constructor(t){this.positionsWorld=[],this.positionsRender=[],this.positionsFittedRender=[],this.positionsFittedRenderComplex=[],this.positionsFittedWorldPlaneProjectedComplex=[],this.triangleIndices=null,this.areaPolygon=new y({rings:[[]],spatialReference:t}),this.positionsFittedWorldPlaneProjected=this.areaPolygon.rings[0],this.trianglePositions=this.positionsFittedRender,this.triangleUvs=this.positionsFittedWorldPlaneProjected}}class G{constructor(t,e=null,r=null,s=null,o=null,i=null,n=null){this.mode=t,this.area=e,this.geodesicArea=r,this.perimeter=s,this.geodesicPerimeter=o,this.areaCentroidRenderCoords=i,this.geodesicAreaCentroidRenderCoords=n}}let J=class extends e{get numVertices(){return this._length}get hasStagedVertex(){return null!=this._lastCursorPoint}get fittingMode(){return this._fittingMode}get measurements(){return this._measurements}get updateId(){return this._updateId}constructor(t){super(t),this._length=0,this._lastCursorPoint=null,this._fittingMode=null,this._measurements=null,this._updateId=0,this._centroidRenderCoords=w(),this._planeWorldCoords=C(),this._worldUp=w(),this._worldTangent=w(),this._frame=[w(),w(),w()],this._worldOrigin=w(),this._updateAxisU=w(),this._updateAxisV=w(),this._updateWorldOrigin=w(),this._lastPathVersion=-1,this._mode=null,this._tempU=w(),this._tempV=w(),this._tempVec3=w(),this._tempSphere=new F,this._measurementWorker=new B,this._updateAbortController=null,this._updateMeasurements=i(async(t,e,r,s,o,i)=>{const a=t.spatialReference,l=E(a);_(this._updateAxisU,this._frame[0]),_(this._updateAxisV,this._frame[1]),_(this._updateWorldOrigin,this._worldOrigin);const d=(e,r)=>(e&&t.renderCoordsHelper.toRenderCoords(e,r)||g(r,0,0,0),r),h=e.areaMeasurement?.geometry,p=l&&1!==r&&h?await this._measurementWorker.geodesicLength(h,{stagedPoint:s?o:null}):null;n(i);const m=this._calculateMode(r,p),c="geodesic"===m,[u,f]=await Promise.all([c?null:this._measurementWorker.area2D(this.vertexData.areaPolygon,{unit:this._areaMeasurementUnit,lengthUnit:this._lengthMeasurementUnit,returnCentroid:!0,returnLength:!0}),c&&h?await this._measurementWorker.geodesicArea(h,{stagedPoint:s?o:null,returnCentroid:!0}):null]);n(i);const P=c?null:w();P&&u?.centroid&&this._projectWorldPlaneProjectedPointToRender(P,this._updateWorldOrigin,[u.centroid?.x??0,u.centroid?.y??0],this._updateAxisU,this._updateAxisV,this.view.renderSpatialReference,this._measurementSR);const j=f?.centroid?d(f.centroid,w()):null;this._measurements=new G(m,c?null:u?.area,c?f?.area:null,c?null:u?.length,c?p:null,c?null:P,c?j:null)});const e=L(t.view.spatialReference);this._measurementSR=e,this._lengthMeasurementUnit=l(e)??"meters",this._areaMeasurementUnit=d(e)??"square-meters";const r=U(e)?R.WebMercator:e;this.vertexData=new Z(r)}destroy(){this._measurementWorker.destroy()}update(t,e,r,s,o,i,n){const a=this._lastPathVersion===t.version,l=e?e.equals(this._lastCursorPoint):null==this._lastCursorPoint,d=this._mode===o;return!(a&&!i&&d&&l)&&(this._lastPathVersion=t.version,this._lastCursorPoint=e,this._update(t,e,r,s,o,n),!0)}_update(t,e,r,s,i,n){const a=this.view.renderSpatialReference,l=this._measurementSR;let d=t.numVertices;const h=!(null==e||e.equals(t.lastPoint)||d>2&&e.equals(t.firstPoint)||t.polygonIsClosed);h&&(d+=1);const p=!t.polygonIsClosed&&d>2,m=t.polygonIsClosed||p;this._resize(d);const{positionsWorld:c,positionsRender:u}=this.vertexData,_=(t,e)=>{K(r.elevationProvider,t),A(t,c[e],l),A(t,u[e],a)};if(t.forEachVertexPosition((t,e)=>_(t,e)),h&&_(e,d-1),this.vertexData.areaPolygon.clearCache(),!m)return this._measurements=null,this.vertexData.triangleIndices=null,this._updateId++,void(this._updateAbortController=o(this._updateAbortController));this._updateVertexData(r,a,l,s),this._updateId++,this._updateAbortController??=new AbortController,n.addPromise(this._updateMeasurements(r,t,i,h,e,this._updateAbortController.signal))}_resize(t){const{positionsWorld:e,positionsRender:s,positionsFittedWorldPlaneProjected:o,positionsFittedRender:i}=this.vertexData;r(e,t,w),r(s,t,w),r(o,t,u),r(i,t,w),this._length=t}_updateVertexData(t,e,r,s){const o=t.renderCoordsHelper,{positionsWorld:i,positionsRender:n}=this.vertexData,a=this._planeWorldCoords,l=this._centroidRenderCoords;z(n,l),o.worldUpAtPosition(l,this._worldUp),o.worldBasisAtPosition(l,0,this._worldTangent),D(l,this._worldUp,e,this._worldUp,r),D(l,this._worldTangent,e,this._worldTangent,r),i.length>2&&I(i,a),this._fittingMode=this._selectFittingMode(a,i,this._worldUp,s);let d=0;if("horizontal"===this._fittingMode){let t=-1/0;n.forEach((e,r)=>{const s=o.getAltitude(n[r]);s>t&&(t=s,d=r)})}const{_worldOrigin:h}=this;_(this._worldOrigin,i[d]);let p=a,m=this._worldTangent;"horizontal"===this._fittingMode?p=this._worldUp:"vertical"===this._fittingMode&&(p=this._tempVec3,m=this._worldUp,q(a,this._worldUp,p));const u=this._frame[0],g=this._frame[1];_(this._frame[2],p),q(m,p,u),f(g,u,this._frame[2]);const{positionsFittedRender:x,positionsFittedWorldPlaneProjected:v}=this.vertexData,w=this._tempVec3;for(let _=0;_<this._length;++_){const t=v[_],s=x[_];P(w,i[_],h),c(t,j(u,w),j(g,w)),this._projectWorldPlaneProjectedPointToRender(s,h,t,u,g,e,r)}this._triangulate(new Q(h,u,g,e,r))}_triangulate(t){!M(this.vertexData.areaPolygon)&&this._triangulateComplexPolygon(t)||this._triangulateSimplePolygon()}_triangulateSimplePolygon(){const{positionsFittedWorldPlaneProjected:t}=this.vertexData;this.vertexData.triangleIndices=b(m(H(t),[],2)),this.vertexData.trianglePositions=this.vertexData.positionsFittedRender,this.vertexData.triangleUvs=t,this.vertexData.positionsFittedWorldPlaneProjectedComplex.length=0,this.vertexData.positionsFittedRenderComplex.length=0}_triangulateComplexPolygon({worldOrigin:t,axisU:e,axisV:s,renderSR:o,worldSR:i}){const{positionsFittedWorldPlaneProjectedComplex:n,positionsFittedRenderComplex:a,areaPolygon:l}=this.vertexData,d=W(l);if(!d)return!1;const{position:h,faces:p}=S(d),m=h.length/3;r(n,m,u),r(a,m,w);for(let r=0,u=0;r<h.length;r+=3,u++){const l=n[u];c(l,h[r],h[r+1]);const d=a[u];this._projectWorldPlaneProjectedPointToRender(d,t,l,e,s,o,i)}return this.vertexData.triangleIndices=p,this.vertexData.trianglePositions=a,this.vertexData.triangleUvs=n,!0}_projectWorldPlaneProjectedPointToRender(t,e,r,s,o,i,n){const a=this._tempU,l=this._tempV;x(a,s,r[0]),x(l,o,r[1]),v(t,a,l),v(t,t,e),V(t,n,t,i)}_selectFittingMode(t,e,r,o){const i=e.map(e=>Math.abs(T(t,e))).reduce((t,e)=>Math.max(t,e),0);O(e,this._tempSphere);const n=i/(2*this._tempSphere.radius),a=n<o.maxRelativeErrorCoplanar,l=n<o.maxRelativeErrorAlmostCoplanar;let d="horizontal";if(a)d="oblique";else if(l){d=Math.abs(j(r,t))>Math.cos(s(o.verticalAngleThreshold))?"horizontal":"vertical"}return d}_calculateMode(t,e){return null!=e&&0===t?a(e,"meters")>N?"geodesic":"euclidean":null==e||1===t?"euclidean":"geodesic"}};function K(t,e){e.hasZ||(e.z=k(t,e,"ground")??0)}t([h()],J.prototype,"_measurements",void 0),t([h()],J.prototype,"_updateId",void 0),t([h()],J.prototype,"view",void 0),J=t([p("esri.views.3d.analysis.AreaMeasurement.support.MeasurementData")],J);const N=1e5;class Q{constructor(t,e,r,s,o){this.worldOrigin=t,this.axisU=e,this.axisV=r,this.renderSR=s,this.worldSR=o}}export{G as AreaMeasurementQuantities,J as MeasurementData};
|
|
@@ -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{debounce as n}from"../../../../core/promiseUtils.js";import{createVolume as i}from"../../../../core/quantity.js";import{whenOnce as s,watch as l,syncAndInitial as a}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as p}from"../../../../core/screenUtils.js";import{property as u,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{e as c}from"../../../../chunks/earcut.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h,scaleAndAdd as g,sqrDist as y}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as f,create as _,clone as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as w}from"../../../../core/support/UpdatingHandles.js";import{projectOrLoad as j}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as b}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as E}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as R,create as G,expand as x,width as L,height as H,fromExtent as T,intersects as
|
|
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 n}from"../../../../core/promiseUtils.js";import{createVolume as i}from"../../../../core/quantity.js";import{whenOnce as s,watch as l,syncAndInitial as a}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as p}from"../../../../core/screenUtils.js";import{property as u,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{e as c}from"../../../../chunks/earcut.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h,scaleAndAdd as g,sqrDist as y}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as f,create as _,clone as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as w}from"../../../../core/support/UpdatingHandles.js";import{projectOrLoad as j}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as b}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as E}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as R,create as G,expand as x,width as L,height as H,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 M from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as U}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as I}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementDistanceTooCloseError as A,VolumeMeasurementDistanceTooFarError as O,VolumeMeasurementPerimeterTooLargeError as D,VolumeMeasurementUnsupportedCoordinateSystemError as S,VolumeMeasurementUnsupportedLayerTransparencyError as F}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as k}from"./VolumeMeasurementRawResult.js";import W from"./VolumeMeasurementResult.js";import{ElevationContext as N}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as z}from"../../support/ElevationProvider.js";import{polygonToRenderInfo as q}from"../../support/renderInfoUtils/polygon.js";import{CutFillDepth as B,TargetGeometryRenderInfo as J}from"../../webgl-engine/lib/CutFillDepth.js";import{MeasurementWorkerHandle as K}from"../../../support/MeasurementWorkerHandle.js";let Q=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new K,this._getElevationProvider=()=>this.view.elevationProvider,this.labelAnchors=null,this._updatingHandles=new w,this._rawResult=null,this._debouncedUpdate=n(async(e,t,r,o)=>{if(!this._renderer.done)return;const{renderCoordsHelper:n}=this.view,i=new I({extent:t,localOrigin:r,renderCoordsHelper:n});this._renderer.setup(i,o),this._renderer.start();const[l]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),s(()=>this._renderer.done).then(()=>{this._updateLabelAnchors(i,this._renderer.getResults())})]);if(!this._enabled)return;const a=this._renderer.getResults();this._updateResult(i,a,"fulfilled"===l.status?l.value:null)})}initialize(){const e=this.view;this._renderer=new B({view:e}),this.addHandles([this._createElevationUpdateHandle(),l(()=>({projectedGeometry:this._projectedGeometry,localOrigin:this._localOrigin,targetGeometryRenderInfo:this._targetGeometryRenderInfo,enabled:this._enabled}),({projectedGeometry:e,localOrigin:t,targetGeometryRenderInfo:r,enabled:o})=>{const n=e?.extent;e&&n&&t&&r&&o?this._updatingHandles.addPromise(this._debouncedUpdate(e,n,t,r)):this._rawResult=null},a)])}destroy(){this._updatingHandles.destroy(),this._renderer.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){if(!this.analysis.valid)return null;const e=this.analysis.geometry,t=j(e,this.view.spatialReference);return t.pending?(this._updatingHandles.addPromise(t.pending),null):(e&&!t.geometry&&U(this.analysis,e.spatialReference,o.getLogger(this)),t.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?f(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;if(!e)return null;const t=e.clone();return X(this._getElevationProvider(),t),t}get targetGeometry(){const{elevationAlignedGeometry:e}=this;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:n}=this.view,i=q(e,o,n,N.fromElevationInfo(new M({mode:"absolute-height"}))),{polygons:s}=i,l=s[0],a=c(l.position,l.holeIndices,3),p=P(3*l.count),u=d(),m=d();return b(t.spatialReference,r,u,n.spatialReference),m[12]=-u[12],m[13]=-u[13],m[14]=-u[14],V(p,l.position,m),new J(p,a)}get updating(){return this._renderer.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new W({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):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:n}=r,{camera:i}=r.state,s=q(e,o,n,N.fromElevationInfo(new M({mode:"absolute-height"}))),{polygons:l}=s,a=l[0].position;R(oe);for(let t=0;t<a.length;t+=3)i.projectToScreen(h(re,a[t],a[t+1],a[t+2]),ne),x(oe,ne,oe);const p=L(oe),u=H(oe),{maxVolumeExtentSizeVw:m,minVolumeExtentSizePixels:c}=t;return p>i.width/i.pixelRatio*m||u>i.height/i.pixelRatio*m?new A:Math.max(p,u)<c?new O: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:n}=t;return null!=o&&o>n?new D:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeter,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new D:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new S:null}get _unsupportedLayerTransparencyError(){return(this.view.map?.ground.opacity??1)<1?new F:null}get _perimeter(){const e=this._targetGeometryRenderInfo?.positions,t=e?Z($(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,ee,this.view.spatialReference),T(t,te),C(ee,te)&&(this._getElevationProvider=()=>this.view.elevationProvider))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:n,height:s},cameraNearFar:{near:l,far:a}}=e,p=n/t.width*(s/t.height),u=Y(t.cut.totalDepth,l,a)*p,m=Y(t.fill.totalDepth,l,a)*p,c=o**3;this._rawResult=new k({cutVolume:i(Math.abs(u*c),"cubic-meters"),fillVolume:i(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateLabelAnchors(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:n,far:i},cameraPositionRenderSpace:s,northVector:l,eastVector:a,upVector:p}=e,u=e=>{const{labelDepth:u,labelCoords:m,totalDepth:c}=e,d=v(s);return 0!==c&&(g(d,d,a,r*(m[0]/t.width-.5)),g(d,d,l,o*(m[1]/t.height-.5))),g(d,d,p,-Y(u,n,i)),d};this.labelAnchors={cut:u(t.cut),fill:u(t.fill)}}};function X(e,t){t.rings[0].forEach(t=>{t[2]=z(e,t,"ground")??0})}function Y(e,t,r){return e*(r-t)+t}function Z(e){if(!e)return null;let t=null,r=null,o=0;for(const n of e)t||(t=[n[0],n[1],n[2]??0]),r?o+=y(r,n):r=[0,0,0],r[0]=n[0],r[1]=n[1],r[2]=n[2];return t&&r&&(o+=y(r,t)),Math.sqrt(o)}function*$(e){const t=_();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([u()],Q.prototype,"_projectedGeometry",null),e([u()],Q.prototype,"_localOrigin",null),e([u()],Q.prototype,"_getElevationProvider",void 0),e([u()],Q.prototype,"elevationAlignedGeometry",null),e([u()],Q.prototype,"targetGeometry",null),e([u()],Q.prototype,"_targetGeometryRenderInfo",null),e([u({constructOnly:!0})],Q.prototype,"analysis",void 0),e([u({constructOnly:!0})],Q.prototype,"analysisViewData",void 0),e([u({constructOnly:!0})],Q.prototype,"view",void 0),e([u()],Q.prototype,"updating",null),e([u()],Q.prototype,"result",null),e([u()],Q.prototype,"labelAnchors",void 0),e([u()],Q.prototype,"error",null),e([u()],Q.prototype,"_tooNearFarError",null),e([u()],Q.prototype,"_perimeterTooLargeError",null),e([u()],Q.prototype,"_perimeterTooLargeLocalError",null),e([u()],Q.prototype,"_perimeterTooLargeGlobalError",null),e([u()],Q.prototype,"_unsupportedCoordinateSystemError",null),e([u()],Q.prototype,"_unsupportedLayerTransparencyError",null),e([u()],Q.prototype,"_perimeter",null),e([u()],Q.prototype,"_enabled",null),e([u()],Q.prototype,"_renderer",void 0),e([u({readOnly:!0})],Q.prototype,"_updatingHandles",void 0),e([u()],Q.prototype,"_rawResult",void 0),Q=e([m("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],Q);const ee=R(),te=R(),re=_(),oe=G(),ne=p();export{Q 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 t}from"tslib";import"../../../core/has.js";import{destroyMaybe as e}from"../../../core/maybe.js";import{watch as i,sync as r}from"../../../core/reactiveUtils.js";import{signal as n}from"../../../core/signal.js";import{property as s,subclass as o}from"../../../core/accessorSupport/decorators.js";import{length as a}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{getReferenceEllipsoid as u}from"../../../geometry/ellipsoidUtils.js";import{cloudPresets as c}from"./CloudsPresets.js";import{CloudsRenderer as p}from"./CloudsRenderer.js";import{Precipitation as h}from"./Precipitation.js";import{heightLimit as l}from"./weather.js";import{SyncRenderPlugin as d}from"../webgl-engine/effects/RenderPlugin.js";let _=class extends d{constructor(t){super(t),this.produces=new Map([]),this._clouds=n(null),this._incarnation=0,this._precipitation=null}initialize(){this.view.stage?.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),this.view?.stage?.removeRenderPlugin(this),this._set("view",null)}get updating(){return!!this._clouds.value?.readyToRun}get weatherAvailable(){return a(this.view.state.camera.eye)-u(this.view.spatialReference).radius<=l}get usedMemory(){return this._clouds.value?.usedMemory??0}_fadeOutPrecipitation(){this._precipitation&&(this._precipitationOutgoing?.destroy(),this._precipitationOutgoing=this._precipitation,this._precipitationOutgoing.fadeOut(()=>this._precipitationOutgoing=e(this._precipitationOutgoing)),this._precipitation=null,++this._incarnation)}get _snowCover(){return this._precipitationOutgoing?.snowCover??this._precipitation?.snowCover??0}get weather(){return this.view?.environmentManager?.weatherEnabled?this.view.environment.weather:null}initializeRenderContext(t){this._context=t;const e=this.view,n=()=>this._requestRender();this.addHandles([i(()=>this._precipitation,n,r),i(()=>this._clouds.value?.state,n,r),i(()=>e.state.mode,n,r),i(()=>this._updateClouds(),n,r),i(()=>this._updatePrecipitation(),n,r),i(()=>this.weather,t=>this._initWeather(t))])}uninitializeRenderContext(){this._context=null,this._clouds.value=e(this._clouds.value),this._precipitation=e(this._precipitation),this._precipitationOutgoing=e(this._precipitationOutgoing)}prepareRender(t){const{bind:e,time:i}=t;if(1===this.view.state.viewingMode){if(e.clouds.data){e.clouds.fade(e.camera,i,this.view.qualitySettings.fadeDuration);const t=this._clouds.value;
|
|
5
|
+
import{__decorate as t}from"tslib";import"../../../core/has.js";import{destroyMaybe as e}from"../../../core/maybe.js";import{watch as i,sync as r}from"../../../core/reactiveUtils.js";import{signal as n}from"../../../core/signal.js";import{property as s,subclass as o}from"../../../core/accessorSupport/decorators.js";import{length as a}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{getReferenceEllipsoid as u}from"../../../geometry/ellipsoidUtils.js";import{cloudPresets as c}from"./CloudsPresets.js";import{CloudsRenderer as p}from"./CloudsRenderer.js";import{Precipitation as h}from"./Precipitation.js";import{heightLimit as l}from"./weather.js";import{SyncRenderPlugin as d}from"../webgl-engine/effects/RenderPlugin.js";let _=class extends d{constructor(t){super(t),this.produces=new Map([]),this._clouds=n(null),this._incarnation=0,this._precipitation=null}initialize(){this.view.stage?.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),this.view?.stage?.removeRenderPlugin(this),this._set("view",null)}get updating(){return!!this._clouds.value?.readyToRun}get weatherAvailable(){return a(this.view.state.camera.eye)-u(this.view.spatialReference).radius<=l}get usedMemory(){return this._clouds.value?.usedMemory??0}_fadeOutPrecipitation(){this._precipitation&&(this._precipitationOutgoing?.destroy(),this._precipitationOutgoing=this._precipitation,this._precipitationOutgoing.fadeOut(()=>this._precipitationOutgoing=e(this._precipitationOutgoing)),this._precipitation=null,++this._incarnation)}get _snowCover(){return this._precipitationOutgoing?.snowCover??this._precipitation?.snowCover??0}get weather(){return this.view?.environmentManager?.weatherEnabled?this.view.environment.weather:null}initializeRenderContext(t){this._context=t;const e=this.view,n=()=>this._requestRender();this.addHandles([i(()=>this._precipitation,n,r),i(()=>this._clouds.value?.state,n,r),i(()=>e.state.mode,n,r),i(()=>this._updateClouds(),n,r),i(()=>this._updatePrecipitation(),n,r),i(()=>this.weather,t=>this._initWeather(t))])}uninitializeRenderContext(){this._context=null,this._clouds.value=e(this._clouds.value),this._precipitation=e(this._precipitation),this._precipitationOutgoing=e(this._precipitationOutgoing)}prepareRender(t){const{bind:e,time:i}=t;if(1===this.view.state.viewingMode){if(e.clouds.data){e.clouds.fade(e.camera,i,this.view.qualitySettings.fadeDuration);const t=this._clouds.value;0!==t?.state||0!==t.coverage||t.readyToRun||t.destroyCubeMap()}e.snowCover=this._snowCover}}acquireTechniques(){return[]}render(){}_requestRender(){this._context?.requestRender()}_initWeather(t){const i=this._context;if(!t||!i)return void(this._clouds.value=e(this._clouds.value));if(this._clouds.value)return;const r=this.view;this._clouds.value=new p({context:i,view:r,requestRender:()=>this._requestRender()})}_updateClouds(){const t=this.view.environment.weather;return null==t||null==this._clouds.value||this._clouds.value.applyPreset(c[t.type],v(t)),++this._incarnation}_updatePrecipitation(){const t=this.view.environment.weather;if(t.type===this._precipitation?.type)return this._incarnation;this._fadeOutPrecipitation();const e="rainy"===t.type||"snowy"===t.type,i=this._context;return e&&i&&(this._precipitation=new h({view:this.view,type:t.type}),++this._incarnation),this._incarnation}hasHighlight(){return!1}get test(){}};function v(t){switch(t.type){case"rainy":case"snowy":case"cloudy":case"sunny":return t.cloudCover;case"foggy":return t.fogStrength}}t([s({constructOnly:!0})],_.prototype,"view",void 0),t([s({type:Boolean,readOnly:!0})],_.prototype,"updating",null),t([s()],_.prototype,"weatherAvailable",null),t([s()],_.prototype,"_context",void 0),_=t([o("esri.views.3d.environment.EnvironmentRenderer")],_);export{_ as EnvironmentRenderer};
|
|
@@ -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{copy as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as t,clone as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n,fromValues as s,copy as r}from"../../../../geometry/support/lineSegment.js";import{VisualElement as l}from"./VisualElement.js";import{
|
|
5
|
+
import"../../../../core/has.js";import{copy as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as t,clone as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n,fromValues as s,copy as r}from"../../../../geometry/support/lineSegment.js";import{VisualElement as l}from"./VisualElement.js";import{d as a}from"../../../../chunks/Laserline.glsl.js";import{LaserLineRenderer as h}from"../../webgl-engine/effects/laserlines/LaserLineRenderer.js";class c extends l{constructor(e){super(e),this._angleCutoff=a,this._style={},this._heightManifoldTarget=t(),this._heightManifoldEnabled=!1,this._intersectsLine=n(),this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._lineVerticalPlaneSegment=null,this._pathVerticalPlaneBuffers=null,this._pointDistanceLine=null,this.applyProperties(e)}get testData(){}createResources(){this._ensureRenderer()}destroyResources(){this._disposeRenderer()}updateVisibility(){this._syncRenderer(),this._syncHeightManifold(),this._syncIntersectsLine(),this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance()}get angleCutoff(){return this._angleCutoff}set angleCutoff(e){this._angleCutoff!==e&&(this._angleCutoff=e,this._syncAngleCutoff())}get style(){return this._style}set style(e){this._style=e,this._syncStyle()}get heightManifoldTarget(){return this._heightManifoldEnabled?this._heightManifoldTarget:null}set heightManifoldTarget(t){null!=t?(e(this._heightManifoldTarget,t),this._heightManifoldEnabled=!0):this._heightManifoldEnabled=!1,this._syncRenderer(),this._syncHeightManifold()}set intersectsWorldUpAtLocation(e){if(null==e)return void(this.intersectsLine=null);const t=this.view.renderCoordsHelper.worldUpAtPosition(e,_);this.intersectsLine=s(e,t),this.intersectsLineInfinite=!0}get intersectsLine(){return this._intersectsLineEnabled?this._intersectsLine:null}set intersectsLine(e){null!=e?(r(e,this._intersectsLine),this._intersectsLineEnabled=!0):this._intersectsLineEnabled=!1,this._syncIntersectsLine(),this._syncRenderer()}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){this._intersectsLineInfinite=e,this._syncIntersectsLineInfinite()}get lineVerticalPlaneSegment(){return this._lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){this._lineVerticalPlaneSegment=null!=e?r(e):null,this._syncLineVerticalPlane(),this._syncRenderer()}get pathVerticalPlane(){return this._pathVerticalPlaneBuffers}set pathVerticalPlane(e){this._pathVerticalPlaneBuffers=e,this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance(),this._syncRenderer()}get pointDistanceLine(){return this._pointDistanceLine}set pointDistanceLine(e){this._pointDistanceLine=null!=e?{origin:i(e.origin),target:e.target?i(e.target):null}:null,this._syncPointDistance(),this._syncRenderer()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._renderer&&(this._renderer.isDecoration=e)}_syncRenderer(){this.attached&&this.visible&&(this._intersectsLineEnabled||this._heightManifoldEnabled||null!=this._pointDistanceLine||null!=this._pathVerticalPlaneBuffers)?this._ensureRenderer():this._disposeRenderer()}_ensureRenderer(){null==this._renderer&&(this._renderer=new h({view:this.view,contrastControlEnabled:!0,isDecoration:this.isDecoration}),this._syncStyle(),this._syncHeightManifold(),this._syncIntersectsLine(),this._syncIntersectsLineInfinite(),this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance(),this._syncAngleCutoff())}_syncStyle(){null!=this._renderer&&this._renderer.setParameters(this._style)}_syncAngleCutoff(){this._renderer?.setParameters({angleCutoff:this._angleCutoff})}_syncHeightManifold(){null!=this._renderer&&(this._renderer.heightManifoldEnabled=this._heightManifoldEnabled&&this.visible,this._heightManifoldEnabled&&(this._renderer.heightManifoldTarget=this._heightManifoldTarget))}_syncIntersectsLine(){null!=this._renderer&&(this._renderer.intersectsLineEnabled=this._intersectsLineEnabled&&this.visible,this._intersectsLineEnabled&&(this._renderer.intersectsLineSegment=this._intersectsLine))}_syncIntersectsLineInfinite(){null!=this._renderer&&(this._renderer.intersectsLineInfinite=this._intersectsLineInfinite)}_syncPathVerticalPlane(){null!=this._renderer&&(this._renderer.pathVerticalPlaneEnabled=null!=this._pathVerticalPlaneBuffers&&this.visible,null!=this._pathVerticalPlaneBuffers&&(this._renderer.pathVerticalPlaneBuffers=this._pathVerticalPlaneBuffers))}_syncLineVerticalPlane(){null!=this._renderer&&(this._renderer.lineVerticalPlaneEnabled=null!=this._lineVerticalPlaneSegment&&this.visible,null!=this._lineVerticalPlaneSegment&&(this._renderer.lineVerticalPlaneSegment=this._lineVerticalPlaneSegment))}_syncPointDistance(){if(null==this._renderer)return;const e=this._pointDistanceLine,t=null!=e;this._renderer.pointDistanceEnabled=t&&null!=e.target&&this.visible,t&&(this._renderer.pointDistanceOrigin=e.origin,null!=e.target&&(this._renderer.pointDistanceTarget=e.target))}_disposeRenderer(){null!=this._renderer&&this.view.stage&&(this._renderer.destroy(),this._renderer=null)}forEachMaterial(){}}const _=t();export{c as LaserlineVisualElement};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{filterInPlace as r}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{equalsShallow as i}from"../../../core/lang.js";import{floatEqualUlp as o}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as a}from"../../../core/reactiveUtils.js";import{generateUID as n}from"../../../core/uid.js";import{property as p,subclass as c}from"../../../core/accessorSupport/decorators.js";import{diff as h}from"../../../core/accessorSupport/diffUtils.js";import{projectBuffer as l}from"../../../geometry/projection/projectBuffer.js";import{fromBuffer as d,create as u}from"../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as m}from"../../../geometry/support/DoubleArray.js";import{makeDehydratedPoint as f}from"../../../layers/graphics/dehydratedPoint.js";import{RenderingInfo as y}from"../../../renderers/support/RenderingInfo.js";import g from"../../../symbols/PointSymbol3D.js";import{Graphics3DCore as b}from"./graphics/Graphics3DCore.js";import{Graphics3DScaleVisibility as _}from"./graphics/Graphics3DScaleVisibility.js";import{boundingBoxCornersPointsStride as v,boundingBoxCornerPoints as I}from"./i3s/I3SGeometryUtil.js";import{LimitGraphicsMap as w}from"../support/LimitGraphicsMap.js";import{hasLayerBasedScaleVisibility as G}from"../../support/layerViewUtils.js";class j{constructor(e,t){this.meta=e,this.index=t}}class C{constructor(e,t){this.graphic=e,this.geometry=t,this.components=[],this.overridesDirty=!1}}let M=class extends t{get updating(){return this._graphicsCore?.updating??!1}constructor(e){super(e),this.loadedGraphics=new w(5e4),this.slicePlaneEnabled=!1,this._renderingInfo=new y(null,new g),this._featuresMap=new Map}initialize(){const e=this.view.basemapTerrain;this._graphicsCore=new b({owner:this,layer:this.layer,preferredUpdatePolicy:0,elevationFeatureExpressionEnabled:!1,graphicSymbolSupported:!1,getRenderingInfoWithoutRenderer:!0,hasZ:!0,hasM:!1,componentFactories:{deconflictor:e=>this.view.deconflictor.addGraphicsOwner(e),labeler:(e,t)=>this.view.labeler.addGraphicsOwner(e,t,{emptySymbolLabelSupported:!0,elevationInfoOverride:{mode:"absolute-height",offset:0},disablePlacement:{logEntityDescription:"3D Object Scene Layer features"}}),scaleVisibility:G()?null:(t,r)=>new _({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:r,graphicsCore:t,basemapTerrain:e,layerScaleEnabled:!1})}}),this._graphicsCore.initializePromise.then(()=>this._graphicsCore.startCreateGraphics()).catch(()=>{}),this.addHandles(a(()=>this.layer.labelingInfo,(e,t)=>{h(e,t)&&this._graphicsCore.updateLabelingInfo()}))}destroy(){this._graphicsCore=s(this._graphicsCore),this.loadedGraphics=s(this.loadedGraphics),this.view=null}addNodeMeta(e,t){let r=0;const i=e.filteredIds,o=this.view.spatialReference,s=[];for(let a=0;a<e.featureIds.length;a++){const p=e.featureIds[a];let c=null==i;if(i&&r<i.length&&p===i[r]&&(c=!0,r++),!this._enabledForFeatureInNode(e,a))continue;const h=this._featuresMap.get(p);if(h){h.components.push(new j(e,a)),this._updateLabelPosition(p);continue}const l=t(a,e),d=f(0,0,0,o),u={objectId:p,uid:n(),attributes:l,visible:c,geometry:d},m=new C(u,d);m.components.push(new j(e,a)),this._featuresMap.set(p,m),this._updateLabelGeometry(p),s.push(u)}this.loadedGraphics.addMany(s)}updateLabelPositions(e){const t=this.view.renderCoordsHelper;this._forEachGraphic(e,(r,i,o)=>{const s=this._graphicsCore.getGraphics3DGraphicById(i.uid);null!=s&&this._updateLabelGeometry(e.featureIds[r])&&s.alignWithAbsoluteElevation(o.z??0,t,!1)})}setNodeMetaAttributes(e,t){const r=new Array;this._forEachGraphic(e,(o,s)=>{const a=t(o,e);i(s.attributes,a)||(s.attributes=a,r.push(s.uid))}),this._graphicsCore.updateLabelingInfo(r)}applyFilterChange(e){this._forEachFeature(e,(t,r,i)=>{if(!this._enabledForFeatureInNode(e,t)){const i=e.featureIds[t];switch(this._removeFeature(r,e,t)){case 2:this.loadedGraphics.removeManyByObjectId([i]);break;case 1:this._updateLabelPosition(i)}return}const o=r.graphic,s=o.visible;s!==i&&(o.visible=i,E.graphic=o,E.property="visible",E.oldValue=s,E.newValue=i,this._graphicsCore.graphicUpdateHandler(E),E.graphic=null)})}removeNodeMeta(e){const t=[];this._forEachGraphic(e,r=>{const i=e.featureIds[r],o=this._featuresMap.get(i);if(!o)return;switch(this._removeFeature(o,e,r)){case 1:this._updateLabelPosition(i);break;case 2:t.push(i)}}),this.loadedGraphics.removeManyByObjectId(t)}_removeFeature(e,t,i){const o=e.components.length;return r(e.components,e=>!(e.meta===t&&e.index===i)),0===e.components.length?(this._featuresMap.delete(t.featureIds[i]),2):o!==e.components.length?1:0}getRenderingInfo(){return this._renderingInfo}notifyGraphicGeometryChanged(){}notifyGraphicVisibilityChanged(){}_updateLabelPosition(e){const t=this._featuresMap.get(e);t&&this._updateLabelGeometry(e)&&(this.loadedGraphics.removeManyByObjectId([e]),this.loadedGraphics.addMany([t.graphic]))}_updateLabelGeometry(e){const t=this._featuresMap.get(e);if(!t)return!1;const r=t.geometry,i=this.view.spatialReference,s=this.view.renderCoordsHelper,a=r.x,n=r.y,p=r.z??0,c=t.components.length,h=m(c*v);let u=0;for(const{meta:o,index:l}of t.components)I(l,this.collection,o.objectHandle,h,u),u+=v;return l(h,s.spatialReference,0,h,i,0),d(h,F),r.x=(F[0]+F[3])/2,r.y=(F[1]+F[4])/2,r.z=F[5],!o(r.x,a)||!o(r.y,n)||!o(r.z,p)}_forEachGraphic(e,t){this._forEachFeature(e,(r,{graphic:i,geometry:o},s)=>{this._enabledForFeatureInNode(e,r)&&t(r,i,o,s)})}_forEachFeature(e,t){let r=0;for(let i=0;i<e.featureIds.length;i++){const o=this._featuresMap.get(e.featureIds[i]);let s=null==e.filteredIds;e.filteredIds
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{filterInPlace as r}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{equalsShallow as i}from"../../../core/lang.js";import{floatEqualUlp as o}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as a}from"../../../core/reactiveUtils.js";import{generateUID as n}from"../../../core/uid.js";import{property as p,subclass as c}from"../../../core/accessorSupport/decorators.js";import{diff as h}from"../../../core/accessorSupport/diffUtils.js";import{projectBuffer as l}from"../../../geometry/projection/projectBuffer.js";import{fromBuffer as d,create as u}from"../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as m}from"../../../geometry/support/DoubleArray.js";import{makeDehydratedPoint as f}from"../../../layers/graphics/dehydratedPoint.js";import{RenderingInfo as y}from"../../../renderers/support/RenderingInfo.js";import g from"../../../symbols/PointSymbol3D.js";import{Graphics3DCore as b}from"./graphics/Graphics3DCore.js";import{Graphics3DScaleVisibility as _}from"./graphics/Graphics3DScaleVisibility.js";import{boundingBoxCornersPointsStride as v,boundingBoxCornerPoints as I}from"./i3s/I3SGeometryUtil.js";import{LimitGraphicsMap as w}from"../support/LimitGraphicsMap.js";import{hasLayerBasedScaleVisibility as G}from"../../support/layerViewUtils.js";class j{constructor(e,t){this.meta=e,this.index=t}}class C{constructor(e,t){this.graphic=e,this.geometry=t,this.components=[],this.overridesDirty=!1}}let M=class extends t{get updating(){return this._graphicsCore?.updating??!1}constructor(e){super(e),this.loadedGraphics=new w(5e4),this.slicePlaneEnabled=!1,this._renderingInfo=new y(null,new g),this._featuresMap=new Map}initialize(){const e=this.view.basemapTerrain;this._graphicsCore=new b({owner:this,layer:this.layer,preferredUpdatePolicy:0,elevationFeatureExpressionEnabled:!1,graphicSymbolSupported:!1,getRenderingInfoWithoutRenderer:!0,hasZ:!0,hasM:!1,componentFactories:{deconflictor:e=>this.view.deconflictor.addGraphicsOwner(e),labeler:(e,t)=>this.view.labeler.addGraphicsOwner(e,t,{emptySymbolLabelSupported:!0,elevationInfoOverride:{mode:"absolute-height",offset:0},disablePlacement:{logEntityDescription:"3D Object Scene Layer features"}}),scaleVisibility:G()?null:(t,r)=>new _({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:r,graphicsCore:t,basemapTerrain:e,layerScaleEnabled:!1})}}),this._graphicsCore.initializePromise.then(()=>this._graphicsCore.startCreateGraphics()).catch(()=>{}),this.addHandles(a(()=>this.layer.labelingInfo,(e,t)=>{h(e,t)&&this._graphicsCore.updateLabelingInfo()}))}destroy(){this._graphicsCore=s(this._graphicsCore),this.loadedGraphics=s(this.loadedGraphics),this.view=null}addNodeMeta(e,t){let r=0;const i=e.filteredIds,o=this.view.spatialReference,s=[];for(let a=0;a<e.featureIds.length;a++){const p=e.featureIds[a];let c=null==i;if(i&&r<i.length&&p===i[r]&&(c=!0,r++),!this._enabledForFeatureInNode(e,a))continue;const h=this._featuresMap.get(p);if(h){h.components.push(new j(e,a)),this._updateLabelPosition(p);continue}const l=t(a,e),d=f(0,0,0,o),u={objectId:p,uid:n(),attributes:l,visible:c,geometry:d},m=new C(u,d);m.components.push(new j(e,a)),this._featuresMap.set(p,m),this._updateLabelGeometry(p),s.push(u)}this.loadedGraphics.addMany(s)}updateLabelPositions(e){const t=this.view.renderCoordsHelper;this._forEachGraphic(e,(r,i,o)=>{const s=this._graphicsCore.getGraphics3DGraphicById(i.uid);null!=s&&this._updateLabelGeometry(e.featureIds[r])&&s.alignWithAbsoluteElevation(o.z??0,t,!1)})}setNodeMetaAttributes(e,t){const r=new Array;this._forEachGraphic(e,(o,s)=>{const a=t(o,e);i(s.attributes,a)||(s.attributes=a,r.push(s.uid))}),this._graphicsCore.updateLabelingInfo(r)}applyFilterChange(e){this._forEachFeature(e,(t,r,i)=>{if(!this._enabledForFeatureInNode(e,t)){const i=e.featureIds[t];switch(this._removeFeature(r,e,t)){case 2:this.loadedGraphics.removeManyByObjectId([i]);break;case 1:this._updateLabelPosition(i)}return}const o=r.graphic,s=o.visible;s!==i&&(o.visible=i,E.graphic=o,E.property="visible",E.oldValue=s,E.newValue=i,this._graphicsCore.graphicUpdateHandler(E),E.graphic=null)})}removeNodeMeta(e){const t=[];this._forEachGraphic(e,r=>{const i=e.featureIds[r],o=this._featuresMap.get(i);if(!o)return;switch(this._removeFeature(o,e,r)){case 1:this._updateLabelPosition(i);break;case 2:t.push(i)}}),this.loadedGraphics.removeManyByObjectId(t)}_removeFeature(e,t,i){const o=e.components.length;return r(e.components,e=>!(e.meta===t&&e.index===i)),0===e.components.length?(this._featuresMap.delete(t.featureIds[i]),2):o!==e.components.length?1:0}getRenderingInfo(){return this._renderingInfo}notifyGraphicGeometryChanged(){}notifyGraphicVisibilityChanged(){}_updateLabelPosition(e){const t=this._featuresMap.get(e);t&&this._updateLabelGeometry(e)&&(this.loadedGraphics.removeManyByObjectId([e]),this.loadedGraphics.addMany([t.graphic]))}_updateLabelGeometry(e){const t=this._featuresMap.get(e);if(!t)return!1;const r=t.geometry,i=this.view.spatialReference,s=this.view.renderCoordsHelper,a=r.x,n=r.y,p=r.z??0,c=t.components.length,h=m(c*v);let u=0;for(const{meta:o,index:l}of t.components)I(l,this.collection,o.objectHandle,h,u),u+=v;return l(h,s.spatialReference,0,h,i,0),d(h,F),r.x=(F[0]+F[3])/2,r.y=(F[1]+F[4])/2,r.z=F[5],!o(r.x,a)||!o(r.y,n)||!o(r.z,p)}_forEachGraphic(e,t){this._forEachFeature(e,(r,{graphic:i,geometry:o},s)=>{this._enabledForFeatureInNode(e,r)&&t(r,i,o,s)})}_forEachFeature(e,t){let r=0;for(let i=0;i<e.featureIds.length;i++){const o=this._featuresMap.get(e.featureIds[i]);let s=null==e.filteredIds;e.filteredIds?.[r]===e.featureIds[i]&&(s=!0,r++),o&&t(i,o,s)}}_enabledForFeatureInNode(e,t){return e.node.index<0||!this.overrides?.featureHasGeometryChanges(e.featureIds[t])}get updatePolicy(){return this._graphicsCore.effectiveUpdatePolicy}get usedMemory(){return this._graphicsCore.usedMemory}get unloadedMemoryEstimate(){return this._graphicsCore.unprocessedMemoryEstimate}get test(){}};e([p()],M.prototype,"view",void 0),e([p()],M.prototype,"layer",void 0),e([p()],M.prototype,"collection",void 0),e([p()],M.prototype,"loadedGraphics",void 0),e([p()],M.prototype,"overrides",void 0),e([p()],M.prototype,"layerViewUid",void 0),e([p()],M.prototype,"updating",null),e([p()],M.prototype,"slicePlaneEnabled",void 0),e([p()],M.prototype,"_graphicsCore",void 0),M=e([c("esri.views.3d.layers.I3SMeshViewLabeler")],M);const E={graphic:null,property:null,oldValue:null,newValue:null},F=u();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{hasScaling as e}from"../../../core/mathUtils.js";import r from"../../../geometry/SpatialReference.js";import{ensurePackedMat4f64 as t,ensurePackedArray as o}from"../../../geometry/support/DoubleArray.js";import n from"../../../geometry/support/MeshGeoreferencedVertexSpace.js";import s from"../../../geometry/support/MeshLocalVertexSpace.js";import{b as i,n as a}from"../../../chunks/vec3.js";import{get as f,cleanup as c}from"../../../libs/i3s/I3SModule.js";import{TransformedGeometry as l,TransformedData as u}from"./SceneLayerWorkerHandle.js";async function m(e){A=await v();const r=[e.geometryBuffer];return{result:x(A,e,r),transferList:r}}async function p(e){A=await v();const r=[e.geometryBuffer],{geometryBuffer:t}=e,o=t.byteLength,n=A._malloc(o),s=new Uint8Array(A.HEAPU8.buffer,n,o);s.set(new Uint8Array(t));const i=A.dracoDecompressPointCloudData(n,s.byteLength);if(A._free(n),i.error.length>0)throw new Error(`i3s.wasm: ${i.error}`);const a=i.featureIds?.length>0?i.featureIds.slice():null,f=i.positions.slice();return a&&r.push(a.buffer),r.push(f.buffer),{result:{positions:f,featureIds:a},transferList:r}}async function y(e){await v(),S(e);const r={buffer:e.buffer};return{result:r,transferList:[r.buffer]}}async function h(e){await v(),L(e)}async function d(e){A=await v(),A.setLegacySchema(e.context,e.jsonSchema)}async function g(e){const{localMatrix:i,origin:a,positions:f,vertexSpace:c}=e,l=r.fromJSON(e.inSpatialReference),u=r.fromJSON(e.outSpatialReference),m=i?t(i):void 0,p=o(a);let y;const[{projectBuffer:h},{initializeProjection:d}]=await Promise.all([import("../../../geometry/projection/projectBuffer.js"),import("../../../geometry/projectionUtils.js")]);await d(l,u);const g=[0,0,0];if(!h(p,l,0,g,u,0))throw new Error("Failed to project");if("georeferenced"===c.type&&null==c.origin){if(y=new Float64Array(f.length),!h(f,l,0,y,u,0,y.length/3))throw new Error("Failed to project")}else{const e="georeferenced"===c.type?n.fromJSON(c):s.fromJSON(c),{projectMeshVertexPositions:r}=await import("../../../geometry/support/meshUtils/projectMeshVertexPositions.js"),t=r({vertexAttributes:{position:f},transform:m?{localMatrix:m}:void 0,vertexSpace:e,spatialReference:l},u);if(!t)throw new Error("Failed to project");y=t}const b=y.length,[w,j,A]=g;for(let r=0;r<b;r+=3)y[r]-=w,y[r+1]-=j,y[r+2]-=A;return{result:{projected:y,original:f,projectedOrigin:g},transferList:[y.buffer,f.buffer]}}async function b({normalMatrix:r,normals:t}){const o=new Float32Array(t.length);return i(o,t,r),e(r)&&a(o,o),{result:{transformed:o,original:t},transferList:[o.buffer,t.buffer]}}function w(e){U(e)}let j,A;function L(e){if(!A)return;const r=e.modifications,t=A._malloc(8*r.length),o=new Float64Array(A.HEAPU8.buffer,t,r.length);for(let n=0;n<r.length;++n)o[n]=r[n];A.setModifications(e.context,t,r.length,e.isGeodetic),A._free(t)}function x(e,r,t){const{context:o,globalTrafo:n,mbs:s,obbData:i,layouts:a,needNormals:f,elevationOffset:c,geometryBuffer:m,geometryDescriptor:p,indexToVertexProjector:y,vertexToRenderProjector:h,normalReferenceFrame:d}=r,g=e._malloc(m.byteLength),b=33,w=e._malloc(b*Float64Array.BYTES_PER_ELEMENT),j=new Uint8Array(e.HEAPU8.buffer,g,m.byteLength);j.set(new Uint8Array(m));const A=new Float64Array(e.HEAPU8.buffer,w,b);P(A,[NaN,NaN,NaN],0);let L=3;P(A,n,L),L+=16,P(A,s.center,L),L+=3,A[L++]=s.radius,i&&P(A,i,L++);const x={isDraco:!1,isLegacy:!1,color:a.some(e=>e.some(e=>"color"===e.name)),normal:f&&a.some(e=>e.some(e=>"normalCompressed"===e.name)),uv0:a.some(e=>e.some(e=>"uv0"===e.name)),uvRegion:a.some(e=>e.some(e=>"uvRegion"===e.name)),featureIndex:p.featureIndex},E=e.process(o,!!i,g,j.byteLength,p,x,w,c,y,h,d);if(e._free(w),e._free(g),E.error.length>0)throw new Error(`i3s.wasm: ${E.error}`);if(E.discarded)return null;const S=E.componentOffsets.length>0?E.componentOffsets.slice():null,U=E.featureIds.length>0?E.featureIds.slice():null,_=E.anchorIds.length>0?Array.from(E.anchorIds):null,v=E.anchors.length>0?Array.from(E.anchors):null,N=E.interleavedVertedData.slice().buffer,F=1===E.indicesType?new Uint16Array(E.indices.buffer,E.indices.byteOffset,E.indices.byteLength/2).slice():new Uint32Array(E.indices.buffer,E.indices.byteOffset,E.indices.byteLength/4).slice(),I=E.positions.slice(),{buffer:M,byteOffset:O,byteLength:B}=E.positionIndices,R=1===E.positionIndicesType?new Uint16Array(M,O,B/2).slice():new Uint32Array(M,O,B/4).slice(),T=new l(r.layouts[0],N,F,E.hasColors,E.hasModifications,{data:I,indices:R});return U&&t.push(U.buffer),S&&t.push(S.buffer),t.push(N),t.push(F.buffer),t.push(I.buffer),t.push(R.buffer),new u(S,U,_,v,T,n,E.obb)}function E(e){return 0===e?0:1===e?1:2===e?2:3}function S(e){if(!A)return;const{context:r,buffer:t}=e,o=A._malloc(t.byteLength),n=t.byteLength/Float64Array.BYTES_PER_ELEMENT,s=new Float64Array(A.HEAPU8.buffer,o,n),i=new Float64Array(t);s.set(i),A.filterOBBs(r,o,n),i.set(s),A._free(o)}function U(e){
|
|
5
|
+
import{hasScaling as e}from"../../../core/mathUtils.js";import r from"../../../geometry/SpatialReference.js";import{ensurePackedMat4f64 as t,ensurePackedArray as o}from"../../../geometry/support/DoubleArray.js";import n from"../../../geometry/support/MeshGeoreferencedVertexSpace.js";import s from"../../../geometry/support/MeshLocalVertexSpace.js";import{b as i,n as a}from"../../../chunks/vec3.js";import{get as f,cleanup as c}from"../../../libs/i3s/I3SModule.js";import{TransformedGeometry as l,TransformedData as u}from"./SceneLayerWorkerHandle.js";async function m(e){A=await v();const r=[e.geometryBuffer];return{result:x(A,e,r),transferList:r}}async function p(e){A=await v();const r=[e.geometryBuffer],{geometryBuffer:t}=e,o=t.byteLength,n=A._malloc(o),s=new Uint8Array(A.HEAPU8.buffer,n,o);s.set(new Uint8Array(t));const i=A.dracoDecompressPointCloudData(n,s.byteLength);if(A._free(n),i.error.length>0)throw new Error(`i3s.wasm: ${i.error}`);const a=i.featureIds?.length>0?i.featureIds.slice():null,f=i.positions.slice();return a&&r.push(a.buffer),r.push(f.buffer),{result:{positions:f,featureIds:a},transferList:r}}async function y(e){await v(),S(e);const r={buffer:e.buffer};return{result:r,transferList:[r.buffer]}}async function h(e){await v(),L(e)}async function d(e){A=await v(),A.setLegacySchema(e.context,e.jsonSchema)}async function g(e){const{localMatrix:i,origin:a,positions:f,vertexSpace:c}=e,l=r.fromJSON(e.inSpatialReference),u=r.fromJSON(e.outSpatialReference),m=i?t(i):void 0,p=o(a);let y;const[{projectBuffer:h},{initializeProjection:d}]=await Promise.all([import("../../../geometry/projection/projectBuffer.js"),import("../../../geometry/projectionUtils.js")]);await d(l,u);const g=[0,0,0];if(!h(p,l,0,g,u,0))throw new Error("Failed to project");if("georeferenced"===c.type&&null==c.origin){if(y=new Float64Array(f.length),!h(f,l,0,y,u,0,y.length/3))throw new Error("Failed to project")}else{const e="georeferenced"===c.type?n.fromJSON(c):s.fromJSON(c),{projectMeshVertexPositions:r}=await import("../../../geometry/support/meshUtils/projectMeshVertexPositions.js"),t=r({vertexAttributes:{position:f},transform:m?{localMatrix:m}:void 0,vertexSpace:e,spatialReference:l},u);if(!t)throw new Error("Failed to project");y=t}const b=y.length,[w,j,A]=g;for(let r=0;r<b;r+=3)y[r]-=w,y[r+1]-=j,y[r+2]-=A;return{result:{projected:y,original:f,projectedOrigin:g},transferList:[y.buffer,f.buffer]}}async function b({normalMatrix:r,normals:t}){const o=new Float32Array(t.length);return i(o,t,r),e(r)&&a(o,o),{result:{transformed:o,original:t},transferList:[o.buffer,t.buffer]}}function w(e){U(e)}let j,A;function L(e){if(!A)return;const r=e.modifications,t=A._malloc(8*r.length),o=new Float64Array(A.HEAPU8.buffer,t,r.length);for(let n=0;n<r.length;++n)o[n]=r[n];A.setModifications(e.context,t,r.length,e.isGeodetic),A._free(t)}function x(e,r,t){const{context:o,globalTrafo:n,mbs:s,obbData:i,layouts:a,needNormals:f,elevationOffset:c,geometryBuffer:m,geometryDescriptor:p,indexToVertexProjector:y,vertexToRenderProjector:h,normalReferenceFrame:d}=r,g=e._malloc(m.byteLength),b=33,w=e._malloc(b*Float64Array.BYTES_PER_ELEMENT),j=new Uint8Array(e.HEAPU8.buffer,g,m.byteLength);j.set(new Uint8Array(m));const A=new Float64Array(e.HEAPU8.buffer,w,b);P(A,[NaN,NaN,NaN],0);let L=3;P(A,n,L),L+=16,P(A,s.center,L),L+=3,A[L++]=s.radius,i&&P(A,i,L++);const x={isDraco:!1,isLegacy:!1,color:a.some(e=>e.some(e=>"color"===e.name)),normal:f&&a.some(e=>e.some(e=>"normalCompressed"===e.name)),uv0:a.some(e=>e.some(e=>"uv0"===e.name)),uvRegion:a.some(e=>e.some(e=>"uvRegion"===e.name)),featureIndex:p.featureIndex},E=e.process(o,!!i,g,j.byteLength,p,x,w,c,y,h,d);if(e._free(w),e._free(g),E.error.length>0)throw new Error(`i3s.wasm: ${E.error}`);if(E.discarded)return null;const S=E.componentOffsets.length>0?E.componentOffsets.slice():null,U=E.featureIds.length>0?E.featureIds.slice():null,_=E.anchorIds.length>0?Array.from(E.anchorIds):null,v=E.anchors.length>0?Array.from(E.anchors):null,N=E.interleavedVertedData.slice().buffer,F=1===E.indicesType?new Uint16Array(E.indices.buffer,E.indices.byteOffset,E.indices.byteLength/2).slice():new Uint32Array(E.indices.buffer,E.indices.byteOffset,E.indices.byteLength/4).slice(),I=E.positions.slice(),{buffer:M,byteOffset:O,byteLength:B}=E.positionIndices,R=1===E.positionIndicesType?new Uint16Array(M,O,B/2).slice():new Uint32Array(M,O,B/4).slice(),T=new l(r.layouts[0],N,F,E.hasColors,E.hasModifications,{data:I,indices:R});return U&&t.push(U.buffer),S&&t.push(S.buffer),t.push(N),t.push(F.buffer),t.push(I.buffer),t.push(R.buffer),new u(S,U,_,v,T,n,E.obb)}function E(e){return 0===e?0:1===e?1:2===e?2:3}function S(e){if(!A)return;const{context:r,buffer:t}=e,o=A._malloc(t.byteLength),n=t.byteLength/Float64Array.BYTES_PER_ELEMENT,s=new Float64Array(A.HEAPU8.buffer,o,n),i=new Float64Array(t);s.set(i),A.filterOBBs(r,o,n),i.set(s),A._free(o)}function U(e){0===A?.destroy(e)&&(A=null,j=null,c())}function P(e,r,t){for(let o=0;o<r.length;++o)e[o+t]=r[o]}async function _(){A||await v()}async function v(){return A||(A=await(j??=f())),A}const N={transform:(e,r)=>A&&x(A,e,r),destroy:U};export{w as destroyContext,p as dracoDecompressPointCloudData,y as filterObbsForModifications,S as filterObbsForModificationsSync,_ as initialize,E as interpretObbModificationResults,m as process,g as project,d as setLegacySchema,h as setModifications,L as setModificationsSync,N as test,b as transformNormals};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{indexOf as r,PositionHint as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Logger.js";import{clamp as n}from"../../../../core/mathUtils.js";import{unwrapUpdating as o,updating as l,isUpdating as a}from"../../../../core/maybeUpdating.js";import{whenOnce as c}from"../../../../core/reactiveUtils.js";import{getUnitString as p}from"../../../../core/units.js";import{property as u,subclass as g}from"../../../../core/accessorSupport/decorators.js";import{transformMat3 as d,add as m,set as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"../../../../core/sql/WhereClause.js";import{getReferenceEllipsoid as j}from"../../../../geometry/ellipsoidUtils.js";import{load as w,project as b}from"../../../../geometry/projectionUtils.js";import v from"../../../../geometry/SpatialReference.js";import{projectBoundingSphere as R}from"../../../../geometry/projection/projectBoundingSphere.js";import{projectVectorToVector as F}from"../../../../geometry/projection/projectVectorToVector.js";import{create as S}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as _,expandWithNestedArray as k,expand as M}from"../../../../geometry/support/aaBoundingRect.js";import{doubleArrayFrom as E}from"../../../../geometry/support/DoubleArray.js";import{earth as I}from"../../../../geometry/support/Ellipsoid.js";import{isWGS84 as G,isWebMercator as x}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as L}from"../../../../geometry/support/sphere.js";import{project as O}from"../../../../geometry/support/webMercatorUtils.js";import B from"../../../../layers/support/FeatureFilter.js";import{objectIdFilter as T,filterInPlace as U}from"./I3SUtil.js";let C=class extends t{constructor(e){super(e),this._projectionEngineLoaded=!1}initialize(){c(()=>this.viewFilter?.geometry||null!=this.layerFilter).then(()=>this.loadAsyncModule(import("../../../../geometry/geometryEngine.js").then(e=>{this.destroyed||(this._geometryEngine=e)})))}get sortedObjectIds(){if(null==this.viewFilter?.objectIds)return null;const e=E(this.viewFilter.objectIds);return e.sort(),e}get parsedWhereClause(){const e=this.viewFilter?.where;if(null==e||!e)return null;try{return h.create(e,{fieldsIndex:this.layerFieldsIndex})}catch(t){s.getLogger(this).error(`Failed to parse filter where clause: ${t}`)}return null}addFilters(e,t,r,i){const n=this.sortedObjectIds;null!=n&&e.push(e=>T(n,!0,e)),this.addSqlFilter(e,this.parsedWhereClause),this.addTimeFilter(e,this.viewFilter?.timeExtent);const l=o(this._layerMaskGeometries),a=this._geometryEngine,c=()=>s.getLogger(this);if(null!=l&&null!=this.layerFilter&&null!=a){const s=this.layerFilter.spatialRelationship;e.push((e,n)=>N(c,a,e,n,i,t,r,l,s))}const p=o(this._viewMaskGeometries);if(null!=p&&null!=this.viewFilter&&null!=a){const s=this.viewFilter.spatialRelationship;e.push((e,n)=>N(c,a,e,n,i,t,r,p,s))}}isMBSGeometryVisible(e,t,r){const i=o(this._layerMaskGeometries),n=this._geometryEngine;if(null!=i&&null!=this.layerFilter&&null!=n){const o=this.layerFilter.spatialRelationship,l=i[0].spatialReference||t;if(!R(e,r,$,l))return s.getLogger(this).warnOnce("SceneLayer.mask geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0;return q(n,$,i,l,o)}const l=o(this._viewMaskGeometries);if(null!=l&&null!=this.viewFilter&&null!=n){const i=this.viewFilter.spatialRelationship,o=l[0].spatialReference||t;if(!R(e,r,$,o))return s.getLogger(this).warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0;return q(n,$,l,o,i)}return!0}get parsedGeometry(){const e=o(this._viewMaskGeometries),t=o(this._layerMaskGeometries);return null==e||null==t?e||t:t.concat(e)}get _layerMaskGeometries(){const e=this.layerFilter;return null==e?null:null==this._geometryEngine?l:"disjoint"===e.spatialRelationship?e.geometries.map(e=>({type:"polygon",rings:e.rings,spatialReference:e.spatialReference,cache:{}})):[e.geometries.reduce((e,t)=>(e.rings=[...e.rings,...t.rings],e),{type:"polygon",rings:[],spatialReference:e.geometries[0].spatialReference,cache:{}})]}get _viewMaskGeometries(){if(null==this.viewFilter)return null;const{geometry:e}=this.viewFilter;if(null==e)return null;if(null==this.viewFilter||null==this._geometryEngine)return l;const{distance:t,units:r}=this.viewFilter,i=this.viewFilter.spatialRelationship,n="mesh"===e.type?e.extent:e;if(null==t||0===t)return V(this._geometryEngine,n,i);const o=r||p(n.spatialReference);if(n.spatialReference.isWGS84){const e=this._geometryEngine.geodesicBuffer(n,t,o);return V(this._geometryEngine,e,i)}const a=O(n,v.WGS84);if(null!=a){const e=O(this._geometryEngine.geodesicBuffer(a,t,o),n.spatialReference);return V(this._geometryEngine,e,i)}if(!this._projectionEngineLoaded&&(this.loadAsyncModule(w().then(()=>this._projectionEngineLoaded=!0)),!this._projectionEngineLoaded))return null;let c=null;try{c=b(n,v.WGS84)}catch(u){}if(c)try{c=b(this._geometryEngine.geodesicBuffer(c,t,o),n.spatialReference)}catch(u){c=null}return c||s.getLogger(this).error(`Filter by geodesic buffer (distance) unsupported, failed to project input geometry (${n.spatialReference.wkid}) to WGS84.`),V(this._geometryEngine,c,i)}get updating(){return a(this._layerMaskGeometries)||a(this._viewMaskGeometries)}static checkSupport(e){return null!=e&&(!!A(e.spatialRelationship)||(s.getLogger(this.prototype).warn(`Filters with spatialRelationship other than ${W.join(", ")} are not supported for mesh scene layers`),!1))}};e([u()],C.prototype,"layerFilter",void 0),e([u({type:B})],C.prototype,"viewFilter",void 0),e([u()],C.prototype,"layerFieldsIndex",void 0),e([u()],C.prototype,"loadAsyncModule",void 0),e([u()],C.prototype,"addSqlFilter",void 0),e([u()],C.prototype,"addTimeFilter",void 0),e([u({readOnly:!0})],C.prototype,"sortedObjectIds",null),e([u({readOnly:!0})],C.prototype,"parsedWhereClause",null),e([u({readOnly:!0})],C.prototype,"parsedGeometry",null),e([u({readOnly:!0})],C.prototype,"_layerMaskGeometries",null),e([u({readOnly:!0})],C.prototype,"_viewMaskGeometries",null),e([u()],C.prototype,"updating",null),e([u()],C.prototype,"_projectionEngineLoaded",void 0),e([u()],C.prototype,"_geometryEngine",void 0),C=e([g("esri.views.3d.layers.i3s.I3SMeshViewFilter")],C);const W=(e=>e)(["contains","intersects","disjoint"]);function A(e){return null!=e&&W.includes(e)}function V(e,t,s){if(null==t)return null;if("disjoint"===s&&"polygon"===t.type){const s=t.rings.length,n=t.spatialReference,o=new Array(s);for(let e=0;e<s;++e){const r=_(1/0,1/0,-1/0,-1/0);k(r,t.rings[e]),o[e]={type:"polygon",rings:[t.rings[e]],spatialReference:n,cache:{},aabr:r}}o.sort((e,t)=>e.aabr[0]-t.aabr[0]);const l=new Set,a=new i;for(let t=0;t<o.length;++t){const i=o[t],s=i.aabr[0];l.forEach(t=>{if(s>=t.aabr[2])return void l.delete(t);if(i.aabr[1]>t.aabr[3]||i.aabr[3]<t.aabr[1]||!e.intersects(i,t))return;i.rings=i.rings.concat(t.rings),M(i.aabr,t.aabr,i.aabr),i.cache={},l.delete(t);const n=r(o,t,o.length,a);o.splice(n,1)}),l.add(i)}for(const e of o)e.aabr=void 0;return o}return[t]}function q(e,t,r,i,s){if(t.radius>=.5*(t.center[2]+j(i).radius))return!0;const n=D(e,t,i);return r.every(t=>1!==H(e,t,n,s))}function N(e,t,r,i,s,n,o,l,a){const c=l[0].spatialReference||n.spatialReference;if(!R(i.node.serviceMbsInIndexSR,o,$,c))return void e().warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter");const p=D(t,$,c),u=z(a,n,c,s,i.objectHandle),g="intersects"===a;let d=null;for(const m of l){if(0===r.length)return;switch(H(t,m,p,a)){case 1:return g&&(i.weaklyRemovedIds=i.weaklyRemovedIds?.concat(r)??r.slice()),void(r.length=0);case 0:continue}U(r,i.featureIds,e=>!!J(t,m,e,u)||(g&&(d||=[],d.push(i.featureIds[e])),!1))}d&&(i.weaklyRemovedIds=i.weaklyRemovedIds?.concat(d)??d)}const $=new L;function z(e,t,r,i,s){const n=t.renderSpatialReference,o=new Map,l={type:"polygon",rings:[[[0,0,0],[0,0,0],[0,0,0],[0,0,0]]],spatialReference:r};l.rings[0][3]=l.rings[0][0];const a={indices:null,data:null,stride:0,startIndex:0,endIndex:0};let c,p;switch(e){case"intersects":c=(e,t,r)=>e.intersects(t,r)?0:2,p=P;break;case"contains":c=(e,t,r)=>e.contains(t,r)?2:1,p=P;break;default:c=(e,t,r)=>e.disjoint(t,r)?2:1,p=Z}return{collection:i,object:s,type:e,maskSR:r,renderSR:n,aabbCache:o,triangle:l,positions:a,triangleTest:c,geometryTest:p}}function D(e,t,r){const i={type:"point",x:t.center[0],y:t.center[1],hasZ:!1,hasM:!1,spatialReference:r},s=!G(r)&&!x(r),o=Number.isNaN(t.radius)?0:n(t.radius,0,2*I.radius),l=s?e.buffer(i,o,1):e.geodesicBuffer(i,o,1);return l.type="polygon",l}function H(e,t,r,i){switch(i){case"intersects":case"contains":return P(e,t,r);case"disjoint":return Z(e,t,r)}}function P(e,t,r){return e.intersects(t,r)?e.contains(t,r)?0:2:1}function Z(e,t,r){return e.intersects(t,r)?e.contains(t,r)?1:2:0}function J(e,t,r,i){const{collection:s,object:n,renderSR:o,maskSR:l,geometryTest:a,aabbCache:c}=i;let p=c.get(r);if(!p){const e=s.getObjectTransform(n);s.getComponentAabb(n,r,K);const t=[y(K[0],K[1],0),y(K[0],K[4],0),y(K[3],K[4],0),y(K[3],K[1],0)];for(let r=0;r<4;++r)d(t[r],t[r],e.rotationScale),m(t[r],t[r],e.position),F(t[r],o,t[r],l);p={type:"polygon",rings:[t],spatialReference:l,cache:{}},p.rings[0][4]=p.rings[0][0],c.set(r,p)}switch(a(e,t,p)){case 1:return!1;case 0:return!0}const{triangle:u,triangleTest:g,positions:h}=i,j=u.rings[0][0],w=u.rings[0][1],b=u.rings[0][2],v=s.getObjectTransform(n);s.getComponentPositions(n,r,h);const{indices:R,data:S,stride:_,startIndex:k,endIndex:M}=h;for(let y=k;y<M;y+=3){const r=_*R[y],i=_*R[y+1],s=_*R[y+2];switch(f(j,S[r],S[r+1],S[r+2]),f(w,S[i],S[i+1],S[i+2]),f(b,S[s],S[s+1],S[s+2]),d(j,j,v.rotationScale),d(w,w,v.rotationScale),d(b,b,v.rotationScale),m(j,j,v.position),m(w,w,v.position),m(b,b,v.position),F(j,o,j,l),F(w,o,w,l),F(b,o,b,l),g(e,t,u)){case 1:return!1;case 0:return!0}}return"intersects"!==i.type}const K=S();export{C as I3SMeshViewFilter};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{indexOf as r,PositionHint as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Logger.js";import{clamp as o}from"../../../../core/mathUtils.js";import{unwrapUpdating as n,updating as a,isUpdating as l}from"../../../../core/maybeUpdating.js";import{whenOnce as c}from"../../../../core/reactiveUtils.js";import{getUnitString as p,lengthUnits as u}from"../../../../core/units.js";import{property as m,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{transformMat3 as g,add as f,set as y}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import j from"../../../../core/sql/WhereClause.js";import{getReferenceEllipsoid as w}from"../../../../geometry/ellipsoidUtils.js";import{projectBoundingSphere as v}from"../../../../geometry/projection/projectBoundingSphere.js";import{projectVectorToVector as R}from"../../../../geometry/projection/projectVectorToVector.js";import{create as O}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as b,expandWithNestedArray as F,expand as S}from"../../../../geometry/support/aaBoundingRect.js";import{doubleArrayFrom as x}from"../../../../geometry/support/DoubleArray.js";import{earth as _}from"../../../../geometry/support/Ellipsoid.js";import{isWGS84 as k,isWebMercator as I}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as M}from"../../../../geometry/support/sphere.js";import G from"../../../../layers/support/FeatureFilter.js";import{objectIdFilter as L,filterInPlace as T}from"./I3SUtil.js";let B=class extends t{constructor(e){super(e)}initialize(){c(()=>this.viewFilter?.geometry||this.layerFilter).then(()=>Promise.all([this._loadOperator(import("../../../../geometry/operators/json/geodesicBufferOperator.js")),this._loadOperator(import("../../../../geometry/operators/json/bufferOperator.js")),this._loadOperator(import("../../../../geometry/operators/json/intersectsOperator.js")),this._loadOperator(import("../../../../geometry/operators/json/containsOperator.js")),this._loadOperator(import("../../../../geometry/operators/json/disjointOperator.js"))]).then(async e=>{this.destroyed||(this._geometryOperators=e)}))}_loadOperator(e){return this.loadAsyncModule(e).then(e=>"load"in e&&"function"==typeof e.load?e.load().then(()=>e):e)}get sortedObjectIds(){return null==this.viewFilter?.objectIds?null:x(this.viewFilter.objectIds).sort()}get parsedWhereClause(){const e=this.viewFilter?.where;if(null==e||!e)return null;try{return j.create(e,{fieldsIndex:this.layerFieldsIndex})}catch(t){s.getLogger(this).error(`Failed to parse filter where clause: ${t}`)}return null}addFilters(e,t,r,i){const o=this.sortedObjectIds;null!=o&&e.push(e=>L(o,!0,e)),this.addSqlFilter(e,this.parsedWhereClause),this.addTimeFilter(e,this.viewFilter?.timeExtent);const a=this._geometryOperators;if(!a)return;const l=()=>s.getLogger(this),c=n(this._layerMaskGeometries);if(c&&this.layerFilter){const s=this.layerFilter.spatialRelationship;e.push((e,o)=>J(l,a,e,o,i,t,r,c,s))}const p=n(this._viewMaskGeometries);if(p&&this.viewFilter){const s=this.viewFilter.spatialRelationship;e.push((e,o)=>J(l,a,e,o,i,t,r,p,s))}}isMBSGeometryVisible(e,t,r){const i=this._geometryOperators;if(!i)return!0;const o=n(this._layerMaskGeometries);if(o&&this.layerFilter){const n=this.layerFilter.spatialRelationship,a=o[0].spatialReference||t;if(!v(e,r,W,a))return s.getLogger(this).warnOnce("SceneLayer.mask geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0;return A(i,W,o,a,n)}const a=n(this._viewMaskGeometries);if(a&&this.viewFilter){const o=this.viewFilter.spatialRelationship,n=a[0].spatialReference||t;if(!v(e,r,W,n))return s.getLogger(this).warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0;return A(i,W,a,n,o)}return!0}get parsedGeometry(){const e=n(this._viewMaskGeometries),t=n(this._layerMaskGeometries);return null==e||null==t?e??t:t.concat(e)}get _layerMaskGeometries(){const e=this.layerFilter;return null==e?null:null==this._geometryOperators?a:"disjoint"===e.spatialRelationship?e.geometries.map(e=>({type:"polygon",rings:e.rings,spatialReference:e.spatialReference,cache:{}})):[e.geometries.reduce((e,t)=>(e.rings=[...e.rings,...t.rings],e),{type:"polygon",rings:[],spatialReference:e.geometries[0].spatialReference,cache:{}})]}get _viewMaskGeometries(){const e=this.viewFilter?.geometry;if(!this.viewFilter||!e)return null;if(!this._geometryOperators)return a;const{distance:t,units:r}=this.viewFilter,i=this.viewFilter.spatialRelationship,o="mesh"===e.type?e.extent:e;if(null==t||0===t)return V(this._geometryOperators,o,i);try{const e=U(r,o.spatialReference),s=this._geometryOperators[0].execute(o.toJSON(),t,{unit:e});return V(this._geometryOperators,s,i)}catch(n){s.getLogger(this).error(`Filter by geodesic buffer (distance) unsupported, failed execute with input geometry (${JSON.stringify(o.toJSON())}).`)}return null}get updating(){return l(this._layerMaskGeometries)||l(this._viewMaskGeometries)}static checkSupport(e){return null!=e&&(!!N(e.spatialRelationship)||(s.getLogger(this.prototype).warn(`Filters with spatialRelationship other than ${C.join(", ")} are not supported for mesh scene layers`),!1))}};e([m()],B.prototype,"layerFilter",void 0),e([m({type:G})],B.prototype,"viewFilter",void 0),e([m()],B.prototype,"layerFieldsIndex",void 0),e([m()],B.prototype,"loadAsyncModule",void 0),e([m()],B.prototype,"addSqlFilter",void 0),e([m()],B.prototype,"addTimeFilter",void 0),e([m({readOnly:!0})],B.prototype,"sortedObjectIds",null),e([m({readOnly:!0})],B.prototype,"parsedWhereClause",null),e([m({readOnly:!0})],B.prototype,"parsedGeometry",null),e([m({readOnly:!0})],B.prototype,"_layerMaskGeometries",null),e([m({readOnly:!0})],B.prototype,"_viewMaskGeometries",null),e([m()],B.prototype,"updating",null),e([m()],B.prototype,"_geometryOperators",void 0),B=e([d("esri.views.3d.layers.i3s.I3SMeshViewFilter")],B);const C=(e=>e)(["contains","intersects","disjoint"]);function N(e){return null!=e&&C.includes(e)}function U(e,t){const r=e??p(t);return u.includes(r)?r:void 0}function V(e,t,s){if(null==t)return null;if("disjoint"===s&&"rings"in t){const s=t.spatialReference,o=t.rings.map(e=>{const t=b(1/0,1/0,-1/0,-1/0);return F(t,e),new q({rings:[e],spatialReference:s},t)});o.sort((e,t)=>e.aabr[0]-t.aabr[0]);const n=new Set,a=new i;for(let t=0;t<o.length;++t){const{polygon:i,aabr:s}=o[t],l=s[0];n.forEach(t=>{if(l>=t.aabr[2])return void n.delete(t);if(s[1]>t.aabr[3]||s[3]<t.aabr[1]||!e[2].execute(i,t.polygon))return;i.rings=i.rings.concat(t.polygon.rings),S(s,t.aabr,s),n.delete(t);const c=r(o,t,o.length,a);o.splice(c,1)}),n.add(o[t])}return o.map(({polygon:e})=>e)}return["toJSON"in t?t.toJSON():t]}function A(e,t,r,i,s){if(t.radius>=.5*(t.center[2]+w(i).radius))return!0;const o=$(e,t,i);return!o||r.every(t=>1!==P(e,t,o,s))}function J(e,t,r,i,s,o,n,a,l){const c=a[0].spatialReference||o.spatialReference;if(!v(i.node.serviceMbsInIndexSR,n,W,c))return void e().warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter");const p=$(t,W,c);if(!p)return;const u=E(l,o,c,s,i.objectHandle),m="intersects"===l;let d=null;for(const g of a){if(0===r.length)return;switch(P(t,g,p,l)){case 1:return m&&(i.weaklyRemovedIds=i.weaklyRemovedIds?.concat(r)??r.slice()),void(r.length=0);case 0:continue}T(r,i.featureIds,e=>!!H(t,g,e,u)||(m&&(d||=[],d.push(i.featureIds[e])),!1))}d&&(i.weaklyRemovedIds=i.weaklyRemovedIds?.concat(d)??d)}const W=new M;class q{constructor(e,t){this.aabr=t,this.polygon={rings:e.rings,spatialReference:e.spatialReference}}}function E(e,t,r,i,s){const o=t.renderSpatialReference,n=new Map,a={rings:[[[0,0,0],[0,0,0],[0,0,0],[0,0,0]]],spatialReference:r};a.rings[0][3]=a.rings[0][0];const l={indices:null,data:null,stride:0,startIndex:0,endIndex:0};let c,p;switch(e){case"intersects":c=(e,t,r)=>e[2].execute(t,r)?0:2,p=z;break;case"contains":c=(e,t,r)=>e[3].execute(t,r)?2:1,p=z;break;default:c=(e,t,r)=>e[4].execute(t,r)?2:1,p=D}return{collection:i,object:s,type:e,maskSR:r,renderSR:o,aabbCache:n,triangle:a,positions:l,triangleTest:c,geometryTest:p}}function $(e,t,r){const i={x:t.center[0],y:t.center[1],spatialReference:r},s=!k(r)&&!I(r),n=Number.isNaN(t.radius)?0:o(t.radius,0,2*_.radius);return s?e[1].execute(i,n):e[0].execute(i,n)}function P(e,t,r,i){if(!r)return 0;switch(i){case"intersects":case"contains":return z(e,t,r);case"disjoint":return D(e,t,r)}}function z(e,t,r){return e[2].execute(t,r)?e[3].execute(t,r)?0:2:1}function D(e,t,r){return e[2].execute(t,r)?e[3].execute(t,r)?1:2:0}function H(e,t,r,i){const{collection:s,object:o,renderSR:n,maskSR:a,geometryTest:l,aabbCache:c}=i;let p=c.get(r);if(!p){const e=s.getObjectTransform(o);s.getComponentAabb(o,r,K);const t=[h(K[0],K[1],0),h(K[0],K[4],0),h(K[3],K[4],0),h(K[3],K[1],0)];for(let r=0;r<4;++r)g(t[r],t[r],e.rotationScale),f(t[r],t[r],e.position),R(t[r],n,t[r],a);p={rings:[t],spatialReference:a},p.rings[0][4]=p.rings[0][0],c.set(r,p)}switch(l(e,t,p)){case 1:return!1;case 0:return!0}const{triangle:u,triangleTest:m,positions:d}=i,j=u.rings[0][0],w=u.rings[0][1],v=u.rings[0][2],O=s.getObjectTransform(o);s.getComponentPositions(o,r,d);const{indices:b,data:F,stride:S,startIndex:x,endIndex:_}=d;for(let h=x;h<_;h+=3){const r=S*b[h],i=S*b[h+1],s=S*b[h+2];switch(y(j,F[r],F[r+1],F[r+2]),y(w,F[i],F[i+1],F[i+2]),y(v,F[s],F[s+1],F[s+2]),g(j,j,O.rotationScale),g(w,w,O.rotationScale),g(v,v,O.rotationScale),f(j,j,O.position),f(w,w,O.position),f(v,v,O.position),R(j,n,j,a),R(w,n,w,a),R(v,n,v,a),m(e,t,u)){case 1:return!1;case 0:return!0}}return"intersects"!==i.type}const K=O();export{B as I3SMeshViewFilter};
|
|
@@ -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{prefersReducedMotion as t}from"../../../core/a11yUtils.js";import r from"../../../core/Accessor.js";import{EventEmitter as o}from"../../../core/Evented.js";import{destroyMaybe as a}from"../../../core/maybe.js";import{when as i}from"../../../core/reactiveUtils.js";import{property as n,subclass as s}from"../../../core/accessorSupport/decorators.js";import{afterDispatch as l}from"../../../core/accessorSupport/watch.js";import{fromValues as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import m from"../../ViewAnimation.js";import{viewingModeFromString as h}from"../../ViewingMode.js";import{Constraints as d}from"./Constraints.js";import{AnimationController as u}from"./controllers/AnimationController.js";import g from"../webgl/RenderCamera.js";import{DepthRange as y}from"../webgl-engine/lib/DepthRange.js";import{maximumHighlights as C}from"../../support/HighlightDefaults.js";import{PropertiesPool as f}from"../../support/PropertiesPool.js";let w=class extends r{constructor(e){super(e),this._propertiesPool=new f({camera:()=>new g},this),this._lastSeenCameraProjectionValues=new g,this.mode=0,this._cssCamera=new g,this._camera=new g,this.rasterPixelRatio=1,this.contentPixelRatio=1,this.constraints=new d({state:this}),this.events=new o,this.fading=!1,this._cameraChanged=!1,this._updateQueue=new Array,this._processingUpdates=!1}reset(){this.cameraController=null,this._propertiesPool.destroy(),this._propertiesPool=new f({camera:()=>new g},this)}destroy(){this.cameraController=
|
|
5
|
+
import{__decorate as e}from"tslib";import{prefersReducedMotion as t}from"../../../core/a11yUtils.js";import r from"../../../core/Accessor.js";import{EventEmitter as o}from"../../../core/Evented.js";import{destroyMaybe as a}from"../../../core/maybe.js";import{when as i}from"../../../core/reactiveUtils.js";import{property as n,subclass as s}from"../../../core/accessorSupport/decorators.js";import{afterDispatch as l}from"../../../core/accessorSupport/watch.js";import{fromValues as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import m from"../../ViewAnimation.js";import{viewingModeFromString as h}from"../../ViewingMode.js";import{Constraints as d}from"./Constraints.js";import{AnimationController as u}from"./controllers/AnimationController.js";import g from"../webgl/RenderCamera.js";import{DepthRange as y}from"../webgl-engine/lib/DepthRange.js";import{maximumHighlights as C}from"../../support/HighlightDefaults.js";import{PropertiesPool as f}from"../../support/PropertiesPool.js";let w=class extends r{constructor(e){super(e),this._propertiesPool=new f({camera:()=>new g},this),this._lastSeenCameraProjectionValues=new g,this.mode=0,this._cssCamera=new g,this._camera=new g,this.rasterPixelRatio=1,this.contentPixelRatio=1,this.constraints=new d({state:this}),this.events=new o,this.fading=!1,this._cameraChanged=!1,this._updateQueue=new Array,this._processingUpdates=!1}reset(){this.cameraController=null,this._propertiesPool.destroy(),this._propertiesPool=new f({camera:()=>new g},this)}destroy(){this.cameraController=null,this._propertiesPool=a(this._propertiesPool)}createInitialCamera(){if(1===this.viewingMode){const e=c(this.spatialReference).radius;this.camera=new g({eye:p(4*e,0,0),center:p(e,0,0),up:p(0,0,1)})}else this.camera=new g({eye:p(0,0,100),center:p(0,0,0),up:p(0,1,0)})}get animation(){return this.cameraController instanceof u&&null!=this.cameraController.viewAnimation?this.cameraController.viewAnimation:null}get cssCamera(){const e=this._cssCamera.copyFrom(this.camera),{height:t,width:r,pixelRatio:o}=this.camera;return e.pixelRatio=1,e.height=Math.round(t/o),e.width=Math.round(r/o),e}get camera(){return this._camera}set camera(e){e!==j&&j.copyFrom(e),j.computeUp(this.viewingMode),this.events.emit("before-camera-change",{camera:j});const t=this._camera;if(_(this._lastSeenCameraProjectionValues,j)&&(this._lastSeenCameraProjectionValues.copyFrom(j),this.events.emit("camera-projection-changed",this._lastSeenCameraProjectionValues)),!t.equals(j)&&(this._camera=this._propertiesPool.get("camera").copyFrom(j),this._cameraChanged=!t.almostEquals(j),this._cameraChanged)){const e=l(()=>{this._cameraChanged=!1,e.remove()})}}get pixelRatio(){return this.camera.pixelRatio}get alignPixelEnabled(){return this.pixelRatio===this.rasterPixelRatio&&2===this.mode}get updating(){return 2!==this.mode}get contentCamera(){return this._contentCamera??this.camera}set contentCamera(e){if(null==e)return void(this._contentCamera=null);const t=e.clone();this.events.emit("before-camera-change",{camera:t,sceneDepthRange:y.Infinite}),this._contentCamera=t}get fixedContentCamera(){return null!=this._contentCamera}get isGlobal(){return 1===this.viewingMode}get isLocal(){return 2===this.viewingMode}get viewingMode(){return h(this.view.viewingMode)}get spatialReference(){return this.view.spatialReference}get highlights(){const e=this.view.highlights.items.slice(0,C);for(let t=0;t<e.length;){const r=e[t],o=e.findIndex(e=>e.name===r.name);o>=0&&t>o?e.splice(t,1):++t}return e}get highlightOrderMap(){return new Map(this.highlights.map(({name:e},t)=>[e,t]))}get animationsEnabled(){return this.view.animationsEnabled&&!t()}get navigating(){return!!this.cameraController?.isInteractive}get stationary(){return!this._cameraChanged&&!this.navigating}get cameraController(){return this._get("cameraController")}set cameraController(e){this.stopActiveCameraController()?(this.removeHandles(x),this.cameraController?.destroy(),e&&(this.addHandles(i(()=>4===e.state||3===e.state,()=>{this.updateCamera(t=>e.onControllerEnd(t)),this.cameraController===e&&(this._set("cameraController",null),e.destroy())},{sync:!0,once:!0}),x),e.onControllerStart(this.camera)),this._set("cameraController",e)):e&&(e.state=1)}switchCameraController(e){this.cameraController=e}stopActiveCameraController(){return!this.cameraController||this.cameraController.stopController()}updateCamera(e){this._updateQueue.push(e),this._processUpdateQueue()}_processUpdateQueue(){if(0===this._updateQueue.length||this._processingUpdates)return;this._processingUpdates=!0;const e=this._updateQueue.shift();j.copyFrom(this.camera),e(j),this.camera=j,this._processingUpdates=!1,this._processUpdateQueue()}static cleanupViewstate(){j=new g}};e([n({constructOnly:!0})],w.prototype,"view",void 0),e([n()],w.prototype,"mode",void 0),e([n({readOnly:!0,type:m})],w.prototype,"animation",null),e([n({type:g})],w.prototype,"cssCamera",null),e([n()],w.prototype,"_cssCamera",void 0),e([n({type:g})],w.prototype,"camera",null),e([n()],w.prototype,"_camera",void 0),e([n({readOnly:!0})],w.prototype,"pixelRatio",null),e([n()],w.prototype,"rasterPixelRatio",void 0),e([n()],w.prototype,"contentPixelRatio",void 0),e([n({readOnly:!0})],w.prototype,"alignPixelEnabled",null),e([n({readOnly:!0})],w.prototype,"updating",null),e([n({})],w.prototype,"_contentCamera",void 0),e([n({type:g})],w.prototype,"contentCamera",null),e([n({readOnly:!0})],w.prototype,"fixedContentCamera",null),e([n({readOnly:!0})],w.prototype,"events",void 0),e([n({readOnly:!0})],w.prototype,"isGlobal",null),e([n({readOnly:!0})],w.prototype,"isLocal",null),e([n({readOnly:!0})],w.prototype,"viewingMode",null),e([n({readOnly:!0})],w.prototype,"highlights",null),e([n({readOnly:!0})],w.prototype,"highlightOrderMap",null),e([n({readOnly:!0})],w.prototype,"navigating",null),e([n()],w.prototype,"fading",void 0),e([n({readOnly:!0})],w.prototype,"stationary",null),e([n()],w.prototype,"_cameraChanged",void 0),e([n()],w.prototype,"cameraController",null),w=e([s("esri.views.3d.state.ViewState")],w);const v=w;function _(e,t){return e.fov!==t.fov||(e.fullViewport[0]!==t.fullViewport[0]||e.fullViewport[1]!==t.fullViewport[1]||e.fullViewport[2]!==t.fullViewport[2]||e.fullViewport[3]!==t.fullViewport[3]||(e.padding[0]!==t.padding[0]||e.padding[1]!==t.padding[1]||e.padding[2]!==t.padding[2]||e.padding[3]!==t.padding[3]))}let j=new g;const x="ViewStateHandles";export{v 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{signal as i}from"../../../../core/signal.js";class e{static{this.fadeInEase=i=>i*(2-i)}static{this.fadeOutEase=i=>i*i}constructor(e){this.layerView=e,this._numFadingTiles=i(0)}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(i,e){const t=this._getTargetOpacity(e);if(i.fadeDirection=e,0===this.fadeDuration)return void this._instantTileFading(i,t);const a=i.opacityModifier;if(a!==t){const e=1-Math.abs(t-a);this._startTileFading(i,e)}else this._stopTileFading(i)}updateAllTileFading(i){this.layerView.tileHandles.forEach(e=>this._updateTileFading(e,i)),this.layerView.updateGaussians()}onFadeDurationChanged(i){0===i&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(i){return null!=i.fadeProgress&&1===i.fadeDirection}isUpdating(){return this._numFadingTiles.value>0}get fadeDuration(){return
|
|
5
|
+
import{signal as i}from"../../../../core/signal.js";class e{static{this.fadeInEase=i=>i*(2-i)}static{this.fadeOutEase=i=>i*i}constructor(e){this.layerView=e,this._numFadingTiles=i(0)}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(i,e){const t=this._getTargetOpacity(e);if(i.fadeDirection=e,0===this.fadeDuration)return void this._instantTileFading(i,t);const a=i.opacityModifier;if(a!==t){const e=1-Math.abs(t-a);this._startTileFading(i,e)}else this._stopTileFading(i)}updateAllTileFading(i){this.layerView.tileHandles.forEach(e=>this._updateTileFading(e,i)),this.layerView.updateGaussians()}onFadeDurationChanged(i){0===i&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(i){return null!=i.fadeProgress&&1===i.fadeDirection}isUpdating(){return this._numFadingTiles.value>0}get fadeDuration(){return 0}get fadingEnabled(){return 0!==this.fadeDuration}_startTileFading(i,e){null==i.fadeProgress&&this._numFadingTiles.value++,i.fadeProgress=e}_stopTileFading(i){null!=i.fadeProgress&&(1===i.fadeDirection&&this._onTileFullyFadedOut(i),this._numFadingTiles.value--,i.fadeProgress=null)}_updateTileFading(i,t){const{fadeProgress:a,fadeDirection:s}=i;if(null==a)return;const n=this._fadeDirectionToSign(s),d=n*this.fadeDuration,l=this._getTargetOpacity(s),r=t/Math.abs(d||1),o=Math.min(a+r,1),u=n*(1-(0===s?e.fadeInEase:e.fadeOutEase)(o)),g=1===o;i.opacityModifier=g?l:l-u,g?this._stopTileFading(i):i.fadeProgress=o,this._updateOpacityModifier(i)}_updateOpacityModifier(i){const e=255*i.opacityModifier;for(let t=0;t<i.pageIds.length;t++){const a=i.pageIds[t];this.layerView.data.fadingTexture.updateBuffer(e,a)}}_instantTileFading(i,e){i.fadeProgress=null,i.opacityModifier=e,this._updateOpacityModifier(i),1===i.fadeDirection&&this._onTileFullyFadedOut(i)}_instantlyFullyFadeAllTiles(){this.layerView.tileHandles.forEach(i=>{null!=i.fadeProgress&&this._instantTileFading(i,this._getTargetOpacity(i.fadeDirection))}),this.layerView.updateGaussians(),this._numFadingTiles.value=0}_onTileFullyFadedOut(i){i.isVisible=!1,this.layerView.moveTileToCache(i)}_fadeDirectionToSign(i){return 0===i?1:-1}_getTargetOpacity(i){return 0===i?1:0}}export{e as GaussianSplatFadeHelper};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import"../webgl-engine/core/shaderLibrary/terrain/BackgroundGrid.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js";import"../webgl-engine/core/shaderModules/Float3PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/glsl.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";import"../../webgl/ShaderBuilder.js";export{b as build}from"../../../chunks/BlendLayers.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{subclass as r}from"../../../core/accessorSupport/decorators.js";import{ZEROS as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import{subclass as r}from"../../../core/accessorSupport/decorators.js";import{ZEROS as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{B as o}from"../../../chunks/BlendLayers.glsl.js";import{TileCompositePassParameters as i}from"../webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js";import{ReloadableShader as t}from"../webgl-engine/core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as l}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{Pos2TexF16 as a}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{PrimitiveType as n}from"../../webgl/enums.js";class c extends i{constructor(){super(...arguments),this.opacity=1,this.baseOpacity=1,this.texture=null,this.fboTexture=null,this.backgroundColor=s}}let m=class extends l{constructor(e,r){super(e,r,a),this.shader=new t(o,()=>import("./BlendLayers.glsl.js")),this.primitiveType=n.TRIANGLE_STRIP}};m=e([r("esri.views.3d.terrain.BlendLayersTechnique")],m);export{c as BlendLayersPassParameters,m as BlendLayersTechnique};
|
|
@@ -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{unique as r}from"../../../core/arrayUtils.js";import{EventEmitter as t}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as s,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as n}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as a,on as h,syncAndInitial as d,initial as l}from"../../../core/reactiveUtils.js";import{someSet as c}from"../../../core/SetUtils.js";import{property as u,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as _,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as m}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ones as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as f}from"../support/debugFlags.js";import{Overlay as R}from"./Overlay.js";import{OverlayRenderTargets as v}from"./OverlayRenderTargets.js";import x from"../webgl/RenderCamera.js";import{T as w}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as T}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as b,renderHighlightBuffer as O}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as S}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as D}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as C,defaultRenderOccludedMask as P}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as j}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as E}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as M}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as F}from"../webgl-engine/lighting/Lightsources.js";import{O as W}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as q}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as V,noBudget as A}from"../../support/Scheduler.js";import G from"../../webgl/Texture.js";import{TextureDescriptor as k}from"../../webgl/TextureDescriptor.js";let I=class extends T{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new W,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new w,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new x,this.events=new t,this.longitudeCyclical=null,this.produces=new Map([[19,e=>8!==e||this.hasHighlights],[20,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new C(this._rctx,new j(t,e.state.viewingMode),i),this.addHandles([a(()=>s.updating,()=>this.events.emit("content-changed"),d),a(()=>this._spatialReference,e=>this._localOriginFactory=new D(e),d),h(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),a(()=>b(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),a(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},l),e.resourceController.scheduler.registerTask(V.OVERLAY_RENDERER,this)]);const n=this._camera;n.near=1,n.far=1e4,n.relativeElevation=null,this._bindParameters.slot=19,this._bindParameters.camera=n,this._bindParameters.updateLighting([new F(y())],0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=n(this._passParameters.texture),this.disposeOverlays(),this._renderContext=null,this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new S(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(q)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||s(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),r(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(a(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&c(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=c(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=c(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=c(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new v(this._stage.renderer.fboCache),this._overlays=[new R,new R]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_onMaterialOrContentChanged(){this.renderOccludedFlags=s(this._renderers,e=>e.hasOccluders)?L:1}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(e.done)break;(s.destroyed||r(s))&&(i.commitChanges()&&(t=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress()),this.compact(e),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=s(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return s(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(A,e=>1===e.updatePolicy)}get isEmpty(){return!f.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){const e=s(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._setOutput(this._renderTargets?.targets.find(r=>r.content===e)?.output??0);++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(t),s}_setOutput(e){const r=this._renderContext.output;return this._renderContext.output=e,this._bindParameters.slot=2===e?20:19,r}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._setOutput(e),8===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=L),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n,content:o}=r;if(this.isEmpty||2===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:a,_camera:h,_renderContext:d,_bindParameters:l}=this;if(h.pixelRatio=t.pixelRatio*i,this._setOutput(n),l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,4===o&&(d.renderOccludedMask=L),!this.renders(o))return d.renderOccludedMask=P,!1;const{resolution:c}=t,u=0===e,p=u?0:c;a.setViewport(p,0,c,c),this._bindTargetFBO(r),u&&(8===n?a.gl.clearBufferuiv(a.gl.COLOR,0,[0,0,0,0]):(a.setClearColor(0,0,0,0),a.clear(16384)));if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==o&&2!==o){this._techniques.precompile(E,z);const r=this._techniques.get(E,z);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,B[e]),a.bindTechnique(r,l,this._passParameters),a.screen.draw()}if(8===n){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),O(a,t,{width:s,height:s},l,()=>this._renderAllGeometry(e,r),p)}else this._renderAllGeometry(e,r);return a.bindFramebuffer(null),d.renderOccludedMask=P,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(q);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers.map(e=>e.uid),r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer?.uid),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new U(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(m(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new k(e);i.samplingMode=9728,this._passParameters.texture=new G(this._rctx,i,t)}get test(){}};e([u()],I.prototype,"hasHighlights",void 0),e([u()],I.prototype,"renderOccludedFlags",void 0),e([u()],I.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([u({constructOnly:!0})],I.prototype,"parent",void 0),e([u({readOnly:!0})],I.prototype,"_techniques",null),e([u({type:Boolean,readOnly:!0})],I.prototype,"updating",null),e([u()],I.prototype,"isEmpty",null),I=e([p("esri.views.3d.terrain.OverlayRenderer")],I);class U{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const B=[[1,.5,.5],[.5,.5,1]],H=-2,L=4,z=new M;z.hasAlpha=!0;export{I as OverlayRenderer,H as drapedZ,L as overlayRenderOccludedFlag};
|
|
5
|
+
import{__decorate as e}from"tslib";import{unique as r}from"../../../core/arrayUtils.js";import{EventEmitter as t}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as s,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as n}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as a,on as h,syncAndInitial as d,initial as l}from"../../../core/reactiveUtils.js";import{someSet as c}from"../../../core/SetUtils.js";import{property as u,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as _,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as m}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ones as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as f}from"../support/debugFlags.js";import{Overlay as R}from"./Overlay.js";import{OverlayRenderTargets as v}from"./OverlayRenderTargets.js";import x from"../webgl/RenderCamera.js";import{SyncRenderPlugin as w}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as T,renderHighlightBuffer as b}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as S}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as O}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as D,defaultRenderOccludedMask as C}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as P}from"../webgl-engine/lib/ShadowMap.js";import{T as j}from"../../../chunks/Texture.glsl.js";import{TextureTechnique as E}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as M}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as F}from"../webgl-engine/lighting/Lightsources.js";import{O as W}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as q}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as V,noBudget as A}from"../../support/Scheduler.js";import G from"../../webgl/Texture.js";import{TextureDescriptor as k}from"../../webgl/TextureDescriptor.js";let I=class extends w{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new W,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new j,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new x,this.events=new t,this.longitudeCyclical=null,this.produces=new Map([[19,e=>8!==e||this.hasHighlights],[20,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new D(this._rctx,new P(t,e.state.viewingMode),i),this.addHandles([a(()=>s.updating,()=>this.events.emit("content-changed"),d),a(()=>this._spatialReference,e=>this._localOriginFactory=new O(e),d),h(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),a(()=>T(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),a(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},l),e.resourceController.scheduler.registerTask(V.OVERLAY_RENDERER,this)]);const n=this._camera;n.near=1,n.far=1e4,n.relativeElevation=null,this._bindParameters.slot=19,this._bindParameters.camera=n,this._bindParameters.updateLighting([new F(y())],0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=n(this._passParameters.texture),this.disposeOverlays(),this._renderContext=null,this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new S(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(q)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||s(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),r(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(a(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&c(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=c(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=c(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=c(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new v(this._stage.renderer.fboCache),this._overlays=[new R,new R]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_onMaterialOrContentChanged(){this.renderOccludedFlags=s(this._renderers,e=>e.hasOccluders)?L:1}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(e.done)break;(s.destroyed||r(s))&&(i.commitChanges()&&(t=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress()),this.compact(e),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=s(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return s(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(A,e=>1===e.updatePolicy)}get isEmpty(){return!f.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){const e=s(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._setOutput(this._renderTargets?.targets.find(r=>r.content===e)?.output??0);++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(t),s}_setOutput(e){const r=this._renderContext.output;return this._renderContext.output=e,this._bindParameters.slot=2===e?20:19,r}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._setOutput(e),8===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=L),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n,content:o}=r;if(this.isEmpty||2===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:a,_camera:h,_renderContext:d,_bindParameters:l}=this;if(h.pixelRatio=t.pixelRatio*i,this._setOutput(n),l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,4===o&&(d.renderOccludedMask=L),!this.renders(o))return d.renderOccludedMask=C,!1;const{resolution:c}=t,u=0===e,p=u?0:c;a.setViewport(p,0,c,c),this._bindTargetFBO(r),u&&(8===n?a.gl.clearBufferuiv(a.gl.COLOR,0,[0,0,0,0]):(a.setClearColor(0,0,0,0),a.clear(16384)));if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==o&&2!==o){this._techniques.precompile(E,z);const r=this._techniques.get(E,z);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,B[e]),a.bindTechnique(r,l,this._passParameters),a.screen.draw()}if(8===n){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),b(a,t,{width:s,height:s},l,()=>this._renderAllGeometry(e,r),p)}else this._renderAllGeometry(e,r);return a.bindFramebuffer(null),d.renderOccludedMask=C,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(q);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers.map(e=>e.uid),r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer?.uid),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new U(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(m(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new k(e);i.samplingMode=9728,this._passParameters.texture=new G(this._rctx,i,t)}get test(){}};e([u()],I.prototype,"hasHighlights",void 0),e([u()],I.prototype,"renderOccludedFlags",void 0),e([u()],I.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([u({constructOnly:!0})],I.prototype,"parent",void 0),e([u({readOnly:!0})],I.prototype,"_techniques",null),e([u({type:Boolean,readOnly:!0})],I.prototype,"updating",null),e([u()],I.prototype,"isEmpty",null),I=e([p("esri.views.3d.terrain.OverlayRenderer")],I);class U{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const B=[[1,.5,.5],[.5,.5,1]],H=-2,L=4,z=new M;z.hasAlpha=!0;export{I as OverlayRenderer,H as drapedZ,L as overlayRenderOccludedFlag};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../webgl-engine/core/shaderLibrary/raster/Colormap.glsl.js";import"../webgl-engine/core/shaderLibrary/raster/Common.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js";import"../webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import"../webgl-engine/core/shaderModules/BooleanPassUniform.js";import"../webgl-engine/core/shaderModules/Float2PassUniform.js";import"../webgl-engine/core/shaderModules/Float3PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/FloatsPassUniform.js";import"../webgl-engine/core/shaderModules/glsl.js";import"../webgl-engine/core/shaderModules/IntegerPassUniform.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";import"../../webgl/ShaderBuilder.js";export{b as ColorizerHillshadeUniforms,a as ColorizerStretchUniforms,C as ColorizerUniforms,c as build}from"../../../chunks/RasterColorizer.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{subclass as r}from"../../../core/accessorSupport/decorators.js";import{R as o}from"../../../chunks/RasterColorizer.glsl.js";import{ReloadableShader as s}from"../webgl-engine/core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{Pos2TexF16 as t}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{PrimitiveType as
|
|
5
|
+
import{__decorate as e}from"tslib";import{subclass as r}from"../../../core/accessorSupport/decorators.js";import{R as o}from"../../../chunks/RasterColorizer.glsl.js";import{ReloadableShader as s}from"../webgl-engine/core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{Pos2TexF16 as t}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{PrimitiveType as l}from"../../webgl/enums.js";let a=class extends i{constructor(e,r){super(e,r,t),this.shader=new s(o,()=>import("./RasterColorizer.glsl.js")),this.primitiveType=l.TRIANGLE_STRIP}};a=e([r("esri.views.3d.terrain.RasterColorizerTechnique")],a);export{a as RasterColorizerTechnique};
|