@arcgis/core 4.26.0-next.20221221 → 4.26.0-next.20221223
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/WebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{2163b9ee4d639d5ed6f3.js → 05bba3ba2f9ee02f52b5.js} +1 -1
- package/assets/esri/core/workers/chunks/{bbccf69f4aa1b1761265.js → 0b8dc54801a7aa5e6be3.js} +1 -1
- package/assets/esri/core/workers/chunks/{6dbd3aabfe4d5d593205.js → 0b9c53e01d6ac1e7d5ca.js} +29 -29
- package/assets/esri/core/workers/chunks/1039cd48a12e88baa97a.js +1 -0
- package/assets/esri/core/workers/chunks/{634e7957696f72c8b8b1.js → 3fb4ae8d6e8563a1c255.js} +1 -1
- package/assets/esri/core/workers/chunks/{b61ce04af4e57b1856cb.js → d447ebc944a9867f5a99.js} +1 -1
- package/assets/esri/core/workers/chunks/e3ba96417fd75a5d2feb.js +1 -0
- package/assets/esri/core/workers/chunks/{099765dff2b7e6958d3d.js → efc9030af5aac27055a1.js} +1 -1
- package/assets/esri/themes/base/widgets/_UtilityNetworkTrace.scss +1 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nb.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_he.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ar.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_bg.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_bs.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ca.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_cs.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_da.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_de.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_el.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_es.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_et.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_fi.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_fr.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_he.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_hr.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_hu.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_id.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_it.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ja.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ko.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_lt.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_lv.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_nb.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_nl.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_pl.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_pt-BR.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_pt-PT.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ro.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ru.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_sk.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_sl.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_sr.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_sv.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_th.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_tr.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_uk.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_vi.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_zh-CN.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_zh-HK.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_zh-TW.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ar.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_bg.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_bs.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ca.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_cs.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_da.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_de.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_el.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_es.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_et.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_fi.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_fr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_he.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_hr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_hu.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_id.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_it.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ja.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ko.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_lt.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_lv.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_nb.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_nl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pt-BR.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pt-PT.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ro.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ru.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sk.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sv.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_th.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_tr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_uk.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_vi.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-CN.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-HK.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-TW.json +1 -1
- package/core/workers/workers.js +1 -1
- package/geometry/support/intersects.js +1 -1
- package/geometry/support/meshUtils/elevation.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/index.js +1 -1
- package/geometry.js +1 -1
- package/interfaces.d.ts +868 -0
- package/intl.js +1 -1
- package/layers/support/ImageParameters.js +1 -1
- package/layers/support/VoxelVariable.js +1 -1
- package/layers/support/VoxelVolumeStyle.js +1 -1
- package/layers/support/domains.js +1 -1
- package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
- package/libs/maquette/projection.js +1 -1
- package/package.json +1 -1
- package/pointCloudRenderers.js +1 -1
- package/popup/content.js +1 -1
- package/rasterRenderers.js +1 -1
- package/renderers.js +1 -1
- package/rest/locator/addressesToLocations.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/unitConversionUtils.js +1 -1
- package/symbols.js +1 -1
- package/views/2d/engine/FeatureContainer.js +1 -1
- package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/GraphicsLayerView2D.js +1 -1
- package/views/2d/layers/KMLLayerView2D.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/MapImageLayerView2D.js +1 -1
- package/views/2d/layers/MapNotesLayerView2D.js +1 -1
- package/views/2d/layers/RouteLayerView2D.js +1 -1
- package/views/2d/layers/StreamLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/WMSLayerView2D.js +1 -1
- package/views/2d/layers/WMTSLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureStore2D.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/processors/HeatmapProcessor.js +1 -1
- package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
- package/views/2d/layers/features/schemaUtils.js +1 -1
- package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
- package/views/2d/layers/features/sources/DataTileSource.js +1 -1
- package/views/2d/layers/features/sources/DataTileSubscription.js +1 -1
- package/views/2d/layers/features/sources/GeoEventSource.js +1 -1
- package/views/2d/layers/features/sources/SnapshotFeatureSource.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/rendererUtils.js +1 -1
- package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/HeatmapSource.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/visualVariablesUtils.js +1 -1
- package/views/2d/layers/graphics/BaseGraphicContainer.js +1 -1
- package/views/2d/layers/graphics/GraphicBoundsRenderer.js +1 -1
- package/views/2d/layers/graphics/graphicsUtils.js +1 -1
- package/views/2d/layers/imagery/ImageryView2D.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/2d/layers/support/ExportStrategy.js +1 -1
- package/views/2d/layers/support/FeatureLayerProxy.js +1 -1
- package/views/2d/magnifier/MagnifierView2D.js +1 -1
- package/views/2d/navigation/MapViewNavigation.js +1 -1
- package/views/2d/navigation/ZoomBox.js +1 -1
- package/views/2d/navigation/actions/Pan.js +1 -1
- package/views/2d/navigation/actions/Pinch.js +1 -1
- package/views/2d/tiling/TileManager.js +1 -1
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsView3D.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/WMTSLayerView3D.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/QueryEngine.js +1 -1
- package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
- package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
- package/views/3d/layers/graphics/featureExpressionInfoUtils.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/queryForSymbologySnapping.js +1 -1
- package/views/3d/layers/graphics/symbolComplexity.js +1 -1
- package/views/3d/layers/graphics/wosrLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/attributeEditing.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
- package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/layers/support/projectExtentUtils.js +1 -1
- package/views/3d/support/PBFDecoderWorker.js +1 -1
- package/views/3d/support/SharedSymbolResources.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/support/geometry3dUtils.js +1 -1
- package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
- package/widgets/Daylight.js +1 -1
- package/widgets/Directions/components/SaveLayer.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTemplates/ItemList.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/ShadowCast/components/Label.js +1 -1
- package/widgets/Slice/SlicePlane.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/assets/esri/core/workers/chunks/7ce1b3056f392cd10031.js +0 -1
- package/assets/esri/core/workers/chunks/fc197a387187daab1df3.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e,isNone as t,unwrap as s,unwrapOr as i}from"../../../../core/maybe.js";import{c as a,m as n,a as r}from"../../../../chunks/vec3.js";import{c as o}from"../../../../chunks/vec3f64.js";import{setMin as c,setMax as h,create as l,isPoint as g,empty as d,center as b,offset as u}from"../../../../geometry/support/aaBoundingBox.js";import{g as j}from"../../../../chunks/sphere.js";import{evaluateElevationInfoAtPoint as O}from"./elevationAlignmentUtils.js";import{setContextFeature as m}from"./featureExpressionInfoUtils.js";import{demResolutionForBoundingBox as p}from"./graphicUtils.js";import{Object3DState as _}from"../../webgl-engine/lib/basicInterfaces.js";import{Transparency as v}from"../../webgl-engine/lib/edgeRendering/interfaces.js";class f{constructor(e,t,s){this.baseMaterial=e,this.edgeMaterials=t,this.properties=s}}class S{get isElevationSource(){return!(!this.stageObject.metadata||!this.stageObject.metadata.isElevationSource)}constructor(e,t,s,i,a,n,r,o=null){this.graphics3DSymbolLayer=e,this.stageObject=t,this._uniqueGeometries=s,this._uniqueMaterials=i,this._sharedResource=a,this.elevationAligner=n,this.elevationContext=r,this._edgeState=o,this.type="object3d",this._stageLayer=null,this._stage=null,this._visible=!1,this._addedToStage=!1,this.alignedSampledElevation=0,this.needsElevationUpdates=!1,this.useObjectOriginAsAttachmentOrigin=!1}initialize(e,t){this._stageLayer=t,this._stage=e,e.addMany(this._uniqueMaterials),e.addMany(this._uniqueGeometries),e.add(this.stageObject)}destroy(){const t=this._stage;this._stageLayer&&(t.removeMany(this._uniqueMaterials),t.removeMany(this._uniqueGeometries)),t.remove(this.stageObject),this._addedToStage&&(this._stageLayer.remove(this.stageObject),this._addedToStage=!1);const s=this._stage.renderer.ensureEdgeView();s.hasObject(this.stageObject)&&s.removeObject(this.stageObject),this.stageObject.dispose(),e(this._sharedResource)&&this._sharedResource.release(),this._visible=!1,this._stageLayer=null,this._stage=null}layerOpacityChanged(e,s){if(t(this._edgeState))return;const i=E(this._edgeState.baseMaterial);let a=!1;for(const t of this._edgeState.edgeMaterials)t.objectTransparency!==i&&(t.objectTransparency=i,a=!0);a&&this._resetEdgeObject(s);this._stage.renderer.ensureEdgeView().updateAllComponentOpacities(this.stageObject,[e])}slicePlaneEnabledChanged(e,s){if(t(this._edgeState))return;this._stage.renderer.ensureEdgeView().updateAllComponentMaterials(this.stageObject,this._edgeState.edgeMaterials,{hasSlicePlane:e},!s),this._edgeState.properties.hasSlicePlane=e}setVisibility(t){if(null!=this._stage&&this._visible!==t&&(this._visible=t,this.stageObject.visible=t,this._visible&&!this._addedToStage&&(this._stageLayer.add(this.stageObject),this._addedToStage=!0),e(this._edgeState))){const e=this._stage.renderer.ensureEdgeView();e.hasObject(this.stageObject)?e.updateObjectVisibility(this.stageObject,t):t&&this._addOrUpdateEdgeObject(e,!1)}}get visible(){return this._visible}alignWithElevation(t,i,a,n){if(null==this.elevationAligner)return;e(a)&&m(this.elevationContext.featureExpressionInfoContext,a);const r=(e,s)=>O(e,t,this.elevationContext,i,s);this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,s(t.spatialReference),r,i),this._resetEdgeObject(n)}alignWithAbsoluteElevation(e,t,s){const i=(t,s)=>{s.sampledElevation=e,s.verticalDistanceToGround=0,s.z=e};this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,null,i,t),this._resetEdgeObject(s)}getCenterObjectSpace(e=o()){return a(e,j(this.stageObject.boundingVolumeObjectSpace.bounds))}getBoundingBoxObjectSpace(e=l()){const t=this.stageObject.boundingVolumeObjectSpace;return c(e,t.min),h(e,t.max),e}computeAttachmentOrigin(e){if(this.useObjectOriginAsAttachmentOrigin){const t=this.stageObject.transformation;e.render.origin[0]+=t[12],e.render.origin[1]+=t[13],e.render.origin[2]+=t[14],e.render.num++}else for(const t of this.stageObject.geometries)t.computeAttachmentOrigin(x)&&(n(x,x,this.stageObject.transformation),r(e.render.origin,e.render.origin,x),e.render.num++)}async getProjectedBoundingBox(e,t,s,a,r){const o=this.getBoundingBoxObjectSpace(r),c=A,h=g(o)?1:c.length;for(let i=0;i<h;i++){const e=c[i];M[0]=o[e[0]],M[1]=o[e[1]],M[2]=o[e[2]],n(M,M,this.stageObject.transformation),y[3*i+0]=M[0],y[3*i+1]=M[1],y[3*i+2]=M[2]}if(!e(y,0,h))return null;d(o);let l=null;this.calculateRelativeScreenBounds&&(l=this.calculateRelativeScreenBounds());for(let i=0;i<3*h;i+=3){for(let e=0;e<3;e++)o[e]=Math.min(o[e],y[i+e]),o[e+3]=Math.max(o[e+3],y[i+e]);l&&s.push({location:y.slice(i,i+3),screenSpaceBoundingRect:l})}if(t&&t.service&&"absolute-height"!==this.elevationContext.mode){b(o,x);const e="relative-to-scene"===this.elevationContext.mode?"scene":"ground";let s=0;if(t.useViewElevation)s=i(t.service.getElevation(x[0],x[1],e),0);else try{const n=p(o,t.service.spatialReference,t);s=i(await t.service.queryElevation(x[0],x[1],a,n,e),0)}catch(j){}u(o,0,0,-this.alignedSampledElevation+s)}return o}addObjectState(e,t){e===_.Highlight&&t.addObject(this.stageObject,this.stageObject.highlight()),e===_.MaskOccludee&&t.addObject(this.stageObject,this.stageObject.maskOccludee())}removeObjectState(e){e.removeObject(this.stageObject)}_resetEdgeObject(e){if(t(this._edgeState))return;const s=this._stage.renderer.ensureEdgeView();this._visible?this._addOrUpdateEdgeObject(s,e):s.removeObject(this.stageObject)}_addOrUpdateEdgeObject(e,s){const i=this._edgeState;if(t(i))return;const a=E(i.baseMaterial);for(const t of i.edgeMaterials)t.objectTransparency=a;e.addOrUpdateObject3D(this.stageObject,i.edgeMaterials,i.properties,!s).then((()=>this._stageLayer?.sync()))}}function E(e){return e.isVisible?e.parameters.transparent?v.TRANSPARENT:v.OPAQUE:v.INVISIBLE}const y=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],M=o(),x=o(),A=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];export{S as Graphics3DObject3DGraphicLayer,f as Object3DEdgeState};
|
|
5
|
+
import{isSome as e,isNone as t,unwrap as s,unwrapOr as i}from"../../../../core/maybe.js";import{c as a,m as n,a as r}from"../../../../chunks/vec3.js";import{c as o}from"../../../../chunks/vec3f64.js";import{setMin as c,setMax as h,create as l,isPoint as g,empty as d,center as b,offset as u}from"../../../../geometry/support/aaBoundingBox.js";import{g as j}from"../../../../chunks/sphere.js";import{evaluateElevationInfoAtPoint as O}from"./elevationAlignmentUtils.js";import{setContextFeature as m}from"./featureExpressionInfoUtils.js";import{demResolutionForBoundingBox as p}from"./graphicUtils.js";import{Object3DState as _}from"../../webgl-engine/lib/basicInterfaces.js";import{Transparency as v}from"../../webgl-engine/lib/edgeRendering/interfaces.js";class f{constructor(e,t,s){this.baseMaterial=e,this.edgeMaterials=t,this.properties=s}}class S{get isElevationSource(){return!(!this.stageObject.metadata||!this.stageObject.metadata.isElevationSource)}constructor(e,t,s,i,a,n,r,o=null){this.graphics3DSymbolLayer=e,this.stageObject=t,this._uniqueGeometries=s,this._uniqueMaterials=i,this._sharedResource=a,this.elevationAligner=n,this.elevationContext=r,this._edgeState=o,this.type="object3d",this._stageLayer=null,this._stage=null,this._visible=!1,this._addedToStage=!1,this.alignedSampledElevation=0,this.needsElevationUpdates=!1,this.useObjectOriginAsAttachmentOrigin=!1}initialize(e,t){this._stageLayer=t,this._stage=e,e.addMany(this._uniqueMaterials),e.addMany(this._uniqueGeometries),e.add(this.stageObject)}destroy(){const t=this._stage;this._stageLayer&&(t.removeMany(this._uniqueMaterials),t.removeMany(this._uniqueGeometries)),t.remove(this.stageObject),this._addedToStage&&(this._stageLayer.remove(this.stageObject),this._addedToStage=!1);const s=this._stage.renderer.ensureEdgeView();s.hasObject(this.stageObject)&&s.removeObject(this.stageObject),this.stageObject.dispose(),e(this._sharedResource)&&this._sharedResource.release(),this._visible=!1,this._stageLayer=null,this._stage=null}layerOpacityChanged(e,s){if(t(this._edgeState))return;const i=E(this._edgeState.baseMaterial);let a=!1;for(const t of this._edgeState.edgeMaterials)t.objectTransparency!==i&&(t.objectTransparency=i,a=!0);a&&this._resetEdgeObject(s);this._stage.renderer.ensureEdgeView().updateAllComponentOpacities(this.stageObject,[e])}slicePlaneEnabledChanged(e,s){if(t(this._edgeState))return;this._stage.renderer.ensureEdgeView().updateAllComponentMaterials(this.stageObject,this._edgeState.edgeMaterials,{hasSlicePlane:e},!s),this._edgeState.properties.hasSlicePlane=e}setVisibility(t){if(null!=this._stage&&this._visible!==t&&(this._visible=t,this.stageObject.visible=t,this._visible&&!this._addedToStage&&(this._stageLayer.add(this.stageObject),this._addedToStage=!0),e(this._edgeState))){const e=this._stage.renderer.ensureEdgeView();e.hasObject(this.stageObject)?e.updateObjectVisibility(this.stageObject,t):t&&this._addOrUpdateEdgeObject(e,!1)}}get visible(){return this._visible}alignWithElevation(t,i,a,n){if(null==this.elevationAligner)return;e(a)&&m(this.elevationContext.featureExpressionInfoContext,a);const r=(e,s)=>O(e,t,this.elevationContext,i,s);this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,s(t.spatialReference),r,i),this._resetEdgeObject(n)}alignWithAbsoluteElevation(e,t,s){const i=(t,s)=>{s.sampledElevation=e,s.verticalDistanceToGround=0,s.z=e};this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,null,i,t),this._resetEdgeObject(s)}getCenterObjectSpace(e=o()){return a(e,j(this.stageObject.boundingVolumeObjectSpace.bounds))}getBoundingBoxObjectSpace(e=l()){const t=this.stageObject.boundingVolumeObjectSpace;return c(e,t.min),h(e,t.max),e}computeAttachmentOrigin(e){if(this.useObjectOriginAsAttachmentOrigin){const t=this.stageObject.transformation;e.render.origin[0]+=t[12],e.render.origin[1]+=t[13],e.render.origin[2]+=t[14],e.render.num++}else for(const t of this.stageObject.geometries)t.computeAttachmentOrigin(x)&&(n(x,x,this.stageObject.transformation),r(e.render.origin,e.render.origin,x),e.render.num++)}async getProjectedBoundingBox(e,t,s,a,r){const o=this.getBoundingBoxObjectSpace(r),c=A,h=g(o)?1:c.length;for(let i=0;i<h;i++){const e=c[i];M[0]=o[e[0]],M[1]=o[e[1]],M[2]=o[e[2]],n(M,M,this.stageObject.transformation),y[3*i+0]=M[0],y[3*i+1]=M[1],y[3*i+2]=M[2]}if(!e(y,0,h))return null;d(o);let l=null;this.calculateRelativeScreenBounds&&(l=this.calculateRelativeScreenBounds());for(let i=0;i<3*h;i+=3){for(let e=0;e<3;e++)o[e]=Math.min(o[e],y[i+e]),o[e+3]=Math.max(o[e+3],y[i+e]);l&&s.push({location:y.slice(i,i+3),screenSpaceBoundingRect:l})}if(t&&t.service&&"absolute-height"!==this.elevationContext.mode){b(o,x);const e="relative-to-scene"===this.elevationContext.mode?"scene":"ground";let s=0;if(t.useViewElevation)s=i(t.service.getElevation(x[0],x[1],e),0);else try{const n=p(o,t.service.spatialReference,t);s=i(await t.service.queryElevation(x[0],x[1],a,n,e),0)}catch(j){}u(o,0,0,-this.alignedSampledElevation+s)}return o}addObjectState(e,t){e===_.Highlight&&t.addObject(this.stageObject,this.stageObject.highlight()),e===_.MaskOccludee&&t.addObject(this.stageObject,this.stageObject.maskOccludee())}removeObjectState(e){e.removeObject(this.stageObject)}_resetEdgeObject(e){if(t(this._edgeState))return;const s=this._stage.renderer.ensureEdgeView();this._visible?this._addOrUpdateEdgeObject(s,e):s.removeObject(this.stageObject)}_addOrUpdateEdgeObject(e,s){const i=this._edgeState;if(t(i))return;const a=E(i.baseMaterial);for(const t of i.edgeMaterials)t.objectTransparency=a;e.addOrUpdateObject3D(this.stageObject,i.edgeMaterials,i.properties,!s).then((()=>this._stageLayer?.sync()))}}function E(e){return e.isVisible()?e.parameters.transparent?v.TRANSPARENT:v.OPAQUE:v.INVISIBLE}const y=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],M=o(),x=o(),A=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];export{S as Graphics3DObject3DGraphicLayer,f as Object3DEdgeState};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import has from"../../../../core/has.js";import{isSome as t,get as s,none as r,isNone as i,unwrapOr as a}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{pt2px as n}from"../../../../core/screenUtils.js";import{c,i as l,k as h,v as d}from"../../../../chunks/mat4.js";import{c as p}from"../../../../chunks/mat4f64.js";import{l as m,o as u,c as y,B as f,a as _,s as b}from"../../../../chunks/vec3.js";import{d as g,O as P,Z as R,f as v,c as x}from"../../../../chunks/vec3f64.js";import{O as L,c as S}from"../../../../chunks/vec4f64.js";import{projectPointToVector as C,computeTranslationToOriginAndRotation as j}from"../../../../geometry/projection.js";import{create as w,size as U,containsPoint as E,center as T}from"../../../../geometry/support/aaBoundingBox.js";import{defaultPrimitive as A}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as B,objectSymbolLayerSizeWithResourceSize as I}from"../../../../symbols/support/symbolLayerUtils3D.js";import{perLodInstanceElevationAligner as O}from"./ElevationAligners.js";import{needsElevationUpdates3D as G,evaluateElevationInfoAtPoint as D,SampleElevationInfo as M}from"./elevationAlignmentUtils.js";import{ElevationContext as z}from"./ElevationContext.js";import F from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as V}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as k,mixinColorAndOpacity as H,computeObjectScale as W,computeObjectRotation as q}from"./graphicUtils.js";import{ApplyRendererDiffResult as N}from"./interfaces.js";import{LoadStatus as $}from"./Loadable.js";import{makeLodResources as Z,fillEstimatedMinScreenSpaceRadius as J}from"./lodResourceUtils.js";import{fetch as K}from"./objectResourceUtils.js";import{placePointOnGeometry as Q,extendPointGraphicElevationContext as X}from"./pointUtils.js";import{isValidPrimitive as Y,primitiveLodResources as ee}from"./primitiveObjectSymbolUtils.js";import{defaultSymbolLayerMemoryComplexity as te}from"./symbolComplexity.js";import{initFastSymbolUpdatesState as se,updateFastSymbolUpdatesState as re,evaluateModelTransform as ie,evaluateModelTransformScale as ae}from"../support/FastSymbolUpdates.js";import{CullFaceOptions as oe}from"../../webgl-engine/lib/basicInterfaces.js";import{VertexAttribute as ne}from"../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as ce}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{materialsFromLodResources as le,texturesFromLodResources as he,geometriesFromLodResources as de,geometriesFromLodLevelResources as pe}from"../../webgl-engine/lib/lodRendering/LodResources.js";import{DefaultMaterial as me}from"../../webgl-engine/materials/DefaultMaterial.js";class ue{constructor(e,t,s,r,i,a,o,n,c,l,h,d){this.lodResources=e,this.lodRenderer=t,this.stageResources=s,this.originalMaterialParameters=r,this.resourceSize=i,this.isEsriSymbolResource=a,this.isWosr=o,this.resourceBoundingBox=n,this.symbolSize=c,this.extentPadding=l,this.physicalBasedRenderingEnabled=h,this.pivotOffset=d}}class ye extends V{getCachedSize(){const[e,s,r]=t(this._resources)?this._resources.symbolSize:[1,1,1];return{width:e,depth:s,height:r}}constructor(e,t,s,r){super(e,t,s,r),this._resources=null,this._optionalFields=new Array,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=new Array,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){if(k(this.symbolLayer))throw new Error}const t=this.symbolLayer;if(this._isPrimitive){const s=t.resource?t.resource.primitive:A;this._resources=await this._createResourcesForPrimitive(s,e)}else this._resources=await this._createResourcesForUrl(t.resource.href,e);this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.complexity=this.computeComplexity()}get extentPadding(){return t(this._resources)?this._resources.extentPadding:0}get _isPrimitive(){return!(this.symbolLayer.resource&&this.symbolLayer.resource.href)}get lodRenderer(){return t(this._resources)?this._resources.lodRenderer:null}_setMaterialTransparencyParams(e,t=s(this.symbolLayer,"material","color")){const r=this._getCombinedOpacity(t),i=r<1||this.needsDrivenTransparentPass;return e.transparent=i,e.opacity=r,e.cullFace=i?oe.None:oe.Back,e}async _createResourcesForPrimitive(s,i){if(!Y(s))throw new Error(`Unknown object symbol primitive: ${s}`);const a=this.symbolLayer,o=w(B(s)),c=g(U(o)),l=g(I(c,a)),h=m(l),d=!1,p=!1,u={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,ambient:P,diffuse:P,hasSlicePlane:this._context.slicePlaneEnabled,hasSliceHighlight:!1,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!this.symbolLayer.isPrimitive},y=u.usePBR;this._setMaterialTransparencyParams(u);const f=this.symbol;if("point-3d"===f.type&&f.verticalOffset){const{screenLength:e,minWorldLength:s,maxWorldLength:r}=f.verticalOffset;u.verticalOffset={screenLength:n(e),minWorldLength:s||0,maxWorldLength:t(r)?r:1/0},u.castShadows=!1}if(this._context.screenSizePerspectiveEnabled&&(u.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),this._drivenProperties.color)u.externalColor=L;else{const s=t(a.material)&&a.material.color,r=t(s)?e.toUnitRGBA(s):L;u.externalColor=r}this._fastUpdates=se(this._context.renderer,this._fastVisualVariableConvertOptions(o,l,c,r)),u.instanced=["transformation"],this._fastUpdates.enabled?(Object.assign(u,this._fastUpdates.materialParameters),u.instanced.push("featureAttribute"),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(u.instanced.push("color"),this._optionalFields.push("color")),has("enable-feature:objectAndLayerId-rendering")&&(u.instanced.push("objectAndLayerIdColor"),this._optionalFields.push("objectAndLayerIdColor"));const _=new me(u),b=ee(s,_);if(!b)throw new Error(`Unknown object symbol primitive: ${s}`);const R=le(b).map((e=>({opacity:1,transparent:e.parameters.transparent}))),v=await this._createStageResources(b,y,i),x=await this._createLodRenderer(b,i);return new ue(b,x,v,R,c,d,p,o,l,h,y,r)}async _createResourcesForUrl(e,i){const a=["transformation"],o={materialParamsMixin:{instanced:a,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},streamDataRequester:this._context.streamDataRequester,cache:this._context.sharedResources.objectResourceCache};this._fastUpdates=se(this._context.renderer,this._fastVisualVariableConvertOptions(r,r,r,r)),this._fastUpdates.enabled?(Object.assign(o.materialParamsMixin,this._fastUpdates.materialParameters),a.push("featureAttribute"),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(a.push("color"),this._optionalFields.push("color")),has("enable-feature:objectAndLayerId-rendering")&&(a.push("objectAndLayerIdColor"),this._optionalFields.push("objectAndLayerIdColor"));const c=this.symbol;if("point-3d"===c.type&&c.verticalOffset){const{screenLength:e,minWorldLength:s,maxWorldLength:r}=c.verticalOffset;o.materialParamsMixin.verticalOffset={screenLength:n(e),minWorldLength:s||0,maxWorldLength:t(r)?r:1/0},o.materialParamsMixin.castShadows=!1}o.signal=i,o.usePBR=this._context.physicalBasedRenderingEnabled,o.skipHighLods=this._context.skipHighSymbolLods;const l=o.usePBR,h=await K(e,o),d=h.isEsriSymbolResource,p=h.isWosr,u=Z(h.lods);J(u),u.levels.sort(((e,t)=>e.minScreenSpaceRadius-t.minScreenSpaceRadius)),u.levels[0].minScreenSpaceRadius=Math.min(2,u.levels[0].minScreenSpaceRadius);const y=this._context,f=this.symbolLayer.material,_=this._getExternalColorParameters(f),b=s(this.symbolLayer,"material","color"),P=this._getCombinedOpacity(b,{hasIntrinsicColor:!0}),R=this.needsDrivenTransparentPass,v=le(u),x=le(u).map((e=>({opacity:e.parameters.opacity||1,transparent:e.parameters.transparent})));v.forEach((e=>{const t=e.parameters;e.setParameters(_);const s=t.opacity*P,r=s<1||R||t.transparent;e.setParameters({opacity:s,transparent:r}),y.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:y.sharedResources.screenSizePerspectiveSettings})}));const L=h.referenceBoundingBox,S=g(U(L)),C=g(u.levels[0].pivotOffset),j=g(I(S,this.symbolLayer)),w=m(j);re(this._fastUpdates,this._context.renderer,this._fastVisualVariableConvertOptions(L,j,S,C))&&v.forEach((e=>e.setParameters(this._fastUpdates.materialParameters)));const E=await this._createStageResources(u,l,i),T=await this._createLodRenderer(u,i);return new ue(u,T,E,x,S,d,p,L,j,w,l,C)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,t,s){const r=this._context.stage,i=le(e);t!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged(),r.addMany(i),this._addDisposeResource((()=>r.removeMany(i)));const a=he(e);r.addMany(a),this._addDisposeResource((()=>r.removeMany(a))),await r.load(a,s),o(s);const n=de(e);return r.addMany(n),this._addDisposeResource((()=>r.removeMany(n))),{materials:i,textures:a,geometries:n}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerUid:this._context.layer.uid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates.enabled?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,ge),c(s,ie(this._fastUpdates.materialParameters,ge,s))},scaleFactor:(e,t,s)=>(t.getFeatureAttribute(s,ge),ae(e,this._fastUpdates.materialParameters,ge))}:null,a=new ce({symbol:e,optionalFields:this._optionalFields,metadata:r,shaderTransformation:i},this._context.scheduler);return a.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource((()=>{s.removeRenderPlugin(a),a.destroy()})),await s.addRenderPlugin(a.slots,a,t),a}_getExternalColorParameters(s){const r={};return this._drivenProperties.color?r.externalColor=L:t(s)&&t(s.color)?r.externalColor=e.toUnitRGBA(s.color):(r.externalColor=L,r.colorMixMode="ignore"),r}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach((e=>e())),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=Q(t.geometry);if(i(s))return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const r=this.setGraphicElevationContext(t,new z),a=e.renderingInfo;return this._createAs3DShape(t,s,a,r,t.uid,e.layer.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(i(this._resources))return;const e=this._drivenProperties.opacity,t=!this._isPrimitive,r=this._resources.stageResources.materials,a=this._resources.originalMaterialParameters;for(let i=0;i<r.length;i++){const o=r[i],n=s(this.symbolLayer,"material","color"),c=a[i],l=this._getCombinedOpacity(n,{hasIntrinsicColor:t})*c.opacity,h=l<1||e||c.transparent;o.setParameters({opacity:l,transparent:h}),this._isPrimitive&&o.setParameters({cullFace:h?oe.None:oe.Back})}}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,G)}slicePlaneEnabledChanged(){if(i(this._resources))return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(i(this._resources))return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this._isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this._hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this._hasLoadedPBRTextures=!0,!1)}pixelRatioChanged(){return!0}applyRendererDiff(e,t){if(i(this._resources))return N.Recreate_Symbol;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:a,symbolSize:o,resourceSize:n,pivotOffset:c}=this._resources;for(const i in e.diff){if("visualVariables"!==i)return N.Recreate_Symbol;if(!re(this._fastUpdates,t,this._fastVisualVariableConvertOptions(a,o,n,c)))return N.Recreate_Symbol;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return N.Fast_Update}computeComplexity(){if(i(this._resources))return super.computeComplexity();const e=this._resources.lodResources,t=pe(e.levels[0]).reduce(((e,t)=>e+t.indices.get(ne.POSITION).length),0)/3,s=e=>Array.from(e.vertexAttributes.values()).reduce(((e,t)=>e+(t.data.buffer?.byteLength??0)),0)+Array.from(e.indices.values()).reduce(((e,t)=>e+(Array.isArray(t)?12*t.length:t.buffer.byteLength)),0),r=he(e).reduce(((e,t)=>e+t.estimatedTexMemRequired),0)/4+de(e).reduce(((e,t)=>e+s(t)),0);return{primitivesPerFeature:t,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1,memory:{...te(this.symbol,this.symbolLayer),resourceBytes:r}}}_hasLodRenderer(){return t(this._resources)}_createAs3DShape(e,s,r,a,o,n){if(!this._hasLodRenderer()||i(this._resources))return null;const c=this.getFastUpdateAttrValues(e),l=!this._fastUpdates.enabled&&this._hasPerInstanceColor()?H(r.color,r.opacity):null,h=this._context.clippingExtent;if(C(s,fe,this._context.elevationProvider.spatialReference),t(h)&&!E(h,fe))return null;const d=this._requiresTerrainElevation(a),p=this._computeGlobalTransform(s,a,be,Pe),m=this._computeLocalTransform(this._resources,this.symbolLayer,r,_e),u=this._resources.lodRenderer.instanceData,y=u.addInstance();this._instanceIndexToGraphicUid.set(y,o),u.setLocalTransform(y,m,!1),u.setGlobalTransform(y,p),c&&u.setFeatureAttribute(y,c),l&&u.setColor(y,l),t(this._context.stage.renderView.objectAndLayerIdRenderHelper)&&u.setObjectAndLayerIdColor(y,this._context.stage.renderView.objectAndLayerIdRenderHelper.getObjectAndLayerIdColor({graphicUid:o,layerUid:n}));const f=new F(this,y,O,a);return d&&(f.alignedSampledElevation=Pe.sampledElevation),f.needsElevationUpdates=G(a.mode),X(f,s,this._context.elevationProvider),f}_computeGlobalTransform(e,t,s,r){return D(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),fe[0]=e.x,fe[1]=e.y,fe[2]=r.z,j(e.spatialReference,fe,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,s,r){return l(r),this._applyObjectRotation(s,!1,r),this._applyObjectRotation(t,!0,r),this._applyObjectScale(e,s,r),this._applyAnchor(e,t,r),r}_applyObjectScale(e,t,s){if(this._fastUpdates.enabled&&this._fastUpdates.requiresShaderTransformation)return;const r=this._drivenProperties.size&&t.size?t.size:e.symbolSize,i=W(r,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||h(s,s,i)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(i(this._resources))return!0;const s=t&&Q(t);if(i(s))return!1;const r=this.getGeometryElevationMode(t);return e.elevationContext.mode===r&&(this._computeGlobalTransform(s,e.elevationContext,be,Pe),this._requiresTerrainElevation(e.elevationContext)&&(e.alignedSampledElevation=Pe.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(e.instanceIndex,be,!0),X(e,s,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(i(this._resources))return;const s=(e,t,s)=>a(null!=e&&"complete"===e.type?e.newValue:t,s),r=s(t.heading,this.symbolLayer.heading,0),o=s(t.tilt,this.symbolLayer.tilt,0),n=s(t.roll,this.symbolLayer.roll,0),c=s(t.width,this.symbolLayer.width,void 0),l=s(t.height,this.symbolLayer.height,void 0),h=s(t.depth,this.symbolLayer.depth,void 0),d=s(t.anchor,this.symbolLayer.anchor,void 0),p=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const m={heading:r,tilt:o,roll:n,anchor:d,anchorPosition:p},u=this._resources;this.loadStatus===$.LOADED&&e.symbolLayerStatePatches.push((()=>{u.symbolSize=g(I(u.resourceSize,{width:c,height:l,depth:h,isPrimitive:this.symbolLayer.isPrimitive}))})),e.graphics3DGraphicPatches.push(((e,t)=>{const s=this._computeLocalTransform(u,m,t,_e),r=e.instanceIndex;u.lodRenderer.instanceData.setLocalTransform(r,s,!0)}))}_preparePatchColor(s,r){if(!r.material||"partial"!==r.material.type)return;const a=r.material.diff;if(!a.color||"complete"!==a.color.type||null==a.color.newValue||null==a.color.oldValue)return;const o=a.color.newValue,n=t(o)?e.toUnitRGBA(o):L;delete a.color;const c=this._resources;i(c)||s.graphics3DGraphicPatches.push((e=>{let t;this._hasPerInstanceColor()?(c.lodRenderer.instanceData.setColor(e.instanceIndex,n),t=this._setMaterialTransparencyParams({},o)):t=this._setMaterialTransparencyParams({externalColor:n},o);for(const s of c.stageResources.materials)s.setParameters(t)}))}_requiresTerrainElevation(e){return"absolute-height"!==e.mode}_applyObjectRotation(e,t,s){if(!(this._fastUpdates.enabled&&this._fastUpdates.requiresShaderTransformation&&t))return q(e.heading,e.tilt,e.roll,s)}_computeAnchor(e,s,r){const i=x();switch(r.anchor){case"center":y(i,T(e)),u(i,i);break;case"top":{const t=T(e);b(i,-t[0],-t[1],-e[5]);break}case"bottom":{const t=T(e);b(i,-t[0],-t[1],-e[2]);break}case"relative":{const t=T(e),s=U(e),a=r.anchorPosition,o=a?v(a.x,a.y,a.z):R;f(i,s,o),_(i,i,t),u(i,i);break}default:t(s)?u(i,s):y(i,R)}return i}_applyAnchor(e,t,s){if(this._fastUpdates.enabled&&this._fastUpdates.requiresShaderTransformation)return;const r=this._computeAnchor(e.resourceBoundingBox,e.pivotOffset,t);r&&d(s,s,r)}_hasPerInstanceColor(){return this._drivenProperties.color||this._drivenProperties.opacity}_fastVisualVariableConvertOptions(e,s,r,i){const a=t(e)?g(U(e)):P,o=t(e)?this._computeAnchor(e,i,this.symbolLayer):R,n=this._context.renderCoordsHelper.unitInMeters,c=W(t(s)?s:void 0,s,r,n),l=v(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return{modelSize:a,symbolSize:t(s)?s:P,unitInMeters:n,transformation:{anchor:o,scale:c,rotation:l}}}}const fe=x(),_e=p(),be=p(),ge=S(),Pe=new M;export{ye as Graphics3DObjectSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import has from"../../../../core/has.js";import{isSome as t,get as s,none as r,isNone as i,unwrapOr as a}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{pt2px as n}from"../../../../core/screenUtils.js";import{c,i as l,k as h,v as d}from"../../../../chunks/mat4.js";import{c as p}from"../../../../chunks/mat4f64.js";import{l as m,o as u,c as y,B as f,a as _,s as b}from"../../../../chunks/vec3.js";import{d as g,O as P,Z as R,f as v,c as x}from"../../../../chunks/vec3f64.js";import{O as L,c as S}from"../../../../chunks/vec4f64.js";import{projectPointToVector as C,computeTranslationToOriginAndRotation as j}from"../../../../geometry/projection.js";import{create as w,size as U,containsPoint as E,center as T}from"../../../../geometry/support/aaBoundingBox.js";import{defaultPrimitive as A}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as B,objectSymbolLayerSizeWithResourceSize as I}from"../../../../symbols/support/symbolLayerUtils3D.js";import{perLodInstanceElevationAligner as O}from"./ElevationAligners.js";import{needsElevationUpdates3D as G,evaluateElevationInfoAtPoint as D,SampleElevationInfo as M}from"./elevationAlignmentUtils.js";import{ElevationContext as z}from"./ElevationContext.js";import F from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as V}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as k,mixinColorAndOpacity as H,computeObjectScale as W,computeObjectRotation as q}from"./graphicUtils.js";import{ApplyRendererDiffResult as N}from"./interfaces.js";import{LoadStatus as $}from"./Loadable.js";import{makeLodResources as Z,fillEstimatedMinScreenSpaceRadius as J}from"./lodResourceUtils.js";import{fetch as K}from"./objectResourceUtils.js";import{placePointOnGeometry as Q,extendPointGraphicElevationContext as X}from"./pointUtils.js";import{isValidPrimitive as Y,primitiveLodResources as ee}from"./primitiveObjectSymbolUtils.js";import{defaultSymbolLayerMemoryComplexity as te}from"./symbolComplexity.js";import{initFastSymbolUpdatesState as se,updateFastSymbolUpdatesState as re,evaluateModelTransform as ie,evaluateModelTransformScale as ae}from"../support/FastSymbolUpdates.js";import{CullFaceOptions as oe}from"../../webgl-engine/lib/basicInterfaces.js";import{VertexAttribute as ne}from"../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as ce}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{materialsFromLodResources as le,texturesFromLodResources as he,geometriesFromLodResources as de,geometriesFromLodLevelResources as pe}from"../../webgl-engine/lib/lodRendering/LodResources.js";import{DefaultMaterial as me}from"../../webgl-engine/materials/DefaultMaterial.js";class ue{constructor(e,t,s,r,i,a,o,n,c,l,h,d){this.lodResources=e,this.lodRenderer=t,this.stageResources=s,this.originalMaterialParameters=r,this.resourceSize=i,this.isEsriSymbolResource=a,this.isWosr=o,this.resourceBoundingBox=n,this.symbolSize=c,this.extentPadding=l,this.physicalBasedRenderingEnabled=h,this.pivotOffset=d}}class ye extends V{getCachedSize(){const[e,s,r]=t(this._resources)?this._resources.symbolSize:[1,1,1];return{width:e,depth:s,height:r}}constructor(e,t,s,r){super(e,t,s,r),this._resources=null,this._optionalFields=new Array,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=new Array,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){if(k(this.symbolLayer))throw new Error}const t=this.symbolLayer;if(this._isPrimitive){const s=t.resource?t.resource.primitive:A;this._resources=await this._createResourcesForPrimitive(s,e)}else this._resources=await this._createResourcesForUrl(t.resource.href,e);this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.complexity=this.computeComplexity()}get extentPadding(){return t(this._resources)?this._resources.extentPadding:0}get _isPrimitive(){return!(this.symbolLayer.resource&&this.symbolLayer.resource.href)}get lodRenderer(){return t(this._resources)?this._resources.lodRenderer:null}_setMaterialTransparencyParams(e,t=s(this.symbolLayer,"material","color")){const r=this._getCombinedOpacity(t),i=r<1||this.needsDrivenTransparentPass;return e.transparent=i,e.opacity=r,e.cullFace=i?oe.None:oe.Back,e}async _createResourcesForPrimitive(s,i){if(!Y(s))throw new Error(`Unknown object symbol primitive: ${s}`);const a=this.symbolLayer,o=w(B(s)),c=g(U(o)),l=g(I(c,a)),h=m(l),d=!1,p=!1,u={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,ambient:P,diffuse:P,hasSlicePlane:this._context.slicePlaneEnabled,hasSliceHighlight:!1,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!this.symbolLayer.isPrimitive},y=!!u.usePBR;this._setMaterialTransparencyParams(u);const f=this.symbol;if("point-3d"===f.type&&f.verticalOffset){const{screenLength:e,minWorldLength:s,maxWorldLength:r}=f.verticalOffset;u.verticalOffset={screenLength:n(e),minWorldLength:s||0,maxWorldLength:t(r)?r:1/0},u.castShadows=!1}if(this._context.screenSizePerspectiveEnabled&&(u.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),this._drivenProperties.color)u.externalColor=L;else{const s=t(a.material)?a.material.color:null,r=t(s)?e.toUnitRGBA(s):L;u.externalColor=r}this._fastUpdates=se(this._context.renderer,this._fastVisualVariableConvertOptions(o,l,c,r)),u.instanced=["transformation"],this._fastUpdates.enabled?(Object.assign(u,this._fastUpdates.materialParameters),u.instanced.push("featureAttribute"),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(u.instanced.push("color"),this._optionalFields.push("color")),has("enable-feature:objectAndLayerId-rendering")&&(u.instanced.push("objectAndLayerIdColor"),this._optionalFields.push("objectAndLayerIdColor"));const _=new me(u),b=ee(s,_);if(!b)throw new Error(`Unknown object symbol primitive: ${s}`);const R=le(b).map((e=>({opacity:1,transparent:e.parameters.transparent}))),v=await this._createStageResources(b,y,i),x=await this._createLodRenderer(b,i);return new ue(b,x,v,R,c,d,p,o,l,h,y,r)}async _createResourcesForUrl(e,i){const a=["transformation"],o={materialParamsMixin:{instanced:a,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},streamDataRequester:this._context.streamDataRequester,cache:this._context.sharedResources.objectResourceCache};this._fastUpdates=se(this._context.renderer,this._fastVisualVariableConvertOptions(r,r,r,r)),this._fastUpdates.enabled?(Object.assign(o.materialParamsMixin,this._fastUpdates.materialParameters),a.push("featureAttribute"),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(a.push("color"),this._optionalFields.push("color")),has("enable-feature:objectAndLayerId-rendering")&&(a.push("objectAndLayerIdColor"),this._optionalFields.push("objectAndLayerIdColor"));const c=this.symbol;if("point-3d"===c.type&&c.verticalOffset){const{screenLength:e,minWorldLength:s,maxWorldLength:r}=c.verticalOffset;o.materialParamsMixin.verticalOffset={screenLength:n(e),minWorldLength:s||0,maxWorldLength:t(r)?r:1/0},o.materialParamsMixin.castShadows=!1}o.signal=i,o.usePBR=this._context.physicalBasedRenderingEnabled,o.skipHighLods=this._context.skipHighSymbolLods;const l=o.usePBR,h=await K(e,o),d=h.isEsriSymbolResource,p=h.isWosr,u=Z(h.lods);J(u),u.levels.sort(((e,t)=>e.minScreenSpaceRadius-t.minScreenSpaceRadius)),u.levels[0].minScreenSpaceRadius=Math.min(2,u.levels[0].minScreenSpaceRadius);const y=this._context,f=this.symbolLayer.material,_=this._getExternalColorParameters(f),b=s(this.symbolLayer,"material","color"),P=this._getCombinedOpacity(b,{hasIntrinsicColor:!0}),R=this.needsDrivenTransparentPass,v=le(u),x=le(u).map((e=>({opacity:e.parameters.opacity||1,transparent:e.parameters.transparent})));v.forEach((e=>{const t=e.parameters;e.setParameters(_);const s=t.opacity*P,r=s<1||R||t.transparent;e.setParameters({opacity:s,transparent:r}),y.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:y.sharedResources.screenSizePerspectiveSettings})}));const L=h.referenceBoundingBox,S=g(U(L)),C=g(u.levels[0].pivotOffset),j=g(I(S,this.symbolLayer)),w=m(j);re(this._fastUpdates,this._context.renderer,this._fastVisualVariableConvertOptions(L,j,S,C))&&v.forEach((e=>e.setParameters(this._fastUpdates.materialParameters)));const E=await this._createStageResources(u,l,i),T=await this._createLodRenderer(u,i);return new ue(u,T,E,x,S,d,p,L,j,w,l,C)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,t,s){const r=this._context.stage,i=le(e);t!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged(),r.addMany(i),this._addDisposeResource((()=>r.removeMany(i)));const a=he(e);r.addMany(a),this._addDisposeResource((()=>r.removeMany(a))),await r.load(a,s),o(s);const n=de(e);return r.addMany(n),this._addDisposeResource((()=>r.removeMany(n))),{materials:i,textures:a,geometries:n}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerUid:this._context.layer.uid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates.enabled?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,ge),c(s,ie(this._fastUpdates.materialParameters,ge,s))},scaleFactor:(e,t,s)=>(t.getFeatureAttribute(s,ge),ae(e,this._fastUpdates.materialParameters,ge))}:null,a=new ce({symbol:e,optionalFields:this._optionalFields,metadata:r,shaderTransformation:i},this._context.scheduler);return a.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource((()=>{s.removeRenderPlugin(a),a.destroy()})),await s.addRenderPlugin(a.slots,a,t),a}_getExternalColorParameters(s){const r={};return this._drivenProperties.color?r.externalColor=L:t(s)&&t(s.color)?r.externalColor=e.toUnitRGBA(s.color):(r.externalColor=L,r.colorMixMode="ignore"),r}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach((e=>e())),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=Q(t.geometry);if(i(s))return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const r=this.setGraphicElevationContext(t,new z),a=e.renderingInfo;return this._createAs3DShape(t,s,a,r,t.uid,e.layer.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(i(this._resources))return;const e=this._drivenProperties.opacity,t=!this._isPrimitive,r=this._resources.stageResources.materials,a=this._resources.originalMaterialParameters;for(let i=0;i<r.length;i++){const o=r[i],n=s(this.symbolLayer,"material","color"),c=a[i],l=this._getCombinedOpacity(n,{hasIntrinsicColor:t})*c.opacity,h=l<1||e||c.transparent;o.setParameters({opacity:l,transparent:h}),this._isPrimitive&&o.setParameters({cullFace:h?oe.None:oe.Back})}}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,G)}slicePlaneEnabledChanged(){if(i(this._resources))return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(i(this._resources))return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this._isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this._hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this._hasLoadedPBRTextures=!0,!1)}pixelRatioChanged(){return!0}applyRendererDiff(e,t){if(i(this._resources))return N.Recreate_Symbol;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:a,symbolSize:o,resourceSize:n,pivotOffset:c}=this._resources;for(const i in e.diff){if("visualVariables"!==i)return N.Recreate_Symbol;if(!re(this._fastUpdates,t,this._fastVisualVariableConvertOptions(a,o,n,c)))return N.Recreate_Symbol;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return N.Fast_Update}computeComplexity(){if(i(this._resources))return super.computeComplexity();const e=this._resources.lodResources,t=pe(e.levels[0]).reduce(((e,t)=>e+t.indices.get(ne.POSITION).length),0)/3,s=e=>Array.from(e.vertexAttributes.values()).reduce(((e,t)=>e+(t.data.buffer?.byteLength??0)),0)+Array.from(e.indices.values()).reduce(((e,t)=>e+(Array.isArray(t)?12*t.length:t.buffer.byteLength)),0),r=he(e).reduce(((e,t)=>e+t.estimatedTexMemRequired),0)/4+de(e).reduce(((e,t)=>e+s(t)),0);return{primitivesPerFeature:t,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1,memory:{...te(this.symbol,this.symbolLayer),resourceBytes:r}}}_hasLodRenderer(){return t(this._resources)}_createAs3DShape(e,s,r,a,o,n){if(!this._hasLodRenderer()||i(this._resources))return null;const c=this.getFastUpdateAttrValues(e),l=!this._fastUpdates.enabled&&this._hasPerInstanceColor()?H(r.color,r.opacity):null,h=this._context.clippingExtent;if(C(s,fe,this._context.elevationProvider.spatialReference),t(h)&&!E(h,fe))return null;const d=this._requiresTerrainElevation(a),p=this._computeGlobalTransform(s,a,be,Pe),m=this._computeLocalTransform(this._resources,this.symbolLayer,r,_e),u=this._resources.lodRenderer.instanceData,y=u.addInstance();this._instanceIndexToGraphicUid.set(y,o),u.setLocalTransform(y,m,!1),u.setGlobalTransform(y,p),c&&u.setFeatureAttribute(y,c),l&&u.setColor(y,l),t(this._context.stage.renderView.objectAndLayerIdRenderHelper)&&u.setObjectAndLayerIdColor(y,this._context.stage.renderView.objectAndLayerIdRenderHelper.getObjectAndLayerIdColor({graphicUid:o,layerUid:n}));const f=new F(this,y,O,a);return d&&(f.alignedSampledElevation=Pe.sampledElevation),f.needsElevationUpdates=G(a.mode),X(f,s,this._context.elevationProvider),f}_computeGlobalTransform(e,t,s,r){return D(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),fe[0]=e.x,fe[1]=e.y,fe[2]=r.z,j(e.spatialReference,fe,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,s,r){return l(r),this._applyObjectRotation(s,!1,r),this._applyObjectRotation(t,!0,r),this._applyObjectScale(e,s,r),this._applyAnchor(e,t,r),r}_applyObjectScale(e,t,s){if(this._fastUpdates.enabled&&this._fastUpdates.requiresShaderTransformation)return;const r=this._drivenProperties.size&&t.size?t.size:e.symbolSize,i=W(r,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||h(s,s,i)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(i(this._resources))return!0;const s=t&&Q(t);if(i(s))return!1;const r=this.getGeometryElevationMode(t);return e.elevationContext.mode===r&&(this._computeGlobalTransform(s,e.elevationContext,be,Pe),this._requiresTerrainElevation(e.elevationContext)&&(e.alignedSampledElevation=Pe.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(e.instanceIndex,be,!0),X(e,s,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(i(this._resources))return;const s=(e,t,s)=>a(null!=e&&"complete"===e.type?e.newValue:t,s),r=s(t.heading,this.symbolLayer.heading,0),o=s(t.tilt,this.symbolLayer.tilt,0),n=s(t.roll,this.symbolLayer.roll,0),c=s(t.width,this.symbolLayer.width,void 0),l=s(t.height,this.symbolLayer.height,void 0),h=s(t.depth,this.symbolLayer.depth,void 0),d=s(t.anchor,this.symbolLayer.anchor,void 0),p=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const m={heading:r,tilt:o,roll:n,anchor:d,anchorPosition:p},u=this._resources;this.loadStatus===$.LOADED&&e.symbolLayerStatePatches.push((()=>{u.symbolSize=g(I(u.resourceSize,{width:c,height:l,depth:h,isPrimitive:this.symbolLayer.isPrimitive}))})),e.graphics3DGraphicPatches.push(((e,t)=>{const s=this._computeLocalTransform(u,m,t,_e),r=e.instanceIndex;u.lodRenderer.instanceData.setLocalTransform(r,s,!0)}))}_preparePatchColor(s,r){if(!r.material||"partial"!==r.material.type)return;const a=r.material.diff;if(!a.color||"complete"!==a.color.type||null==a.color.newValue||null==a.color.oldValue)return;const o=a.color.newValue,n=t(o)?e.toUnitRGBA(o):L;delete a.color;const c=this._resources;i(c)||s.graphics3DGraphicPatches.push((e=>{let t;this._hasPerInstanceColor()?(c.lodRenderer.instanceData.setColor(e.instanceIndex,n),t=this._setMaterialTransparencyParams({},o)):t=this._setMaterialTransparencyParams({externalColor:n},o);for(const s of c.stageResources.materials)s.setParameters(t)}))}_requiresTerrainElevation(e){return"absolute-height"!==e.mode}_applyObjectRotation(e,t,s){if(!(this._fastUpdates.enabled&&this._fastUpdates.requiresShaderTransformation&&t))return q(e.heading,e.tilt,e.roll,s)}_computeAnchor(e,s,r){const i=x();switch(r.anchor){case"center":y(i,T(e)),u(i,i);break;case"top":{const t=T(e);b(i,-t[0],-t[1],-e[5]);break}case"bottom":{const t=T(e);b(i,-t[0],-t[1],-e[2]);break}case"relative":{const t=T(e),s=U(e),a=r.anchorPosition,o=a?v(a.x,a.y,a.z):R;f(i,s,o),_(i,i,t),u(i,i);break}default:t(s)?u(i,s):y(i,R)}return i}_applyAnchor(e,t,s){if(this._fastUpdates.enabled&&this._fastUpdates.requiresShaderTransformation)return;const r=this._computeAnchor(e.resourceBoundingBox,e.pivotOffset,t);r&&d(s,s,r)}_hasPerInstanceColor(){return this._drivenProperties.color||this._drivenProperties.opacity}_fastVisualVariableConvertOptions(e,s,r,i){const a=t(e)?g(U(e)):P,o=t(e)?this._computeAnchor(e,i,this.symbolLayer):R,n=this._context.renderCoordsHelper.unitInMeters,c=W(t(s)?s:void 0,s,r,n),l=v(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return{modelSize:a,symbolSize:t(s)?s:P,unitInMeters:n,transformation:{anchor:o,scale:c,rotation:l}}}}const fe=x(),_e=p(),be=p(),ge=S(),Pe=new M;export{ye as Graphics3DObjectSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import t from"../../../../core/Error.js";import{acosClamped as e,reciprocalClamped as i}from"../../../../core/mathUtils.js";import{isSome as r,get as s}from"../../../../core/maybe.js";import{s as a}from"../../../../chunks/mat2.js";import{s as o,b as n}from"../../../../chunks/vec2.js";import{f as l,b as h}from"../../../../chunks/vec2f64.js";import{s as c,c as p,a as m,e as f,f as d,g as u,n as g,o as y,b as _}from"../../../../chunks/vec3.js";import{d as b,c as v}from"../../../../chunks/vec3f64.js";import{projectBuffer as x}from"../../../../geometry/projection.js";import{create as w,empty as S,expandWithBuffer as P,intersectsClippingArea as R}from"../../../../geometry/support/aaBoundingBox.js";import{makeDehydratedPoint as j}from"../../../../layers/graphics/dehydratedFeatures.js";import{needsElevationUpdates3D as C,evaluateElevationAlignmentAtPoint as U,SampleElevationInfo as D}from"./elevationAlignmentUtils.js";import{ElevationContext as L}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as A}from"./Graphics3DObject3DGraphicLayer.js";import{PATH_NUM_CIRCLE_PROFILE_SUBDIVISIONS as z,PATH_NUM_ROUND_JOIN_SUBDIVISIONS as V,PATH_NUM_ROUND_CAP_EXTRUSION_SUBDIVISIONS as E}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as M,getAttributeValue as k}from"./Graphics3DSymbolLayer.js";import{isValidSize as I}from"./graphicUtils.js";import{ApplyRendererDiffResult as F}from"./interfaces.js";import{initFastSymbolUpdatesState as G,updateFastSymbolUpdatesState as B}from"../support/FastSymbolUpdates.js";import{CullFaceOptions as O}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as q}from"../../webgl-engine/lib/Object3D.js";import{UpVectorAlignment as H,PathGeometry as W,isPathGeometry as T}from"../../webgl-engine/lib/PathGeometry.js";import{creatQuadProfile as N,createCircleProfile as Z,SimpleExtruder as J,MiterExtruder as K,RoundCapBuilder as Q,TriangulationCapBuilder as X,NoCapBuilder as Y,PathVertex as $,Path as tt,Builder as et,FastUpdatePathGeometry as it,StaticPathGeometry as rt,computeMinimumRotationTangentFrame as st,vertexSpaceToProfileSpace as at}from"../../webgl-engine/lib/pathGeometryUtils.js";import{DefaultMaterial as ot}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as nt}from"../../webgl-engine/materials/PathMaterial.js";const lt=["polyline"];class ht extends M{constructor(t,e,i,r){super(t,e,i,r),this._intrinsicSize=l(1,1),this._upVectorAlignment=H.Path,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const e=r(this.symbolLayer.width)?this.symbolLayer.width:this.symbolLayer.height,i=r(this.symbolLayer.height)?this.symbolLayer.height:e;this._vvConvertOptions={modelSize:[1,1,1],symbolSize:[e,1,i],unitInMeters:this._context.renderCoordsHelper.unitInMeters,transformation:{anchor:[0,0,0],scale:[1,1,1],rotation:[0,0,0]},supportedTypes:{size:!0,color:!0,opacity:!0,rotation:!1}},this._context.renderer&&this._context.renderer.visualVariables&&this._context.renderer.visualVariables.length>0?this._fastUpdates=G(this._context.renderer,this._vvConvertOptions):this._fastUpdates={enabled:!1};const a=this.symbolLayer.anchor||"center";this._upVectorAlignment="heading"===this.symbolLayer.profileRotation?H.World:H.Path;const l=this.symbolLayer.profile||"circle";switch(l){default:case"circle":this._profile=Z(z);break;case"quad":this._profile=N()}let c=[0,0];"center"!==a&&(c={left:[.5,0],right:[-.5,0],top:[0,-.5],bottom:[0,.5]}[a],this._profile.translate(c[0],c[1]));switch(this.symbolLayer.join||"simple"){case"round":this._extruder=new K(0,V);break;case"bevel":this._extruder=new K(0,1);break;case"miter":this._extruder=new K(.8*Math.PI,1);break;default:this._extruder=new J}const p=this.symbolLayer.cap||"butt";switch(p){case"none":this._startCap=new Y,this._endCap=new Y;break;case"butt":default:this._startCap=new X(this._profile,0),this._endCap=new X(this._profile,0,!0);break;case"square":this._startCap=new X(this._profile,-.5),this._endCap=new X(this._profile,.5,!0);break;case"round":{const t="quad"===l;this._startCap=new Q({profile:this._profile,flip:!1,breakNormals:t,subdivisions:E}),this._endCap=new Q({profile:this._profile,flip:!0,breakNormals:t,subdivisions:E});break}}const m=s(this.symbolLayer,"material","color"),f=this._getCombinedOpacityAndColor(m),d=b(f),u=f[3],g=u<1||this.needsDrivenTransparentPass,y={diffuse:d,ambient:d,opacity:u,transparent:g,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,cullFace:g||"none"===p?O.None:O.Back,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(o(this._intrinsicSize,e,i),!I(this._intrinsicSize[0])||!I(this._intrinsicSize[1])))throw new t("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");if(this._fastUpdates.enabled&&this._fastUpdates.visualVariables.size||n(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates.enabled){const t={...y,...this._fastUpdates.materialParameters,size:h(this._intrinsicSize)};this._material=new nt(t)}else y.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,this._material=new ot(y);this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._context.stage.add(this._material)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null}createGraphics3DGraphic(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,lt,this.symbolLayer.type))return null;const i=this.setGraphicElevationContext(e,new L),r=t.renderingInfo;return this._createAs3DShape(e,r,i,e.uid)}layerOpacityChanged(){const t=s(this.symbolLayer,"material","color"),e=this._getCombinedOpacity(t),i=e<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:e,transparent:i})}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,C)}slicePlaneEnabledChanged(){return this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}pixelRatioChanged(){return!0}applyRendererDiff(t,e){for(const i in t.diff){if("visualVariables"!==i)return F.Recreate_Symbol;if(!B(this._fastUpdates,e,this._vvConvertOptions))return F.Recreate_Symbol;this._material.setParameters(this._fastUpdates.materialParameters)}return F.Fast_Update}getVertexData(t){let e=0;const i=t.paths,s=[],a=t.spatialReference,o=this._context.elevationProvider.spatialReference,n=this._context.renderCoordsHelper.spatialReference;for(const r of i)e+=r.length;const l=new Float64Array(3*e),h=new Float64Array(3*e);let c=0;for(const r of i){s.push({index:c,numVertices:r.length});for(const e of r)l[c++]=e[0],l[c++]=e[1],l[c++]=t.hasZ?e[2]:0}let p=!0;return r(o)&&!a.equals(o)&&(p=x(l,a,0,l,o,0,e)),r(o)&&!o.equals(n)?x(l,o,0,h,n,0,e):this._copyVertices(l,0,h,0,e),{pathVertexDataInfos:s,vertexDataES:l,vertexDataRS:h,projectionSuccess:p,terrainElevation:0}}_copyVertices(t,e,i,r,s){e*=3,r*=3;for(let a=0;a<s;++a)i[r++]=t[e++],i[r++]=t[e++],i[r++]=t[e++]}_createAs3DShape(t,e,i,s){const a=t.geometry,o=new Array,n=a.spatialReference,l=w(),h=this._context.renderCoordsHelper;ut.spatialReference=n;const m=this.getVertexData(a);if(!m.projectionSuccess)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===m.pathVertexDataInfos.length)return 0!==a.paths.length&&a.paths.some((t=>t.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;for(const g of m.pathVertexDataInfos){const a=g.index,f=g.numVertices;if(f<2)continue;if(r(this._context.clippingExtent)&&(S(l),P(l,m.vertexDataES,3*a,f),!R(l,this._context.clippingExtent)))continue;const d=[];for(let t=a;t<a+3*f;){const e=t++,r=t++,s=t++,a=new $;c(a.posES,m.vertexDataES[e],m.vertexDataES[r],m.vertexDataES[s]);const o=U(a.posES,this._context.elevationProvider,i,h);c(gt,m.vertexDataRS[e],m.vertexDataRS[r],m.vertexDataRS[s]),h.setAltitude(gt,o),p(a.pos,gt),d.push(a)}const u=new tt(d);ct(u,this._upVectorAlignment,this._context.renderCoordsHelper);const y=new et(u,this._profile,this._extruder,this._startCap,this._endCap);let _=null;if(this._fastUpdates.enabled){const e=this._fastUpdates.visualVariables,i=e.size?k(e.size.field,t):0,r=e.color?k(e.color.field,t):0,s=e.opacity?k(e.opacity.field,t):0;_=new it(y,i,r,s)}else{const t=[this._intrinsicSize[0],this._intrinsicSize[1]];this._drivenProperties.size&&(t[0]*=pt(e.size[0],"symbol-value"===e.size[2]?this.symbolLayer.height||0:e.size[2],this.symbolLayer.width||0),t[1]*=pt(e.size[2],"symbol-value"===e.size[0]?this.symbolLayer.width||0:e.size[0],this.symbolLayer.height||0));let i=null;this._drivenProperties.color&&(i=e.color),this._drivenProperties.opacity&&null!=e.opacity&&(i=i?[i[0],i[1],i[2],e.opacity]:[1,1,1,e.opacity]);const r=new rt(y);r.bake(t),i&&r.bakeVertexColors(i),_=r}const{vertexAttributes:b,indices:v}=_.createGeometryData(),x=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:s,layerUid:this._context.layer.uid}),w=new W(this._material,b,v,_,n,this._upVectorAlignment,this._stencilWidth,x);w.transformation=_.xform,o.push(w)}if(0===o.length)return null;const f={layerUid:this._context.layer.uid,graphicUid:s},d=new q({geometries:o,metadata:f}),u=new A(this,d,o,null,null,ft,i);return u.alignedSampledElevation=m.terrainElevation,u.needsElevationUpdates=C(i.mode),u}}function ct(t,r,s){switch(r){default:case H.World:for(const r of t.vertices){m(gt,r.pos,t.offset),s.worldUpAtPosition(gt,gt),r.setFrameFromUpVector(gt),r.rotationFrameUp=r.frame.up,o(r.rotationRight,1,0),u(gt,r.frame.up,f(r.frame.up,r.vLeft)),_(gt,r.vLeft,gt),y(gt,gt),g(gt,gt),u(yt,r.frame.up,f(r.frame.up,r.vRight)),_(yt,r.vRight,yt),g(yt,yt),d(_t,r.rotationFrameUp,r.vLeft);const n=Math.sign(f(_t,r.vRight));if(r.rotationAngle=n*(Math.PI-e(f(gt,yt))),Math.abs(r.rotationAngle)>0){const t=i(Math.cos(.5*r.rotationAngle));a(r.miterStretch,t-1+1,0,0,1)}const l=Math.PI-r.rotationAngle;r.maxStretchDistance=Math.abs(r.vMinSiblingLength/Math.cos(.5*l))}break;case H.Path:m(gt,t.vertices[0].pos,t.offset),s.worldUpAtPosition(gt,gt),st(t,gt);for(const r of t.vertices){const t=Math.sign(f(r.frame.right,r.vRight));d(r.rotationFrameUp,r.vRight,r.vLeft),u(r.rotationFrameUp,r.rotationFrameUp,t),g(r.rotationFrameUp,r.rotationFrameUp);const s=f(r.rotationFrameUp,r.frame.up),o=f(r.rotationFrameUp,r.frame.right);if(u(gt,r.frame.up,-o),u(yt,r.frame.right,s),m(gt,gt,yt),g(gt,gt),at(r.rotationRight,r.frame,gt),y(gt,r.vLeft),r.rotationAngle=-t*(Math.PI-e(f(gt,r.vRight))),Math.abs(r.rotationAngle)>0){const t=i(Math.cos(.5*r.rotationAngle));a(r.miterStretch,1+(t-1)*r.rotationRight[0]*r.rotationRight[0],(t-1)*r.rotationRight[0]*r.rotationRight[1],(t-1)*r.rotationRight[0]*r.rotationRight[1],1+(t-1)*r.rotationRight[1]*r.rotationRight[1])}const n=Math.PI-r.rotationAngle;r.maxStretchDistance=Math.abs(r.vMinSiblingLength*i(Math.cos(.5*n)))}}}function pt(t,e,i){switch(t){case"symbol-value":return i;case"proportional":return e;default:return t}}function mt(t,e,i,r){let s=0;for(const a of t.vertices)i(a.posES,bt),s+=bt.sampledElevation,m(gt,a.pos,t.offset),r.setAltitude(gt,bt.z),_(a.pos,gt,t.offset);return t.updatePathVertexInformation(),s/t.vertices.length}function ft(t,e,i,r,s){const a=t.stageObject,o=a.geometries;let n=0;dt.spatialReference=s.spatialReference;for(const l of o){if(!T(l))continue;const t=l.path,i=t.builder.path,o=l.geometrySR;ut.spatialReference=o,n+=mt(i,e,r,s),l.upVectorAlignment!==H.World&&ct(i,l.upVectorAlignment,s),t.onPathChanged(),l.invalidateBoundingInfo(),a.geometryVertexAttrsUpdated(l)}return n/o.length}const dt=j(0,0,0,null),ut=j(0,0,0,null),gt=v(),yt=v(),_t=v(),bt=new D;export{ht as Graphics3DPathSymbolLayer};
|
|
5
|
+
import"../../../../core/has.js";import t from"../../../../core/Error.js";import{acosClamped as e,reciprocalClamped as i}from"../../../../core/mathUtils.js";import{isSome as r,get as s}from"../../../../core/maybe.js";import{s as a}from"../../../../chunks/mat2.js";import{s as o,b as n}from"../../../../chunks/vec2.js";import{f as l,b as h}from"../../../../chunks/vec2f64.js";import{s as c,c as p,a as m,e as f,f as d,g as u,n as g,o as y,b as _}from"../../../../chunks/vec3.js";import{d as b,c as v}from"../../../../chunks/vec3f64.js";import{projectBuffer as x}from"../../../../geometry/projection.js";import{create as w,empty as S,expandWithBuffer as P,intersectsClippingArea as R}from"../../../../geometry/support/aaBoundingBox.js";import{makeDehydratedPoint as j}from"../../../../layers/graphics/dehydratedFeatures.js";import{needsElevationUpdates3D as C,evaluateElevationAlignmentAtPoint as U,SampleElevationInfo as D}from"./elevationAlignmentUtils.js";import{ElevationContext as L}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as A}from"./Graphics3DObject3DGraphicLayer.js";import{PATH_NUM_CIRCLE_PROFILE_SUBDIVISIONS as V,PATH_NUM_ROUND_JOIN_SUBDIVISIONS as E,PATH_NUM_ROUND_CAP_EXTRUSION_SUBDIVISIONS as z}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as M,getAttributeValue as k}from"./Graphics3DSymbolLayer.js";import{isValidSize as I}from"./graphicUtils.js";import{ApplyRendererDiffResult as F}from"./interfaces.js";import{initFastSymbolUpdatesState as G,updateFastSymbolUpdatesState as B}from"../support/FastSymbolUpdates.js";import{CullFaceOptions as O}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as q}from"../../webgl-engine/lib/Object3D.js";import{UpVectorAlignment as H,PathGeometry as W,isPathGeometry as T}from"../../webgl-engine/lib/PathGeometry.js";import{creatQuadProfile as N,createCircleProfile as Z,SimpleExtruder as J,MiterExtruder as K,RoundCapBuilder as Q,TriangulationCapBuilder as X,NoCapBuilder as Y,PathVertex as $,Path as tt,Builder as et,FastUpdatePathGeometry as it,StaticPathGeometry as rt,computeMinimumRotationTangentFrame as st,vertexSpaceToProfileSpace as at}from"../../webgl-engine/lib/pathGeometryUtils.js";import{DefaultMaterial as ot}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as nt}from"../../webgl-engine/materials/PathMaterial.js";const lt=["polyline"];class ht extends M{constructor(t,e,i,r){super(t,e,i,r),this._intrinsicSize=l(1,1),this._upVectorAlignment=H.Path,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const e=r(this.symbolLayer.width)?this.symbolLayer.width:this.symbolLayer.height,i=r(this.symbolLayer.height)?this.symbolLayer.height:e;this._vvConvertOptions={modelSize:[1,1,1],symbolSize:[e,1,i],unitInMeters:this._context.renderCoordsHelper.unitInMeters,transformation:{anchor:[0,0,0],scale:[1,1,1],rotation:[0,0,0]},supportedTypes:{size:!0,color:!0,opacity:!0,rotation:!1}},this._context.renderer&&this._context.renderer.visualVariables&&this._context.renderer.visualVariables.length>0?this._fastUpdates=G(this._context.renderer,this._vvConvertOptions):this._fastUpdates={enabled:!1};const a=this.symbolLayer.anchor||"center";this._upVectorAlignment="heading"===this.symbolLayer.profileRotation?H.World:H.Path;const l=this.symbolLayer.profile||"circle";switch(l){default:case"circle":this._profile=Z(V);break;case"quad":this._profile=N()}let c=[0,0];switch("center"!==a&&(c={left:[.5,0],right:[-.5,0],top:[0,-.5],bottom:[0,.5]}[a],this._profile.translate(c[0],c[1])),this.symbolLayer.join??"simple"){case"round":this._extruder=new K(0,E);break;case"bevel":this._extruder=new K(0,1);break;case"miter":this._extruder=new K(.8*Math.PI,1);break;default:this._extruder=new J}const p=this.symbolLayer.cap||"butt";switch(p){case"none":this._startCap=new Y,this._endCap=new Y;break;case"butt":default:this._startCap=new X(this._profile,0),this._endCap=new X(this._profile,0,!0);break;case"square":this._startCap=new X(this._profile,-.5),this._endCap=new X(this._profile,.5,!0);break;case"round":{const t="quad"===l;this._startCap=new Q({profile:this._profile,flip:!1,breakNormals:t,subdivisions:z}),this._endCap=new Q({profile:this._profile,flip:!0,breakNormals:t,subdivisions:z});break}}const m=s(this.symbolLayer,"material","color"),f=this._getCombinedOpacityAndColor(m),d=b(f),u=f[3],g=u<1||this.needsDrivenTransparentPass,y={diffuse:d,ambient:d,opacity:u,transparent:g,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,cullFace:g||"none"===p?O.None:O.Back,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(o(this._intrinsicSize,e,i),!I(this._intrinsicSize[0])||!I(this._intrinsicSize[1])))throw new t("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");if(this._fastUpdates.enabled&&this._fastUpdates.visualVariables.size||n(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates.enabled){const t={...y,...this._fastUpdates.materialParameters,size:h(this._intrinsicSize)};this._material=new nt(t)}else y.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,this._material=new ot(y);this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._context.stage.add(this._material)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null}createGraphics3DGraphic(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,lt,this.symbolLayer.type))return null;const i=this.setGraphicElevationContext(e,new L),r=t.renderingInfo;return this._createAs3DShape(e,r,i,e.uid)}layerOpacityChanged(){const t=s(this.symbolLayer,"material","color"),e=this._getCombinedOpacity(t),i=e<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:e,transparent:i})}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,C)}slicePlaneEnabledChanged(){return this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}pixelRatioChanged(){return!0}applyRendererDiff(t,e){for(const i in t.diff){if("visualVariables"!==i)return F.Recreate_Symbol;if(!B(this._fastUpdates,e,this._vvConvertOptions))return F.Recreate_Symbol;this._material.setParameters(this._fastUpdates.materialParameters)}return F.Fast_Update}getVertexData(t){let e=0;const i=t.paths,s=[],a=t.spatialReference,o=this._context.elevationProvider.spatialReference,n=this._context.renderCoordsHelper.spatialReference;for(const r of i)e+=r.length;const l=new Float64Array(3*e),h=new Float64Array(3*e);let c=0;for(const r of i){s.push({index:c,numVertices:r.length});for(const e of r)l[c++]=e[0],l[c++]=e[1],l[c++]=t.hasZ?e[2]:0}let p=!0;return r(o)&&!a.equals(o)&&(p=x(l,a,0,l,o,0,e)),r(o)&&!o.equals(n)?x(l,o,0,h,n,0,e):this._copyVertices(l,0,h,0,e),{pathVertexDataInfos:s,vertexDataES:l,vertexDataRS:h,projectionSuccess:p,terrainElevation:0}}_copyVertices(t,e,i,r,s){e*=3,r*=3;for(let a=0;a<s;++a)i[r++]=t[e++],i[r++]=t[e++],i[r++]=t[e++]}_createAs3DShape(t,e,i,s){const a=t.geometry,o=new Array,n=a.spatialReference,l=w(),h=this._context.renderCoordsHelper;ut.spatialReference=n;const m=this.getVertexData(a);if(!m.projectionSuccess)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===m.pathVertexDataInfos.length)return 0!==a.paths.length&&a.paths.some((t=>t.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;for(const g of m.pathVertexDataInfos){const a=g.index,f=g.numVertices;if(f<2)continue;if(r(this._context.clippingExtent)&&(S(l),P(l,m.vertexDataES,3*a,f),!R(l,this._context.clippingExtent)))continue;const d=[];for(let t=a;t<a+3*f;){const e=t++,r=t++,s=t++,a=new $;c(a.posES,m.vertexDataES[e],m.vertexDataES[r],m.vertexDataES[s]);const o=U(a.posES,this._context.elevationProvider,i,h);c(gt,m.vertexDataRS[e],m.vertexDataRS[r],m.vertexDataRS[s]),h.setAltitude(gt,o),p(a.pos,gt),d.push(a)}const u=new tt(d);ct(u,this._upVectorAlignment,this._context.renderCoordsHelper);const y=new et(u,this._profile,this._extruder,this._startCap,this._endCap);let _=null;if(this._fastUpdates.enabled){const e=this._fastUpdates.visualVariables,i=e.size?k(e.size.field,t):0,r=e.color?k(e.color.field,t):0,s=e.opacity?k(e.opacity.field,t):0;_=new it(y,i,r,s)}else{const t=[this._intrinsicSize[0],this._intrinsicSize[1]];if(this._drivenProperties.size){const i=e.size;t[0]*=pt(i[0],"symbol-value"===i[2]?this.symbolLayer.height||0:i[2],this.symbolLayer.width||0),t[1]*=pt(i[2],"symbol-value"===i[0]?this.symbolLayer.width||0:i[0],this.symbolLayer.height||0)}let i;this._drivenProperties.color&&(i=e.color),this._drivenProperties.opacity&&null!=e.opacity&&(i=i?[i[0],i[1],i[2],e.opacity]:[1,1,1,e.opacity]);const r=new rt(y);r.bake(t),i&&r.bakeVertexColors(i),_=r}const{vertexAttributes:b,indices:v}=_.createGeometryData(),x=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:s,layerUid:this._context.layer.uid}),w=new W(this._material,b,v,_,n,this._upVectorAlignment,this._stencilWidth,x);w.transformation=_.xform,o.push(w)}if(0===o.length)return null;const f={layerUid:this._context.layer.uid,graphicUid:s},d=new q({geometries:o,metadata:f}),u=new A(this,d,o,null,null,ft,i);return u.alignedSampledElevation=m.terrainElevation,u.needsElevationUpdates=C(i.mode),u}}function ct(t,r,s){switch(r){default:case H.World:for(const r of t.vertices){m(gt,r.pos,t.offset),s.worldUpAtPosition(gt,gt),r.setFrameFromUpVector(gt),r.rotationFrameUp=r.frame.up,o(r.rotationRight,1,0),u(gt,r.frame.up,f(r.frame.up,r.vLeft)),_(gt,r.vLeft,gt),y(gt,gt),g(gt,gt),u(yt,r.frame.up,f(r.frame.up,r.vRight)),_(yt,r.vRight,yt),g(yt,yt),d(_t,r.rotationFrameUp,r.vLeft);const n=Math.sign(f(_t,r.vRight));if(r.rotationAngle=n*(Math.PI-e(f(gt,yt))),Math.abs(r.rotationAngle)>0){const t=i(Math.cos(.5*r.rotationAngle));a(r.miterStretch,t-1+1,0,0,1)}const l=Math.PI-r.rotationAngle;r.maxStretchDistance=Math.abs(r.vMinSiblingLength/Math.cos(.5*l))}break;case H.Path:m(gt,t.vertices[0].pos,t.offset),s.worldUpAtPosition(gt,gt),st(t,gt);for(const r of t.vertices){const t=Math.sign(f(r.frame.right,r.vRight));d(r.rotationFrameUp,r.vRight,r.vLeft),u(r.rotationFrameUp,r.rotationFrameUp,t),g(r.rotationFrameUp,r.rotationFrameUp);const s=f(r.rotationFrameUp,r.frame.up),o=f(r.rotationFrameUp,r.frame.right);if(u(gt,r.frame.up,-o),u(yt,r.frame.right,s),m(gt,gt,yt),g(gt,gt),at(r.rotationRight,r.frame,gt),y(gt,r.vLeft),r.rotationAngle=-t*(Math.PI-e(f(gt,r.vRight))),Math.abs(r.rotationAngle)>0){const t=i(Math.cos(.5*r.rotationAngle));a(r.miterStretch,1+(t-1)*r.rotationRight[0]*r.rotationRight[0],(t-1)*r.rotationRight[0]*r.rotationRight[1],(t-1)*r.rotationRight[0]*r.rotationRight[1],1+(t-1)*r.rotationRight[1]*r.rotationRight[1])}const n=Math.PI-r.rotationAngle;r.maxStretchDistance=Math.abs(r.vMinSiblingLength*i(Math.cos(.5*n)))}}}function pt(t,e,i){switch(t){case"symbol-value":return i;case"proportional":return e;default:return t}}function mt(t,e,i,r){let s=0;for(const a of t.vertices)i(a.posES,bt),s+=bt.sampledElevation,m(gt,a.pos,t.offset),r.setAltitude(gt,bt.z),_(a.pos,gt,t.offset);return t.updatePathVertexInformation(),s/t.vertices.length}function ft(t,e,i,r,s){const a=t.stageObject,o=a.geometries;let n=0;dt.spatialReference=s.spatialReference;for(const l of o){if(!T(l))continue;const t=l.path,i=t.builder.path,o=l.geometrySR;ut.spatialReference=o,n+=mt(i,e,r,s),l.upVectorAlignment!==H.World&&ct(i,l.upVectorAlignment,s),t.onPathChanged(),l.invalidateBoundingInfo(),a.geometryVertexAttrsUpdated(l)}return n/o.length}const dt=j(0,0,0,null),ut=j(0,0,0,null),gt=v(),yt=v(),_t=v(),bt=new D;export{ht as Graphics3DPathSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import{isSome as t,get as i,isNone as r,unwrap as n}from"../../../../core/maybe.js";import{pt2px as o}from"../../../../core/screenUtils.js";import{e as s}from"../../../../chunks/earcut.js";import{s as a}from"../../../../chunks/vec4.js";import{create as l,empty as c,expandWithBuffer as h,intersectsClippingArea as p,expandWithAABB as u}from"../../../../geometry/support/aaBoundingBox.js";import{SymbolUpdateType as d,elevationModeChangeUpdateType as m,needsElevationUpdates2D as _}from"./elevationAlignmentUtils.js";import{ElevationContext as g}from"./ElevationContext.js";import y from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as f}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as b}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as x}from"./graphicUtils.js";import{parseCapType as v}from"./lineUtils.js";import{geometryAsPolygon as O,createColorGeometry as C,PolygonCreationDataBase as D}from"./polygonUtils.js";import{createMaterial as j,uvElevationAligner as S}from"../support/patternUtils.js";import{createMapSpaceUVCoords as A,createMapSpaceUVCoordsDraped as M}from"../support/uvUtils.js";import{createGeometry as P}from"../../support/engineContent/line.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as L}from"../../support/renderInfoUtils/polygon.js";import{newDoubleArray as w,doubleSubArray as G}from"../../webgl-engine/lib/DoubleArray.js";import{newFloatArray as U,floatSubArray as I}from"../../webgl-engine/lib/FloatArray.js";import{Object3D as R}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as V}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as B}from"../../webgl-engine/lib/VertexAttribute.js";import{getStipplePatternForLinePattern as F}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as T}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as H}from"../../webgl-engine/materials/RibbonLineMaterial.js";const W=["polyline","polygon","extent"];class z extends b{constructor(e,t,i,r){super(e,t,i,r),this._needsUV=!1,this._hasOutline=!1}async doLoad(){}_ensureMaterials(){this._ensureFillMaterial(),this._ensureOutlineMaterial()}_ensureFillMaterial(){if(t(this._material))return;const e=i(this.symbolLayer,"material","color"),r=this._getCombinedOpacityAndColor(e);this._material=j(this.symbolLayer,{color:r,transparent:r[3]<1||this.needsDrivenTransparentPass,polygonOffset:!1,hasVertexColors:!0,writeLinearDepth:!0,hasSlicePlane:this._context.slicePlaneEnabled},{isDraped:this.draped}),this._needsUV=this._material instanceof T,this._context.stage.add(this._material)}_ensureOutlineMaterial(){const e=this.symbolLayer.outline;if(t(this._outlineMaterial)||!this._isValidOutline(e))return;this._hasOutline=!0;const i=t=>{const i=F(e.pattern);return new H({width:t,color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:i,stippleScaleWithLineWidth:!0,cap:v(e.patternCap||"butt")})};this._outlineMaterial=i(o(e.size)),this._context.stage.add(this._outlineMaterial)}_isValidOutline(e){return t(e)&&e.size&&e.size>0&&t(e.color)&&(r(e.pattern)||"style"!==e.pattern.type||"none"!==e.pattern.style)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null,this._context.stage.remove(this._outlineMaterial),this._outlineMaterial=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,W,this.symbolLayer.type))return null;const i=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t,new g);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._ensureMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}layerOpacityChanged(){if(t(this._material)){const e=this._material.parameters.color,t=i(this.symbolLayer,"material","color"),r=this._getCombinedOpacity(t);this._material.setParameters({color:[e[0],e[1],e[2],r],transparent:r<1||this.needsDrivenTransparentPass})}if(t(this._outlineMaterial)){const e=this._outlineMaterial.parameters.color;this._outlineMaterial.setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,n=m(z.elevationModeChangeTypes,i,r);if(n!==d.UPDATE)return n;const o=_(r);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>o))}slicePlaneEnabledChanged(){if(t(this._material)&&this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t(this._outlineMaterial)){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._outlineMaterial.setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!0}_createAs3DShape(e,t,i){const n=O(e.geometry);if(r(n))return null;const o=E(n,this._context.elevationProvider,this._context.renderCoordsHelper,i),s=new k(o,t,this._context.layer.uid,e.uid),a=s.renderData.position.length/3;if(this._needsUV&&(s.uvMapSpace=U(4*a,!0),s.boundingRect=w(9*a,!0),A(s.uvMapSpace,s.boundingRect,s.renderData.position,this._context.renderCoordsHelper)),s.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(s),this._createAs3DShapeFill(s),this._hasOutline&&this._createAs3DShapeOutline(s),this._logGeometryCreationWarnings(s.renderData,n.rings,"rings","FillSymbol3DLayer"),0===s.outGeometries.length)return null;const l=new R({geometries:s.outGeometries,castShadow:!1,metadata:{layerUid:this._context.layer.uid,graphicUid:e.uid}}),c=new f(this,l,s.outGeometries,null,null,S,i);return c.alignedSampledElevation=s.renderData.sampledElevation,c.needsElevationUpdates=_(i.mode),c}_createAs3DShapeFill(e){const i=e.renderData.polygons;for(const{position:r,mapPositions:o,holeIndices:a,index:l,count:u}of i){if(t(this._context.clippingExtent)&&(c(N),h(N,o),!p(N,this._context.clippingExtent)))continue;const i=s(o,a,3);if(0===i.length)continue;const d=C({material:n(this._material),indices:i,mapPositions:o,attributeData:{position:r,color:e.color,uvMapSpace:this._needsUV?I(e.uvMapSpace,4*l,4*u):null,boundingRect:this._needsUV?G(e.boundingRect,9*l,9*u):null,objectAndLayerIdColor:e.objectAndLayerIdColor}});e.outGeometries.push(d)}}_createAs3DShapeOutline(e){if(!this._hasOutline)return;const i=e.renderData.outlines;for(let r=0;r<i.length;++r){const{mapPositions:o,position:s}=i[r];if(t(this._context.clippingExtent)&&(c(N),h(N,o),!p(N,this._context.clippingExtent)))continue;const a=P(n(this._outlineMaterial),{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:o,attributeData:{position:s}},e.objectAndLayerIdColor),l=a.vertexAttributes.get(B.POSITION);l.data===s&&(l.data=new Float64Array(s)),e.outGeometries.push(a)}}_createAsOverlay(e,i){const o=O(e.geometry);if(r(o))return null;n(this._material).renderPriority=this._renderPriority+this._renderPriorityStep/2,t(this._outlineMaterial)&&(this._outlineMaterial.renderPriority=this._renderPriority);const s=L(o,this._context.overlaySR),a=new q(s,i,this._context.layer.uid,e.uid),l=a.renderData.position.length/3;return this._needsUV&&(a.uvMapSpace=U(4*l,!0),M(a.uvMapSpace,a.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),a.outBoundingBox=c(),a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._createAsOverlayFill(a),this._hasOutline&&this._createAsOverlayOutline(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","FillSymbol3DLayer"),0===a.outGeometries.length?null:new y(this,a.outGeometries,a.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e){const t=e.renderData.polygons;for(const{position:i,holeIndices:r,index:o,count:l}of t){const t=c(N);if(h(t,i),!p(t,this._context.clippingExtent))continue;const d=s(i,r,3);if(0===d.length)continue;u(e.outBoundingBox,t);const m=C({material:n(this._material),indices:d,attributeData:{position:i,color:e.color,uvMapSpace:this._needsUV?I(e.uvMapSpace,4*o,4*l):null,objectAndLayerIdColor:e.objectAndLayerIdColor}}),_=new V(m,e);a(_.boundingSphere,.5*(t[0]+t[3]),.5*(t[1]+t[4]),0,.5*Math.sqrt((t[3]-t[0])*(t[3]-t[0])+(t[4]-t[1])*(t[4]-t[1]))),e.outGeometries.push(_)}}_createAsOverlayOutline(e){if(!this._hasOutline)return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(c(N),h(N,r),!p(N,this._context.clippingExtent))continue;u(e.outBoundingBox,N);const o=P(n(this._outlineMaterial),{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:r}},e.objectAndLayerIdColor),s=new V(o,e),l=N;a(s.boundingSphere,.5*(l[0]+l[3]),.5*(l[1]+l[4]),0,.5*Math.sqrt((l[3]-l[0])*(l[3]-l[0])+(l[4]-l[1])*(l[4]-l[1]))),e.outGeometries.push(s)}}_getOutlineOpacity(){const e=i(this.symbolLayer,"outline","color");return(this.draped?1:this._getLayerOpacity())*(t(e)?e.a:0)}_getOutlineColor(){const r=i(this.symbolLayer,"outline","color"),n=this._getOutlineOpacity();return x(t(r)?e.toUnitRGB(r):null,n)}test(){return{...super.test(),createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}}z.elevationModeChangeTypes={definedChanged:d.RECREATE,staysOnTheGround:d.NONE,onTheGroundChanged:d.RECREATE};const N=l();class k extends D{constructor(e,t,i,r){super(e,i,r),this.color=t}}class q extends D{constructor(e,t,i,r){super(e,i,r),this.color=t}}export{z as Graphics3DPolygonFillSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import{isSome as t,get as i,isNone as r,unwrap as n}from"../../../../core/maybe.js";import{pt2px as o}from"../../../../core/screenUtils.js";import{e as s}from"../../../../chunks/earcut.js";import{s as a}from"../../../../chunks/vec4.js";import{create as l,empty as c,expandWithBuffer as h,intersectsClippingArea as p,expandWithAABB as u}from"../../../../geometry/support/aaBoundingBox.js";import{SymbolUpdateType as d,elevationModeChangeUpdateType as m,needsElevationUpdates2D as _}from"./elevationAlignmentUtils.js";import{ElevationContext as g}from"./ElevationContext.js";import y from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as f}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as b}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as x}from"./graphicUtils.js";import{parseCapType as v}from"./lineUtils.js";import{geometryAsPolygon as O,createColorGeometry as C,PolygonCreationDataBase as D}from"./polygonUtils.js";import{createMaterial as j,uvElevationAligner as S}from"../support/patternUtils.js";import{createMapSpaceUVCoords as A,createMapSpaceUVCoordsDraped as M}from"../support/uvUtils.js";import{createGeometry as P}from"../../support/engineContent/line.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as L}from"../../support/renderInfoUtils/polygon.js";import{newDoubleArray as w,doubleSubArray as G}from"../../webgl-engine/lib/DoubleArray.js";import{newFloatArray as U,floatSubArray as I}from"../../webgl-engine/lib/FloatArray.js";import{Object3D as R}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as V}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as B}from"../../webgl-engine/lib/VertexAttribute.js";import{getStipplePatternForLinePattern as F}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as T}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as H}from"../../webgl-engine/materials/RibbonLineMaterial.js";const W=["polyline","polygon","extent"];class z extends b{constructor(e,t,i,r){super(e,t,i,r),this._needsUV=!1,this._hasOutline=!1}async doLoad(){}_ensureMaterials(){this._ensureFillMaterial(),this._ensureOutlineMaterial()}_ensureFillMaterial(){if(t(this._material))return;const e=i(this.symbolLayer,"material","color"),r=this._getCombinedOpacityAndColor(e);this._material=j(this.symbolLayer,{color:r,transparent:r[3]<1||this.needsDrivenTransparentPass,polygonOffset:!1,hasVertexColors:!0,writeLinearDepth:!0,hasSlicePlane:this._context.slicePlaneEnabled},{isDraped:this.draped}),this._needsUV=this._material instanceof T,this._context.stage.add(this._material)}_ensureOutlineMaterial(){const e=this.symbolLayer.outline;if(t(this._outlineMaterial)||!this._isValidOutline(e))return;this._hasOutline=!0;const i=t=>{const i=F(e.pattern);return new H({width:t,color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:i,stippleScaleWithLineWidth:!0,cap:v(e.patternCap||"butt")})};this._outlineMaterial=i(o(e.size)),this._context.stage.add(this._outlineMaterial)}_isValidOutline(e){return t(e)&&null!=e.size&&e.size>0&&t(e.color)&&(r(e.pattern)||"style"!==e.pattern.type||"none"!==e.pattern.style)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null,this._context.stage.remove(this._outlineMaterial),this._outlineMaterial=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,W,this.symbolLayer.type))return null;const i=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t,new g);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._ensureMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}layerOpacityChanged(){if(t(this._material)){const e=this._material.parameters.color,t=i(this.symbolLayer,"material","color"),r=this._getCombinedOpacity(t);this._material.setParameters({color:[e[0],e[1],e[2],r],transparent:r<1||this.needsDrivenTransparentPass})}if(t(this._outlineMaterial)){const e=this._outlineMaterial.parameters.color;this._outlineMaterial.setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,n=m(z.elevationModeChangeTypes,i,r);if(n!==d.UPDATE)return n;const o=_(r);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>o))}slicePlaneEnabledChanged(){if(t(this._material)&&this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t(this._outlineMaterial)){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._outlineMaterial.setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!0}_createAs3DShape(e,t,i){const n=O(e.geometry);if(r(n))return null;const o=E(n,this._context.elevationProvider,this._context.renderCoordsHelper,i),s=new k(o,t,this._context.layer.uid,e.uid),a=s.renderData.position.length/3;if(this._needsUV&&(s.uvMapSpace=U(4*a,!0),s.boundingRect=w(9*a,!0),A(s.uvMapSpace,s.boundingRect,s.renderData.position,this._context.renderCoordsHelper)),s.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(s),this._createAs3DShapeFill(s),this._hasOutline&&this._createAs3DShapeOutline(s),this._logGeometryCreationWarnings(s.renderData,n.rings,"rings","FillSymbol3DLayer"),0===s.outGeometries.length)return null;const l=new R({geometries:s.outGeometries,castShadow:!1,metadata:{layerUid:this._context.layer.uid,graphicUid:e.uid}}),c=new f(this,l,s.outGeometries,null,null,S,i);return c.alignedSampledElevation=s.renderData.sampledElevation,c.needsElevationUpdates=_(i.mode),c}_createAs3DShapeFill(e){const i=e.renderData.polygons;for(const{position:r,mapPositions:o,holeIndices:a,index:l,count:u}of i){if(t(this._context.clippingExtent)&&(c(N),h(N,o),!p(N,this._context.clippingExtent)))continue;const i=s(o,a,3);if(0===i.length)continue;const d=C({material:n(this._material),indices:i,mapPositions:o,attributeData:{position:r,color:e.color,uvMapSpace:this._needsUV?I(e.uvMapSpace,4*l,4*u):null,boundingRect:this._needsUV?G(e.boundingRect,9*l,9*u):null,objectAndLayerIdColor:e.objectAndLayerIdColor}});e.outGeometries.push(d)}}_createAs3DShapeOutline(e){if(!this._hasOutline)return;const i=e.renderData.outlines;for(let r=0;r<i.length;++r){const{mapPositions:o,position:s}=i[r];if(t(this._context.clippingExtent)&&(c(N),h(N,o),!p(N,this._context.clippingExtent)))continue;const a=P(n(this._outlineMaterial),{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:o,attributeData:{position:s}},e.objectAndLayerIdColor),l=a.vertexAttributes.get(B.POSITION);l.data===s&&(l.data=new Float64Array(s)),e.outGeometries.push(a)}}_createAsOverlay(e,i){const o=O(e.geometry);if(r(o))return null;n(this._material).renderPriority=this._renderPriority+this._renderPriorityStep/2,t(this._outlineMaterial)&&(this._outlineMaterial.renderPriority=this._renderPriority);const s=L(o,this._context.overlaySR),a=new q(s,i,this._context.layer.uid,e.uid),l=a.renderData.position.length/3;return this._needsUV&&(a.uvMapSpace=U(4*l,!0),M(a.uvMapSpace,a.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),a.outBoundingBox=c(),a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._createAsOverlayFill(a),this._hasOutline&&this._createAsOverlayOutline(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","FillSymbol3DLayer"),0===a.outGeometries.length?null:new y(this,a.outGeometries,a.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e){const t=e.renderData.polygons;for(const{position:i,holeIndices:r,index:o,count:l}of t){const t=c(N);if(h(t,i),!p(t,this._context.clippingExtent))continue;const d=s(i,r,3);if(0===d.length)continue;u(e.outBoundingBox,t);const m=C({material:n(this._material),indices:d,attributeData:{position:i,color:e.color,uvMapSpace:this._needsUV?I(e.uvMapSpace,4*o,4*l):null,objectAndLayerIdColor:e.objectAndLayerIdColor}}),_=new V(m,e);a(_.boundingSphere,.5*(t[0]+t[3]),.5*(t[1]+t[4]),0,.5*Math.sqrt((t[3]-t[0])*(t[3]-t[0])+(t[4]-t[1])*(t[4]-t[1]))),e.outGeometries.push(_)}}_createAsOverlayOutline(e){if(!this._hasOutline)return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(c(N),h(N,r),!p(N,this._context.clippingExtent))continue;u(e.outBoundingBox,N);const o=P(n(this._outlineMaterial),{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:r}},e.objectAndLayerIdColor),s=new V(o,e),l=N;a(s.boundingSphere,.5*(l[0]+l[3]),.5*(l[1]+l[4]),0,.5*Math.sqrt((l[3]-l[0])*(l[3]-l[0])+(l[4]-l[1])*(l[4]-l[1]))),e.outGeometries.push(s)}}_getOutlineOpacity(){const e=i(this.symbolLayer,"outline","color");return(this.draped?1:this._getLayerOpacity())*(t(e)?e.a:0)}_getOutlineColor(){const r=i(this.symbolLayer,"outline","color"),n=this._getOutlineOpacity();return x(t(r)?e.toUnitRGB(r):null,n)}test(){return{...super.test(),createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}}z.elevationModeChangeTypes={definedChanged:d.RECREATE,staysOnTheGround:d.NONE,onTheGroundChanged:d.RECREATE};const N=l();class k extends D{constructor(e,t,i,r){super(e,i,r),this.color=t}}class q extends D{constructor(e,t,i,r){super(e,i,r),this.color=t}}export{z as Graphics3DPolygonFillSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{HandleOwner as i}from"../../../../core/HandleOwner.js";import t from"../../../../core/Logger.js";import{isSome as r,isNone as a}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectBoundingRect as n}from"../../../../geometry/projection.js";import{create as c}from"../../../../geometry/support/aaBoundingRect.js";import{VisibilityFlag as o,VisibilityGroup as h}from"./enums.js";import{scaleBoundsPredicate as p}from"../../../support/layerViewUtils.js";import{TaskPriority as y}from"../../../support/Scheduler.js";const d=t.getLogger("esri.views.3d.layers.graphics.Graphics3DScaleVisibility");let g=class extends i{constructor(e){super(e),this._scaleRangeActive=!1,this._layerScaleRangeVisibilityQuery=!1,this._extent=null,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null,this.basemapTerrain=null,this.layerScaleEnabled=!0,this.suspended=!1,this._dirty=!0}initialize(){this.updateScaleRangeActive();const e=this.graphicsCoreOwner.view.resourceController.scheduler;this.handles.add(e.registerTask(y.SCALE_VISIBILITY,this)),this.updatingHandles.add((()=>this.layer.effectiveScaleRange),(()=>this.layerMinMaxScaleChangeHandler()))}destroy(){this.updatingHandles.removeAll(),this.handles.removeAll(),this._dirty=!1,this._extent=null,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null,this.basemapTerrain=null}get updating(){return this._dirty||this.updatingHandles.updating}_setDirty(){this._dirty=!0}setExtent(e){const i=this.graphicsCoreOwner.view.spatialReference,t=this.graphicsCoreOwner.view.basemapTerrain.spatialReference;if(i===t)this._extent=e;else{const r=c();n(e,i,r,t)?this._extent=r:this._extent=null}this._setDirty()}scaleRangeActive(){return this._scaleRangeActive}updateScaleRangeActive(){const e=this.layer,i=e.effectiveScaleRange;let t=this.layerScaleEnabled&&u(i.minScale,i.maxScale);e.labelingInfo&&!t&&(t=e.labelingInfo.some((e=>e&&u(e.minScale,e.maxScale))));const r=this._scaleRangeActive!==t;return this._scaleRangeActive=t,t&&!this.handles.has(b)&&this.basemapTerrain?(this.handles.add(this.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),b),this.layerScaleEnabled&&this.handles.add(this.basemapTerrain.on("tiles-visibility-changed",(()=>this._setDirty())),b)):!t&&this.handles.has(b)&&this.handles.remove(b),r}get running(){return!(!this.graphicsCoreOwner.view.basemapTerrain||!this.updating)}runTask(e){const i=this.graphicsCoreOwner.view.basemapTerrain;if(this._extent&&i&&i.ready&&this._scaleRangeActive&&this.layerScaleEnabled){if(!this._layerScaleRangeVisibilityQuery){this._layerScaleRangeVisibilityQuery=!0;const e=this.layer.effectiveScaleRange;i.queryVisibleScaleRange(this._extent,e.minScale,e.maxScale,(e=>this._finishUpdate(e)))}}else this._finishUpdate(!0);e.madeProgress()}_finishUpdate(e){this._layerScaleRangeVisibilityQuery=!1,this._set("suspended",!e),this._dirty=!1}_visibleAtLayerScale(e){const i=this.layer.effectiveScaleRange;return!this.layerScaleEnabled||p(e,i.minScale||0,i.maxScale||0)}_visibleAtLabelScale(e,i){return p(e,i.minScale||0,i.maxScale||0)}_graphicScale(e){let i;if(r(e.centroid)?i=e.centroid:r(e.graphic.geometry)&&"point"===e.graphic.geometry.type&&(i=e.graphic.geometry),i){return this.graphicsCoreOwner.view.basemapTerrain?this.graphicsCoreOwner.view.basemapTerrain.getScale(i):1}return null}_graphicVisible(e){if(!this.layerScaleEnabled)return!0;const i=this._graphicScale(e);return this._visibleAtLayerScale(i)}updateVisibility(e){if(this._scaleRangeActive){const i=this._graphicVisible(e);return e.setVisibilityFlag(o.SCALE_RANGE,i,h.GRAPHIC)}return!1}updateGraphicLabelScaleVisibility(e){if(!this._scaleRangeActive)return!1;if(!e.labelLayers||0===e.labelLayers.length)return!1;const i=this._graphicScale(e),t=this._updateLabelScaleVisibility(e,i);return t&&(this.graphicsCoreOwner.view.deconflictor.setDirty(),this.graphicsCoreOwner.view.labeler.setDirty()),t}_updateLabelScaleVisibility(e,i){if(!e.labelLayers||0===e.labelLayers.length)return!1;const t=e.labelLayers[0]._labelClass;if(t&&null!=t.minScale&&null!=t.maxScale){const r=this._visibleAtLabelScale(i,t);if(e.setVisibilityFlag(o.SCALE_RANGE,r,h.LABEL))return!0}return!1}_scaleUpdateHandler(e){if(this._setDirty(),!this.graphicsCore.visible)return;const i=e.extent,t=e.scale,s=this._visibleAtLayerScale(t);let l=!1;const c=this.graphicsCoreOwner.view.spatialReference,p=e.spatialReference;if(a(p))return void d.error("scaleUpdate: Internal error, no SpatialReference given for tiles");const y=!p.equals(c);if(y){if(!n(i,p,m,c))return void d.error("scaleUpdate: Internal error, cannot project AABR from "+p+" to wkid "+c)}const g=y?m:i;this.queryGraphicUIDsInExtent(g,c,(e=>{const n=this.graphicsCore.getGraphics3DGraphicById(e);if(a(n))return;const c=n.centroid;r(c)&&(i[0]>c.x||i[1]>c.y||i[2]<c.x||i[3]<c.y)||(n.setVisibilityFlag(o.SCALE_RANGE,s,h.GRAPHIC)&&(l=!0),this._updateLabelScaleVisibility(n,t)&&(l=!0))})),l&&(this.graphicsCoreOwner.view.deconflictor.setDirty(),this.graphicsCoreOwner.view.labeler.setDirty())}layerMinMaxScaleChangeHandler(){this.updateScaleRangeActive()&&!this._scaleRangeActive?this.graphicsCore.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(o.SCALE_RANGE))):this._scaleRangeActive&&this.graphicsCore.updateAllGraphicsVisibility(),this._setDirty()}};function u(e,i){return e>0||i>0}e([s()],g.prototype,"graphicsCoreOwner",void 0),e([s()],g.prototype,"layer",void 0),e([s()],g.prototype,"queryGraphicUIDsInExtent",void 0),e([s()],g.prototype,"graphicsCore",void 0),e([s()],g.prototype,"basemapTerrain",void 0),e([s({constructOnly:!0})],g.prototype,"layerScaleEnabled",void 0),e([s({readOnly:!0})],g.prototype,"suspended",void 0),e([s({readOnly:!0})],g.prototype,"updating",null),e([s()],g.prototype,"_dirty",void 0),g=e([l("esri.views.3d.layers.graphics.Graphics3DScaleVisibility")],g);const b="terrain-events",m=c(),S=g;export{S as default};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{HandleOwner as i}from"../../../../core/HandleOwner.js";import t from"../../../../core/Logger.js";import{isSome as r,isNone as a}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectBoundingRect as n}from"../../../../geometry/projection.js";import{create as c}from"../../../../geometry/support/aaBoundingRect.js";import{VisibilityFlag as o,VisibilityGroup as h}from"./enums.js";import{scaleBoundsPredicate as p}from"../../../support/layerViewUtils.js";import{TaskPriority as y}from"../../../support/Scheduler.js";const d=t.getLogger("esri.views.3d.layers.graphics.Graphics3DScaleVisibility");let g=class extends i{constructor(e){super(e),this._scaleRangeActive=!1,this._layerScaleRangeVisibilityQuery=!1,this._extent=null,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null,this.basemapTerrain=null,this.layerScaleEnabled=!0,this.suspended=!1,this._dirty=!0}initialize(){this.updateScaleRangeActive();const e=this.graphicsCoreOwner.view.resourceController.scheduler;this.handles.add(e.registerTask(y.SCALE_VISIBILITY,this)),this.updatingHandles.add((()=>this.layer.effectiveScaleRange),(()=>this.layerMinMaxScaleChangeHandler()))}destroy(){this.updatingHandles.removeAll(),this.handles.removeAll(),this._dirty=!1,this._extent=null,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null,this.basemapTerrain=null}get updating(){return this._dirty||this.updatingHandles.updating}_setDirty(){this._dirty=!0}setExtent(e){const i=this.graphicsCoreOwner.view.spatialReference,t=this.graphicsCoreOwner.view.basemapTerrain.spatialReference;if(i===t)this._extent=e??null;else{const r=c();n(e,i,r,t)?this._extent=r:this._extent=null}this._setDirty()}scaleRangeActive(){return this._scaleRangeActive}updateScaleRangeActive(){const e=this.layer,i=e.effectiveScaleRange;let t=this.layerScaleEnabled&&null!=i&&u(i.minScale,i.maxScale);e.labelingInfo&&!t&&(t=e.labelingInfo.some((e=>e&&u(e.minScale??0,e.maxScale??0))));const r=this._scaleRangeActive!==t;return this._scaleRangeActive=t,t&&!this.handles.has(b)&&this.basemapTerrain?(this.handles.add(this.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),b),this.layerScaleEnabled&&this.handles.add(this.basemapTerrain.on("tiles-visibility-changed",(()=>this._setDirty())),b)):!t&&this.handles.has(b)&&this.handles.remove(b),r}get running(){return!(!this.graphicsCoreOwner.view.basemapTerrain||!this.updating)}runTask(e){const i=this.graphicsCoreOwner.view.basemapTerrain;if(this._extent&&i&&i.ready&&this._scaleRangeActive&&this.layerScaleEnabled){if(!this._layerScaleRangeVisibilityQuery){this._layerScaleRangeVisibilityQuery=!0;const e=this.layer.effectiveScaleRange;i.queryVisibleScaleRange(this._extent,e.minScale,e.maxScale,(e=>this._finishUpdate(e)))}}else this._finishUpdate(!0);e.madeProgress()}_finishUpdate(e){this._layerScaleRangeVisibilityQuery=!1,this._set("suspended",!e),this._dirty=!1}_visibleAtLayerScale(e){const i=this.layer.effectiveScaleRange;return!this.layerScaleEnabled||p(e,i.minScale||0,i.maxScale||0)}_visibleAtLabelScale(e,i){return p(e,i.minScale||0,i.maxScale||0)}_graphicScale(e){let i;if(r(e.centroid)?i=e.centroid:r(e.graphic.geometry)&&"point"===e.graphic.geometry.type&&(i=e.graphic.geometry),i){return this.graphicsCoreOwner.view.basemapTerrain?this.graphicsCoreOwner.view.basemapTerrain.getScale(i):1}return null}_graphicVisible(e){if(!this.layerScaleEnabled)return!0;const i=this._graphicScale(e);return this._visibleAtLayerScale(i)}updateVisibility(e){if(this._scaleRangeActive){const i=this._graphicVisible(e);return e.setVisibilityFlag(o.SCALE_RANGE,i,h.GRAPHIC)}return!1}updateGraphicLabelScaleVisibility(e){if(!this._scaleRangeActive)return!1;if(!e.labelLayers||0===e.labelLayers.length)return!1;const i=this._graphicScale(e),t=this._updateLabelScaleVisibility(e,i);return t&&(this.graphicsCoreOwner.view.deconflictor.setDirty(),this.graphicsCoreOwner.view.labeler.setDirty()),t}_updateLabelScaleVisibility(e,i){if(!e.labelLayers||0===e.labelLayers.length)return!1;const t=e.labelLayers[0]._labelClass;if(t&&null!=t.minScale&&null!=t.maxScale){const r=this._visibleAtLabelScale(i,t);if(e.setVisibilityFlag(o.SCALE_RANGE,r,h.LABEL))return!0}return!1}_scaleUpdateHandler(e){if(this._setDirty(),!this.graphicsCore.visible)return;const i=e.extent,t=e.scale,s=this._visibleAtLayerScale(t);let l=!1;const c=this.graphicsCoreOwner.view.spatialReference,p=e.spatialReference;if(a(p))return void d.error("scaleUpdate: Internal error, no SpatialReference given for tiles");const y=!p.equals(c);if(y){if(!n(i,p,m,c))return void d.error("scaleUpdate: Internal error, cannot project AABR from "+p+" to wkid "+c)}const g=y?m:i;this.queryGraphicUIDsInExtent(g,c,(e=>{const n=this.graphicsCore.getGraphics3DGraphicById(e);if(a(n))return;const c=n.centroid;r(c)&&(i[0]>c.x||i[1]>c.y||i[2]<c.x||i[3]<c.y)||(n.setVisibilityFlag(o.SCALE_RANGE,s,h.GRAPHIC)&&(l=!0),this._updateLabelScaleVisibility(n,t)&&(l=!0))})),l&&(this.graphicsCoreOwner.view.deconflictor.setDirty(),this.graphicsCoreOwner.view.labeler.setDirty())}layerMinMaxScaleChangeHandler(){this.updateScaleRangeActive()&&!this._scaleRangeActive?this.graphicsCore.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(o.SCALE_RANGE))):this._scaleRangeActive&&this.graphicsCore.updateAllGraphicsVisibility(),this._setDirty()}};function u(e,i){return e>0||i>0}e([s()],g.prototype,"graphicsCoreOwner",void 0),e([s()],g.prototype,"layer",void 0),e([s()],g.prototype,"queryGraphicUIDsInExtent",void 0),e([s()],g.prototype,"graphicsCore",void 0),e([s()],g.prototype,"basemapTerrain",void 0),e([s({constructOnly:!0})],g.prototype,"layerScaleEnabled",void 0),e([s({readOnly:!0})],g.prototype,"suspended",void 0),e([s({readOnly:!0})],g.prototype,"updating",null),e([s()],g.prototype,"_dirty",void 0),g=e([l("esri.views.3d.layers.graphics.Graphics3DScaleVisibility")],g);const b="terrain-events",m=c(),S=g;export{S as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{forEach as e}from"../../../../core/asyncUtils.js";import{isSome as t,get as s,isNone as r}from"../../../../core/maybe.js";import{onAbortOrThrow as o,throwIfAborted as a}from"../../../../core/promiseUtils.js";import i from"./Graphics3DGraphic.js";import{Graphics3DObject3DGraphicLayer as n}from"./Graphics3DObject3DGraphicLayer.js";import{make as y}from"./Graphics3DSymbolLayerFactory.js";import{ApplyRendererDiffResult as l}from"./interfaces.js";import{Loadable as h,LoadStatus as c}from"./Loadable.js";import{totalSymbolComplexities as m}from"./symbolComplexity.js";class p extends h{set symbol(e){this._symbol=e,e.symbolLayers.forEach(((s,r)=>{const o=this.symbolLayers[r];t(o)&&(o.symbol=e,o.symbolLayer=s)}))}get symbol(){return this._symbol}constructor(e,t,s){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=s,this._destroyed=!1,this.symbolLayers=new Array,this.referenced=0,this._extentPadding=0}async doLoad(s){let r=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(r=this._backgroundLayers.concat(r));const i=r.length;for(;this.symbolLayers.length<r.length;)this.symbolLayers.push(null);this.symbolLayers.length=r.length;const n=[];for(let e=0;e<i;e++){const t=r.getItemAt(e);if(!1===t.enabled)continue;d.renderPriority=1-(1+e)/i,d.renderPriorityStep=1/i,d.ignoreDrivers=t._ignoreDrivers;const a=y(this.symbol,t,this._context,d)
|
|
5
|
+
import{forEach as e}from"../../../../core/asyncUtils.js";import{isSome as t,get as s,isNone as r}from"../../../../core/maybe.js";import{onAbortOrThrow as o,throwIfAborted as a}from"../../../../core/promiseUtils.js";import i from"./Graphics3DGraphic.js";import{Graphics3DObject3DGraphicLayer as n}from"./Graphics3DObject3DGraphicLayer.js";import{make as y}from"./Graphics3DSymbolLayerFactory.js";import{ApplyRendererDiffResult as l}from"./interfaces.js";import{Loadable as h,LoadStatus as c}from"./Loadable.js";import{totalSymbolComplexities as m}from"./symbolComplexity.js";class p extends h{set symbol(e){this._symbol=e,e.symbolLayers.forEach(((s,r)=>{const o=this.symbolLayers[r];t(o)&&(o.symbol=e,o.symbolLayer=s)}))}get symbol(){return this._symbol}constructor(e,t,s){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=s,this._destroyed=!1,this.symbolLayers=new Array,this.referenced=0,this._extentPadding=0}async doLoad(s){let r=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(r=this._backgroundLayers.concat(r));const i=r.length;for(;this.symbolLayers.length<r.length;)this.symbolLayers.push(null);this.symbolLayers.length=r.length;const n=[];for(let e=0;e<i;e++){const t=r.getItemAt(e);if(!1===t.enabled)continue;d.renderPriority=1-(1+e)/i,d.renderPriorityStep=1/i,d.ignoreDrivers=t._ignoreDrivers;const a=y(this.symbol,t,this._context,d),l=o(s,(()=>{this.symbolLayers[e]=null,a.destroy()}));l&&n.push(l),this.symbolLayers[e]=a}if(await e(this.symbolLayers,(async(e,s)=>{if(t(e))try{await e.load(),this._extentPadding+=Math.max(this._extentPadding,e.extentPadding)}catch{this.symbolLayers[s]=null}})),n.forEach((e=>e.remove())),a(s),this.symbolLayers.length&&!this.symbolLayers.some((e=>!!e)))throw new Error}getSymbolLayerSize(e){const s=this.symbolLayers[e];return t(s)?s.getCachedSize():null}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some((e=>t(e)&&e.queryForSnapping))}createGraphics3DGraphic(e,s){const r=e.graphic,o=new Array(this.symbolLayers.length);for(let i=0;i<this.symbolLayers.length;i++){const s=this.symbolLayers[i];o[i]=t(s)?s.createGraphics3DGraphic(e):null}const a=this._context.arcade||this._context.featureExpressionInfoContext&&this._context.featureExpressionInfoContext.arcade&&this._context.featureExpressionInfoContext.arcade.modules||null;return new i(r,s||this,o,e.layer,a)}get complexity(){return m(this.symbolLayers.map((e=>s(e,"complexity"))))}globalPropertyChanged(e,s){const r=this.symbolLayers.length;for(let o=0;o<r;o++){const r=this.symbolLayers[o],a=e=>{const t=e.layers[o];return t instanceof n?t:null};if(t(r)&&!r.globalPropertyChanged(e,s,a))return!1}return!0}applyRendererDiff(e,s){return this.loadStatus!==c.LOADED?l.Recreate_Symbol:this.symbolLayers.reduce(((r,o)=>r!==l.Recreate_Symbol&&t(o)?Math.min(r,o.applyRendererDiff(e,s)):r),l.Fast_Update)}prepareSymbolPatch(e){if(this.loadStatus===c.FAILED)return;if("partial"!==e.diff.type)return;const s=e.diff.diff;if(!s.symbolLayers||"partial"!==s.symbolLayers.type)return;const o=s.symbolLayers.diff;this.symbolLayers.forEach(((s,a)=>{if(r(s))return;const i=o[a];if(i){const r={diff:i,graphics3DGraphicPatches:[],symbolLayerStatePatches:[]};s.prepareSymbolLayerPatch(r),e.symbolStatePatches.push(...r.symbolLayerStatePatches),r.graphics3DGraphicPatches.length&&e.graphics3DGraphicPatches.push(((e,s)=>{const o=e.layers[a];t(o)&&r.graphics3DGraphicPatches.forEach((e=>e(o,s)))}))}}))}updateGeometry(e,t){for(let s=0;s<this.symbolLayers.length;s++){const o=this.symbolLayers[s];if(r(o))continue;const a=e.layers[s];if(r(a)||!o.updateGeometry(a,t))return!1}return!0}onRemoveGraphic(e){for(let s=0;s<this.symbolLayers.length;s++){const o=this.symbolLayers[s];if(r(o))continue;const a=e.layers[s];t(a)&&o.onRemoveGraphic(a)}}getFastUpdateStatus(){let e=0,t=0,s=0;return this.symbolLayers.forEach((o=>{r(o)||(o.loadStatus===c.LOADING?e++:o.isFastUpdatesEnabled()?s++:t++)})),{loading:e,slow:t,fast:s}}async queryForSnapping(e,s,r,o){const i=this.symbolLayers.filter(t).filter((e=>t(e.queryForSnapping))).map((t=>t.queryForSnapping(e,s,r,o))),n=await Promise.all(i);return a(o),n.flat()}destroy(){if(this.destroyed)console.error("Graphics3DSymbol.destroy called when already destroyed!");else{super.destroy();for(const e of this.symbolLayers)t(e)&&e.destroy();this.symbolLayers.length=0,this._destroyed=!0}}get destroyed(){return this._destroyed}}const d={renderPriority:0,renderPriorityStep:1,ignoreDrivers:!1};export{p as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{isSome as i,unwrap as o,unwrapOr as r}from"../../../../core/maybe.js";import{O as n}from"../../../../chunks/vec3f64.js";import{f as s}from"../../../../chunks/vec4f64.js";import{SymbolUpdateType as a}from"./elevationAlignmentUtils.js";import{ElevationContext as l}from"./ElevationContext.js";import{zeroContext as p}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as c}from"./graphicUtils.js";import{ApplyRendererDiffResult as d}from"./interfaces.js";import{Loadable as u}from"./Loadable.js";import{defaultSymbolLayerComplexity as h}from"./symbolComplexity.js";const f=t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class y extends u{constructor(e,t,i,o){super(i.schedule),this.symbol=e,this.symbolLayer=t,this._context=i,this._elevationInfoOverride=null,this._ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1},this.complexity=null,this.logger=f,this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this._renderPriority=o.renderPriority,this._renderPriorityStep=o.renderPriorityStep,this._elevationContext=new l,this.complexity=this.computeComplexity(),this._ignoreDrivers=o.ignoreDrivers,this._ignoreDrivers||(this._drivenProperties=g(this._context.renderer)),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}_drivenPropertiesChanged(e){if(this._ignoreDrivers)return!1;const t=this._drivenProperties,i=g(e);return i.color!==t.color||i.opacity!==t.opacity||i.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||i.size!==t.size}get needsDrivenTransparentPass(){return this._drivenProperties.opacity&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,t,i,o){const r=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${o} geometry failed to be created`;let a=null;r?!this._logGeometryValidationWarnings(t,i,o)&&n&&0===n.length&&"rings"===i&&t.length>0&&t[0].length>2&&(a=`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):a=`${s} (failed to project geometry to view spatial reference)`,a&&f.warnOncePerTick(a)}_logGeometryValidationWarnings(e,t,i){const o=`${i} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(f.warnOncePerTick(`${o} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(f.warnOncePerTick(`${o} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,o=null){if(i(t)&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+o+` symbol: ${e.type}`),!1;if("point"===e.type){const t=e;if(!isFinite(t.x)||!isFinite(t.y))return f.warn("point coordinate is not a valid number, graphic skipped"),!1}return!0}_defaultElevationInfoNoZ(){return m}_defaultElevationInfoZ(){return _}_updateElevationContext(){i(this._elevationInfoOverride)?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t){const i=o(e.geometry),n=this.getDefaultElevationInfo(i);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:n.unit,t.mode=this.getGeometryElevationMode(i,n),t.offsetMeters=r(this._elevationContext.meterUnitOffset,r(n.offset,0));const s=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;s&&(t.mode="relative-to-ground",t.offsetMeters=0);const a=s?p:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(a,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=x){let o=1;return this.draped||(o*=this._getLayerOpacity()),this._drivenProperties.opacity||(i(e)?o*=e.a:t.hasIntrinsicColor||(o=0)),o}_getCombinedOpacityAndColor(t,o=x){const r=this._getCombinedOpacity(t,o);if(this._drivenProperties.color)return c(null,r);const s=i(t)?e.toUnitRGB(t):n;return c(s,r)}_getVertexOpacityAndColor(e,t=null){const o=this._drivenProperties.color?e.color:null,r=this._drivenProperties.opacity?e.opacity:null,n=c(o,r);return i(t)&&(n[0]*=t,n[1]*=t,n[2]*=t,n[3]*=t),n}isFastUpdatesEnabled(){return this._fastUpdates&&this._fastUpdates.enabled}computeComplexity(){return h(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,i){switch(e){case"opacity":return this.layerOpacityChanged(t,i),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return this.layerElevationInfoChanged(t,i,e)!==a.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,i);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged();default:return!1}}updateGraphics3DGraphicElevationInfo(e,t,o){let r=a.UPDATE;return e.forEach((e=>{const n=t(e);if(i(n)){const t=e.graphic;this.setGraphicElevationContext(t,n.elevationContext),n.needsElevationUpdates=o(n.elevationContext.mode)}else r=a.RECREATE})),r}applyRendererDiff(e,t){return d.Recreate_Symbol}getFastUpdateAttrValues(e){if(!this._fastUpdates.enabled)return null;const t=this._fastUpdates.visualVariables,i=t.size?v(t.size.field,e):0,o=t.color?v(t.color.field,e):0,r=t.opacity?v(t.opacity.field,e):0;return s(i,o,r,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&f.warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}test(){const e=()=>({size:this._fastUpdates?.visualVariables?.size?.field??null,color:this._fastUpdates?.visualVariables?.color?.field??null,opacity:this._fastUpdates?.visualVariables?.opacity?.field??null,rotation:this._fastUpdates?.visualVariables?.rotation?.field??null});return{drivenProperties:this._drivenProperties,getVisVarFields:e}}}function v(e,t){const i=null!=e?t.attributes[e]:0;return null!=i&&isFinite(i)?i:0}function g(e){const t={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach((e=>{switch(e.type){case"color":if(t.color=!0,e.stops)for(let i=0;i<e.stops.length;i++){const o=e.stops[i].color;o&&(t.opacity=!0,o.a<1&&(t.opacityAlwaysOpaque=!1))}break;case"opacity":t.opacity=!0,t.opacityAlwaysOpaque=!1;break;case"size":t.size=!0}})),t}const m={mode:"on-the-ground",offset:0,unit:"meters"},_={mode:"absolute-height",offset:0,unit:"meters"},x={hasIntrinsicColor:!1};export{y as Graphics3DSymbolLayer,v as getAttributeValue};
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{isSome as i,unwrap as o,unwrapOr as r}from"../../../../core/maybe.js";import{O as n}from"../../../../chunks/vec3f64.js";import{f as s}from"../../../../chunks/vec4f64.js";import{SymbolUpdateType as a}from"./elevationAlignmentUtils.js";import{ElevationContext as l}from"./ElevationContext.js";import{zeroContext as p}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as c}from"./graphicUtils.js";import{ApplyRendererDiffResult as d}from"./interfaces.js";import{Loadable as u}from"./Loadable.js";import{defaultSymbolLayerComplexity as h}from"./symbolComplexity.js";const f=t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class y extends u{constructor(e,t,i,o){super(i.schedule),this.symbol=e,this.symbolLayer=t,this._context=i,this._elevationInfoOverride=null,this._ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1},this.complexity=null,this.logger=f,this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this._renderPriority=o.renderPriority,this._renderPriorityStep=o.renderPriorityStep,this._elevationContext=new l,this.complexity=this.computeComplexity(),this._ignoreDrivers=o.ignoreDrivers,this._ignoreDrivers||(this._drivenProperties=g(this._context.renderer)),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}_drivenPropertiesChanged(e){if(this._ignoreDrivers)return!1;const t=this._drivenProperties,i=g(e);return i.color!==t.color||i.opacity!==t.opacity||i.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||i.size!==t.size}get needsDrivenTransparentPass(){return this._drivenProperties.opacity&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,t,i,o){const r=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${o} geometry failed to be created`;let a=null;r?!this._logGeometryValidationWarnings(t,i,o)&&n&&0===n.length&&"rings"===i&&t.length>0&&t[0].length>2&&(a=`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):a=`${s} (failed to project geometry to view spatial reference)`,a&&f.warnOncePerTick(a)}_logGeometryValidationWarnings(e,t,i){const o=`${i} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(f.warnOncePerTick(`${o} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(f.warnOncePerTick(`${o} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,o=null){if(i(t)&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+o+` symbol: ${e.type}`),!1;if("point"===e.type){const t=e;if(!isFinite(t.x)||!isFinite(t.y))return f.warn("point coordinate is not a valid number, graphic skipped"),!1}return!0}_defaultElevationInfoNoZ(){return m}_defaultElevationInfoZ(){return _}_updateElevationContext(){i(this._elevationInfoOverride)?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t){const i=o(e.geometry),n=this.getDefaultElevationInfo(i);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:n.unit,t.mode=this.getGeometryElevationMode(i,n),t.offsetMeters=r(this._elevationContext.meterUnitOffset,r(n.offset,0));const s=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;s&&(t.mode="relative-to-ground",t.offsetMeters=0);const a=s?p:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(a,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=x){let o=1;return this.draped||(o*=this._getLayerOpacity()),this._drivenProperties.opacity||(i(e)?o*=e.a:t.hasIntrinsicColor||(o=0)),o}_getCombinedOpacityAndColor(t,o=x){const r=this._getCombinedOpacity(t,o);if(this._drivenProperties.color)return c(null,r);const s=i(t)?e.toUnitRGB(t):n;return c(s,r)}_getVertexOpacityAndColor(e,t=null){const o=this._drivenProperties.color?e.color:null,r=this._drivenProperties.opacity?e.opacity:null,n=c(o,r);return i(t)&&(n[0]*=t,n[1]*=t,n[2]*=t,n[3]*=t),n}isFastUpdatesEnabled(){return this._fastUpdates&&this._fastUpdates.enabled}computeComplexity(){return h(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,i){switch(e){case"opacity":return this.layerOpacityChanged(t,i),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return this.layerElevationInfoChanged(t,i,e)!==a.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,i);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged();default:return!1}}updateGraphics3DGraphicElevationInfo(e,t,o){let r=a.UPDATE;return e.forEach((e=>{const n=t(e);if(i(n)){const t=e.graphic;this.setGraphicElevationContext(t,n.elevationContext),n.needsElevationUpdates=o(n.elevationContext.mode)}else r=a.RECREATE})),r}applyRendererDiff(e,t){return d.Recreate_Symbol}getFastUpdateAttrValues(e){if(!this._fastUpdates.enabled)return null;const t=this._fastUpdates.visualVariables,i=t.size?v(t.size.field,e):0,o=t.color?v(t.color.field,e):0,r=t.opacity?v(t.opacity.field,e):0;return s(i,o,r,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&f.warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}test(){const e=()=>({size:this._fastUpdates?.visualVariables?.size?.field??null,color:this._fastUpdates?.visualVariables?.color?.field??null,opacity:this._fastUpdates?.visualVariables?.opacity?.field??null,rotation:this._fastUpdates?.visualVariables?.rotation?.field??null});return{drivenProperties:this._drivenProperties,getVisVarFields:e}}}function v(e,t){const i=null!=e?t.attributes[e]:0;return null!=i&&isFinite(i)?i:0}function g(e){const t={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach((e=>{switch(e.type){case"color":if(t.color=!0,e.stops)for(let i=0;i<e.stops.length;i++){const o=e.stops[i].color;o&&(t.opacity=!0,o.a<1&&(t.opacityAlwaysOpaque=!1))}break;case"opacity":t.opacity=!0,t.opacityAlwaysOpaque=!1;break;case"size":t.size=!0}})),t}const m={mode:"on-the-ground",offset:0,unit:"meters"},_={mode:"absolute-height",offset:0,unit:"meters"},x={hasIntrinsicColor:!1};export{y as Graphics3DSymbolLayer,v as getAttributeValue};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import{isNone as t,isSome as r,get as
|
|
5
|
+
import e from"../../../../core/Error.js";import{isNone as t,isSome as r,get as s,unwrap as n}from"../../../../core/maybe.js";import{isPromiseLike as i}from"../../../../core/promiseUtils.js";import{pt2px as o}from"../../../../core/screenUtils.js";import{f as a,Z as l,a as c}from"../../../../chunks/vec2f64.js";import{hasCalloutSupport as m,textSymbolLayerSupportsVerticalOffset as h}from"../../../../symbols/callouts/calloutUtils.js";import{CreateLabelParameters as p}from"./CreateLabelParameters.js";import{perObjectElevationAligner as d}from"./ElevationAligners.js";import{SymbolUpdateType as f,needsElevationUpdates2D as u}from"./elevationAlignmentUtils.js";import{ElevationContext as g}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as y}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as x}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as b}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as v}from"./graphicUtils.js";import{verticalPlacementFromAlignment as P,textRenderAlignmentFromHorizontalPlacement as O,horizontalPlacementToAnchorX as j,anchorFromPlacements as w,namedAnchorToHUDMaterialAnchorPos as S}from"./placementUtils.js";import{placePointOnGeometry as _,createStageObject as E,extendPointGraphicElevationContext as L}from"./pointUtils.js";import{createPointGeometry as z}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as C}from"../../webgl-engine/lib/TextRenderParameters.js";import G from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as R}from"../../webgl-engine/materials/HUDMaterial.js";const U=[0,0,1];class D extends b{constructor(e,t,r,s){super(e,t,r,s),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=v(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.pixelRatio;this._textRenderParameters=await C.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const s=e.graphic,n=_(s.geometry);if(t(n))return this.logger.warn(`unsupported geometry type for text symbol: ${s.geometry.type}`),null;const i=this.symbolLayer.text;if(t(i)||""===i)return null;const o=m(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(r(o)&&!h(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const a=new p(o,this.symbolLayer.horizontalAlignment,P(this.symbolLayer.verticalAlignment));return this._createAs3DShape(s,n,i,a)}createLabel(e,r,s,n){const i=e.graphic,o=_(i.geometry);if(t(o))return this.logger.warn(`unsupported geometry type for label: ${i.geometry.type}`),null;const a=r.text;return!a||/^\s+$/.test(a)?null:this._createAs3DShape(i,o,a,r,s,n)}setGraphicElevationContext(e,t,r=0){const s=super.setGraphicElevationContext(e,t);return s.addOffsetRenderUnits(r),s}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,t){return A(e,t,((e,t)=>{this.updateGraphicElevationContext(t,e)})),f.UPDATE}slicePlaneEnabledChanged(e,t){return A(e,t,(e=>{for(const t of e.stageObject.geometries)t.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!1}updateGraphicElevationContext(e,t){const s=t.elevationContext;this.setGraphicElevationContext(e,s,r(t.metadata)?t.metadata.elevationOffset:0),t.needsElevationUpdates=u(s.mode)||"absolute-height"===s.mode}_defaultElevationInfoNoZ(){return W}_createAs3DShape(e,m,h,p,f,b){const v=this.setGraphicElevationContext(e,new g,p.elevationOffset),P="polyline"===s(e.geometry,"type"),j=e.uid;let w=null,S=null;if(t(b)){const e=O(p.horizontalPlacement);w=new G(h,e,this._textRenderParameters);let s=null;if(r(this._context.sharedResources.textures)){S=this._context.sharedResources.textures.fromData(w.key,(()=>n(w).create()),(()=>{r(s)&&s.release()}));const e=this._context.stage.renderView.textureRepository.acquire(S.texture.id);if(t(e)||i(e))return S.release(),null;s=e}}const _=T(w,p),C={occlusionTest:!0,screenOffset:p.screenOffset,anchorPosition:_,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:p.centerOffsetUnits,drawInSecondSlot:!0};if(r(b)?C.textureId=b.id:r(S)&&(C.textureId=S.texture.id),r(p.verticalOffset)){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=p.verticalOffset;C.verticalOffset={screenLength:o(e),minWorldLength:t||0,maxWorldLength:r(s)?s:1/0}}if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:e,screenSizePerspectiveSettingsLabels:t}=this._context.sharedResources;C.screenSizePerspective=t.overridePadding(this._textRenderParameters.haloSize+this._textRenderParameters.definition.background.padding[0]),C.screenSizePerspectiveAlignment=e}let D;if(P&&(C.shaderPolygonOffset=1e-4),C.hasSlicePlane=this._context.slicePlaneEnabled,r(f)){const e=JSON.stringify(C);D=f.get(e),t(D)&&(D=new R(C),f.add(e,D))}else D=new R(C);const A=p.translation,W=r(w)?a(w.displayWidth,w.displayHeight):l,I=p.centerOffset,k=z(D,U,A,null,W,I,[0,0],null),$=E(this._context,m,k,v,j);if(t($))return null;const H=new y(this,$.object,[k],t(f)?[D]:null,S,d,v);H.alignedSampledElevation=$.sampledElevation,H.needsElevationUpdates=u(v.mode)||"absolute-height"===v.mode;const{displayWidth:V,displayHeight:M}=r(w)?w:p;H.getScreenSize=(e=c())=>(e[0]=V,e[1]=M,e);const N=new x(p.elevationOffset,h);return H.metadata=N,L(H,m,this._context.elevationProvider),H}}function A(e,t,s){e&&e.forEach((e=>{const n=t(e);r(n)&&s(n,e.graphic)}))}function T(e,t){if("baseline"===t.verticalPlacement){const s=j[t.horizontalPlacement],n=r(e)?e.baselineAnchorY:0;return a(s,n)}const s=w(t.horizontalPlacement,t.verticalPlacement);return S[s]}const W={mode:"relative-to-ground",offset:0};export{D as Graphics3DTextSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import t from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import a from"../../../../geometry/Extent.js";import{QueryEngine as o}from"../../../../layers/graphics/data/QueryEngine.js";import i from"../../../../rest/support/FeatureSet.js";import u from"../../../../rest/support/Query.js";import{featureGeometryTypeKebabDictionary as y}from"../../../../geometry/support/typeUtils.js";const c=o;let p=class extends t{get layer(){return this.context.layer}get spatialReference(){return this.context.spatialReference}get _queryGeometryType(){switch(this.layer.geometryType){case"multipoint":case"point":case"polygon":case"polyline":return this.layer.geometryType;case"mesh":return"polygon";default:return}}get defaultQueryJSON(){return new u({outSpatialReference:this.spatialReference}).toJSON()}get _dataQueryEngine(){return this._ensureDataQueryEngine()}constructor(e){super(e),this._dataQueryEngineInstance=null}destroy(){this.clear()}clear(){return!!this._dataQueryEngineInstance&&(this._dataQueryEngineInstance.destroy(),this._dataQueryEngineInstance=null,!0)}async executeQueryForIdSet(e,t,r){return this._dataQueryEngine.executeQueryForIdSet(this._ensureQueryJSON(e,t),r)}async executeQueryForCount(e,t){return this._dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),t)}async executeQueryForExtent(e,t){const{count:r,extent:s}=await this._dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),t);return{count:r,extent:a.fromJSON(s)}}async executeQueryForIds(e,t){return this._dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),t)}async executeQueryForLatestObservations(e,t){const r=await this._dataQueryEngine.executeQueryForLatestObservations(this._ensureQueryJSON(e),t),s=i.fromJSON(r);return s.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),s}async executeQuery(e,t){const r=await this._dataQueryEngine.executeQuery(this._ensureQueryJSON(e),t),s=i.fromJSON(r);return s.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),s}_ensureQueryJSON(e,t){let s=this.defaultQueryJSON;if(r(e)&&("outSpatialReference"in e&&!e.outSpatialReference&&(e.outSpatialReference=this.spatialReference),s=e.toJSON()),r(t)){const e=t.geometries.map((e=>e.toJSON())).reduce(((e,t)=>(e.rings=e.rings.concat(t.rings),e)));s={...s,sceneFilter:{...t,geometry:e}}}return s}_ensureDataQueryEngine(){if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e="timeInfo"in this.layer&&this.layer.timeInfo&&this.layer.timeInfo.toJSON()||null,t=this.layer.objectIdField,r=y.toJSON(this._queryGeometryType),s=this.layer.fields
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import t from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import a from"../../../../geometry/Extent.js";import{QueryEngine as o}from"../../../../layers/graphics/data/QueryEngine.js";import i from"../../../../rest/support/FeatureSet.js";import u from"../../../../rest/support/Query.js";import{featureGeometryTypeKebabDictionary as y}from"../../../../geometry/support/typeUtils.js";const c=o;let p=class extends t{get layer(){return this.context.layer}get spatialReference(){return this.context.spatialReference}get _queryGeometryType(){switch(this.layer.geometryType){case"multipoint":case"point":case"polygon":case"polyline":return this.layer.geometryType;case"mesh":return"polygon";default:return}}get defaultQueryJSON(){return new u({outSpatialReference:this.spatialReference}).toJSON()}get _dataQueryEngine(){return this._ensureDataQueryEngine()}constructor(e){super(e),this._dataQueryEngineInstance=null}destroy(){this.clear()}clear(){return!!this._dataQueryEngineInstance&&(this._dataQueryEngineInstance.destroy(),this._dataQueryEngineInstance=null,!0)}async executeQueryForIdSet(e,t,r){return this._dataQueryEngine.executeQueryForIdSet(this._ensureQueryJSON(e,t),r)}async executeQueryForCount(e,t){return this._dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),t)}async executeQueryForExtent(e,t){const{count:r,extent:s}=await this._dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),t);return{count:r,extent:a.fromJSON(s)}}async executeQueryForIds(e,t){return this._dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),t)}async executeQueryForLatestObservations(e,t){const r=await this._dataQueryEngine.executeQueryForLatestObservations(this._ensureQueryJSON(e),t),s=i.fromJSON(r);return s.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),s}async executeQuery(e,t){const r=await this._dataQueryEngine.executeQuery(this._ensureQueryJSON(e),t),s=i.fromJSON(r);return s.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),s}_ensureQueryJSON(e,t){let s=this.defaultQueryJSON;if(r(e)&&("outSpatialReference"in e&&!e.outSpatialReference&&(e.outSpatialReference=this.spatialReference),s=e.toJSON()),r(t)){const e=t.geometries.map((e=>e.toJSON())).reduce(((e,t)=>(e.rings=e.rings.concat(t.rings),e)));s={...s,sceneFilter:{...t,geometry:e}}}return s}_ensureDataQueryEngine(){if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e="timeInfo"in this.layer&&this.layer.timeInfo&&this.layer.timeInfo.toJSON()||null,t=this.layer.objectIdField,r=y.toJSON(this._queryGeometryType),s=this.layer.fields?.map((e=>e.toJSON()))??[],n=this.priority,a=this.spatialReference.toJSON(),{hasZ:o,hasM:i,featureStore:u,scheduler:p}=this.context;return this._dataQueryEngineInstance=new c({hasZ:o,hasM:i,geometryType:r,fields:s,timeInfo:e,spatialReference:a,objectIdField:t,featureStore:u,scheduler:p,priority:n}),this._dataQueryEngineInstance}};e([s({constructOnly:!0})],p.prototype,"context",void 0),e([s({constructOnly:!0})],p.prototype,"priority",void 0),e([s()],p.prototype,"layer",null),e([s()],p.prototype,"spatialReference",null),e([s()],p.prototype,"_queryGeometryType",null),e([s()],p.prototype,"defaultQueryJSON",null),p=e([n("esri.views.3d.layers.graphics.QueryEngine")],p);export{p as QueryEngine};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import has from"../../../../core/has.js";import{isNone as
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import has from"../../../../core/has.js";import{destroyMaybe as s,isNone as i}from"../../../../core/maybe.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{PooledRBush as o}from"../../../../core/libs/rbush/PooledRBush.js";import{fromRect as a}from"../../../../geometry/support/aaBoundingBox.js";import{getObjectId as d}from"../../../../layers/graphics/dehydratedFeatures.js";let c=class extends e{constructor(t){super(t),this._index=new o(9,has("esri-csp-restrictions")?t=>({minX:t.extent[0],minY:t.extent[1],maxX:t.extent[2],maxY:t.extent[3]}):[".extent[0]",".extent[1]",".extent[2]",".extent[3]"]),this._missing=new Set,this._boundsByFeature=new Map,this.spatialReference=null,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.updating=!1}setup(t){this._addMany(t)}destroy(){this._missing.clear(),this._index=s(this._index),this._boundsByFeature.clear(),this._boundsByFeature=null}update(){this._missing.size>0&&(this._addMany(Array.from(this._missing.values())),this.updating=!1,this._missing.clear())}get updatingRemaining(){return this._missing.size}queryGraphicUIDsInExtent(t,e,s){!i(e)&&e.equals(this.spatialReference)&&(u.minX=t[0],u.minY=t[1],u.maxX=t[2],u.maxY=t[3],this.update(),this._index.search(u,(t=>s(t.graphic.uid))))}add(t){this._missing.add(t),this.updating=!0}remove(t){if(this._missing.delete(t))return void(this.updating=this._missing.size>0);this._index.remove(t);const e=d(t.graphic,this._get("objectIdField"));null!=e&&this._boundsByFeature.delete(e)}_addMany(t){if(0===t.length)return;const e=this._get("objectIdField");for(const s of t){s.computeExtent(this.spatialReference);const t=d(s.graphic,e);null!=t&&this._boundsByFeature.set(t,s.extent)}this._index.load(t)}clear(){this._index.clear(),this._missing.clear(),this._boundsByFeature.clear(),this.updating=!1}forEachInBounds(t,e){u.minX=t[0],u.minY=t[1],u.maxX=t[2],u.maxY=t[3],this.update(),this._index.search(u,(t=>{e(t)}))}getBounds(t,e){this.update();const s=this._boundsByFeature.get(t);return s?a(e,s):null}};t([r({constructOnly:!0})],c.prototype,"spatialReference",void 0),t([r({constructOnly:!0})],c.prototype,"hasZ",void 0),t([r({constructOnly:!0})],c.prototype,"hasM",void 0),t([r({constructOnly:!0})],c.prototype,"objectIdField",void 0),t([r()],c.prototype,"updating",void 0),t([r({readOnly:!0})],c.prototype,"updatingRemaining",null),c=t([n("esri.views.3d.layers.graphics.SpatialIndex2D")],c);const u={minX:0,minY:0,maxX:0,maxY:0};export{c as SpatialIndex2D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{unwrapOr as e}from"../../../../core/maybe.js";import{c as t}from"../../../../chunks/mat4.js";import{c as n}from"../../../../chunks/mat4f64.js";import{c as o}from"../../../../chunks/vec3f64.js";import{projectBuffer as r,computeTranslationToOriginAndRotation as i}from"../../../../geometry/projection.js";import{isDehydratedPoint as s}from"../../../../layers/graphics/dehydratedFeatureUtils.js";import{updateVertexAttributeAuxpos1w as a}from"./graphicUtils.js";import{isSamplePosition as l,getElevationAtPoint as u}from"../../support/ElevationProvider.js";function c(e,t,n,o,i,s,a,l,u,c,f){const d=x[f.mode];let m,p,g=0;if(r(e,t,n,o,u.spatialReference,i,l))return d.requiresAlignment(f)?(g=d.applyElevationAlignmentBuffer(o,i,s,a,l,u,c,f),m=s,p=a):(m=o,p=i),r(m,u.spatialReference,p,s,c.spatialReference,a,l)?g:void 0}function f(t,n,o,r,i){const a=(s(t)?t.z:l(t)?t.array[t.offset+2]:t[2])||0;switch(o.mode){case"on-the-ground":{const o=e(u(n,t,"ground"),0);return i.verticalDistanceToGround=0,i.sampledElevation=o,void(i.z=o)}case"relative-to-ground":{const s=e(u(n,t,"ground"),0),l=o.geometryZWithOffset(a,r);return i.verticalDistanceToGround=l,i.sampledElevation=s,void(i.z=l+s)}case"relative-to-scene":{const s=e(u(n,t,"scene"),0),l=o.geometryZWithOffset(a,r);return i.verticalDistanceToGround=l,i.sampledElevation=s,void(i.z=l+s)}case"absolute-height":{const s=o.geometryZWithOffset(a,r),l=e(u(n,t,"ground"),0);return i.verticalDistanceToGround=s-l,i.sampledElevation=l,void(i.z=s)}default:return void(i.z=0)}}function d(e,t,n,o){return f(e,t,n,o,z),z.z}function m(e,t,n){return null==t||null==n?e.definedChanged:"on-the-ground"===t&&"on-the-ground"===n?e.staysOnTheGround:t===n||"on-the-ground"!==t&&"on-the-ground"!==n?j.UPDATE:e.onTheGroundChanged}function p(e){return"relative-to-ground"===e||"relative-to-scene"===e}function g(e){return"absolute-height"!==e}function v(e,n,o,r,s){f(n,o,s,r,z),a(e,z.verticalDistanceToGround);const l=z.sampledElevation,u=t(O,e.transformation);C[0]=n.x,C[1]=n.y,C[2]=z.z;return i(n.spatialReference,C,u,r.spatialReference)?e.transformation=u:console.warn("Could not locate symbol object properly, it might be misplaced"),l}function h(t,n,o,r,i,s){let a=0;const l=s.spatialReference;n*=3,r*=3;for(let u=0;u<i;++u){const i=t[n+0],u=t[n+1],c=t[n+2],f=e(s.getElevation(i,u,c,l,"ground"),0);a+=f,o[r+0]=i,o[r+1]=u,o[r+2]=f,n+=3,r+=3}return a/i}function E(t,n,o,r,i,s,a,l){let u=0;const c=l.calculateOffsetRenderUnits(a),f=l.featureExpressionInfoContext,d=s.spatialReference;n*=3,r*=3;for(let m=0;m<i;++m){const i=t[n+0],a=t[n+1],l=t[n+2],m=e(s.getElevation(i,a,l,d,"ground"),0);u+=m,o[r+0]=i,o[r+1]=a,o[r+2]=null==f?l+m+c:m+c,n+=3,r+=3}return u/i}function y(t,n,o,r,i,s,a,l){let u=0;const c=l.calculateOffsetRenderUnits(a),f=l.featureExpressionInfoContext,d=s.spatialReference;n*=3,r*=3;for(let m=0;m<i;++m){const i=t[n+0],a=t[n+1],l=t[n+2],m=e(s.getElevation(i,a,l,d,"scene"),0);u+=m,o[r+0]=i,o[r+1]=a,o[r+2]=null==f?l+m+c:m+c,n+=3,r+=3}return u/i}function A(e){const t=e.meterUnitOffset,n=e.featureExpressionInfoContext;return 0!==t||null!=n}function R(e,t,n,o,r,i,s,a){const l=a.calculateOffsetRenderUnits(s),u=a.featureExpressionInfoContext;t*=3,o*=3;for(let c=0;c<r;++c){const r=e[t+0],i=e[t+1],s=e[t+2];n[o+0]=r,n[o+1]=i,n[o+2]=null==u?s+l:l,t+=3,o+=3}return 0}class T{constructor(){this.verticalDistanceToGround=0,this.sampledElevation=0,this.z=0}}var j;!function(e){e[e.NONE=0]="NONE",e[e.UPDATE=1]="UPDATE",e[e.RECREATE=2]="RECREATE"}(j||(j={}));const x={"absolute-height":{applyElevationAlignmentBuffer:R,requiresAlignment:A},"on-the-ground":{applyElevationAlignmentBuffer:h,requiresAlignment:()=>!0},"relative-to-ground":{applyElevationAlignmentBuffer:E,requiresAlignment:()=>!0},"relative-to-scene":{applyElevationAlignmentBuffer:y,requiresAlignment:()=>!0}},O=n(),z=new T,C=o();export{T as SampleElevationInfo,j as SymbolUpdateType,v as applyElevationAlignmentForHUD,c as applyPerVertexElevationAlignment,m as elevationModeChangeUpdateType,d as evaluateElevationAlignmentAtPoint,f as evaluateElevationInfoAtPoint,p as needsElevationUpdates2D,g as needsElevationUpdates3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Logger.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{hydrateGeometry as r}from"../../../../layers/graphics/hydratedFeatures.js";import{loadArcade as n}from"../../../../support/arcadeOnDemand.js";const c=e.getLogger("esri.views.3d.layers.graphics.featureExpressionInfoUtils");function o(e){return{cachedResult:e.cachedResult,arcade:e.arcade?{func:e.arcade.func,context:e.arcade.modules.arcadeUtils.createExecContext(null,{sr:e.arcade.context.spatialReference}),modules:e.arcade.modules}:null}}function
|
|
5
|
+
import e from"../../../../core/Logger.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{hydrateGeometry as r}from"../../../../layers/graphics/hydratedFeatures.js";import{loadArcade as n}from"../../../../support/arcadeOnDemand.js";const c=e.getLogger("esri.views.3d.layers.graphics.featureExpressionInfoUtils");function o(e){return{cachedResult:e.cachedResult,arcade:e.arcade?{func:e.arcade.func,context:e.arcade.modules.arcadeUtils.createExecContext(null,{sr:e.arcade.context.spatialReference}),modules:e.arcade.modules}:null}}function u(e){const t=e&&e.expression;if("string"==typeof t){const e=m(t);if(null!=e)return{cachedResult:e}}return null}async function a(e,r,c,o){const u=e&&e.expression;if("string"!=typeof u)return null;const a=m(u);if(null!=a)return{cachedResult:a};const s=await n();t(c);const l=s.arcadeUtils,i=l.createSyntaxTree(u);return l.dependsOnView(i)?(null!=o&&o.error("Expressions containing '$view' are not supported on ElevationInfo"),{cachedResult:0}):{arcade:{func:l.createFunction(i),context:l.createExecContext(null,{sr:r}),modules:s}}}function s(e,t,r){return e.arcadeUtils.createFeature(t.attributes,t.geometry,r)}function l(e,t){if(null!=e&&!p(e)){if(!t||!e.arcade)return void c.errorOncePerTick("Arcade support required but not provided");const n=t;n._geometry&&(n._geometry=r(n._geometry)),e.arcade.modules.arcadeUtils.updateExecContext(e.arcade.context,t)}}function i(e){if(null!=e){if(p(e))return e.cachedResult;const t=e.arcade;let r=t?.modules.arcadeUtils.executeFunction(t.func,t.context);return"number"!=typeof r&&(e.cachedResult=0,r=0),r}return 0}function d(e,t=!1){let r=e&&e.featureExpressionInfo;const n=r&&r.expression;return t||"0"===n||(r=null),r??null}const f={cachedResult:0};function p(e){return null!=e.cachedResult}function m(e){return"0"===e?0:null}export{o as clone,a as createContext,u as createContextWithoutExpressionSupport,s as createFeature,i as execute,d as extractExpressionInfo,l as setContextFeature,f as zeroContext};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as t,isNone as e}from"../../../../core/maybe.js";import{getMetersPerUnitForSR as r}from"../../../../core/unitUtils.js";import{o as n,r as o,n as i}from"../../../../chunks/mat4.js";import{c as s}from"../../../../chunks/mat4f64.js";import{d as u,O as a}from"../../../../chunks/vec3f64.js";import{s as m}from"../../../../chunks/vec4.js";import{d as l,O as c}from"../../../../chunks/vec4f64.js";import{projectPoint as f}from"../../../../geometry/projection.js";import{width as p,depth as h,height as g}from"../../../../geometry/support/aaBoundingBox.js";import{create as y}from"../../../../geometry/support/aaBoundingRect.js";import{ringsCentroid as d}from"../../../../geometry/support/centroid.js";import{getPointOnPath as x,getPathLength as j}from"../../../../geometry/support/coordsUtils.js";import{makeDehydratedPoint as b}from"../../../../layers/graphics/dehydratedFeatures.js";import{isHydratedGeometry as v,clonePoint as w}from"../../../../layers/graphics/hydratedFeatures.js";import{VertexAttribute as
|
|
5
|
+
import{isSome as t,isNone as e}from"../../../../core/maybe.js";import{getMetersPerUnitForSR as r}from"../../../../core/unitUtils.js";import{o as n,r as o,n as i}from"../../../../chunks/mat4.js";import{c as s}from"../../../../chunks/mat4f64.js";import{d as u,O as a}from"../../../../chunks/vec3f64.js";import{s as m}from"../../../../chunks/vec4.js";import{d as l,O as c}from"../../../../chunks/vec4f64.js";import{projectPoint as f}from"../../../../geometry/projection.js";import{width as p,depth as h,height as g}from"../../../../geometry/support/aaBoundingBox.js";import{create as y}from"../../../../geometry/support/aaBoundingRect.js";import{ringsCentroid as d}from"../../../../geometry/support/centroid.js";import{getPointOnPath as x,getPathLength as j}from"../../../../geometry/support/coordsUtils.js";import{makeDehydratedPoint as b}from"../../../../layers/graphics/dehydratedFeatures.js";import{isHydratedGeometry as v,clonePoint as w}from"../../../../layers/graphics/hydratedFeatures.js";import{VertexAttribute as z}from"../../webgl-engine/lib/VertexAttribute.js";function A(t,e){if("point"===t.type)return P(t,e,!1);if(v(t))switch(t.type){case"extent":return P(t.center,e,!1);case"polygon":return P(t.centroid,e,!1);case"polyline":return P(M(t),e,!0);case"mesh":return P(t.origin,e,!1)}else switch(t.type){case"extent":return P(R(t),e,!0);case"polygon":return P(F(t),e,!0);case"polyline":return P(M(t),e,!0)}}function M(t){const e=t.paths[0];if(!e||0===e.length)return null;const r=x(e,j(e)/2);return b(r[0],r[1],r[2],t.spatialReference)}function R(t){return b(.5*(t.xmax+t.xmin),.5*(t.ymax+t.ymin),null!=t.zmin&&null!=t.zmax&&isFinite(t.zmin)&&isFinite(t.zmax)?.5*(t.zmax+t.zmin):void 0,t.spatialReference)}function F(t){const e=t.rings[0];if(!e||0===e.length)return null;const r=d(t.rings,!!t.hasZ);return b(r[0],r[1],r[2],t.spatialReference)}function P(t,e,r){const n=r?t:w(t);return e&&t?f(t,n,e)?n:null:n}function k(t,e,r,n=0){if(t){e||(e=y());const o=t;let i=.5*o.width*(r-1),s=.5*o.height*(r-1);return o.width<1e-7*o.height?i+=s/20:o.height<1e-7*o.width&&(s+=i/20),m(e,o.xmin-i-n,o.ymin-s-n,o.xmax+i+n,o.ymax+s+n),e}return null}function U(t,e){for(let r=0;r<t.geometries.length;++r){const n=t.geometries[r].getMutableAttribute(z.AUXPOS1);n&&n.data[3]!==e&&(n.data[3]=e,t.geometryVertexAttrsUpdated(t.geometries[r]))}}function B(e,r){const n=l(c);return t(e)&&(n[0]=e[0],n[1]=e[1],n[2]=e[2]),t(r)?n[3]=r:t(e)&&e.length>3&&(n[3]=e[3]),n}function D(e,r,n,o,i,s=[0,0,0,0]){for(let u=0;u<3;++u)t(e)&&null!=e[u]?s[u]=e[u]:t(n)&&null!=n[u]?s[u]=n[u]:s[u]=i[u];return t(r)?s[3]=r:t(o)?s[3]=o:s[3]=i[3],s}function I(t=a,r,n,o=1){const i=new Array(3);if(e(r)||e(n))i[0]=1,i[1]=1,i[2]=1;else{let e,o=0;for(let s=2;s>=0;s--){const u=t[s];let a;const m=null!=u,l=0===s&&!e&&!m,c=n[s];"symbol-value"===u||l?a=0!==c?r[s]/c:1:m&&"proportional"!==u&&isFinite(u)&&(a=0!==c?u/c:1),null!=a&&(i[s]=a,e=a,o=Math.max(o,Math.abs(a)))}for(let t=2;t>=0;t--)null==i[t]?i[t]=e:0===i[t]&&(i[t]=.001*o)}for(let e=2;e>=0;e--)i[e]/=o;return u(i)}function O(t){return null!=t.isPrimitive}function S(t){return V(O(t)?[t.width,t.depth,t.height]:t)?null:"Symbol sizes may not be negative values"}function V(t){if(Array.isArray(t)){for(const e of t)if(!V(e))return!1;return!0}return null==t||t>=0}function G(t,e,r,u=s()){const a=t||0,m=e||0,l=r||0;return 0!==a&&n(u,u,-a/180*Math.PI),0!==m&&o(u,u,m/180*Math.PI),0!==l&&i(u,u,l/180*Math.PI),u}function X(t,e,n){if(null!=n.minDemResolution)return n.minDemResolution;const o=r(e),i=p(t)*o,s=h(t)*o,u=g(t)*(e.isGeographic?1:o);return 0===i&&0===s&&0===u?n.minDemResolutionForPoints:.01*Math.max(i,s,u)}export{A as computeCentroid,G as computeObjectRotation,I as computeObjectScale,X as demResolutionForBoundingBox,k as enlargeExtent,V as isValidSize,B as mixinColorAndOpacity,D as overrideColor,U as updateVertexAttributeAuxpos1w,S as validateSymbolLayerSize};
|