@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{adjustStaticAGOUrl as e}from"../../../../core/devEnvironmentUtils.js";import{get as t,isSome as r,isNone as o}from"../../../../core/maybe.js";import{b as s}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a as n}from"../../../../chunks/mat4.js";import{c as a}from"../../../../chunks/mat4f64.js";import{m as u,b as l,C as c,l as m,n as f,h as d}from"../../../../chunks/vec3.js";import{c as p}from"../../../../chunks/vec3f64.js";import{empty as g,expandWithVec3 as b}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as x,BufferViewVec4f as h,BufferViewVec2f as T,BufferViewVec4u8 as R,BufferViewVec4u16 as w,BufferViewVec3u8 as j,BufferViewVec3u16 as M}from"../../../../geometry/support/buffer/BufferView.js";import{t as v,a as y,s as B}from"../../../../chunks/vec32.js";import{t as L,s as C}from"../../../../chunks/vec42.js";import{createBuffer as I}from"../../../../geometry/support/buffer/utils.js";import{DefaultLoadingContext as A}from"../../glTF/DefaultLoadingContext.js";import{loadGLTF as O}from"../../glTF/loader.js";import{triangleFanToTriangles as S,triangleStripToTriangles as E,trianglesToTriangles as N}from"../../glTF/internal/indexUtils.js";import{getTransformMatrix as k}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as F}from"./ProcessedObjectResource.js";import{load as P,processLoadResult as V}from"./wosrLoader.js";import{NormalAttributeType as _}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as G}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as D,DepthTestFunction as U,CullFaceOptions as H}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as q}from"../../webgl-engine/lib/Geometry.js";import{Texture as W}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as $}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as z}from"../../webgl-engine/materials/DefaultMaterial.js";import{COLOR_GAMMA as K}from"../../webgl-engine/materials/DefaultMaterial_COLOR_GAMMA.js";import{PrimitiveType as Q}from"../../../webgl/enums.js";import{n as J}from"../../../../chunks/vec22.js";import{c as X,f as Y}from"../../../../chunks/vec43.js";import{c as Z}from"../../../../chunks/vec33.js";async function ee(o,s){const i=te(e(o));if("wosr"===i.fileType){const e=await(s.cache?s.cache.loadWOSR(i.url,s):P(i.url,s)),{engineResources:t,referenceBoundingBox:r}=V(e,s);return{lods:t,referenceBoundingBox:r,isEsriSymbolResource:!1,isWosr:!0}}const n=await(s.cache?s.cache.loadGLTF(i.url,s
|
|
5
|
+
import{adjustStaticAGOUrl as e}from"../../../../core/devEnvironmentUtils.js";import{get as t,isSome as r,isNone as o}from"../../../../core/maybe.js";import{b as s}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a as n}from"../../../../chunks/mat4.js";import{c as a}from"../../../../chunks/mat4f64.js";import{m as u,b as l,C as c,l as m,n as f,h as d}from"../../../../chunks/vec3.js";import{c as p}from"../../../../chunks/vec3f64.js";import{empty as g,expandWithVec3 as b}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as x,BufferViewVec4f as h,BufferViewVec2f as T,BufferViewVec4u8 as R,BufferViewVec4u16 as w,BufferViewVec3u8 as j,BufferViewVec3u16 as M}from"../../../../geometry/support/buffer/BufferView.js";import{t as v,a as y,s as B}from"../../../../chunks/vec32.js";import{t as L,s as C}from"../../../../chunks/vec42.js";import{createBuffer as I}from"../../../../geometry/support/buffer/utils.js";import{DefaultLoadingContext as A}from"../../glTF/DefaultLoadingContext.js";import{loadGLTF as O}from"../../glTF/loader.js";import{triangleFanToTriangles as S,triangleStripToTriangles as E,trianglesToTriangles as N}from"../../glTF/internal/indexUtils.js";import{getTransformMatrix as k}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as F}from"./ProcessedObjectResource.js";import{load as P,processLoadResult as V}from"./wosrLoader.js";import{NormalAttributeType as _}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as G}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as D,DepthTestFunction as U,CullFaceOptions as H}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as q}from"../../webgl-engine/lib/Geometry.js";import{Texture as W}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as $}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as z}from"../../webgl-engine/materials/DefaultMaterial.js";import{COLOR_GAMMA as K}from"../../webgl-engine/materials/DefaultMaterial_COLOR_GAMMA.js";import{PrimitiveType as Q}from"../../../webgl/enums.js";import{n as J}from"../../../../chunks/vec22.js";import{c as X,f as Y}from"../../../../chunks/vec43.js";import{c as Z}from"../../../../chunks/vec33.js";async function ee(o,s){const i=te(e(o));if("wosr"===i.fileType){const e=await(s.cache?s.cache.loadWOSR(i.url,s):P(i.url,s)),{engineResources:t,referenceBoundingBox:r}=V(e,s);return{lods:t,referenceBoundingBox:r,isEsriSymbolResource:!1,isWosr:!0}}const n=await(s.cache?s.cache.loadGLTF(i.url,s,!!s.usePBR):O(new A(s.streamDataRequester),i.url,s,s.usePBR)),a=t(n.model.meta,"ESRI_proxyEllipsoid"),u=n.meta.isEsriSymbolResource&&r(a)&&n.meta.uri.includes("/RealisticTrees/");u&&!n.customMeta.esriTreeRendering&&(n.customMeta.esriTreeRendering=!0,ue(n,a));const l=!!s.usePBR,c=n.meta.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:u,mrrFactors:[0,1,.2]}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:[0,1,.5]},m={...s.materialParamsMixin,treeRendering:u},{engineResources:f,referenceBoundingBox:d}=re(n,c,m,s.skipHighLods&&null==i.specifiedLodIndex?{skipHighLods:!0}:{skipHighLods:!1,singleLodIndex:i.specifiedLodIndex});return{lods:f,referenceBoundingBox:d,isEsriSymbolResource:n.meta.isEsriSymbolResource,isWosr:!1}}function te(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(t)return{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function re(e,t,o,s){const i=e.model,n=new Array,a=new Map,u=new Map,l=i.lods.length,c=g();return i.lods.forEach(((e,m)=>{const f=!0===s.skipHighLods&&(l>1&&0===m||l>3&&1===m)||!1===s.skipHighLods&&null!=s.singleLodIndex&&m!==s.singleLodIndex;if(f&&0!==m)return;const d=new F(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach((e=>{const s=f?new z({}):oe(i,e,d,t,o,a,u),{geometry:n,vertexCount:l}=se(e,r(s)?s:new z({})),p=n.boundingInfo;r(p)&&0===m&&(b(c,p.bbMin),b(c,p.bbMax)),r(s)&&(d.stageResources.geometries.push(n),d.numberOfVertices+=l)})),f||n.push(d)})),{engineResources:n,referenceBoundingBox:c}}function oe(e,t,s,i,n,a,u){const l=t.material+(t.attributes.normal?"_normal":"")+(t.attributes.color?"_color":"")+(t.attributes.texCoord0?"_texCoord0":"")+(t.attributes.tangent?"_tangent":""),c=e.materials.get(t.material),m=r(t.attributes.texCoord0),f=r(t.attributes.normal);if(o(c))return null;const d=ne(c.alphaMode);if(!a.has(l)){if(m){const t=(t,o=!1)=>{if(r(t)&&!u.has(t)){const s=e.textures.get(t);r(s)&&u.set(t,new W(s.data,o?{...s.parameters,preMultiplyAlpha:o}:s.parameters))}};t(c.textureColor,d!==D.Opaque),t(c.textureNormal),t(c.textureOcclusion),t(c.textureEmissive),t(c.textureMetallicRoughness)}const o=c.color[0]**(1/K),s=c.color[1]**(1/K),p=c.color[2]**(1/K),g=c.emissiveFactor[0]**(1/K),b=c.emissiveFactor[1]**(1/K),x=c.emissiveFactor[2]**(1/K),h=r(c.textureColor)&&m?u.get(c.textureColor):null;a.set(l,new z({...i,transparent:d===D.Blend,customDepthTest:U.Lequal,textureAlphaMode:d,textureAlphaCutoff:c.alphaCutoff,diffuse:[o,s,p],ambient:[o,s,p],opacity:c.opacity,doubleSided:c.doubleSided,doubleSidedType:"winding-order",cullFace:c.doubleSided?H.None:H.Back,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:f?_.Attribute:_.ScreenDerivative,castShadows:!0,receiveSSAO:!0,textureId:r(h)?h.id:void 0,colorMixMode:c.colorMixMode,normalTextureId:r(c.textureNormal)&&m?u.get(c.textureNormal).id:void 0,textureAlphaPremultiplied:r(h)&&!!h.params.preMultiplyAlpha,occlusionTextureId:r(c.textureOcclusion)&&m?u.get(c.textureOcclusion).id:void 0,emissiveTextureId:r(c.textureEmissive)&&m?u.get(c.textureEmissive).id:void 0,metallicRoughnessTextureId:r(c.textureMetallicRoughness)&&m?u.get(c.textureMetallicRoughness).id:void 0,emissiveFactor:[g,b,x],mrrFactors:[c.metallicFactor,c.roughnessFactor,i.mrrFactors[2]],isSchematic:!1,colorTextureTransformMatrix:k(c.colorTextureTransform),normalTextureTransformMatrix:k(c.normalTextureTransform),occlusionTextureTransformMatrix:k(c.occlusionTextureTransform),emissiveTextureTransformMatrix:k(c.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:k(c.metallicRoughnessTextureTransform),...n}))}const p=a.get(l);if(s.stageResources.materials.push(p),m){const e=e=>{r(e)&&s.stageResources.textures.push(u.get(e))};e(c.textureColor),e(c.textureNormal),e(c.textureOcclusion),e(c.textureEmissive),e(c.textureMetallicRoughness)}return p}function se(e,t){const o=e.attributes.position.count,i=ae(e.indices||o,e.primitiveType),n=I(x,o);v(n,e.attributes.position,e.transform);const a=[[$.POSITION,new G(n.typedBuffer,n.elementCount,!0)]],u=[[$.POSITION,i]];if(r(e.attributes.normal)){const t=I(x,o);s(ie,e.transform),y(t,e.attributes.normal,ie),a.push([$.NORMAL,new G(t.typedBuffer,t.elementCount,!0)]),u.push([$.NORMAL,i])}if(r(e.attributes.tangent)){const t=I(h,o);s(ie,e.transform),L(t,e.attributes.tangent,ie),a.push([$.TANGENT,new G(t.typedBuffer,t.elementCount,!0)]),u.push([$.TANGENT,i])}if(r(e.attributes.texCoord0)){const t=I(T,o);J(t,e.attributes.texCoord0),a.push([$.UV0,new G(t.typedBuffer,t.elementCount,!0)]),u.push([$.UV0,i])}if(r(e.attributes.color)){const t=I(R,o);if(4===e.attributes.color.elementCount)e.attributes.color instanceof h?C(t,e.attributes.color,255):e.attributes.color instanceof R?X(t,e.attributes.color):e.attributes.color instanceof w&&C(t,e.attributes.color,1/256);else{Y(t,255,255,255,255);const r=new j(t.buffer,0,4);e.attributes.color instanceof x?B(r,e.attributes.color,255):e.attributes.color instanceof j?Z(r,e.attributes.color):e.attributes.color instanceof M&&B(r,e.attributes.color,1/256)}a.push([$.COLOR,new G(t.typedBuffer,t.elementCount,!0)]),u.push([$.COLOR,i])}return{geometry:new q(t,a,u),vertexCount:o}}const ie=i();function ne(e){switch(e){case"BLEND":return D.Blend;case"MASK":return D.Mask;case"OPAQUE":case null:case void 0:return D.Opaque}}function ae(e,t){switch(t){case Q.TRIANGLES:return N(e);case Q.TRIANGLE_STRIP:return E(e);case Q.TRIANGLE_FAN:return S(e)}}function ue(e,t){for(let r=0;r<e.model.lods.length;++r){const s=e.model.lods[r];for(const i of s.parts){const s=i.attributes.normal;if(o(s))return;const g=i.attributes.position,b=g.count,h=p(),T=p(),w=p(),j=I(R,b),M=I(x,b),v=n(a(),i.transform);for(let o=0;o<b;o++){g.getVec(o,T),s.getVec(o,h),u(T,T,i.transform),l(w,T,t.center),c(w,w,t.radius);const n=w[2],a=m(w),p=Math.min(.45+.55*a*a,1);c(w,w,t.radius),null!==v&&u(w,w,v),f(w,w),r+1!==e.model.lods.length&&e.model.lods.length>1&&d(w,w,h,n>-1?.2:Math.min(-4*n-3.8,1)),M.setVec(o,w),j.set(o,0,255*p),j.set(o,1,255*p),j.set(o,2,255*p),j.set(o,3,255)}i.attributes.normal=M,i.attributes.color=j}}}export{ee as fetch,re as gltfToEngineResources,te as parseUrl};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isNone as e,isSome as n}from"../../../../core/maybe.js";import{throwIfAborted as r}from"../../../../core/promiseUtils.js";import{loadArcade as t}from"../../../../support/arcadeOnDemand.js";async function a(a,o,i){if(e(a)||0===o.candidates.length)return s;const c=a.graphics3DGraphicsByObjectID??a.graphics3DGraphics,p=[],d=[],{renderer:u}=a,g=n(u)&&"arcadeRequired"in u&&u.arcadeRequired?t():null,l=async(n,{graphic:r,graphics3DSymbol:t})=>{const s=await g,o=await a.getRenderingInfoAsync(r,u,s,{signal:i});return e(o)?[]:t.queryForSnapping(n,f,o,i)},{candidates:h,spatialReference:f}=o;for(let n=0;n<h.length;++n){const r=h[n],{objectId:t}=r,a="number"==typeof t?c
|
|
5
|
+
import{isNone as e,isSome as n}from"../../../../core/maybe.js";import{throwIfAborted as r}from"../../../../core/promiseUtils.js";import{loadArcade as t}from"../../../../support/arcadeOnDemand.js";async function a(a,o,i){if(e(a)||0===o.candidates.length)return s;const c=a.graphics3DGraphicsByObjectID??a.graphics3DGraphics,p=[],d=[],{renderer:u}=a,g=n(u)&&"arcadeRequired"in u&&u.arcadeRequired?t():null,l=async(n,{graphic:r,graphics3DSymbol:t})=>{const s=await g,o=await a.getRenderingInfoAsync(r,u,s,{signal:i});return e(o)?[]:t.queryForSnapping(n,f,o,i)},{candidates:h,spatialReference:f}=o;for(let n=0;n<h.length;++n){const r=h[n],{objectId:t}=r,a="number"==typeof t?c?.get(t):void 0;if(e(a))continue;const{graphics3DSymbol:s}=a;s.symbologySnappingSupported&&(p.push(l(r,a)),d.push(n))}if(0===p.length)return s;const m=await Promise.all(p);r(i);const y=[],b=[];for(let e=0;e<m.length;++e){const n=m[e],r=d[e];for(const e of n)y.push(e),b.push(r)}return{candidates:y,sourceCandidateIndices:b}}const s={candidates:[],sourceCandidateIndices:[]};export{a as queryForSymbologySnapping};
|
|
@@ -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{neverReached as e}from"../../../../core/compilerUtils.js";import{isNone as r,isSome as t}from"../../../../core/maybe.js";import{defaultPrimitive as a}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{PATH_NUM_ROUND_CAP_EXTRUSION_SUBDIVISIONS as s,PATH_NUM_CIRCLE_PROFILE_SUBDIVISIONS as i,PATH_NUM_ROUND_JOIN_SUBDIVISIONS as o}from"./Graphics3DPathSymbolLayerConstants.js";import{primitiveLodResources as u}from"./primitiveObjectSymbolUtils.js";import{hasEdges as b}from"../support/edgeUtils.js";import{VertexAttribute as y}from"../../webgl-engine/lib/VertexAttribute.js";import{geometriesFromLodLevelResources as P}from"../../webgl-engine/lib/lodRendering/LodResources.js";const d={primitivesPerFeature:0,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!0,memory:{bytesPerFeature:0,bytesPerCoordinate:0,bytesPerFeatureLabel:0,resourceBytes:0,draped:{bytesPerFeature:0,bytesPerFeatureLabel:0,bytesPerCoordinate:0}}};function
|
|
5
|
+
import{neverReached as e}from"../../../../core/compilerUtils.js";import{isNone as r,isSome as t}from"../../../../core/maybe.js";import{defaultPrimitive as a}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{PATH_NUM_ROUND_CAP_EXTRUSION_SUBDIVISIONS as s,PATH_NUM_CIRCLE_PROFILE_SUBDIVISIONS as i,PATH_NUM_ROUND_JOIN_SUBDIVISIONS as o}from"./Graphics3DPathSymbolLayerConstants.js";import{primitiveLodResources as u}from"./primitiveObjectSymbolUtils.js";import{hasEdges as b}from"../support/edgeUtils.js";import{VertexAttribute as y}from"../../webgl-engine/lib/VertexAttribute.js";import{geometriesFromLodLevelResources as P}from"../../webgl-engine/lib/lodRendering/LodResources.js";const d={primitivesPerFeature:0,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!0,memory:{bytesPerFeature:0,bytesPerCoordinate:0,bytesPerFeatureLabel:0,resourceBytes:0,draped:{bytesPerFeature:0,bytesPerFeatureLabel:0,bytesPerCoordinate:0}}};function m(e){if("web-style"===e.type)return d;return n(e.symbolLayers.toArray().map((r=>c(e,r))))}function n(e){let t=0,a=0,s=0,i=!1,o=0;const u={bytesPerFeature:0,bytesPerFeatureLabel:0,bytesPerCoordinate:0,resourceBytes:0,draped:{bytesPerFeature:0,bytesPerFeatureLabel:0,bytesPerCoordinate:0}};for(const b of e)r(b)||(t+=b.primitivesPerFeature,a+=b.primitivesPerCoordinate,s+=b.drawCallsPerFeature,u.bytesPerFeature+=b.memory.bytesPerFeature,u.bytesPerFeatureLabel+=b.memory.bytesPerFeatureLabel,u.bytesPerCoordinate+=b.memory.bytesPerCoordinate,u.resourceBytes+=b.memory.resourceBytes,u.draped.bytesPerFeature+=b.memory.bytesPerFeature,u.draped.bytesPerFeatureLabel+=b.memory.bytesPerFeatureLabel,u.draped.bytesPerCoordinate+=b.memory.bytesPerCoordinate,i=i||b.estimated,++o);return{primitivesPerFeature:t,primitivesPerCoordinate:a,drawCallsPerFeature:s,estimated:i,memory:u,numComplexities:o}}function l(e){const r=n(e);return r.numComplexities>0&&(r.primitivesPerFeature/=r.numComplexities,r.primitivesPerCoordinate/=r.numComplexities,r.drawCallsPerFeature/=r.numComplexities,r.memory.bytesPerFeature/=r.numComplexities,r.memory.bytesPerFeatureLabel/=r.numComplexities,r.memory.bytesPerCoordinate/=r.numComplexities,r.memory.resourceBytes/=r.numComplexities,r.memory.draped.bytesPerFeature/=r.numComplexities,r.memory.draped.bytesPerFeatureLabel/=r.numComplexities,r.memory.draped.bytesPerCoordinate/=r.numComplexities),r}const F={};function c(r,u){const y=p(r,u),P=b(u)?2:0;switch(u.type){case"extrude":return{primitivesPerFeature:-4,primitivesPerCoordinate:4,drawCallsPerFeature:P,estimated:!1,memory:y};case"fill":return"mesh-3d"===r.type?{primitivesPerFeature:0,primitivesPerCoordinate:0,drawCallsPerFeature:P,estimated:!1,memory:y}:t(u.outline)&&u.outline.size>0?{primitivesPerFeature:-4,primitivesPerCoordinate:3,drawCallsPerFeature:0,estimated:!1,memory:y}:{primitivesPerFeature:-2,primitivesPerCoordinate:1,drawCallsPerFeature:0,estimated:!1,memory:y};case"water":return{primitivesPerFeature:-2,primitivesPerCoordinate:1,drawCallsPerFeature:0,estimated:!1,memory:y};case"line":return{primitivesPerFeature:-2,primitivesPerCoordinate:2,drawCallsPerFeature:0,estimated:!1,memory:y};case"object":if(u.resource&&u.resource.href)return{primitivesPerFeature:16,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!0,memory:y};return{...C(u.resource&&u.resource.primitive||a),memory:y};case"path":{let r=0,t=0;switch(u.profile){case"circle":r=i;break;case"quad":r=4;break;default:return void e(u.profile)}switch(u.join??"simple"){case"round":t=o;break;case"miter":case"bevel":t=1;break;default:return}const a=2*r,b=r*t*2;let P=-2*b-a;switch(u.cap){case"none":break;case"butt":case"square":P+=2*(r-1);break;case"round":P+=2*(r*(s-1)*2+r);break;default:return}return{primitivesPerFeature:P,primitivesPerCoordinate:b+a,drawCallsPerFeature:0,estimated:!1,memory:y}}case"text":case"icon":return{primitivesPerFeature:2,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1,memory:y};default:return}}function p(r,a){const s="point-3d"===r.type;switch(a.type){case"extrude":return a.edges&&a.edges.size>0?L.EXTRUDE_EDGES:L.EXTRUDE;case"fill":return t(a.outline)&&a.outline.size>0?L.FILL_OUTLINE:L.FILL;case"water":return L.FILL;case"line":return"round"===a.join?L.LINE_ROUND:L.LINE_MITER;case"path":switch(a.join){case"round":switch(a.profile){case"circle":return L.PATH_ROUND_CIRCLE;case"quad":return L.PATH_ROUND_QUAD;default:return void e(a.profile)}case"miter":case"bevel":switch(a.profile){case"circle":return L.PATH_MITER_CIRCLE;case"quad":return L.PATH_MITER_QUAD;default:return void e(a.profile)}default:return}case"object":return s?L.OBJECT_POINT:L.OBJECT_POLYGON;case"icon":case"text":return s?L.ICON_POINT:L.ICON_POLYGON;default:return}}function C(e){let r=F[e];if(r)return r;const t=u(e,null);return r={primitivesPerFeature:P(t.levels[0]).reduce(((e,r)=>e+r.indices.get(y.POSITION).length/3),0),primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1},F[e]=r,r}const L={ICON_POINT:{bytesPerFeature:3380.2751699716728,bytesPerFeatureLabel:991.0342814814816,bytesPerCoordinate:0,resourceBytes:0,draped:{bytesPerFeature:2406.8302946175645,bytesPerFeatureLabel:986.2135111111111,bytesPerCoordinate:0}},ICON_POLYGON:{bytesPerFeature:4359.764126212755,bytesPerFeatureLabel:994.1692592592592,bytesPerCoordinate:25.81480763374183,resourceBytes:0,draped:{bytesPerFeature:3352.822557738393,bytesPerFeatureLabel:1004.8700691358024,bytesPerCoordinate:25.860247675345768}},OBJECT_POINT:{bytesPerFeature:1859.6125297450421,bytesPerFeatureLabel:991.149725925926,bytesPerCoordinate:0,resourceBytes:0,draped:{bytesPerFeature:1859.6125297450421,bytesPerFeatureLabel:991.149725925926,bytesPerCoordinate:0}},OBJECT_POLYGON:{bytesPerFeature:2845.5426145906563,bytesPerFeatureLabel:990.1373679012346,bytesPerCoordinate:26.28656573063013,resourceBytes:0,draped:{bytesPerFeature:2845.5426145906563,bytesPerFeatureLabel:990.1373679012346,bytesPerCoordinate:26.28656573063013}},LINE_MITER:{bytesPerFeature:3496.0885217025834,bytesPerFeatureLabel:1006.2801333333334,bytesPerCoordinate:123.59788212780904,resourceBytes:0,draped:{bytesPerFeature:2284.3411036090542,bytesPerFeatureLabel:991.73412345679,bytesPerCoordinate:91.9152724978562}},LINE_ROUND:{bytesPerFeature:3317.1187644975244,bytesPerFeatureLabel:994.045698765432,bytesPerCoordinate:125.25369803460195,resourceBytes:0,draped:{bytesPerFeature:2306.872555845465,bytesPerFeatureLabel:992.8294074074074,bytesPerCoordinate:92.07516569878699}},PATH_MITER_CIRCLE:{bytesPerFeature:36610.70308259819,bytesPerFeatureLabel:1004.4142,bytesPerCoordinate:2702.6111852445874,resourceBytes:0,draped:{bytesPerFeature:36610.70308259819,bytesPerFeatureLabel:1004.4142,bytesPerCoordinate:2702.6111852445874}},PATH_ROUND_CIRCLE:{bytesPerFeature:23654.504287088952,bytesPerFeatureLabel:1008.3214,bytesPerCoordinate:5274.602998396151,resourceBytes:0,draped:{bytesPerFeature:23654.504287088952,bytesPerFeatureLabel:1008.3214,bytesPerCoordinate:5274.602998396151}},PATH_MITER_QUAD:{bytesPerFeature:24455.812230954263,bytesPerFeatureLabel:996.2129000000001,bytesPerCoordinate:2133.2360064153972,resourceBytes:0,draped:{bytesPerFeature:24455.812230954263,bytesPerFeatureLabel:996.2129000000001,bytesPerCoordinate:2133.2360064153972}},PATH_ROUND_QUAD:{bytesPerFeature:34795.75795669603,bytesPerFeatureLabel:980.2077,bytesPerCoordinate:3333.2525677626304,resourceBytes:0,draped:{bytesPerFeature:34795.75795669603,bytesPerFeatureLabel:980.2077,bytesPerCoordinate:3333.2525677626304}},FILL:{bytesPerFeature:4831.669938963107,bytesPerFeatureLabel:996.7990962962963,bytesPerCoordinate:66.28002864428382,resourceBytes:0,draped:{bytesPerFeature:3702.7425204073356,bytesPerFeatureLabel:977.9262864197531,bytesPerCoordinate:50.30914037420919}},FILL_OUTLINE:{bytesPerFeature:6750.801787250462,bytesPerFeatureLabel:995.3558074074075,bytesPerCoordinate:90.79371852494751,resourceBytes:0,draped:{bytesPerFeature:4979.209389797341,bytesPerFeatureLabel:994.7808444444444,bytesPerCoordinate:70.52030308533435}},EXTRUDE:{bytesPerFeature:13001.478514853923,bytesPerFeatureLabel:1005.6048395061729,bytesPerCoordinate:326.3628309517058,resourceBytes:0,draped:{bytesPerFeature:13001.478514853923,bytesPerFeatureLabel:1005.6048395061729,bytesPerCoordinate:326.3628309517058}},EXTRUDE_EDGES:{bytesPerFeature:15102.293699217093,bytesPerFeatureLabel:1009.9203555555555,bytesPerCoordinate:332.02964191895046,resourceBytes:0,draped:{bytesPerFeature:15102.293699217093,bytesPerFeatureLabel:1009.9203555555555,bytesPerCoordinate:332.02964191895046}}};export{l as averageSymbolComplexities,m as defaultSymbolComplexity,c as defaultSymbolLayerComplexity,p as defaultSymbolLayerMemoryComplexity,d as emptySymbolComplexity,L as memoryEstimators,n as totalSymbolComplexities};
|
|
@@ -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"../../../../request.js";import{result as t}from"../../../../core/asyncUtils.js";import{estimateNestedObjectSize as r}from"../../../../core/byteSizeEstimations.js";import n from"../../../../core/Error.js";import s from"../../../../core/Logger.js";import{isSome as
|
|
5
|
+
import e from"../../../../request.js";import{result as t}from"../../../../core/asyncUtils.js";import{estimateNestedObjectSize as r}from"../../../../core/byteSizeEstimations.js";import n from"../../../../core/Error.js";import s from"../../../../core/Logger.js";import{isSome as o,unwrap as a,isNone as i}from"../../../../core/maybe.js";import{NestedMap as u}from"../../../../core/NestedMap.js";import{throwIfAbortError as l}from"../../../../core/promiseUtils.js";import{Version as c}from"../../../../core/Version.js";import{d as p}from"../../../../chunks/vec3f64.js";import{empty as m,expandWithVec3 as f}from"../../../../geometry/support/aaBoundingBox.js";import{requestImage as d}from"../../../../support/requestImageUtils.js";import{Attribute as g}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as y,AlphaDiscardMode as b}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as w}from"../../webgl-engine/lib/Geometry.js";import{Texture as x}from"../../webgl-engine/lib/Texture.js";import{DefaultMaterial as h}from"../../webgl-engine/materials/DefaultMaterial.js";import{TextureWrapMode as v}from"../../../webgl/enums.js";const j=s.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");async function A(e,t){const n=await M(e,t),s=await k(n.textureDefinitions??{},t);let o=0;for(const r in s)if(s.hasOwnProperty(r)){const e=s[r];o+=e?.image?e.image.width*e.image.height*4:0}return{resource:n,textures:s,size:o+r(n)}}async function M(r,n){const s=o(n)&&n.streamDataRequester;if(s)return P(r,s,n);const i=await t(e(r,a(n)));if(!0===i.ok)return i.value.data;l(i.error),U(i.error)}async function P(e,r,n){const s=await t(r.request(e,"json",n));if(!0===s.ok)return s.value;l(s.error),U(s.error.details.url)}function U(e){throw new n("",`Request for object resource failed: ${e}`)}function E(e){const t=e.params,r=t.topology;let n=!0;switch(t.vertexAttributes||(j.warn("Geometry must specify vertex attributes"),n=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t&&t.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(j.warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),n=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(j.warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),n=!1)):(j.warn(`Indexed geometry does not specify face indices for '${r}' attribute`),n=!1)}}else j.warn("Indexed geometries must specify faces"),n=!1;break}default:j.warn(`Unsupported topology '${r}'`),n=!1}e.params.material||(j.warn("Geometry requires material"),n=!1);const s=e.params.vertexAttributes;for(const o in s){s[o].values||(j.warn("Geometries with externally defined attributes are not yet supported"),n=!1)}return n}function I(e,t){const r=new Array,n=new Array,s=new Array,a=new u,l=e.resource,m=c.parse(l.version||"1.0","wosr");R.validate(m);const f=l.model.name,d=l.model.geometries,b=l.materialDefinitions??{},v=e.textures;let j=0;const A=new Map;for(let u=0;u<d.length;u++){const e=d[u];if(!E(e))continue;const l=O(e),c=e.params.vertexAttributes,m=[];for(const t in c){const e=c[t],r=e.values;m.push([t,new g(r,e.valuesPerElement,!0)])}const f=[];if("PerAttributeArray"!==e.params.topology){const t=e.params.faces;for(const e in t)f.push([e,t[e].values])}const M=l.texture,P=v&&v[M];if(P&&!A.has(M)){const{image:e,params:t}=P,r=new x(e,t);n.push(r),A.set(M,r)}const U=A.get(M),I=U?U.id:void 0,T=l.material;let k=a.get(T,M);if(i(k)){const e=b[T.substring(T.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=P&&P.alphaChannelUsage,n=e.transparency>0||"transparency"===r||"maskAndTransparency"===r,s=P?q(P.alphaChannelUsage):void 0,i={ambient:p(e.diffuse),diffuse:p(e.diffuse),opacity:1-(e.transparency||0),transparent:n,textureAlphaMode:s,textureAlphaCutoff:.33,textureId:I,initTextureTransparent:!0,doubleSided:!0,cullFace:y.None,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:!!P&&!!P.params.preMultiplyAlpha};o(t)&&t.materialParamsMixin&&Object.assign(i,t.materialParamsMixin),k=new h(i),a.set(T,M,k)}s.push(k);const R=new w(k,m,f);j+=f.position?f.position.length:0,r.push(R)}return{engineResources:[{name:f,stageResources:{textures:n,materials:s,geometries:r},pivotOffset:l.model.pivotOffset,numberOfVertices:j,lodThreshold:null}],referenceBoundingBox:T(r)}}function T(e){const t=m();return e.forEach((e=>{const r=e.boundingInfo;o(r)&&(f(t,r.bbMin),f(t,r.bbMax))})),t}async function k(e,t){const r=[];for(const a in e){const n=e[a],s=n.images[0].data;if(!s){j.warn("Externally referenced texture data is not yet supported");continue}const i=n.encoding+";base64,"+s,u="/textureDefinitions/"+a,l="rgba"===n.channels?n.alphaChannelUsage||"transparency":"none",c={noUnpackFlip:!0,wrap:{s:v.REPEAT,t:v.REPEAT},preMultiplyAlpha:q(l)!==b.Opaque},p=o(t)&&t.disableTextures?Promise.resolve(null):d(i,t);r.push(p.then((e=>({refId:u,image:e,params:c,alphaChannelUsage:l}))))}const n=await Promise.all(r),s={};for(const o of n)s[o.refId]=o;return s}function q(e){switch(e){case"mask":return b.Mask;case"maskAndTransparency":return b.MaskBlend;case"none":return b.Opaque;default:return b.Blend}}function O(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const R=new c(1,2,"wosr");export{k as createTextureResources,A as load,I as processLoadResult};
|
|
@@ -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 i}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{isAbortError as n}from"../../../../core/promiseUtils.js";import{l as r}from"../../../../chunks/vec3.js";import{b as o}from"../../../../chunks/vec4f64.js";import{LodMetric as a,NodeBase as d,Node as l,ElevationRange as h,NodeFilterImpact as u,NodeIMModificationImpact as c,NodeTraversalState as _}from"./I3SNode.js";import{invalidateMbs as g,invalidateObb as m,addWraparound as f}from"./I3SUtil.js";import{clone as v}from"../../support/orientedBoundingBox.js";class b{constructor(e,t,i,s,n){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this.ref=s,this.node=n,this.useAsHole=0,this.filterImpact=u.NotChecked}}class p{constructor(e,t,i,n,r,o,d,l,h,u,c,_,g,m){this._streamDataController=i,this._viewportQueries=n,this._logger=r,this.holeFilling=o,this._isLoaded=d,this._isReloading=l,this._isSelected=h,this._enable=u,this._needsUpdate=c,this._canRequest=_,this._computeVisibilityObb=g,this._computeNodeFiltering=m,this._dirty=!0,this._nodePages=[],this._nodeCount=0,this._nodesPerPage=0,this._rootIndex=0,this._lodMetric=a.None,this._lodConversion=e=>e,this._urlPrefix="",this._loading=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._nodeTraversalState=new Map,this._version=I(0),this._visibilityCacheVersion=I(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missing=new s({deallocator:null}),this._prefetch=new s({deallocator:null}),this._updates=new N(this._missing),this._imModificationUncategorized=new s({deallocator:null}),this.ignoreServiceObb=!1,this.progressiveLoadPenalty=0,this._pageQueue=[],this.needNodeElevationRange=!1,this.layerHasModifications=!1,this._layerHasFilter=!1,this._logLayer=e,e.serviceUpdateTimeStamp&&e.serviceUpdateTimeStamp.lastUpdate&&(this._lastUpdate=`${e.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this._viewportQueries?this._viewportQueries.maxLodLevel:1,this._init(t)}_init(e){if("page"===e.type){switch(this._urlPrefix=e.urlPrefix,this._nodesPerPage=e.pageSize,this._rootIndex=e.rootIndex,e.lodMetric){case"maxScreenThreshold":this._lodMetric=a.MaxScreenThreshold;break;case"maxScreenThresholdSQ":this._lodMetric=a.MaxScreenThreshold,this._lodConversion=V}this._addPage(S(this._rootIndex,this._nodesPerPage),e.rootPage),this._updateParentsAndLevel()}else if("node"===e.type){this._urlPrefix=e.urlPrefix,this._nodePages.push({nodes:[],children:[],parents:[]}),this._makeRefNode(new d(e.rootNode.id,null),-1);const t=this._validateNode(e.rootNode.id,e.rootNode);t&&this._addNode(t,0)}}_loadPage(e){this._loading.add(e);const t=this._urlPrefix+e;this._streamDataController.request(t,"json").then((t=>{this._pageQueue.push({pageIndex:e,page:t})})).catch((t=>{this._loading.delete(e),n(t)||(this._failedPages.add(e),this._logger.error("#loadPage()",this._logLayer,`Error when loading page ${e}`,t))}))}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loading.delete(t),e.madeProgress()}this._updateParentsAndLevel()}_addPage(e,t){for(let r=this._nodePages.length;r<e;r++)this._nodePages[r]=null;const i=[],s=[],n=t.nodes.map(((t,n)=>{const a=i.length,d=t.children?t.children.length:0;s.push(-1);for(let e=0;e<d;e++)i.push(t.children[e]);const h=`${t.index}`,u=v(t.obb),c=o([u.center[0],u.center[1],u.center[2],r(u.halfSize)]),_=t.mesh&&t.mesh.attribute,g=t.mesh&&t.mesh.geometry,m=t.mesh&&t.mesh.material,f={hasSharedResource:!1,hasFeatureData:!!g,attributes:_&&null!=_.resource?`${_.resource}`:null,geometry:g&&null!=g.resource?`${g.resource}`:null,texture:m&&null!=m.resource?`${m.resource}`:null,geometryDefinition:g?g.definition:-1,materialDefinition:m?m.definition:-1},p=new l(h,e*this._nodesPerPage+n,c,d,0,f,this._lastUpdate,this._lodMetric,this._lodConversion(t.lodThreshold),g?g.featureCount:null);return p.serviceObb=u,p.visibilityObb=this._computeVisibilityObb(p),p.vertexCount=g?g.vertexCount:0,new b(a,d,x(this._visibilityCacheVersion),null,p)}));this._nodePages[e]={nodes:n,children:i,parents:s},this._nodeCount+=n.length}_updateParentsAndLevel(){const t=new Array,i=(i,s,n)=>{const r=this._getPage(i);if(e(r)){const o=R(i,this._nodesPerPage);r.parents[o]=s;const a=r.nodes[o].node;e(a)&&(a.level=n,t.push(i))}};for(i(this._rootIndex,-1,0);t.length;){const s=t.pop(),n=this.getNode(s);if(e(n))for(let e=0;e<n.childCount;e++){i(this.getChildIndex(n.index,e),s,n.level+1),this._maxLevel=Math.max(this._maxLevel,n.level+1)}}}_getPage(e){return this._nodePages[S(e,this._nodesPerPage)]}_getNodeInternal(e){const i=this._getPage(e);return t(i)?null:i.nodes[R(e,this._nodesPerPage)]}_addNode(t,s){null!=t.children&&this.populateChildren(s,t.children);const n=this.getParent(s),r=e(n)?n.level+1:0;this._maxLevel=Math.max(this._maxLevel,t.children?r+1:r);const{lodMetric:a,maxError:d}=E(t.lodSelection),h=i(this._getNodeInternal(s));return h.node=new l(t.id,s,o(t.mbs),h.childCount,r,t.resources,t.version,a,d,t.numFeatures),t.obb&&(h.node.serviceObb=v(t.obb)),h.node.visibilityObb=this._computeVisibilityObb(h.node),e(h.ref)&&(null==h.ref.mbs&&(h.ref.mbs=t.mbs),h.node.renderMbs=h.ref.renderMbs,h.node.serviceObbInRenderSR=h.ref.serviceObbInRenderSR,h.ref.visibilityObb=h.node.visibilityObb),h.node}_makeRefNode(e,t){const i=this._nodePages[0],s=i.nodes.length;return i.nodes.push(new b(0,0,x(this._visibilityCacheVersion),e,null)),this._nodeCount++,i.parents.push(t),g(e.renderMbs),m(e.serviceObbInRenderSR),s}populateChildren(e,t){const s=i(this._getNodeInternal(e)),n=i(this._getPage(e));s.childOffset=n.children.length,s.childCount=t.length;for(let i=0;i<t.length;i++){const s=this._makeRefNode(t[i],e);n.children.push(s)}}getNode(t){const i=this._getNodeInternal(t);return e(i)?i.node:null}getIndexById(t){let i;return this._forAllNodes(((s,n)=>{(e(s.node)&&s.node.id===t||e(s.ref)&&s.ref.id===t)&&(i=n)})),i}getNodeById(e){const t=this.getIndexById(e);return t>=0?this.getNode(t):null}getChildIndex(e,i){const s=this._getPage(e);if(t(s))return-1;const n=s.nodes[R(e,this._nodesPerPage)];return s.children[n.childOffset+i]}getParentIndex(t){const i=this._getPage(t);return e(i)?i.parents[R(t,this._nodesPerPage)]:-1}getParent(e){return(e=this.getParentIndex(e))>=0?this.getNode(e):null}isLeaf(t){const i=this._getNodeInternal(t);return e(i)&&0===i.childCount}get rootNode(){return this.getNode(this._rootIndex)}get size(){return this._nodeCount}removeAllGeometryObbs(){this._forAllNodes((t=>{e(t.node)&&(t.node.geometryObb=null)}))}invalidateVisibilityCache(){this._visibilityCacheVersion=I(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(t){const i=this._getNodeInternal(t);e(i)&&this.invalidateNodeVisibilityCacheInternal(i)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=x(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(t){const i=this._getNodeInternal(t);e(i)&&(P(i),this.invalidateNodeVisibilityCacheInternal(i))}updateElevationChanged(i){const s=this._getNodeInternal(i);if(t(s))return;if(!this.needNodeElevationRange)return void this.invalidateBoundingVolumeCache(i);const n=e(s.node)?s.node:s.ref;if(t(n))return;const r=n.elevationRange;t(r)||(r.valid=!1)}invalidateGeometryVisibility(t){const i=this._getNodeInternal(t);e(i)&&e(i.node)&&(i.node.geometryObb=null,g(i.node.renderMbs),m(i.node.serviceObbInRenderSR))}invalidateVisibilityObbs(){t(this.rootNode)||this.traverse(this.rootNode,(e=>(e.visibilityObb=this._computeVisibilityObb(e),e.geometryObb=null,!0)))}_updateElevationRange(i){const s=this._getNodeInternal(i);if(t(s))return null;const n=e(s.node)?s.node:s.ref;if(t(n))return null;const r=n.elevationRange;if(e(r)&&r.valid)return r;const o=new h;let a=!1;for(let e=0;e<s.childCount;e++){const s=this._updateElevationRange(this.getChildIndex(i,e));t(s)?a=!0:(o.min=Math.min(o.min,s.min),o.max=Math.max(o.max,s.max))}if(0===s.childCount||a&&e(s.node)&&s.node.resources.geometry){const t=this._viewportQueries.getElevationRange(n);e(t)&&(o.min=Math.min(o.min,t.min),o.max=Math.max(o.max,t.max))}return e(r)&&r.min===o.min&&r.max===o.max?(r.valid=!0,r):(o.valid=!0,n.elevationRange=o,this.invalidateBoundingVolumeCache(i),o)}isNodeVisible(i){const s=this._getNodeInternal(i);if(t(s)||e(s.ref)&&!s.ref.mbs)return!0;if(this.needNodeElevationRange&&this._updateElevationRange(i),!w(s.visibilityCache,this._visibilityCacheVersion)){const i=s.node,n=e(i)&&(t(s.ref)||e(i.visibilityObb))?i:e(s.ref)?s.ref:null;if(this._layerHasFilter&&this._computeNodeFiltering&&(e(i)||e(s.ref))&&s.filterImpact===u.NotChecked){const t=e(i)?i.mbs:e(s.ref)?s.ref.mbs:null;s.filterImpact=null!=t?this._computeNodeFiltering(t):u.Unmodified}const r=e(i)&&s.filterImpact===u.Culled,o=!(e(i)&&i.imModificationImpact===c.Culled)&&(!n||this._viewportQueries.isNodeVisible(n))&&!r;return s.visibilityCache=C(o,this._visibilityCacheVersion),o}return M(s.visibilityCache)}isGeometryVisible(t){if(!this.isNodeVisible(t))return!1;const i=this._getNodeInternal(t);return!(e(i)&&e(i.node)&&e(i.node.geometryObb)&&(!this.layerHasModifications||i.node.imModificationImpact!==c.NotChecked))||this._viewportQueries.isGeometryVisible(i.node)}_traverseCoverage(s,n,r,o,a){const d=this._getPage(s);if(t(d)||0===n.childCount)return;const l=n.childOffset+n.childCount,h=new Array;for(let t=n.childOffset;t<l;++t){const i=d.children[t],s=this._getNodeInternal(i);e(s)&&e(s.node)&&this.isGeometryVisible(i)&&h.push(s)}o/=h.length;for(const e of h){const t=i(e.node).index;this._isLoaded(t)||this._isReloading(t)?(a.delta=Math.max(a.delta,r),a.coverage+=o):this._traverseCoverage(t,e,r+1,o,a)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const i=this._getNodeInternal(e);if(t(i))return!1;if("always"===this.holeFilling)return!0;if(w(i.useAsHole,this._version))return M(i.useAsHole);const s={delta:0,coverage:0};this._traverseCoverage(e,i,0,1,s);const n=s.delta*s.coverage<=.5;return i.useAsHole=C(n,this._version),n}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.add.prune(),this._updates.update.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=I(this._version)}imModificationsChanged(t){this.layerHasModifications=t,this._forAllNodes((({node:t})=>{e(t)&&(t.imModificationImpact=c.NotChecked,t.visibilityObb=this._computeVisibilityObb(t),t.hasModifications&&this.invalidateGeometryVisibility(t.index))})),this.invalidateVisibilityCache()}layerFilterChanged(t){this._layerHasFilter=t,this._forAllNodes((t=>{if(e(t)){t.filterImpact=u.NotChecked;const i=t.node;e(i)&&this.invalidateNodeVisibilityCache(i.index)}})),this.invalidateVisibilityCache()}update(s,n,r){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(n),this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missing.clear(),this._prefetch.clear(),this._updates.reset(s),y.clear();let o=!0;const a=new O,d=new O,l=this._imModificationUncategorized;l.clear();const h=new Set,u=(u,_,g)=>{if(t(_)){let e=this._entryPriority(u);e===1/0&&(e=this._entryPriority(g));const t=S(u,this._nodesPerPage);return y.set(t,Math.max(e,y.get(t)||0)),this._loading.has(t)||this._failedPages.has(t)||this._missing.push(t),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const m=_.node;if(this._updateNodeFeatureEstimate(m,d),t(m)){const e=this._entryPriority(u);return this._loading.has(u)||this._failedNodes.has(u)||(this._missing.push(u),y.set(u,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const f=i(this._getPage(u));if(0===this._missing.length&&0===this._nodesPerPage)for(let t=0;t<_.childCount;t++){const i=f.children[_.childOffset+t],s=this._getNodeInternal(i);!e(s)||s.node||this._loading.has(i)||this._failedNodes.has(i)||(y.set(i,this._entryPriority(i)),this._prefetch.push(i))}if(m.failed||!m.resources.hasFeatureData)return void(o&&_.childCount>0&&this._isSelected(m)&&(o=!1));if(h.add(m.id),this._isLoaded(u)){if(a.known+=m.memory,++a.knownNodes,this._isSelected(m)?_.childCount>0&&(o=!1):(a.unremoved+=m.memory,o=!1),this._needsUpdate(m)){const e=this._entryPriority(u);y.set(u,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(u)}return}if(m.memory&&(a.known+=m.memory,++a.knownNodes),!this._isSelected(m))return void(this._isReloading(u)&&this._updates.remove.push(u));if(_.childCount>0&&(o=!1),m.memory?(a.missing+=m.memory,a.known+=m.memory,++a.knownNodes):++a.missingNodes,s.includes(m.index))return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._entryPriority(u)),void(this._updates.cancel=this._updates.cancel.filter((e=>e!==m.index)));if(!n.done&&this._enable(m))return void n.madeProgress();const v=this._entryPriority(u);y.set(u,v),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,v),this._updates.add.push(u),this.layerHasModifications&&r&&e(m)&&m.imModificationImpact===c.NotChecked&&l.push(u)};this.traverseVisible(u);const _=this._updates.add;_.length>0&&this.layerHasModifications&&(l.length>0&&r(l),_.filterInPlace((e=>{const i=this._getNodeInternal(e),s=t(i)||t(i.node)||i.node.imModificationImpact!==c.Culled;return s||this.invalidateNodeVisibilityCache(e),s}))),this._unloadedMemoryEstimate=a.missing-a.unremoved,a.knownNodes>3&&a.missingNodes>0&&(this._unloadedMemoryEstimate+=a.known/a.knownNodes*a.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate),this._featureEstimate.estimate=this._computeFeatureEstimate(d),this._featureEstimate.leavesReached=o,this._missing.sort(((e,t)=>e-t)),this._missing.filterInPlace(((e,t)=>t<1||this._missing.data[t-1]!==e)),this._missing.sort(((e,t)=>y.get(e)-y.get(t))),this._missing.length>0&&(this._maxUnloadedPrio=y.get(this._missing.back()),this._prefetch.clear()),this._updates.add.filterInPlace((e=>y.get(e)>=this._maxUnloadedPrio)).sort(((e,t)=>y.get(e)-y.get(t))),this._updates.update.sort(((e,t)=>y.get(e)-y.get(t))),this._indexMissing=this._loading.size+this._missing.length,this._dirty=this._indexMissing>0,y.clear()}checkFeatureTarget(e,t){const i=this._viewportQueries.updateScreenSpaceErrorBias(t);let s=t,n=t,r=i,o=10;for(;o--;){const i=new O;this._updateFeatureEstimate(s,i);if(this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===o)break;r=s,s=.5*(s+n)}else n=s,s=.5*(s+r)}return this._version=I(this._version),this._viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_updateFeatureEstimate(t,i){this._version=I(this._version),this._viewportQueries.updateScreenSpaceErrorBias(t),this.traverseVisible(((t,s)=>this._updateNodeFeatureEstimate(e(s)&&s.node,i)))}_updateNodeFeatureEstimate(i,s){if(!(t(i)||i.failed||t(i.numFeatures)))return this._isLoaded(i.index)?(s.known+=i.numFeatures,++s.knownNodes,void(this._isSelected(i)||(s.unremoved+=i.numFeatures))):void(this._isSelected(i)&&(e(i.numFeatures)?(s.missing+=i.numFeatures,s.known+=i.numFeatures,++s.knownNodes):++s.missingNodes))}_computeFeatureEstimate(e){let t=e.known-e.unremoved;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.known/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missing)}prefetch(){return this._prefetch.sort(((e,t)=>y.get(e)-y.get(t))),this._load(this._prefetch)}_load(e){if(0===e.length||!this._canRequest())return!1;for(;e.length>0&&this._canRequest();)0===this._nodesPerPage?this._loadNode(e.pop()):this._loadPage(e.pop());return!0}get isLoading(){return this._indexMissing>0}get isPrefetching(){return this._prefetch.length>0}get indexLoading(){return this._loading.size}get indexMissing(){return this._indexMissing}get unloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}get maxPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}nodeTraversalState(e){if(t(e))return null;let i=this._nodeTraversalState.get(e.index);if(i&&w(i.version,this._version))return i;const s=this._viewportQueries.getLodLevel(e),n=this._viewportQueries.hasLOD(e);let r=!0;if(n){const t=this.getParentIndex(e.index);if(t>=0){const e=this._nodeTraversalState.get(t);r=e&&s>e.lodLevel}else r=s>0}else r=0===e.childCount;return i?(i.lodLevel=s,i.isChosen=r,i.version=C(!0,this._version),i):(i=new _(n,r,s,C(!0,this._version)),this._nodeTraversalState.set(e.index,i),i)}_loadNode(e){this._loading.add(e);const s=i(this._getNodeInternal(e)).ref;if(t(s))return void this._failedNodes.add(e);const r=s.id,o=this._urlPrefix+r,a=()=>{this._loading.delete(e),0===this._missing.length&&0===this._loading.size&&this.requestUpdate()};this._streamDataController.request(o,"json").then((t=>{a();const i=this._validateNode(r,t);if(null==i)return;i.obb&&this.invalidateNodeVisibilityCache(e);const s=this._addNode(i,e);this.nodeTraversalState(s)}),(t=>{a(),n(t)||(this._logger.error("#loadNode()",this._logLayer,"Error loading node: "+o),this._failedNodes.add(e))}))}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this._logger.error("#validateNode()",this._logLayer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this._logger.error("#validateNode()",this._logLayer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this._logger.warn("#validateNode()",this._logLayer,`Invalid shared resource href on node "${e}"`),null==t.geometryData||Array.isArray(t.geometryData)&&1===t.geometryData.length&&"./geometries/0"===t.geometryData[0].href||this._logger.warn("#validateNode()",this._logLayer,`Invalid geometry data on node "${e}"`),null==t.attributeData||Array.isArray(t.attributeData)&&!t.attributeData.some(((e,t)=>e.href!==`./attributes/f_${t}/0`))||this._logger.warn("#validateNode()",this._logLayer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this._logger.warn("#validateNode()",this._logLayer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const i=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,s=t.featureData&&1===t.featureData.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:null,n=t=>{if(null==t)return null;const i=t=>this._logger.error("#validateNode()",this._logLayer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;t.href&&t.href!=="../"+t.id&&this._logger.error("#validateNode()",this._logLayer,`Invalid node href on node "${e}"`);const s=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,n=new d(`${t.id}`,t.mbs);return n.serviceObb=s,n.visibilityObb=this._computeVisibilityObb(n),n},r=Array.isArray(t.children)?t.children.map(n).filter((e=>null!=e)):null;return{id:e,mbs:t.mbs,obb:i,children:r,resources:{hasFeatureData:t.featureData&&t.featureData.length>0,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:null,texture:t.textureData&&t.textureData.length>0?e:null,geometry:null!=t.geometryData?e:null},version:"string"==typeof t.version?t.version:null,lodSelection:Array.isArray(t.lodSelection)?t.lodSelection:null,numFeatures:s}}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes((t=>{e(t.node)&&(t.node.failed=!1)}))}_entryPriority(i){const s=this._getNodeInternal(i),n=this.getParentIndex(i);if(t(s)||n<0&&null==s.node)return n<0?1/0:this._entryPriority(n);let r=0;if(s.node&&n>=0){const e=this._nodeTraversalState.get(n);null!=e&&(r=e.lodLevel)}let o=this.progressiveLoadPenalty;for(let e=i;e>=0;e=this.getParentIndex(e))if(this._isLoaded(e)){o=0;break}const a=e(s.ref)?this._viewportQueries.distToPOI(s.ref):e(s.node)?this._viewportQueries.distToPOI(s.node):0;return-a-r*(a+this.progressiveLoadPenalty)+o}traverseVisible(e){const i=this._getNodeInternal(this._rootIndex);t(i)?e(this._rootIndex,null,null):this._traverseVisible(this._rootIndex,-1,i,e)}_traverseVisible(t,s,n,r){if(n.node&&0===n.childCount)return void(this.isGeometryVisible(t)&&r(t,n,s));if(!this.isNodeVisible(t))return;if(r(t,n,s),null==n.node)return;const o=this.nodeTraversalState(n.node);if(o.nodeHasLOD&&o.lodLevel===this._maxLodLevel)return;const a=i(this._getPage(t));for(let i=0;i<n.childCount;i++){const s=a.children[n.childOffset+i],o=this._getNodeInternal(s);e(o)?this._traverseVisible(s,t,o,r):r(s,null,t)}}traverse(e,t){t(e)&&this.traverseChildren(e,t)}traverseChildren(t,i){const s=t.index,n=this._getNodeInternal(s);e(n)&&this._traverseChildren(s,n,i)}_traverseChildren(i,s,n){const r=this._getPage(i);if(t(r))return;const o=s.childOffset+s.childCount;for(let t=s.childOffset;t<o;++t){const i=r.children[t],s=this._getNodeInternal(i);e(s)&&e(s.node)&&n(s.node)&&this._traverseChildren(i,s,n)}}updateChildrenLoaded(t,i){let s=this.getNode(t);for(;e(s);)s.childrenLoaded+=i,s=this.getParent(s.index)}checkChildrenLoadedInvariant(){if(t(this.rootNode))return!0;const e=[],i=t=>{let s=this._isLoaded(t.index)||this._isReloading(t.index)?1:0;return this.traverseChildren(t,(e=>(s+=i(e),!1))),t.childrenLoaded!==s&&e.push(t.index),s};return i(this.rootNode),e.length&&this._logger.error("childrenLoaded invariant broken at following nodes: "+e.join(",")),e.length>0}updateStats(e){if(this._updates.add.length>0&&(e.nodes+=" + "+this._updates.add.length),(this._indexMissing||this._prefetch.length>0)&&(e.index+=" + "+this._indexMissing||this._prefetch.length),e.prio=this._maxProcessingPrio,this._featureEstimate.estimate){const t=this._featureEstimate.estimate-e.features;t>0?e.features+=" + "+t:t<0&&(e.features+=" - "+-t)}}updateElevationInfo(e,t){this.needNodeElevationRange=t&&e&&("relative-to-ground"===e.mode||"on-the-ground"===e.mode),this._viewportQueries.updateElevationInfo(e),this.invalidateAllElevationRanges()}invalidateAllElevationRanges(){this._forAllNodes((t=>{P(t),e(t.node)&&(t.node.elevationRange=null),e(t.ref)&&(t.ref.elevationRange=null)}))}_forAllNodes(e){for(let t=0;t<this._nodePages.length;t++){const i=this._nodePages[t];if(i){const s=t*this._nodesPerPage;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],s+t)}}}get test(){return{addNode:(e,t)=>this._addNode(e,t)}}}const y=new Map;class N{constructor(e){this.missing=e,this.update=new s({deallocator:null}),this.add=new s({deallocator:null}),this.remove=new s({deallocator:null}),this.cancel=[]}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function P(t){e(t.node)&&(g(t.node.renderMbs),m(t.node.serviceObbInRenderSR)),e(t.ref)&&(g(t.ref.renderMbs),m(t.ref.serviceObbInRenderSR))}function x(e){return f(e,-2)}function I(e){return f(e,2)}function C(e,t){return t+(e?1:0)}function w(e,t){return(-2&e)===t}function M(e){return 1==(1&e)}function S(e,t){return 0===t?0:e/t|0}function R(e,t){return 0===t?e:e%t}const L=[["maxScreenThreshold",a.MaxScreenThreshold],["screenSpaceRelative",a.ScreenSpaceRelative],["removedFeatureDiameter",a.RemovedFeatureDiameter],["distanceRangeFromDefaultCamera",a.DistanceRangeFromDefaultCamera]];function E(e){if(e)for(let t=0;t<e.length;t++)for(const i of L)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:a.None,maxError:0}}class O{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}function V(e){return Math.sqrt(e*(4/Math.PI))}export{p as I3SIndex,E as selectErrorMetric};
|
|
5
|
+
import{isSome as e,isNone as t,unwrap as i}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{isAbortError as n}from"../../../../core/promiseUtils.js";import{l as r}from"../../../../chunks/vec3.js";import{b as o}from"../../../../chunks/vec4f64.js";import{LodMetric as a,NodeBase as d,Node as l,ElevationRange as h,NodeFilterImpact as u,NodeIMModificationImpact as c,NodeTraversalState as _}from"./I3SNode.js";import{invalidateMbs as g,invalidateObb as m,addWraparound as f}from"./I3SUtil.js";import{clone as v}from"../../support/orientedBoundingBox.js";class b{constructor(e,t,i,s,n){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this.ref=s,this.node=n,this.useAsHole=0,this.filterImpact=u.NotChecked}}class p{constructor(e,t,i,n,r,o,d,l,h,u,c,_,g,m){this._streamDataController=i,this._viewportQueries=n,this._logger=r,this.holeFilling=o,this._isLoaded=d,this._isReloading=l,this._isSelected=h,this._enable=u,this._needsUpdate=c,this._canRequest=_,this._computeVisibilityObb=g,this._computeNodeFiltering=m,this._dirty=!0,this._nodePages=[],this._nodeCount=0,this._nodesPerPage=0,this._rootIndex=0,this._lodMetric=a.None,this._lodConversion=e=>e,this._urlPrefix="",this._loading=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._nodeTraversalState=new Map,this._version=I(0),this._visibilityCacheVersion=I(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missing=new s({deallocator:null}),this._prefetch=new s({deallocator:null}),this._updates=new N(this._missing),this._imModificationUncategorized=new s({deallocator:null}),this.ignoreServiceObb=!1,this.progressiveLoadPenalty=0,this._pageQueue=[],this.needNodeElevationRange=!1,this.layerHasModifications=!1,this._layerHasFilter=!1,this._logLayer=e,e.serviceUpdateTimeStamp&&e.serviceUpdateTimeStamp.lastUpdate&&(this._lastUpdate=`${e.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this._viewportQueries?this._viewportQueries.maxLodLevel:1,this._init(t)}_init(e){if("page"===e.type){switch(this._urlPrefix=e.urlPrefix,this._nodesPerPage=e.pageSize,this._rootIndex=e.rootIndex,e.lodMetric){case"maxScreenThreshold":this._lodMetric=a.MaxScreenThreshold;break;case"maxScreenThresholdSQ":this._lodMetric=a.MaxScreenThreshold,this._lodConversion=V}this._addPage(S(this._rootIndex,this._nodesPerPage),e.rootPage),this._updateParentsAndLevel()}else if("node"===e.type){this._urlPrefix=e.urlPrefix,this._nodePages.push({nodes:[],children:[],parents:[]}),this._makeRefNode(new d(e.rootNode.id,null),-1);const t=this._validateNode(e.rootNode.id,e.rootNode);t&&this._addNode(t,0)}}_loadPage(e){this._loading.add(e);const t=this._urlPrefix+e;this._streamDataController.request(t,"json").then((t=>{this._pageQueue.push({pageIndex:e,page:t})})).catch((t=>{this._loading.delete(e),n(t)||(this._failedPages.add(e),this._logger.error("#loadPage()",this._logLayer,`Error when loading page ${e}`,t))}))}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loading.delete(t),e.madeProgress()}this._updateParentsAndLevel()}_addPage(e,t){for(let r=this._nodePages.length;r<e;r++)this._nodePages[r]=null;const i=[],s=[],n=t.nodes.map(((t,n)=>{const a=i.length,d=t.children?t.children.length:0;s.push(-1);for(let e=0;e<d;e++)i.push(t.children[e]);const h=`${t.index}`,u=v(t.obb),c=o([u.center[0],u.center[1],u.center[2],r(u.halfSize)]),_=t.mesh&&t.mesh.attribute,g=t.mesh&&t.mesh.geometry,m=t.mesh&&t.mesh.material,f={hasSharedResource:!1,hasFeatureData:!!g,attributes:_&&null!=_.resource?`${_.resource}`:void 0,geometry:g&&null!=g.resource?`${g.resource}`:void 0,texture:m&&null!=m.resource?`${m.resource}`:void 0,geometryDefinition:g?g.definition:-1,materialDefinition:m?m.definition:-1},p=new l(h,e*this._nodesPerPage+n,c,d,0,f,this._lastUpdate,this._lodMetric,this._lodConversion(t.lodThreshold),g?g.featureCount:null);return p.serviceObb=u,p.visibilityObb=this._computeVisibilityObb(p),p.vertexCount=g?g.vertexCount:0,new b(a,d,x(this._visibilityCacheVersion),null,p)}));this._nodePages[e]={nodes:n,children:i,parents:s},this._nodeCount+=n.length}_updateParentsAndLevel(){const t=new Array,i=(i,s,n)=>{const r=this._getPage(i);if(e(r)){const o=R(i,this._nodesPerPage);r.parents[o]=s;const a=r.nodes[o].node;e(a)&&(a.level=n,t.push(i))}};for(i(this._rootIndex,-1,0);t.length;){const s=t.pop(),n=this.getNode(s);if(e(n))for(let e=0;e<n.childCount;e++){i(this.getChildIndex(n.index,e),s,n.level+1),this._maxLevel=Math.max(this._maxLevel,n.level+1)}}}_getPage(e){return this._nodePages[S(e,this._nodesPerPage)]}_getNodeInternal(e){const i=this._getPage(e);return t(i)?null:i.nodes[R(e,this._nodesPerPage)]}_addNode(t,s){null!=t.children&&this.populateChildren(s,t.children);const n=this.getParent(s),r=e(n)?n.level+1:0;this._maxLevel=Math.max(this._maxLevel,t.children?r+1:r);const{lodMetric:a,maxError:d}=E(t.lodSelection),h=i(this._getNodeInternal(s));return h.node=new l(t.id,s,o(t.mbs),h.childCount,r,t.resources,t.version,a,d,t.numFeatures),t.obb&&(h.node.serviceObb=v(t.obb)),h.node.visibilityObb=this._computeVisibilityObb(h.node),e(h.ref)&&(null==h.ref.mbs&&(h.ref.mbs=t.mbs),h.node.renderMbs=h.ref.renderMbs,h.node.serviceObbInRenderSR=h.ref.serviceObbInRenderSR,h.ref.visibilityObb=h.node.visibilityObb),h.node}_makeRefNode(e,t){const i=this._nodePages[0];if(null==i)return-1;const s=i.nodes.length;return i.nodes.push(new b(0,0,x(this._visibilityCacheVersion),e,null)),this._nodeCount++,i.parents.push(t),g(e.renderMbs),m(e.serviceObbInRenderSR),s}populateChildren(e,t){const s=i(this._getNodeInternal(e)),n=i(this._getPage(e));s.childOffset=n.children.length,s.childCount=t.length;for(let i=0;i<t.length;i++){const s=this._makeRefNode(t[i],e);n.children.push(s)}}getNode(t){const i=this._getNodeInternal(t);return e(i)?i.node:null}getIndexById(t){let i;return this._forAllNodes(((s,n)=>{(e(s.node)&&s.node.id===t||e(s.ref)&&s.ref.id===t)&&(i=n)})),i}getNodeById(e){const t=this.getIndexById(e);return null!=t&&t>=0?this.getNode(t):null}getChildIndex(e,i){const s=this._getPage(e);if(t(s))return-1;const n=s.nodes[R(e,this._nodesPerPage)];return s.children[n.childOffset+i]}getParentIndex(t){const i=this._getPage(t);return e(i)?i.parents[R(t,this._nodesPerPage)]:-1}getParent(e){return(e=this.getParentIndex(e))>=0?this.getNode(e):null}isLeaf(t){const i=this._getNodeInternal(t);return e(i)&&0===i.childCount}get rootNode(){return this.getNode(this._rootIndex)}get size(){return this._nodeCount}removeAllGeometryObbs(){this._forAllNodes((t=>{e(t.node)&&(t.node.geometryObb=null)}))}invalidateVisibilityCache(){this._visibilityCacheVersion=I(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(t){const i=this._getNodeInternal(t);e(i)&&this.invalidateNodeVisibilityCacheInternal(i)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=x(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(t){const i=this._getNodeInternal(t);e(i)&&(P(i),this.invalidateNodeVisibilityCacheInternal(i))}updateElevationChanged(i){const s=this._getNodeInternal(i);if(t(s))return;if(!this.needNodeElevationRange)return void this.invalidateBoundingVolumeCache(i);const n=e(s.node)?s.node:s.ref;if(t(n))return;const r=n.elevationRange;t(r)||(r.valid=!1)}invalidateGeometryVisibility(t){const i=this._getNodeInternal(t);e(i)&&e(i.node)&&(i.node.geometryObb=null,g(i.node.renderMbs),m(i.node.serviceObbInRenderSR))}invalidateVisibilityObbs(){t(this.rootNode)||this.traverse(this.rootNode,(e=>(e.visibilityObb=this._computeVisibilityObb(e),e.geometryObb=null,!0)))}_updateElevationRange(i){const s=this._getNodeInternal(i);if(t(s))return null;const n=e(s.node)?s.node:s.ref;if(t(n))return null;const r=n.elevationRange;if(e(r)&&r.valid)return r;const o=new h;let a=!1;for(let e=0;e<s.childCount;e++){const s=this._updateElevationRange(this.getChildIndex(i,e));t(s)?a=!0:(o.min=Math.min(o.min,s.min),o.max=Math.max(o.max,s.max))}if(0===s.childCount||a&&e(s.node)&&s.node.resources.geometry){const t=this._viewportQueries.getElevationRange(n);e(t)&&(o.min=Math.min(o.min,t.min),o.max=Math.max(o.max,t.max))}return e(r)&&r.min===o.min&&r.max===o.max?(r.valid=!0,r):(o.valid=!0,n.elevationRange=o,this.invalidateBoundingVolumeCache(i),o)}isNodeVisible(i){const s=this._getNodeInternal(i);if(t(s)||e(s.ref)&&!s.ref.mbs)return!0;if(this.needNodeElevationRange&&this._updateElevationRange(i),!w(s.visibilityCache,this._visibilityCacheVersion)){const i=s.node,n=e(i)&&(t(s.ref)||e(i.visibilityObb))?i:e(s.ref)?s.ref:null;if(this._layerHasFilter&&this._computeNodeFiltering&&(e(i)||e(s.ref))&&s.filterImpact===u.NotChecked){const t=e(i)?i.mbs:e(s.ref)?s.ref.mbs:null;s.filterImpact=null!=t?this._computeNodeFiltering(t):u.Unmodified}const r=e(i)&&s.filterImpact===u.Culled,o=!(e(i)&&i.imModificationImpact===c.Culled)&&(!n||this._viewportQueries.isNodeVisible(n))&&!r;return s.visibilityCache=C(o,this._visibilityCacheVersion),o}return M(s.visibilityCache)}isGeometryVisible(t){if(!this.isNodeVisible(t))return!1;const i=this._getNodeInternal(t);return!(e(i)&&e(i.node)&&e(i.node.geometryObb)&&(!this.layerHasModifications||i.node.imModificationImpact!==c.NotChecked))||this._viewportQueries.isGeometryVisible(i.node)}_traverseCoverage(s,n,r,o,a){const d=this._getPage(s);if(t(d)||0===n.childCount)return;const l=n.childOffset+n.childCount,h=new Array;for(let t=n.childOffset;t<l;++t){const i=d.children[t],s=this._getNodeInternal(i);e(s)&&e(s.node)&&this.isGeometryVisible(i)&&h.push(s)}o/=h.length;for(const e of h){const t=i(e.node).index;this._isLoaded(t)||this._isReloading(t)?(a.delta=Math.max(a.delta,r),a.coverage+=o):this._traverseCoverage(t,e,r+1,o,a)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const i=this._getNodeInternal(e);if(t(i))return!1;if("always"===this.holeFilling)return!0;if(w(i.useAsHole,this._version))return M(i.useAsHole);const s={delta:0,coverage:0};this._traverseCoverage(e,i,0,1,s);const n=s.delta*s.coverage<=.5;return i.useAsHole=C(n,this._version),n}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.add.prune(),this._updates.update.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=I(this._version)}imModificationsChanged(t){this.layerHasModifications=t,this._forAllNodes((({node:t})=>{e(t)&&(t.imModificationImpact=c.NotChecked,t.visibilityObb=this._computeVisibilityObb(t),t.hasModifications&&this.invalidateGeometryVisibility(t.index))})),this.invalidateVisibilityCache()}layerFilterChanged(t){this._layerHasFilter=t,this._forAllNodes((t=>{if(e(t)){t.filterImpact=u.NotChecked;const i=t.node;e(i)&&this.invalidateNodeVisibilityCache(i.index)}})),this.invalidateVisibilityCache()}update(s,n,r){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(n),this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missing.clear(),this._prefetch.clear(),this._updates.reset(s),y.clear();let o=!0;const a=new O,d=new O,l=this._imModificationUncategorized;l.clear();const h=new Set,u=(u,_,g)=>{if(t(_)){let e=this._entryPriority(u);e===1/0&&(e=this._entryPriority(g));const t=S(u,this._nodesPerPage);return y.set(t,Math.max(e,y.get(t)||0)),this._loading.has(t)||this._failedPages.has(t)||this._missing.push(t),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const m=_.node;if(this._updateNodeFeatureEstimate(m,d),t(m)){const e=this._entryPriority(u);return this._loading.has(u)||this._failedNodes.has(u)||(this._missing.push(u),y.set(u,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const f=i(this._getPage(u));if(0===this._missing.length&&0===this._nodesPerPage)for(let t=0;t<_.childCount;t++){const i=f.children[_.childOffset+t],s=this._getNodeInternal(i);!e(s)||s.node||this._loading.has(i)||this._failedNodes.has(i)||(y.set(i,this._entryPriority(i)),this._prefetch.push(i))}if(m.failed||!m.resources.hasFeatureData)return void(o&&_.childCount>0&&this._isSelected(m)&&(o=!1));if(h.add(m.id),this._isLoaded(u)){if(a.known+=m.memory,++a.knownNodes,this._isSelected(m)?_.childCount>0&&(o=!1):(a.unremoved+=m.memory,o=!1),this._needsUpdate(m)){const e=this._entryPriority(u);y.set(u,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(u)}return}if(m.memory&&(a.known+=m.memory,++a.knownNodes),!this._isSelected(m))return void(this._isReloading(u)&&this._updates.remove.push(u));if(_.childCount>0&&(o=!1),m.memory?(a.missing+=m.memory,a.known+=m.memory,++a.knownNodes):++a.missingNodes,s.includes(m.index))return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._entryPriority(u)),void(this._updates.cancel=this._updates.cancel.filter((e=>e!==m.index)));if(!n.done&&this._enable(m))return void n.madeProgress();const v=this._entryPriority(u);y.set(u,v),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,v),this._updates.add.push(u),this.layerHasModifications&&r&&e(m)&&m.imModificationImpact===c.NotChecked&&l.push(u)};this.traverseVisible(u);const _=this._updates.add;_.length>0&&this.layerHasModifications&&(l.length>0&&r?.(l),_.filterInPlace((e=>{const i=this._getNodeInternal(e),s=t(i)||t(i.node)||i.node.imModificationImpact!==c.Culled;return s||this.invalidateNodeVisibilityCache(e),s}))),this._unloadedMemoryEstimate=a.missing-a.unremoved,a.knownNodes>3&&a.missingNodes>0&&(this._unloadedMemoryEstimate+=a.known/a.knownNodes*a.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate),this._featureEstimate.estimate=this._computeFeatureEstimate(d),this._featureEstimate.leavesReached=o,this._missing.sort(((e,t)=>e-t)),this._missing.filterInPlace(((e,t)=>t<1||this._missing.data[t-1]!==e)),this._missing.sort(((e,t)=>y.get(e)-y.get(t))),this._missing.length>0&&(this._maxUnloadedPrio=y.get(this._missing.back()),this._prefetch.clear()),this._updates.add.filterInPlace((e=>y.get(e)>=this._maxUnloadedPrio)).sort(((e,t)=>y.get(e)-y.get(t))),this._updates.update.sort(((e,t)=>y.get(e)-y.get(t))),this._indexMissing=this._loading.size+this._missing.length,this._dirty=this._indexMissing>0,y.clear()}checkFeatureTarget(e,t){const i=this._viewportQueries.updateScreenSpaceErrorBias(t);let s=t,n=t,r=i,o=10;for(;o--;){const i=new O;this._updateFeatureEstimate(s,i);if(this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===o)break;r=s,s=.5*(s+n)}else n=s,s=.5*(s+r)}return this._version=I(this._version),this._viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_updateFeatureEstimate(t,i){this._version=I(this._version),this._viewportQueries.updateScreenSpaceErrorBias(t),this.traverseVisible(((t,s)=>this._updateNodeFeatureEstimate(e(s)?s.node:void 0,i)))}_updateNodeFeatureEstimate(i,s){if(!(t(i)||i.failed||t(i.numFeatures)))return this._isLoaded(i.index)?(s.known+=i.numFeatures,++s.knownNodes,void(this._isSelected(i)||(s.unremoved+=i.numFeatures))):void(this._isSelected(i)&&(e(i.numFeatures)?(s.missing+=i.numFeatures,s.known+=i.numFeatures,++s.knownNodes):++s.missingNodes))}_computeFeatureEstimate(e){let t=e.known-e.unremoved;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.known/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missing)}prefetch(){return this._prefetch.sort(((e,t)=>y.get(e)-y.get(t))),this._load(this._prefetch)}_load(e){if(0===e.length||!this._canRequest())return!1;for(;e.length>0&&this._canRequest();)0===this._nodesPerPage?this._loadNode(e.pop()):this._loadPage(e.pop());return!0}get isLoading(){return this._indexMissing>0}get isPrefetching(){return this._prefetch.length>0}get indexLoading(){return this._loading.size}get indexMissing(){return this._indexMissing}get unloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}get maxPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}nodeTraversalState(e){if(t(e))return null;let i=this._nodeTraversalState.get(e.index);if(i&&w(i.version,this._version))return i;const s=this._viewportQueries.getLodLevel(e),n=this._viewportQueries.hasLOD(e);let r=!0;if(n){const t=this.getParentIndex(e.index);if(t>=0){const e=this._nodeTraversalState.get(t);r=!!e&&s>e.lodLevel}else r=s>0}else r=0===e.childCount;return i?(i.lodLevel=s,i.isChosen=r,i.version=C(!0,this._version),i):(i=new _(n,r,s,C(!0,this._version)),this._nodeTraversalState.set(e.index,i),i)}_loadNode(e){this._loading.add(e);const s=i(this._getNodeInternal(e)).ref;if(t(s))return void this._failedNodes.add(e);const r=s.id,o=this._urlPrefix+r,a=()=>{this._loading.delete(e),0===this._missing.length&&0===this._loading.size&&this.requestUpdate()};this._streamDataController.request(o,"json").then((t=>{a();const i=this._validateNode(r,t);if(null==i)return;i.obb&&this.invalidateNodeVisibilityCache(e);const s=this._addNode(i,e);this.nodeTraversalState(s)}),(t=>{a(),n(t)||(this._logger.error("#loadNode()",this._logLayer,"Error loading node: "+o),this._failedNodes.add(e))}))}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this._logger.error("#validateNode()",this._logLayer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this._logger.error("#validateNode()",this._logLayer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this._logger.warn("#validateNode()",this._logLayer,`Invalid shared resource href on node "${e}"`),null==t.geometryData||Array.isArray(t.geometryData)&&1===t.geometryData.length&&"./geometries/0"===t.geometryData[0].href||this._logger.warn("#validateNode()",this._logLayer,`Invalid geometry data on node "${e}"`),null==t.attributeData||Array.isArray(t.attributeData)&&!t.attributeData.some(((e,t)=>e.href!==`./attributes/f_${t}/0`))||this._logger.warn("#validateNode()",this._logLayer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this._logger.warn("#validateNode()",this._logLayer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const i=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,s=t.featureData&&1===t.featureData.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:void 0,n=t=>{if(null==t)return null;const i=t=>this._logger.error("#validateNode()",this._logLayer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;t.href&&t.href!=="../"+t.id&&this._logger.error("#validateNode()",this._logLayer,`Invalid node href on node "${e}"`);const s=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,n=new d(`${t.id}`,t.mbs);return n.serviceObb=s,n.visibilityObb=this._computeVisibilityObb(n),n},r=Array.isArray(t.children)?t.children.map(n).filter((e=>null!=e)):null;return{id:e,mbs:t.mbs,obb:i,children:r,resources:{hasFeatureData:t.featureData&&t.featureData.length>0,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:void 0,texture:t.textureData&&t.textureData.length>0?e:void 0,geometry:null!=t.geometryData?e:void 0},version:"string"==typeof t.version?t.version:null,lodSelection:Array.isArray(t.lodSelection)?t.lodSelection:null,numFeatures:s}}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes((t=>{e(t.node)&&(t.node.failed=!1)}))}_entryPriority(i){const s=this._getNodeInternal(i),n=this.getParentIndex(i);if(t(s)||n<0&&null==s.node)return n<0?1/0:this._entryPriority(n);let r=0;if(s.node&&n>=0){const e=this._nodeTraversalState.get(n);null!=e&&(r=e.lodLevel)}let o=this.progressiveLoadPenalty;for(let e=i;e>=0;e=this.getParentIndex(e))if(this._isLoaded(e)){o=0;break}const a=e(s.ref)?this._viewportQueries.distToPOI(s.ref):e(s.node)?this._viewportQueries.distToPOI(s.node):0;return-a-r*(a+this.progressiveLoadPenalty)+o}traverseVisible(e){const i=this._getNodeInternal(this._rootIndex);t(i)?e(this._rootIndex,null,null):this._traverseVisible(this._rootIndex,-1,i,e)}_traverseVisible(t,s,n,r){if(n.node&&0===n.childCount)return void(this.isGeometryVisible(t)&&r(t,n,s));if(!this.isNodeVisible(t))return;if(r(t,n,s),null==n.node)return;const o=this.nodeTraversalState(n.node);if(o?.nodeHasLOD&&o.lodLevel===this._maxLodLevel)return;const a=i(this._getPage(t));for(let i=0;i<n.childCount;i++){const s=a.children[n.childOffset+i],o=this._getNodeInternal(s);e(o)?this._traverseVisible(s,t,o,r):r(s,null,t)}}traverse(e,t){t(e)&&this.traverseChildren(e,t)}traverseChildren(t,i){const s=t.index,n=this._getNodeInternal(s);e(n)&&this._traverseChildren(s,n,i)}_traverseChildren(i,s,n){const r=this._getPage(i);if(t(r))return;const o=s.childOffset+s.childCount;for(let t=s.childOffset;t<o;++t){const i=r.children[t],s=this._getNodeInternal(i);e(s)&&e(s.node)&&n(s.node)&&this._traverseChildren(i,s,n)}}updateChildrenLoaded(t,i){let s=this.getNode(t);for(;e(s);)s.childrenLoaded+=i,s=this.getParent(s.index)}checkChildrenLoadedInvariant(){if(t(this.rootNode))return!0;const e=[],i=t=>{let s=this._isLoaded(t.index)||this._isReloading(t.index)?1:0;return this.traverseChildren(t,(e=>(s+=i(e),!1))),t.childrenLoaded!==s&&e.push(t.index),s};return i(this.rootNode),e.length&&this._logger.error("childrenLoaded invariant broken at following nodes: "+e.join(",")),e.length>0}updateStats(e){if(this._updates.add.length>0&&(e.nodes+=" + "+this._updates.add.length),(this._indexMissing||this._prefetch.length>0)&&(e.index+=" + "+this._indexMissing||this._prefetch.length),e.prio=this._maxProcessingPrio,this._featureEstimate.estimate){const t=this._featureEstimate.estimate-e.features;t>0?e.features+=" + "+t:t<0&&(e.features+=" - "+-t)}}updateElevationInfo(e,t){this.needNodeElevationRange=t&&e&&("relative-to-ground"===e.mode||"on-the-ground"===e.mode),this._viewportQueries.updateElevationInfo(e),this.invalidateAllElevationRanges()}invalidateAllElevationRanges(){this._forAllNodes((t=>{P(t),e(t.node)&&(t.node.elevationRange=null),e(t.ref)&&(t.ref.elevationRange=null)}))}_forAllNodes(e){for(let t=0;t<this._nodePages.length;t++){const i=this._nodePages[t];if(i){const s=t*this._nodesPerPage;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],s+t)}}}get test(){return{addNode:(e,t)=>this._addNode(e,t)}}}const y=new Map;class N{constructor(e){this.missing=e,this.update=new s({deallocator:null}),this.add=new s({deallocator:null}),this.remove=new s({deallocator:null}),this.cancel=[]}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function P(t){e(t.node)&&(g(t.node.renderMbs),m(t.node.serviceObbInRenderSR)),e(t.ref)&&(g(t.ref.renderMbs),m(t.ref.serviceObbInRenderSR))}function x(e){return f(e,-2)}function I(e){return f(e,2)}function C(e,t){return t+(e?1:0)}function w(e,t){return(-2&e)===t}function M(e){return 1==(1&e)}function S(e,t){return 0===t?0:e/t|0}function R(e,t){return 0===t?e:e%t}const L=[["maxScreenThreshold",a.MaxScreenThreshold],["screenSpaceRelative",a.ScreenSpaceRelative],["removedFeatureDiameter",a.RemovedFeatureDiameter],["distanceRangeFromDefaultCamera",a.DistanceRangeFromDefaultCamera]];function E(e){if(e)for(let t=0;t<e.length;t++)for(const i of L)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:a.None,maxError:0}}class O{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}function V(e){return Math.sqrt(e*(4/Math.PI))}export{p as I3SIndex,E as selectErrorMetric};
|
|
@@ -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 t from"../../../../request.js";import s from"../../../../core/Accessor.js";import{remove as i,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import{resultOrAbort as a,result as n}from"../../../../core/asyncUtils.js";import{estimateStringByteSize as o,estimateNumberByteSize as c}from"../../../../core/byteSizeEstimations.js";import d from"../../../../core/Logger.js";import{isSome as h,unwrap as l,
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../request.js";import s from"../../../../core/Accessor.js";import{remove as i,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import{resultOrAbort as a,result as n}from"../../../../core/asyncUtils.js";import{estimateStringByteSize as o,estimateNumberByteSize as c}from"../../../../core/byteSizeEstimations.js";import d from"../../../../core/Logger.js";import{isSome as h,unwrap as l,destroyMaybe as u,abortMaybe as m,isNone as g,get as p}from"../../../../core/maybe.js";import{whenOrAbort as _}from"../../../../core/promiseUtils.js";import{watch as y,initial as b}from"../../../../core/reactiveUtils.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as O}from"../../../../core/accessorSupport/decorators/subclass.js";import{formatNumber as j}from"../../../../intl/number.js";import{getMaximumQuerySize as v,queryAllJSON as I}from"../../../../layers/support/featureQueryAll.js";import{sceneLayerEditingEnabled as C}from"../../../../support/featureFlags.js";import E from"../FeatureLayerView3D.js";let A=class extends s{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._pendingFetchAbortController=new AbortController,this._interactiveEditingSessions=null,this._maximumNumberOfEditOVerrides=F,this._original3DOFLDefinitionExpression=null,this._associatedLayerView=null,this._changedObjectIds=new Set}initialize(){this._memCache=this.memoryController.newCache(`${this.layer.uid}-attribute-overrides`),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.then((()=>this._pendingFetchAbortController=null)),C()&&h(this._associatedLayer)&&h(this._associatedLayer.infoFor3D)&&this._associatedLayer.load().then((e=>{this.destroyed||(this._original3DOFLDefinitionExpression=e.definitionExpression,this.addHandles(y((()=>this._definitionExpression),(t=>e.definitionExpression=t),b)),this._associatedLayerView=new E({layer:this._associatedLayer,view:this.view}))}))}destroy(){C()&&h(this._associatedLayer)&&h(this._associatedLayer.infoFor3D)&&h(this._associatedLayerView)&&(this._associatedLayer.definitionExpression=l(this._original3DOFLDefinitionExpression)),this._set("layer",null),this._memCache=u(this._memCache),this._pendingFetchAbortController=m(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null}get geometryChangedObjectIds(){return[...this._changedObjectIds]}get _associatedLayer(){return this.layer.associatedLayer}get _definitionExpression(){const e=this.geometryChangedObjectIds;return 0===e.length?"1 = 0":`OBJECTID IN (${e.join(",")})`}get updating(){if(!C())return!1;if(!(h(this._associatedLayer)&&h(this._associatedLayer.infoFor3D)))return!1;return!h(this._associatedLayerView)||h(this._associatedLayerView)&&this._associatedLayerView.updating}createInteractiveEditSession(e){this._changedObjectIds.add(e),this.notifyChange("_changedObjectIds"),g(this._interactiveEditingSessions)&&(this._interactiveEditingSessions=[]);const t=this._interactiveEditingSessions,s=new L(e,{rollback:()=>{i(t,s),0===t.length&&(this._interactiveEditingSessions=null)},commit:t=>{for(const[s,i]of t)this.updateAttributeValue(e,s,i)}});return t.unshift(s),s}async apply(e,t,s){if(g(t))return;const{loadedAttributes:i,attributeData:r}=t;if(g(i)||0===i.length||g(r))return;if(await _(this._pendingFetchChangedObjectIds,s),0===this._changedObjectIds.size)return;const a={loadedAttributes:i,attributeData:r},n=this._getOverridesFromCache(e,a,this._changedObjectIds),{objectIds:o,fieldNames:c}=n,d=await this._queryOverridesFromAssociatedLayer(o,c,s);g(d)||this._processOverridesFromAssociatedLayer(e,d,c,a)}updateGeometry(e){this._changedObjectIds.add(e),this.notifyChange("_changedObjectIds")}updateAttributeValue(e,t,s){this._changedObjectIds.add(e),this._cacheAttributeValue(e,t,s),this.notifyChange("_changedObjectIds")}_cacheAttributeValue(e,t,s){this._memCache.put(this._getAttributeCacheKey(e,t),s,this._memCacheAttributeValueSize(s))}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:s},i){const r=new Set,a=new Array;for(const o of t)a[o.index]=s[o.name];const n=new Set;for(let o=0;o<e.length;o++){const s=e[o];if(i.has(s))for(const e of t){const t=this._fromCache(s,e.index);void 0===t?(r.add(s),n.add(e.name)):a[e.index][o]=t}}return{objectIds:Array.from(r),fieldNames:Array.from(n)}}_fromCache(e,t){const s=this._fromInteractiveEditingSession(e,t);if(void 0!==s)return s;const i=this._getAttributeCacheKey(e,t);return this._memCache.get(i)}_fromInteractiveEditingSession(e,t){if(!g(this._interactiveEditingSessions))for(const s of this._interactiveEditingSessions){if(s.objectId!==e)continue;const i=s.get(t);if(void 0!==i)return i}}_getAttributeCacheKey(e,t){return`${e}-${t}`}async _queryOverridesFromAssociatedLayer(e,t,s){if(0===e.length||0===t.length)return null;e=e.sort(((e,t)=>e-t)),this._warnMaximumChangedObjectsExceeded&&(this._warnMaximumChangedObjectsExceeded=!1,this._logMaximumObjectsExceededWarning());const i=this.layer.associatedLayer;if(g(i))return null;const n=i.createQuery();n.where="1=1",n.returnGeometry=!1,n.outFields=[i.objectIdField,...t],n.cacheHint=!0,n.objectIds=e;const o=v(i),c=e.length>o?r(e,o).map((e=>{const t=n.clone();return t.objectIds=e,a(I(i,t,{signal:s}))})):[a(I(i,n,{signal:s}))];return(await Promise.all(c)).reduce(((e,t)=>e.concat(t.ok?t.value.features:[])),[])}_logMaximumObjectsExceededWarning(){let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${j(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;t&&t.loaded?e+=` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:e+=` (${this.layer.parsedUrl.path})`,d.getLogger("esri.views.3d.layers.i3s.I3SOverrides").warn("#queryOverrides()",this.layer.title,`${e}.`)}_processOverridesFromAssociatedLayer(e,t,s,{loadedAttributes:i,attributeData:r}){const a=this.layer.associatedLayer;if(g(a))return;const n=a.objectIdField,o=s.map((e=>r[e])),c=new Map(i.map((e=>[e.name,e.index]))),d=s.map((e=>c.get(e))),h=new Map(Array.from(e,((e,t)=>[e,t])));for(const l of t){const e=l.attributes[n];for(let t=0;t<s.length;t++){const i=d[t],r=h.get(e),a=l.attributes[s[t]];o[t][r]=a,this._cacheAttributeValue(e,i,a)}}}_memCacheAttributeValueSize(e){return"string"==typeof e?o(e):c()}async _fetchChangedObjectIds(e){const s=this.layer;if(await s.load({signal:e}),this._changedObjectIds.clear(),g(s.associatedLayer)||!s.associatedLayer.capabilities?.operations?.supportsChangeTracking)return;const i=this._getFetchChangedObjectIdsServerGen();if(g(i))return;const r=s.associatedLayer.layerId,a=h(s.associatedLayer.infoFor3D),o=await n(t(`${s.associatedLayer.url}/extractChanges`,{method:"post",query:{f:"json",returnIdsOnly:!0,layers:`[${r}]`,returnUpdates:!0,returnDeletes:a,returnInserts:a,layerServerGens:JSON.stringify([{id:r,serverGen:i}])},timeout:w,signal:e}));if(o.ok&&o.value.data?.edits&&1===o.value.data.edits.length){const e=o.value.data.edits[0],t=p(e,"objectIds","adds"),s=p(e,"objectIds","updates"),i=p(e,"objectIds","deletes");let r=[];h(t)&&(r=r.concat(t)),h(s)&&(r=r.concat(s)),h(i)&&(r=r.concat(i));const a=Math.min(this._maximumNumberOfEditOVerrides,r.length);a<r.length&&(this._warnMaximumChangedObjectsExceeded=!0);const n=r.sort(((e,t)=>e-t));for(let o=0;o<a;o++)this._changedObjectIds.add(n[o])}this.notifyChange("_changedObjectIds")}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(h(e.serviceUpdateTimeStamp)&&h(e.serviceUpdateTimeStamp.lastUpdate))return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return h(t)&&h(t.serverGens)&&h(t.serverGens.minServerGen)?t.serverGens.minServerGen:null}get test(){const e=Array.from(this._changedObjectIds),t=this._pendingFetchChangedObjectIds,s=this;return{changedObjectIds:e,pendingFetchChangedObjectIds:t,get maximumNumberOfEditOVerrides(){return s._maximumNumberOfEditOVerrides},set maximumNumberOfEditOVerrides(e){s._maximumNumberOfEditOVerrides=e}}}};e([f({constructOnly:!0})],A.prototype,"view",void 0),e([f({constructOnly:!0})],A.prototype,"layer",void 0),e([f({readOnly:!0})],A.prototype,"geometryChangedObjectIds",null),e([f()],A.prototype,"_associatedLayer",null),e([f()],A.prototype,"_associatedLayerView",void 0),e([f({constructOnly:!0})],A.prototype,"memoryController",void 0),e([f()],A.prototype,"_changedObjectIds",void 0),e([f()],A.prototype,"_definitionExpression",null),e([f()],A.prototype,"updating",null),A=e([O("esri.views.3d.layers.i3s.I3SOverrides")],A);class L{constructor(e,t){this.objectId=e,this._options=t,this._updates=new Map,this._state=x.ACTIVE}get(e){return this._updates.get(e)}set(e,t){this._isActive&&this._updates.set(e,t)}rollback(){this._isActive&&(this._state=x.ROLLED_BACK,this._options.rollback())}commit(){this._isActive&&(this._state=x.COMMITTED,this._options.commit(this._updates),this._updates.clear())}get _isActive(){return this._state===x.ACTIVE}}var x;!function(e){e[e.ACTIVE=0]="ACTIVE",e[e.COMMITTED=1]="COMMITTED",e[e.ROLLED_BACK=2]="ROLLED_BACK"}(x||(x={}));const w=1e4,F=5e4;export{A as I3SOverrides};
|
|
@@ -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"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import n from"../../../../core/Error.js";import has from"../../../../core/has.js";import{isSome as o,isNone as a}from"../../../../core/maybe.js";import{eachAlways as i}from"../../../../core/promiseUtils.js";import{isInt16Array as s,isInt32Array as c}from"../../../../core/typedArrayUtil.js";import{c as l}from"../../../../chunks/mat3.js";import{c as u}from"../../../../chunks/mat3f64.js";import{a as f}from"../../../../chunks/mat4.js";import{c as p}from"../../../../chunks/mat4f64.js";import{a as m,m as h,c as d}from"../../../../chunks/quat.js";import{c as y}from"../../../../chunks/quatf32.js";import{s as b,c as g,w as S,q as w,g as T,a as E,m as v}from"../../../../chunks/vec3.js";import{c as M}from"../../../../chunks/vec3f64.js";import{canProjectWithoutEngine as I,projectBuffer as R,computeTranslationToOriginAndRotation as x,projectVectorToVector as j}from"../../../../geometry/projection.js";import{getSphericalPCPF as q,getReferenceEllipsoid as k}from"../../../../geometry/projectionEllipsoid.js";import C from"../../../../geometry/SpatialReference.js";import{create as N,empty as U,expandPointInPlace as z,intersects as W}from"../../../../geometry/support/aaBoundingRect.js";import{isPlateCarree as A}from"../../../../geometry/support/spatialReferenceUtils.js";import D from"../../../../rest/support/Query.js";import{readBinaryAttribute as F}from"./I3SBinaryReader.js";import{computeGlobalTransformation as _}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as O,createMaterialFromEdges as G}from"../support/edgeUtils.js";import{parseColorMixMode as K,ColorMixModeEnum as L}from"../support/symbolColorUtils.js";import{create as B,compute as P,corners as $}from"../../support/orientedBoundingBox.js";import{Attribute as Q}from"../../webgl-engine/lib/Attribute.js";function Z(e){return e&&parseInt(e.substring(e.lastIndexOf("/")+1,e.length),10)}function H(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function J(e,t,r,n){r.traverse(t,(t=>{const r=t.mbs;return re(e,r)!==te.OUTSIDE&&(n(t),!0)}))}function V(e,t,r){let n=0,o=0;for(let a=0;a<t.length&&n<e.length;a++)e[n]===t[a]&&(r(a)&&(e[o]=e[n],o++),n++);e.length=o}function X(e,r,n){let o=0,a=0;for(;o<n.length;){t(e,n[o])>=0===r&&(n[a]=n[o],a++),o++}n.length=a}const Y=N();function ee(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return Y[0]=(e[0]-t.position[0])/t.rotationScale[0],Y[1]=(e[1]-t.position[1])/t.rotationScale[4],Y[2]=(e[2]-t.position[0])/t.rotationScale[0],Y[3]=(e[3]-t.position[1])/t.rotationScale[4],Y}var te;function re(e,t){const r=t[0],n=t[1],o=t[3],a=e[0]-r,i=r-e[2],s=e[1]-n,c=n-e[3],l=Math.max(a,i,0),u=Math.max(s,c,0),f=l*l+u*u;if(f>o*o)return te.OUTSIDE;if(f>0)return te.INTERSECTS_CENTER_OUTSIDE;return-Math.max(a,i,s,c)>o?te.INSIDE:te.INTERSECTS_CENTER_INSIDE}function ne(e,t,r){const n=[],o=r&&r.missingFields,a=r&&r.originalFields;for(const i of e){const e=i.toLowerCase();let r=!1;for(const o of t)if(e===o.name.toLowerCase()){n.push(o.name),r=!0,a&&a.push(i);break}!r&&o&&o.push(i)}return n}async function oe(e,t,r,i,s){if(0===t.length)return[];const c=e.attributeStorageInfo;if(o(e.associatedLayer))try{return await ie(e.associatedLayer,t,r,i)}catch(l){if(e.associatedLayer.loaded)throw l}if(c){const o=ae(t,r,s);if(a(o))throw new n("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const l=e.parsedUrl.path;return(await Promise.all(o.map((e=>ce(l,c,e.node,e.indices,i).then((t=>{for(let r=0;r<e.graphics.length;r++){const n=e.graphics[r],o=t[r];if(n.attributes)for(const e in n.attributes)e in o||(o[e]=n.attributes[e]);n.attributes=o}return e.graphics})))))).flat()}throw new n("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function ae(e,t,r){const n=new Map,o=[],a=r();for(const i of e){const e=i.attributes[t];for(let t=0;t<a.length;t++){const r=a[t],s=r.featureIds.indexOf(e);if(s>=0){let e=n.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},o.push(e),n.set(r.node,e)),e.indices.push(s),e.graphics.push(i);for(let r=t;r>0;r--)a[r]=a[r-1];a[0]=r;break}}}return o}async function ie(e,t,r,n){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const o=t.map((e=>e.attributes[r])),a=[],i=ne(n,e.fields,{originalFields:a}),s=await se(e,o,i);for(let c=0;c<t.length;c++){const e=t[c],r=s[c],n={};if(e.attributes)for(const t in e.attributes)n[t]=e.attributes[t];for(let t=0;t<a.length;t++)n[a[t]]=r[i[t]];e.attributes=n}return t}function se(e,t,o){const a=e.capabilities.query.maxRecordCount;if(null!=a&&t.length>a){const n=r(t,a);return Promise.all(n.map((t=>se(e,t,o)))).then((e=>e.flat()))}const i=new D({objectIds:t,outFields:o,orderByFields:[e.objectIdField]});return e.queryFeatures(i).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new n("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function ce(e,t,r,n,o){return le(e,t,r.resources.attributes,n,o)}function le(t,r,n,o,a){const s=[];for(const e of r)if(e&&a.includes(e.name)){const r=`${t}/nodes/${n}/attributes/${e.key}/0`;s.push({url:r,storageInfo:e})}return i(s.map((t=>e(t.url,{responseType:"array-buffer"}).then((e=>F(t.storageInfo,e.data)))))).then((e=>{const t=[];for(const r of o){const n={};for(let t=0;t<e.length;t++)null!=e[t].value&&(n[s[t].storageInfo.name]=pe(e[t].value,r));t.push(n)}return t}))}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(te||(te={}));const ue=-32768,fe=-(2**31);function pe(e,t){if(!e)return null;const r=e[t];if(s(e))return r===ue?null:r;if(c(e))return r===fe?null:r;return r!=r?null:r}function me(e){const t=e.store.indexCRS||e.store.geographicCRS,r=void 0===t?e.store.indexWKT:void 0;if(r){if(!e.spatialReference)throw new n("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indeWKT in the scene layer store but no layer spatial reference",{});if(r!==e.spatialReference.wkt)throw new n("layerview:store-spatial-reference-wkt-index-incompatible","The indeWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const o=t?new C(Z(t)):e.spatialReference;return o.equals(e.spatialReference)?e.spatialReference:o}function he(e){const t=e.store.vertexCRS||e.store.projectedCRS,r=void 0===t?e.store.vertexWKT:void 0;if(r){if(!e.spatialReference)throw new n("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(r!==e.spatialReference.wkt)throw new n("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const o=t?new C(Z(t)):e.spatialReference;return o.equals(e.spatialReference)?e.spatialReference:o}function de(e,t){return a(t)?"@null":t===q(t)?"@ECEF":e.equals(t)?"":null!=t.wkid?"@"+t.wkid:null}function ye(e,t,r){if(!I(e,t))throw new n("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});if("local"===r&&!be(e,t))throw new n("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{})}function be(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function ge(e,t,r){const n=me(e),o=he(e);ye(n,t,r),ye(o,t,r)}function Se(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&(null!=e.vertexAttributes&&null!=e.vertexAttributes.position))}function we(e){if(null==e.store||null==e.store.defaultGeometrySchema||!Se(e.store.defaultGeometrySchema))throw new n("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function Te(e,t){ge(e,t.spatialReference,t.viewingMode)}function Ee(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&(null!=e.vertexAttributes&&null!=e.vertexAttributes.position)))}function ve(e){if(null==e.store||null==e.store.defaultGeometrySchema||!Ee(e.store.defaultGeometrySchema))throw new n("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function Me(e,t){ye(e.spatialReference,t.spatialReference,t.viewingMode)}function Ie(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function Re(e){return"mesh-3d"===e.type}function xe(e){if(null==e||!Ie(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.getSymbols();if(0===t.length)return!0;for(const r of t){if(!Re(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||a(e.material)||a(e.material.color)||"replace"!==e.material.colorMixMode)return!0}return!1}const je=O({color:[0,0,0,0],opacity:0});class qe{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function ke(e){const t=new qe;let r=!1,n=!1;for(const a of e.symbolLayers.items)if("fill"===a.type&&a.enabled){const e=a.material,i=a.edges;if(o(e)&&!r){const n=e.color,i=K(e.colorMixMode);o(n)?t.material={color:[n.r/255,n.g/255,n.b/255],alpha:n.a,colorMixMode:i}:t.material={color:[1,1,1],alpha:1,colorMixMode:L.Multiply},t.castShadows=a.castShadows,r=!0}o(i)&&!n&&(t.edgeMaterial=G(i,{}),n=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:L.Multiply}),t}function Ce(e,t){return(0|e)+(0|t)|0}function Ne(e,t,r,n,o=0){n===q(n)?t.isGeographic?Ke(e,r,t,o):Ge(e,r,t,o):t.isWGS84&&(n.isWebMercator||A(n))?Ue(t,e,n,r,o):t.isWebMercator&&A(n)?_e(t,e,n,r,o):e===r?(r.center[2]+=o,R(r.center,t,0,r.center,n,0,1)):(b(r.center,e.center[0],e.center[1],e.center[2]+o),R(r.center,t,0,r.center,n,0,1),m(r.quaternion,e.quaternion),g(r.halfSize,e.halfSize))}function Ue(e,t,r,n,o){g(De,t.center),De[2]+=o;const a=q(r);R(De,e,0,De,a,0,1),Oe(a,t,De,r,n)}const ze=new Array(24),We=new Q(ze,3,!0),Ae=M(),De=M(),Fe=u();function _e(e,t,r,n,o){g(De,t.center),De[2]+=o,Oe(e,t,De,r,n)}function Oe(e,t,r,n,o){const a=l(Fe,t.quaternion);for(let i=0;i<8;++i){for(let e=0;e<3;++e)Ae[e]=t.halfSize[e]*(0!=(i&1<<e)?-1:1);for(let e=0;e<3;++e){let t=r[e];for(let r=0;r<3;++r)t+=Ae[r]*a[3*r+e];ze[3*i+e]=t}}R(ze,e,0,ze,n,0,8),P(We,o)}function Ge(e,t,r,n){$(e,Je),b(t.center,e.center[0],e.center[1],e.center[2]+n),x(r,t.center,Ze,q(r)),b(t.center,Ze[12],Ze[13],Ze[14]);const o=2*Math.sqrt(1+Ze[0]+Ze[5]+Ze[10]);He[0]=(Ze[6]-Ze[9])/o,He[1]=(Ze[8]-Ze[2])/o,He[2]=(Ze[1]-Ze[4])/o,He[3]=.25*o,h(t.quaternion,He,e.quaternion),d(He,t.quaternion);let a=0,i=0,s=0;for(const c of Je)c[2]+=n,R(c,r,0,c,q(r),0,1),S(et,c,t.center),w(et,et,He),a=Math.max(a,Math.abs(et[0])),i=Math.max(i,Math.abs(et[1])),s=Math.max(s,Math.abs(et[2]));b(t.halfSize,a,i,s)}function Ke(e,t,r,n){const o=k(r),a=1+Math.max(0,n)/(o.radius+e.center[2]);b(t.center,e.center[0],e.center[1],e.center[2]+n),R(t.center,r,0,t.center,q(r),0,1),m(t.quaternion,e.quaternion),d(He,e.quaternion),b(et,0,0,1),w(et,et,He),b(et,e.halfSize[0]*Math.abs(et[0]),e.halfSize[1]*Math.abs(et[1]),e.halfSize[2]*Math.abs(et[2])),T(et,et,o.inverseFlattening),E(t.halfSize,e.halfSize,et),T(t.halfSize,t.halfSize,a)}function Le(e,t,r,n,i,s){if(!s||0===s.length||a(t))return null;const c=_(e.mbs,i,r,t);let l;f(rt,c);const u=()=>{if(!l)if(l=Je,U(Xe),o(e.serviceObb)){Ne(e.serviceObb,r,Ye,t,i),$(Ye,l);for(const e of l)v(e,e,rt),z(Xe,e)}else{const n=e.mbs,o=n[3];j(n,r,et,t),v(et,et,rt),et[2]+=i;for(let e=0;e<8;++e){const t=1&e?o:-o,r=2&e?o:-o,n=4&e?o:-o,a=l[e];g(a,[et[0]+t,et[1]+r,et[2]+n]),z(Xe,a)}}};let p=1/0,m=-1/0;const h=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r.hasZ)return;U(Ve);const o=r.spatialReference||n,a=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(j(r,o,et,t),v(et,et,rt),z(Ve,et),Math.min(et[2],e))),e)),1/0);u(),W(Xe,Ve)&&(p=Math.min(p,a),m=Math.max(m,a))};if(s.forEach((e=>h(e))),p===1/0)return null;const d=(e,t,r)=>{v(et,r,c),e[t+0]=et[0],e[t+1]=et[1],e[t+2]=et[2],t+=24,r[2]=p,v(et,r,c),e[t+0]=et[0],e[t+1]=et[1],e[t+2]=et[2],t+=24,r[2]=m,v(et,r,c),e[t+0]=et[0],e[t+1]=et[1],e[t+2]=et[2]};for(let o=0;o<8;++o)d(tt.data,3*o,l[o]);return P(tt)}function Be(e){return o(e)&&e.halfSize[0]>=0}function Pe(e){return e[3]>=0}function $e(e){o(e)&&(e.halfSize[0]=-1)}function Qe(e){o(e)&&(e[3]=-1)}const Ze=p(),He=y(),Je=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],Ve=N(),Xe=N(),Ye=B(),et=M(),tt={data:new Array(72),size:3,exclusive:!0,stride:3},rt=p();export{te as MbsIntersectResult,qe as SymbolInfo,Ce as addWraparound,Me as checkPointCloudLayerCompatibleWithView,ve as checkPointCloudLayerValid,Te as checkSceneLayerCompatibleWithView,we as checkSceneLayerValid,ye as checkSpatialReference,ge as checkSpatialReferences,Le as computeVisibilityObb,H as containsDraco,Z as extractWkid,V as filterInPlace,ne as findFieldsCaseInsensitive,J as findIntersectingNodes,de as getCacheKeySuffix,pe as getCachedAttributeValue,ee as getClipRect,me as getIndexCrs,ke as getSymbolInfo,he as getVertexCrs,re as intersectBoundingRectWithMbs,Qe as invalidateMbs,$e as invalidateObb,be as isSupportedLocalModeProjection,Pe as isValidMbs,Be as isValidObb,X as objectIdFilter,le as queryAttributesFromCachedAttributesId,xe as rendererNeedsTextures,Ne as transformObb,je as transparentEdgeMaterial,oe as whenGraphicAttributes};
|
|
5
|
+
import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import n from"../../../../core/Error.js";import has from"../../../../core/has.js";import{isSome as o,isNone as a}from"../../../../core/maybe.js";import{eachAlways as i}from"../../../../core/promiseUtils.js";import{isInt16Array as s,isInt32Array as c}from"../../../../core/typedArrayUtil.js";import{c as l}from"../../../../chunks/mat3.js";import{c as u}from"../../../../chunks/mat3f64.js";import{a as f}from"../../../../chunks/mat4.js";import{c as p}from"../../../../chunks/mat4f64.js";import{a as m,m as h,c as d}from"../../../../chunks/quat.js";import{c as y}from"../../../../chunks/quatf32.js";import{s as b,c as g,w as S,q as w,g as T,a as E,m as v}from"../../../../chunks/vec3.js";import{c as M}from"../../../../chunks/vec3f64.js";import{canProjectWithoutEngine as I,projectBuffer as R,computeTranslationToOriginAndRotation as x,projectVectorToVector as j}from"../../../../geometry/projection.js";import{getSphericalPCPF as q,getReferenceEllipsoid as k}from"../../../../geometry/projectionEllipsoid.js";import C from"../../../../geometry/SpatialReference.js";import{create as N,empty as U,expandPointInPlace as z,intersects as W}from"../../../../geometry/support/aaBoundingRect.js";import{isPlateCarree as A}from"../../../../geometry/support/spatialReferenceUtils.js";import D from"../../../../rest/support/Query.js";import{readBinaryAttribute as F}from"./I3SBinaryReader.js";import{computeGlobalTransformation as _}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as O,createMaterialFromEdges as G}from"../support/edgeUtils.js";import{parseColorMixMode as K,ColorMixModeEnum as L}from"../support/symbolColorUtils.js";import{create as B,compute as P,corners as $}from"../../support/orientedBoundingBox.js";import{Attribute as Q}from"../../webgl-engine/lib/Attribute.js";function Z(e){return e?parseInt(e.substring(e.lastIndexOf("/")+1,e.length),10):void 0}function H(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function J(e,t,r,n){r.traverse(t,(t=>{const r=t.mbs;return(null!=r&&re(e,r))!==te.OUTSIDE&&(n(t),!0)}))}function V(e,t,r){let n=0,o=0;for(let a=0;a<t.length&&n<e.length;a++)e[n]===t[a]&&(r(a)&&(e[o]=e[n],o++),n++);e.length=o}function X(e,r,n){let o=0,a=0;for(;o<n.length;){t(e,n[o])>=0===r&&(n[a]=n[o],a++),o++}n.length=a}const Y=N();function ee(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return Y[0]=(e[0]-t.position[0])/t.rotationScale[0],Y[1]=(e[1]-t.position[1])/t.rotationScale[4],Y[2]=(e[2]-t.position[0])/t.rotationScale[0],Y[3]=(e[3]-t.position[1])/t.rotationScale[4],Y}var te;function re(e,t){const r=t[0],n=t[1],o=t[3],a=e[0]-r,i=r-e[2],s=e[1]-n,c=n-e[3],l=Math.max(a,i,0),u=Math.max(s,c,0),f=l*l+u*u;if(f>o*o)return te.OUTSIDE;if(f>0)return te.INTERSECTS_CENTER_OUTSIDE;return-Math.max(a,i,s,c)>o?te.INSIDE:te.INTERSECTS_CENTER_INSIDE}function ne(e,t,r){const n=[],o=r&&r.missingFields,a=r&&r.originalFields;for(const i of e){const e=i.toLowerCase();let r=!1;for(const o of t)if(e===o.name.toLowerCase()){n.push(o.name),r=!0,a&&a.push(i);break}!r&&o&&o.push(i)}return n}async function oe(e,t,r,i,s){if(0===t.length)return[];const c=e.attributeStorageInfo;if(o(e.associatedLayer))try{return await ie(e.associatedLayer,t,r,i)}catch(l){if(e.associatedLayer.loaded)throw l}if(c){const o=ae(t,r,s);if(a(o))throw new n("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const l=e.parsedUrl.path;return(await Promise.all(o.map((e=>ce(l,c,e.node,e.indices,i).then((t=>{for(let r=0;r<e.graphics.length;r++){const n=e.graphics[r],o=t[r];if(n.attributes)for(const e in n.attributes)e in o||(o[e]=n.attributes[e]);n.attributes=o}return e.graphics})))))).flat()}throw new n("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function ae(e,t,r){const n=new Map,o=[],a=r();for(const i of e){const e=i.attributes[t];for(let t=0;t<a.length;t++){const r=a[t],s=r.featureIds.indexOf(e);if(s>=0){let e=n.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},o.push(e),n.set(r.node,e)),e.indices.push(s),e.graphics.push(i);for(let r=t;r>0;r--)a[r]=a[r-1];a[0]=r;break}}}return o}async function ie(e,t,r,n){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const o=t.map((e=>e.attributes[r])),a=[],i=ne(n,e.fields,{originalFields:a}),s=await se(e,o,i);for(let c=0;c<t.length;c++){const e=t[c],r=s[c],n={};if(e.attributes)for(const t in e.attributes)n[t]=e.attributes[t];for(let t=0;t<a.length;t++)n[a[t]]=r[i[t]];e.attributes=n}return t}function se(e,t,o){const a=e.capabilities.query.maxRecordCount;if(null!=a&&t.length>a){const n=r(t,a);return Promise.all(n.map((t=>se(e,t,o)))).then((e=>e.flat()))}const i=new D({objectIds:t,outFields:o,orderByFields:[e.objectIdField]});return e.queryFeatures(i).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new n("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function ce(e,t,r,n,o){return le(e,t,r.resources.attributes,n,o)}function le(t,r,n,o,a){const s=[];for(const e of r)if(e&&a.includes(e.name)){const r=`${t}/nodes/${n}/attributes/${e.key}/0`;s.push({url:r,storageInfo:e})}return i(s.map((t=>e(t.url,{responseType:"array-buffer"}).then((e=>F(t.storageInfo,e.data)))))).then((e=>{const t=[];for(const r of o){const n={};for(let t=0;t<e.length;t++){const o=e[t].value;null!=o&&(n[s[t].storageInfo.name]=pe(o,r))}t.push(n)}return t}))}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(te||(te={}));const ue=-32768,fe=-(2**31);function pe(e,t){if(!e)return null;const r=e[t];if(s(e))return r===ue?null:r;if(c(e))return r===fe?null:r;return r!=r?null:r}function me(e){const t=e.store?.indexCRS||e.store?.geographicCRS,r=void 0===t?e.store?.indexWKT:void 0;if(r){if(!e.spatialReference)throw new n("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indeWKT in the scene layer store but no layer spatial reference",{});if(r!==e.spatialReference.wkt)throw new n("layerview:store-spatial-reference-wkt-index-incompatible","The indeWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const o=t?new C(Z(t)):e.spatialReference;return o.equals(e.spatialReference)?e.spatialReference:o}function he(e){const t=e.store?.vertexCRS||e.store?.projectedCRS,r=void 0===t?e.store?.vertexWKT:void 0;if(r){if(!e.spatialReference)throw new n("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(r!==e.spatialReference.wkt)throw new n("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const o=t?new C(Z(t)):e.spatialReference;return o.equals(e.spatialReference)?e.spatialReference:o}function de(e,t){return a(t)?"@null":t===q(t)?"@ECEF":e.equals(t)?"":null!=t.wkid?"@"+t.wkid:null}function ye(e,t,r){if(!I(e,t))throw new n("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});if("local"===r&&!be(e,t))throw new n("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{})}function be(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function ge(e,t,r){const n=me(e),o=he(e);ye(n,t,r),ye(o,t,r)}function Se(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&(null!=e.vertexAttributes&&null!=e.vertexAttributes.position))}function we(e){if(null==e.store||null==e.store.defaultGeometrySchema||!Se(e.store.defaultGeometrySchema))throw new n("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function Te(e,t){ge(e,t.spatialReference,t.viewingMode)}function Ee(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&(null!=e.vertexAttributes&&null!=e.vertexAttributes.position)))}function ve(e){if(null==e.store||null==e.store.defaultGeometrySchema||!Ee(e.store.defaultGeometrySchema))throw new n("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function Me(e,t){ye(e.spatialReference,t.spatialReference,t.viewingMode)}function Ie(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function Re(e){return"mesh-3d"===e.type}function xe(e){if(null==e||!Ie(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.getSymbols();if(0===t.length)return!0;for(const r of t){if(!Re(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||a(e.material)||a(e.material.color)||"replace"!==e.material.colorMixMode)return!0}return!1}const je=O({color:[0,0,0,0],opacity:0});class qe{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function ke(e){const t=new qe;let r=!1,n=!1;for(const a of e.symbolLayers.items)if("fill"===a.type&&a.enabled){const e=a.material,i=a.edges;if(o(e)&&!r){const n=e.color,i=K(e.colorMixMode);o(n)?t.material={color:[n.r/255,n.g/255,n.b/255],alpha:n.a,colorMixMode:i}:t.material={color:[1,1,1],alpha:1,colorMixMode:L.Multiply},t.castShadows=a.castShadows,r=!0}o(i)&&!n&&(t.edgeMaterial=G(i,{}),n=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:L.Multiply}),t}function Ce(e,t){return(0|e)+(0|t)|0}function Ne(e,t,r,n,o=0){n===q(n)?t.isGeographic?Ke(e,r,t,o):Ge(e,r,t,o):t.isWGS84&&(n.isWebMercator||A(n))?Ue(t,e,n,r,o):t.isWebMercator&&A(n)?_e(t,e,n,r,o):e===r?(r.center[2]+=o,R(r.center,t,0,r.center,n,0,1)):(b(r.center,e.center[0],e.center[1],e.center[2]+o),R(r.center,t,0,r.center,n,0,1),m(r.quaternion,e.quaternion),g(r.halfSize,e.halfSize))}function Ue(e,t,r,n,o){g(De,t.center),De[2]+=o;const a=q(r);R(De,e,0,De,a,0,1),Oe(a,t,De,r,n)}const ze=new Array(24),We=new Q(ze,3,!0),Ae=M(),De=M(),Fe=u();function _e(e,t,r,n,o){g(De,t.center),De[2]+=o,Oe(e,t,De,r,n)}function Oe(e,t,r,n,o){const a=l(Fe,t.quaternion);for(let i=0;i<8;++i){for(let e=0;e<3;++e)Ae[e]=t.halfSize[e]*(0!=(i&1<<e)?-1:1);for(let e=0;e<3;++e){let t=r[e];for(let r=0;r<3;++r)t+=Ae[r]*a[3*r+e];ze[3*i+e]=t}}R(ze,e,0,ze,n,0,8),P(We,o)}function Ge(e,t,r,n){$(e,Je),b(t.center,e.center[0],e.center[1],e.center[2]+n),x(r,t.center,Ze,q(r)),b(t.center,Ze[12],Ze[13],Ze[14]);const o=2*Math.sqrt(1+Ze[0]+Ze[5]+Ze[10]);He[0]=(Ze[6]-Ze[9])/o,He[1]=(Ze[8]-Ze[2])/o,He[2]=(Ze[1]-Ze[4])/o,He[3]=.25*o,h(t.quaternion,He,e.quaternion),d(He,t.quaternion);let a=0,i=0,s=0;for(const c of Je)c[2]+=n,R(c,r,0,c,q(r),0,1),S(et,c,t.center),w(et,et,He),a=Math.max(a,Math.abs(et[0])),i=Math.max(i,Math.abs(et[1])),s=Math.max(s,Math.abs(et[2]));b(t.halfSize,a,i,s)}function Ke(e,t,r,n){const o=k(r),a=1+Math.max(0,n)/(o.radius+e.center[2]);b(t.center,e.center[0],e.center[1],e.center[2]+n),R(t.center,r,0,t.center,q(r),0,1),m(t.quaternion,e.quaternion),d(He,e.quaternion),b(et,0,0,1),w(et,et,He),b(et,e.halfSize[0]*Math.abs(et[0]),e.halfSize[1]*Math.abs(et[1]),e.halfSize[2]*Math.abs(et[2])),T(et,et,o.inverseFlattening),E(t.halfSize,e.halfSize,et),T(t.halfSize,t.halfSize,a)}function Le(e,t,r,n,i,s){if(!s||0===s.length||a(t)||!e.mbs)return null;const c=_(e.mbs,i,r,t);let l;f(rt,c);const u=()=>{if(!l)if(l=Je,U(Xe),o(e.serviceObb)){Ne(e.serviceObb,r,Ye,t,i),$(Ye,l);for(const e of l)v(e,e,rt),z(Xe,e)}else{const n=e.mbs;if(!n)return;const o=n[3];j(n,r,et,t),v(et,et,rt),et[2]+=i;for(let e=0;e<8;++e){const t=1&e?o:-o,r=2&e?o:-o,n=4&e?o:-o,a=l[e];g(a,[et[0]+t,et[1]+r,et[2]+n]),z(Xe,a)}}};let p=1/0,m=-1/0;const h=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;U(Ve);const o=r.spatialReference||n,a=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(j(r,o,et,t),v(et,et,rt),z(Ve,et),Math.min(et[2],e))),e)),1/0);u(),W(Xe,Ve)&&(p=Math.min(p,a),m=Math.max(m,a))};if(s.forEach((e=>h(e))),p===1/0)return null;const d=(e,t,r)=>{v(et,r,c),e[t+0]=et[0],e[t+1]=et[1],e[t+2]=et[2],t+=24,r[2]=p,v(et,r,c),e[t+0]=et[0],e[t+1]=et[1],e[t+2]=et[2],t+=24,r[2]=m,v(et,r,c),e[t+0]=et[0],e[t+1]=et[1],e[t+2]=et[2]};for(let o=0;o<8;++o)d(tt.data,3*o,l[o]);return P(tt)}function Be(e){return o(e)&&e.halfSize[0]>=0}function Pe(e){return e[3]>=0}function $e(e){o(e)&&(e.halfSize[0]=-1)}function Qe(e){o(e)&&(e[3]=-1)}const Ze=p(),He=y(),Je=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],Ve=N(),Xe=N(),Ye=B(),et=M(),tt={data:new Array(72),size:3,exclusive:!0,stride:3},rt=p();export{te as MbsIntersectResult,qe as SymbolInfo,Ce as addWraparound,Me as checkPointCloudLayerCompatibleWithView,ve as checkPointCloudLayerValid,Te as checkSceneLayerCompatibleWithView,we as checkSceneLayerValid,ye as checkSpatialReference,ge as checkSpatialReferences,Le as computeVisibilityObb,H as containsDraco,V as filterInPlace,ne as findFieldsCaseInsensitive,J as findIntersectingNodes,de as getCacheKeySuffix,pe as getCachedAttributeValue,ee as getClipRect,me as getIndexCrs,ke as getSymbolInfo,he as getVertexCrs,re as intersectBoundingRectWithMbs,Qe as invalidateMbs,$e as invalidateObb,be as isSupportedLocalModeProjection,Pe as isValidMbs,Be as isValidObb,X as objectIdFilter,le as queryAttributesFromCachedAttributesId,xe as rendererNeedsTextures,Ne as transformObb,je as transparentEdgeMaterial,oe as whenGraphicAttributes};
|
|
@@ -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{isNone as e,isSome as t}from"../../../../core/maybe.js";import{d as i,i as s,l as r,g as n,e as o,p as a,b as h,a as c}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import{c as
|
|
5
|
+
import{isNone as e,isSome as t}from"../../../../core/maybe.js";import{d as i,i as s,l as r,g as n,e as o,p as a,b as h,a as c}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import{c as l}from"../../../../chunks/vec4.js";import{projectBoundingSphere as p}from"../../../../geometry/projection.js";import{getReferenceEllipsoid as _,getSphericalPCPF as u}from"../../../../geometry/projectionEllipsoid.js";import{create as d,fromMatrix as g,intersectsSphere as b}from"../../../../geometry/support/frustum.js";import{isPlateCarree as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{w as x}from"../../../../chunks/sphere.js";import{makeDehydratedPoint as f}from"../../../../layers/graphics/dehydratedFeatures.js";import{evaluateElevationAlignmentAtPoint as M}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as R}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as D,extractExpressionInfo as S}from"../graphics/featureExpressionInfoUtils.js";import{LodMetric as C}from"./I3SNode.js";import{isValidMbs as E,isValidObb as P,transformObb as O,intersectBoundingRectWithMbs as L,MbsIntersectResult as j}from"./I3SUtil.js";import{create as F,computeOffsetObb as B,isVisible as y}from"../../support/orientedBoundingBox.js";const I=1e5;class A{constructor(e,t,i,s,r,n,o,a,h={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=r,this._elevationProvider=n,this._viewingMode=o,this._options=h,this._frustum=d(),this._useFrustumCulling=!1,this._poi=m(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=F(),this._tmp1=m(),this._tmp2=m(),this._tmp3=m(),this._tmp0=m(),this._screenspaceErrorBias=h.screenspaceErrorBias||1,this._progressiveLoadFactor=h.progressiveLoadFactor||1,this.updateCamera(i,s),this.engineSR=this._renderCoordsHelper.spatialReference,this.updateElevationInfo(a),this._tmpPoint=f(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(this.engineSR.isWebMercator||v(this.engineSR)),this._indexSREllipsoidRadius=_(this._indexSR).radius}updateElevationInfo(e){null!=e?(this._elevationContext=R.fromElevationInfo(e),this._elevationContext.updateFeatureExpressionInfoContext(D(S(e,!1)))):this._elevationContext=null}updateCamera(e,t){this._useFrustumCulling=t,t&&g(e.viewMatrix,e.projectionMatrix,this._frustum),this._screenSizeFactor=1/(e.perScreenPixelRatio/2),this._camPos=e.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}getElevationRange(i){if(e(this._elevationContext))return null;const s=i.mbs;if(!s)return null;const r=s[0],n=s[1],o=s[2],a=s[3],h="relative-to-scene"===this._elevationContext.mode?"scene":"ground";if(this._elevationProvider.getSphereElevationBounds)return this._elevationProvider.getSphereElevationBounds(r,n,o,a,this._indexSR,h);const c=this._elevationProvider.getElevation(r,n,o,this._indexSR,h);return t(c)?{min:c,max:c}:null}getRenderMbs(e){const t=e.renderMbs;return E(t)||(e.mbs&&l(t,e.mbs),this._elevationContext&&t[3]<I&&(this._tmpPoint.x=t[0],this._tmpPoint.y=t[1],this._tmpPoint.z=t[2],t[2]=M(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper)),p(t,this._indexSR,t,this.engineSR)),t}getVisibilityObb(i){if(t(i.visibilityObb))return i.visibilityObb;const s=i.serviceObb,r=.01*this._indexSREllipsoidRadius;return e(s)||!i.mbs||!P(s)||this._isECEFOBBInLocalMode&&s.halfSize.some((e=>e>r))?null:(i.serviceObbInRenderSR=this._computeRenderObb(s,i.serviceObbInRenderSR,i.mbs[3],i.elevationRange),i.serviceObbInRenderSR)}_computeRenderObb(i,s,r,n){if(e(s))s=F();else if(P(s))return s;let o=0,a=0;if(this._elevationContext&&t(n)&&Number.isFinite(n.min))switch(this._elevationContext.mode){case"relative-to-ground":o=this._elevationContext.geometryZWithOffset(i.center[2],this._renderCoordsHelper)+n.min-i.center[2],a=n.max-n.min;break;case"on-the-ground":o=n.min-i.center[2],a=n.max-n.min}else this._elevationContext&&r<I&&(this._tmpPoint.x=i.center[0],this._tmpPoint.y=i.center[1],this._tmpPoint.z=i.center[2],o=M(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper)-i.center[2]);return a>0?(O(i,this._indexSR,this._tmpObb,this.engineSR,o),B(this._tmpObb,0,a,this._viewingMode,s)):O(i,this._indexSR,s,this.engineSR,o),s}isNodeVisible(e){const i=this.getRenderMbs(e);if(!this._isMBSinClippingArea(i))return!1;if(!this._useFrustumCulling)return!0;const s=this.getVisibilityObb(e);return t(s)?y(s,this._frustum):b(this._frustum,x(i))}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const i=e.geometryObb;return t(i)?y(i,this._frustum):this.isNodeVisible(e)}_isMBSinClippingArea(t){return!!e(this._clippingArea)||L(this._clippingArea,t)!==j.OUTSIDE}_screenSpaceDiameterMbs(e,t){const s=this.getRenderMbs(e),r=Math.sqrt(i(s,this._camPos)),n=r-s[3];return this._updateMinMaxDistance(r),n<0?.5*Number.MAX_VALUE:t/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getRenderMbs(e)[3]}calcCameraDistanceToCenter(e){const t=this.getRenderMbs(e),i=s(t,this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const t=this.getRenderMbs(e),i=t[3],n=(Math.abs(t[0]*(t[0]-this._camPos[0])+t[1]*(t[1]-this._camPos[1])+t[2]*(t[2]-this._camPos[2]))/r(t)+i)/s(t,this._camPos);return Math.min(1,n)}hasLOD(e){return e.lodMetric!==C.None}_getDistancePlanarMode(e,t){const i=e[0]-t[0],s=e[1]-t[1],r=e[2]-t[2],n=i*i+s*s,o=t[3];if(n<=o*o)return Math.abs(r);const a=Math.sqrt(n)-o;return Math.sqrt(r*r+a*a)}_getDistanceGlobeMode(e,t){const m=r(t),l=r(e)-m;n(this._tmp0,e,o(e,t)/a(e));const p=i(t,this._tmp0),_=t[3];if(p<=_*_)return Math.abs(l);{const i=n(this._tmp0,t,1/m),a=m,p=_*_/2/a,u=n(this._tmp1,i,a-p),d=e,g=h(this._tmp2,d,u),b=h(this._tmp2,g,n(this._tmp3,i,o(i,g))),v=c(this._tmp2,u,n(this._tmp2,b,_/r(b)));let x=s(d,v);if(l>=2e5){const e=h(this._tmp1,d,v);let t=o(e,i)/r(e);t<.08&&(t=1e-4),x/=t}return x}}_getDistance(e,t){return this.engineSR===u(this.engineSR)?this._getDistanceGlobeMode(e,t):this._getDistancePlanarMode(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(e.lodMetric===C.None)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case C.ScreenSpaceRelative:{const i=this.getRenderMbs(e),s=this._getDistance(this._camPos,i),r=2*s/this._screenSizeFactor,n=s+i[3];return this._updateMinMaxDistance(n),e.maxError*t<=r}case C.MaxScreenThreshold:{let i=this._screenSpaceDiameterMbs(e,e.mbs[3]*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case C.RemovedFeatureDiameter:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case C.DistanceRangeFromDefaultCamera:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToPOI(e){const t=this.getRenderMbs(e);return s(t,this._poi)-t[3]}distCameraToPOI(){return s(this._camPos,this._poi)}}export{A 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{clone as t}from"../../../../core/lang.js";import{isSome as e,isNone as n}from"../../../../core/maybe.js";import{attributeLookup as r}from"../support/attributeUtils.js";const o={setAttribute(){},rollback(){},commit(){}};var s;function i(e,r){const i=r.attributes[e.objectIdField],a=e.sessions.get(i);if(a)return a;const u=t(r.attributes),c=new Set;if(null==i)return o;const f=e.i3sOverrides.createInteractiveEditSession(i),d=new Map,l=(t,e)=>{const n=d.get(t);if(null==n){const n=e.indexOf(i);return d.set(t,n),n}return n};let I=s.EDITING;const b={setAttribute(t,o){if(I!==s.EDITING)return;const i=e.fieldsIndex.get(t);if(n(i))return;const a=e.attributeStorageInfo.findIndex((t=>t.name===i.name));if(a<0)return;f.set(a,o);const u=e.attributeStorageInfo[a];let d=!1;c.add(t),e.forEachNode(((t,n)=>{const s=l(t,n);if(-1===s)return;const i=e.getAttributeData(t.index);if(i){const n=i[u.name];n&&(n[s]=o,e.setAttributeData(t.index,i,r),d=!0)}})),d&&e.clearMemCache()},rollback(){if(I===s.EDITING){for(const t of c)this.setAttribute(t,u[t]);f.rollback(),I=s.ROLLED_BACK,e.sessions.delete(i)}},commit(){I===s.EDITING&&(f.commit(),I=s.COMMITTED,e.sessions.delete(i))}};return e.sessions.set(i,b),b}function a(t,e){const n=[...e.addedFeatures,...e.updatedFeatures,...e.deletedFeatures];for(const r of n)r.objectId&&t.i3sOverrides.updateGeometry(r.objectId)}function u(t,n){const r=c(t,n);if(0===r.size)return;const o=new Map;for(let e=0;e<t.attributeStorageInfo.length;e++)o.set(t.attributeStorageInfo[e].name,e);let s=!1;r.forEach(((n,r)=>{const i=t.getAttributeData(r);let a=!1;n.forEach(((n,r)=>{const u=e(i)?i[r]:null,c=o.get(r);for(const{featureIndex:e,value:o,featureId:i}of n)u&&(u[e]=o,a=!0,s=!0),t.i3sOverrides.updateAttributeValue(i,c,o)})),a&&t.setAttributeData(r,i,null)})),s&&t.clearMemCache()}function c(t,e){const n=e.edits.updateFeatures;if(!n||0===n.length)return new b;const o=l(e),s=new b,i=new Map;for(let r=0;r<t.attributeStorageInfo.length;r++)i.set(t.attributeStorageInfo[r].name,r);const a=t.fieldsIndex,u=t.objectIdField,c=n.filter((t=>{const e=r(a,t.attributes,u);return o.has(e)}));return t.forEachNode(((e,n)=>{const o=new Set(n);for(const i of c){const c=r(a,i.attributes,u);if(!o.has(c))continue;const d=n.indexOf(c);for(const n in i.attributes){const r=t.fieldsIndex.normalizeFieldName(n),o=f(s,e.index,r),a=i.attributes[n];o.push({featureIndex:d,featureId:c,value:a})}}})),s}function f(t,e,n){const r=d(t,e),o=r.get(n);if(o)return o;const s=new Array;return r.set(n,s),s}function d(t,e){const n=t.get(e);if(n)return n;const r=new I;return t.set(e,r),r}function l(t){const e=new Set;if(!t.updatedFeatures)return e;for(const n of t.updatedFeatures)null!=n.objectId&&null==n.error&&e.add(n.objectId);return e}!function(t){t[t.EDITING=0]="EDITING",t[t.ROLLED_BACK=1]="ROLLED_BACK",t[t.COMMITTED=2]="COMMITTED"}(s||(s={}));const I=Map,b=Map;export{i as createInteractiveEditSession,u as processAttributeEdits,a as processGeometryEdits};
|
|
5
|
+
import{clone as t}from"../../../../core/lang.js";import{isSome as e,isNone as n}from"../../../../core/maybe.js";import{attributeLookup as r}from"../support/attributeUtils.js";const o={setAttribute(){},rollback(){},commit(){}};var s;function i(e,r){const i=r.attributes[e.objectIdField],a=e.sessions.get(i);if(a)return a;const u=t(r.attributes),c=new Set;if(null==i)return o;const f=e.i3sOverrides.createInteractiveEditSession(i),d=new Map,l=(t,e)=>{const n=d.get(t);if(null==n){const n=e.indexOf(i);return d.set(t,n),n}return n};let I=s.EDITING;const b={setAttribute(t,o){if(I!==s.EDITING)return;const i=e.fieldsIndex.get(t);if(n(i))return;const a=e.attributeStorageInfo.findIndex((t=>t.name===i.name));if(a<0)return;f.set(a,o);const u=e.attributeStorageInfo[a];let d=!1;c.add(t),e.forEachNode(((t,n)=>{const s=l(t,n);if(-1===s)return;const i=e.getAttributeData(t.index);if(i){const n=i[u.name];n&&(n[s]=o,e.setAttributeData(t.index,i,r),d=!0)}})),d&&e.clearMemCache()},rollback(){if(I===s.EDITING){for(const t of c)this.setAttribute(t,u[t]);f.rollback(),I=s.ROLLED_BACK,e.sessions.delete(i)}},commit(){I===s.EDITING&&(f.commit(),I=s.COMMITTED,e.sessions.delete(i))}};return e.sessions.set(i,b),b}function a(t,e){const n=[...e.addedFeatures,...e.updatedFeatures,...e.deletedFeatures];for(const r of n)r.objectId&&t.i3sOverrides.updateGeometry(r.objectId)}function u(t,n){const r=c(t,n);if(0===r.size)return;const o=new Map;for(let e=0;e<t.attributeStorageInfo.length;e++)o.set(t.attributeStorageInfo[e].name,e);let s=!1;r.forEach(((n,r)=>{const i=t.getAttributeData(r);let a=!1;n.forEach(((n,r)=>{const u=e(i)?i[r]:null,c=o.get(r);for(const{featureIndex:e,value:o,featureId:i}of n)u&&(u[e]=o,a=!0,s=!0),t.i3sOverrides.updateAttributeValue(i,c,o)})),a&&t.setAttributeData(r,i,null)})),s&&t.clearMemCache()}function c(t,e){const n=e.edits.updateFeatures;if(!n||0===n.length)return new b;const o=l(e),s=new b,i=new Map;for(let r=0;r<t.attributeStorageInfo.length;r++)i.set(t.attributeStorageInfo[r].name,r);const a=t.fieldsIndex,u=t.objectIdField,c=n.filter((t=>{const e=r(a,t.attributes,u);return o.has(e)}));return t.forEachNode(((e,n)=>{const o=new Set(n);for(const i of c){const c=r(a,i.attributes,u);if(!o.has(c))continue;const d=n.indexOf(c);for(const n in i.attributes){const r=t.fieldsIndex.normalizeFieldName(n),o=f(s,e.index,r),a=i.attributes[n];o.push({featureIndex:d,featureId:c,value:a})}}})),s}function f(t,e,n){const r=d(t,e),o=null!=n&&r.get(n);if(o)return o;const s=new Array;return r.set(n,s),s}function d(t,e){const n=t.get(e);if(n)return n;const r=new I;return t.set(e,r),r}function l(t){const e=new Set;if(!t.updatedFeatures)return e;for(const n of t.updatedFeatures)null!=n.objectId&&null==n.error&&e.add(n.objectId);return e}!function(t){t[t.EDITING=0]="EDITING",t[t.ROLLED_BACK=1]="ROLLED_BACK",t[t.COMMITTED=2]="COMMITTED"}(s||(s={}));const I=Map,b=Map;export{i as createInteractiveEditSession,u as processAttributeEdits,a as processGeometryEdits};
|
|
@@ -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{clamp as e}from"../../../../core/mathUtils.js";import{f as o}from"../../../../chunks/mat3.js";import{c as t}from"../../../../chunks/mat3f64.js";import{i,c as n,s as r,m as s,k as l,v as a,o as u,r as f,n as c}from"../../../../chunks/mat4.js";import{c as p}from"../../../../chunks/mat4f64.js";import{s as d}from"../../../../chunks/vec3.js";import{c as v}from"../../../../chunks/vec3f64.js";import{meterIn as z}from"../../../../renderers/support/lengthUtils.js";import m from"../../support/debugFlags.js";var S,y;function h(e){return null!=e}function x(e){return"number"==typeof e}function b(e){return"string"==typeof e}function C(e){return null==e||b(e)}function g(e,o){e&&e.push(o)}function V(e,o,t,i=p()){const n=e||0,r=o||0,s=t||0;return 0!==n&&u(i,i,-n/180*Math.PI),0!==r&&f(i,i,r/180*Math.PI),0!==s&&c(i,i,s/180*Math.PI),i}function D(e,o,t,i,n){const r=e.minSize,s=e.maxSize;if(e.expression)return g(n,"Could not convert size info: expression not supported"),!1;if(e.useSymbolValue){const e=i.symbolSize[t];return o.minSize[t]=e,o.maxSize[t]=e,o.offset[t]=o.minSize[t],o.factor[t]=0,o.type[t]=S.DefinedSize,!0}if(h(e.field))return h(e.stops)?2===e.stops.length&&x(e.stops[0].size)&&x(e.stops[1].size)?(M(e.stops[0].size,e.stops[1].size,e.stops[0].value,e.stops[1].value,o,t),o.type[t]=S.DefinedSize,!0):(g(n,"Could not convert size info: stops only supported with 2 elements"),!1):x(r)&&x(s)&&h(e.minDataValue)&&h(e.maxDataValue)?(M(r,s,e.minDataValue,e.maxDataValue,o,t),o.type[t]=S.DefinedSize,!0):null!=z[e.valueUnit]?(o.minSize[t]=-1/0,o.maxSize[t]=1/0,o.offset[t]=0,o.factor[t]=1/z[e.valueUnit],o.type[t]=S.DefinedSize,!0):"unknown"===e.valueUnit?(g(n,"Could not convert size info: proportional size not supported"),!1):(g(n,"Could not convert size info: scale-dependent size not supported"),!1);if(!h(e.field)){if(e.stops&&e.stops[0]&&x(e.stops[0].size))return o.minSize[t]=e.stops[0].size,o.maxSize[t]=e.stops[0].size,o.offset[t]=o.minSize[t],o.factor[t]=0,o.type[t]=S.DefinedSize,!0;if(x(r))return o.minSize[t]=r,o.maxSize[t]=r,o.offset[t]=r,o.factor[t]=0,o.type[t]=S.DefinedSize,!0}return g(n,"Could not convert size info: unsupported variant of sizeInfo"),!1}function M(e,o,t,i,n,r){const s=Math.abs(i-t)>0?(o-e)/(i-t):0;n.minSize[r]=s>0?e:o,n.maxSize[r]=s>0?o:e,n.offset[r]=e-t*s,n.factor[r]=s}function U(e,o,t,i){if(e.normalizationField||e.valueRepresentation)return g(i,"Could not convert size info: unsupported property"),null;if(!C(e.field))return g(i,"Could not convert size info: field is not a string"),null;if(o.size){if(e.field)if(o.size.field){if(e.field!==o.size.field)return g(i,"Could not convert size info: multiple fields in use"),null}else o.size.field=e.field}else o.size={field:e.field,minSize:[0,0,0],maxSize:[0,0,0],offset:[0,0,0],factor:[0,0,0],type:[S.Undefined,S.Undefined,S.Undefined]};let n;switch(e.axis){case"width":return n=D(e,o.size,0,t,i),n?o:null;case"height":return n=D(e,o.size,2,t,i),n?o:null;case"depth":return n=D(e,o.size,1,t,i),n?o:null;case"width-and-depth":return n=D(e,o.size,0,t,i),n&&D(e,o.size,1,t,i),n?o:null;case null:case void 0:case"all":return n=D(e,o.size,0,t,i),n=n&&D(e,o.size,1,t,i),n=n&&D(e,o.size,2,t,i),n?o:null;default:return g(i,`Could not convert size info: unknown axis "${e.axis}""`),null}}function T(e,o,t){for(let n=0;n<3;++n){let t=o.unitInMeters;e.type[n]===S.DefinedSize&&(t*=o.modelSize[n],e.type[n]=S.DefinedScale),e.minSize[n]=e.minSize[n]/t,e.maxSize[n]=e.maxSize[n]/t,e.offset[n]=e.offset[n]/t,e.factor[n]=e.factor[n]/t}let i;if(e.type[0]!==S.Undefined)i=0;else if(e.type[1]!==S.Undefined)i=1;else{if(e.type[2]===S.Undefined)return g(t,"No size axis contains a valid size or scale"),!1;i=2}for(let n=0;n<3;++n)e.type[n]===S.Undefined&&(e.minSize[n]=e.minSize[i],e.maxSize[n]=e.maxSize[i],e.offset[n]=e.offset[i],e.factor[n]=e.factor[i],e.type[n]=e.type[i]);return!0}function E(e,o,t){e[4*o+0]=t.r/255,e[4*o+1]=t.g/255,e[4*o+2]=t.b/255,e[4*o+3]=t.a}function O(e,o,t){if(e.normalizationField)return g(t,"Could not convert color info: unsupported property"),null;if(b(e.field)){if(!e.stops)return g(t,"Could not convert color info: missing stops or colors"),null;{if(e.stops.length>8)return g(t,"Could not convert color info: too many color stops"),null;o.color={field:e.field,values:[0,0,0,0,0,0,0,0],colors:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};const i=e.stops;for(let e=0;e<8;++e){const t=i[Math.min(e,i.length-1)];o.color.values[e]=t.value,E(o.color.colors,e,t.color)}}}else{if(!(e.stops&&e.stops.length>=0))return g(t,"Could not convert color info: no field and no colors/stops"),null;{const t=e.stops&&e.stops.length>=0&&e.stops[0].color;o.color={field:null,values:[0,0,0,0,0,0,0,0],colors:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};for(let e=0;e<8;e++)o.color.values[e]=1/0,E(o.color.colors,e,t)}}return o}function j(e,o,t){if(e.normalizationField)return g(t,"Could not convert opacity info: unsupported property"),null;if(b(e.field)){if(!e.stops)return g(t,"Could not convert opacity info: missing stops or opacities"),null;{if(e.stops.length>8)return g(t,"Could not convert opacity info: too many opacity stops"),null;o.opacity={field:e.field,values:[0,0,0,0,0,0,0,0],opacityValues:[0,0,0,0,0,0,0,0]};const i=e.stops;for(let e=0;e<8;++e){const t=i[Math.min(e,i.length-1)];o.opacity.values[e]=t.value,o.opacity.opacityValues[e]=t.opacity}}}else{if(!(e.stops&&e.stops.length>=0))return g(t,"Could not convert opacity info: no field and no opacities/stops"),null;{const t=e.stops&&e.stops.length>=0
|
|
5
|
+
import"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{f as o}from"../../../../chunks/mat3.js";import{c as t}from"../../../../chunks/mat3f64.js";import{i,c as n,s as r,m as s,k as l,v as a,o as u,r as f,n as c}from"../../../../chunks/mat4.js";import{c as p}from"../../../../chunks/mat4f64.js";import{s as d}from"../../../../chunks/vec3.js";import{c as v}from"../../../../chunks/vec3f64.js";import{meterIn as z}from"../../../../renderers/support/lengthUtils.js";import m from"../../support/debugFlags.js";var S,y;function h(e){return null!=e}function x(e){return"number"==typeof e}function b(e){return"string"==typeof e}function C(e){return null==e||b(e)}function g(e,o){e&&e.push(o)}function V(e,o,t,i=p()){const n=e||0,r=o||0,s=t||0;return 0!==n&&u(i,i,-n/180*Math.PI),0!==r&&f(i,i,r/180*Math.PI),0!==s&&c(i,i,s/180*Math.PI),i}function D(e,o,t,i,n){const r=e.minSize,s=e.maxSize;if(e.expression)return g(n,"Could not convert size info: expression not supported"),!1;if(e.useSymbolValue){const e=i.symbolSize[t];return o.minSize[t]=e,o.maxSize[t]=e,o.offset[t]=o.minSize[t],o.factor[t]=0,o.type[t]=S.DefinedSize,!0}if(h(e.field))return h(e.stops)?2===e.stops.length&&x(e.stops[0].size)&&x(e.stops[1].size)?(M(e.stops[0].size,e.stops[1].size,e.stops[0].value,e.stops[1].value,o,t),o.type[t]=S.DefinedSize,!0):(g(n,"Could not convert size info: stops only supported with 2 elements"),!1):x(r)&&x(s)&&h(e.minDataValue)&&h(e.maxDataValue)?(M(r,s,e.minDataValue,e.maxDataValue,o,t),o.type[t]=S.DefinedSize,!0):null!=z[e.valueUnit]?(o.minSize[t]=-1/0,o.maxSize[t]=1/0,o.offset[t]=0,o.factor[t]=1/z[e.valueUnit],o.type[t]=S.DefinedSize,!0):"unknown"===e.valueUnit?(g(n,"Could not convert size info: proportional size not supported"),!1):(g(n,"Could not convert size info: scale-dependent size not supported"),!1);if(!h(e.field)){if(e.stops&&e.stops[0]&&x(e.stops[0].size))return o.minSize[t]=e.stops[0].size,o.maxSize[t]=e.stops[0].size,o.offset[t]=o.minSize[t],o.factor[t]=0,o.type[t]=S.DefinedSize,!0;if(x(r))return o.minSize[t]=r,o.maxSize[t]=r,o.offset[t]=r,o.factor[t]=0,o.type[t]=S.DefinedSize,!0}return g(n,"Could not convert size info: unsupported variant of sizeInfo"),!1}function M(e,o,t,i,n,r){const s=Math.abs(i-t)>0?(o-e)/(i-t):0;n.minSize[r]=s>0?e:o,n.maxSize[r]=s>0?o:e,n.offset[r]=e-t*s,n.factor[r]=s}function U(e,o,t,i){if(e.normalizationField||e.valueRepresentation)return g(i,"Could not convert size info: unsupported property"),null;if(!C(e.field))return g(i,"Could not convert size info: field is not a string"),null;if(o.size){if(e.field)if(o.size.field){if(e.field!==o.size.field)return g(i,"Could not convert size info: multiple fields in use"),null}else o.size.field=e.field}else o.size={field:e.field,minSize:[0,0,0],maxSize:[0,0,0],offset:[0,0,0],factor:[0,0,0],type:[S.Undefined,S.Undefined,S.Undefined]};let n;switch(e.axis){case"width":return n=D(e,o.size,0,t,i),n?o:null;case"height":return n=D(e,o.size,2,t,i),n?o:null;case"depth":return n=D(e,o.size,1,t,i),n?o:null;case"width-and-depth":return n=D(e,o.size,0,t,i),n&&D(e,o.size,1,t,i),n?o:null;case null:case void 0:case"all":return n=D(e,o.size,0,t,i),n=n&&D(e,o.size,1,t,i),n=n&&D(e,o.size,2,t,i),n?o:null;default:return g(i,`Could not convert size info: unknown axis "${e.axis}""`),null}}function T(e,o,t){for(let n=0;n<3;++n){let t=o.unitInMeters;e.type[n]===S.DefinedSize&&(t*=o.modelSize[n],e.type[n]=S.DefinedScale),e.minSize[n]=e.minSize[n]/t,e.maxSize[n]=e.maxSize[n]/t,e.offset[n]=e.offset[n]/t,e.factor[n]=e.factor[n]/t}let i;if(e.type[0]!==S.Undefined)i=0;else if(e.type[1]!==S.Undefined)i=1;else{if(e.type[2]===S.Undefined)return g(t,"No size axis contains a valid size or scale"),!1;i=2}for(let n=0;n<3;++n)e.type[n]===S.Undefined&&(e.minSize[n]=e.minSize[i],e.maxSize[n]=e.maxSize[i],e.offset[n]=e.offset[i],e.factor[n]=e.factor[i],e.type[n]=e.type[i]);return!0}function E(e,o,t){e[4*o+0]=t.r/255,e[4*o+1]=t.g/255,e[4*o+2]=t.b/255,e[4*o+3]=t.a}function O(e,o,t){if(e.normalizationField)return g(t,"Could not convert color info: unsupported property"),null;if(b(e.field)){if(!e.stops)return g(t,"Could not convert color info: missing stops or colors"),null;{if(e.stops.length>8)return g(t,"Could not convert color info: too many color stops"),null;o.color={field:e.field,values:[0,0,0,0,0,0,0,0],colors:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};const i=e.stops;for(let e=0;e<8;++e){const t=i[Math.min(e,i.length-1)];o.color.values[e]=t.value,E(o.color.colors,e,t.color)}}}else{if(!(e.stops&&e.stops.length>=0))return g(t,"Could not convert color info: no field and no colors/stops"),null;{const t=e.stops&&e.stops.length>=0&&e.stops[0].color;o.color={field:null,values:[0,0,0,0,0,0,0,0],colors:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};for(let e=0;e<8;e++)o.color.values[e]=1/0,E(o.color.colors,e,t)}}return o}function j(e,o,t){if(e.normalizationField)return g(t,"Could not convert opacity info: unsupported property"),null;if(b(e.field)){if(!e.stops)return g(t,"Could not convert opacity info: missing stops or opacities"),null;{if(e.stops.length>8)return g(t,"Could not convert opacity info: too many opacity stops"),null;o.opacity={field:e.field,values:[0,0,0,0,0,0,0,0],opacityValues:[0,0,0,0,0,0,0,0]};const i=e.stops;for(let e=0;e<8;++e){const t=i[Math.min(e,i.length-1)];o.opacity.values[e]=t.value,o.opacity.opacityValues[e]=t.opacity}}}else{if(!(e.stops&&e.stops.length>=0))return g(t,"Could not convert opacity info: no field and no opacities/stops"),null;{const t=e.stops&&e.stops.length>=0?e.stops[0].opacity:0;o.opacity={field:null,values:[0,0,0,0,0,0,0,0],opacityValues:[0,0,0,0,0,0,0,0]};for(let e=0;e<8;e++)o.opacity.values[e]=1/0,o.opacity.opacityValues[e]=t}}return o}function k(e,o,t){const i=2===t&&"arithmetic"===e.rotationType;o.offset[t]=i?90:0,o.factor[t]=i?-1:1,o.type[t]=1}function w(e,o,t){if(!b(e.field))return g(t,"Could not convert rotation info: field is not a string"),null;if(o.rotation){if(e.field)if(o.rotation.field){if(e.field!==o.rotation.field)return g(t,"Could not convert rotation info: multiple fields in use"),null}else o.rotation.field=e.field}else o.rotation={field:e.field,offset:[0,0,0],factor:[1,1,1],type:[0,0,0]};switch(e.axis){case"tilt":return k(e,o.rotation,0),o;case"roll":return k(e,o.rotation,1),o;case null:case void 0:case"heading":return k(e,o.rotation,2),o;default:return g(t,`Could not convert rotation info: unknown axis "${e.axis}""`),null}}function F(e,o,t){if(!e)return null;const i=!o.supportedTypes||!!o.supportedTypes.size,n=!o.supportedTypes||!!o.supportedTypes.color,r=!o.supportedTypes||!!o.supportedTypes.rotation,s=!!o.supportedTypes&&!!o.supportedTypes.opacity,l=e.reduce(((e,l)=>{if(!e)return e;if(l.valueExpression)return g(t,"Could not convert visual variables: arcade expressions not supported"),null;switch(l.type){case"size":return i?U(l,e,o,t):e;case"color":return n?O(l,e,t):e;case"opacity":return s?j(l,e,t):null;case"rotation":return r?w(l,e,t):e;default:return null}}),{size:null,color:null,opacity:null,rotation:null});return!(e.length>0&&l)||l.size||l.color||l.opacity||l.rotation?l&&l.size&&!T(l.size,o,t)?null:l:null}function A(e){return e&&null!=e.size}function I(e,o){if(!e)return{enabled:!1};if(m.TESTS_DISABLE_FAST_UPDATES)return{enabled:!1};const t=F(e.visualVariables,o);return t?{enabled:!0,visualVariables:t,materialParameters:_(t,o),requiresShaderTransformation:A(t)}:{enabled:!1}}function P(e,o,t){if(!o||!e.enabled)return!1;const i=e.visualVariables,n=F(o.visualVariables,t);return!!n&&(!!(R(i.size,n.size,"size")&&R(i.color,n.color,"color")&&R(i.rotation,n.rotation,"rotation")&&R(i.opacity,n.opacity,"opacity"))&&(e.visualVariables=n,e.materialParameters=_(n,t),e.requiresShaderTransformation=A(n),!0))}function R(e,o,t){if(!!e!=!!o)return!1;if(e&&e.field!==o.field)return!1;if(e&&"rotation"===t){const t=e,i=o;for(let e=0;e<3;e++)if(t.type[e]!==i.type[e]||t.offset[e]!==i.offset[e]||t.factor[e]!==i.factor[e])return!1}return!0}function _(e,n){const r={vvSizeEnabled:!1,vvSizeMinSize:null,vvSizeMaxSize:null,vvSizeOffset:null,vvSizeFactor:null,vvSizeValue:null,vvColorEnabled:!1,vvColorValues:null,vvColorColors:null,vvOpacityEnabled:!1,vvOpacityValues:null,vvOpacityOpacities:null,vvSymbolAnchor:null,vvSymbolRotationMatrix:null},s=A(e);return e&&e.size?(r.vvSizeEnabled=!0,r.vvSizeMinSize=e.size.minSize,r.vvSizeMaxSize=e.size.maxSize,r.vvSizeOffset=e.size.offset,r.vvSizeFactor=e.size.factor):e&&s&&(r.vvSizeValue=n.transformation.scale),e&&s&&(r.vvSymbolAnchor=n.transformation.anchor,r.vvSymbolRotationMatrix=t(),i(N),V(n.transformation.rotation[2],n.transformation.rotation[0],n.transformation.rotation[1],N),o(r.vvSymbolRotationMatrix,N)),e&&e.color&&(r.vvColorEnabled=!0,r.vvColorValues=e.color.values,r.vvColorColors=e.color.colors),e&&e.opacity&&(r.vvOpacityEnabled=!0,r.vvOpacityValues=e.opacity.values,r.vvOpacityOpacities=e.opacity.opacityValues),r}function q(o,t,i){if(!o.vvSizeEnabled)return i;n(B,i);const u=o.vvSymbolRotationMatrix;r(N,u[0],u[1],u[2],0,u[3],u[4],u[5],0,u[6],u[7],u[8],0,0,0,0,1),s(B,B,N);for(let n=0;n<3;++n){const i=o.vvSizeOffset[n]+t[0]*o.vvSizeFactor[n];L[n]=e(i,o.vvSizeMinSize[n],o.vvSizeMaxSize[n])}return l(B,B,L),a(B,B,o.vvSymbolAnchor),B}function $(o,t,i){if(!t.vvSizeEnabled)return d(o,1,1,1);for(let n=0;n<3;++n){const r=t.vvSizeOffset[n]+i[0]*t.vvSizeFactor[n];o[n]=e(r,t.vvSizeMinSize[n],t.vvSizeMaxSize[n])}return o}!function(e){e[e.Undefined=0]="Undefined",e[e.DefinedSize=1]="DefinedSize",e[e.DefinedScale=2]="DefinedScale"}(S||(S={})),function(e){e[e.Undefined=0]="Undefined",e[e.DefinedAngle=1]="DefinedAngle"}(y||(y={}));const B=p(),L=v(),N=p();export{y as FastRotationType,S as FastSizeType,F as convertVisualVariables,q as evaluateModelTransform,$ as evaluateModelTransformScale,_ as getMaterialParameters,I as initFastSymbolUpdatesState,P as updateFastSymbolUpdatesState};
|