@arcgis/core 5.1.0-next.81 → 5.1.0-next.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/ShadowCast/DiscreteOptions.d.ts +12 -0
- package/analysis/ShadowCast/TotalDurationOptions.d.ts +12 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/040884cec4b84dd1bb17.js +1 -0
- package/assets/esri/core/workers/chunks/05c5f68e117fc58ae801.js +1 -0
- package/assets/esri/core/workers/chunks/074f5e6aaeafca13bf72.js +1 -0
- package/assets/esri/core/workers/chunks/{7bd1d624f4f4a11a31e8.js → 086d7cdfa92a649c9f7b.js} +1 -1
- package/assets/esri/core/workers/chunks/{0eed2b1b06355ab89013.js → 0c074c46d106ca4d3bad.js} +1 -1
- package/assets/esri/core/workers/chunks/{c758e16b57c96ce88294.js → 1768f1a7e3caa6074d91.js} +1 -1
- package/assets/esri/core/workers/chunks/{85d3475667c503ec4fc6.js → 186bfde8c552e3b42302.js} +1 -1
- package/assets/esri/core/workers/chunks/1a35121a0c2595a41fdb.js +1 -0
- package/assets/esri/core/workers/chunks/1ab66600579fa4232d7b.js +1 -0
- package/assets/esri/core/workers/chunks/1e3fe89970c57a883fe5.js +1 -0
- package/assets/esri/core/workers/chunks/{824051af00e7a1f05ed0.js → 230e0e43f8e771950397.js} +1 -1
- package/assets/esri/core/workers/chunks/26f804c92077c11c626d.js +1 -0
- package/assets/esri/core/workers/chunks/28a45bd26eb5c9b3ec7c.js +1 -0
- package/assets/esri/core/workers/chunks/38f1a86b8dd9ee684ee5.js +596 -0
- package/assets/esri/core/workers/chunks/{71fe127734f33d020a44.js → 475394218caaa4cd3e86.js} +1 -1
- package/assets/esri/core/workers/chunks/475409026288f0981ce2.js +1 -0
- package/assets/esri/core/workers/chunks/4e206957b28253ddc1a3.js +1 -0
- package/assets/esri/core/workers/chunks/5cc38ac051d3d0557920.js +1 -0
- package/assets/esri/core/workers/chunks/{992cd87ba0ab6346f692.js → 64e268ebac0b62076f81.js} +1 -1
- package/assets/esri/core/workers/chunks/{003fd7745966fe03510c.js → 65ac73de5bb133c6bf89.js} +1 -1
- package/assets/esri/core/workers/chunks/6675d56f49d07a97dc40.js +1 -0
- package/assets/esri/core/workers/chunks/{484d6c1b0fe1633515b7.js → 72f8f4cfa0842d325fb0.js} +1 -1
- package/assets/esri/core/workers/chunks/{283d39dfb1625b5a74db.js → 747e258f57f0543c836e.js} +1 -1
- package/assets/esri/core/workers/chunks/{dd4f431511edd975a53b.js → 7acf82763aeba44049d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d8e944b192aad4cf986.js → 7b505112c7e6d9b7a239.js} +1 -1
- package/assets/esri/core/workers/chunks/7b8466f892a38a53c600.js +1 -0
- package/assets/esri/core/workers/chunks/{77dd719516138afb1a2a.js → 8af9a78cf316581ea482.js} +1 -1
- package/assets/esri/core/workers/chunks/988e91cc6cf88c34c2de.js +1 -0
- package/assets/esri/core/workers/chunks/9c402657f63a4d5668d0.js +1 -0
- package/assets/esri/core/workers/chunks/9ea23cd4b2664c08b670.js +1 -0
- package/assets/esri/core/workers/chunks/9f51a69b8f1937a8794a.js +1 -0
- package/assets/esri/core/workers/chunks/a28124bba6b43efd74cc.js +1 -0
- package/assets/esri/core/workers/chunks/af762422a65c551dcd54.js +1 -0
- package/assets/esri/core/workers/chunks/{056fd7847caaff2c9514.js → af8bc56cf1404afc3028.js} +1 -1
- package/assets/esri/core/workers/chunks/b9e163f4a898e50cc854.js +1 -0
- package/assets/esri/core/workers/chunks/{444f0f51b3ee0b9845a5.js → bb2f6b0fcdfb8b158e26.js} +1 -1
- package/assets/esri/core/workers/chunks/{4af39fa53bc0b79101ed.js → bc8a74da48b08309875f.js} +1 -1
- package/assets/esri/core/workers/chunks/{026d3fa331caec1ea3d2.js → bf4dd8e50704e4040966.js} +1 -1
- package/assets/esri/core/workers/chunks/c19e3f6027b6526de359.js +1 -0
- package/assets/esri/core/workers/chunks/ce4dfc3a470230ddc9e4.js +1 -0
- package/assets/esri/core/workers/chunks/{8ea4584e07ccc85caabd.js → d11de13537b623739e14.js} +1 -1
- package/assets/esri/core/workers/chunks/d897412b99b9fba44bb4.js +1 -0
- package/assets/esri/core/workers/chunks/{035dbb0217f83108fa89.js → db86a1119e4e58ecfbda.js} +1 -1
- package/assets/esri/core/workers/chunks/dcb7a3ff59677b1cf0f1.js +1 -0
- package/assets/esri/core/workers/chunks/{5fe97253f80c797fad7f.js → df8a3d3cac454d42e14d.js} +1 -1
- package/assets/esri/core/workers/chunks/dfe1139124fda0d6c059.js +1 -0
- package/assets/esri/core/workers/chunks/{8b8f391f27774aec6db9.js → e0b27bceb397482bd0e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{84821dff3bcc51161802.js → e89dc473f46a5584d2ef.js} +32 -32
- package/assets/esri/core/workers/chunks/{01ee18782a50279f907e.js → f4220b6eab0865318033.js} +1 -1
- package/assets/esri/core/workers/chunks/{42336e0d1ef88737b078.js → f468c6ea2818a1f97e19.js} +1 -1
- package/assets/esri/core/workers/chunks/fce2306a1b31c6680f90.js +1 -0
- package/assets/esri/core/workers/chunks/fcf51697c361e0075cc2.js +1 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +15 -0
- 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/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
- package/chunks/ShadowCastVisualize.glsl.js +33 -15
- package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
- package/chunks/arcgis-knowledge-client-core.js +1 -1
- package/config.js +1 -1
- package/core/workers/registry.js +1 -1
- package/form/elements/inputs/MultipleChoiceInput.d.ts +6 -6
- package/form/elements/inputs/MultipleChoiceInput.js +1 -1
- package/kernel.js +1 -1
- package/layers/BaseDynamicLayer.js +1 -1
- package/layers/BaseTileLayer.js +1 -1
- package/layers/ElevationLayer.js +1 -1
- package/layers/MapImageLayer.js +1 -1
- package/layers/TileLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/WMTSLayer.js +1 -1
- package/layers/WebTileLayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/TiledImagery.js +1 -1
- package/layers/support/imageBitmapUtils.js +1 -1
- package/package.json +1 -1
- package/request/process.js +1 -1
- package/rest/knowledgeGraph/CreateReplicaResponse.d.ts +37 -0
- package/rest/knowledgeGraph/CreateReplicaResponse.js +2 -0
- package/rest/knowledgeGraph/ReplicaDefinition.d.ts +91 -0
- package/rest/knowledgeGraph/ReplicaDefinition.js +2 -0
- package/rest/knowledgeGraph/ReplicasInformationResponse.d.ts +24 -0
- package/rest/knowledgeGraph/ReplicasInformationResponse.js +2 -0
- package/rest/knowledgeGraph/UnregisterReplicaResponse.d.ts +44 -0
- package/rest/knowledgeGraph/UnregisterReplicaResponse.js +2 -0
- package/rest/knowledgeGraph/wasmInterface/replicaToWasmEncodedFactories.js +2 -0
- package/rest/knowledgeGraph/wasmInterface/wasmToReplicaFactories.js +2 -0
- package/rest/knowledgeGraphService.d.ts +50 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/FillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/BaseDynamicLayerView2D.js +1 -1
- package/views/2d/layers/MapImageLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.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/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/layers/ElevationLayerView3D.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerWorker.js +2 -0
- package/views/3d/layers/IntegratedMesh3DTilesLayerWorkerHandle.js +2 -0
- package/views/3d/layers/TileLayerView3D.js +1 -1
- package/views/3d/layers/WMTSLayerView3D.js +1 -1
- package/views/3d/layers/graphics/tessellationUtils.js +1 -1
- package/views/3d/layers/support/IntegratedMesh3DTilesVertexProcessing.js +2 -0
- package/views/3d/layers/support/makeScheduleFunction.js +1 -1
- package/views/3d/support/renderInfoUtils/polygon.js +1 -1
- package/views/3d/terrain/TerrainData.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/VisualVariablePassParameters.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/colorRampParameters.js +2 -0
- package/views/support/TextureCompressionWorker.js +1 -1
- package/views/support/TextureCompressionWorkerHandle.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/css.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/05c3146d87d917606193.js +0 -1
- package/assets/esri/core/workers/chunks/0b77c124b743067e4155.js +0 -1
- package/assets/esri/core/workers/chunks/11241781baaed346af52.js +0 -1
- package/assets/esri/core/workers/chunks/1d9560eb8b21b9e76616.js +0 -1
- package/assets/esri/core/workers/chunks/2bd69a7734d170e190ed.js +0 -1
- package/assets/esri/core/workers/chunks/2c87c3112a43db8624f6.js +0 -1
- package/assets/esri/core/workers/chunks/3a58708217a9c11836ab.js +0 -1
- package/assets/esri/core/workers/chunks/3bbf684ee2484eb44c9f.js +0 -1
- package/assets/esri/core/workers/chunks/49fb9c47070641bce9a9.js +0 -1
- package/assets/esri/core/workers/chunks/5417308eba30e668b1ee.js +0 -1
- package/assets/esri/core/workers/chunks/62b3e933f548ce354b99.js +0 -1
- package/assets/esri/core/workers/chunks/6e70e922331704b92a08.js +0 -1
- package/assets/esri/core/workers/chunks/7c7c11c0fde8b63e330b.js +0 -1
- package/assets/esri/core/workers/chunks/7cee7ffaf941a4fe23b0.js +0 -596
- package/assets/esri/core/workers/chunks/7f55eef696e9ed717bfc.js +0 -1
- package/assets/esri/core/workers/chunks/89dbea6f436d45a3b185.js +0 -1
- package/assets/esri/core/workers/chunks/9d216e30d04ea21fc8a2.js +0 -1
- package/assets/esri/core/workers/chunks/a5d8d6f3c0c8de474efd.js +0 -1
- package/assets/esri/core/workers/chunks/a809b811121099a87a98.js +0 -1
- package/assets/esri/core/workers/chunks/c02ba921c0a32d2021e3.js +0 -1
- package/assets/esri/core/workers/chunks/c3c19b62d948d53118a8.js +0 -1
- package/assets/esri/core/workers/chunks/c46a4adea39636a96d03.js +0 -1
- package/assets/esri/core/workers/chunks/c5507480344176fad241.js +0 -1
- package/assets/esri/core/workers/chunks/c6030271bd6d39b6e1db.js +0 -1
- package/assets/esri/core/workers/chunks/d1a7d13e1d48abcd7bf1.js +0 -1
- package/assets/esri/core/workers/chunks/dcbc4072c18278c2b67d.js +0 -1
- package/assets/esri/core/workers/chunks/e610d24539a675fb054b.js +0 -1
- package/assets/esri/core/workers/chunks/ecb7ede6a8e6c05e4c6c.js +0 -1
- package/assets/esri/core/workers/chunks/f227b34cce6843df0fb6.js +0 -1
- package/request/ImageWithType.js +0 -2
- package/views/3d/layers/support/fetchTile.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{makeHandle as i}from"../../../core/handleUtils.js";import t from"../../../core/Logger.js";import{isAbortError as s,waitTick as r}from"../../../core/promiseUtils.js";import{property as o,subclass as l}from"../../../core/accessorSupport/decorators.js";import{equals as h}from"../../../geometry/support/spatialReferenceUtils.js";import{GraphicsCollection as a}from"../../../support/GraphicsCollection.js";import"../../../core/RandomLCG.js";import"../../../core/has.js";import"../../../core/scheduling.js";import"../../../Color.js";import"../../../core/mathUtils.js";import"../../../config.js";import"../../../symbols/cim/defaultCIMValues.js";import"../../../core/floatRGBA.js";import"../../../geometry/Extent.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Point.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../../../symbols/Font.js";import"../../../symbols/cim/effects/EffectAddControlPoints.js";import"../../../symbols/cim/effects/EffectArrow.js";import"../../../symbols/cim/effects/EffectBuffer.js";import"../../../symbols/cim/effects/EffectControlMeasureLine.js";import"../../../symbols/cim/effects/EffectCut.js";import"../../../symbols/cim/effects/EffectDashes.js";import"../../../symbols/cim/effects/EffectDonut.js";import"../../../symbols/cim/effects/EffectEnclosingPolygon.js";import"../../../symbols/cim/effects/EffectJog.js";import"../../../symbols/cim/effects/EffectMove.js";import"../../../symbols/cim/effects/EffectOffset.js";import"../../../symbols/cim/effects/EffectRadial.js";import"../../../symbols/cim/effects/EffectReverse.js";import"../../../symbols/cim/effects/EffectRotate.js";import"../../../symbols/cim/effects/EffectScale.js";import"../../../symbols/cim/effects/EffectSuppress.js";import"../../../symbols/cim/effects/EffectTaperedPolygon.js";import"../../../symbols/cim/effects/EffectWave.js";import"../../../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../../../symbols/cim/placements/PlacementAtExtremities.js";import"../../../symbols/cim/placements/PlacementAtMeasuredUnits.js";import"../../../symbols/cim/placements/PlacementAtRatioPositions.js";import"../../../symbols/cim/placements/PlacementInsidePolygon.js";import"../../../symbols/cim/placements/PlacementOnLine.js";import"../../../symbols/cim/placements/PlacementOnVertices.js";import"../../../symbols/cim/placements/PlacementPolygonCenter.js";import"../../../symbols/dimensions/effects/LinearDimensionArrowEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionExtensionLineEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionLeaderLineEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionLineEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionPointEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionTextEffect.js";import"../../../symbols/cim/constants.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../../../symbols/support/defaults.js";import"../../../symbols/cim/OverrideHelper.js";import"../../../layers/effects/EffectView.js";import"../../../core/Accessor.js";import"../engine/transitions/FadeTransition.js";import"../engine/webgl/shaders/BitBlitPrograms.js";import"../../webgl/enums.js";import"../../webgl/Program.js";import"../../webgl/Util.js";import"../../webgl/VertexAttributeLayouts.js";import"../../webgl/BufferObject.js";import"../../../request.js";import"../../../core/urlUtils.js";import"../../webgl/Texture.js";import"../../../core/pbf.js";import"../engine/webgl/shaders/StencilPrograms.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"../engine/webgl/shaders/HighlightPrograms.js";import"../../webgl/FramebufferObject.js";import"../../../Graphic.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlitShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/BloomShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlurShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js";import"../engine/webgl/meshing/SimpleMesh.js";import"../../webgl/Renderbuffer.js";import"../engine/webgl/PooledUint32Array.js";import"../engine/webgl/Profiler.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../engine/webgl/number.js";import"../engine/webgl/shaderGraph/techniques/animated/attributes.js";import"../engine/webgl/mesh/templates/templateUtils.js";import"../engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/support/aaBoundingBox.js";import"../engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../../../core/sql/UnknownTimeZone.js";import"luxon";import"../../../intl/locale.js";import"../../../layers/support/fieldUtils.js";import"../../../time/constants.js";import"../engine/webgl/animations/instructions.js";import"../engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"../../webgl/checkWebGLError.js";import"../../webgl/renderState.js";import"../../webgl/testSVGPremultipliedAlpha.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../../chunks/pe.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import n from"./graphics/GraphicsView2D.js";import"../engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/cpuMapped/MappedMesh.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../core/asyncUtils.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/support/UpdatingHandles.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import{BitmapTileLayerView2D as p}from"./BitmapTileLayerView2D.js";import{LayerView2D as m}from"./LayerView2D.js";import c from"./graphics/HighlightGraphicContainer.js";import{createBlankImage as g,resampleImage as f}from"./support/imageUtils.js";import u from"../tiling/TileInfoView.js";import d from"../tiling/TileKey.js";import j from"../tiling/TileQueue.js";import y from"../tiling/TileStrategy.js";import w from"../../layers/LayerView.js";import{RefreshableLayerView as b}from"../../layers/RefreshableLayerView.js";import{getHighlightGraphics as _}from"../../layers/support/highlightUtils.js";import{isMapServiceLayerView as G,MapServiceLayerViewHelper as q}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as T}from"../../support/drapedUtils.js";import{getHighlightName as V}from"../../support/highlightOptionsUtils.js";import{TaskPriority as S}from"../../support/Scheduler.js";const E=[0,0];let P=class extends(b(p(m(w)))){constructor(){super(...arguments),this._fetchQueue=null,this._highlightGraphics=new a,this._highlightView=null,this._popupHighlightHelper=null,this._tileStrategy=null,this.layer=null}get resampling(){return!("resampling"in this.layer)||!1!==this.layer.resampling}get tilemapCache(){return"tilemapCache"in this.layer?this.layer.tilemapCache:null}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume(),this._highlightView?.processUpdate(e)}attach(){const e="tileServers"in this.layer?this.layer.tileServers:null,i=this.tilemapCache;if(this._tileInfoView=new u(this.layer.tileInfo,this.layer.fullExtent,i?.effectiveMinLOD,i?.effectiveMaxLOD),this._fetchQueue=new j({tileInfoView:this._tileInfoView,concurrency:e&&10*e.length||10,process:(e,i)=>this.fetchTile(e,i),scheduler:this.scheduler,priority:S.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new y({cachePolicy:"keep",resampling:this.resampling,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),G(this,this.layer)){const e=this._highlightView=new n({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new c(this.view.featuresTilingScheme),defaultPointSymbolEnabled:!1});this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new q({createFetchPopupFeaturesQueryGeometry:(e,i)=>T(e,i,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:({graphic:i,property:t})=>e.graphicUpdateHandler({graphic:i,property:t}),layerView:this,updatingHandles:this._updatingHandles})}this.requestUpdate(),this.addAttachHandles(this._updatingHandles.add(()=>this.resampling,()=>{this.doRefresh()})),super.attach()}detach(){super.detach(),this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._popupHighlightHelper?.destroy(),this._highlightView?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=this._popupHighlightHelper=null}async fetchPopupFeaturesAtLocation(e,i){return this._popupHighlightHelper?this._popupHighlightHelper.fetchPopupFeaturesAtLocation(e,i):[]}highlight(e,t){const s=_(e);if(0===s.length)return i();const r=V(t);return this._addHighlightGraphics(s,r),i(()=>!this.destroyed&&this._removeHighlightGraphics(s,r))}_processHighlight(){const e=this._getHighlights();this._highlightView?.setHighlight(e)}_addHighlightGraphics(e,i){this._highlightGraphics.addMany(e),this._addHighlights(e.map(e=>e.uid),i)}_removeHighlightGraphics(e,i){this._highlightGraphics.removeMany(e),this._removeHighlights(e.map(e=>e.uid),i)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return h(this.layer.tileInfo?.spatialReference,e)}async doRefresh(){if(this.attached){if(this.suspended)return this._tileStrategy.clear(),void this.requestUpdate();this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updatingHandles.addPromise(this._enqueueTileFetch(e)))}}acquireTile(e){const i=this._bitmapView.createTile(e),t=i.bitmap;return[t.x,t.y]=this._tileInfoView.getTileCoords(E,i.key),t.resolution=this._tileInfoView.getTileResolution(i.key),[t.width,t.height]=this._tileInfoView.size,this._updatingHandles.consumePromise(this._enqueueTileFetch(i)),this._bitmapView.addChild(i),this.requestUpdate(),i}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once("detach",()=>e.destroy()),this.requestUpdate()}async fetchTile(e,i={}){return this.tilemapCache?this._fetchTileWithTilemapCache(e,i):this._fetchTileWithoutTilemapCache(e,i)}async _fetchTileWithoutTilemapCache(e,i={}){const{signal:t,resamplingLevel:r=0}=i;try{return await this._fetchImage(e,t)}catch(o){if(s(o))throw o;if(!this.resampling)return g(this._tileInfoView.size);if(r<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){const s=new d(t),o=await this._fetchTileWithoutTilemapCache(s,{...i,resamplingLevel:r+1});return f(this._tileInfoView,o,s,e)}}return g(this._tileInfoView.size)}}async _fetchTileWithTilemapCache(e,i={}){const t=this.tilemapCache,{signal:o,resamplingLevel:l=0}=i,h=new d(0,0,0,0);let a,n=null;try{if(n=await t.fetchAvailabilityUpsample(e.level,e.row,e.col,h,{signal:o}),!this.resampling&&h.level!==e.level)return await r(i),g(this._tileInfoView.size);a=await this._fetchImage(h,o)}catch(p){if(s(p))throw p;if(this.resampling&&"unknown"===n&&l<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){h.set(t);try{a=await this._fetchTileWithTilemapCache(h,{...i,resamplingLevel:l+1})}catch{}}}}return a?this.resampling?f(this._tileInfoView,a,h,e):a:g(this._tileInfoView.size)}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{const i=await this._fetchQueue.push(e.key);e.bitmap.source=i,e.bitmap.width=this._tileInfoView.size[0],e.bitmap.height=this._tileInfoView.size[1],e.once("attach",()=>this.requestUpdate()),e.once("isReady",()=>this.requestUpdate())}catch(i){s(i)||t.getLogger(this).error(i)}this.requestUpdate()}}async _fetchImage(e,i){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:i})}};e([o()],P.prototype,"resampling",null),e([o()],P.prototype,"tilemapCache",null),P=e([l("esri.views.2d.layers.TileLayerView2D")],P);const U=P;export{U as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{makeHandle as i}from"../../../core/handleUtils.js";import t from"../../../core/Logger.js";import{isAbortError as s,waitTick as r}from"../../../core/promiseUtils.js";import{property as o,subclass as l}from"../../../core/accessorSupport/decorators.js";import{equals as h}from"../../../geometry/support/spatialReferenceUtils.js";import{GraphicsCollection as a}from"../../../support/GraphicsCollection.js";import"../../../core/RandomLCG.js";import"../../../core/has.js";import"../../../core/scheduling.js";import"../../../Color.js";import"../../../core/mathUtils.js";import"../../../config.js";import"../../../symbols/cim/defaultCIMValues.js";import"../../../core/floatRGBA.js";import"../../../geometry/Extent.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Point.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../../../symbols/Font.js";import"../../../symbols/cim/effects/EffectAddControlPoints.js";import"../../../symbols/cim/effects/EffectArrow.js";import"../../../symbols/cim/effects/EffectBuffer.js";import"../../../symbols/cim/effects/EffectControlMeasureLine.js";import"../../../symbols/cim/effects/EffectCut.js";import"../../../symbols/cim/effects/EffectDashes.js";import"../../../symbols/cim/effects/EffectDonut.js";import"../../../symbols/cim/effects/EffectEnclosingPolygon.js";import"../../../symbols/cim/effects/EffectJog.js";import"../../../symbols/cim/effects/EffectMove.js";import"../../../symbols/cim/effects/EffectOffset.js";import"../../../symbols/cim/effects/EffectRadial.js";import"../../../symbols/cim/effects/EffectReverse.js";import"../../../symbols/cim/effects/EffectRotate.js";import"../../../symbols/cim/effects/EffectScale.js";import"../../../symbols/cim/effects/EffectSuppress.js";import"../../../symbols/cim/effects/EffectTaperedPolygon.js";import"../../../symbols/cim/effects/EffectWave.js";import"../../../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../../../symbols/cim/placements/PlacementAtExtremities.js";import"../../../symbols/cim/placements/PlacementAtMeasuredUnits.js";import"../../../symbols/cim/placements/PlacementAtRatioPositions.js";import"../../../symbols/cim/placements/PlacementInsidePolygon.js";import"../../../symbols/cim/placements/PlacementOnLine.js";import"../../../symbols/cim/placements/PlacementOnVertices.js";import"../../../symbols/cim/placements/PlacementPolygonCenter.js";import"../../../symbols/dimensions/effects/LinearDimensionArrowEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionExtensionLineEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionLeaderLineEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionLineEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionPointEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionTextEffect.js";import"../../../symbols/cim/constants.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../../../symbols/support/defaults.js";import"../../../symbols/cim/OverrideHelper.js";import"../../../layers/effects/EffectView.js";import"../../../core/Accessor.js";import"../engine/transitions/FadeTransition.js";import"../engine/webgl/shaders/BitBlitPrograms.js";import"../../webgl/enums.js";import"../../webgl/Program.js";import"../../webgl/Util.js";import"../../webgl/VertexAttributeLayouts.js";import"../../webgl/BufferObject.js";import"../../../request.js";import"../../../core/urlUtils.js";import"../../webgl/Texture.js";import"../../../core/pbf.js";import"../engine/webgl/shaders/StencilPrograms.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"../engine/webgl/shaders/HighlightPrograms.js";import"../../webgl/FramebufferObject.js";import"../../../Graphic.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlitShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/BloomShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlurShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js";import"../engine/webgl/meshing/SimpleMesh.js";import"../../webgl/Renderbuffer.js";import"../engine/webgl/PooledUint32Array.js";import"../engine/webgl/Profiler.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../engine/webgl/number.js";import"../engine/webgl/shaderGraph/techniques/animated/attributes.js";import"../engine/webgl/mesh/templates/templateUtils.js";import"../engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/support/aaBoundingBox.js";import"../engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../../../core/sql/UnknownTimeZone.js";import"luxon";import"../../../intl/locale.js";import"../../../layers/support/fieldUtils.js";import"../../../time/constants.js";import"../engine/webgl/animations/instructions.js";import"../engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"../../webgl/checkWebGLError.js";import"../../webgl/renderState.js";import"../../webgl/testSVGPremultipliedAlpha.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../../chunks/pe.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import n from"./graphics/GraphicsView2D.js";import"../engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/cpuMapped/MappedMesh.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../core/asyncUtils.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/support/UpdatingHandles.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import{BitmapTileLayerView2D as p}from"./BitmapTileLayerView2D.js";import{LayerView2D as m}from"./LayerView2D.js";import c from"./graphics/HighlightGraphicContainer.js";import{createBlankImage as g,resampleImage as f}from"./support/imageUtils.js";import u from"../tiling/TileInfoView.js";import d from"../tiling/TileKey.js";import j from"../tiling/TileQueue.js";import y from"../tiling/TileStrategy.js";import w from"../../layers/LayerView.js";import{RefreshableLayerView as b}from"../../layers/RefreshableLayerView.js";import{getHighlightGraphics as _}from"../../layers/support/highlightUtils.js";import{isMapServiceLayerView as G,MapServiceLayerViewHelper as q}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as T}from"../../support/drapedUtils.js";import{getHighlightName as V}from"../../support/highlightOptionsUtils.js";import{TaskPriority as S}from"../../support/Scheduler.js";const E=[0,0];let P=class extends(b(p(m(w)))){constructor(){super(...arguments),this._fetchQueue=null,this._highlightGraphics=new a,this._highlightView=null,this._popupHighlightHelper=null,this._tileStrategy=null,this.layer=null}get resampling(){return!("resampling"in this.layer)||!1!==this.layer.resampling}get tilemapCache(){return"tilemapCache"in this.layer?this.layer.tilemapCache:null}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume(),this._highlightView?.processUpdate(e)}attach(){const e="tileServers"in this.layer?this.layer.tileServers:null,i=this.tilemapCache;if(this._tileInfoView=new u(this.layer.tileInfo,this.layer.fullExtent,i?.effectiveMinLOD,i?.effectiveMaxLOD),this._fetchQueue=new j({tileInfoView:this._tileInfoView,concurrency:e&&10*e.length||10,process:(e,i)=>this.fetchTile(e,i),scheduler:this.scheduler,priority:S.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new y({cachePolicy:"keep",resampling:this.resampling,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),G(this,this.layer)){const e=this._highlightView=new n({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new c(this.view.featuresTilingScheme),defaultPointSymbolEnabled:!1});this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new q({createFetchPopupFeaturesQueryGeometry:(e,i)=>T(e,i,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:({graphic:i,property:t})=>e.graphicUpdateHandler({graphic:i,property:t}),layerView:this,updatingHandles:this._updatingHandles})}this.requestUpdate(),this.addAttachHandles(this._updatingHandles.add(()=>this.resampling,()=>{this.doRefresh()})),super.attach()}detach(){super.detach(),this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._popupHighlightHelper?.destroy(),this._highlightView?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=this._popupHighlightHelper=null}async fetchPopupFeaturesAtLocation(e,i){return this._popupHighlightHelper?this._popupHighlightHelper.fetchPopupFeaturesAtLocation(e,i):[]}highlight(e,t){const s=_(e);if(0===s.length)return i();const r=V(t);return this._addHighlightGraphics(s,r),i(()=>!this.destroyed&&this._removeHighlightGraphics(s,r))}_processHighlight(){const e=this._getHighlights();this._highlightView?.setHighlight(e)}_addHighlightGraphics(e,i){this._highlightGraphics.addMany(e),this._addHighlights(e.map(e=>e.uid),i)}_removeHighlightGraphics(e,i){this._highlightGraphics.removeMany(e),this._removeHighlights(e.map(e=>e.uid),i)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return h(this.layer.tileInfo?.spatialReference,e)}async doRefresh(){if(this.attached){if(this.suspended)return this._tileStrategy.clear(),void this.requestUpdate();this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updatingHandles.addPromise(this._enqueueTileFetch(e)))}}acquireTile(e){const i=this._bitmapView.createTile(e),t=i.bitmap;return[t.x,t.y]=this._tileInfoView.getTileCoords(E,i.key),t.resolution=this._tileInfoView.getTileResolution(i.key),[t.width,t.height]=this._tileInfoView.size,this._updatingHandles.consumePromise(this._enqueueTileFetch(i)),this._bitmapView.addChild(i),this.requestUpdate(),i}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once("detach",()=>e.destroy()),this.requestUpdate()}async fetchTile(e,i={}){return this.tilemapCache?this._fetchTileWithTilemapCache(e,i):this._fetchTileWithoutTilemapCache(e,i)}async _fetchTileWithoutTilemapCache(e,i={}){const{signal:t,resamplingLevel:r=0}=i;try{return await this._fetchImage(e,t)}catch(o){if(s(o))throw o;if(!this.resampling)return g(this._tileInfoView.size);if(r<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){const s=new d(t),o=await this._fetchTileWithoutTilemapCache(s,{...i,resamplingLevel:r+1});return f(this._tileInfoView,o,s,e)}}return g(this._tileInfoView.size)}}async _fetchTileWithTilemapCache(e,i={}){const t=this.tilemapCache,{signal:o,resamplingLevel:l=0}=i,h=new d(0,0,0,0);let a,n=null;try{if(n=await t.fetchAvailabilityUpsample(e.level,e.row,e.col,h,{signal:o}),!this.resampling&&h.level!==e.level)return await r(i),g(this._tileInfoView.size);a=await this._fetchImage(h,o)}catch(p){if(s(p))throw p;if(this.resampling&&"unknown"===n&&l<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){h.set(t);try{a=await this._fetchTileWithTilemapCache(h,{...i,resamplingLevel:l+1})}catch{}}}}return a?this.resampling?f(this._tileInfoView,a,h,e):a:g(this._tileInfoView.size)}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{const i=await this._fetchQueue.push(e.key);e.bitmap.source=i,e.bitmap.width=this._tileInfoView.size[0],e.bitmap.height=this._tileInfoView.size[1],e.once("attach",()=>this.requestUpdate()),e.once("isReady",()=>this.requestUpdate())}catch(i){s(i)||t.getLogger(this).error(i)}this.requestUpdate()}}async _fetchImage(e,i){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:i}).then(({bitmap:e})=>e)}};e([o()],P.prototype,"resampling",null),e([o()],P.prototype,"tilemapCache",null),P=e([l("esri.views.2d.layers.TileLayerView2D")],P);const U=P;export{U as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{clone as t}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{createScreenPoint as a,pt2px as l}from"../../../core/screenUtils.js";import{property as n,subclass as o}from"../../../core/accessorSupport/decorators.js";import{diff as h,hasDiff as u}from"../../../core/accessorSupport/diffUtils.js";import c from"../../../geometry/Point.js";import{create as y}from"../../../geometry/support/aaBoundingRect.js";import{equals as d}from"../../../geometry/support/spatialReferenceUtils.js";import{isVectorTileGraphicOrigin as p}from"../../../graphic/isVectorTileGraphicOrigin.js";import{tileSizeInTileUnits as _,tileSizeInPixels as f}from"../engine/vectorTiles/constants.js";import{TileHandler as g}from"../engine/vectorTiles/TileHandler.js";import{TileManager as m}from"../engine/vectorTiles/TileManager.js";import{VectorTile as T}from"../engine/vectorTiles/VectorTile.js";import{VectorTileContainer as C}from"../engine/vectorTiles/VectorTileContainer.js";import v from"../engine/vectorTiles/VectorTileFeatureIndex.js";import w from"../engine/vectorTiles/style/StyleRepository.js";import{LayerView2D as R}from"./LayerView2D.js";import{isScreenRect as H}from"../support/hitTestUtils.js";import I from"../tiling/TileInfoViewPOT.js";import Q from"../tiling/TileQueue.js";import P from"../../layers/VectorTileLayerView.js";import{TaskPriority as S}from"../../support/Scheduler.js";const b=2.5;let V=class extends(R(P)){constructor(){super(...arguments),this._styleChanges=[],this._fetchQueue=null,this._parseQueue=null,this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._styeChanged=!1,this._spriteSourceChanged=!1}get fading(){return(this._vectorTileContainer?.fading||this._tileManager?.isFading())??!1}get hasVisibleFeatures(){const e=this._vectorTileContainer.children;for(const t of e)if(t.hasFeatures())return!0;return!1}get spriteSourceChanged(){return this._spriteSourceChanged}get styleChanged(){return this._styeChanged}async hitTest(e,t){const i=this._tileHandlerPromise,s=this._vectorTileContainer?.symbolFader;if(!i||!this._isTileHandlerReady||!s)return;await i;let r=[];if(H(t)){const e=t;r=[a(e.x,e.y+e.height),a(e.x+e.width,e.y+e.height),a(e.x+e.width,e.y),a(e.x,e.y)]}else r=[t];const n=has("esri-vtl-search-tolerance")??0,o=n>0?n:b,h=this.view.state,{rotation:u,pixelRatio:c}=this.view.state,y=l(o)*c;let d=null;const p=this._vectorTileContainer?.symbolRepository;p&&(d=p.querySymbols(r[0],y,s.decluttererOffset,{}));const _=this._tileManager.getIntersectingTiles(r[0].x,r[0].y,y,h,d);if((!_||0===_.length)&&0===d?.length)return null;e=e.clone().normalize();const f=[],g=[];for(const a of _)f.push(this._queryTile(g,e,y,u,a,d?.filter(e=>e.tileKey.id===a.id)));return await Promise.all(f),g}update(e){if(this._tileHandlerPromise&&this._isTileHandlerReady)return e.pixelRatio!==this._tileHandler.devicePixelRatio?(this._tileHandler.devicePixelRatio=e.pixelRatio,void this._loadStyle()):void(this._styleChanges.length>0?this._tileHandlerPromise=this._applyStyleChanges():(this._pauseQueues(),this._fetchQueue.state=e.state,this._parseQueue.state=e.state,this._tileManager.update(e)||this.requestUpdate(),this._resumeQueues()))}attach(){const{style:e}=this.layer.currentStyleInfo;this._styleRepository=new w(e),this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),this._vectorTileContainer=new C(this._tileInfoView),this._tileHandler=new g(this.layer,this._styleRepository,window.devicePixelRatio||1,this.layer.tileInfo.lods.length-1),this.container.addChild(this._vectorTileContainer),this._start(),this.addAttachHandles([this.layer.on("paint-change",e=>{if(this._styeChanged=!0,e.isDataDriven)this._styleChanges.push({type:0,data:e}),this.requestUpdate();else{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=3===i.type;t.setPaintProperties(e.layer,e.paint),s&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender()}}),this.layer.on("layout-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;this._styeChanged=!0;const s=h(i.layout,e.layout);if(null!=s){if(u(s,"visibility")&&1===j(s))return t.setLayoutProperties(e.layer,e.layout),3===i.type&&this._vectorTileContainer?.restartDeclutter(),void this._vectorTileContainer?.requestRender();this._styleChanges.push({type:1,data:e}),this.requestUpdate()}}),this.layer.on("style-layer-visibility-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);i&&(this._styeChanged=!0,t.setStyleLayerVisibility(e.layer,e.visibility),3===i.type&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender())}),this.layer.on("style-layer-change",e=>{this._styleChanges.push({type:2,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("delete-style-layer",e=>{this._styleChanges.push({type:3,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("load-style",()=>this._loadStyle()),this.layer.on("spriteSource-change",e=>{this._spriteSourceChanged=!0,this._styleChanges.push({type:4,data:e});const t=this._styleRepository.layers;for(const i of t)switch(i.type){case 3:i.getLayoutProperty("icon-image")&&this._styleChanges.push({type:1,data:{layer:i.id,layout:i.layout}});break;case 2:i.getPaintProperty("line-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}});break;case 1:i.getLayoutProperty("fill-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}})}this.requestUpdate()})])}detach(){this._stop(),this.container.removeAllChildren(),this._vectorTileContainer=s(this._vectorTileContainer),this._tileHandler=s(this._tileHandler)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return d(this.layer.tileInfo?.spatialReference,e)}canResume(){let e=super.canResume();const{currentStyleInfo:t}=this.layer;if(e&&t?.layerDefinition){const i=this.view.scale,{minScale:s,maxScale:r}=t.layerDefinition;t?.layerDefinition&&(s&&s<i&&(e=!1),r&&r>i&&(e=!1))}return e}isUpdating(){return this.fading}acquireTile(e){const t=this._createVectorTile(e);return this._updatingHandles.consumePromise(this._fetchQueue.push(t.key).then(e=>this._parseQueue.push({key:t.key,data:e})).then(e=>{t.once("attach",()=>this.requestUpdate()),t.setData(e),this.requestUpdate()}).catch(e=>{r(e)||i.getLogger(this).error(e)})),t}releaseTile(e){const t=e.key.id;this._fetchQueue.abort(t),this._parseQueue.abort(t),this.requestUpdate()}async doRefresh(){if(!this.attached)return;if(this.suspended)return this._tileManager.clear(),void this.requestUpdate();this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache(),this._resumeQueues();const e=this._vectorTileContainer.children,t=[];try{for(const i of e){const e=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(e=>this._parseQueue.push({key:i.key,data:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(e)}await Promise.all(t)}catch(s){i.getLogger(this).error("error refreshing vector-tiles layer-view",s),this._resumeQueues(),this._isTileHandlerReady=!0}this._isTileHandlerReady=!0,this.requestUpdate()}_start(){if(this._stop(),this._tileManager=new m({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),!this.layer.currentStyleInfo)return;const e=new AbortController,t=this._tileHandler.start({signal:e.signal}).then(()=>{this._fetchQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._getTileData(e,t),concurrency:15,scheduler:this.scheduler,priority:S.MAPVIEW_FETCH_QUEUE}),this._parseQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._parseTileData(e,t),concurrency:8,scheduler:this.scheduler,priority:S.MAPVIEW_VECTOR_TILE_PARSING_QUEUE}),this.requestUpdate(),this._isTileHandlerReady=!0});this._tileHandler.spriteMosaic.then(e=>{this._vectorTileContainer.setStyleResources(e,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this.requestUpdate()}),this._tileHandlerAbortController=e,this._tileHandlerPromise=t}_stop(){if(!this._tileHandlerAbortController||!this._vectorTileContainer)return;const e=this._tileHandlerAbortController;e&&e.abort(),this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._fetchQueue=s(this._fetchQueue),this._parseQueue=s(this._parseQueue),this._tileManager=s(this._tileManager),this._vectorTileContainer.removeAllChildren()}async _getTileData(e,t){return this._tileHandler.fetchTileData(e,t)}async _parseTileData(e,t){return this._tileHandler.parseTileData(e,t)}async _applyStyleChanges(){this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache();const e=this._styleChanges;try{await this._tileHandler.updateStyle(e)}catch(l){i.getLogger(this).error("error applying vector-tiles style update",l.message),this._resumeQueues(),this._isTileHandlerReady=!0}const t=this._styleRepository,s=new Set;e.forEach(e=>{if(3!==e.type)return;const i=e.data,r=t.getLayerById(i.layer);r&&s.add(r.uid)});const r=new Set;e.forEach(e=>{let i;switch(e.type){case 0:t.setPaintProperties(e.data.layer,e.data.paint),i=e.data.layer;break;case 1:t.setLayoutProperties(e.data.layer,e.data.layout),i=e.data.layer;break;case 3:return void t.deleteStyleLayer(e.data.layer);case 2:t.setStyleLayer(e.data.layer,e.data.index),i=e.data.layer.id;break;case 4:this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(e.data.spriteSource))}if(i){const e=t.getLayerById(i);e&&r.add(e.uid)}});const a=this._vectorTileContainer.children;if(s.size>0){const e=Array.from(s);this._vectorTileContainer.deleteStyleLayers(e);for(const t of a)t.deleteLayerData(e)}if(this._resumeQueues(),r.size>0){const e=Array.from(r),t=[];for(const i of a){const s=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(t=>this._parseQueue.push({key:i.key,data:t,styleLayerUIDs:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(s)}await Promise.all(t)}this._styleChanges=[],this._isTileHandlerReady=!0,this.requestUpdate()}async _loadStyle(){const{style:e}=this.layer.currentStyleInfo,i=t(e);this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._styleRepository=new w(i),this._vectorTileContainer.destroy(),this._tileManager.clear(),this._tileHandlerAbortController.abort(),this._tileHandlerAbortController=new AbortController;const{signal:s}=this._tileHandlerAbortController;try{this._tileHandlerPromise=this._tileHandler.setStyle(this._styleRepository,i,this.layer.tileInfo.lods.length-1),await this._tileHandlerPromise}catch(n){if(!r(n))throw n}if(s.aborted)return this._resumeQueues(),this._isTileHandlerReady=!0,this._styeChanged=!1,this._spriteSourceChanged=!1,void this.requestUpdate();const a=await this._tileHandler.spriteMosaic,l=this._vectorTileContainer;this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),l.setStyleResources(a,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this._tileManager=new m({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),this._resumeQueues(),this._isTileHandlerReady=!0,this.requestUpdate(),this._styeChanged=!1,this._spriteSourceChanged=!1}_createVectorTile(e){const t=this._tileInfoView.getTileBounds(y(),e),i=this._tileInfoView.getTileResolution(e.level);return new T(e,i,t[0],t[3],512,512,this._styleRepository)}async _queryTile(e,t,i,s,r,a){if(0===r.layerData.size)return;const l=this._ensureTileIndex(r),[n,o,h,u]=this._tileInfoView.getTileBounds(y(),r.key,!0),c=_*((t.x-n)/(h-n)),d=_*(1-(t.y-o)/(u-o)),g=i*(_/f),m=await l.queryAttributes(c,d,g,s,a);for(const y of m)y.graphic.geometry=this._tileToMapPoint(y.tilePoint,r.transforms.tileUnitsToPixels),e.push({type:"graphic",layer:this.layer,graphic:y.graphic,mapPoint:t.clone()});e.sort((e,t)=>(p(t.graphic.origin)?t.graphic.origin.layerIndex:0)-(p(e.graphic.origin)?e.graphic.origin.layerIndex:0))}_tileToMapPoint(e,t){if(!e)return null;const i=e[0]*t[0]+e[1]*t[3]+t[6],s=e[0]*t[1]+e[1]*t[4]+t[7],r=this.view.state,a=[0,0];return r.toMap(a,[i,s]),new c({x:a[0],y:a[1],spatialReference:r.spatialReference})}_ensureTileIndex(e){let t=e.featureIndex;return t||(t=v.create(e.key,e.layerData,this._styleRepository,this._tileHandler,this.layer),e.featureIndex=t),t}_pauseQueues(){this._fetchQueue.pause(),this._parseQueue.pause()}_resumeQueues(){this._fetchQueue.resume(),this._parseQueue.resume()}_clearQueues(){this._fetchQueue.clear(),this._parseQueue.clear()}};function j(e){if(null==e)return 0;switch(e.type){case"partial":return Object.keys(e.diff).length;case"complete":return Math.max(Object.keys(e.oldValue).length,Object.keys(e.newValue).length);case"collection":return Object.keys(e.added).length+Object.keys(e.changed).length+Object.keys(e.removed).length}}e([n()],V.prototype,"_isTileHandlerReady",void 0),V=e([o("esri.views.2d.layers.VectorTileLayerView2D")],V);const D=V;export{D as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{clone as t}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{createScreenPoint as a,pt2px as l}from"../../../core/screenUtils.js";import{property as n,subclass as o}from"../../../core/accessorSupport/decorators.js";import{diff as h,hasDiff as u}from"../../../core/accessorSupport/diffUtils.js";import y from"../../../geometry/Point.js";import{create as c}from"../../../geometry/support/aaBoundingRect.js";import{equals as d}from"../../../geometry/support/spatialReferenceUtils.js";import{isVectorTileGraphicOrigin as p}from"../../../graphic/isVectorTileGraphicOrigin.js";import{tileSizeInTileUnits as _,tileSizeInPixels as f}from"../engine/vectorTiles/constants.js";import{TileHandler as g}from"../engine/vectorTiles/TileHandler.js";import{TileManager as m}from"../engine/vectorTiles/TileManager.js";import{VectorTile as T}from"../engine/vectorTiles/VectorTile.js";import{VectorTileContainer as C}from"../engine/vectorTiles/VectorTileContainer.js";import v from"../engine/vectorTiles/VectorTileFeatureIndex.js";import w from"../engine/vectorTiles/style/StyleRepository.js";import{LayerView2D as R}from"./LayerView2D.js";import{isScreenRect as H}from"../support/hitTestUtils.js";import I from"../tiling/TileInfoViewPOT.js";import Q from"../tiling/TileQueue.js";import S from"../../layers/VectorTileLayerView.js";import{TaskPriority as P}from"../../support/Scheduler.js";const b=2.5;let V=class extends(R(S)){constructor(){super(...arguments),this._styleChanges=[],this._fetchQueue=null,this._parseQueue=null,this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._styeChanged=!1,this._spriteSourceChanged=!1}get fading(){return(this._vectorTileContainer?.fading||this._tileManager?.isFading())??!1}get hasVisibleFeatures(){const e=this._vectorTileContainer.children;for(const t of e)if(t.hasFeatures())return!0;return!1}get spriteSourceChanged(){return this._spriteSourceChanged}get styleChanged(){return this._styeChanged}async hitTest(e,t){const i=this._tileHandlerPromise,s=this._vectorTileContainer?.symbolFader;if(!i||!this._isTileHandlerReady||!s)return;await i;let r=[];if(H(t)){const e=t;r=[a(e.x,e.y+e.height),a(e.x+e.width,e.y+e.height),a(e.x+e.width,e.y),a(e.x,e.y)]}else r=[t];const n=has("esri-vtl-search-tolerance")??0,o=n>0?n:b,h=this.view.state,{rotation:u,pixelRatio:y}=this.view.state,c=l(o)*y;let d=null;const p=this._vectorTileContainer?.symbolRepository;p&&(d=p.querySymbols(r[0],c,s.decluttererOffset,{}));const _=this._tileManager.getIntersectingTiles(r[0].x,r[0].y,c,h,d);if((!_||0===_.length)&&0===d?.length)return null;e=e.clone().normalize();const f=[],g=[];for(const a of _)f.push(this._queryTile(g,e,c,u,a,d?.filter(e=>e.tileKey.id===a.id)));return await Promise.all(f),g}update(e){if(this._tileHandlerPromise&&this._isTileHandlerReady)return e.pixelRatio!==this._tileHandler.devicePixelRatio?(this._tileHandler.devicePixelRatio=e.pixelRatio,void this._loadStyle()):void(this._styleChanges.length>0?this._tileHandlerPromise=this._applyStyleChanges():(this._pauseQueues(),this._fetchQueue.state=e.state,this._parseQueue.state=e.state,this._tileManager.update(e)||this.requestUpdate(),this._resumeQueues()))}attach(){const{style:e}=this.layer.currentStyleInfo;this._styleRepository=new w(e),this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),this._vectorTileContainer=new C(this._tileInfoView),this._tileHandler=new g(this.layer,this._styleRepository,window.devicePixelRatio||1,this.layer.tileInfo.lods.length-1),this.container.addChild(this._vectorTileContainer),this._start(),this.addAttachHandles([this.layer.on("paint-change",e=>{if(this._styeChanged=!0,e.isDataDriven)this._styleChanges.push({type:0,data:e}),this.requestUpdate();else{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=3===i.type;t.setPaintProperties(e.layer,e.paint),s&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender()}}),this.layer.on("layout-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;this._styeChanged=!0;const s=h(i.layout,e.layout);if(null!=s){if(u(s,"visibility")&&1===j(s))return t.setLayoutProperties(e.layer,e.layout),3===i.type&&this._vectorTileContainer?.restartDeclutter(),void this._vectorTileContainer?.requestRender();this._styleChanges.push({type:1,data:e}),this.requestUpdate()}}),this.layer.on("style-layer-visibility-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);i&&(this._styeChanged=!0,t.setStyleLayerVisibility(e.layer,e.visibility),3===i.type&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender())}),this.layer.on("style-layer-change",e=>{this._styleChanges.push({type:2,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("delete-style-layer",e=>{this._styleChanges.push({type:3,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("load-style",()=>this._loadStyle()),this.layer.on("spriteSource-change",e=>{this._spriteSourceChanged=!0,this._styleChanges.push({type:4,data:e});const t=this._styleRepository.layers;for(const i of t)switch(i.type){case 3:i.getLayoutProperty("icon-image")&&this._styleChanges.push({type:1,data:{layer:i.id,layout:i.layout}});break;case 2:i.getPaintProperty("line-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}});break;case 1:i.getLayoutProperty("fill-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}})}this.requestUpdate()})])}detach(){this._stop(),this.container.removeAllChildren(),this._vectorTileContainer=s(this._vectorTileContainer),this._tileHandler=s(this._tileHandler)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return d(this.layer.tileInfo?.spatialReference,e)}canResume(){let e=super.canResume();const{currentStyleInfo:t}=this.layer;if(e&&t?.layerDefinition){const i=this.view.scale,{minScale:s,maxScale:r}=t.layerDefinition;t?.layerDefinition&&(s&&s<i&&(e=!1),r&&r>i&&(e=!1))}return e}isUpdating(){return this.fading}acquireTile(e){const t=this._createVectorTile(e);return this._updatingHandles.consumePromise(this._fetchQueue.push(t.key).then(e=>this._parseQueue.push({key:t.key,data:e})).then(e=>{t.once("attach",()=>this.requestUpdate()),t.setData(e),this.requestUpdate()}).catch(e=>{r(e)||i.getLogger(this).error(e)})),t}releaseTile(e){const t=e.key.id;this._fetchQueue.abort(t),this._parseQueue.abort(t),this.requestUpdate()}async doRefresh(){if(!this.attached)return;if(this.suspended)return this._tileManager.clear(),void this.requestUpdate();this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache(),this._resumeQueues();const e=this._vectorTileContainer.children,t=[];try{for(const i of e){const e=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(e=>this._parseQueue.push({key:i.key,data:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(e)}await Promise.all(t)}catch(s){i.getLogger(this).error("error refreshing vector-tiles layer-view",s),this._resumeQueues(),this._isTileHandlerReady=!0}this._isTileHandlerReady=!0,this.requestUpdate()}_start(){if(this._stop(),this._tileManager=new m({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),!this.layer.currentStyleInfo)return;const e=new AbortController,t=this._tileHandler.start({signal:e.signal}).then(()=>{this._fetchQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._getTileData(e,t),concurrency:15,scheduler:this.scheduler,priority:P.MAPVIEW_FETCH_QUEUE}),this._parseQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._parseTileData(e,t),concurrency:8,scheduler:this.scheduler,priority:P.MAPVIEW_VECTOR_TILE_PARSING_QUEUE}),this.requestUpdate(),this._isTileHandlerReady=!0});this._tileHandler.spriteMosaic.then(e=>{this._vectorTileContainer.setStyleResources(e,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this.requestUpdate()}),this._tileHandlerAbortController=e,this._tileHandlerPromise=t}_stop(){if(!this._tileHandlerAbortController||!this._vectorTileContainer)return;const e=this._tileHandlerAbortController;e&&e.abort(),this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._fetchQueue=s(this._fetchQueue),this._parseQueue=s(this._parseQueue),this._tileManager=s(this._tileManager),this._vectorTileContainer.removeAllChildren()}async _getTileData(e,t){return this._tileHandler.fetchTileData(e,t)}async _parseTileData(e,t){return this._tileHandler.parseTileData(e,t)}async _applyStyleChanges(){this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache();const e=this._styleChanges;try{await this._tileHandler.updateStyle(e)}catch(o){i.getLogger(this).error("error applying vector-tiles style update",o.message),this._resumeQueues(),this._isTileHandlerReady=!0}const t=this._styleRepository,s=new Set,r=new Set;for(const i of e){if(3!==i.type&&2!==i.type)continue;const e=2===i.type?i.data.layer.id:i.data.layer,a=t.getLayerById(e);a&&(s.add(a.uid),3===a.type&&r.add(a.uid))}const a=this._vectorTileContainer.children,l=this._vectorTileContainer?.symbolFader?.symbolRepository;l&&r.size>0&&l.deleteStyleLayers(Array.from(r));const n=new Set;if(e.forEach(e=>{let i;switch(e.type){case 0:t.setPaintProperties(e.data.layer,e.data.paint),i=e.data.layer;break;case 1:t.setLayoutProperties(e.data.layer,e.data.layout),i=e.data.layer;break;case 3:return void t.deleteStyleLayer(e.data.layer);case 2:t.setStyleLayer(e.data.layer,e.data.index),i=e.data.layer.id;break;case 4:this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(e.data.spriteSource))}if(i){const e=t.getLayerById(i);e&&n.add(e.uid)}}),s.size>0){const e=Array.from(s);this._vectorTileContainer.deleteStyleLayers(e);for(const t of a)t.deleteLayerData(e)}if(this._resumeQueues(),n.size>0){const e=Array.from(n),t=[];for(const i of a){const s=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(t=>this._parseQueue.push({key:i.key,data:t,styleLayerUIDs:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(s)}await Promise.all(t)}this._styleChanges=[],this._isTileHandlerReady=!0,this.requestUpdate()}async _loadStyle(){const{style:e}=this.layer.currentStyleInfo,i=t(e);this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._styleRepository=new w(i),this._vectorTileContainer.destroy(),this._tileManager.clear(),this._tileHandlerAbortController.abort(),this._tileHandlerAbortController=new AbortController;const{signal:s}=this._tileHandlerAbortController;try{this._tileHandlerPromise=this._tileHandler.setStyle(this._styleRepository,i,this.layer.tileInfo.lods.length-1),await this._tileHandlerPromise}catch(n){if(!r(n))throw n}if(s.aborted)return this._resumeQueues(),this._isTileHandlerReady=!0,this._styeChanged=!1,this._spriteSourceChanged=!1,void this.requestUpdate();const a=await this._tileHandler.spriteMosaic,l=this._vectorTileContainer;this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),l.setStyleResources(a,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this._tileManager=new m({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),this._resumeQueues(),this._isTileHandlerReady=!0,this.requestUpdate(),this._styeChanged=!1,this._spriteSourceChanged=!1}_createVectorTile(e){const t=this._tileInfoView.getTileBounds(c(),e),i=this._tileInfoView.getTileResolution(e.level);return new T(e,i,t[0],t[3],512,512,this._styleRepository)}async _queryTile(e,t,i,s,r,a){if(0===r.layerData.size)return;const l=this._ensureTileIndex(r),[n,o,h,u]=this._tileInfoView.getTileBounds(c(),r.key,!0),y=_*((t.x-n)/(h-n)),d=_*(1-(t.y-o)/(u-o)),g=i*(_/f),m=await l.queryAttributes(y,d,g,s,a);for(const c of m)c.graphic.geometry=this._tileToMapPoint(c.tilePoint,r.transforms.tileUnitsToPixels),e.push({type:"graphic",layer:this.layer,graphic:c.graphic,mapPoint:t.clone()});e.sort((e,t)=>(p(t.graphic.origin)?t.graphic.origin.layerIndex:0)-(p(e.graphic.origin)?e.graphic.origin.layerIndex:0))}_tileToMapPoint(e,t){if(!e)return null;const i=e[0]*t[0]+e[1]*t[3]+t[6],s=e[0]*t[1]+e[1]*t[4]+t[7],r=this.view.state,a=[0,0];return r.toMap(a,[i,s]),new y({x:a[0],y:a[1],spatialReference:r.spatialReference})}_ensureTileIndex(e){let t=e.featureIndex;return t||(t=v.create(e.key,e.layerData,this._styleRepository,this._tileHandler,this.layer),e.featureIndex=t),t}_pauseQueues(){this._fetchQueue.pause(),this._parseQueue.pause()}_resumeQueues(){this._fetchQueue.resume(),this._parseQueue.resume()}_clearQueues(){this._fetchQueue.clear(),this._parseQueue.clear()}};function j(e){if(null==e)return 0;switch(e.type){case"partial":return Object.keys(e.diff).length;case"complete":return Math.max(Object.keys(e.oldValue).length,Object.keys(e.newValue).length);case"collection":return Object.keys(e.added).length+Object.keys(e.changed).length+Object.keys(e.removed).length}}e([n()],V.prototype,"_isTileHandlerReady",void 0),V=e([o("esri.views.2d.layers.VectorTileLayerView2D")],V);const D=V;export{D as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{isAbortError as i}from"../../../core/promiseUtils.js";import{watch as a}from"../../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../../core/accessorSupport/decorators.js";import n from"../../../geometry/Extent.js";import{BitmapContainer as m}from"../engine/BitmapContainer.js";import{LayerView2D as p}from"./LayerView2D.js";import h from"./support/ExportStrategy.js";import c from"../../layers/LayerView.js";import{RefreshableLayerView as d}from"../../layers/RefreshableLayerView.js";import{WMSLayerView as u}from"../../layers/WMSLayerView.js";let g=class extends(u(d(p(c)))){constructor(){super(...arguments),this.bitmapContainer=new m}supportsSpatialReference(t){return this.layer.serviceSupportsSpatialReference(t)}update(t){this.strategy.update(t).catch(t=>{i(t)||e.getLogger(this).error(t)})}attach(){const{layer:t}=this,{imageMaxHeight:e,imageMaxWidth:r}=t;this.bitmapContainer=new m,this.container.addChild(this.bitmapContainer),this.strategy=new h({container:this.bitmapContainer,fetchSource:this.fetchImage.bind(this),requestUpdate:this.requestUpdate.bind(this),imageMaxHeight:e,imageMaxWidth:r,imageRotationSupported:!1,imageNormalizationSupported:!1,hidpi:!1}),this.addAttachHandles(a(()=>this.exportImageVersion,()=>this.requestUpdate()))}detach(){this.strategy=r(this.strategy),this.container.removeAllChildren()}viewChange(){}moveEnd(){this.requestUpdate()}createFetchPopupFeaturesQuery(t){const{view:e,bitmapContainer:r}=this,{x:i,y:a}=t,{spatialReference:s}=e;let o,m=0,p=0;if(r.children.some(t=>{const{width:e,height:r,resolution:h,x:c,y:d}=t,u=c+h*e,g=d-h*r;return i>=c&&i<=u&&a<=d&&a>=g&&(o=new n({xmin:c,ymin:g,xmax:u,ymax:d,spatialReference:s}),m=e,p=r,!0)}),!o)return null;const h=o.width/m,c=Math.round((i-o.xmin)/h),d=Math.round((o.ymax-a)/h);return{extent:o,width:m,height:p,x:c,y:d}}async doRefresh(){this.requestUpdate()}isUpdating(){return this.strategy.updating||this.updateRequested}fetchImage(t,e,r,i){return this.layer.fetchImageBitmap(t,e,r,{timeExtent:this.timeExtent,...i}).then(t=>t&&"bitmap"in t?t.bitmap:t)}};t([s()],g.prototype,"strategy",void 0),g=t([o("esri.views.2d.layers.WMSLayerView2D")],g);const y=g;export{y as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Logger.js";import{isAbortError as i}from"../../../core/promiseUtils.js";import{property as s,subclass as r}from"../../../core/accessorSupport/decorators.js";import{equals as a}from"../../../geometry/support/spatialReferenceUtils.js";import{BitmapTileLayerView2D as l}from"./BitmapTileLayerView2D.js";import{LayerView2D as h}from"./LayerView2D.js";import{resampleImage as o}from"./support/imageUtils.js";import n from"../tiling/TileInfoView.js";import c from"../tiling/TileKey.js";import u from"../tiling/TileQueue.js";import
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Logger.js";import{isAbortError as i}from"../../../core/promiseUtils.js";import{property as s,subclass as r}from"../../../core/accessorSupport/decorators.js";import{equals as a}from"../../../geometry/support/spatialReferenceUtils.js";import{BitmapTileLayerView2D as l}from"./BitmapTileLayerView2D.js";import{LayerView2D as h}from"./LayerView2D.js";import{resampleImage as o}from"./support/imageUtils.js";import n from"../tiling/TileInfoView.js";import c from"../tiling/TileKey.js";import u from"../tiling/TileQueue.js";import p from"../tiling/TileStrategy.js";import f from"../../layers/LayerView.js";import{RefreshableLayerView as m}from"../../layers/RefreshableLayerView.js";import{TaskPriority as d}from"../../support/Scheduler.js";const y=[0,0];let _=class extends(m(l(h(f)))){constructor(){super(...arguments),this._tileStrategy=null,this._fetchQueue=null,this.layer=null}get tileMatrixSet(){const{activeLayer:e}=this.layer,{tileMatrixSet:t}=e;if(t&&a(t.tileInfo?.spatialReference,this.view.spatialReference))return t;const i=this._getTileMatrixSetBySpatialReference(e);return i&&i.id!==e.tileMatrixSetId?(e.tileMatrixSetId=i.id,i):null}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume()}attach(){const e=this.tileMatrixSet?.tileInfo;e&&(this._tileInfoView=new n(e),this._fetchQueue=new u({tileInfoView:this._tileInfoView,concurrency:16,process:(e,t)=>this.fetchTile(e,t),scheduler:this.scheduler,priority:d.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new p({cachePolicy:"keep",resampling:!0,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),this.addAttachHandles(this._updatingHandles.add(()=>[this.layer?.activeLayer?.styleId,this.tileMatrixSet],()=>this.doRefresh())),super.attach())}detach(){super.detach(),this._tileStrategy?.destroy(),this._fetchQueue?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return this.layer.activeLayer.tileMatrixSets?.some(t=>a(t.tileInfo?.spatialReference,e))??!1}async doRefresh(){if(this.attached){if(this.suspended)return this._tileStrategy.clear(),void this.requestUpdate();this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updatingHandles.addPromise(this._enqueueTileFetch(e)))}}acquireTile(e){const t=this._bitmapView.createTile(e),i=t.bitmap;return[i.x,i.y]=this._tileInfoView.getTileCoords(y,t.key),i.resolution=this._tileInfoView.getTileResolution(t.key),[i.width,i.height]=this._tileInfoView.size,this._updatingHandles.consumePromise(this._enqueueTileFetch(t)),this._bitmapView.addChild(t),this.requestUpdate(),t}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once("detach",()=>e.destroy()),this.requestUpdate()}async fetchTile(e,t={}){const s="tilemapCache"in this.layer?this.layer.tilemapCache:null,{signal:r,resamplingLevel:a=0}=t;if(!s)return this._fetchImage(e,r);const l=new c(0,0,0,0);let h;try{await s.fetchAvailabilityUpsample(e.level,e.row,e.col,l,{signal:r}),h=await this._fetchImage(l,r)}catch(n){if(i(n))throw n;if(a<3){const i=this._tileInfoView.getTileParentId(e.id);if(i){const s=new c(i),r=await this.fetchTile(s,{...t,resamplingLevel:a+1});return o(this._tileInfoView,r,s,e)}}throw n}return o(this._tileInfoView,h,l,e)}canResume(){const e=super.canResume();return e?null!==this.tileMatrixSet:e}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{const t=await this._fetchQueue.push(e.key);e.bitmap.source=t,e.bitmap.width=this._tileInfoView.size[0],e.bitmap.height=this._tileInfoView.size[1],e.once("attach",()=>this.requestUpdate())}catch(s){i(s)||t.getLogger(this).error(s)}this.requestUpdate()}}async _fetchImage(e,t){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:t}).then(({bitmap:e})=>e)}_getTileMatrixSetBySpatialReference(e){return e.tileMatrixSets?.find(e=>a(e.tileInfo?.spatialReference,this.view.spatialReference))}};e([s({readOnly:!0})],_.prototype,"tileMatrixSet",null),_=e([r("esri.views.2d.layers.WMTSLayerView2D")],_);const w=_;export{w as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{isSome as t,equals as i}from"../../../core/arrayUtils.js";import{createTask as s}from"../../../core/asyncUtils.js";import r from"../../../core/Error.js";import"../../../core/has.js";import n from"../../../core/Logger.js";import{abortMaybe as a,destroyMaybe as o}from"../../../core/maybe.js";import{after as l,throwIfAborted as u,isPromiseLike as c}from"../../../core/promiseUtils.js";import{watch as p,syncAndInitial as d}from"../../../core/reactiveUtils.js";import{createScreenPointArray as h,createRenderScreenPointArray as m}from"../../../core/screenUtils.js";import{offsetDateUTC as g,convertTime as _}from"../../../core/timeUtils.js";import{property as y,subclass as v}from"../../../core/accessorSupport/decorators.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as w}from"../../../core/support/UpdatingHandles.js";import{g as D}from"../../../chunks/boundedPlane.js";import{polygonToVolume as b}from"../focusAreaUtils.js";import C from"./AnalysisView3D.js";import{registerAnalysisView as V,hideOtherAnalysisViews as U}from"./ShadowCast/analysisViewRegister.js";import{ShadowCastTooltip as T}from"./ShadowCast/ShadowCastTooltip.js";import{ElevationContext as P}from"../layers/graphics/ElevationContext.js";import{longitudeToTimezone as O}from"../support/earthUtils.js";import{computeDirectionsOverTime as x}from"../support/sunUtils.js";import{breadthFirstBinaryPartitioning as j}from"../../../widgets/support/traversalUtils.js";let z=class extends C{constructor(e){super(e),this.type="shadow-cast-view-3d",this.analysis=null,this._updatingHandles=new w,this._stopPreviewingTask=null,this._updatedRecently=!1,this._tooltip=null,this._previousVolume=null}initialize(){this.addHandles([V(this.view,this),p(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{a(this._stopPreviewingTask),this._updatedRecently=!0,this._stopPreviewingTask=s(async e=>{await l(H,e),u(e),this._updatedRecently=!1})},{sync:!0,initial:!0,equals:(e,t)=>E(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),p(()=>({renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t})=>{t&&U(this.view,this),e?.setParameters({shadowCast:{enabled:t}})},d),p(()=>({renderer:this._renderer,parameters:this._visualizationParameters,visible:this.visible}),({renderer:e,parameters:t,visible:i})=>{L(e,i,t)},d),p(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext,visible:this.visible}),({renderer:e,lightDirections:t,lightDirectionsContext:i,visible:s})=>{L(e,s,{lightDirections:t,lightDirectionsContext:i})},d),p(()=>({renderer:this._renderer,previewing:this._previewing,visible:this.visible}),({renderer:e,previewing:t,visible:i})=>{L(e,i,{previewing:t})},d),p(()=>({analysisVolume:this._analysisVolume,renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t,analysisVolume:i})=>{L(e,t,{analysisVolume:i})},d)]),this.interactive=!0,this._tooltip=new T({getDuration:this.getDurationAtScreen.bind(this),isVisible:()=>this.interactive&&this.visible,view:this.view})}destroy(){this.visible&&L(this._renderer,!0,{enabled:!1}),this._tooltip=o(this._tooltip),this._stopPreviewingTask=a(this._stopPreviewingTask),this._updatingHandles=o(this._updatingHandles)}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return this._previewing||null!=this._stopPreviewingTask&&!this._stopPreviewingTask.finished||!0===this._tooltip?.updating||this._updatingHandles.updating}get visible(){return super.visible}set visible(e){super.visible=e}get _previewing(){return this._updatedRecently||this._sceneUpdating}get _sceneUpdating(){const{view:e}=this;if(null==e?.allLayerViews)return!0;const{stationary:t,graphicsView:i}=e;return!t||this._shadowLayerViews.some(e=>e.updating)||!i?.suspended&&!!i?.updating}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){const e=this._referencePosition;return null!=e?O(e[0],!1):0}get _dateUTCOffset(){let e=this.analysis.date;return e=g(e,-e.getTimezoneOffset(),"minutes"),e=g(e,-this._effectiveUtcOffset,"hours"),e}get _startDateTimeUTC(){return g(this._dateUTCOffset,this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return g(this._dateUTCOffset,this.analysis.endTimeOfDay)}get _referencePosition(){return this.view?.environmentManager?.referencePositionGeographic}get _totalDurationInterval(){return this._totalDuration>0?Math.floor(this._totalDuration/(G-1)):G}get _interval(){const e=this._totalDurationInterval;switch(this.analysis.mode){case"min-duration":return this._totalDuration>0?e:0;case"total-duration":return e;case"discrete":return this.analysis.discreteOptions.interval||e}}get _intervalContext(){const{mode:e,minDurationOptions:t}=this.analysis;return"min-duration"===e&&t.contextEnabled?t.contextOptions.interval||this._totalDurationInterval:-1}get _totalDurationSampleCount(){return this._lightDirections.length}get _totalDuration(){const{startTimeOfDay:e,endTimeOfDay:t}=this.analysis;return t-e}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){const{view:t}=this;if(e<=0)return[];const i="global"===t.viewingMode?M:this._referencePosition;if(null==i)return[];const s=x(this._startDateTimeUTC,this._endDateTimeUTC,e,i,t.state.viewingMode,G),r=s.length;I.length=0;const n=j(0,r,I),a=new Array(r);for(let o=0;o<r;++o)a[o]=s[n[o]];return a}get _analysisVolume(){const{geometry:e}=this.analysis;if(null==e)return this._previousVolume=null,null;try{const t=b(e,this.view,q);return null==t?(this._previousVolume=null,null):c(t)?(this._updatingHandles.consumePromise(t),this._previousVolume):(this._previousVolume=t,t)}catch(t){return n.getLogger(this).error(new r("shadowcastanalysisview3d:projection-failed","Failed to project analysis area geometry to view spatial reference",{geometry:e,error:t})),null}}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case"min-duration":return this._minDurationVisualizationParameters;case"total-duration":return this._durationVisualizationParameters;case"discrete":return this._discreteVisualizationParameters}}get _minDurationVisualizationParameters(){const{color:e,minDuration:t}=this.analysis.minDurationOptions,i=this._totalDuration;return{visualization:2,thresholdColor:e.toUnitRGBA(),threshold:i>0?t/this._totalDuration:0,...this._minDurationContextVisualizationParameters}}get _minDurationContextVisualizationParameters(){const{minDurationOptions:e}=this.analysis;return e.contextEnabled?{visualization:3,gradientColor:A(e.contextOptions.color,e.contextOptions.colorStops)}:{}}get _durationVisualizationParameters(){const{color:e,colorStops:t,mode:i}=this.analysis.totalDurationOptions,s=this._totalDuration,r=s>0&&"hourly"===i?R/s:0,n=A(e,t);return 0===r?{...this._discreteVisualizationParameters,gradientColor:n}:{bandedGradientColor:n,visualization:1,bandSize:r}}get _discreteVisualizationParameters(){const{color:e,colorStops:t}=this.analysis.discreteOptions;return{gradientColor:A(e,t),visualization:0}}get _shadowLayerViews(){return this.view.allLayerViews.items.filter(k)}get _previewDependencies(){const{view:e}=this,i=e.slice.plane,s=this._shadowLayerViews,r=s.map(e=>e.layer).filter(t),n=s.map(e=>e.suspended),a=r.map(e=>e.visible),o=r.map(e=>e.opacity),l=!!e.graphicsView?.suspended,u=r.filter(e=>"definitionExpression"in e).map(e=>e.definitionExpression),c=s.filter(e=>"filter"in e).map(e=>e.filter);return{slicePlane:i,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:n,graphicsViewSuspended:l,layerVisibilities:a,layerOpacities:o,filters:c,definitionExpressions:u}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){const{_renderer:t,_totalDurationSampleCount:i}=this;if(null==t||0===i)return 0;const s=this.view.state.camera.screenToRender(h(e.x,e.y),m());return t.readAccumulatedShadow(s)*this._totalDuration}};e([y({readOnly:!0,type:["shadow-cast-view-3d"]})],z.prototype,"type",void 0),e([y({constructOnly:!0,nonNullable:!0})],z.prototype,"analysis",void 0),e([y({readOnly:!0})],z.prototype,"updating",null),e([y()],z.prototype,"_stopPreviewingTask",void 0),e([y()],z.prototype,"_updatedRecently",void 0),e([y()],z.prototype,"_tooltip",void 0),e([y()],z.prototype,"_sceneUpdating",null),e([y()],z.prototype,"_effectiveUtcOffset",null),e([y()],z.prototype,"_utcOffsetAuto",null),e([y()],z.prototype,"_dateUTCOffset",null),e([y()],z.prototype,"_startDateTimeUTC",null),e([y()],z.prototype,"_endDateTimeUTC",null),e([y()],z.prototype,"_referencePosition",null),e([y()],z.prototype,"_interval",null),e([y()],z.prototype,"_intervalContext",null),e([y()],z.prototype,"_totalDurationSampleCount",null),e([y()],z.prototype,"_totalDuration",null),e([y()],z.prototype,"_lightDirections",null),e([y()],z.prototype,"_lightDirectionsContext",null),e([y()],z.prototype,"_analysisVolume",null),e([y()],z.prototype,"_visualizationParameters",null),e([y()],z.prototype,"_minDurationVisualizationParameters",null),e([y()],z.prototype,"_minDurationContextVisualizationParameters",null),e([y()],z.prototype,"_durationVisualizationParameters",null),e([y()],z.prototype,"_discreteVisualizationParameters",null),e([y()],z.prototype,"_shadowLayerViews",null),e([y()],z.prototype,"_previewDependencies",null),e([y()],z.prototype,"_renderer",null),z=e([v("esri.views.3d.analysis.ShadowCastAnalysisView3D")],z);const S=z;function L(e,t,i){t&&null!=i&&e?.setParameters({shadowCast:i})}function A(e,t){return(t?.[0]?.color??e).toUnitRGBA()}function k(e){if(e.suspended)return!1;switch(e.type){case"building-scene-3d":case"csv-3d":case"elevation-3d":case"feature-3d":case"geojson-3d":case"integrated-mesh-3d":case"integrated-mesh-3dtiles":case"ogc-feature-3d":case"route-3d":case"scene-layer-3d":case"scene-layer-graphics-3d":case"stream-3d":case"wms-3d":case"catalog-footprint-3d":return!0;case"base-dynamic-3d":case"catalog-3d":case"catalog-dynamic-group-3d":case"dimension-3d":case"gaussian-splat-3d":case"imagery-3d":case"imagery-tile-3d":case"line-of-sight-3d":case"map-image-3d":case"point-cloud-3d":case"tile-3d":case"vector-tile-3d":case"viewshed-3d":case"voxel-3d":case"wfs-3d":case"wmts-3d":case"media-3d":case"group":default:return!1;case"graphics-3d":return e.layer.graphics.some(e=>{const{symbol:t}=e;return null==t||"text"!==t.type&&!("symbolLayers"in t)||"text"!==t.type&&t.symbolLayers.some(e=>"text"!==e.type)})}}function E(e,t){if(e===t)return!0;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;const s=D(e.slicePlane,t.slicePlane),r=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),n=i(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,a=i(e.layerVisibilities,t.layerVisibilities),o=i(e.layerOpacities,t.layerOpacities),l=i(e.filters,t.filters),u=i(e.definitionExpressions,t.definitionExpressions);return s&&r&&n&&a&&o&&l&&u}const R=_(1,"hours","milliseconds"),H=500,G=255,M=f(),I=[],q=new P;export{S as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t,equals as i}from"../../../core/arrayUtils.js";import{createTask as s}from"../../../core/asyncUtils.js";import r from"../../../core/Error.js";import"../../../core/has.js";import a from"../../../core/Logger.js";import{abortMaybe as n,destroyMaybe as o}from"../../../core/maybe.js";import{after as l,throwIfAborted as u,isPromiseLike as c}from"../../../core/promiseUtils.js";import{watch as p,syncAndInitial as d}from"../../../core/reactiveUtils.js";import{createScreenPointArray as h,createRenderScreenPointArray as m}from"../../../core/screenUtils.js";import{offsetDateUTC as g,convertTime as _}from"../../../core/timeUtils.js";import{property as f,subclass as y}from"../../../core/accessorSupport/decorators.js";import{create as v}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as D}from"../../../core/support/UpdatingHandles.js";import{g as C}from"../../../chunks/boundedPlane.js";import{polygonToVolume as b}from"../focusAreaUtils.js";import V from"./AnalysisView3D.js";import{registerAnalysisView as U,hideOtherAnalysisViews as T}from"./ShadowCast/analysisViewRegister.js";import{ShadowCastTooltip as P}from"./ShadowCast/ShadowCastTooltip.js";import{ElevationContext as O}from"../layers/graphics/ElevationContext.js";import{longitudeToTimezone as x}from"../support/earthUtils.js";import{computeDirectionsOverTime as j}from"../support/sunUtils.js";import{maxColorRampSize as S}from"../webgl-engine/shaders/colorRampParameters.js";import{breadthFirstBinaryPartitioning as z}from"../../../widgets/support/traversalUtils.js";let R=class extends V{constructor(e){super(e),this.type="shadow-cast-view-3d",this.analysis=null,this._updatingHandles=new D,this._stopPreviewingTask=null,this._updatedRecently=!1,this._tooltip=null,this._previousVolume=null}initialize(){this.addHandles([U(this.view,this),p(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{n(this._stopPreviewingTask),this._updatedRecently=!0,this._stopPreviewingTask=s(async e=>{await l(M,e),u(e),this._updatedRecently=!1})},{sync:!0,initial:!0,equals:(e,t)=>H(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),p(()=>({renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t})=>{t&&T(this.view,this),e?.setParameters({shadowCast:{enabled:t}})},d),p(()=>({renderer:this._renderer,parameters:this._visualizationParameters,visible:this.visible}),({renderer:e,parameters:t,visible:i})=>{L(e,i,t)},d),p(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext,visible:this.visible}),({renderer:e,lightDirections:t,lightDirectionsContext:i,visible:s})=>{L(e,s,{lightDirections:t,lightDirectionsContext:i})},d),p(()=>({renderer:this._renderer,previewing:this._previewing,visible:this.visible}),({renderer:e,previewing:t,visible:i})=>{L(e,i,{previewing:t})},d),p(()=>({analysisVolume:this._analysisVolume,renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t,analysisVolume:i})=>{L(e,t,{analysisVolume:i})},d)]),this.interactive=!0,this._tooltip=new P({getDuration:this.getDurationAtScreen.bind(this),isVisible:()=>this.interactive&&this.visible,view:this.view})}destroy(){this.visible&&L(this._renderer,!0,{enabled:!1}),this._tooltip=o(this._tooltip),this._stopPreviewingTask=n(this._stopPreviewingTask),this._updatingHandles=o(this._updatingHandles)}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return this._previewing||null!=this._stopPreviewingTask&&!this._stopPreviewingTask.finished||!0===this._tooltip?.updating||this._updatingHandles.updating}get visible(){return super.visible}set visible(e){super.visible=e}get _previewing(){return this._updatedRecently||this._sceneUpdating}get _sceneUpdating(){const{view:e}=this;if(null==e?.allLayerViews)return!0;const{stationary:t,graphicsView:i}=e;return!t||this._shadowLayerViews.some(e=>e.updating)||!i?.suspended&&!!i?.updating}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){const e=this._referencePosition;return null!=e?x(e[0],!1):0}get _dateUTCOffset(){let e=this.analysis.date;return e=g(e,-e.getTimezoneOffset(),"minutes"),e=g(e,-this._effectiveUtcOffset,"hours"),e}get _startDateTimeUTC(){return g(this._dateUTCOffset,this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return g(this._dateUTCOffset,this.analysis.endTimeOfDay)}get _referencePosition(){return this.view?.environmentManager?.referencePositionGeographic}get _totalDurationInterval(){return this._totalDuration>0?Math.floor(this._totalDuration/(B-1)):B}get _interval(){const e=this._totalDurationInterval;switch(this.analysis.mode){case"min-duration":return this._totalDuration>0?e:0;case"total-duration":return e;case"discrete":return this.analysis.discreteOptions.interval||e}}get _intervalContext(){const{mode:e,minDurationOptions:t}=this.analysis;return"min-duration"===e&&t.contextEnabled?t.contextOptions.interval||this._totalDurationInterval:-1}get _totalDurationSampleCount(){return this._lightDirections.length}get _totalDuration(){const{startTimeOfDay:e,endTimeOfDay:t}=this.analysis;return t-e}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){const{view:t}=this;if(e<=0)return[];const i="global"===t.viewingMode?I:this._referencePosition;if(null==i)return[];const s=j(this._startDateTimeUTC,this._endDateTimeUTC,e,i,t.state.viewingMode,B),r=s.length;q.length=0;const a=z(0,r,q),n=new Array(r);for(let o=0;o<r;++o)n[o]=s[a[o]];return n}get _analysisVolume(){const{geometry:e}=this.analysis;if(null==e)return this._previousVolume=null,null;try{const t=b(e,this.view,F);return null==t?(this._previousVolume=null,null):c(t)?(this._updatingHandles.consumePromise(t),this._previousVolume):(this._previousVolume=t,t)}catch(t){return a.getLogger(this).error(new r("shadowcastanalysisview3d:projection-failed","Failed to project analysis area geometry to view spatial reference",{geometry:e,error:t})),null}}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case"min-duration":return this._minDurationVisualizationParameters;case"total-duration":return this._durationVisualizationParameters;case"discrete":return this._discreteVisualizationParameters}}get _minDurationVisualizationParameters(){const{color:e,minDuration:t}=this.analysis.minDurationOptions,i=this._totalDuration;return{visualization:2,thresholdColor:e.toUnitRGBA(),threshold:i>0?t/this._totalDuration:0,...this._minDurationContextVisualizationParameters}}get _minDurationContextVisualizationParameters(){const{minDurationOptions:e}=this.analysis;return e.contextEnabled?{visualization:3,gradientColorRamp:this._getEffectiveShadowCastColorRamp(e.contextOptions.color,e.contextOptions.colorStops,1/this._lightDirectionsContext.length)}:{}}get _durationVisualizationParameters(){const{color:e,colorStops:t,mode:i}=this.analysis.totalDurationOptions,s=this._totalDuration,r=s>0&&"hourly"===i?G/s:0,a=this._getEffectiveShadowCastColorRamp(e,t,1/s);return 0===r?{...this._discreteVisualizationParameters,gradientColorRamp:a}:{bandedGradientColorRamp:a,visualization:1,bandSize:r}}get _discreteVisualizationParameters(){const{color:e,colorStops:t}=this.analysis.discreteOptions;return{gradientColorRamp:this._getEffectiveShadowCastColorRamp(e,t,1/this._lightDirections.length),visualization:0}}get _shadowLayerViews(){return this.view.allLayerViews.items.filter(k)}get _previewDependencies(){const{view:e}=this,i=e.slice.plane,s=this._shadowLayerViews,r=s.map(e=>e.layer).filter(t),a=s.map(e=>e.suspended),n=r.map(e=>e.visible),o=r.map(e=>e.opacity),l=!!e.graphicsView?.suspended,u=r.filter(e=>"definitionExpression"in e).map(e=>e.definitionExpression),c=s.filter(e=>"filter"in e).map(e=>e.filter);return{slicePlane:i,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:a,graphicsViewSuspended:l,layerVisibilities:n,layerOpacities:o,filters:c,definitionExpressions:u}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){const{_renderer:t,_totalDurationSampleCount:i}=this;if(null==t||0===i)return 0;const s=this.view.state.camera.screenToRender(h(e.x,e.y),m());return t.readAccumulatedShadow(s)*this._totalDuration}_getEffectiveShadowCastColorRamp(e,t,i){if(null!=t){t.length>S&&a.getLogger(this).warnOnce("ShadowCastAnalysis supports at most 8 color stops");const e=t.map(e=>[e.value*i,e.color.toUnitRGBA()]);return e.sort(([e],[t])=>e-t),e}return E(e)}};e([f({readOnly:!0,type:["shadow-cast-view-3d"]})],R.prototype,"type",void 0),e([f({constructOnly:!0,nonNullable:!0})],R.prototype,"analysis",void 0),e([f({readOnly:!0})],R.prototype,"updating",null),e([f()],R.prototype,"_stopPreviewingTask",void 0),e([f()],R.prototype,"_updatedRecently",void 0),e([f()],R.prototype,"_tooltip",void 0),e([f()],R.prototype,"_sceneUpdating",null),e([f()],R.prototype,"_effectiveUtcOffset",null),e([f()],R.prototype,"_utcOffsetAuto",null),e([f()],R.prototype,"_dateUTCOffset",null),e([f()],R.prototype,"_startDateTimeUTC",null),e([f()],R.prototype,"_endDateTimeUTC",null),e([f()],R.prototype,"_referencePosition",null),e([f()],R.prototype,"_interval",null),e([f()],R.prototype,"_intervalContext",null),e([f()],R.prototype,"_totalDurationSampleCount",null),e([f()],R.prototype,"_totalDuration",null),e([f()],R.prototype,"_lightDirections",null),e([f()],R.prototype,"_lightDirectionsContext",null),e([f()],R.prototype,"_analysisVolume",null),e([f()],R.prototype,"_visualizationParameters",null),e([f()],R.prototype,"_minDurationVisualizationParameters",null),e([f()],R.prototype,"_minDurationContextVisualizationParameters",null),e([f()],R.prototype,"_durationVisualizationParameters",null),e([f()],R.prototype,"_discreteVisualizationParameters",null),e([f()],R.prototype,"_shadowLayerViews",null),e([f()],R.prototype,"_previewDependencies",null),e([f()],R.prototype,"_renderer",null),R=e([y("esri.views.3d.analysis.ShadowCastAnalysisView3D")],R);const A=R;function L(e,t,i){t&&null!=i&&e?.setParameters({shadowCast:i})}function E(e){const t=e.toUnitRGBA();return[[0,w(t[0],t[1],t[2],0)],[1,t]]}function k(e){if(e.suspended)return!1;switch(e.type){case"building-scene-3d":case"csv-3d":case"elevation-3d":case"feature-3d":case"geojson-3d":case"integrated-mesh-3d":case"integrated-mesh-3dtiles":case"ogc-feature-3d":case"route-3d":case"scene-layer-3d":case"scene-layer-graphics-3d":case"stream-3d":case"wms-3d":case"catalog-footprint-3d":return!0;case"base-dynamic-3d":case"catalog-3d":case"catalog-dynamic-group-3d":case"dimension-3d":case"gaussian-splat-3d":case"imagery-3d":case"imagery-tile-3d":case"line-of-sight-3d":case"map-image-3d":case"point-cloud-3d":case"tile-3d":case"vector-tile-3d":case"viewshed-3d":case"voxel-3d":case"wfs-3d":case"wmts-3d":case"media-3d":case"group":default:return!1;case"graphics-3d":return e.layer.graphics.some(e=>{const{symbol:t}=e;return null==t||"text"!==t.type&&!("symbolLayers"in t)||"text"!==t.type&&t.symbolLayers.some(e=>"text"!==e.type)})}}function H(e,t){if(e===t)return!0;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;const s=C(e.slicePlane,t.slicePlane),r=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=i(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,n=i(e.layerVisibilities,t.layerVisibilities),o=i(e.layerOpacities,t.layerOpacities),l=i(e.filters,t.filters),u=i(e.definitionExpressions,t.definitionExpressions);return s&&r&&a&&n&&o&&l&&u}const G=_(1,"hours","milliseconds"),M=500,B=255,I=v(),q=[],F=new O;export{A as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import
|
|
2
|
+
import{__decorate as e}from"tslib";import i from"../../../core/Error.js";import o from"../../../core/Logger.js";import{isAborted as t}from"../../../core/promiseUtils.js";import{property as r,subclass as s}from"../../../core/accessorSupport/decorators.js";import a from"../../../layers/support/ElevationTileData.js";import{ElevationLayerView3DModifications as n,ElevationLayerView3DModification as l}from"./ElevationLayerView3DModifications.js";import{LayerView3D as m}from"./LayerView3D.js";import{TiledLayerView3D as p}from"./TiledLayerView3D.js";import{elevationNoDataValue as c}from"../terrain/TerrainConst.js";import y from"../../layers/LayerView.js";let f=class extends(p(m(y))){constructor(){super(...arguments),this.type="elevation-3d",this.modifications=new n}get tileInfo(){return this.layer.tileInfo}initialize(){const e=this.view,o=e.map?.allLayers,t=o&&o.includes(this.layer),r=e.map?.ground?.layers,s=r&&r.includes(this.layer);if(t&&!s){const e=new i("layerview:elevation-layer-only",`3D elevation layer '${this.layer.id}' can only be added to layers in map.ground`);this.addResolvingPromise(Promise.reject(e))}this._addTilingSchemeMatchPromise()}async fetchElevationTile(e,i){const o=await this._fetchTileData(e.lij,i);if(!t(i))return o&&await this.modifications.apply(o,e,i.signal),o}async _fetchTileData(e,i){const r=this.layer,s=await r.fetchTile(e[0],e[1],e[2],{noDataValue:c,signal:i.signal,useQueue:i.useQueue,priority:i.priority});if(!t(i))return a.from(s);o.getLogger(this).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true.")}async setModifications(e){if(this.modifications.modifications.length=0,!e||0===e.length)return;this._simplifyOperatorPromise??=import("../../../geometry/operators/simplifyOperator.js");const i=await this._simplifyOperatorPromise;for(const t of e){const e=t.geometry;if("polygon"===e?.type){const r=i.execute(e);if("polygon"===r?.type){const e=new l(t.type,r);this.modifications.modifications.push(e)}else o.getLogger(this).warn("Failed to simplify modification polygon")}else o.getLogger(this).warn("Invalid modification added to elevation layer: "+(e?`non polygon geometry ${e.type}`:"no geometry"))}}};e([r()],f.prototype,"layer",void 0),e([r()],f.prototype,"tileInfo",null),e([r()],f.prototype,"modifications",void 0),f=e([s("esri.views.3d.layers.ElevationLayerView3D")],f);const d=f;export{d as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import"../../../core/has.js";import{whenOnce as i,watch as r,sync as s}from"../../../core/reactiveUtils.js";import{property as l,subclass as a}from"../../../core/accessorSupport/decorators.js";import{computeSrcResolutions as n,projectDatasetExtent as o}from"../../../layers/raster/functions/rasterProjectionHelper.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import"../../../core/has.js";import{whenOnce as i,watch as r,sync as s}from"../../../core/reactiveUtils.js";import{property as l,subclass as a}from"../../../core/accessorSupport/decorators.js";import{computeSrcResolutions as n,projectDatasetExtent as o}from"../../../layers/raster/functions/rasterProjectionHelper.js";import{createBitmapResult as h}from"../../../layers/support/imageBitmapUtils.js";import{LayerView3D as m}from"./LayerView3D.js";import{TiledLayerView3D as p}from"./TiledLayerView3D.js";import u from"../support/flow/FlowSubViewTiles3D.js";import{RasterTile as d}from"../terrain/RasterTile.js";import c from"../../layers/ImageryTileLayerView.js";import{RefreshableLayerView as y}from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as f}from"../../support/drapedUtils.js";import{getWebGLCapabilities as b}from"../../webgl/capabilities.js";let g=class extends(y(p(m(c)))){constructor(){super(...arguments),this._srcResolutions=[],this.type="imagery-tile-3d",this._isAlignedMapTile=!0,this._flowSubView=null,this.ignoresMemoryFactor=!1,this.unloadedMemory=0}initialize(){this.layer.increaseRasterJobHandlerUsage(),null==this.fullExtent&&this.addResolvingPromise(Promise.reject(new t("layerview:spatial-reference-incompatible","The layer extent cannot be projected to the view's spatial reference",{layer:this.layer})));const e=i(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{const e=this.view.basemapTerrain.tilingScheme,t=this.layer.tileInfo;this._isAlignedMapTile=["png","png24","png32","jpg","mixed"].includes(t.format)&&e.compatibleWith(t),this.tileInfo=this._isAlignedMapTile?t:e.toTileInfo(),this._srcResolutions=n(this.layer.serviceRasterInfo,this.tileInfo),this.addHandles([r(()=>this.layer.renderer,e=>{this._setSubView(e),this._updatingHandles.consumePromise(this.doRefresh())},s),r(()=>[this.layer.interpolation,this.layer.bandIds,this.layer.multidimensionalDefinition,this.layer.multidimensionalSubset,this.layer.rasterFunction,this.timeExtent],()=>this._updatingHandles.addPromise(this.doRefresh()),s)])});this._setSubView(this.layer.renderer),this.addResolvingPromise(e)}destroy(){this.layer.decreaseRasterJobHandlerUsage(),this._flowSubView?.destroy()}get fullExtent(){try{return this.layer.loaded?this._getFullExtent():null}catch{return null}}_setSubView(e){if("wcs"===this.layer.type)return;const t="flow"===e?.type,i=this._flowSubView;t&&null!=i||(i?.destroy(),this._flowSubView=t?new u({layerView:this}):null)}get _blankTile(){const e=document.createElement("canvas"),t=e.getContext("2d"),[i,r]=this.tileInfo.size;return e.width=i,e.height=r,t.clearRect(0,0,i,r),h(e,{type:"image/png"})}get _hasFlow(){return null!=this._flowSubView}get imageFormatIsOpaque(){return"jpg"===this.layer.tileInfo.format}get hasMixedImageFormats(){return"mixed"===this.layer.tileInfo.format}get dataLevelRange(){const e=this.layer.tileInfo,t=this.tileInfo.lodAt(0)?.scale,i=e.lodAt(e.lods.length-1)?.scale;return this.levelRangeFromScaleRange(t,i)}get visibleAtCurrentScale(){return this._flowSubView?.visibleAtCurrentScale??this.tilesVisibleAtCurrentScale()}_getFullExtent(){return o(this.layer.serviceRasterInfo,this.view.basemapTerrain?.spatialReference??this.view.spatialReference)}async fetchTile(e,i){if(this._isAlignedMapTile)return this.layer.fetchImageBitmapTile(e[0],e[1],e[2],{...i,allowDeriveTypeFromData:!0,imageOrientation:"flipY"});const r=this.tileInfo,s=this._canSymbolizeInWebGL(),l={tileInfo:r,requestRawData:s&&!this._hasFlow,signal:i.signal,timeExtent:this.timeExtent,requestProjectedLocalDirections:this._hasFlow,srcResolution:this._srcResolutions[e[0]],noClip:!1},{layer:a}=this,[n,o,h]=e,m=await a.fetchTile(n,o,h,l);if(m instanceof HTMLImageElement||m instanceof ImageBitmap)throw new t("layerview:unexpected-tile-data","Expected fetchTile to return raster data, but received an image element. This may indicate a problem with the layer's fetchTile implementation.");let p=m?.pixelBlock;if(null==p)return this._blankTile;if(!s&&!this._hasFlow&&(p=await a.applyRenderer(m),null==p))return this._blankTile;const u=new d([n,o,h],p,r.size[0],r.size[1]);return s?(u.symbolizerRenderer=a.symbolizer.rendererJSON,u.symbolizerParameters=a.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(n)),u.transformGrid=m.transformGrid,u.bandIds=a.bandIds):(u.isRenderedSource=!0,u.bandIds=null),u.interpolation=a.interpolation,u}_getSymbolizerOptions(e){const t=this.tileInfo.lodAt(e).resolution;return{pixelBlock:null,isGCS:null!=this.view.basemapTerrain?.spatialReference?this.view.basemapTerrain.spatialReference.isGeographic:this.view.spatialReference.isGeographic,resolution:{x:t,y:t},bandIds:this.layer.bandIds}}ensureSymbolizerParameters(e){this._canSymbolizeInWebGL()&&JSON.stringify(e.symbolizerRenderer)!==JSON.stringify(this.layer.symbolizer.rendererJSON)&&(e.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e.lij[0])))}createFetchPopupFeaturesQueryGeometry(e,t){return f(e,t,this.view)}async doRefresh(){this.suspended||(this._flowSubView?.doRefresh(),this.emit("data-changed"))}isUpdating(){return this._flowSubView?.updating??!1}_canSymbolizeInWebGL(){const e=b(),{symbolizer:t}=this.layer,i=t.lookup.colormapLut?.indexedColormap,r=!!this.layer.rasterFunction?.hasClipFunction,s=i&&i.length>4*(e.maxTextureSize||4096);return t.canRenderInWebGL&&!s&&!r}get usedMemory(){return this._flowSubView?.usedMemory??0}get test(){}};e([l()],g.prototype,"fullExtent",null),e([l()],g.prototype,"_blankTile",null),e([l()],g.prototype,"_hasFlow",null),e([l({readOnly:!0})],g.prototype,"imageFormatIsOpaque",null),e([l({readOnly:!0})],g.prototype,"hasMixedImageFormats",null),e([l()],g.prototype,"_flowSubView",void 0),e([l({readOnly:!0})],g.prototype,"dataLevelRange",null),e([l({readOnly:!0})],g.prototype,"visibleAtCurrentScale",null),g=e([a("esri.views.3d.layers.ImageryTileLayerView3D")],g);const w=g;export{w as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as c,subclass as d}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as u,fromQuat as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p,IDENTITY as f}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as y}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as _,dot as v,set as w,transformMat3 as x,add as T}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as j,freeze as C,clone as M,fromValues as O,ZEROS as E}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as R,fromValues as V,ONES as S}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as U,isMars as H,getReferenceEllipsoid as k,SphericalECEFSpatialReferenceLike as P}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as A}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as L}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as I}from"../../../geometry/projection/projectVectorToVector.js";import{create as D}from"../../../geometry/support/aaBoundingRect.js";import{isCGCS2000 as B}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec4f as F,BufferViewVec4u8 as G,BufferViewVec4u16 as N,BufferViewVec3f as z,BufferViewVec3u8 as q,BufferViewVec3u16 as W,BufferViewVec2f as $,BufferViewUint32 as Z,BufferViewUint16 as J,BufferViewVec2i16 as X}from"../../../geometry/support/buffer/BufferView.js";import Y from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as Q}from"../../../support/elevationInfoUtils.js";import{computeNormals as K,writeAddedVerticesAndNormals as ee,NormalData as te}from"./IntegratedMeshNormals.js";import{LayerView3D as ie}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as se}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as re,removeLayerViewFromWasm as oe,getLyr3DWasm as ne}from"./Lyr3DWasm.js";import{toWasmModification as ae}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as le}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as ce}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as de,alphaModeConversion as he,faceCullingConversion as ue,wrapModeConversion as me}from"./support/lyr3dTypeConversions.js";import{Tiles3DMeshIntersectionHandler as pe}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as fe}from"../state/Frustum.js";import{ElevationRange as be}from"../support/ElevationRange.js";import{toBoundingRect as ye}from"../support/extentUtils.js";import{Obb as ge,compute as _e}from"../support/orientedBoundingBox.js";import{glLayout as ve}from"../support/buffer/glUtil.js";import{VertexBufferLayoutCreationParameters as we,createVertexBufferLayout as xe,ComponentGeometryParameters as Te,SourceGeometry as je}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Ce}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Me}from"../webgl-engine/core/material/RenderTexture.js";import{Vertices as Oe}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as Ee}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as Re}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Ve}from"../webgl-engine/materials/pbrUtils.js";import Se from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Ue,isInEffectiveScaleRange as He,validateScaleRange as ke}from"../../support/layerViewUtils.js";import{TaskPriority as Pe}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ae}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Le}from"../../../webscene/support/AlphaCutoff.js";var Ie;let De=class extends(ie(Se)){static{Ie=ce}constructor(e){super(e),this[Ie]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ae,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Pe.TILES3D,this),this._frustum=new fe(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Ue("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=re(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new pe(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new le({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange()),n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),oe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=ae(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=D();this._layerClippingArea=ye(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,Q(e))}get _wasm(){return ne(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||He(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||ke(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new se(this.usedMemory,r,o,Ge(t),Ge(e),Ge(s),Ge(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return Q(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new be(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new be;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,s=i.isWGS84||i.isWebMercator||B(i)||U(i)||H(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=k(i).radius,{eye:o,viewForward:n,near:a}=t.state.camera,l=g(j(),n),c=500,d=Math.max(o[2],c),h=d+r,u=Math.sqrt(h**2-r**2),m=Math.abs(Math.atan2(u,r))*r,p=d>.5*r?.5*Math.PI*r:m,f=j();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;_(f,s,o);const r=v(f,l);Math.abs(r)<p&&r+i>a&&r-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!Qe(t))throw new Error("meshData not valid");const i=new Map;let s;try{s=this._createPrimitiveTextureBundles(t,i)}catch(n){throw i.forEach(e=>this._stage.removeTexture(e)),n}const r=new Array,o=new be;try{const n=await this._frameTask.schedule(()=>this._createRenderableMain(t,s,i,r,o),null);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");if(await Promise.all(s.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const a=r.reduce((e,t)=>{const{texture:i,textureMetallicRoughness:s,textureEmissive:r,textureOcclusion:o,textureNormal:n}=t.renderable.drawParameters;return e+(i?.usedMemory??0)+(s?.usedMemory??0)+(r?.usedMemory??0)+(o?.usedMemory??0)+(n?.usedMemory??0)},0),l=new Fe(e.handle,r,n.textures,n.cpuMemoryUsage,n.vboMemoryUsage,a,n.tileObb,e.stableNodeId,e.nodeDepth,o);this._lyrHandleToObjects.set(e.handle,l),this._memCache.put(We(l.handle),l);const{usedMemory:c}=l;return this._cacheMemory+=c,{memUsageBytes:c}}catch(n){throw s.forEach(e=>e.cleanup()),r.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage.removeTexture(e)),n}}_createPrimitiveTextureBundles(e,t){const i=new Array,s=e.desc.prims.length;try{for(let r=0;r<s;r++){const s=e.desc.prims[r],o=e.desc.materials&&null!=s.materialId?e.desc.materials[s.materialId]:null;let n=Promise.resolve($e),a=null,l=null,c=null,d=null,h=null;if(o){const i="Pbr"===o.lightingModel;a=this._getTexture(o.baseColorTex,e,t),l=i?this._getTexture(o.metalTex,e,t):null,c=i?this._getTexture(o.emissiveTex,e,t):null,d=i?this._getTexture(o.occlusionTex,e,t):null,h=i?this._getTexture(o.normalTex,e,t):null;const s=[a,l,c,d,h].map(e=>e?.loadPromise??null);n=Promise.all(s)}i.push(new Ze(n,a,l,c,d,h))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}_createRenderableMain(e,t,i,s,r){let o=0;const n=e.desc,a=e.data.buffer,l=n.prims.length,c=n.materials,d=C(...n.origin),m=this.view.basemapTerrain.spatialReference,y=this.view.state.isGlobal;let g=f;if(y){const e=b();A(P,d,e,m),g=h(p(),e)}if(null==n.obb)throw new Error("meshData.desc.obb undefined");const _=qe(n.obb),v=y?k(this.view.spatialReference).radius:0,x=g!==f,T=x?u(p(),g)??f:f,E=j();for(let h=0;h<l;h++){const e=n.prims[h],i=t[h];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(e));if(null==de[e.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive."),i.cleanup();continue}const l=c&&null!=e.materialId?c[e.materialId]:null,u=null!=l?l.lightingModel:"Unlit",{positionView:p,normalsData:f,colorView:b,texCoord0Data:C,indicesView:U}=this.getBufferViews(e,a);if(null==p||null==U){i.cleanup();continue}const H=p.count,k=(e,t)=>null==e||e===H||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!k(null!=C?C.length/2:void 0,"numTexcoord")||!k(b?.count,"numColors")||!k(f?.length,"normals")){i.cleanup();continue}const P=null!=b,A=null!=f||this._imVertexNormals,D=new we(P,A,C?1:0),B=this._imVertexNormals&&null==f?K(U.typedBuffer,p.typedBuffer,p.typedBufferStride):null,F=B?.outputVertexCount??H,G=xe(D),N=G.createBuffer(F),z=B?G.fields.get("normalCompressed"):null;if(null!=B&&null==z)throw new Error("computeNormals requires a reserved NORMALCOMPRESSED attribute in layout");const q=B?B.packedNormals:f;Ye(new Xe(d,v,y,g),{texCoord0Data:C,colorView:b,packedNormalsSource:q},N,{positionView:p,tileObb:_,obbHalfSizeAccumulator:E,elevationRange:r});const W=_?.clone()??ze(new Oe(p.typedBuffer,3),d);let $;if(null!=B){const e=G.stride/4,t=z.offset/4,i=H,s=new Uint32Array(N.buffer);ee(s,e,t,s,e,i,F,B.appendedVertexToOriginal,B.packedNormals),$=new te(N.buffer,B.indices)}else $=new te(N.buffer,U.typedBuffer);const Z=ve(G),J=new Uint32Array([0,U.typedBuffer.length]),X=new Te(Z,this._imShading?2:0,D.textureCoordinateType,x?1:0,0),Y=new je({interleavedVertexData:$.data,vertexCount:$.data.byteLength/Z[0].stride,indexData:$.indices},{positions:p.typedBuffer,indices:U.typedBuffer},J,X),Q=this.view.renderSpatialReference,ie=j(),se=[1,1,1];L(d,Q,se,m)||this._dbg(3,"Unsupported coordinate system for IM overlay"),I(d,Q,ie,m);let re=S,oe=Le,ne=null,ae=null,le=null,ce=null,me=null,pe=1,fe=!1,be=2,ye=!1,ge=O(0,0,0);const _e=M(Ve),Me="Pbr"===u;if(l&&(ne=i.baseColorTexture,me=i.metallicRoughnessTexture,ae=i.emissionTexture,ce=i.occlusionTexture,le=i.normalTexture,re=R(l.baseColorFactor),oe=l.alphaCutoff??Le,Me&&(w(_e,l.metallicFactor,l.roughnessFactor,0),l.emissiveFactor&&(ge=l.emissiveFactor)),pe=he[l.alphaMode],fe=l.isDoubleSided,be=ue[l.faceCulling??"NotSet"],ye=this.layer.replacesTerrain),this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}ne||this._dbg(3,"No colour texture 1");const Ee=this._collection.createObject({toMapSpace:V(ie[0],ie[1],se[0],se[1]),transform:new Ce(d,T),obb:W,geometry:Y,elevationAlignable:!1},{isIntegratedMesh:!0,baseColor:re,textureAlphaCutoff:oe,mrrFactors:_e,baseColorTexture:ne,metallicRoughnessTexture:me,normalTexture:le,occlusionTexture:ce,emissionTexture:ae,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:pe,doubleSided:fe,cullFace:be,isGround:ye,emissiveBaseColor:ge,usePBR:Me,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO});o+=this._collection.getObjectGPUMemoryUsage(Ee),s.push(Ee)}const U=Array.from(i.values()),{fullExtent:H}=this.layer;H?.hasZ&&H.zmax&&H.zmin&&(r.minElevation=Math.max(r.minElevation,H.zmin),r.maxElevation=Math.min(r.maxElevation,H.zmax));const D=s.reduce((e,t)=>e+t.intersectionGeometry.usedMemory,0);return new Je(o,_,U,D)}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=We(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1,n=!1;for(let a=0;a<i;++a){if(!t[a])continue;const i=e[a],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(We(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let a=0;a<i;++a){const i=e[a];if(t[a])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=s.isVisible;this._visibleObjects.delete(s),s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),this._intersectionHandler.removeTile(s),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(We(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=i.get(s)??this._createTexture(e,t,i);return r?new Me(this._stage.renderView.textures,r.id):null}_createTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,o=!!s.mipCount||r>1,n=me[e.wrapMode??"None"];let a=s.alpha?6408:6407;const l=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let c=null,d=null,h=null;switch(s.format){case"Raw":"R8"===s.pixelFormat?(c=l,a=6403,d=""):"Rgb8"===s.pixelFormat?(c=l,a=6407,d=""):"Rgba8"===s.pixelFormat&&(c=l,a=6408,d="");break;case"Dxt1":c=l,a=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,a=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,a=6407,d="image/ktx2";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,t=new Ee(c,{mipmap:o,maxAnisotropy:r,encoding:d,wrap:n,pixelFormat:a,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(t),i.set(s,t),t}return null}getBufferViews(e,t){let i,s,r,o,n;for(let l=0;l<e.atrbs.length;l++){const n=e.atrbs[l],{view:c}=n,d=void 0,h=c.byteOffset+c.byteCount;try{switch(n.sem){case"Position":3!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+c+")"):i=new z(t,c.byteOffset,d,h);break;case"Normal":if(3!==c.ncomp||"F32"!==c.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+c+")");else{const e=new z(t,c.byteOffset,d,h);o=new Uint32Array(e.count),Re(e.typedBuffer,new Int16Array(o.buffer,o.byteOffset,2*o.length))}break;case"TexCoord":2!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+c+")"):void 0===r&&(r=new $(t,c.byteOffset,d,h).typedBuffer);break;case"Color":4===c.ncomp?("F32"===c.type&&(s=new F(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new G(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new N(t,c.byteOffset,d,h))):3===c.ncomp&&("F32"===c.type&&(s=new z(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new q(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new W(t,c.byteOffset,d,h))),null==s&&this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+c+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+n.sem+"). Skipping vertex attribute.")}}catch(a){this._dbg(2,"Error Creating buffer ("+a+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":n=new J(t,i.byteOffset,s,r);break;case"U32":n=new Z(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==n&&null!=i){const e=i.count;n=n=e<65535?new J(new Uint16Array(e).buffer):new Z(new Uint32Array(e).buffer);for(let t=0;t<e;t++)n.set(t,t)}return{positionView:i,colorView:s,texCoord0Data:r,indicesView:n,normalsData:o}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([c()],De.prototype,"fullOpacity",null),e([c({readOnly:!0})],De.prototype,"ready",null),e([c({type:[Y]})],De.prototype,"_modifications",void 0),e([c()],De.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],De.prototype,"layer",void 0),e([c({readOnly:!0})],De.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],De.prototype,"_collection",null),e([c()],De.prototype,"elevationOffset",null),e([c({readOnly:!0})],De.prototype,"visibleElevationRange",null),De=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],De);const Be=De;class Fe{constructor(e,t,i,s,r,o,n,a,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=j();n?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=n?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const u=n?.halfSize;this._obbShortestHalfsize=u?Math.min(u[0],u[1],u[2]):0,this._mbsCenter=n?M(n.center):E}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:s,_obbCenterZ:r}=this,o=i-e[0],n=s-e[1],a=r-e[2],l=o*t[0]+n*t[1]+a*t[2];return o*o+n*n+a*a-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const n=this._obbCenterY-i[1];if(n>r)return!1;const a=this._obbCenterZ-i[2];if(a>r)return!1;const l=o*o+n*n+a*a;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;return Math.sqrt(l)+t<=s||(this.obb?.intersectSphere(e)??!0)}}function Ge(e){return Math.round(e/1048.576)/1e3}const Ne=j();function ze(e,t){const i=_e(e);return T(Ne,i.center,t),i.center=Ne,i}function qe(e){return new ge(e.center,e.halfSize,y(...e.quaternion))}function We(e){return`${e}`}const $e=new Array;class Ze{constructor(e,t,i,s,r,o){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=s,this.occlusionTexture=r,this.normalTexture=o}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}class Je{constructor(e,t,i,s){this.vboMemoryUsage=e,this.tileObb=t,this.textures=i,this.cpuMemoryUsage=s}}class Xe{constructor(e,t,i,s){this.origin=e,this.ellipsoidRadius=t,this.isGlobal=i,this.ecefRotation=s}}function Ye(e,t,i,s){const{origin:r,ellipsoidRadius:o,isGlobal:n,ecefRotation:a}=e,{texCoord0Data:l,colorView:c,packedNormalsSource:d}=t,{positionView:h,tileObb:u,obbHalfSizeAccumulator:p,elevationRange:b}=s,y=i.getField("position",z),g=y.typedBuffer,_=y.typedBufferStride,v=null!=l?i.getField("uv0",$):null,w=v?.typedBuffer,T=v?.typedBufferStride??0,j=c?.typedBuffer,C=c?.elementCount??0,M=null!=c?i.getField("color",G):null,O=M?.typedBuffer,R=M?.typedBufferStride??0,V=null!=d?i.getField("normalCompressed",X):null,S=null!=V?new Uint32Array(V.typedBuffer.buffer,V.typedBuffer.byteOffset,V.typedBuffer.length/2):null,U=null!=V?V.typedBufferStride/2:0,H=null!=u?m(et,u.quaternionConjugate):f,k=x(Ke,u?.center??E,H),P=H[0],A=H[1],L=H[2],I=H[3],D=H[4],B=H[5],F=H[6],N=H[7],q=H[8],W=k[0],Z=k[1],J=k[2],Y=a[0],Q=a[1],K=a[2],ee=a[3],te=a[4],ie=a[5],se=a[6],re=a[7],oe=a[8],ne=a!==f,ae=r[0],le=r[1],ce=r[2],de=h.count,he=h.typedBufferStride,ue=h.typedBuffer,me=null!=w&&null!=l,pe=null!=O&&null!=j&&(3===C||4===C),fe=4===C,be=null!=S&&null!=d,ye=null!=p;let ge=ye?p[0]:0,_e=ye?p[1]:0,ve=ye?p[2]:0;for(let m=0;m<de;++m){const e=m*he,t=ue[e],i=ue[e+1],s=ue[e+2],r=t+ae,a=i+le,c=s+ce,h=n?Math.sqrt(r*r+a*a+c*c)-o:c;if(b.expandElevationRangeValues(h,h),ye){const e=Math.abs(r*P+a*I+c*F-W),t=Math.abs(r*A+a*D+c*N-Z),i=Math.abs(r*L+a*B+c*q-J);ge=Math.max(ge,e),_e=Math.max(_e,t),ve=Math.max(ve,i)}const u=m*_;if(ne){const r=t*Y+i*ee+s*se,o=t*Q+i*te+s*re,n=t*K+i*ie+s*oe;ue[e]=r,ue[e+1]=o,ue[e+2]=n,g[u]=r,g[u+1]=o,g[u+2]=n}else g[u]=t,g[u+1]=i,g[u+2]=s;if(me){const e=2*m,t=m*T;w[t]=l[e],w[t+1]=l[e+1]}if(pe){const e=m*R;if(fe){const t=4*m;O[e]=j[t],O[e+1]=j[t+1],O[e+2]=j[t+2],O[e+3]=j[t+3]}else{const t=3*m;O[e]=j[t],O[e+1]=j[t+1],O[e+2]=j[t+2],O[e+3]=255}}be&&(S[m*U]=d[m])}u&&ye&&(p[0]=ge,p[1]=_e,p[2]=ve,u.setHalfSize(ge,_e,ve))}function Qe(e){return null!=e.data&&("string"==typeof e.desc&&(e.desc=JSON.parse(e.desc)),null!=e.desc)}const Ke=j(),et=p();export{Be as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as a,when as n}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as c,subclass as d}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as u,IDENTITY as p}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as y,sub as g,dot as _,set as v}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w,freeze as x,clone as T,fromValues as j,ZEROS as C}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as O,clone as M,ONES as E}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as R,isMars as V,getReferenceEllipsoid as U,SphericalECEFSpatialReferenceLike as H}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as S}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as D}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as I}from"../../../geometry/projection/projectVectorToVector.js";import{create as P}from"../../../geometry/support/aaBoundingRect.js";import{isCGCS2000 as L}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec4f as k,BufferViewVec4u8 as A,BufferViewVec4u16 as F,BufferViewVec3f as G,BufferViewVec3u8 as B,BufferViewVec3u16 as z,BufferViewVec2f as N,BufferViewUint32 as W,BufferViewUint16 as q}from"../../../geometry/support/buffer/BufferView.js";import $ from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as Z}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as J}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as X}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as Y}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as Q,removeLayerViewFromWasm as K,getLyr3DWasm as ee}from"./Lyr3DWasm.js";import{toWasmModification as te}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as ie}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as se}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as re,alphaModeConversion as oe,faceCullingConversion as ae,wrapModeConversion as ne}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as le}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as ce}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as de}from"../state/Frustum.js";import{ElevationRange as he}from"../support/ElevationRange.js";import{toBoundingRect as me}from"../support/extentUtils.js";import{Obb as ue}from"../support/orientedBoundingBox.js";import{glLayout as pe}from"../support/buffer/glUtil.js";import{ComponentGeometryParameters as be,SourceGeometry as fe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as ye}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as ge}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as _e}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as ve}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as we}from"../webgl-engine/materials/pbrUtils.js";import xe from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Te,isInEffectiveScaleRange as je,validateScaleRange as Ce}from"../../support/layerViewUtils.js";import{TaskPriority as Oe}from"../../support/Scheduler.js";import{TextureCompressionTracker as Me}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Ee}from"../../../webscene/support/AlphaCutoff.js";var Re;let Ve=class extends(X(xe)){static{Re=se}constructor(e){super(e),this[Re]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Me,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Oe.TILES3D,this),this._frustum=new de(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new J(le(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Te("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=Q(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new ce(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new ie({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([a(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),n(()=>this.fullOpacity,()=>this._opacityChange()),a(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),K(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=te(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=P();this._layerClippingArea=me(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,Z(e))}get _wasm(){return ee(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||je(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||Ce(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(a=>{a.isLoaded?(e+=a.textureMemoryUsage,t+=a.vboMemoryUsage,r++):(i+=a.textureMemoryUsage,s+=a.vboMemoryUsage,o++)}),new Y(this.usedMemory,r,o,Se(t),Se(e),Se(s),Se(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return Z(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new he(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new he;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,s=i.isWGS84||i.isWebMercator||L(i)||R(i)||V(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=U(i).radius,{eye:o,viewForward:a,near:n}=t.state.camera,l=y(w(),a),c=500,d=Math.max(o[2],c),h=d+r,m=Math.sqrt(h**2-r**2),u=Math.abs(Math.atan2(m,r))*r,p=d>.5*r?.5*Math.PI*r:u,b=w();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;g(b,s,o);const r=_(b,l);Math.abs(r)<p&&r+i>n&&r-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!ke(t))throw new Error("meshData not valid");const i=new Map;let s;try{s=this._createPrimitiveTextureBundles(t,i)}catch(o){throw i.forEach(e=>this._stage.removeTexture(e)),o}let r=null;try{if(r=await this._createRenderableMain(t,s),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:o,componentObjects:a,elevationRange:n}=r;let l=0,c=0,d=0;for(const e of a){const{texture:t,textureMetallicRoughness:i,textureEmissive:s,textureOcclusion:r,textureNormal:o}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(s?.usedMemory??0)+(r?.usedMemory??0)+(o?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),m=new He(e.handle,a,h,d,c,l,o,e.stableNodeId,e.nodeDepth,n);this._lyrHandleToObjects.set(e.handle,m),this._memCache.put(Ie(m.handle),m);const{usedMemory:u}=m;return this._cacheMemory+=u,{memUsageBytes:u}}catch(o){throw s.forEach(e=>e.cleanup()),r?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage.removeTexture(e)),o}}_createPrimitiveTextureBundles(e,t){const i=new Array,s=e.desc.prims.length;try{const r=e.desc;for(let o=0;o<s;o++){const s=r.prims[o].materialId,a=r.materials&&null!=s?r.materials[s]:null;let n=Promise.resolve(Pe),l=null,c=null,d=null,h=null,m=null;if(a){const i="Pbr"===a.lightingModel;l=this._getTexture(a.baseColorTex,e,t),c=i?this._getTexture(a.metalTex,e,t):null,d=i?this._getTexture(a.emissiveTex,e,t):null,h=i?this._getTexture(a.occlusionTex,e,t):null,m=i?this._getTexture(a.normalTex,e,t):null;const s=[l,c,d,h,m].map(e=>e?.loadPromise??null);n=Promise.all(s)}i.push(new Le(n,l,c,d,h,m))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,s=e.desc,r=e.data.buffer,o=s.prims.length,a=x(...s.origin),n=this.view.basemapTerrain.spatialReference,l=this.view.state.isGlobal;let c=p;if(l){const e=b();S(H,a,e,n),c=h(u(),e)}if(null==s.obb)throw new Error("meshData.desc.obb undefined");const d=De(s.obb),f=l?U(this.view.spatialReference).radius:0,y=new Array;try{for(let i=0;i<o;i++){const e=s.prims[i],o=t[i];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(e));if(null==re[e.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive."),o.cleanup();continue}const{positionView:a,normalsData:n,colorView:l,texCoord0Data:c,indicesView:d}=this.getBufferViews(e,r);if(null==a||null==d){o.cleanup();continue}const h=a.count,m=(e,t)=>null==e||e===h||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);m(null!=c?c.length/2:void 0,"numTexcoord")&&m(l?.count,"numColors")&&m(n?.length,"normals")?y.push({componentIndex:i,positionView:a,indicesView:d,texCoord0Data:c,colorView:l,normalsData:n}):o.cleanup()}const{vertexProcessingOutputs:e,obbHalfSizeAccumulator:h,elevationRange:b}=await this._workerHandle.processTiles3DVertices(y,a,f,l,c,d,this._imVertexNormals);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const g=s.materials,_=c!==p,v=_?m(u(),c)??p:p;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");for(const r of e){const{componentIndex:e,positionView:o,indicesView:l,layout:c,textureCoordinateType:h,interleavedVertexData:m,indices:u}=r,p=s.prims[e],b=t[e],f=d.clone(),y=pe(c),x=new Uint32Array([0,l.typedBuffer.length]),T=new be(y,this._imShading?2:0,h,_?1:0,0),j=new fe({interleavedVertexData:m,vertexCount:m.byteLength/y[0].stride,indexData:u},{positions:o.typedBuffer,indices:l.typedBuffer},x,T),C=this.view.renderSpatialReference,M=w(),E=[1,1,1];D(a,C,E,n)||this._dbg(3,"Unsupported coordinate system for IM overlay"),I(a,C,M,n);const R=g&&null!=p.materialId?g[p.materialId]:null,V=this._createComponentMaterialInitParameters(R,b);V.baseColorTexture||this._dbg(3,"No colour texture 1");const U=this._collection.createObject({toMapSpace:O(M[0],M[1],E[0],E[1]),transform:new ye(a,v),obb:f,geometry:j,elevationAlignable:!1},V);i.push(U)}i.length>0&&d.setHalfSize(h[0],h[1],h[2]);const{fullExtent:x}=this.layer;return x?.hasZ&&x.zmax&&x.zmin&&(b.minElevation=Math.max(b.minElevation,x.zmin),b.maxElevation=Math.min(b.maxElevation,x.zmax)),{tileObb:d,componentObjects:i,elevationRange:b}}catch(g){throw i.forEach(e=>this._collection.destroyObject(e)),g}}_createComponentMaterialInitParameters(e,t){const i="Pbr"===(null!=e?e.lightingModel:"Unlit");let s=E,r=Ee,o=1,a=!1,n=2,l=j(0,0,0);const c=T(we),d=t.baseColorTexture,h=t.metallicRoughnessTexture,m=t.emissionTexture,u=t.occlusionTexture,p=t.normalTexture;return e&&(s=M(e.baseColorFactor),r=e.alphaCutoff??Ee,i&&(v(c,e.metallicFactor,e.roughnessFactor,0),e.emissiveFactor&&(l=e.emissiveFactor)),o=oe[e.alphaMode],a=e.isDoubleSided,n=ae[e.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:s,textureAlphaCutoff:r,mrrFactors:c,baseColorTexture:d,metallicRoughnessTexture:h,normalTexture:p,occlusionTexture:u,emissionTexture:m,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:o,doubleSided:a,cullFace:n,isGround:this.layer.replacesTerrain,emissiveBaseColor:l,usePBR:i,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=Ie(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1,a=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),a||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Ie(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=s.isVisible;this._visibleObjects.delete(s),s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),this._intersectionHandler.removeTile(s),e&&(this._visibleGeometryChanged(),a||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(Ie(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),a&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=i.get(s)??this._createTexture(e,t,i);return r?new ge(this._stage.renderView.textures,r.id):null}_createTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,o=!!s.mipCount||r>1,a=ne[e.wrapMode??"None"];let n=s.alpha?6408:6407;const l=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let c=null,d=null,h=null;switch(s.format){case"Raw":"R8"===s.pixelFormat?(c=l,n=6403,d=""):"Rgb8"===s.pixelFormat?(c=l,n=6407,d=""):"Rgba8"===s.pixelFormat&&(c=l,n=6408,d="");break;case"Dxt1":c=l,n=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,n=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,n=6407,d="image/ktx2";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,t=new _e(c,{mipmap:o,maxAnisotropy:r,encoding:d,wrap:a,pixelFormat:n,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(t),i.set(s,t),t}return null}getBufferViews(e,t){let i,s,r,o,a;for(let l=0;l<e.atrbs.length;l++){const a=e.atrbs[l],{view:c}=a,d=void 0,h=c.byteOffset+c.byteCount;try{switch(a.sem){case"Position":3!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+c+")"):i=new G(t,c.byteOffset,d,h);break;case"Normal":if(3!==c.ncomp||"F32"!==c.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+c+")");else{const e=new G(t,c.byteOffset,d,h);o=new Uint32Array(e.count),ve(e.typedBuffer,new Int16Array(o.buffer,o.byteOffset,2*o.length))}break;case"TexCoord":2!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+c+")"):void 0===r&&(r=new N(t,c.byteOffset,d,h).typedBuffer);break;case"Color":4===c.ncomp?("F32"===c.type&&(s=new k(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new A(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new F(t,c.byteOffset,d,h))):3===c.ncomp&&("F32"===c.type&&(s=new G(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new B(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new z(t,c.byteOffset,d,h))),null==s&&this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+c+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+a.sem+"). Skipping vertex attribute.")}}catch(n){this._dbg(2,"Error Creating buffer ("+n+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":a=new q(t,i.byteOffset,s,r);break;case"U32":a=new W(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==a&&null!=i){const e=i.count;a=a=e<65535?new q(new Uint16Array(e).buffer):new W(new Uint32Array(e).buffer);for(let t=0;t<e;t++)a.set(t,t)}return{positionView:i,colorView:s,texCoord0Data:r,indicesView:a,normalsData:o}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([c()],Ve.prototype,"fullOpacity",null),e([c({readOnly:!0})],Ve.prototype,"ready",null),e([c({type:[$]})],Ve.prototype,"_modifications",void 0),e([c()],Ve.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],Ve.prototype,"layer",void 0),e([c({readOnly:!0})],Ve.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],Ve.prototype,"_collection",null),e([c()],Ve.prototype,"elevationOffset",null),e([c({readOnly:!0})],Ve.prototype,"visibleElevationRange",null),Ve=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ve);const Ue=Ve;class He{constructor(e,t,i,s,r,o,a,n,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=a,this.stableNodeId=n,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=w();a?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=a?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const m=a?.halfSize;this._obbShortestHalfsize=m?Math.min(m[0],m[1],m[2]):0,this._mbsCenter=a?T(a.center):C}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:s,_obbCenterZ:r}=this,o=i-e[0],a=s-e[1],n=r-e[2],l=o*t[0]+a*t[1]+n*t[2];return o*o+a*a+n*n-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const a=this._obbCenterY-i[1];if(a>r)return!1;const n=this._obbCenterZ-i[2];if(n>r)return!1;const l=o*o+a*a+n*n;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;return Math.sqrt(l)+t<=s||(this.obb?.intersectSphere(e)??!0)}}function Se(e){return Math.round(e/1048.576)/1e3}function De(e){return new ue(e.center,e.halfSize,f(...e.quaternion))}function Ie(e){return`${e}`}const Pe=new Array;class Le{constructor(e,t,i,s,r,o){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=s,this.occlusionTexture=r,this.normalTexture=o}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}function ke(e){return null!=e.data&&("string"==typeof e.desc&&(e.desc=JSON.parse(e.desc)),null!=e.desc)}export{Ue as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{clone as e}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{clone as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BufferViewUint16 as n,BufferViewUint32 as o,BufferViewVec3f as i,BufferViewVec3u8 as r,BufferViewVec3u16 as a,BufferViewVec4f as s,BufferViewVec4u8 as f,BufferViewVec4u16 as u}from"../../../geometry/support/buffer/BufferView.js";import{processTiles3DVertices as l}from"./support/IntegratedMesh3DTilesVertexProcessing.js";function c(){}function d(e){const{colorData:t,colorElementCount:n}=e;if(null==t||0===n)return;const o=t.byteOffset,l=o+t.byteLength;return 3===n?t instanceof Float32Array?new i(t.buffer,o,void 0,l):t instanceof Uint8Array?new r(t.buffer,o,void 0,l):new a(t.buffer,o,void 0,l):t instanceof Float32Array?new s(t.buffer,o,void 0,l):t instanceof Uint8Array?new f(t.buffer,o,void 0,l):new u(t.buffer,o,void 0,l)}function b(e){return e.map((e,t)=>{const{indicesData:r}=e,a=e.positionData.byteOffset,s=a+e.positionData.byteLength,f=e.positionStride*Float32Array.BYTES_PER_ELEMENT,u=r.byteOffset,l=u+r.byteLength;return{componentIndex:t,positionView:new i(e.positionData.buffer,a,f,s),indicesView:r instanceof Uint16Array?new n(r.buffer,u,void 0,l):new o(r.buffer,u,void 0,l),texCoord0Data:e.texCoord0Data??void 0,colorView:d(e),normalsData:e.normalsData??void 0}})}function p(e,t){return e.map(e=>({positionData:t?e.positionView.typedBuffer:null,interleavedVertexData:e.interleavedVertexData,renderIndices:e.indices===e.indicesView.typedBuffer?null:e.indices}))}function m(e){const t=[];for(const n of e)null!=n.positionData&&t.push(n.positionData.buffer),t.push(n.interleavedVertexData),null!=n.renderIndices&&t.push(n.renderIndices.buffer);return t}async function v(n){const o={center:t(n.tileObbCenter),quaternionConjugate:e(n.tileObbQuaternionConjugate)},{vertexProcessingOutputs:i,obbHalfSizeAccumulator:r,elevationRange:a}=l(b(n.inputs),n.origin,n.ellipsoidRadius,n.isGlobal,n.ecefRotation,o,n.imVertexNormals),s=p(i,n.isGlobal),f=m(s);return{result:{outputs:s,obbHalfSizeAccumulator:t(r),minElevation:a.minElevation,maxElevation:a.maxElevation},transferList:f}}function y(e){}export{y as destroyContext,c as initialize,v as processVertices};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{clone as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{WorkerHandle as t}from"../../../core/workers/WorkerHandle.js";import{BufferViewVec3f as o}from"../../../geometry/support/buffer/BufferView.js";import{ElevationRange as r}from"../support/ElevationRange.js";import{createVertexBufferLayout as i,VertexBufferLayoutCreationParameters as n}from"../webgl-engine/collections/Component/SourceGeometry.js";function a(e){const t=[];for(const o of e.inputs)t.push(o.positionData.buffer,o.indicesData.buffer),null!=o.texCoord0Data&&t.push(o.texCoord0Data.buffer),null!=o.colorData&&t.push(o.colorData.buffer),null!=o.normalsData&&t.push(o.normalsData.buffer);return t}function s(e,t,o,r,i,n,a){return{inputs:e.map(e=>({positionData:e.positionView.typedBuffer.slice(),positionStride:e.positionView.typedBufferStride,indicesData:e.indicesView.typedBuffer.slice(),texCoord0Data:null!=e.texCoord0Data?e.texCoord0Data.slice():null,colorData:null!=e.colorView?e.colorView.typedBuffer.slice():null,colorElementCount:3===e.colorView?.elementCount||4===e.colorView?.elementCount?e.colorView.elementCount:0,normalsData:null!=e.normalsData?e.normalsData.slice():null})),origin:t,ellipsoidRadius:o,isGlobal:r,ecefRotation:i,tileObbCenter:n.center,tileObbQuaternionConjugate:n.quaternionConjugate,imVertexNormals:a}}function l(e,t,r){return e.outputs.map((e,a)=>{const s=t[a],l=null==e.positionData?s.positionView:new o(e.positionData.buffer,e.positionData.byteOffset,s.positionView.typedBufferStride*Float32Array.BYTES_PER_ELEMENT,e.positionData.byteOffset+e.positionData.byteLength),u=s.indicesView,c=null!=s.texCoord0Data?1:0,p=i(new n(null!=s.colorView,null!=s.normalsData||r,c));return{componentIndex:s.componentIndex,positionView:l,indicesView:u,layout:p,textureCoordinateType:c,interleavedVertexData:e.interleavedVertexData,indices:e.renderIndices??s.indicesView.typedBuffer}})}class u extends t{constructor(e){super("IntegratedMesh3DTilesLayerWorker","processVertices",{processVertices:e=>a(e)},e,{hasInitialize:!0})}processVertices(e){return this.invoke(e)}async processTiles3DVertices(t,o,i,n,a,u,c){const p=s(t,o,i,n,a,u,c),f=await this.processVertices(p);return{vertexProcessingOutputs:l(f,t,c),obbHalfSizeAccumulator:e(f.obbHalfSizeAccumulator),elevationRange:new r(f.minElevation,f.maxElevation)}}destroyContext(e){return this.broadcast(e,"destroyContext")}async destroyContextAndSelf(e){await this.destroyContext(e),this.destroy()}}export{u as IntegratedMesh3DTilesLayerWorkerHandle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{destroyHandle as i,makeHandle as r}from"../../../core/handleUtils.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{destroyHandle as i,makeHandle as r}from"../../../core/handleUtils.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{property as o,subclass as l}from"../../../core/accessorSupport/decorators.js";import{canProjectWithoutEngine as a}from"../../../geometry/projectionUtils.js";import{LayerView3D as p}from"./LayerView3D.js";import{TiledLayerView3D as n}from"./TiledLayerView3D.js";import{SublayerPopupHighlightHelper3D as h}from"./support/SublayerPopupHighlightHelper3D.js";import m from"../../layers/LayerView.js";import{RefreshableLayerView as f}from"../../layers/RefreshableLayerView.js";import{isMapServiceLayerView as u}from"../../layers/support/MapServiceLayerViewHelper.js";let c=class extends(f(n(p(m)))){constructor(){super(...arguments),this.type="tile-3d"}get imageFormatIsOpaque(){return"jpg"===this.layer.tileInfo.format}get hasMixedImageFormats(){return"mixed"===this.layer.tileInfo.format}get tileInfo(){return this.layer.tileInfo}initialize(){if("web-tile"===this.layer.type){const e=this.layer.fullExtent?.spatialReference,i=this.layer.tileInfo?.spatialReference;if(null==e||null==i||!a(e,i)){const e="defaults"===this.layer.originOf("fullExtent")||null==this.layer.fullExtent?"SceneView requires fullExtent to be specified by the user on WebTileLayer":"SceneView requires fullExtent to be specified in the same spatial reference as tileInfo on WebTileLayer";this.addResolvingPromise(Promise.reject(new t("layerview:incompatible-fullextent",e)))}}if(u(this,this.layer)){const e=new h({view:this.view,layerView:this,updatingHandles:this._updatingHandles});this._popupHighlightHelper=e,this.addHandles(i(e))}this._addTilingSchemeMatchPromise()}async fetchTile([e,t,i],r){const o=await this.layer.fetchImageBitmapTile(e,t,i,{...r,allowDeriveTypeFromData:!0,imageOrientation:"flipY"});return s(r),o}async fetchPopupFeaturesAtLocation(e,t){return this._popupHighlightHelper?.fetchPopupFeaturesAtLocation(e,t)??[]}highlight(e,t){return this._popupHighlightHelper?.highlight(e,t)??r()}async doRefresh(){this.suspended||this.emit("data-changed")}};e([o()],c.prototype,"imageFormatIsOpaque",null),e([o()],c.prototype,"hasMixedImageFormats",null),e([o()],c.prototype,"layer",void 0),e([o()],c.prototype,"tileInfo",null),c=e([l("esri.views.3d.layers.TileLayerView3D")],c);const y=c;export{y as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Collection.js";import i from"../../../core/Logger.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Collection.js";import i from"../../../core/Logger.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{whenOnce as s}from"../../../core/reactiveUtils.js";import{property as o,subclass as l}from"../../../core/accessorSupport/decorators.js";import{getTileMaxtrixSetFromActiveLayer as a}from"../../../layers/support/layerUtils.js";import{LayerView3D as n}from"./LayerView3D.js";import{TiledLayerView3D as h}from"./TiledLayerView3D.js";import m from"../../layers/LayerView.js";import{RefreshableLayerView as f}from"../../layers/RefreshableLayerView.js";let d=class extends(f(h(n(m)))){constructor(){super(...arguments),this.type="wmts-3d"}initialize(){this._getCompatibleTileInfoMatrixSet(e=>this._getTileInfoSupportError(e.tileInfo,e.fullExtent));const e=s(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{const e=this._getCompatibleTileInfoMatrixSet(e=>this._getTileInfoError(e.tileInfo,e.fullExtent));null!=e&&(null!==e.id&&this.layer.activeLayer.tileMatrixSetId!==e.id&&(this.layer.activeLayer.tileMatrixSetId=e.id),e.tileInfo&&(this.tileInfo=e.tileInfo),this.layer.fullExtent=e.fullExtent)});this.addResolvingPromise(e),this.when(()=>this._postInitialize())}refresh(){this.emit("data-changed")}canResume(){if(!super.canResume())return!1;const e=this.layer.activeLayer.tileMatrixSet;return null!=e&&!this._getTileInfoError(e.tileInfo,e.fullExtent)}async fetchTile([e,t,i],s){const o=await this.layer.fetchImageBitmapTile(e,t,i,{...s,allowDeriveTypeFromData:!0,imageOrientation:"flipY"});return r(s),o}async doRefresh(){this.suspended||this.emit("data-changed")}_postInitialize(){this._updatingHandles.add(()=>this.layer?.activeLayer?.styleId,()=>this.refresh()),this._updatingHandles.add(()=>this.layer?.activeLayer,e=>{const t=this._getCompatibleTileInfoMatrixSet(e=>this._getTileInfoError(e.tileInfo,e.fullExtent),!0);t&&null!=t.id&&e.tileMatrixSetId!==t.id&&(this.layer.activeLayer.tileMatrixSetId=t.id),this.notifyChange("suspended"),this.canResume()&&this.refresh()})}_getCompatibleTileInfoMatrixSet(e,r=!1){const s=a(this.layer);if(null!=s){if(t.isCollection(s)){const t=s.find(t=>{const s=e(t);return null!=s&&(r?i.getLogger(this).error("The selected tile matrix set is not compatible with the view",s):this.addResolvingPromise(Promise.reject(s))),null==s});return t}const o=e(s);return null!=o&&(r?i.getLogger(this).error("The selected tile matrix set is not compatible with the view",o):this.addResolvingPromise(Promise.reject(o))),s}return null}_getTileInfoError(e,t){return this._getTileInfoSupportError(e,t)||this._getTileInfoCompatibilityError(e,this.view.basemapTerrain.tilingScheme)}};e([o()],d.prototype,"layer",void 0),e([o()],d.prototype,"suspended",void 0),e([o()],d.prototype,"tileInfo",void 0),d=e([l("esri.views.3d.layers.WMTSLayerView3D")],d);const p=d;export{p as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import"../../../../core/has.js";import"../../../../core/Logger.js";import{trackAccess as t}from"../../../../core/accessorSupport/tracking.js";import{SimpleObservable as n}from"../../../../core/accessorSupport/tracking/SimpleObservable.js";import{e}from"../../../../chunks/earcut.js";import{loadLibtessF64 as o,isLibtessF64Loaded as s,triangulateIndexedF64 as i}from"../../../../geometry/libtess.js";import{isClockwise as r}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as u,doubleSubArray as
|
|
2
|
+
import"../../../../core/has.js";import"../../../../core/Logger.js";import{trackAccess as t}from"../../../../core/accessorSupport/tracking.js";import{SimpleObservable as n}from"../../../../core/accessorSupport/tracking/SimpleObservable.js";import{e}from"../../../../chunks/earcut.js";import{loadLibtessF64 as o,isLibtessF64Loaded as s,triangulateIndexedF64 as i}from"../../../../geometry/libtess.js";import{isClockwise as r}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as u,doubleSubArray as c}from"../../../../geometry/support/DoubleArray.js";import{compactMeshIndices as l,newIndexArray as h}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as g}from"../../../../geometry/support/polygonUtils.js";const f=1e-5,p={method:"auto",projectionAxis:void 0,outlines:void 0};function d(t,n){const{hasZ:e,ccwRingsAsHoles:o,spatialReference:s}=n,i=n.axis??a(t,e,s),r=t.length,l=[],h=[],g=[],f=t.reduce((t,n)=>t+n.length,0);let p=0;const d=u(3*f);let x=0;const y=o&&t[0]&&m(t[0],e,i);for(let u=r-1;u>=0;u--){const n=t[u],s=S(n,e);if(s<3){s>1&&(g.push({index:x,count:n.length}),x=B(n,d,x,n.length,e,y));continue}const r=!!o&&m(n,e,i);if(y?!r:r)l[p++]=n;else{let t=n.length;for(let n=0;n<p;++n)t+=l[n].length;const o={index:x,pathLengths:new Array(p+1),count:t,holeIndices:new Array(p)};o.pathLengths[0]=n.length,n.length>0&&g.push({index:x,count:n.length}),x=B(n,d,x,n.length,e,y);for(let n=0;n<p;++n){const t=l[n];o.holeIndices[n]=x,o.pathLengths[n+1]=t.length,t.length>0&&g.push({index:x,count:t.length}),x=B(t,d,x,t.length,e,y)}p=0,o.count>0&&h.push(o)}}return{positions:3*x===d.length?d:c(d,0,3*x),polygons:h,outlines:g}}function a(t,n,e){if(!n)return 2;const o=t.map(t=>{const o=S(t,n);return o<3?2:g(t,o,e)}),s=o[0];return o.every(t=>t===s)?s:2}function m(t,n,e){if(!n)return!r(t);if(t.length<3)return!1;switch(e){case 0:return!r(t,1,2);case 1:return!r(t,0,2);case 2:return!r(t,0,1)}}const x=new n;function y(n,e){const o=v(n,e);if(o.succeeded)return o;return"libtess-not-loaded"===o.message?(t(x),j()):o}async function j(){try{await o(),x.notify()}catch(t){throw t}}function v(t,n){const e={method:n?.method??p.method,projectionAxis:n?.projectionAxis??p.projectionAxis,outlines:n?.outlines??p.outlines},{projectionAxis:o}=e,s=null!=o&&2!==o;s&&I(t.positions,o,2);const i=L(t,e);if(s){const n=i.succeeded?i.positions:null;null!=n&&n!==t.positions&&I(n,2,o),I(t.positions,2,o)}return i}function L(t,n){if("libtess"===n.method)return A(t,n);const o=Array();let s=0;for(const u of t.polygons){const i=R(t.positions,u),r=(u.holeIndices??[]).map(t=>t-u.index),c=r.length>0?r:null,l=e(i,c,3),h=e.deviation(i,r,3,l);if("auto"===n.method&&h>f)return A(t,n);for(let t=0;t<l.length;t++)o.push(l[t]+u.index);s=Math.max(s,h)}const{outlineIndexBuffer:i,outlineRingLengths:r}=null!=n.outlines?b(n.outlines,t.positions):{outlineIndexBuffer:void 0,outlineRingLengths:void 0};return{succeeded:!0,positions:t.positions,indices:l(o),outlineIndexBuffer:i,outlineRingLengths:r,vertexCount:t.positions.length/3,method:"earcut",deviation:s}}function A(t,n){if(!s())return C("libtess-not-loaded");const e=null!=n.outlines,o=w(t.polygons),{vertices:r,indices:u,outlineIndices:c,outlineRingLengths:l}=i(t.positions,o,3,e);return r.length%3!=0?C("positions-not-multiple-of-3"):{succeeded:!0,positions:r,indices:u,outlineIndexBuffer:e?c:void 0,outlineRingLengths:e?l:void 0,vertexCount:r.length/3,method:"libtess"}}function I(t,n,e){for(let o=0;o<t.length;o+=3){const s=t[o+n];t[o+n]=t[o+e],t[o+e]=s}}function b(t,n){const e=h(t.length);let o=0;for(let r=0;r<t.length;r++){const s=t[r],i=s.count;if(i<=0){e[r]=0;continue}const u=3*s.index,c=3*(s.index+i-1),l=i>1&&n[u]===n[c]&&n[u+1]===n[c+1]&&n[u+2]===n[c+2]?i-1:i,h=l>0?l+1:0;e[r]=h,o+=h}const s=h(o);let i=0;for(let r=0;r<t.length;r++){const n=e[r];if(0===n)continue;const o=t[r].index,u=n-1;for(let t=0;t<u;t++)s[i++]=o+t;s[i++]=o}return{outlineIndexBuffer:s,outlineRingLengths:e}}function w(t){const n=t.reduce((t,n)=>t+n.pathLengths.length,0),e=new Array(n);let o=0;for(let s=0;s<t.length;s++){const n=t[s].pathLengths;for(let t=0;t<n.length;t++)e[o++]=n[t]}return e}function R(t,{index:n,count:e}){return c(t,3*n,3*e)}function B(t,n,e,o,s,i){let r=i?t.length-1:0;const u=i?-1:1;e*=3;for(let c=0;c<o;++c){const o=t[r];n[e++]=o[0],n[e++]=o[1],n[e++]=s&&null!=o[2]?o[2]:0,r+=u}return e/3}function k(t,n){const e=t.length;if(e<2)return!1;const o=t[0],s=t[e-1];return o[0]===s[0]&&o[1]===s[1]&&(!n||o[2]===s[2])}function S(t,n){return k(t,n)?t.length-1:t.length}function C(t){return{succeeded:!1,message:t}}export{a as axisFromRings,m as isCounterClockwise,j as load,d as ringsToOutlinedTessellationInfo,v as tessellate,y as tessellateOrLoad};
|