@arcgis/core 5.2.0-next.36 → 5.2.0-next.37
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/02b043a3c5fa8bcb4c5b.js +1 -0
- package/assets/esri/core/workers/chunks/{acbc14395c31f6da509e.js → 03437a8ef35c200dbf17.js} +1 -1
- package/assets/esri/core/workers/chunks/034dd8ee5152a12412cd.js +1 -0
- package/assets/esri/core/workers/chunks/0a6e03263ab0906d8bcf.js +1 -0
- package/assets/esri/core/workers/chunks/0edd250159ec259601b3.js +1 -0
- package/assets/esri/core/workers/chunks/{401ee7fa500adad77db1.js → 1079914101d69a40b3eb.js} +1 -1
- package/assets/esri/core/workers/chunks/{c72121076e438ed28d60.js → 1599dc5309a4e60017ce.js} +2 -2
- package/assets/esri/core/workers/chunks/181e98399732f425305d.js +1 -0
- package/assets/esri/core/workers/chunks/{47d88e1b003c4519b7b6.js → 18f4b2099299942aaf97.js} +1 -1
- package/assets/esri/core/workers/chunks/196e7515a43bd0026f49.js +1 -0
- package/assets/esri/core/workers/chunks/1aa7496a7dc95aae11ac.js +1 -0
- package/assets/esri/core/workers/chunks/1d524690c4b66289bd20.js +1 -0
- package/assets/esri/core/workers/chunks/{f72f38e7609756a7f8ea.js → 20fa2c3d4360afa5e136.js} +1 -1
- package/assets/esri/core/workers/chunks/{03350a56f840cffe5459.js → 2757c4bf0280e27f3484.js} +1 -1
- package/assets/esri/core/workers/chunks/{93ceb74ac88ef460fe5f.js → 278409028bc5af45b507.js} +1 -1
- package/assets/esri/core/workers/chunks/{2c61bb25578f73ba49bc.js → 29a1d0659bbc5a039864.js} +1 -1
- package/assets/esri/core/workers/chunks/29df3f829006719b2680.js +1 -0
- package/assets/esri/core/workers/chunks/30cf84a47ebefd180bb7.js +1 -0
- package/assets/esri/core/workers/chunks/{71a593fa116770e58832.js → 37a95f097533bad1b338.js} +1 -1
- package/assets/esri/core/workers/chunks/{7335a762412bc8c15a2f.js → 37e823202424c11076cb.js} +1 -1
- package/assets/esri/core/workers/chunks/{ee446250a40e5d89bb5a.js → 3a76fffa2016c16d7989.js} +3 -3
- package/assets/esri/core/workers/chunks/{58ce4bcfb15f378b1b9f.js → 3d6d2b42ba2ad7086d5d.js} +1 -1
- package/assets/esri/core/workers/chunks/3ec91474658eae87b832.js +1 -0
- package/assets/esri/core/workers/chunks/448e0596005cba9a4225.js +1 -0
- package/assets/esri/core/workers/chunks/{f148666308071bdb185a.js → 45530a49fa1f09d1682e.js} +1 -1
- package/assets/esri/core/workers/chunks/{155940ef3d1888272d73.js → 459e89d1b94a3b204d20.js} +2 -2
- package/assets/esri/core/workers/chunks/{f71f5778e03f68f27482.js → 45b2e58051f42ebd236e.js} +1 -1
- package/assets/esri/core/workers/chunks/4611cf051c3c396fdf96.js +1 -0
- package/assets/esri/core/workers/chunks/{efaa1d05705f6b450e8f.js → 46e3d33e44e5398221e2.js} +1 -1
- package/assets/esri/core/workers/chunks/{866950e9ab96aebc6b32.js → 4a8201e09bc3ad5cc00b.js} +1 -1
- package/assets/esri/core/workers/chunks/{110135b0562a3b5708b9.js → 4abe820bbe4f7ffccc09.js} +1 -1
- package/assets/esri/core/workers/chunks/4ad86d6b1be07c97b6f6.js +1 -0
- package/assets/esri/core/workers/chunks/{20ffeb09bb30400de110.js → 4e28f49d0be20ea50fd7.js} +1 -1
- package/assets/esri/core/workers/chunks/4f25aac84d9eb10cac83.js +1 -0
- package/assets/esri/core/workers/chunks/{0197e459fdb04dfb28ef.js → 51838d55d8ec4ce70398.js} +1 -1
- package/assets/esri/core/workers/chunks/542d8a6c415098b9857c.js +1 -0
- package/assets/esri/core/workers/chunks/57abf838fcff0f0e2c5e.js +1 -0
- package/assets/esri/core/workers/chunks/57dd017fed2943d24e3d.js +1 -0
- package/assets/esri/core/workers/chunks/59801b2ccaaf4b394e02.js +1 -0
- package/assets/esri/core/workers/chunks/5a62c9f64db4fcae5e52.js +1 -0
- package/assets/esri/core/workers/chunks/{e84c13ac59e5381b77e2.js → 5aebecb5c2b3e7887127.js} +1 -1
- package/assets/esri/core/workers/chunks/{c19fe4f31e4ef84bbcf6.js → 5e68b74fd548c7cdba36.js} +1 -1
- package/assets/esri/core/workers/chunks/{9dcb2cbf89dcb7558432.js → 5f360492560ae07083a6.js} +1 -1
- package/assets/esri/core/workers/chunks/6022f43ebd58e21c737a.js +1 -0
- package/assets/esri/core/workers/chunks/62b137a795e487fa06a1.js +1 -0
- package/assets/esri/core/workers/chunks/{007485862ce95928717a.js → 632de34ebd2f44b4423d.js} +1 -1
- package/assets/esri/core/workers/chunks/{1ad5fcae6d6a9801cf58.js → 63ca17f569407c89bde1.js} +2 -2
- package/assets/esri/core/workers/chunks/6896a6dd36fa91a27151.js +1 -0
- package/assets/esri/core/workers/chunks/{e6263e1983e703befe48.js → 68bc674affe2f7269c40.js} +1 -1
- package/assets/esri/core/workers/chunks/{759686b896f51f0fe6a9.js → 6a51499c6623ddce5f00.js} +1 -1
- package/assets/esri/core/workers/chunks/6cdf1db30793133294dd.js +1 -0
- package/assets/esri/core/workers/chunks/{b0e4af49fc968b0a910f.js → 6ff6783f89ecd3a5e752.js} +1 -1
- package/assets/esri/core/workers/chunks/{857532de88f21e8c3466.js → 70763c7b68d8abe8d5fe.js} +1 -1
- package/assets/esri/core/workers/chunks/{e67a9f9298d63026e7f6.js → 716b1f073e3cd807abd3.js} +1 -1
- package/assets/esri/core/workers/chunks/71a3f05cb86ae2920f8d.js +1 -0
- package/assets/esri/core/workers/chunks/723bb56de2324b41df4e.js +1 -0
- package/assets/esri/core/workers/chunks/73f61107cb7e6d30bf03.js +1 -0
- package/assets/esri/core/workers/chunks/752c34cee981862add89.js +1 -0
- package/assets/esri/core/workers/chunks/760dfd585b6c2c1937ce.js +1 -0
- package/assets/esri/core/workers/chunks/{595401947e74a0a67144.js → 76449e50222111ba0eb1.js} +1 -1
- package/assets/esri/core/workers/chunks/76bed5497f42f23a27ed.js +1 -0
- package/assets/esri/core/workers/chunks/832ecc1f7d45774c4726.js +1 -0
- package/assets/esri/core/workers/chunks/860a0f9d20f53db1caf4.js +1 -0
- package/assets/esri/core/workers/chunks/867e39bb444947c93586.js +1 -0
- package/assets/esri/core/workers/chunks/8a8b7ac6693bdfbebf07.js +1 -0
- package/assets/esri/core/workers/chunks/8fce15ce4cfdccf407f3.js +1 -0
- package/assets/esri/core/workers/chunks/{5260f623438bd84f2caa.js → 937cf55b3b9d324eea73.js} +1 -1
- package/assets/esri/core/workers/chunks/93df864c2e829f0fd5ce.js +1 -0
- package/assets/esri/core/workers/chunks/{7b5e628ea3d4a51f1c4e.js → 966d002acec8c72be56a.js} +1 -1
- package/assets/esri/core/workers/chunks/{367a3031abbeff0c0090.js → 9aef0b87f471626abd66.js} +1 -1
- package/assets/esri/core/workers/chunks/{f1d211904d5a1de93cb3.js → 9ba9a3705623679bc305.js} +1 -1
- package/assets/esri/core/workers/chunks/{aec82b94787821153d2b.js → a188d0767825d322f96d.js} +1 -1
- package/assets/esri/core/workers/chunks/a638de0102c3990403d1.js +1 -0
- package/assets/esri/core/workers/chunks/b09935d0105d50a0971b.js +1 -0
- package/assets/esri/core/workers/chunks/b2c0262c4a76b8a86200.js +1 -0
- package/assets/esri/core/workers/chunks/{599bd80379423c99799d.js → b4323e69e624c6b51754.js} +1 -1
- package/assets/esri/core/workers/chunks/b5141f240ca79729686d.js +1 -0
- package/assets/esri/core/workers/chunks/b549a4d4b1a34bee8beb.js +1 -0
- package/assets/esri/core/workers/chunks/bb89b6fd93513c61b2d3.js +1 -0
- package/assets/esri/core/workers/chunks/{3bd32387af52fa48d747.js → bc553ecc8cbcc1b02717.js} +1 -1
- package/assets/esri/core/workers/chunks/bcba02f61cf0abcb5600.js +1 -0
- package/assets/esri/core/workers/chunks/{f63e7b01c70352538b1e.js → bd0f488e228a75fbefb3.js} +2 -2
- package/assets/esri/core/workers/chunks/c48dfda8dcb9551606fb.js +1 -0
- package/assets/esri/core/workers/chunks/c4e44fde4bc4ff89e2bc.js +1 -0
- package/assets/esri/core/workers/chunks/c93a68618674b38b932e.js +1 -0
- package/assets/esri/core/workers/chunks/d2745886ba5a86fd5c4c.js +680 -0
- package/assets/esri/core/workers/chunks/d4c341b15d9244276fb9.js +1 -0
- package/assets/esri/core/workers/chunks/d5faab9799891e5da5a8.js +1 -0
- package/assets/esri/core/workers/chunks/d811924acc9c0be95bba.js +1 -0
- package/assets/esri/core/workers/chunks/{4b96aa2dc5b88846bb53.js → e0a4d0288abd334b0673.js} +1 -1
- package/assets/esri/core/workers/chunks/{b22a1c98271c2e4d8808.js → e1ddb8e4977b317fd40c.js} +1 -1
- package/assets/esri/core/workers/chunks/e961c6140c39921816a8.js +1 -0
- package/assets/esri/core/workers/chunks/eb7daa0f6610983ff8db.js +1 -0
- package/assets/esri/core/workers/chunks/eb842cf470ce28a73187.js +1 -0
- package/assets/esri/core/workers/chunks/ed1d4ebf487c7dcd5c33.js +1 -0
- package/assets/esri/core/workers/chunks/f565e203d8fed2672112.js +1 -0
- package/assets/esri/core/workers/chunks/f80cadcc2a588da63b38.js +1 -0
- package/assets/esri/core/workers/chunks/f8bbb52b865a0a242140.js +1 -0
- package/assets/esri/core/workers/chunks/f9592bcdd9988199a7ea.js +1 -0
- package/assets/esri/core/workers/chunks/ff7e1eb2366d4301d288.js +1 -0
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/chunks/NavigationDepth.glsl.js +18 -0
- package/chunks/Path.glsl.js +20 -16
- package/config.js +1 -1
- package/core/accessorSupport/diffUtils.js +1 -1
- package/geometry/FlatGeometry.js +1 -1
- package/geometry/support/Indices.js +1 -1
- package/geometry/support/ShortArray.js +1 -1
- package/geometry/support/UintArray.js +1 -1
- package/geometry/support/meshUtils/geographicUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/mixins/PublishableLayer.js +1 -1
- package/layers/mixins/RefreshableLayer.js +1 -1
- package/layers/raster/functions/pixelUtils.js +1 -1
- package/layers/support/kustoUtils.js +1 -1
- package/package.json +1 -1
- package/popup/Feature.js +1 -1
- package/portal/support/resourceUtils.js +1 -1
- package/renderers/support/rasterTypeUtils.js +1 -1
- package/rest/query/operations/pbfFeatureSetUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/utils.js +1 -1
- package/tables/support/tablesUtils.js +1 -1
- package/views/2d/engine/flow/utils.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/AlignedVertexSpec.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/features/layerAdapters/labelingUtils.js +1 -1
- package/views/2d/layers/support/annodime/dimensionUtils.js +1 -1
- package/views/2d/layers/support/annodime/utils.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/Lyr3DWasm.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/i3s/PointCloudRendererUtil.js +1 -1
- package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
- package/views/3d/layers/support/lyr3dTypeConversions.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatAtlasPages.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +32 -16
- package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/calculateUVZShadowFromDepth.glsl.js +2 -2
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/NavigationDepthCache.js +2 -0
- package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
- package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
- package/views/3d/webgl-engine/materials/PathLayouts.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/NavigationDepth.glsl.js +2 -0
- package/views/3d/webgl-engine/shaders/NavigationDepthTechnique.js +2 -0
- package/views/3d/webgl-engine/shaders/oitResolution.glsl.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/support/euclideanLengthMeasurementUtils.js +1 -1
- package/views/support/selectionUtils.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/VertexAttributeLayouts.js +1 -1
- package/webscene/spec-certification/utils.js +1 -1
- package/widgets/Editor/legacy/workflowUtils.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/errors.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/utils.js +1 -1
- package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicViewer/constants.js +1 -1
- package/widgets/PanoramicViewer/support/importUtils.js +1 -1
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/support/dateUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0a2f08298a3c932614f2.js +0 -1
- package/assets/esri/core/workers/chunks/0df978697328b6453c94.js +0 -1
- package/assets/esri/core/workers/chunks/168c15cf462f9abcbdd2.js +0 -1
- package/assets/esri/core/workers/chunks/22c447fcc9a28afeb6e3.js +0 -1
- package/assets/esri/core/workers/chunks/24aa98cb2021ddd789ce.js +0 -1
- package/assets/esri/core/workers/chunks/2509da565e5a2b43ac7f.js +0 -1
- package/assets/esri/core/workers/chunks/256cc116e3be4feee593.js +0 -1
- package/assets/esri/core/workers/chunks/2bb3494659609594c4ca.js +0 -1
- package/assets/esri/core/workers/chunks/2c017eae434254610c8e.js +0 -1
- package/assets/esri/core/workers/chunks/303e723e829ea7088d43.js +0 -1
- package/assets/esri/core/workers/chunks/368db1420b8520beae05.js +0 -1
- package/assets/esri/core/workers/chunks/38a6a7c56c592f336a12.js +0 -1
- package/assets/esri/core/workers/chunks/39ff5b2a05a90e1cb214.js +0 -1
- package/assets/esri/core/workers/chunks/3b914ca36e7e2b00cfe6.js +0 -1
- package/assets/esri/core/workers/chunks/3e8fa2a7a36881234479.js +0 -1
- package/assets/esri/core/workers/chunks/451331f69d21c61ec93b.js +0 -1
- package/assets/esri/core/workers/chunks/4656a4bf430d7eed1465.js +0 -1
- package/assets/esri/core/workers/chunks/472ec242cd3070e6acfe.js +0 -1
- package/assets/esri/core/workers/chunks/51d7145f748b4865de7f.js +0 -1
- package/assets/esri/core/workers/chunks/54f54623532f633dc0e2.js +0 -1
- package/assets/esri/core/workers/chunks/570a4725b2a4a19c5148.js +0 -1
- package/assets/esri/core/workers/chunks/586ca90e46f5cbdfeece.js +0 -1
- package/assets/esri/core/workers/chunks/59c22bab85f9cdbb9948.js +0 -1
- package/assets/esri/core/workers/chunks/5dfeefee96659832398a.js +0 -1
- package/assets/esri/core/workers/chunks/6c746ac4bd2e57b8cb41.js +0 -1
- package/assets/esri/core/workers/chunks/6d72a1bdc2664df62c4c.js +0 -1
- package/assets/esri/core/workers/chunks/7085b4c655a19694da04.js +0 -1
- package/assets/esri/core/workers/chunks/777b16b76db406c99c69.js +0 -1
- package/assets/esri/core/workers/chunks/818a481ce579f519de1c.js +0 -1
- package/assets/esri/core/workers/chunks/85a280ee915010a8da3c.js +0 -1
- package/assets/esri/core/workers/chunks/86731e276b31453bc235.js +0 -1
- package/assets/esri/core/workers/chunks/87b86375f8557418dbe6.js +0 -1
- package/assets/esri/core/workers/chunks/8817d25c7f4cf0e6c6bd.js +0 -1
- package/assets/esri/core/workers/chunks/8a9b2efa0603e9fa4e8b.js +0 -1
- package/assets/esri/core/workers/chunks/8aa5bbf9a9b09815725a.js +0 -1
- package/assets/esri/core/workers/chunks/8b68a69ab8fb1679e7b2.js +0 -1
- package/assets/esri/core/workers/chunks/98685bd149dee1d6dc99.js +0 -1
- package/assets/esri/core/workers/chunks/9de673a04c70bd47047e.js +0 -1
- package/assets/esri/core/workers/chunks/9de9cec5c644bc452294.js +0 -1
- package/assets/esri/core/workers/chunks/9fb0431b0628dcb53004.js +0 -680
- package/assets/esri/core/workers/chunks/a2a688dd2ed4565e01ff.js +0 -1
- package/assets/esri/core/workers/chunks/a3ae7c41832c7a8b0570.js +0 -1
- package/assets/esri/core/workers/chunks/a3e86830460e52706a4d.js +0 -1
- package/assets/esri/core/workers/chunks/a58b8903ae17acf117d6.js +0 -1
- package/assets/esri/core/workers/chunks/a99ce2f12c8204ee542a.js +0 -1
- package/assets/esri/core/workers/chunks/ab3d1c00ef514b61ce0b.js +0 -1
- package/assets/esri/core/workers/chunks/ae5363956b4467208e04.js +0 -1
- package/assets/esri/core/workers/chunks/b24b7411a73d1da87c30.js +0 -1
- package/assets/esri/core/workers/chunks/b97b83159fec34f383af.js +0 -1
- package/assets/esri/core/workers/chunks/bec660ee2e7828f965e2.js +0 -1
- package/assets/esri/core/workers/chunks/c7316fd2bdb7ac9eada3.js +0 -1
- package/assets/esri/core/workers/chunks/ca7d4d76a6bf5a3046cd.js +0 -1
- package/assets/esri/core/workers/chunks/cffef41791f0cfa6c26c.js +0 -1
- package/assets/esri/core/workers/chunks/d26b1a9f47b4b2744c89.js +0 -1
- package/assets/esri/core/workers/chunks/d4a96f0402172787823a.js +0 -1
- package/assets/esri/core/workers/chunks/d9fcc63df008f687848a.js +0 -1
- package/assets/esri/core/workers/chunks/e3a4695c31d3f9d55213.js +0 -1
- package/assets/esri/core/workers/chunks/e65d291bab13f7f5323b.js +0 -1
- package/assets/esri/core/workers/chunks/eeee7421f64a52074ff4.js +0 -1
- package/assets/esri/core/workers/chunks/eef7e0bee19c4258ba55.js +0 -1
- package/assets/esri/core/workers/chunks/efaf998d18479a0380ae.js +0 -1
- package/assets/esri/core/workers/chunks/f0573db9a3d3e1499a7e.js +0 -1
- package/assets/esri/core/workers/chunks/f07722efd7fa2b75d4dd.js +0 -1
- package/assets/esri/core/workers/chunks/f137e544076482e348ad.js +0 -1
- package/assets/esri/core/workers/chunks/fd53ef66176ae164e221.js +0 -1
- package/assets/esri/core/workers/chunks/fd956a58787020d610af.js +0 -1
- package/rest/sharedTemplates/addSharedTemplates.js +0 -2
- package/support/featureFlags.js +0 -2
- package/views/2d/engine/webgl/ClippingInfo.js +0 -2
- package/views/2d/engine/webgl/Mesh2D.js +0 -2
- package/views/2d/engine/webgl/shaderGraph/GLSLShaderModule.js +0 -2
- package/views/2d/layers/features/ProcessorTileMessageQueue.js +0 -2
- package/views/3d/support/AsyncWorkerQueue.js +0 -2
- package/views/3d/webgl-engine/lib/PathGeometryData.js +0 -2
- package/widgets/BatchAttributeForm/templates/support/contingentValuesUtils.js +0 -2
- package/widgets/OrientedImageryViewer/components/NavigationAction.js +0 -2
- package/widgets/OrientedImageryViewer/components/NavigationActions.js +0 -2
- package/widgets/OrientedImageryViewer/support/NonPanoramicMediaCollection.js +0 -2
- package/widgets/PanoramicViewer/support/PanoramicMediaCollection.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Logger.js";import{disposeMaybe as t}from"../../core/maybe.js";import{BufferObject as r}from"./BufferObject.js";import{webglDebugEnabled as i}from"./checkWebGLError.js";import{ResourceType as s,ColorAttachment0 as n,PixelType as h,StencilAttachment as o,SizedDepthStencilFormat as c,DepthStencilAttachment as a,SizedDepthFormat as l,DepthAttachment as f}from"./enums.js";import{Renderbuffer as u}from"./Renderbuffer.js";import _ from"./Texture.js";const m=()=>e.getLogger("esri.views.webgl.FramebufferObject");class d{constructor(e,t,r){if(this._context=e,this._level=0,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,e.instanceCounter.increment(s.FramebufferObject,this),null!=t){const r=N(e,t);null!=r&&(this._colorAttachments.set(n,r),T(r)?this._validateTextureDescriptor(r.descriptor):this._validateRenderbufferDescriptor(r.descriptor)),this._validateColorAttachmentPoint(n)}if(null!=r)if(x(r))this._depthStencilTexture=T(r)?r:new _(e,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const t=g(r)?r:new u(e,r);this._depthStencilBuffer=t,this._validateRenderbufferDescriptor(t.descriptor)}}get glName(){return this._glName}get colorTexture(){const e=this._colorAttachments.get(n);return T(e)?e:null}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.width??0}get height(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.height??0}get usedMemory(){return[...this._colorAttachments].reduce((e,[t,r])=>e+r.usedMemory,this.depthStencil?.usedMemory??0)}get level(){return this._level}set level(e){this._level!==e&&(this._level=e,this._glName&&this._context.temporaryBindFramebuffer(this,()=>this._initializeAttachments()))}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(e){const t=this._colorAttachments.get(e);return t&&T(t)?t:null}get colorAttachments(){return Array.from(this._colorAttachments.keys())}attachColorTexture(e,t=n){if(!e)return;this._validateColorAttachmentPoint(t);const{descriptor:r}=e;this._validateTextureDescriptor(r),this.detachColorTexture(t)?.dispose(),this._colorAttachments.set(t,e),this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,t))}detachColorTexture(e=n){const t=this._colorAttachments.get(e);if(!t)return;const r=T(t);return this._glName&&this._context.temporaryBindFramebuffer(this,()=>{if(r)this._framebufferTexture2D(null,e);else{const t=this._context.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)}}),this._colorAttachments.delete(e),r?t:void 0}detachColorTextures(...e){if(0!==e.length){if(this._glName){const t=this._context.gl;this._context.temporaryBindFramebuffer(this,()=>{e.forEach(e=>{T(this._colorAttachments.get(e))?this._framebufferTexture2D(null,e):t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)})})}e.forEach(e=>this._colorAttachments.delete(e))}}setColorTextureTarget(e,t=n,r=0){const i=this._colorAttachments.get(t);i&&(35866===e?this._framebufferTextureLayer(i.glName,t,36160,r):this._framebufferTexture2D(i.glName,t,e,36160))}attachDepthStencil(e){if(e)switch(e.type){case 1:return this._attachDepthStencilTexture(e);case 2:return this._attachDepthStencilBuffer(e)}}_attachDepthStencilTexture(e){if(null==e)return;const{descriptor:t}=e,{pixelFormat:r,dataType:i}=t;34041===r||6402===r?34041!==r||i===h.UNSIGNED_INT_24_8?6402!==r||i===h.UNSIGNED_INT||i===h.UNSIGNED_SHORT?(this._validateTextureDescriptor(t),this._disposeDepthStencilAttachments(),this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,D(r))),this._depthStencilTexture?.dispose(),this._depthStencilTexture=e):console.error("Depth texture must have data type of UNSIGNED_INT or UNSIGNED_SHORT!"):console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"):console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!")}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._glName&&this._context.temporaryBindFramebuffer(this,()=>{this._framebufferTexture2D(null,D(e.descriptor.pixelFormat))}),this._depthStencilTexture=null,e}_attachDepthStencilBuffer(e){if(null==e)return;const t=e.descriptor;if(this._validateRenderbufferDescriptor(t),this._disposeDepthStencilAttachments(),this._glName){this._context.bindFramebuffer(this);const{gl:r}=this._context,i=this._getGLAttachmentPoint(t);r.framebufferRenderbuffer(36160,i,r.RENDERBUFFER,e.glName)}this._depthStencilBuffer=e}detachDepthStencilBuffer(){const e=this._depthStencilBuffer;if(e&&this._glName){const{_context:t}=this,r=t.boundFramebuffer;t.bindFramebuffer(this);const{gl:i}=t,s=this._getGLAttachmentPoint(e.descriptor);i.framebufferRenderbuffer(36160,s,i.RENDERBUFFER,null),t.bindFramebuffer(r)}return this._depthStencilBuffer=null,e}invalidateAttachments(e){const{_context:t}=this;t.temporaryBindFramebuffer(this,()=>t.gl.invalidateFramebuffer(36160,e),!0)}copyToTexture(e,t,r,i,s,n,h){(e<0||t<0||s<0||n<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const o=h.descriptor;3553!==h.descriptor.target&&console.error("Texture target must be TEXTURE_2D!"),(null==o?.width||null==o?.height||e+r>this.width||t+i>this.height||s+r>o.width||n+i>o.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const c=this._context,a=c.bindTexture(h,_.TEXTURE_UNIT_FOR_UPDATES);c.setActiveTexture(_.TEXTURE_UNIT_FOR_UPDATES),c.bindFramebuffer(this),c.gl.copyTexSubImage2D(3553,0,s,n,e,t,r,i),c.bindTexture(a,_.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,s,n,h){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),h||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,s,n,h)}async readPixelsAsync(e,t,i,s,n,h,o){const{gl:c}=this._context,a=r.createPixelPack(this._context,35041,o.byteLength);this._context.bindBuffer(a);const l=this._context.boundFramebuffer;this._context.bindFramebuffer(this),c.readPixels(e,t,i,s,n,h,0),this._context.unbindBuffer(35051),this._context.bindFramebuffer(l),await a.getSubDataAsync(o),a.dispose()}resize(e,t){if(this.width===e&&this.height===t)return;const r={width:e,height:t};if(F(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach(e=>e.resize(r.width,r.height)),this._depthStencilTexture?.resize(r.width,r.height),this._glName&&(F(r,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(r.width,r.height),i())){const{gl:e}=this._context;e.checkFramebufferStatus(36160)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}initializeAndBind(e=36160){const{gl:t}=this._context;this._glName?t.bindFramebuffer(e,this._glName):(this._glName&&t.deleteFramebuffer(this._glName),this._glName=t.createFramebuffer(),t.bindFramebuffer(e,this._glName),this._initializeAttachments(e))}_initializeAttachments(e=36160){const{gl:t}=this._context;if(this._colorAttachments.forEach((t,r)=>{if(T(t)){const i=A(t);35866===i?this._framebufferTextureLayer(t.glName,r,e):this._framebufferTexture2D(t.glName,r,i,e)}else if(g(t)){const i=this._context.gl;i.framebufferRenderbuffer(e,r,i.RENDERBUFFER,t.glName)}}),this._depthStencilBuffer){const r=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(e,r,t.RENDERBUFFER,this._depthStencilBuffer.glName)}else if(this._depthStencilTexture){const t=D(this._depthStencilTexture.descriptor.pixelFormat);this._framebufferTexture2D(this._depthStencilTexture.glName,t,A(this._depthStencilTexture),e)}if(i()){t.checkFramebufferStatus(e)!==t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}_framebufferTexture2D(e,t=n,r=3553,i=36160){this._context.gl.framebufferTexture2D(i,t,r,e,this._level)}_framebufferTextureLayer(e,t=n,r=36160,i=0){this._context.gl.framebufferTextureLayer(r,t,e,this._level,i)}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthStencilBuffer){if(this._glName){this._context.bindFramebuffer(this);const t=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(36160,t,e.RENDERBUFFER,null)}this._depthStencilBuffer=t(this._depthStencilBuffer)}this._depthStencilTexture&&(this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,D(this._depthStencilTexture.descriptor.pixelFormat))),this._depthStencilTexture=t(this._depthStencilTexture))}_validateTextureDescriptor(e){3553!==e.target&&34067!==e.target&&35866!==e.target&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),F(e,this._context.parameters.maxTextureSize),this._validateBufferDimensions(e)}_validateRenderbufferDescriptor(e){F(e,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(e)}_validateBufferDimensions(e){e.width<=0&&(e.width=this.width),e.height<=0&&(e.height=this.height),this.width>0&&this.height>0&&(this.width===e.width&&this.height===e.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(e){switch(e.internalFormat){case l.DEPTH_COMPONENT16:case l.DEPTH_COMPONENT24:case l.DEPTH_COMPONENT32F:return f;case c.DEPTH24_STENCIL8:case c.DEPTH32F_STENCIL8:return a;case 36168:return o;default:return n}}_validateColorAttachmentPoint(t){if(-1===d._MAX_COLOR_ATTACHMENTS){const{gl:e}=this._context;d._MAX_COLOR_ATTACHMENTS=e.getParameter(e.MAX_COLOR_ATTACHMENTS)}const r=t-n;r+1>d._MAX_COLOR_ATTACHMENTS&&e.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${r+1}. Implementation supports up to ${d._MAX_COLOR_ATTACHMENTS} color attachments`)}}class p extends d{constructor(e,t,r){super(e,t,r)}dispose(){const{_colorAttachments:e,_glName:t,_context:r}=this;if(r.instanceCounter.decrement(s.FramebufferObject,this),0===e.size&&!this._depthStencilBuffer&&!this._depthStencilTexture&&!t)return;const i=r.boundFramebuffer,n=Array.from(e.values());this.detachColorTextures(...e.keys()),n.forEach(e=>e.dispose()),this.detachDepthStencilBuffer()?.dispose(),this.detachDepthStencilTexture()?.dispose(),r.gl.deleteFramebuffer(this._glName),this._glName=null,r.bindFramebuffer(i===this?null:i)}}function T(e){return 1===E(e)}function g(e){return 2===E(e)}function x(e){return T(e)||b(e)}function b(e){return 0===E(e)}function S(e){return 3===E(e)||null!=e&&"samples"in e}function E(e){return null!=e&&"type"in e?e.type:null}function N(e,t){return T(t)||g(t)?t:b(t)?new _(e,t):S(t)?new u(e,t):null}function F(e,t){const r=Math.max(e.width,e.height);if(r>t){m().warnOnce(`Resizing FBO attachment size ${e.width}x${e.height} to device limit ${t}`);const i=t/r;return e.width=Math.round(e.width*i),e.height=Math.round(e.height*i),!1}return!0}function A(e){return 34067===e.descriptor.target?34069:35866===e.descriptor.target?35866:3553}function D(e){return 6402===e?f:a}export{p as DisposableFramebufferObject,d as FramebufferObject,F as ensureAttachmentMaxSize};
|
|
2
|
+
import e from"../../core/Logger.js";import{disposeMaybe as t}from"../../core/maybe.js";import{BufferObject as r}from"./BufferObject.js";import{webglDebugEnabled as i}from"./checkWebGLError.js";import{ResourceType as s,ColorAttachment0 as n,PixelType as h,StencilAttachment as o,SizedDepthStencilFormat as c,DepthStencilAttachment as a,SizedDepthFormat as l,DepthAttachment as f}from"./enums.js";import{Renderbuffer as u}from"./Renderbuffer.js";import _ from"./Texture.js";const m=()=>e.getLogger("esri.views.webgl.FramebufferObject");class d{constructor(e,t,r){if(this._context=e,this._level=0,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,e.instanceCounter.increment(s.FramebufferObject,this),null!=t){const r=N(e,t);null!=r&&(this._colorAttachments.set(n,r),T(r)?this._validateTextureDescriptor(r.descriptor):this._validateRenderbufferDescriptor(r.descriptor)),this._validateColorAttachmentPoint(n)}if(null!=r)if(x(r))this._depthStencilTexture=T(r)?r:new _(e,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const t=g(r)?r:new u(e,r);this._depthStencilBuffer=t,this._validateRenderbufferDescriptor(t.descriptor)}}get glName(){return this._glName}get colorTexture(){const e=this._colorAttachments.get(n);return T(e)?e:null}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.width??0}get height(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.height??0}get usedMemory(){return[...this._colorAttachments].reduce((e,[t,r])=>e+r.usedMemory,this.depthStencil?.usedMemory??0)}get level(){return this._level}set level(e){this._level!==e&&(this._level=e,this._glName&&this._context.temporaryBindFramebuffer(this,()=>this._initializeAttachments()))}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(e){const t=this._colorAttachments.get(e);return t&&T(t)?t:null}get colorAttachments(){return Array.from(this._colorAttachments.keys())}attachColorTexture(e,t=n){if(!e)return;this._validateColorAttachmentPoint(t);const{descriptor:r}=e;this._validateTextureDescriptor(r),this.detachColorTexture(t)?.dispose(),this._colorAttachments.set(t,e),this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,t))}detachColorTexture(e=n){const t=this._colorAttachments.get(e);if(!t)return;const r=T(t);return this._glName&&this._context.temporaryBindFramebuffer(this,()=>{if(r)this._framebufferTexture2D(null,e);else{const t=this._context.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)}}),this._colorAttachments.delete(e),r?t:void 0}detachColorTextures(...e){if(0!==e.length){if(this._glName){const t=this._context.gl;this._context.temporaryBindFramebuffer(this,()=>{e.forEach(e=>{T(this._colorAttachments.get(e))?this._framebufferTexture2D(null,e):t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)})})}e.forEach(e=>this._colorAttachments.delete(e))}}setColorTextureTarget(e,t=n,r=0){const i=this._colorAttachments.get(t);i&&(35866===e?this._framebufferTextureLayer(i.glName,t,36160,r):this._framebufferTexture2D(i.glName,t,e,36160))}attachDepthStencil(e){if(e)switch(e.type){case 1:return this._attachDepthStencilTexture(e);case 2:return this._attachDepthStencilBuffer(e)}}_attachDepthStencilTexture(e){if(null==e)return;const{descriptor:t}=e,{pixelFormat:r,dataType:i}=t;34041===r||6402===r?34041!==r||i===h.UNSIGNED_INT_24_8?6402!==r||i===h.UNSIGNED_INT||i===h.UNSIGNED_SHORT?(this._validateTextureDescriptor(t),this._disposeDepthStencilAttachments(),this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,D(r))),this._depthStencilTexture?.dispose(),this._depthStencilTexture=e):console.error("Depth texture must have data type of UNSIGNED_INT or UNSIGNED_SHORT!"):console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"):console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!")}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._glName&&this._context.temporaryBindFramebuffer(this,()=>{this._framebufferTexture2D(null,D(e.descriptor.pixelFormat))}),this._depthStencilTexture=null,e}_attachDepthStencilBuffer(e){if(null==e)return;const t=e.descriptor;if(this._validateRenderbufferDescriptor(t),this._disposeDepthStencilAttachments(),this._glName){this._context.bindFramebuffer(this);const{gl:r}=this._context,i=this._getGLAttachmentPoint(t);r.framebufferRenderbuffer(36160,i,r.RENDERBUFFER,e.glName)}this._depthStencilBuffer=e}detachDepthStencilBuffer(){const e=this._depthStencilBuffer;if(e&&this._glName){const{_context:t}=this,r=t.boundFramebuffer;t.bindFramebuffer(this);const{gl:i}=t,s=this._getGLAttachmentPoint(e.descriptor);i.framebufferRenderbuffer(36160,s,i.RENDERBUFFER,null),t.bindFramebuffer(r)}return this._depthStencilBuffer=null,e}invalidateAttachments(e){const{_context:t}=this;t.temporaryBindFramebuffer(this,()=>t.gl.invalidateFramebuffer(36160,e),!0)}copyToTexture(e,t,r,i,s,n,h){(e<0||t<0||s<0||n<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const o=h.descriptor;3553!==h.descriptor.target&&console.error("Texture target must be TEXTURE_2D!"),(null==o?.width||null==o?.height||e+r>this.width||t+i>this.height||s+r>o.width||n+i>o.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const c=this._context,a=c.bindTexture(h,_.TEXTURE_UNIT_FOR_UPDATES);c.setActiveTexture(_.TEXTURE_UNIT_FOR_UPDATES),c.bindFramebuffer(this),c.gl.copyTexSubImage2D(3553,0,s,n,e,t,r,i),c.bindTexture(a,_.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,s,n,h){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),h||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,s,n,h)}async readPixelsAsync(e,t,i,s,n,h,o,c){const{gl:a}=this._context,l=r.createPixelPack(this._context,35041,o.byteLength);this._context.bindBuffer(l);const f=this._context.boundFramebuffer;this._context.bindFramebuffer(this),a.readPixels(e,t,i,s,n,h,0),this._context.unbindBuffer(35051),this._context.bindFramebuffer(f);try{await l.getSubDataAsync(o,void 0,void 0,void 0,c)}finally{l.dispose()}}resize(e,t){if(this.width===e&&this.height===t)return;const r={width:e,height:t};if(F(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach(e=>e.resize(r.width,r.height)),this._depthStencilTexture?.resize(r.width,r.height),this._glName&&(F(r,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(r.width,r.height),i())){const{gl:e}=this._context;e.checkFramebufferStatus(36160)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}initializeAndBind(e=36160){const{gl:t}=this._context;this._glName?t.bindFramebuffer(e,this._glName):(this._glName&&t.deleteFramebuffer(this._glName),this._glName=t.createFramebuffer(),t.bindFramebuffer(e,this._glName),this._initializeAttachments(e))}_initializeAttachments(e=36160){const{gl:t}=this._context;if(this._colorAttachments.forEach((t,r)=>{if(T(t)){const i=A(t);35866===i?this._framebufferTextureLayer(t.glName,r,e):this._framebufferTexture2D(t.glName,r,i,e)}else if(g(t)){const i=this._context.gl;i.framebufferRenderbuffer(e,r,i.RENDERBUFFER,t.glName)}}),this._depthStencilBuffer){const r=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(e,r,t.RENDERBUFFER,this._depthStencilBuffer.glName)}else if(this._depthStencilTexture){const t=D(this._depthStencilTexture.descriptor.pixelFormat);this._framebufferTexture2D(this._depthStencilTexture.glName,t,A(this._depthStencilTexture),e)}if(i()){t.checkFramebufferStatus(e)!==t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}_framebufferTexture2D(e,t=n,r=3553,i=36160){this._context.gl.framebufferTexture2D(i,t,r,e,this._level)}_framebufferTextureLayer(e,t=n,r=36160,i=0){this._context.gl.framebufferTextureLayer(r,t,e,this._level,i)}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthStencilBuffer){if(this._glName){this._context.bindFramebuffer(this);const t=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(36160,t,e.RENDERBUFFER,null)}this._depthStencilBuffer=t(this._depthStencilBuffer)}this._depthStencilTexture&&(this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,D(this._depthStencilTexture.descriptor.pixelFormat))),this._depthStencilTexture=t(this._depthStencilTexture))}_validateTextureDescriptor(e){3553!==e.target&&34067!==e.target&&35866!==e.target&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),F(e,this._context.parameters.maxTextureSize),this._validateBufferDimensions(e)}_validateRenderbufferDescriptor(e){F(e,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(e)}_validateBufferDimensions(e){e.width<=0&&(e.width=this.width),e.height<=0&&(e.height=this.height),this.width>0&&this.height>0&&(this.width===e.width&&this.height===e.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(e){switch(e.internalFormat){case l.DEPTH_COMPONENT16:case l.DEPTH_COMPONENT24:case l.DEPTH_COMPONENT32F:return f;case c.DEPTH24_STENCIL8:case c.DEPTH32F_STENCIL8:return a;case 36168:return o;default:return n}}_validateColorAttachmentPoint(t){if(-1===d._MAX_COLOR_ATTACHMENTS){const{gl:e}=this._context;d._MAX_COLOR_ATTACHMENTS=e.getParameter(e.MAX_COLOR_ATTACHMENTS)}const r=t-n;r+1>d._MAX_COLOR_ATTACHMENTS&&e.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${r+1}. Implementation supports up to ${d._MAX_COLOR_ATTACHMENTS} color attachments`)}}class p extends d{constructor(e,t,r){super(e,t,r)}dispose(){const{_colorAttachments:e,_glName:t,_context:r}=this;if(r.instanceCounter.decrement(s.FramebufferObject,this),0===e.size&&!this._depthStencilBuffer&&!this._depthStencilTexture&&!t)return;const i=r.boundFramebuffer,n=Array.from(e.values());this.detachColorTextures(...e.keys()),n.forEach(e=>e.dispose()),this.detachDepthStencilBuffer()?.dispose(),this.detachDepthStencilTexture()?.dispose(),r.gl.deleteFramebuffer(this._glName),this._glName=null,r.bindFramebuffer(i===this?null:i)}}function T(e){return 1===E(e)}function g(e){return 2===E(e)}function x(e){return T(e)||b(e)}function b(e){return 0===E(e)}function S(e){return 3===E(e)||null!=e&&"samples"in e}function E(e){return null!=e&&"type"in e?e.type:null}function N(e,t){return T(t)||g(t)?t:b(t)?new _(e,t):S(t)?new u(e,t):null}function F(e,t){const r=Math.max(e.width,e.height);if(r>t){m().warnOnce(`Resizing FBO attachment size ${e.width}x${e.height} to device limit ${t}`);const i=t/r;return e.width=Math.round(e.width*i),e.height=Math.round(e.height*i),!1}return!0}function A(e){return 34067===e.descriptor.target?34069:35866===e.descriptor.target?35866:3553}function D(e){return 6402===e?f:a}export{p as DisposableFramebufferObject,d as FramebufferObject,F as ensureAttachmentMaxSize};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"../../core/has.js";import t from"../../core/Logger.js";import{disposeMaybe as e}from"../../core/maybe.js";import{after as s}from"../../core/promiseUtils.js";import{Milliseconds as i}from"../../core/time.js";import{webglDebugEnabled as a,checkWebGLError as r,getErrorMessage as n,webglValidateShadersEnabled as l}from"./checkWebGLError.js";import{ContextState as h}from"./ContextState.js";import{baseTextureUnit as f,DrawBufferBack as o,DrawBufferNone as u,ResourceType as c,ColorAttachment0 as d,PrimitiveType as _}from"./enums.js";import{InstanceCounter as b}from"./InstanceCounter.js";import{Parameters as g}from"./Parameters.js";import{ProgramCache as p}from"./ProgramCache.js";import{StateTracker as m}from"./renderState.js";import B from"./Texture.js";import{WebGLDriverTest as F}from"./WebGLDriverTest.js";import{Capabilities as T}from"./capabilities/Capabilities.js";const x=()=>t.getLogger("esri.views.webgl.RenderingContext");let w=class{constructor(t,e){this.gl=t,this.instanceCounter=new b,this._programCache=new p(this),this._transformFeedbackRequestInfo=null,this._state=new h,this._numOfDrawCalls=0,this._numOfTriangles=0,this._options=e,this.configure(e)}configure(t){this._options=t,this._capabilities=new T(this.gl,t),this._parameters=new g(this.gl,this._capabilities,t),B.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;const s=this.gl.getParameter(this.gl.VIEWPORT);this._state=new h,this._state.viewport={x:s[0],y:s[1],width:s[2],height:s[3]},this._stateTracker=new m({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const{ref:e,readMask:s,stencilFront:i,stencilBack:a}=t;i.compare===a.compare?this.setStencilFunction(i.compare,e,s):(this.setStencilFunctionSeparate(1028,i.compare,e,s),this.setStencilFunctionSeparate(1029,a.compare,e,s)),i.fail===a.fail&&i.zFail===a.zFail&&i.zPass===a.zPass?this.setStencilOp(i.fail,i.zFail,i.zPass):(this.setStencilOpSeparate(1028,i.fail,i.zFail,i.zPass),this.setStencilOpSeparate(1029,a.fail,a.zFail,a.zPass))}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)}}),this.enforceState(),e(this._driverTest),this._driverTest=new F(this)}updateOptions(t){this._options={...this._options,...t},this._parameters=new g(this.gl,this._capabilities,this._options)}dispose(){this._driverTest=e(this._driverTest),this._programCache=e(this._programCache),this.bindVAO(null),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663),this._state.textureUnitMap.length=0,this._state.textureUnitSamplerMap.length=0,this._state=null,this._capabilities=null,this._stateTracker=null;const t=a()&&this.instanceCounter.resourceInformation;t&&console.log(t)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}get programCache(){return this._programCache}setPipelineState(t){this._stateTracker.setPipeline(t)}getPipelineState(){return this._stateTracker.getPipelineState()}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){this._state.program?.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s){const e=t[s];this._state.textureUnitMap[e]=null,this._state.textureUnitSamplerMap[e]=null}e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){this.gl.bindVertexArray(null),this._state.vertexArrayObject=null,this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){1032===this._state.stencilFunction.face&&this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=1032,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){1032===this._state.stencilOperation.face&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=1032,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(f+t),this._state.activeTexture=t),s}setDrawBuffers(t){const e=this.drawBuffers;if(e.length===t.length&&e.every((e,s)=>e===t[s]))return e;if(t.length>this.parameters.maxDrawBuffers)return x().error(`Setting more active draw buffers (${t.length}) than GL.MAX_DRAW_BUFFERS allows ( ${this.parameters.maxDrawBuffers}).`),e;const s=this._state.drawFramebuffer,i=null===s;if(i){if(t.length>1)return x().error(`The default framebuffer can only have 1 active draw buffer but was requested with ${t.length}.`),e;if(t[0]!==o&&t[0]!==u)return x().error(`The default framebuffer can only use the constants GL.BACK or GL.NONE as draw buffers but got ${t[0]}`),e}else if(t.includes(o))return x().error("A framebuffer object can only use the constants GL.COLOR_ATTACHMENTx or GL.NONE as draw buffers."),e;return this.gl.drawBuffers(t),r(this.gl),i?this._state.drawBuffers.defaultFramebuffer=t:this._state.drawBuffers.fbos.set(s,t),e}get drawBuffers(){const t=this._state.drawFramebuffer;return null===t?this._state.drawBuffers.defaultFramebuffer:this._state.drawBuffers.fbos.get(t)??[]}clear(t,e=255){t&&(16384&t&&this.setColorMask(!0,!0,!0,!0),256&t&&this.setDepthWriteEnabled(!0),1024&t&&this.setStencilWriteMask(e),this.gl.clear(t))}clearFramebuffer(t,e=!1,s=!1){let i=0;if(t){const e=1e-13,s=Math.max(e,t[3]);this.setClearColor(t[0],t[1],t[2],s),i|=16384}e&&(i|=256),!1===s?s=0:(!0===s&&(s=255),i|=1024),i&&this.clear(i,s)}clearBuffer(t,e,s=6144,i){this.gl.clearBufferfv(s,t,e,i)}clearBufferInteger(t,e,s=6144,i){this.gl.clearBufferiv(s,t,e,i)}clearBufferUnsignedInteger(t,e,s=6144,i){this.gl.clearBufferuiv(s,t,e,i)}drawArrays(t,e,s){if(this._transformFeedbackRequestInfo){if(t!==this._transformFeedbackRequestInfo.primitiveType)throw new Error("DrawArrays called during transform feedback, but primitiveType does not match that of the current transform feedback request");if(null==this._state.program?.hasTransformFeedbackVaryings)throw new Error("DrawArrays called during transform feedback, but the shader program was not linked with a transform feedback varying")}if(a()&&(this._numOfDrawCalls++,this._numOfTriangles+=k(t,s),has("enable-feature:webgl-debug:textureReadWrite"))){const t=this._state.textureUnitMap;for(let e=0;e<t.length;e++){const s=t[e];if(null!=s&&s===this._state.drawFramebuffer?.colorTexture)throw new Error(`Detected readWrite. Texture already bound at index ${e}`)}}this.gl.drawArrays(t,e,s),r(this.gl)}drawArraysInstanced(t,e,s,i){this.gl.drawArraysInstanced(t,e,s,i),r(this.gl)}drawElements(t,e,s,i){if(this._transformFeedbackRequestInfo)throw new Error("Cannot called drawElements during a transform feedback request");if(a()&&(this._numOfDrawCalls++,this._numOfTriangles+=k(t,e)),this.gl.drawElements(t,e,s,i),a()){const a=n(this.gl);if(a){const r=this.getBoundVAO(),n=r?.indexBuffer,l=r?.buffers,h={indexBuffer:n,vertexBuffers:l},f={mode:t,count:e,type:s,offset:i},o=n?.size??0,u=i+e,c=o<u?`. Buffer is too small. Attempted to draw index ${u} of ${o}`:"";x().error(`drawElements: ${a}${c}`,{args:f,vao:h})}}}drawElementsInstanced(t,e,s,i,a){this.gl.drawElementsInstanced(t,e,s,i,a),r(this.gl)}logInfo(){a()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}resetInfo(){a()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}setViewport4fv(t){this.setViewport(t[0],t[1],t[2],t[3])}restoreViewport({x:t,y:e,width:s,height:i}){this.setViewport(t,e,s,i)}getViewport(){const t=this._state.viewport;return{x:t.x,y:t.y,width:t.width,height:t.height}}useProgram(t){if(this._state.program!==t){if(t&&null==t.glName&&l())throw new Error("Attempting to use disposed or invalid Program");this._state.program?.stop(),this._state.program=t,this.gl.useProgram(t?.glName??null)}}bindTexture(t,e,s=!1,i=null){(e>=this.parameters.maxTextureImageUnits||e<0)&&x().error(`Input texture unit (${e}) is out of range of available units (0...${this.parameters.maxTextureImageUnits})\n `);const a=this._state.textureUnitMap[e],r=this._state.textureUnitSamplerMap[e],{gl:n}=this;return null==t?.glName?(null!=a&&(this.setActiveTexture(e,s),n.bindTexture(a.descriptor.target,null)),this._state.textureUnitMap[e]=null,null!=r&&(this._state.textureUnitSamplerMap[e]=null,n.bindSampler(e,null)),a):(r!==i&&(n.bindSampler(e,i?.glName??null),this._state.textureUnitSamplerMap[e]=i),s||a!==t?(this.setActiveTexture(e,s),n.bindTexture(t.descriptor.target,t.glName),t.applyChanges(),this._state.textureUnitMap[e]=t,a):(t.isDirty&&(this.setActiveTexture(e,s),t.applyChanges()),a))}unbindTexture(t){if(null!=t)for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(t,e=!1){const s=E(t);if(e||this._state.readFramebuffer!==t||this._state.drawFramebuffer!==t){if(null==t)return this.gl.bindFramebuffer(36160,null),this._state.readFramebuffer=this._state.drawFramebuffer=null,void this.setDrawBuffers(s);t.initializeAndBind(36160),this._state.readFramebuffer=t,this._state.drawFramebuffer=t,this.setDrawBuffers(s)}else this.setDrawBuffers(s)}bindFramebufferSeparate(t,e,s=!1){const i=36008===e,a=i?this._state.readFramebuffer:this._state.drawFramebuffer;(s||a!==t)&&(null==t?this.gl.bindFramebuffer(e,null):t.initializeAndBind(e),i?this._state.readFramebuffer=t??null:(this._state.drawFramebuffer=t??null,this.setDrawBuffers(E(t))))}blitFramebuffer(t,e,s=16384,i=9728,a=0,r=0,n=t.width,l=t.height,h=0,f=0,o=e.width,u=e.height){this.bindFramebufferSeparate(t,36008,!0),this.bindFramebufferSeparate(e,36009,!0),this.gl.blitFramebuffer(a,r,n,l,h,f,o,u,s,i)}bindBuffer(t,e){if(t)switch(e??=t.bufferType,e){case 34962:this._state.vertexBuffer=S(this.gl,t,e,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=S(this.gl,t,e,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=S(this.gl,t,e,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=S(this.gl,t,e,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=S(this.gl,t,e,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=S(this.gl,t,e,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=S(this.gl,t,e,this._state.copyWriteBuffer);break;case 35982:this._state.transformFeedbackBuffer=S(this.gl,t,e,this._state.transformFeedbackBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(t,e){if(e>=this.parameters.maxUniformBufferBindings||e<0)return x().error(`Uniform buffer binding point (${e}) is out of range (0...${this.parameters.maxUniformBufferBindings})\n `),null;const s=35345===t?this._state.uniformBufferBindingPoints:this._state.transformBufferBindingPoints;let i=s[e];return null==i&&(i={buffer:null,offset:0,size:0},s[e]=i),i}bindBufferBase(t,e,s){const i=this._getBufferBinding(t,e);null!=i&&(i.buffer===s&&0===i.offset&&0===i.size||(this.gl.bindBufferBase(t,e,s?s.glName:null),i.buffer=s,i.offset=0,i.size=0))}bindBufferRange(t,e,s,i,a){const r=this._getBufferBinding(t,e);null!=r&&(r.buffer===s&&r.offset===i&&r.size===a||(i%this._parameters.uniformBufferOffsetAlignment===0?(this.gl.bindBufferRange(t,e,s.glName,i,a),r.buffer=s,r.offset=i,r.size=a):x().error("Uniform buffer binding offset is not a multiple of the context offset alignment")))}bindUBO(t,e,s,i){null!=e?(a()&&(i??e.byteLength)>this._parameters.maxUniformBlockSize&&x().error("Attempting to bind more data than the maximum uniform block size"),e.initialize(),void 0!==s&&void 0!==i?this.bindBufferRange(35345,t,e.buffer,s,i):this.bindBufferBase(35345,t,e.buffer)):this.bindBufferBase(35345,t,null)}unbindUBO(t){for(let e=0,s=this._state.uniformBufferBindingPoints.length;e<s;e++){const s=this._state.uniformBufferBindingPoints[e];null!=s&&s.buffer===t.buffer&&this.bindBufferBase(35345,e,null)}}unbindBuffer(t){switch(t){case 34962:this._state.vertexBuffer=S(this.gl,null,t,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=S(this.gl,null,t,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=S(this.gl,null,t,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=S(this.gl,null,t,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=S(this.gl,null,t,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=S(this.gl,null,t,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=S(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(t,e){if(null==t)return this._state.vertexArrayObject?.unbind(),void(this._state.vertexArrayObject=null);this._state.vertexArrayObject!==t&&(t.bind(e),this._state.vertexArrayObject=t)}bindTransformFeedback(t){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,t.glName)}beginTransformFeedback(t,e){if(this._transformFeedbackRequestInfo)throw new Error("Already in a transform feedback request");const{gl:s}=this;s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,t.glName),s.beginTransformFeedback(e),this._transformFeedbackRequestInfo={primitiveType:e}}endTransformFeedback(){if(!this._transformFeedbackRequestInfo)throw new Error("Not in a transform feedback request");const{gl:t}=this;t.endTransformFeedback(),t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),this._transformFeedbackRequestInfo=null}async clientWaitAsync(t=i(10)){const{gl:e}=this,a=e.fenceSync(37143,0);if(!a)throw new Error("Client wait failed, could not create sync object");let r;this.instanceCounter.increment(c.Sync,a),e.flush();do{await s(t),r=e.clientWaitSync(a,0,0)}while(37147===r);if(this.instanceCounter.decrement(c.Sync,a),e.deleteSync(a),37149===r)throw new Error("Client wait failed")}get boundFramebuffer(){return this._state.drawFramebuffer}temporaryBindFramebuffer(t,e,s=!1){const i=this.boundFramebuffer,a={...this._state.viewport};try{this.bindFramebuffer(t,s),t&&this.setViewport(0,0,t.width,t.height),e()}finally{this.bindFramebuffer(i,s),t&&this.setViewport(a.x,a.y,a.width,a.height)}}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663);for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(1,0),this.setBlendEquation(32774),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(1029),this.setFrontFace(2305),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(513),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(519,0,0),this.setStencilOp(7680,7680,7680),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){const{gl:t}=this;t.bindVertexArray(null);for(let s=0;s<this.parameters.maxVertexAttributes;s++)t.disableVertexAttribArray(s);this._state.vertexBuffer?t.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):t.bindBuffer(34962,null),this._state.indexBuffer?t.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):t.bindBuffer(34963,null),this._state.uniformBuffer?t.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):t.bindBuffer(35345,null);for(let s=0;s<this._parameters.maxUniformBufferBindings;s++){const e=this._state.uniformBufferBindingPoints[s];if(null!=e){const{buffer:i,offset:a,size:r}=e;null!==i?0===a&&0===r?t.bindBufferBase(35345,s,i.glName):t.bindBufferRange(35345,s,i.glName,a,r):t.bindBufferBase(35345,s,null)}}if(this._state.pixelPackBuffer?t.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):t.bindBuffer(35051,null),this._state.pixelUnpackBuffer?t.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):t.bindBuffer(35052,null),this._state.copyReadBuffer?t.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):t.bindBuffer(36662,null),this._state.copyWriteBuffer?t.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):t.bindBuffer(36663,null),t.bindFramebuffer(36008,null),t.readBuffer(t.BACK),this._state.readFramebuffer&&(t.bindFramebuffer(36008,this._state.readFramebuffer.glName),t.readBuffer(d)),t.bindFramebuffer(36009,this._state.drawFramebuffer?.glName??null),null===this._state.drawFramebuffer){const e=this._state.drawBuffers.defaultFramebuffer;t.drawBuffers(e??[o])}else{const e=this._state.drawBuffers.fbos.get(this._state.drawFramebuffer);t.drawBuffers(e??[d])}if(this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}t.useProgram(this._state.program?.glName??null),t.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),t.bindRenderbuffer(t.RENDERBUFFER,this._state.renderbuffer?.glName??null),!0===this._state.blend?t.enable(this.gl.BLEND):t.disable(this.gl.BLEND),t.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),t.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),t.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),t.clearDepth(this._state.clearDepth),t.clearStencil(this._state.clearStencil),t.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),t.cullFace(this._state.cullFace),t.depthFunc(this._state.depthFunction),t.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),t.depthMask(this._state.depthWrite),t.frontFace(this._state.frontFace),t.lineWidth(1),!0===this._state.faceCulling?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),t.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),t.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),t.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),t.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),t.stencilMask(this._state.stencilWriteMask);for(let s=0;s<this.parameters.maxTextureImageUnits;s++){t.activeTexture(f+s),t.bindTexture(3553,null),t.bindTexture(34067,null),t.bindTexture(32879,null),t.bindTexture(35866,null),t.bindSampler(s,null);const e=this._state.textureUnitMap[s];null!=e&&t.bindTexture(e.descriptor.target,e.glName);const i=this._state.textureUnitSamplerMap[s];null!=i&&t.bindSampler(s,i?.glName)}t.activeTexture(f+this._state.activeTexture);const e=this._state.viewport;t.viewport(e.x,e.y,e.width,e.height),this.resetInfo()}};function S(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function k(t,e){switch(t){case _.POINTS:return 2*e;case _.TRIANGLES:return e/3;case _.TRIANGLE_STRIP:case _.TRIANGLE_FAN:return e-2;default:return 0}}function E(t){return t?t.colorAttachments.length>0?t.colorAttachments:[u]:[o]}export{w as RenderingContext,E as getFramebufferDrawBuffers};
|
|
2
|
+
import has from"../../core/has.js";import t from"../../core/Logger.js";import{disposeMaybe as e}from"../../core/maybe.js";import{after as s}from"../../core/promiseUtils.js";import{Milliseconds as i}from"../../core/time.js";import{webglDebugEnabled as a,checkWebGLError as r,getErrorMessage as n,webglValidateShadersEnabled as l}from"./checkWebGLError.js";import{ContextState as h}from"./ContextState.js";import{baseTextureUnit as f,DrawBufferBack as o,DrawBufferNone as u,ResourceType as c,ColorAttachment0 as d,PrimitiveType as _}from"./enums.js";import{InstanceCounter as b}from"./InstanceCounter.js";import{Parameters as g}from"./Parameters.js";import{ProgramCache as p}from"./ProgramCache.js";import{StateTracker as m}from"./renderState.js";import B from"./Texture.js";import{WebGLDriverTest as F}from"./WebGLDriverTest.js";import{Capabilities as T}from"./capabilities/Capabilities.js";const x=()=>t.getLogger("esri.views.webgl.RenderingContext");let w=class{constructor(t,e){this.gl=t,this.instanceCounter=new b,this._programCache=new p(this),this._transformFeedbackRequestInfo=null,this._state=new h,this._numOfDrawCalls=0,this._numOfTriangles=0,this._options=e,this.configure(e)}configure(t){this._options=t,this._capabilities=new T(this.gl,t),this._parameters=new g(this.gl,this._capabilities,t),B.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;const s=this.gl.getParameter(this.gl.VIEWPORT);this._state=new h,this._state.viewport={x:s[0],y:s[1],width:s[2],height:s[3]},this._stateTracker=new m({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const{ref:e,readMask:s,stencilFront:i,stencilBack:a}=t;i.compare===a.compare?this.setStencilFunction(i.compare,e,s):(this.setStencilFunctionSeparate(1028,i.compare,e,s),this.setStencilFunctionSeparate(1029,a.compare,e,s)),i.fail===a.fail&&i.zFail===a.zFail&&i.zPass===a.zPass?this.setStencilOp(i.fail,i.zFail,i.zPass):(this.setStencilOpSeparate(1028,i.fail,i.zFail,i.zPass),this.setStencilOpSeparate(1029,a.fail,a.zFail,a.zPass))}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)}}),this.enforceState(),e(this._driverTest),this._driverTest=new F(this)}updateOptions(t){this._options={...this._options,...t},this._parameters=new g(this.gl,this._capabilities,this._options)}dispose(){this._driverTest=e(this._driverTest),this._programCache=e(this._programCache),this.bindVAO(null),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663),this._state.textureUnitMap.length=0,this._state.textureUnitSamplerMap.length=0,this._state=null,this._capabilities=null,this._stateTracker=null;const t=a()&&this.instanceCounter.resourceInformation;t&&console.log(t)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}get programCache(){return this._programCache}setPipelineState(t){this._stateTracker.setPipeline(t)}getPipelineState(){return this._stateTracker.getPipelineState()}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){this._state.program?.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s){const e=t[s];this._state.textureUnitMap[e]=null,this._state.textureUnitSamplerMap[e]=null}e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){this.gl.bindVertexArray(null),this._state.vertexArrayObject=null,this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){1032===this._state.stencilFunction.face&&this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=1032,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){1032===this._state.stencilOperation.face&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=1032,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(f+t),this._state.activeTexture=t),s}setDrawBuffers(t){const e=this.drawBuffers;if(e.length===t.length&&e.every((e,s)=>e===t[s]))return e;if(t.length>this.parameters.maxDrawBuffers)return x().error(`Setting more active draw buffers (${t.length}) than GL.MAX_DRAW_BUFFERS allows ( ${this.parameters.maxDrawBuffers}).`),e;const s=this._state.drawFramebuffer,i=null===s;if(i){if(t.length>1)return x().error(`The default framebuffer can only have 1 active draw buffer but was requested with ${t.length}.`),e;if(t[0]!==o&&t[0]!==u)return x().error(`The default framebuffer can only use the constants GL.BACK or GL.NONE as draw buffers but got ${t[0]}`),e}else if(t.includes(o))return x().error("A framebuffer object can only use the constants GL.COLOR_ATTACHMENTx or GL.NONE as draw buffers."),e;return this.gl.drawBuffers(t),r(this.gl),i?this._state.drawBuffers.defaultFramebuffer=t:this._state.drawBuffers.fbos.set(s,t),e}get drawBuffers(){const t=this._state.drawFramebuffer;return null===t?this._state.drawBuffers.defaultFramebuffer:this._state.drawBuffers.fbos.get(t)??[]}clear(t,e=255){t&&(16384&t&&this.setColorMask(!0,!0,!0,!0),256&t&&this.setDepthWriteEnabled(!0),1024&t&&this.setStencilWriteMask(e),this.gl.clear(t))}clearFramebuffer(t,e=!1,s=!1){let i=0;if(t){const e=1e-13,s=Math.max(e,t[3]);this.setClearColor(t[0],t[1],t[2],s),i|=16384}e&&(i|=256),!1===s?s=0:(!0===s&&(s=255),i|=1024),i&&this.clear(i,s)}clearBuffer(t,e,s=6144,i){this.gl.clearBufferfv(s,t,e,i)}clearBufferInteger(t,e,s=6144,i){this.gl.clearBufferiv(s,t,e,i)}clearBufferUnsignedInteger(t,e,s=6144,i){this.gl.clearBufferuiv(s,t,e,i)}drawArrays(t,e,s){if(this._transformFeedbackRequestInfo){if(t!==this._transformFeedbackRequestInfo.primitiveType)throw new Error("DrawArrays called during transform feedback, but primitiveType does not match that of the current transform feedback request");if(null==this._state.program?.hasTransformFeedbackVaryings)throw new Error("DrawArrays called during transform feedback, but the shader program was not linked with a transform feedback varying")}if(a()&&(this._numOfDrawCalls++,this._numOfTriangles+=k(t,s),has("enable-feature:webgl-debug:textureReadWrite"))){const t=this._state.textureUnitMap;for(let e=0;e<t.length;e++){const s=t[e];if(null!=s&&s===this._state.drawFramebuffer?.colorTexture)throw new Error(`Detected readWrite. Texture already bound at index ${e}`)}}this.gl.drawArrays(t,e,s),r(this.gl)}drawArraysInstanced(t,e,s,i){this.gl.drawArraysInstanced(t,e,s,i),r(this.gl)}drawElements(t,e,s,i){if(this._transformFeedbackRequestInfo)throw new Error("Cannot called drawElements during a transform feedback request");if(a()&&(this._numOfDrawCalls++,this._numOfTriangles+=k(t,e)),this.gl.drawElements(t,e,s,i),a()){const a=n(this.gl);if(a){const r=this.getBoundVAO(),n=r?.indexBuffer,l=r?.buffers,h={indexBuffer:n,vertexBuffers:l},f={mode:t,count:e,type:s,offset:i},o=n?.size??0,u=i+e,c=o<u?`. Buffer is too small. Attempted to draw index ${u} of ${o}`:"";x().error(`drawElements: ${a}${c}`,{args:f,vao:h})}}}drawElementsInstanced(t,e,s,i,a){this.gl.drawElementsInstanced(t,e,s,i,a),r(this.gl)}logInfo(){a()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}resetInfo(){a()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}setViewport4fv(t){this.setViewport(t[0],t[1],t[2],t[3])}restoreViewport({x:t,y:e,width:s,height:i}){this.setViewport(t,e,s,i)}getViewport(){const t=this._state.viewport;return{x:t.x,y:t.y,width:t.width,height:t.height}}useProgram(t){if(this._state.program!==t){if(t&&null==t.glName&&l())throw new Error("Attempting to use disposed or invalid Program");this._state.program?.stop(),this._state.program=t,this.gl.useProgram(t?.glName??null)}}bindTexture(t,e,s=!1,i=null){(e>=this.parameters.maxTextureImageUnits||e<0)&&x().error(`Input texture unit (${e}) is out of range of available units (0...${this.parameters.maxTextureImageUnits})\n `);const a=this._state.textureUnitMap[e],r=this._state.textureUnitSamplerMap[e],{gl:n}=this;return null==t?.glName?(null!=a&&(this.setActiveTexture(e,s),n.bindTexture(a.descriptor.target,null)),this._state.textureUnitMap[e]=null,null!=r&&(this._state.textureUnitSamplerMap[e]=null,n.bindSampler(e,null)),a):(r!==i&&(n.bindSampler(e,i?.glName??null),this._state.textureUnitSamplerMap[e]=i),s||a!==t?(this.setActiveTexture(e,s),n.bindTexture(t.descriptor.target,t.glName),t.applyChanges(),this._state.textureUnitMap[e]=t,a):(t.isDirty&&(this.setActiveTexture(e,s),t.applyChanges()),a))}unbindTexture(t){if(null!=t)for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(t,e=!1){const s=E(t);if(e||this._state.readFramebuffer!==t||this._state.drawFramebuffer!==t){if(null==t)return this.gl.bindFramebuffer(36160,null),this._state.readFramebuffer=this._state.drawFramebuffer=null,void this.setDrawBuffers(s);t.initializeAndBind(36160),this._state.readFramebuffer=t,this._state.drawFramebuffer=t,this.setDrawBuffers(s)}else this.setDrawBuffers(s)}bindFramebufferSeparate(t,e,s=!1){const i=36008===e,a=i?this._state.readFramebuffer:this._state.drawFramebuffer;(s||a!==t)&&(null==t?this.gl.bindFramebuffer(e,null):t.initializeAndBind(e),i?this._state.readFramebuffer=t??null:(this._state.drawFramebuffer=t??null,this.setDrawBuffers(E(t))))}blitFramebuffer(t,e,s=16384,i=9728,a=0,r=0,n=t.width,l=t.height,h=0,f=0,o=e.width,u=e.height){this.bindFramebufferSeparate(t,36008,!0),this.bindFramebufferSeparate(e,36009,!0),this.gl.blitFramebuffer(a,r,n,l,h,f,o,u,s,i)}bindBuffer(t,e){if(t)switch(e??=t.bufferType,e){case 34962:this._state.vertexBuffer=S(this.gl,t,e,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=S(this.gl,t,e,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=S(this.gl,t,e,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=S(this.gl,t,e,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=S(this.gl,t,e,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=S(this.gl,t,e,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=S(this.gl,t,e,this._state.copyWriteBuffer);break;case 35982:this._state.transformFeedbackBuffer=S(this.gl,t,e,this._state.transformFeedbackBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(t,e){if(e>=this.parameters.maxUniformBufferBindings||e<0)return x().error(`Uniform buffer binding point (${e}) is out of range (0...${this.parameters.maxUniformBufferBindings})\n `),null;const s=35345===t?this._state.uniformBufferBindingPoints:this._state.transformBufferBindingPoints;let i=s[e];return null==i&&(i={buffer:null,offset:0,size:0},s[e]=i),i}bindBufferBase(t,e,s){const i=this._getBufferBinding(t,e);null!=i&&(i.buffer===s&&0===i.offset&&0===i.size||(this.gl.bindBufferBase(t,e,s?s.glName:null),i.buffer=s,i.offset=0,i.size=0))}bindBufferRange(t,e,s,i,a){const r=this._getBufferBinding(t,e);null!=r&&(r.buffer===s&&r.offset===i&&r.size===a||(i%this._parameters.uniformBufferOffsetAlignment===0?(this.gl.bindBufferRange(t,e,s.glName,i,a),r.buffer=s,r.offset=i,r.size=a):x().error("Uniform buffer binding offset is not a multiple of the context offset alignment")))}bindUBO(t,e,s,i){null!=e?(a()&&(i??e.byteLength)>this._parameters.maxUniformBlockSize&&x().error("Attempting to bind more data than the maximum uniform block size"),e.initialize(),void 0!==s&&void 0!==i?this.bindBufferRange(35345,t,e.buffer,s,i):this.bindBufferBase(35345,t,e.buffer)):this.bindBufferBase(35345,t,null)}unbindUBO(t){for(let e=0,s=this._state.uniformBufferBindingPoints.length;e<s;e++){const s=this._state.uniformBufferBindingPoints[e];null!=s&&s.buffer===t.buffer&&this.bindBufferBase(35345,e,null)}}unbindBuffer(t){switch(t){case 34962:this._state.vertexBuffer=S(this.gl,null,t,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=S(this.gl,null,t,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=S(this.gl,null,t,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=S(this.gl,null,t,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=S(this.gl,null,t,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=S(this.gl,null,t,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=S(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(t,e){if(null==t)return this._state.vertexArrayObject?.unbind(),void(this._state.vertexArrayObject=null);this._state.vertexArrayObject!==t&&(t.bind(e),this._state.vertexArrayObject=t)}bindTransformFeedback(t){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,t.glName)}beginTransformFeedback(t,e){if(this._transformFeedbackRequestInfo)throw new Error("Already in a transform feedback request");const{gl:s}=this;s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,t.glName),s.beginTransformFeedback(e),this._transformFeedbackRequestInfo={primitiveType:e}}endTransformFeedback(){if(!this._transformFeedbackRequestInfo)throw new Error("Not in a transform feedback request");const{gl:t}=this;t.endTransformFeedback(),t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),this._transformFeedbackRequestInfo=null}async clientWaitAsync(t=i(10),e){const{gl:a}=this,r=a.fenceSync(37143,0);if(!r)throw new Error("Client wait failed, could not create sync object");this.instanceCounter.increment(c.Sync,r),a.flush();try{let i;do{await s(t,null,e),i=a.clientWaitSync(r,0,0)}while(37147===i);if(37149===i)throw new Error("Client wait failed")}finally{this.instanceCounter.decrement(c.Sync,r),a.deleteSync(r)}}get boundFramebuffer(){return this._state.drawFramebuffer}temporaryBindFramebuffer(t,e,s=!1){const i=this.boundFramebuffer,a={...this._state.viewport};try{this.bindFramebuffer(t,s),t&&this.setViewport(0,0,t.width,t.height),e()}finally{this.bindFramebuffer(i,s),t&&this.setViewport(a.x,a.y,a.width,a.height)}}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663);for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(1,0),this.setBlendEquation(32774),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(1029),this.setFrontFace(2305),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(513),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(519,0,0),this.setStencilOp(7680,7680,7680),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){const{gl:t}=this;t.bindVertexArray(null);for(let s=0;s<this.parameters.maxVertexAttributes;s++)t.disableVertexAttribArray(s);this._state.vertexBuffer?t.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):t.bindBuffer(34962,null),this._state.indexBuffer?t.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):t.bindBuffer(34963,null),this._state.uniformBuffer?t.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):t.bindBuffer(35345,null);for(let s=0;s<this._parameters.maxUniformBufferBindings;s++){const e=this._state.uniformBufferBindingPoints[s];if(null!=e){const{buffer:i,offset:a,size:r}=e;null!==i?0===a&&0===r?t.bindBufferBase(35345,s,i.glName):t.bindBufferRange(35345,s,i.glName,a,r):t.bindBufferBase(35345,s,null)}}if(this._state.pixelPackBuffer?t.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):t.bindBuffer(35051,null),this._state.pixelUnpackBuffer?t.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):t.bindBuffer(35052,null),this._state.copyReadBuffer?t.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):t.bindBuffer(36662,null),this._state.copyWriteBuffer?t.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):t.bindBuffer(36663,null),t.bindFramebuffer(36008,null),t.readBuffer(t.BACK),this._state.readFramebuffer&&(t.bindFramebuffer(36008,this._state.readFramebuffer.glName),t.readBuffer(d)),t.bindFramebuffer(36009,this._state.drawFramebuffer?.glName??null),null===this._state.drawFramebuffer){const e=this._state.drawBuffers.defaultFramebuffer;t.drawBuffers(e??[o])}else{const e=this._state.drawBuffers.fbos.get(this._state.drawFramebuffer);t.drawBuffers(e??[d])}if(this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}t.useProgram(this._state.program?.glName??null),t.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),t.bindRenderbuffer(t.RENDERBUFFER,this._state.renderbuffer?.glName??null),!0===this._state.blend?t.enable(this.gl.BLEND):t.disable(this.gl.BLEND),t.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),t.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),t.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),t.clearDepth(this._state.clearDepth),t.clearStencil(this._state.clearStencil),t.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),t.cullFace(this._state.cullFace),t.depthFunc(this._state.depthFunction),t.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),t.depthMask(this._state.depthWrite),t.frontFace(this._state.frontFace),t.lineWidth(1),!0===this._state.faceCulling?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),t.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),t.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),t.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),t.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),t.stencilMask(this._state.stencilWriteMask);for(let s=0;s<this.parameters.maxTextureImageUnits;s++){t.activeTexture(f+s),t.bindTexture(3553,null),t.bindTexture(34067,null),t.bindTexture(32879,null),t.bindTexture(35866,null),t.bindSampler(s,null);const e=this._state.textureUnitMap[s];null!=e&&t.bindTexture(e.descriptor.target,e.glName);const i=this._state.textureUnitSamplerMap[s];null!=i&&t.bindSampler(s,i?.glName)}t.activeTexture(f+this._state.activeTexture);const e=this._state.viewport;t.viewport(e.x,e.y,e.width,e.height),this.resetInfo()}};function S(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function k(t,e){switch(t){case _.POINTS:return 2*e;case _.TRIANGLES:return e/3;case _.TRIANGLE_STRIP:case _.TRIANGLE_FAN:return e-2;default:return 0}}function E(t){return t?t.colorAttachments.length>0?t.colorAttachments:[u]:[o]}export{w as RenderingContext,E as getFramebufferDrawBuffers};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{DataType as
|
|
2
|
+
import{DataType as t}from"./enums.js";import{fromLayout as e}from"./VertexAttributeLocations.js";import{VertexElementDescriptor as o}from"./VertexElementDescriptor.js";const r=[new o("position",2,t.UNSIGNED_SHORT,0,4)],s=[new o("a_pos",2,t.BYTE,0,4),new o("a_tex",2,t.BYTE,2,4)],i=e(r);export{r as Pos2us,i as Pos2usLocations,s as PosTex2b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
function e(e){return t(e,"",new Set,new Map)}function t(e,s,n
|
|
2
|
+
function e(e){return t(e,"",new Set,new Map)}function t(e,s,r,n){if(r.has(e))return n;r.add(e),s&&e.id&&n.set(s,e);for(const a of e.properties)if("string"!=typeof a.type){const e=s?`${s}.${a.name}`:a.name;t(a.type,e,r,n)}return r.delete(e),n}class s{constructor(){this.stack=[],this.seen=new Map,this._uniqueDeclaredClasses=new Map}[Symbol.dispose](){this.seen.clear(),this.stack.length=0,this._uniqueDeclaredClasses.clear()}getDeclaredClass(e){const{_uniqueDeclaredClasses:t}=this,s=e.prototype.declaredClass.replaceAll(".","/");let r=0;for(;;){const n=r?`${s}/${r}`:s;r++;const a=t.get(n);if(!a)return t.set(n,e),n;if(a===e)return n}}addProperty(e){this.currentClass?.properties.push(e)}push(e,t){this.seen.set(t.id,t),this.stack.push({klass:t,propertyName:e})}pop(){return this.stack.pop()?.klass??null}get currentClass(){return this.stack.length?this.stack[this.stack.length-1].klass:null}get pathString(){return this.stack.map(e=>e.propertyName).filter(e=>!!e).join(".")}}function r(e){const t=e.slice();return t.sort(),t}export{s as ScanContext,e as collectClassPaths,r as sorted};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
function e(e){return null!=e&&"update-features"===e.type}function t(e){return null!=e&&e.type.includes("update-")&&"fullFeature"in e}function n(e){return null!=e&&"
|
|
2
|
+
function e(e){return null!=e&&"update-features"===e.type}function t(e){return null!=e&&e.type.includes("update-")&&"fullFeature"in e}function n(e){return null!=e&&"merge-features"===e.type}function u(e){return null!=e&&"split-feature"===e.type}function r(e){const t=e?.type;return"update-feature"===t||"update-table-record"===t||"update-features"===t||"split-feature"===t}function i(n){return t(n)||e(n)}function p(e){return"merge"===e?.type}function l(e){return"split"===e?.type}function a(e){return n(e)||u(e)}function f(e){return"update-multiple"===e?.type}function o(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}export{i as isAnyUpdateLeafWorkflow,n as isMergeFeaturesWorkflow,p as isMergeWorkflowOptions,r as isParentWorkflow,u as isSplitFeatureWorkflow,l as isSplitWorkflowOptions,e as isUpdateFeaturesWorkflow,f as isUpdateFeaturesWorkflowOptions,t as isUpdateRecordWorkflow,o as prepareAttachmentsForCreateFeaturesWorkflow,a as workflowInfluencesOutcomeOfParent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as o}from"../../core/arrayUtils.js";import i from"../../core/Error.js";import{handlesGroup as a,makeHandle as s,abortHandle as l}from"../../core/handleUtils.js";import{clone as c}from"../../core/lang.js";import u from"../../core/Logger.js";import{getOrCreateMapValue as p}from"../../core/MapUtils.js";import{debounce as d,isPromiseLike as f,whenOrAbort as y}from"../../core/promiseUtils.js";import{watch as m,on as h,whenOnce as g,when as b}from"../../core/reactiveUtils.js";import{px2pt as w}from"../../core/screenUtils.js";import{addMany as I}from"../../core/SetUtils.js";import{isSharedTemplateOrMetadata as v,isSharedGroupTemplate as T,getCreationAttributes as F,isSharedPresetTemplate as j}from"../../editing/templateUtils.js";import{isCurvedGeometry as k,hasUnsupportedCurve as A}from"../../geometry/support/curves/curveUtils.js";import S from"../../layers/GraphicsLayer.js";import{featureHasFields as O,fixFields as U,getDisplayFieldName as L}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as V}from"../../layers/support/layerUtils.js";import{calculateTolerance as M}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as x}from"../../renderers/support/lengthUtils.js";import{isRenderer as q}from"../../renderers/support/typeUtils.js";import{getTransformationType as z}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{isGraphic as E}from"../../support/graphicInstanceUtils.js";import P from"../../symbols/SimpleFillSymbol.js";import R from"../../symbols/SimpleLineSymbol.js";import C from"../../symbols/SimpleMarkerSymbol.js";import{to3D as D}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as G}from"../../symbols/support/symbolUtils.js";import{getServices as B}from"../../undoredo/support/Services.js";import{defaultDrawingMode as N}from"../../views/draw/drawingModes.js";import{updateGraphicSymbolWhenRequired as Z,fetchFullFeaturesByObjectId as W}from"../../views/draw/support/editingSessionUtils.js";import{createQueryGeometry as $}from"../../views/support/drapedUtils.js";import{filterGraphicHits as Q,hitTestSelectSimilarDistance as H}from"../../views/support/hitTestSelectUtils.js";import{isNextOrLegacyUpdateWorkflow as J,isNextOrLegacyUpdateFeaturesWorkflow as K}from"./compatibilityAdapters.js";import{dependencySort as X}from"./support/dependencySort.js";import{isDrawGraphicTool as Y,isDrawTool as _}from"../Sketch/support/sketchUtils.js";const ee=()=>u.getLogger("esri.widgets.Editor.workflowUtils");function te(e){return ae(e)||oe(e)}function re(e){return!!e&&"features"in e}function ne(e){return null!=e&&"create-features"===e.type}function oe(e){return null!=e&&"update-features"===e.type}function ie(e){return null!=e&&"update-feature"===e.type}function ae(e){return null!=e&&e.type.includes("update-")&&"fullFeature"in e}function se(e){return null!=e&&"update"===e.type}function le(e){return null!=e&&"merge-features"===e.type}function ce(e){return null!=e&&"split-feature"===e.type}function ue(e){const t=e?.type;return"update-feature"===t||"update-table-record"===t||"update-features"===t||"split-feature"===t}function pe(e){return"merge"===e?.type}function de(e){return"split"===e?.type}function fe(e){return le(e)||ce(e)}function ye(e){return"update-multiple"===e?.type}function me(e){const t=e&&"renderer"in e?e.renderer:null;if(!Te(t))return{rotation:null,size:null};const r=t.getVisualVariablesForType("rotation").filter(e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression),n=t.getVisualVariablesForType("size").filter(e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&"real-world-size"===z(e));return{rotation:1===r.length?r[0]:null,size:1===n.length?n[0]:null}}function he(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&Te(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=me(t);let o=null,i=null;if(r){const e=t.fields?.filter(e=>e.name===r.field),n=1===e?.length?e[0]:null;o=ge(r,n)}if(n){const e=t.fields?.filter(e=>e.name===n.field),r=1===e?.length?e[0]:null;i=Ie(n,r)}return{rotation:o,size:i}}function ge(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=t?.type??"double",o={initial:0,current:0};return{field:e.field,fieldType:n,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(o.current=o.initial-r*e,ve((o.current+360)%360,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function be(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function we(e,t,r){if(null==t)return 0;const{symbol:n}=D(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const o=n.symbolLayers.at(0);if(!o)return 0;switch(o.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min(it.icon,(await e(o,it.icon))[0])||it.icon}case"text":return it.text;case"line":return it.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return be(await t(o,e.scale/it.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/it.viewScaleSizeFactor;default:return 0}}function Ie(e,t){const r=e.axis,n=t?.type??"double",o={initial:0,current:0},i=x[e.valueUnit]??1;let a;return a="area"===e.valueRepresentation?e=>(e*i/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*i/2:e=>e*i,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>ve(a(await we(t,e,r)),n),getValue:(e,t)=>(o.initial||(o.initial=t.pixelSizeAt(t.center)),o.current=o.initial*e,ve(o.current,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,displayUnit:lt(e.valueUnit),axis:e.axis}}function ve(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function Te(e){if(!q(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}function Fe(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const n={mode:N,optionsPerTool:r};if(v(t)){const o=t.defaultTool,i=T(t)?t.definition?.inputGeometryType??e:e;switch(o){case"freehand":case"stream-line":return{tool:"polyline"===i?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===i?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const o=t.drawingTool;if("circle"===o||"ellipse"===o)return r.get("circle").preserveAspectRatio="circle"===o,{tool:"circle",createOptions:n};if("rectangle"===o)return{tool:"rectangle",createOptions:n};if("freehand"===o)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function je(e,t,r){const{creationInfo:n,fullTemplate:o}=r;if(!n)throw new i("featureworkflow","No creation info provided.");const a=n.layer,s=F(o,n.attributeOverrides,n.layer),{view:l}=e,c="2d"===l?.type;T(o)||j(o)||await Be(e,a,s,c?l.scale:null);const{capabilities:u}=a;t.elevationInfo=a.elevationInfo;const p=Fe(a.geometryType,o);e.defaultCreateOptions={graphicProperties:{attributes:s,sourceLayer:a},mode:p.createOptions.mode,optionsPerTool:p.createOptions.optionsPerTool,preserveAspectRatio:p.createOptions.preserveAspectRatio,hasZ:u.data.supportsZ,defaultZ:(c?u.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==n.geometryToPlace?await e.create(p.tool):await e.place(n.geometryToPlace,{graphicProperties:{attributes:s,sourceLayer:a}})}async function ke(e){return a([Ae(e),Se(e)])}function Ae({creationAttributes:e,data:t,sketchViewModel:r,view:n}){const{creationInfo:o}=t,{fullTemplate:i}=t;if(!o||"2d"!==n?.type||T(i)||j(i))return null;const a=d(t=>Be(r,o.layer,e,t));return m(()=>n.scale,e=>a(e))}function Se({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:o}=t;if(!o)return null;const l=r.activeComponent;if(!n||!Y(l)&&!_(l))return ee().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new S({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:p}=o,d=n.theme?.accentColor??new e([255,165,0,1]);return a([h(()=>l,["cursor-update","vertex-add"],()=>{c.removeAll();const e=Y(l)?l.graphic?.geometry:l.unprocessedGeometry;if(!e||!Oe(e))return;const t=u(e,"digitizing");if(!f(t))for(const r of t.edits){const e=p.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=Ue(e,d);t&&c.add(t)}}}),s(()=>{n.map.remove(c),c.destroy()})])}function Oe(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":{if(k(e))return e.curvePaths[0].length>1;const t=e.paths[0];return!!t&&t.length>1}case"polygon":{if(k(e))return e.curveRings[0].length>2;const t=e.rings[0];return!!t&&(n(t.at(0),t.at(-1))?t.length>2:t.length>1)}default:return!1}}function Ue(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new C({angle:0,color:r,outline:new R({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":n=new P({color:r,outline:new R({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new R({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:n,attributes:{...e.attributes}})}function Le(e,t){const r=B(t),n=V(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}function Ve(e,t){const r=Le(e,t);if(!r)return new Map;const n=new Map;for(const o of r.layersAndTables)p(n,o.layerId,()=>[]).push(o);return n}function Me(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function xe(e){const{edits:t,serviceInfo:n,view:o,findOriginalFeature:i}=e,a=qe(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=Ee(t,a,i),p=Pe(l,ze(s,c),c);if(o&&De(l,p,o),0===p.length)return t;const d=X(p,{continueOnCircularDependency:!0}).map(e=>u.get(e)).filter(r),f=new Map;for(const r of d)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of d){const{layer:e}=r;switch(null==h?h=Me(e):h.id!==e.layerId&&(m.push(h),h=Me(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find(t=>t.id===e)??Me(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function qe(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function ze(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(Re(n,e),""),t.has(e.relatedTableId)){const o=t.get(e.relatedTableId);if(o.length>0)for(const t of o[0].layer.relationships??[])if(t.id===e.id){r.set(Re(n,e),t.keyField);break}}return r}function Ee(e,t,r){const n=new Map,o=[],a=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});n.set(c.layerId,e);for(const t of e)o.push(t),a.set(t.uniqueId,t)}return{allEditData:o,editDataByIdMap:a,editDataByLayerIdMap:n}}function Pe(e,t,r){const n=[];for(const o of e){const e=o.layer.relationships??[],{uniqueId:i}=o;for(const a of e){const e=a.keyField;if("origin"===a.role){const s=r.get(a.relatedTableId);if(!s||0===s.length)continue;const l=Re(o.layer,a),c=t.get(l);if(void 0===c||""===c)continue;switch(o.operationType){case"add":for(const t of s)t!==o&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===o.after.attributes[e]&&n.push([i,t.uniqueId]));break;case"modify":if(o.before.attributes[e]!==o.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==o&&("delete"===t.operationType?t.before.attributes[c]===o.before.attributes[e]?n.push([r,i]):t.before.attributes[c]===o.after.attributes[e]&&n.push([i,r]):"add"===t.operationType?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):t.after.attributes[c]===o.before.attributes[e]&&n.push([r,i]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):n.push([r,i]):n.push([i,r])))}break;case"delete":for(const t of s)t!==o&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===o.before.attributes[e]&&n.push([t.uniqueId,i]))}}}}return n}function Re(e,t){return`${e.layerId}:${t.id}`}function Ce(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some(t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId)))}function De(e,t,r){const n=[];for(const i of e)Ce(i.layer,r)&&n.push(i);if(0===n.length)return;let o=[];for(const i of n){const r=i.layer;switch(i.operationType){case"delete":o=[...Ge(i.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ge(i.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([i.uniqueId,e.uniqueId]);break;case"add":o=[...Ge(i.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ge(i.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([e.uniqueId,i.uniqueId])}}}function Ge(e,t){const r=[],n=t.filter(({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField);for(const o of n){const t=o.layer.globalIdField;("before"in o&&o.before?.attributes[t]===e||"after"in o&&o.after?.attributes[t]===e)&&r.push(o)}return r}async function Be(e,r,n,o){const i=new t({sourceLayer:r,attributes:n}),{rotation:a,size:s}=he(i);let l=await G(i,{useSourceLayer:!0,scale:o}),c=!1;for(const t of[s,a]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(l,e.view),c=!0)}switch(c&&(l=await G(i,{useSourceLayer:!0,scale:o})),l?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=l;break;case"simple-line":case"line-3d":e.polylineSymbol=l;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=l;break;case"mesh-3d":e.meshSymbol=l}Ne(e.tooltipOptions,s,a)}function Ne(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function Ze(e,t){return e.find(e=>e.layer===t)}function We(e,t){const r=Ze(e,t);if(null==r)throw new i("no-editorItem-found","The EditorViewModel provided did not have an EditorItem associated with the specified layer");return r}function $e(e,t){return e?.find(e=>e.layer===t)}async function Qe(e,t,r,n){switch(t.type){case"3d":return He(e,t,r,n);case"2d":return Je(e,t,r,n)}}async function He(e,t,r,n){if(0===e.length)return[];const{updatable:i,graphicsByLayer:a}=await r.defer(async()=>{const{results:o}=await y(H(t,r),n),i=new Map,a=e=>{const t=e.layer,r=i.get(t);if(!r){const e=new Array;return i.set(t,e),e}return r};Q(o).forEach(({graphic:e})=>a(e).push(e));const s=e.filter(({capabilities:e,layer:t})=>e.update.enabled&&i.has(t));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:i}});return y(Promise.allSettled(i.map(async({layer:e})=>{const t=a.get(e),r=Ke(e);if(t.every(e=>O(e,r)))return t;const i=[];for(const n of t){i.push(n.getObjectId());const e=Object.keys(n.attributes);o(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=i,s.outFields=U(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then(({features:e})=>e)})),n)}async function Je(e,t,r,n){if(0===e.length)return[];const{mapPoint:o}=r;if(null==o)return[];let i=null;const a=await r.defer(async()=>{const{results:o}=await y(t.hitTest(r),n);if(0===o.length)return[];const a=new Set;i=Q(o),i.forEach(({graphic:e})=>e&&a.add(e.layer));const s=e.filter(e=>a.has(e.layer)&&e.supportsUpdateWorkflow);return s.length>0&&r.stopPropagation(),s});return y(Promise.allSettled(a.map(async({layer:e})=>{const a=e.createQuery();a.returnGeometry=!0,a.outFields=Ke(e);const s="renderer"in e?M({renderer:e.renderer,pointerType:r.pointerType}):0;a.geometry=$(o,s,t),a.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(a,{signal:n});return i?.forEach(({graphic:t})=>{t.layer!==e||l.some(e=>e.getObjectId()===t.getObjectId())||l.push(t)}),l})),n)}function Ke(e){return U(e.fieldsIndex,[e.objectIdField,L({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function Xe(e,t,n,o){const i=e.map(e=>e.getObjectId()??e.attributes[t.objectIdField]).filter(r);return await W(i,t,n,o)}async function Ye(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,updateOptions:o,visualVariables:i}=e;await et(e);const a={multipleSelectionEnabled:!1,...o};return"point"===n.geometryType&&(a.enableRotation=null!=i.rotation,a.enableScaling=null!=i.size),r.update(t,a)}function _e(e,t){const{activeUpdateOptions:r}=e;r&&(e.activeUpdateOptions={...r,...t,reshapeOptions:{...r.reshapeOptions,...t.reshapeOptions},highlightOptions:{...r.highlightOptions,...t.highlightOptions}})}async function et(e){const{graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:o,visualVariables:i}=e;let a=!1;const{rotation:s,size:l}=i;for(const c of[s,l]){if(null==c)continue;const e=t.getAttribute(c.field);if(null!=e)c.setInitialValue(e);else{const e=await c.getDefaultValue(t.symbol,n.view);c.setInitialValue(e),t.setAttribute(c.field,e),a=!0}}if(a){const e="2d"===n.view?.type?n.view.scale:null;await Z(t,e)}Ne(n.tooltipOptions,l,s),r.elevationInfo=o.elevationInfo}function tt(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function rt(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function nt(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const o=t.attributes;let i=!1;const a=n.rotation,s=tt(r.toolEventInfo);if(null!=a&&null!=s){const{field:r,getValue:n}=a;if("rotate-stop"===s.type)a.isUpdatingInteractively=!1,a.setInitialValue(t.getAttribute(r));else{a.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==o[r]&&t.setAttribute(r,l),i=!0}}const l=n.size,c=rt(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const a=n(c.xScale,e);a!==o[r]&&t.setAttribute(r,a),i=!0}}return i}async function ot({feature:e,featureClone:t,sketchLayer:r,sketchViewModel:n,getUpdateOptions:o,view:i,visualVariableAttributes:c,addHandle:u,addUpdatingPromise:p,onUpdate:f}){await Z(t,"2d"===i.type?i.scale:null);let y=null;if("2d"===n?.view?.type){const e=d(e=>Z(t,e));y=m(()=>n?.view?.scale,t=>e(t))}const h=t.sourceLayer,w=ut(i,h);await Ye({graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:h,updateOptions:o(),visualVariables:c});let I=null;w.then(e=>I=e).catch(()=>{});const v=c.size,T=c.rotation,F=m(()=>e.attributes,async e=>{let r=!1;for(const n in e){const o=e[n];o!==t.getAttribute(n)&&(t.setAttribute(n,o),null==v||v.isUpdatingInteractively||v.field!==n||v.setInitialValue(o),null==T||T.isUpdatingInteractively||T.field!==n||T.setInitialValue(o),(null==I||I.requiredFields.includes(n))&&(r=!0))}r&&await Z(t,"2d"===i.type?i.scale:null)}),j=n.on("update",async e=>{const t=e.graphics[0],a={graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:h,updateOptions:o(),visualVariables:c};if("complete"===e.state){const e=new AbortController,t=l(e);return u(t),p(g(()=>null===i.activeTool,e.signal).then(async()=>{if(!e.signal.aborted)return e.abort(),Ye(a)}))}nt(i,t,e,c)&&await Z(t,"2d"===i.type?i.scale:null),f(dt(t),e)}),k=b(()=>null!=i.activeTool&&i.activeTool!==n.activeComponent,()=>n.cancel()),A=n.on(["undo","redo"],e=>{f(dt(e.graphics[0]),e)});return a([A,j,k,s(()=>n.cancel()),F,y])}const it={icon:w(24),text:w(12),line:w(1),viewScaleSizeFactor:100};function at(e,t,r){let n=!1;return e.filter(e=>!!n||(n=e===t,n)).map(e=>r[e]())}function st(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const n=r.layer,o=e.viewModel.getTemplatesForLayer(n);1===o.length&&"scene"!==n.type&&(r.template=o[0],t.shift())}return t}function lt(e){return"unknown"===e?null:e}const ct=e=>e.includes("-stop")||e.includes("vertex-"),ut=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function pt(e){return"createInteractiveEditSession"in e}function dt(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=c(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function ft(e){return e.acquireCursor("progress")}function yt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:o}=t;e.setAttribute(r,n.getAttribute(o))}}function mt(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach(e=>yt(e.relationships)),t.flatMap(e=>e.edits)):null}function ht(e){const t=J(e)?e.activeWorkflow:e;if(null==t)return[];if(K(t))return t.data.layers;const r=t.layer;return r?[r]:[]}function gt({attributes:e},t){const r=new Set;r.add(t.objectIdField),"uniqueIdFields"in t&&t.uniqueIdFields&&t.uniqueIdFields.length>0&&I(r,t.uniqueIdFields);const n={};for(const o of r)null!=e[o]&&(n[o]=e[o]);if("scene"===t.type&&null!=t.infoFor3D){const r=t.associatedLayer?.globalIdField;null!=r&&(e[r]=e[r])}return n}function bt(e){if(!wt(e))return e;const t=new Map;for(const r of e){const e=r.getObjectId();if(null!=e){const n=r.sourceLayer??r.layer;p(t,n,()=>[]).push(e)}}return Array.from(t.entries()).map(([e,t])=>({layer:e,objectIds:t}))}function wt(e){return 0===e.length||E(e[0])}function It({drawTool:e},t){const r=e?.mostDownstreamPlugin?.configuration?.curveTypes;if(!t||!r||0===r.length)return!1;const n=new Set(t.capabilities.supportedCurveTypes);return r.some(e=>!n.has(e))}function vt(e,t){const r=new Set(t.capabilities.supportedCurveTypes);return e.some(({geometry:e})=>e&&k(e)&&A(e,r))}function Tt({filter:e,forEachFeature:t,forEachValueChange:r}){return n=>{for(const{feature:o,changes:i}of n.data)if(!e||e(o)){for(const{fieldName:e,value:t}of i)r?.(e,t,o);t?.(o,i)}}}export{It as activeSketchToolDrawsUnsupportedCurve,De as appendAllUtilityNetworkAssociationRelationships,st as avoidFeatureTemplateSelectionWithOnlyOneItem,pt as canCreateInteractiveEditSession,dt as cloneGraphicExceptMesh,vt as containsUnsupportedCurve,qe as createLayerIdMap,ze as createRelationshipKeyMap,Fe as createToolFromGeometryType,at as createWorkflowSteps,Qe as fetchCandidates,Xe as fetchFullFeatures,Pe as findAllDependencies,Ge as findChangesByGlobalId,Ze as findEditorItemForLayer,We as findEditorItemForLayerOrThrow,$e as findLayerInfo,Re as generateHashForRelationship,ht as getLayersFromWorkflow,ge as getRotationVariableAttribute,mt as getServiceEditsFromWorkflowData,Le as getServiceInfoForLayer,Ve as getServiceLayersById,Ie as getSizeVariableAttribute,he as getVisualVariableAttributes,me as getVisualVariablesForLayer,Tt as handleFormValuesChangeEvent,te as isAnyUpdateLeafWorkflow,re as isBatchAttributeFormViewModel,ne as isCreateFeaturesWorkflow,wt as isGraphicsArray,le as isMergeFeaturesWorkflow,pe as isMergeWorkflowOptions,ue as isParentWorkflow,ce as isSplitFeatureWorkflow,de as isSplitWorkflowOptions,ct as isTerminalUpdateEventType,ie as isUpdateFeatureWorkflow,oe as isUpdateFeaturesWorkflow,ye as isUpdateFeaturesWorkflowOptions,ae as isUpdateRecordWorkflow,se as isUpdateWorkflow,Ce as isUtilityNetworkAssociationsTable,gt as makeMinimalAttributes,xe as orderEditsByRelationshipDependencies,yt as setRelationshipFields,ot as setUpGeometryUpdate,ke as setUpSketchCreateWatchers,et as setVisualVariablesAndElevationInfoForUpdate,ft as showProgressCursor,it as sizeDefaults,lt as sizeVariableUnitToLengthUnit,je as startCreatingNewFeature,Ye as startUpdatingFeatureGeometry,_e as syncUpdateOptions,bt as toFeatureInfos,nt as visualVariableInteractiveUpdate,ut as whenEditorLayerView,fe as workflowInfluencesOutcomeOfParent};
|
|
2
|
+
import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as o}from"../../core/arrayUtils.js";import i from"../../core/Error.js";import{handlesGroup as a,makeHandle as s,abortHandle as l}from"../../core/handleUtils.js";import{clone as c}from"../../core/lang.js";import u from"../../core/Logger.js";import{getOrCreateMapValue as p}from"../../core/MapUtils.js";import{debounce as d,isPromiseLike as f,whenOrAbort as y}from"../../core/promiseUtils.js";import{watch as m,on as h,whenOnce as g,when as b}from"../../core/reactiveUtils.js";import{px2pt as w}from"../../core/screenUtils.js";import{addMany as I}from"../../core/SetUtils.js";import{isSharedTemplateOrMetadata as v,isSharedGroupTemplate as T,getCreationAttributes as F,isSharedPresetTemplate as j}from"../../editing/templateUtils.js";import{isCurvedGeometry as k,hasUnsupportedCurve as A}from"../../geometry/support/curves/curveUtils.js";import S from"../../layers/GraphicsLayer.js";import{featureHasFields as O,fixFields as U,getDisplayFieldName as L}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as V}from"../../layers/support/layerUtils.js";import{calculateTolerance as M}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as x}from"../../renderers/support/lengthUtils.js";import{isRenderer as q}from"../../renderers/support/typeUtils.js";import{getTransformationType as z}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{isGraphic as E}from"../../support/graphicInstanceUtils.js";import P from"../../symbols/SimpleFillSymbol.js";import R from"../../symbols/SimpleLineSymbol.js";import C from"../../symbols/SimpleMarkerSymbol.js";import{to3D as D}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as G}from"../../symbols/support/symbolUtils.js";import{getServices as B}from"../../undoredo/support/Services.js";import{defaultDrawingMode as N}from"../../views/draw/drawingModes.js";import{updateGraphicSymbolWhenRequired as Z,fetchFullFeaturesByObjectId as W}from"../../views/draw/support/editingSessionUtils.js";import{createQueryGeometry as $}from"../../views/support/drapedUtils.js";import{filterGraphicHits as Q,hitTestSelectSimilarDistance as H}from"../../views/support/hitTestSelectUtils.js";import{isNextOrLegacyUpdateWorkflow as J,isNextOrLegacyUpdateFeaturesWorkflow as K}from"./compatibilityAdapters.js";import{dependencySort as X}from"./support/dependencySort.js";import{isDrawGraphicTool as Y,isDrawTool as _}from"../Sketch/support/sketchUtils.js";const ee=()=>u.getLogger("esri.widgets.Editor.workflowUtils");function te(e){return oe(e)||ne(e)}function re(e){return!!e&&"features"in e}function ne(e){return null!=e&&"update-features"===e.type}function oe(e){return null!=e&&e.type.includes("update-")&&"fullFeature"in e}function ie(e){return null!=e&&"merge-features"===e.type}function ae(e){return null!=e&&"split-feature"===e.type}function se(e){const t=e?.type;return"update-feature"===t||"update-table-record"===t||"update-features"===t||"split-feature"===t}function le(e){return"merge"===e?.type}function ce(e){return"split"===e?.type}function ue(e){return ie(e)||ae(e)}function pe(e){return"update-multiple"===e?.type}function de(e){const t=e&&"renderer"in e?e.renderer:null;if(!we(t))return{rotation:null,size:null};const r=t.getVisualVariablesForType("rotation").filter(e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression),n=t.getVisualVariablesForType("size").filter(e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&"real-world-size"===z(e));return{rotation:1===r.length?r[0]:null,size:1===n.length?n[0]:null}}function fe(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&we(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=de(t);let o=null,i=null;if(r){const e=t.fields?.filter(e=>e.name===r.field),n=1===e?.length?e[0]:null;o=ye(r,n)}if(n){const e=t.fields?.filter(e=>e.name===n.field),r=1===e?.length?e[0]:null;i=ge(n,r)}return{rotation:o,size:i}}function ye(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=t?.type??"double",o={initial:0,current:0};return{field:e.field,fieldType:n,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(o.current=o.initial-r*e,be((o.current+360)%360,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function me(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function he(e,t,r){if(null==t)return 0;const{symbol:n}=D(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const o=n.symbolLayers.at(0);if(!o)return 0;switch(o.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min(rt.icon,(await e(o,rt.icon))[0])||rt.icon}case"text":return rt.text;case"line":return rt.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return me(await t(o,e.scale/rt.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/rt.viewScaleSizeFactor;default:return 0}}function ge(e,t){const r=e.axis,n=t?.type??"double",o={initial:0,current:0},i=x[e.valueUnit]??1;let a;return a="area"===e.valueRepresentation?e=>(e*i/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*i/2:e=>e*i,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>be(a(await he(t,e,r)),n),getValue:(e,t)=>(o.initial||(o.initial=t.pixelSizeAt(t.center)),o.current=o.initial*e,be(o.current,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,displayUnit:it(e.valueUnit),axis:e.axis}}function be(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function we(e){if(!q(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}function Ie(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const n={mode:N,optionsPerTool:r};if(v(t)){const o=t.defaultTool,i=T(t)?t.definition?.inputGeometryType??e:e;switch(o){case"freehand":case"stream-line":return{tool:"polyline"===i?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===i?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const o=t.drawingTool;if("circle"===o||"ellipse"===o)return r.get("circle").preserveAspectRatio="circle"===o,{tool:"circle",createOptions:n};if("rectangle"===o)return{tool:"rectangle",createOptions:n};if("freehand"===o)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function ve(e,t,r){const{creationInfo:n,fullTemplate:o}=r;if(!n)throw new i("featureworkflow","No creation info provided.");const a=n.layer,s=F(o,n.attributeOverrides,n.layer),{view:l}=e,c="2d"===l?.type;T(o)||j(o)||await Ce(e,a,s,c?l.scale:null);const{capabilities:u}=a;t.elevationInfo=a.elevationInfo;const p=Ie(a.geometryType,o);e.defaultCreateOptions={graphicProperties:{attributes:s,sourceLayer:a},mode:p.createOptions.mode,optionsPerTool:p.createOptions.optionsPerTool,preserveAspectRatio:p.createOptions.preserveAspectRatio,hasZ:u.data.supportsZ,defaultZ:(c?u.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==n.geometryToPlace?await e.create(p.tool):await e.place(n.geometryToPlace,{graphicProperties:{attributes:s,sourceLayer:a}})}async function Te(e){return a([Fe(e),je(e)])}function Fe({creationAttributes:e,data:t,sketchViewModel:r,view:n}){const{creationInfo:o}=t,{fullTemplate:i}=t;if(!o||"2d"!==n?.type||T(i)||j(i))return null;const a=d(t=>Ce(r,o.layer,e,t));return m(()=>n.scale,e=>a(e))}function je({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:o}=t;if(!o)return null;const l=r.activeComponent;if(!n||!Y(l)&&!_(l))return ee().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new S({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:p}=o,d=n.theme?.accentColor??new e([255,165,0,1]);return a([h(()=>l,["cursor-update","vertex-add"],()=>{c.removeAll();const e=Y(l)?l.graphic?.geometry:l.unprocessedGeometry;if(!e||!ke(e))return;const t=u(e,"digitizing");if(!f(t))for(const r of t.edits){const e=p.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=Ae(e,d);t&&c.add(t)}}}),s(()=>{n.map.remove(c),c.destroy()})])}function ke(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":{if(k(e))return e.curvePaths[0].length>1;const t=e.paths[0];return!!t&&t.length>1}case"polygon":{if(k(e))return e.curveRings[0].length>2;const t=e.rings[0];return!!t&&(n(t.at(0),t.at(-1))?t.length>2:t.length>1)}default:return!1}}function Ae(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new C({angle:0,color:r,outline:new R({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":n=new P({color:r,outline:new R({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new R({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:n,attributes:{...e.attributes}})}function Se(e,t){const r=B(t),n=V(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}function Oe(e,t){const r=Se(e,t);if(!r)return new Map;const n=new Map;for(const o of r.layersAndTables)p(n,o.layerId,()=>[]).push(o);return n}function Ue(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function Le(e){const{edits:t,serviceInfo:n,view:o,findOriginalFeature:i}=e,a=Ve(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=xe(t,a,i),p=qe(l,Me(s,c),c);if(o&&Pe(l,p,o),0===p.length)return t;const d=X(p,{continueOnCircularDependency:!0}).map(e=>u.get(e)).filter(r),f=new Map;for(const r of d)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of d){const{layer:e}=r;switch(null==h?h=Ue(e):h.id!==e.layerId&&(m.push(h),h=Ue(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find(t=>t.id===e)??Ue(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function Ve(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function Me(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(ze(n,e),""),t.has(e.relatedTableId)){const o=t.get(e.relatedTableId);if(o.length>0)for(const t of o[0].layer.relationships??[])if(t.id===e.id){r.set(ze(n,e),t.keyField);break}}return r}function xe(e,t,r){const n=new Map,o=[],a=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});n.set(c.layerId,e);for(const t of e)o.push(t),a.set(t.uniqueId,t)}return{allEditData:o,editDataByIdMap:a,editDataByLayerIdMap:n}}function qe(e,t,r){const n=[];for(const o of e){const e=o.layer.relationships??[],{uniqueId:i}=o;for(const a of e){const e=a.keyField;if("origin"===a.role){const s=r.get(a.relatedTableId);if(!s||0===s.length)continue;const l=ze(o.layer,a),c=t.get(l);if(void 0===c||""===c)continue;switch(o.operationType){case"add":for(const t of s)t!==o&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===o.after.attributes[e]&&n.push([i,t.uniqueId]));break;case"modify":if(o.before.attributes[e]!==o.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==o&&("delete"===t.operationType?t.before.attributes[c]===o.before.attributes[e]?n.push([r,i]):t.before.attributes[c]===o.after.attributes[e]&&n.push([i,r]):"add"===t.operationType?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):t.after.attributes[c]===o.before.attributes[e]&&n.push([r,i]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):n.push([r,i]):n.push([i,r])))}break;case"delete":for(const t of s)t!==o&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===o.before.attributes[e]&&n.push([t.uniqueId,i]))}}}}return n}function ze(e,t){return`${e.layerId}:${t.id}`}function Ee(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some(t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId)))}function Pe(e,t,r){const n=[];for(const i of e)Ee(i.layer,r)&&n.push(i);if(0===n.length)return;let o=[];for(const i of n){const r=i.layer;switch(i.operationType){case"delete":o=[...Re(i.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Re(i.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([i.uniqueId,e.uniqueId]);break;case"add":o=[...Re(i.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Re(i.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([e.uniqueId,i.uniqueId])}}}function Re(e,t){const r=[],n=t.filter(({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField);for(const o of n){const t=o.layer.globalIdField;("before"in o&&o.before?.attributes[t]===e||"after"in o&&o.after?.attributes[t]===e)&&r.push(o)}return r}async function Ce(e,r,n,o){const i=new t({sourceLayer:r,attributes:n}),{rotation:a,size:s}=fe(i);let l=await G(i,{useSourceLayer:!0,scale:o}),c=!1;for(const t of[s,a]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(l,e.view),c=!0)}switch(c&&(l=await G(i,{useSourceLayer:!0,scale:o})),l?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=l;break;case"simple-line":case"line-3d":e.polylineSymbol=l;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=l;break;case"mesh-3d":e.meshSymbol=l}De(e.tooltipOptions,s,a)}function De(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function Ge(e,t){return e.find(e=>e.layer===t)}function Be(e,t){const r=Ge(e,t);if(null==r)throw new i("no-editorItem-found","The EditorViewModel provided did not have an EditorItem associated with the specified layer");return r}function Ne(e,t){return e?.find(e=>e.layer===t)}async function Ze(e,t,r,n){switch(t.type){case"3d":return We(e,t,r,n);case"2d":return $e(e,t,r,n)}}async function We(e,t,r,n){if(0===e.length)return[];const{updatable:i,graphicsByLayer:a}=await r.defer(async()=>{const{results:o}=await y(H(t,r),n),i=new Map,a=e=>{const t=e.layer,r=i.get(t);if(!r){const e=new Array;return i.set(t,e),e}return r};Q(o).forEach(({graphic:e})=>a(e).push(e));const s=e.filter(({capabilities:e,layer:t})=>e.update.enabled&&i.has(t));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:i}});return y(Promise.allSettled(i.map(async({layer:e})=>{const t=a.get(e),r=Qe(e);if(t.every(e=>O(e,r)))return t;const i=[];for(const n of t){i.push(n.getObjectId());const e=Object.keys(n.attributes);o(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=i,s.outFields=U(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then(({features:e})=>e)})),n)}async function $e(e,t,r,n){if(0===e.length)return[];const{mapPoint:o}=r;if(null==o)return[];let i=null;const a=await r.defer(async()=>{const{results:o}=await y(t.hitTest(r),n);if(0===o.length)return[];const a=new Set;i=Q(o),i.forEach(({graphic:e})=>e&&a.add(e.layer));const s=e.filter(e=>a.has(e.layer)&&e.supportsUpdateWorkflow);return s.length>0&&r.stopPropagation(),s});return y(Promise.allSettled(a.map(async({layer:e})=>{const a=e.createQuery();a.returnGeometry=!0,a.outFields=Qe(e);const s="renderer"in e?M({renderer:e.renderer,pointerType:r.pointerType}):0;a.geometry=$(o,s,t),a.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(a,{signal:n});return i?.forEach(({graphic:t})=>{t.layer!==e||l.some(e=>e.getObjectId()===t.getObjectId())||l.push(t)}),l})),n)}function Qe(e){return U(e.fieldsIndex,[e.objectIdField,L({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function He(e,t,n,o){const i=e.map(e=>e.getObjectId()??e.attributes[t.objectIdField]).filter(r);return await W(i,t,n,o)}async function Je(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,updateOptions:o,visualVariables:i}=e;await Xe(e);const a={multipleSelectionEnabled:!1,...o};return"point"===n.geometryType&&(a.enableRotation=null!=i.rotation,a.enableScaling=null!=i.size),r.update(t,a)}function Ke(e,t){const{activeUpdateOptions:r}=e;r&&(e.activeUpdateOptions={...r,...t,reshapeOptions:{...r.reshapeOptions,...t.reshapeOptions},highlightOptions:{...r.highlightOptions,...t.highlightOptions}})}async function Xe(e){const{graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:o,visualVariables:i}=e;let a=!1;const{rotation:s,size:l}=i;for(const c of[s,l]){if(null==c)continue;const e=t.getAttribute(c.field);if(null!=e)c.setInitialValue(e);else{const e=await c.getDefaultValue(t.symbol,n.view);c.setInitialValue(e),t.setAttribute(c.field,e),a=!0}}if(a){const e="2d"===n.view?.type?n.view.scale:null;await Z(t,e)}De(n.tooltipOptions,l,s),r.elevationInfo=o.elevationInfo}function Ye(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function _e(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function et(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const o=t.attributes;let i=!1;const a=n.rotation,s=Ye(r.toolEventInfo);if(null!=a&&null!=s){const{field:r,getValue:n}=a;if("rotate-stop"===s.type)a.isUpdatingInteractively=!1,a.setInitialValue(t.getAttribute(r));else{a.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==o[r]&&t.setAttribute(r,l),i=!0}}const l=n.size,c=_e(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const a=n(c.xScale,e);a!==o[r]&&t.setAttribute(r,a),i=!0}}return i}async function tt({feature:e,featureClone:t,sketchLayer:r,sketchViewModel:n,getUpdateOptions:o,view:i,visualVariableAttributes:c,addHandle:u,addUpdatingPromise:p,onUpdate:f}){await Z(t,"2d"===i.type?i.scale:null);let y=null;if("2d"===n?.view?.type){const e=d(e=>Z(t,e));y=m(()=>n?.view?.scale,t=>e(t))}const h=t.sourceLayer,w=st(i,h);await Je({graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:h,updateOptions:o(),visualVariables:c});let I=null;w.then(e=>I=e).catch(()=>{});const v=c.size,T=c.rotation,F=m(()=>e.attributes,async e=>{let r=!1;for(const n in e){const o=e[n];o!==t.getAttribute(n)&&(t.setAttribute(n,o),null==v||v.isUpdatingInteractively||v.field!==n||v.setInitialValue(o),null==T||T.isUpdatingInteractively||T.field!==n||T.setInitialValue(o),(null==I||I.requiredFields.includes(n))&&(r=!0))}r&&await Z(t,"2d"===i.type?i.scale:null)}),j=n.on("update",async e=>{const t=e.graphics[0],a={graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:h,updateOptions:o(),visualVariables:c};if("complete"===e.state){const e=new AbortController,t=l(e);return u(t),p(g(()=>null===i.activeTool,e.signal).then(async()=>{if(!e.signal.aborted)return e.abort(),Je(a)}))}et(i,t,e,c)&&await Z(t,"2d"===i.type?i.scale:null),f(ct(t),e)}),k=b(()=>null!=i.activeTool&&i.activeTool!==n.activeComponent,()=>n.cancel()),A=n.on(["undo","redo"],e=>{f(ct(e.graphics[0]),e)});return a([A,j,k,s(()=>n.cancel()),F,y])}const rt={icon:w(24),text:w(12),line:w(1),viewScaleSizeFactor:100};function nt(e,t,r){let n=!1;return e.filter(e=>!!n||(n=e===t,n)).map(e=>r[e]())}function ot(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const n=r.layer,o=e.viewModel.getTemplatesForLayer(n);1===o.length&&"scene"!==n.type&&(r.template=o[0],t.shift())}return t}function it(e){return"unknown"===e?null:e}const at=e=>e.includes("-stop")||e.includes("vertex-"),st=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function lt(e){return"createInteractiveEditSession"in e}function ct(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=c(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function ut(e){return e.acquireCursor("progress")}function pt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:o}=t;e.setAttribute(r,n.getAttribute(o))}}function dt(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach(e=>pt(e.relationships)),t.flatMap(e=>e.edits)):null}function ft(e){const t=J(e)?e.activeWorkflow:e;if(null==t)return[];if(K(t))return t.data.layers;const r=t.layer;return r?[r]:[]}function yt({attributes:e},t){const r=new Set;r.add(t.objectIdField),"uniqueIdFields"in t&&t.uniqueIdFields&&t.uniqueIdFields.length>0&&I(r,t.uniqueIdFields);const n={};for(const o of r)null!=e[o]&&(n[o]=e[o]);if("scene"===t.type&&null!=t.infoFor3D){const r=t.associatedLayer?.globalIdField;null!=r&&(e[r]=e[r])}return n}function mt(e){if(!ht(e))return e;const t=new Map;for(const r of e){const e=r.getObjectId();if(null!=e){const n=r.sourceLayer??r.layer;p(t,n,()=>[]).push(e)}}return Array.from(t.entries()).map(([e,t])=>({layer:e,objectIds:t}))}function ht(e){return 0===e.length||E(e[0])}function gt({drawTool:e},t){const r=e?.mostDownstreamPlugin?.configuration?.curveTypes;if(!t||!r||0===r.length)return!1;const n=new Set(t.capabilities.supportedCurveTypes);return r.some(e=>!n.has(e))}function bt(e,t){const r=new Set(t.capabilities.supportedCurveTypes);return e.some(({geometry:e})=>e&&k(e)&&A(e,r))}function wt({filter:e,forEachFeature:t,forEachValueChange:r}){return n=>{for(const{feature:o,changes:i}of n.data)if(!e||e(o)){for(const{fieldName:e,value:t}of i)r?.(e,t,o);t?.(o,i)}}}export{gt as activeSketchToolDrawsUnsupportedCurve,Pe as appendAllUtilityNetworkAssociationRelationships,ot as avoidFeatureTemplateSelectionWithOnlyOneItem,lt as canCreateInteractiveEditSession,ct as cloneGraphicExceptMesh,bt as containsUnsupportedCurve,Ve as createLayerIdMap,Me as createRelationshipKeyMap,Ie as createToolFromGeometryType,nt as createWorkflowSteps,Ze as fetchCandidates,He as fetchFullFeatures,qe as findAllDependencies,Re as findChangesByGlobalId,Ge as findEditorItemForLayer,Be as findEditorItemForLayerOrThrow,Ne as findLayerInfo,ze as generateHashForRelationship,ft as getLayersFromWorkflow,ye as getRotationVariableAttribute,dt as getServiceEditsFromWorkflowData,Se as getServiceInfoForLayer,Oe as getServiceLayersById,ge as getSizeVariableAttribute,fe as getVisualVariableAttributes,de as getVisualVariablesForLayer,wt as handleFormValuesChangeEvent,te as isAnyUpdateLeafWorkflow,re as isBatchAttributeFormViewModel,ht as isGraphicsArray,ie as isMergeFeaturesWorkflow,le as isMergeWorkflowOptions,se as isParentWorkflow,ae as isSplitFeatureWorkflow,ce as isSplitWorkflowOptions,at as isTerminalUpdateEventType,ne as isUpdateFeaturesWorkflow,pe as isUpdateFeaturesWorkflowOptions,oe as isUpdateRecordWorkflow,Ee as isUtilityNetworkAssociationsTable,yt as makeMinimalAttributes,Le as orderEditsByRelationshipDependencies,pt as setRelationshipFields,tt as setUpGeometryUpdate,Te as setUpSketchCreateWatchers,Xe as setVisualVariablesAndElevationInfoForUpdate,ut as showProgressCursor,rt as sizeDefaults,it as sizeVariableUnitToLengthUnit,ve as startCreatingNewFeature,Je as startUpdatingFeatureGeometry,Ke as syncUpdateOptions,mt as toFeatureInfos,et as visualVariableInteractiveUpdate,st as whenEditorLayerView,ue as workflowInfluencesOutcomeOfParent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{rad2deg as e}from"../../core/mathUtils.js";import{throwIfAborted as t}from"../../core/promiseUtils.js";import{createArea as n,createLength as r}from"../../core/quantity.js";import{formatArea as a,formatLength as o}from"../../core/quantityFormatUtils.js";import{set as i,determinant as c}from"../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as l,fromValues as u}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{distance as f}from"../../core/libs/gl-matrix-2/math/vec2.js";import{set as m,cross as p,sub as h}from"../../core/libs/gl-matrix-2/math/vec3.js";import{isSupported as y,geodesicLengths as g,geodesicAreas as w}from"../../geometry/geodesicUtils.js";import x from"../../geometry/Point.js";import v from"../../geometry/Polygon.js";import R from"../../geometry/Polyline.js";import{projectAsync as d,project as M}from"../../geometry/projectionUtils.js";import P from"../../geometry/SpatialReference.js";import{e as z}from"../../chunks/areaOperator.js";import{l as j,e as b}from"../../chunks/geodeticAreaOperator.js";import{l as E,e as S}from"../../chunks/geodeticDensifyOperator.js";import{l as L,e as O}from"../../chunks/geodeticLengthOperator.js";import{e as W}from"../../chunks/lengthOperator.js";import{e as I}from"../../chunks/simplifyOperator.js";import{imageToWorldPanoramic as q,imageToWorld as G}from"../../layers/orientedImagery/transformations/imageToWorld.js";import{getImageToWorldPanoramicProperties as k,getUpdateElevationProps as A,convertSphereVertexToPixelLocation as D,getImageToWorldProperties as U,scaleWithFactor as B}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImagePanoramic as H,worldToImage as F}from"../../layers/orientedImagery/transformations/worldToImage.js";const T=1e5,V="meters",C="square-meters";function J(e,t){let n=180*Math.atan2(-e.y+t.y,e.x-t.x)/Math.PI;return n<0&&(n+=180),n*Math.PI/180}function K(e,t){let n=180*Math.atan2(-e.y+t.y,e.x-t.x)/Math.PI;return n<0&&(n+=180),n*Math.PI/180}function N(e,t,n){if(!e?.length||!t?.length||!n)return;const[r,a]=e,[,o]=t,i=o-a;return[r+i*Math.cos(n),a+i*Math.sin(n)]}async function Q(e,t,n){if(await E(),y(e)){const e=g([t],V)[0];return{area:w([n],C)[0],perimeter:e}}const r=P.WGS84,a=M(t,r),o=M(n,r);let i=S(o,T);if(i=i?I(i):null,!i)return null;const c=g([a],V)[0];return{area:w([i],C)[0],perimeter:c}}function X(e,t,n=1){const r=Re(e,!1);if(!r?.length)return;return 20*f([r[0].x,r[0].y],[r.at(-1).x,r.at(-1).y])*n/t}async function Y(e){await L();const t=e.spatialReference;if(t.isGeographic){if(y(t))return g([e],V)[0];const n=M(e,P.WGS84);return g([n],V)[0]}return t.isWebMercator?O(e,{unit:V}):W(e,{unit:V})}function Z(e){if(!e?.length)throw new Error("Invalid deviations array");const[t,n,r]=[0,1,2].map(t=>e.map(e=>e[t]).filter(e=>null!==e)).map(e=>e.length?be(e):0);return[t,n,r]}function $(e,t){const n=I(t);if(!n)return null;const r=W(e,{unit:V});return{area:z(n,{unit:C}),perimeter:r}}function _(e,t){return[(e[1][0]-e[0][0])/t,(e[1][1]-e[0][1])/t,(e[1][2]-e[0][2])/t]}async function ee(e,t){await Promise.all([j(),E(),L()]);let n=S(t,T);if(n=n?I(n):null,!n)return null;const r=O(e,{unit:V});return{area:b(n,{unit:C}),perimeter:r}}async function te(e,n,r){if(!n||!e)throw new Error("Missing required parameters");const a=await G(e,n);t(r);const o=a.clone();o.z?o.z+=20:o.z=20;const{averageElevation:i,cameraPitch:c,cameraRoll:s,farDistance:l,...u}=n;return F(o,u)}async function ne(e,n,r,a){const{attributes:o}=r,{location:i}=o,{updateElevationProps:c,...s}=n;if(!e||!n)throw new Error("Missing parameters");let l=i.clone();l.spatialReference.isGeographic&&(l=await d(l,P.WebMercator));const u=await q(e,{...s,cameraLocation:l},c);t(a);const f=u.clone();return f.z?f.z+=20:f.z=20,H(f,s)}function re(e,t,n,r,a=0,o=1,i){const{averageElevation:c,cameraPitch:s,cameraRoll:l,farDistance:u,...m}=r;if(a>=5||o<=.1){return{value:e*Oe(r.cameraLocation.spatialReference)}}const p=new x({x:t.x,y:t.y,z:t.z?t.z+e:e,spatialReference:r.cameraLocation.spatialReference}),h=F(p,m),y=f([n[0].x,n[0].y],[h.x,h.y]),g=n.at(0),w=n.at(-1);if(!g||!w)return null;const v=f([g.x,g.y],[w.x,w.y])*e/y;return re(v,t,n,r,a+1,Math.abs(e-v))}function ae(e,t,n,r,a=0,o=1,i){const{averageElevation:c,horizontalFieldOfView:s,verticalFieldOfView:l,farDistance:u,...m}=r;if(a>=5||o<=.1){return{value:e*Oe(r.cameraLocation.spatialReference)}}const p=new x({x:t.x,y:t.y,z:t.z?t.z+e:e,spatialReference:r.cameraLocation.spatialReference}),h=H(p,m),y=f([n[0].x,n[0].y],[h.x,h.y]),g=n.at(0),w=n.at(-1);if(!g||!w)return null;const v=f([g.x,g.y],[w.x,w.y])*e/y;return ae(v,t,n,r,a+1,Math.abs(e-v))}async function oe(e,t,n){return e.spatialReference&&!t.spatialReference.equals(e.spatialReference)&&(t=await d(t,e.spatialReference)),new R({paths:[[[e.x,e.y,e.z??0],[t.x,t.y,t.z??0]]],spatialReference:n})}function ie(e){return 1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e/6378137)))}function ce(e,t){return Math.sqrt((Math.sqrt((e[0][0]-e[1][0])**2+(e[0][1]-e[1][1])**2)/t)**2+(e[0][2]-e[1][2])**2)}function se(e,t){return Math.sqrt((e[0][0]-e[1][0])**2+(e[0][1]-e[1][1])**2)/t}function le(t){return e(Math.atan((t[1][2]-t[0][2])/Math.sqrt((t[1][0]-t[0][0])**2+(t[1][1]-t[0][1])**2)))}function ue(t){let n=90-e(Math.atan2(t[1][1]-t[0][1],t[1][0]-t[0][0]));return n<0&&(n+=360),n}function fe(e,t){return new x({x:(e.pointOnA[0]+e.pointOnB[0])/2,y:(e.pointOnA[1]+e.pointOnB[1])/2,z:(e.pointOnA[2]+e.pointOnB[2])/2,spatialReference:t})}async function me(e){if(2===e?.length){const t=[];let n=1;const[r,a]=e,o=r.camera.spatialReference,{measurePoints:i}=r;for(let e=0;e<i.length;e++){const i=await oe(r.camera,r.measurePoints[e],o),c=await oe(a.camera,a.measurePoints[e],o),s=await Fe(i,c);if(!s)return null;const l=fe(s,o);l.spatialReference.isWebMercator&&(n=ie(l.y)),t.push([l.x,l.y,l.z??0])}if(t?.length>1){return{distance:ce(t,n),horizontalDistance:se(t,n),verticalDistance:Math.abs(t[0][2]-t[1][2]),slope:le(t),aspect:ue(t)}}}return null}async function pe(e){const t=e[0].camera.spatialReference;if(2!==e?.length)return null;const[n,r]=e,{camera:a,measurePoints:o}=n,{camera:i,measurePoints:c}=r,s=await oe(a,o[0],t),l=await oe(i,c[0],t),u=await Fe(s,l);return u?fe(u,t)??null:null}async function he(e,t){if(!e?.length)return null;const n=[],r=e[0],a=e[1],o=r.camera.spatialReference,{measurePoints:i}=r;for(let u=0;u<i.length;u++){const e=await oe(r.camera,r.measurePoints[u],o),t=await oe(a.camera,a.measurePoints[u],o),i=await Fe(e,t);if(!i)return null;const c=fe(i,o);n.push([c.x,c.y,c.z??0])}if(n?.length<2)return null;const c=new R({paths:[n],spatialReference:t}),s=new v({rings:[n],spatialReference:t});if(t.isGeographic){const e=await Q(t,c,s);return e?.area??null}if(t.isWebMercator){const e=await ee(c,s);return e?.area??null}const l=$(c,s);return l?.area??null}function ye(e,t){if(!e)return null;return{camera:t.geometry.clone(),measurePoints:Array.isArray(e)?e:[e]}}async function ge(e,t){const{updateElevationProps:n,...r}=t;return await G(e,r,n)}async function we(e,t){const{updateElevationProps:n,...r}=t;return q(e,r,n)}function xe(e){navigator.clipboard.writeText(e).catch(e=>{throw e})}function ve(e){const t=e.map(e=>[e.x,e.y]),n=e[0].spatialReference;return new R({paths:[t],spatialReference:n})}function Re(e,t){return e.map(e=>({x:t?.5+e[0]:e[0],y:t?.5-e[1]:e[1]}))}function de(e,t,n,a,i){const c="measurement"===e?t:n;if(i&&c)return o(a,r(c,V),i,3)||null}function Me(e,t){const{cameraPitch:n,cameraRoll:r,cameraLocation:a}=e,{x:o,y:i,z:c,spatialReference:s}=a;if(t.every(e=>0===e)||!t||!t.length||!s)throw new Error("Invalid parameters");const[l,u,,f,m]=t,p=[-f,0,f],h=[-m,0,m],y=[-l,0,l],g=[-u,0,u],w=[];for(const x of p)for(const t of h)for(const a of y)for(const l of y)for(const u of g){const f={...e};f.cameraPitch=n+x,f.cameraRoll=r+t,f.cameraLocation={x:o+a,y:i+l,z:c?c+u:0,spatialReference:{wkid:s.wkid}},w.push(f)}return w}function Pe(e,t){const{cameraHeading:n,cameraLocation:r}=e,{x:a,y:o,z:i,spatialReference:c}=r;if(!t||t.every(e=>0===e)||!t.length||!c)throw new Error("Invalid parameters");const[s,l,u]=t,f=u>0?[-u,0,u]:[],m=s>0?[-s,0,s]:[],p=l>0?[-l,0,l]:[],h=[];for(const y of f)for(const t of m)for(const r of m)for(const s of p){const l={...e};l.cameraHeading=n+y,l.cameraLocation={x:a+t,y:o+r,z:i?i+s:0,spatialReference:{wkid:c.wkid}},h.push(l)}return h}function ze(e,t,n,a,i){const c="measurement"===e?t:be(n);if(i&&c)return o(a,r(c,V),i,3)||null}function je(e,t,r,o,i){const c="measurement"===e?t:r;if(i&&c)return a(o,n(c,C),i,3)||null}function be(e){return Math.sqrt(e.reduce((e,t)=>e+t**2,0))}function Ee(e,t,n){if(!e||!t)return;const{elevationSample:r,attributes:a}=e,{elevationSource:o,cameraHeight:i}=a,c=U(a,t[0],t[1]);let s=c.cameraLocation;return(s.spatialReference.isGeographic?d(s,P.WebMercator):Promise.resolve(s)).then(e=>(s=e,A(s.spatialReference,s.z??0,i,{elevationSample:r,elevationSource:o,extent:n}))).then(t=>("elevationSample"in t&&(e.elevationSample=t.elevationSample),{...c,cameraLocation:s,updateElevationProps:t}))}function Se(e,t,n){if(!e||!t)return;const{elevationSample:r,attributes:a}=e,{elevationSource:o,cameraHeight:i}=a,c=k(a,t[0],t[1]);let s=c.cameraLocation;return(s.spatialReference.isGeographic?d(s,P.WebMercator):Promise.resolve(s)).then(e=>(s=e,A(s.spatialReference,s.z??0,i,{elevationSample:r,elevationSource:o,extent:n}))).then(t=>("elevationSample"in t&&(e.elevationSample=t.elevationSample),{...c,cameraLocation:s,updateElevationProps:t}))}function Le(e,t,n){if("default"===t)return e;const r={x:e[0],y:e[1],z:e[2]},a=D(r,n[0],n[1]);return[a.x,a.y]}function Oe(e){return e.metersPerUnit}function We(e,t,n,r){let a=[];return a="panoramic"===t?e.map(([e,t,a])=>{const{x:o,y:i}=D({x:e,y:t,z:a},n[0],n[1],r);return[o-.5,-.5-i]}):e.map(([e,t])=>[e-.5,-.5-t]),a}function Ie(e,t,n){return e.map(e=>D({x:e[0],y:e[1],z:e[2]},t[0],t[1],n))}async function qe(e,n,r,a=!1,o=!1,i){if(!e||!n||e.length<2)return null;const c=Re(e,a);if(!c||c.length<2)return null;const[s,l]=[c[0],c.at(-1)];if(!l)return null;const u=[s],m=await G(s,n);t(i);const p=m.clone();p.z?p.z+=20:p.z=20;const{averageElevation:h,cameraPitch:y,cameraRoll:g,farDistance:w,...x}=n,v=F(p,x),R=f([s.x,s.y],[v.x,v.y]),d=J(s,v);if(!d)return;const M=N([s.x,s.y],[l.x,l.y],d);if(!M?.length)return;u.push({x:M[0],y:M[1]});const P=20*f([u[0].x,u[0].y],[u[1].x,u[1].y])*Oe(n.cameraLocation.spatialReference)/R;if(!o)return P;const z=re(P,m,u,n,0,1);return z?.value}async function Ge(e,n,r,a,o=!1,i=!1,c){const{attributes:s}=a,{location:l}=s,{updateElevationProps:u,...m}=n;if(!e||!n||e.length<2)throw new Error("Invalid parameters");const p=Re(e,o),[h,y]=[p[0],p.at(-1)],g=[h];let w=l.clone();w.spatialReference.isGeographic&&(w=await d(w,P.WebMercator));const x=await q(h,{...m,cameraLocation:w},u);t(c);const v=x.clone();v.z?v.z+=20:v.z=20;const R=H(v,m),M=f([h.x,h.y],[R.x,R.y]),z=J(h,R);if(!z)return;const j=N([h.x,h.y],[y.x,y.y],z);if(!j?.length)return;g.push({x:j[0],y:j[1]});const b=20*f([g[0].x,g[0].y],[g[1].x,g[1].y])*Oe(n.cameraLocation.spatialReference)/M;if(!i)return b;const E=ae(b,x,g,n,0,1);return E?.value}async function ke(e,t,n){const{updateElevationProps:r,...a}=t,{updateElevationProps:o,...i}=n,c=await G(e,a,r);return F(c,i)}async function Ae(e,t,n){const{updateElevationProps:r,...a}=t,{updateElevationProps:o,...i}=n,c=await q(e,a,r);return H(c,i)}async function De(e,t,n=!1){if(e.length<3)return null;const r=Re(e,n),a=await ge(r,t),o=a.map(({x:e,y:t})=>[e,t]);e.push(e[0]),o.push(o[0]);const i=a[0].spatialReference,c=new R({paths:[o],spatialReference:i}),s=new v({rings:[o],spatialReference:i});return i.isGeographic?Q(i,c,s):i.isWebMercator?ee(c,s):$(c,s)}async function Ue(e,n,r=!1,a){if(e.length<3)return null;const o=Re(e,r),i=await we(o,n);t(a);const c=i.map(({x:e,y:t})=>[e,t]);e.push(e[0]),c.push(c[0]);const s=i[0].spatialReference,l=new R({paths:[c],spatialReference:s}),u=new v({rings:[c],spatialReference:s});return s.isGeographic?Q(s,l,u):s.isWebMercator?ee(l,u):$(l,u)}async function Be(e,t,n=!1){const r=Re(e,n);return Y(ve(await ge(r,t)))}async function He(e,n,r=!1,a){const o=Re(e,r),i=await we(o,n);t(a);return Y(ve(i))}async function Fe(e,t){const n=s(),r=e.paths[0][0],a=t.paths[0][0];let o,l;e.spatialReference.isWGS84||e.spatialReference.isWebMercator?(await L(),o=O(e),l=O(t)):(o=W(e),l=W(t));const u=_(e.paths[0],o),f=_(t.paths[0],l),m=Te(u,f),[p,h,y]=u,[g,w,x]=f.map(e=>-e),[v,R,d]=m,[M,P,z]=[a[0]-r[0],a[1]-r[1],a[2]-r[2]];i(n,p,g,v,h,w,R,y,x,d);const j=c(n);if(0===j)return null;i(n,M,g,v,P,w,R,z,x,d);const b=c(n);i(n,p,M,v,h,P,R,y,z,d);const E=c(n);i(n,p,g,M,h,w,P,y,x,z);const S=b/j,I=E/j,q=c(n)/j;return{distance:Math.abs(q/Math.sqrt(m[0]*m[0]+m[1]*m[1]+m[2]*m[2])),pointOnA:Ve(r,S,u),pointOnB:Ve(a,I,f)}}function Te(e,t){const n=l(),r=m(l(),e[0],e[1],e[2]),a=m(l(),t[0],t[1],t[2]),o=p(n,r,a);return[o[0],o[1],o[2]]}function Ve(e,t,n){return[e[0]+t*n[0],e[1]+t*n[1],e[2]+t*n[2]]}function Ce(e,t){const n=u(e[0],e[1],e[2]),r=u(t[0],t[1],t[2]);return h(l(),n,r)}function Je(e,t,n){const r=B(e,t,n);return[r[0],r[1],r[2]]}export{J as calculateAngle,K as calculateAnglePano,N as calculateCorrectedPixel,X as calculateHeightFromTemporaryDistance,Z as calculateLocationAccuracyFromDeviations,ne as calculateReferenceImagePointPanoramic,te as calculateTempImagePoint,ie as calculateUpdatedWmsf,re as computeHeightIteratively,ae as computeHeightIterativelyPanoramic,he as computeTriangulatedAreaMeasurement,me as computeTriangulatedDistanceMeasurement,pe as computeTriangulatedPoint,ye as computeTriangulatedVector,xe as copyToClipboard,Re as formatPixels,Me as generateCombinations,Pe as generateCombinationsPanoramic,je as getConvertedArea,ze as getConvertedDistance,de as getConvertedHeight,Ee as getMeasurementProperties,Se as getMeasurementPropertiesPanoramic,Le as getModeCorrectedPoint,We as getModeCorrectedPoints,Ie as getPixelLocationFromSphereVertices,be as getRootOfSumOfSquaredErrors,Oe as getUnitRateFromSpatialReference,qe as heightMeasurement2D,Ge as heightMeasurementPanoramic,ke as imageToImageTransform,Ae as imageToImageTransformPanoramic,De as pixelAreaMeasurement2D,Ue as pixelAreaMeasurementPanoramic,Be as pixelDistanceMeasurement2D,He as pixelDistanceMeasurementPanoramic,Je as scale,Fe as solveSkewLinesIntersection,Ce as subtract};
|
|
2
|
+
import{rad2deg as e}from"../../core/mathUtils.js";import{throwIfAborted as t}from"../../core/promiseUtils.js";import{createArea as n,createLength as r}from"../../core/quantity.js";import{formatArea as a,formatLength as o}from"../../core/quantityFormatUtils.js";import{set as i,determinant as c}from"../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as l}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{distance as u}from"../../core/libs/gl-matrix-2/math/vec2.js";import{set as f,cross as m}from"../../core/libs/gl-matrix-2/math/vec3.js";import{isSupported as p,geodesicLengths as h,geodesicAreas as y}from"../../geometry/geodesicUtils.js";import g from"../../geometry/Point.js";import w from"../../geometry/Polygon.js";import x from"../../geometry/Polyline.js";import{projectAsync as v,project as R}from"../../geometry/projectionUtils.js";import d from"../../geometry/SpatialReference.js";import{e as M}from"../../chunks/areaOperator.js";import{l as P,e as z}from"../../chunks/geodeticAreaOperator.js";import{l as j,e as b}from"../../chunks/geodeticDensifyOperator.js";import{l as E,e as S}from"../../chunks/geodeticLengthOperator.js";import{e as L}from"../../chunks/lengthOperator.js";import{e as O}from"../../chunks/simplifyOperator.js";import{imageToWorldPanoramic as W,imageToWorld as I}from"../../layers/orientedImagery/transformations/imageToWorld.js";import{getImageToWorldPanoramicProperties as q,getUpdateElevationProps as G,convertSphereVertexToPixelLocation as k,getImageToWorldProperties as A}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImagePanoramic as D,worldToImage as U}from"../../layers/orientedImagery/transformations/worldToImage.js";const B=1e5,H="meters",F="square-meters";function T(e,t){let n=180*Math.atan2(-e.y+t.y,e.x-t.x)/Math.PI;return n<0&&(n+=180),n*Math.PI/180}function V(e,t){let n=180*Math.atan2(-e.y+t.y,e.x-t.x)/Math.PI;return n<0&&(n+=180),n*Math.PI/180}function C(e,t,n){if(!e?.length||!t?.length||!n)return;const[r,a]=e,[,o]=t,i=o-a;return[r+i*Math.cos(n),a+i*Math.sin(n)]}async function J(e,t,n){if(await j(),p(e)){const e=h([t],H)[0];return{area:y([n],F)[0],perimeter:e}}const r=d.WGS84,a=R(t,r),o=R(n,r);let i=b(o,B);if(i=i?O(i):null,!i)return null;const c=h([a],H)[0];return{area:y([i],F)[0],perimeter:c}}function K(e,t,n=1){const r=we(e,!1);if(!r?.length)return;return 20*u([r[0].x,r[0].y],[r.at(-1).x,r.at(-1).y])*n/t}async function N(e){await E();const t=e.spatialReference;if(t.isGeographic){if(p(t))return h([e],H)[0];const n=R(e,d.WGS84);return h([n],H)[0]}return t.isWebMercator?S(e,{unit:H}):L(e,{unit:H})}function Q(e){if(!e?.length)throw new Error("Invalid deviations array");const[t,n,r]=[0,1,2].map(t=>e.map(e=>e[t]).filter(e=>null!==e)).map(e=>e.length?Pe(e):0);return[t,n,r]}function X(e,t){const n=O(t);if(!n)return null;const r=L(e,{unit:H});return{area:M(n,{unit:F}),perimeter:r}}function Y(e,t){return[(e[1][0]-e[0][0])/t,(e[1][1]-e[0][1])/t,(e[1][2]-e[0][2])/t]}async function Z(e,t){await Promise.all([P(),j(),E()]);let n=b(t,B);if(n=n?O(n):null,!n)return null;const r=S(e,{unit:H});return{area:z(n,{unit:F}),perimeter:r}}async function $(e,n,r){if(!n||!e)throw new Error("Missing required parameters");const a=await I(e,n);t(r);const o=a.clone();o.z?o.z+=20:o.z=20;const{averageElevation:i,cameraPitch:c,cameraRoll:s,farDistance:l,...u}=n;return U(o,u)}async function _(e,n,r,a){const{attributes:o}=r,{location:i}=o,{updateElevationProps:c,...s}=n;if(!e||!n)throw new Error("Missing parameters");let l=i.clone();l.spatialReference.isGeographic&&(l=await v(l,d.WebMercator));const u=await W(e,{...s,cameraLocation:l},c);t(a);const f=u.clone();return f.z?f.z+=20:f.z=20,D(f,s)}function ee(e,t,n,r,a=0,o=1,i){const{averageElevation:c,cameraPitch:s,cameraRoll:l,farDistance:f,...m}=r;if(a>=5||o<=.1){return{value:e*Ee(r.cameraLocation.spatialReference)}}const p=new g({x:t.x,y:t.y,z:t.z?t.z+e:e,spatialReference:r.cameraLocation.spatialReference}),h=U(p,m),y=u([n[0].x,n[0].y],[h.x,h.y]),w=n.at(0),x=n.at(-1);if(!w||!x)return null;const v=u([w.x,w.y],[x.x,x.y])*e/y;return ee(v,t,n,r,a+1,Math.abs(e-v))}function te(e,t,n,r,a=0,o=1,i){const{averageElevation:c,horizontalFieldOfView:s,verticalFieldOfView:l,farDistance:f,...m}=r;if(a>=5||o<=.1){return{value:e*Ee(r.cameraLocation.spatialReference)}}const p=new g({x:t.x,y:t.y,z:t.z?t.z+e:e,spatialReference:r.cameraLocation.spatialReference}),h=D(p,m),y=u([n[0].x,n[0].y],[h.x,h.y]),w=n.at(0),x=n.at(-1);if(!w||!x)return null;const v=u([w.x,w.y],[x.x,x.y])*e/y;return te(v,t,n,r,a+1,Math.abs(e-v))}async function ne(e,t,n){return e.spatialReference&&!t.spatialReference.equals(e.spatialReference)&&(t=await v(t,e.spatialReference)),new x({paths:[[[e.x,e.y,e.z??0],[t.x,t.y,t.z??0]]],spatialReference:n})}function re(e){return 1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e/6378137)))}function ae(e,t){return Math.sqrt((Math.sqrt((e[0][0]-e[1][0])**2+(e[0][1]-e[1][1])**2)/t)**2+(e[0][2]-e[1][2])**2)}function oe(e,t){return Math.sqrt((e[0][0]-e[1][0])**2+(e[0][1]-e[1][1])**2)/t}function ie(t){return e(Math.atan((t[1][2]-t[0][2])/Math.sqrt((t[1][0]-t[0][0])**2+(t[1][1]-t[0][1])**2)))}function ce(t){let n=90-e(Math.atan2(t[1][1]-t[0][1],t[1][0]-t[0][0]));return n<0&&(n+=360),n}function se(e,t){return new g({x:(e.pointOnA[0]+e.pointOnB[0])/2,y:(e.pointOnA[1]+e.pointOnB[1])/2,z:(e.pointOnA[2]+e.pointOnB[2])/2,spatialReference:t})}async function le(e){if(2===e?.length){const t=[];let n=1;const[r,a]=e,o=r.camera.spatialReference,{measurePoints:i}=r;for(let e=0;e<i.length;e++){const i=await ne(r.camera,r.measurePoints[e],o),c=await ne(a.camera,a.measurePoints[e],o),s=await Ue(i,c);if(!s)return null;const l=se(s,o);l.spatialReference.isWebMercator&&(n=re(l.y)),t.push([l.x,l.y,l.z??0])}if(t?.length>1){return{distance:ae(t,n),horizontalDistance:oe(t,n),verticalDistance:Math.abs(t[0][2]-t[1][2]),slope:ie(t),aspect:ce(t)}}}return null}async function ue(e){const t=e[0].camera.spatialReference;if(2!==e?.length)return null;const[n,r]=e,{camera:a,measurePoints:o}=n,{camera:i,measurePoints:c}=r,s=await ne(a,o[0],t),l=await ne(i,c[0],t),u=await Ue(s,l);return u?se(u,t)??null:null}async function fe(e,t){if(!e?.length)return null;const n=[],r=e[0],a=e[1],o=r.camera.spatialReference,{measurePoints:i}=r;for(let u=0;u<i.length;u++){const e=await ne(r.camera,r.measurePoints[u],o),t=await ne(a.camera,a.measurePoints[u],o),i=await Ue(e,t);if(!i)return null;const c=se(i,o);n.push([c.x,c.y,c.z??0])}if(n?.length<2)return null;const c=new x({paths:[n],spatialReference:t}),s=new w({rings:[n],spatialReference:t});if(t.isGeographic){const e=await J(t,c,s);return e?.area??null}if(t.isWebMercator){const e=await Z(c,s);return e?.area??null}const l=X(c,s);return l?.area??null}function me(e,t){if(!e)return null;return{camera:t.geometry.clone(),measurePoints:Array.isArray(e)?e:[e]}}async function pe(e,t){const{updateElevationProps:n,...r}=t;return await I(e,r,n)}async function he(e,t){const{updateElevationProps:n,...r}=t;return W(e,r,n)}function ye(e){navigator.clipboard.writeText(e).catch(e=>{throw e})}function ge(e){const t=e.map(e=>[e.x,e.y]),n=e[0].spatialReference;return new x({paths:[t],spatialReference:n})}function we(e,t){return e.map(e=>({x:t?.5+e[0]:e[0],y:t?.5-e[1]:e[1]}))}function xe(e,t,n,a,i){const c="measurement"===e?t:n;if(i&&c)return o(a,r(c,H),i,3)||null}function ve(e,t){const{cameraPitch:n,cameraRoll:r,cameraLocation:a}=e,{x:o,y:i,z:c,spatialReference:s}=a;if(t.every(e=>0===e)||!t||!t.length||!s)throw new Error("Invalid parameters");const[l,u,,f,m]=t,p=[-f,0,f],h=[-m,0,m],y=[-l,0,l],g=[-u,0,u],w=[];for(const x of p)for(const t of h)for(const a of y)for(const l of y)for(const u of g){const f={...e};f.cameraPitch=n+x,f.cameraRoll=r+t,f.cameraLocation={x:o+a,y:i+l,z:c?c+u:0,spatialReference:{wkid:s.wkid}},w.push(f)}return w}function Re(e,t){const{cameraHeading:n,cameraLocation:r}=e,{x:a,y:o,z:i,spatialReference:c}=r;if(!t||t.every(e=>0===e)||!t.length||!c)throw new Error("Invalid parameters");const[s,l,u]=t,f=u>0?[-u,0,u]:[],m=s>0?[-s,0,s]:[],p=l>0?[-l,0,l]:[],h=[];for(const y of f)for(const t of m)for(const r of m)for(const s of p){const l={...e};l.cameraHeading=n+y,l.cameraLocation={x:a+t,y:o+r,z:i?i+s:0,spatialReference:{wkid:c.wkid}},h.push(l)}return h}function de(e,t,n,a,i){const c="measurement"===e?t:Pe(n);if(i&&c)return o(a,r(c,H),i,3)||null}function Me(e,t,r,o,i){const c="measurement"===e?t:r;if(i&&c)return a(o,n(c,F),i,3)||null}function Pe(e){return Math.sqrt(e.reduce((e,t)=>e+t**2,0))}function ze(e,t,n){if(!e||!t)return;const{elevationSample:r,attributes:a}=e,{elevationSource:o,cameraHeight:i}=a,c=A(a,t[0],t[1]);let s=c.cameraLocation;return(s.spatialReference.isGeographic?v(s,d.WebMercator):Promise.resolve(s)).then(e=>(s=e,G(s.spatialReference,s.z??0,i,{elevationSample:r,elevationSource:o,extent:n}))).then(t=>("elevationSample"in t&&(e.elevationSample=t.elevationSample),{...c,cameraLocation:s,updateElevationProps:t}))}function je(e,t,n){if(!e||!t)return;const{elevationSample:r,attributes:a}=e,{elevationSource:o,cameraHeight:i}=a,c=q(a,t[0],t[1]);let s=c.cameraLocation;return(s.spatialReference.isGeographic?v(s,d.WebMercator):Promise.resolve(s)).then(e=>(s=e,G(s.spatialReference,s.z??0,i,{elevationSample:r,elevationSource:o,extent:n}))).then(t=>("elevationSample"in t&&(e.elevationSample=t.elevationSample),{...c,cameraLocation:s,updateElevationProps:t}))}function be(e,t,n){if("default"===t)return e;const r={x:e[0],y:e[1],z:e[2]},a=k(r,n[0],n[1]);return[a.x,a.y]}function Ee(e){return e.metersPerUnit}function Se(e,t,n,r){let a=[];return a="panoramic"===t?e.map(([e,t,a])=>{const{x:o,y:i}=k({x:e,y:t,z:a},n[0],n[1],r);return[o-.5,-.5-i]}):e.map(([e,t])=>[e-.5,-.5-t]),a}function Le(e,t,n){return e.map(e=>k({x:e[0],y:e[1],z:e[2]},t[0],t[1],n))}async function Oe(e,n,r,a=!1,o=!1,i){if(!e||!n||e.length<2)return null;const c=we(e,a);if(!c||c.length<2)return null;const[s,l]=[c[0],c.at(-1)];if(!l)return null;const f=[s],m=await I(s,n);t(i);const p=m.clone();p.z?p.z+=20:p.z=20;const{averageElevation:h,cameraPitch:y,cameraRoll:g,farDistance:w,...x}=n,v=U(p,x),R=u([s.x,s.y],[v.x,v.y]),d=T(s,v);if(!d)return;const M=C([s.x,s.y],[l.x,l.y],d);if(!M?.length)return;f.push({x:M[0],y:M[1]});const P=20*u([f[0].x,f[0].y],[f[1].x,f[1].y])*Ee(n.cameraLocation.spatialReference)/R;if(!o)return P;const z=ee(P,m,f,n,0,1);return z?.value}async function We(e,n,r,a,o=!1,i=!1,c){const{attributes:s}=a,{location:l}=s,{updateElevationProps:f,...m}=n;if(!e||!n||e.length<2)throw new Error("Invalid parameters");const p=we(e,o),[h,y]=[p[0],p.at(-1)],g=[h];let w=l.clone();w.spatialReference.isGeographic&&(w=await v(w,d.WebMercator));const x=await W(h,{...m,cameraLocation:w},f);t(c);const R=x.clone();R.z?R.z+=20:R.z=20;const M=D(R,m),P=u([h.x,h.y],[M.x,M.y]),z=T(h,M);if(!z)return;const j=C([h.x,h.y],[y.x,y.y],z);if(!j?.length)return;g.push({x:j[0],y:j[1]});const b=20*u([g[0].x,g[0].y],[g[1].x,g[1].y])*Ee(n.cameraLocation.spatialReference)/P;if(!i)return b;const E=te(b,x,g,n,0,1);return E?.value}async function Ie(e,t,n){const{updateElevationProps:r,...a}=t,{updateElevationProps:o,...i}=n,c=await I(e,a,r);return U(c,i)}async function qe(e,t,n){const{updateElevationProps:r,...a}=t,{updateElevationProps:o,...i}=n,c=await W(e,a,r);return D(c,i)}async function Ge(e,t,n=!1){if(e.length<3)return null;const r=we(e,n),a=await pe(r,t),o=a.map(({x:e,y:t})=>[e,t]);e.push(e[0]),o.push(o[0]);const i=a[0].spatialReference,c=new x({paths:[o],spatialReference:i}),s=new w({rings:[o],spatialReference:i});return i.isGeographic?J(i,c,s):i.isWebMercator?Z(c,s):X(c,s)}async function ke(e,n,r=!1,a){if(e.length<3)return null;const o=we(e,r),i=await he(o,n);t(a);const c=i.map(({x:e,y:t})=>[e,t]);e.push(e[0]),c.push(c[0]);const s=i[0].spatialReference,l=new x({paths:[c],spatialReference:s}),u=new w({rings:[c],spatialReference:s});return s.isGeographic?J(s,l,u):s.isWebMercator?Z(l,u):X(l,u)}async function Ae(e,t,n=!1){const r=we(e,n);return N(ge(await pe(r,t)))}async function De(e,n,r=!1,a){const o=we(e,r),i=await he(o,n);t(a);return N(ge(i))}async function Ue(e,t){const n=s(),r=e.paths[0][0],a=t.paths[0][0];let o,l;e.spatialReference.isWGS84||e.spatialReference.isWebMercator?(await E(),o=S(e),l=S(t)):(o=L(e),l=L(t));const u=Y(e.paths[0],o),f=Y(t.paths[0],l),m=Be(u,f),[p,h,y]=u,[g,w,x]=f.map(e=>-e),[v,R,d]=m,[M,P,z]=[a[0]-r[0],a[1]-r[1],a[2]-r[2]];i(n,p,g,v,h,w,R,y,x,d);const j=c(n);if(0===j)return null;i(n,M,g,v,P,w,R,z,x,d);const b=c(n);i(n,p,M,v,h,P,R,y,z,d);const O=c(n);i(n,p,g,M,h,w,P,y,x,z);const W=b/j,I=O/j,q=c(n)/j;return{distance:Math.abs(q/Math.sqrt(m[0]*m[0]+m[1]*m[1]+m[2]*m[2])),pointOnA:He(r,W,u),pointOnB:He(a,I,f)}}function Be(e,t){const n=l(),r=f(l(),e[0],e[1],e[2]),a=f(l(),t[0],t[1],t[2]),o=m(n,r,a);return[o[0],o[1],o[2]]}function He(e,t,n){return[e[0]+t*n[0],e[1]+t*n[1],e[2]+t*n[2]]}export{T as calculateAngle,V as calculateAnglePano,C as calculateCorrectedPixel,K as calculateHeightFromTemporaryDistance,Q as calculateLocationAccuracyFromDeviations,_ as calculateReferenceImagePointPanoramic,$ as calculateTempImagePoint,re as calculateUpdatedWmsf,ee as computeHeightIteratively,te as computeHeightIterativelyPanoramic,fe as computeTriangulatedAreaMeasurement,le as computeTriangulatedDistanceMeasurement,ue as computeTriangulatedPoint,me as computeTriangulatedVector,ye as copyToClipboard,we as formatPixels,ve as generateCombinations,Re as generateCombinationsPanoramic,Me as getConvertedArea,de as getConvertedDistance,xe as getConvertedHeight,ze as getMeasurementProperties,je as getMeasurementPropertiesPanoramic,be as getModeCorrectedPoint,Se as getModeCorrectedPoints,Le as getPixelLocationFromSphereVertices,Pe as getRootOfSumOfSquaredErrors,Ee as getUnitRateFromSpatialReference,Oe as heightMeasurement2D,We as heightMeasurementPanoramic,Ie as imageToImageTransform,qe as imageToImageTransformPanoramic,Ge as pixelAreaMeasurement2D,ke as pixelAreaMeasurementPanoramic,Ae as pixelDistanceMeasurement2D,De as pixelDistanceMeasurementPanoramic,Ue as solveSkewLinesIntersection};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/Error.js";class r extends e{constructor(e){super("InvalidDirectionError",`cannot navigate in direction: ${e}`)}}class o extends e{constructor(
|
|
2
|
+
import e from"../../../core/Error.js";class r extends e{constructor(e){super("InvalidDirectionError",`cannot navigate in direction: ${e}`)}}class o extends e{constructor(){super("NoImageLoadedError","no image loaded")}}class n extends e{constructor(e){super("NoFeatureFoundWithObjectIdError",`no feature found with objectId: ${e}`)}}class t extends e{constructor(){super("NoSequenceFoundError","no sequence found")}}class s extends e{constructor(e){super("NoImageInSequenceError",`reached the ${e} of the sequence`)}}export{r as InvalidDirectionError,n as NoFeatureFoundWithObjectIdError,s as NoImageInSequenceError,o as NoImageLoadedError,t as NoSequenceFoundError};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{sqlAnd as e}from"../../../core/sql.js";import r from"../../../geometry/Point.js";import t from"../../../geometry/SpatialReference.js";import{polygonCentroidPoint as n}from"../../../geometry/support/centroid.js";import{searchImages as
|
|
2
|
+
import{sqlAnd as e}from"../../../core/sql.js";import r from"../../../geometry/Point.js";import t from"../../../geometry/SpatialReference.js";import{polygonCentroidPoint as n}from"../../../geometry/support/centroid.js";import{searchImages as o}from"../../../layers/orientedImagery/queries.js";import{createCoveragePolygon as i}from"../../../layers/orientedImagery/core/coverageUtils.js";import{constructWhereClauseForSequenceFields as s}from"./utils.js";function a(e){return e.effectiveSequenceOrderField?.[0]?.fieldName??null}function c(e){const r=a(e);return r?`${r} IS NOT NULL`:null}async function u(e,t,s,a,c){const{polygon:u}=i(t.attributes),f=r.fromJSON(n(u));f.z=void 0;const l=h(e.definitionExpression,s);let d,m;try{d=await o({layerInstanceOrURL:e,point:f,queryParams:{where:l,timeExtent:a}},c)}catch(y){m=y}return new p(f,d,m)}async function f(e,r,t,n,i){const s=e.effectiveSequenceOrderField?.map(({fieldName:e,sortOrder:r})=>`${e} ${"desc"===r?"DESC":"ASC"}`),a=h(e.definitionExpression,t);let c,u;try{c=await o({layerInstanceOrURL:e,point:r,queryParams:{where:a,orderByFields:s,returnGeometry:!0,outFields:["*"],timeExtent:n}},i)}catch(f){u=f}return new p(r,c,u)}async function l(r,n,o,i="ASC",s,u,f){const l=a(r);let d=h(r.definitionExpression,s,c(r));const m="number"==typeof n?n-1:void 0;"string"===n&&l&&(d=e(d,`${l} = ${n}`));const p=r.createQuery();p.where=d,p.start=m,p.num=o,p.timeExtent=u,p.orderByFields=l?[`${l} ${i}`]:void 0,r.spatialReference.isGeographic&&(p.outSpatialReference=t.WebMercator);try{const e=await r.queryFeatures(p,f);return await w(e,r),new y(e)}catch(S){return new y(void 0,S)}}async function d(e,r,n,o=1,i,a,c){const u=e.effectiveSequenceOrderField?.map(({fieldName:e,sortOrder:r})=>`${e} ${"desc"===r?"DESC":"ASC"}`),f=h(e.definitionExpression,i,s(r,n,e.fields)),l=e.createQuery();l.where=f,l.num=o,l.orderByFields=u,l.timeExtent=a,e.spatialReference.isGeographic&&(l.outSpatialReference=t.WebMercator);try{const r=await e.queryFeatures(l,c);return await w(r,e),new y(r)}catch(d){return new y(void 0,d)}}async function m(e,r,n,o,i){const s=Array.isArray(r)?r:[r],a=h(e.definitionExpression,n,`${e.objectIdField} IN (${s.join(",")})`),c=e.createQuery();c.where=a,e.spatialReference.isGeographic&&(c.outSpatialReference=t.WebMercator),o&&(c.timeExtent=o);try{const r=await e.queryFeatures(c,i);return await w(r,e),new y(r)}catch(u){return new y(void 0,u)}}class y{constructor(e,r){this.response=e,this.error=r}}class p{constructor(e,r,t){this.nextLocation=e,this.response=r,this.error=t}}async function w(e,r){const t=await import("../../../layers/orientedImagery/core/ExposurePoint.js").then(e=>e.default);e.features.forEach(e=>{const n=t.fromJSON({...e.toJSON(),layer:r});n&&(e.attributes=n)})}function h(...r){let t="1=1";return r.forEach(r=>{t=e(t,r)}),t}export{p as QueryNextLocationFeaturesResponse,y as QueryOrientedImageryFeaturesResponse,h as mergeSQLstatements,d as queryAfterSequenceField,m as queryFeatureByObjectIds,u as queryNextLocationFeatures,l as queryOffsetSequenceFeatures,f as querySequenceFeaturesAroundPoint};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{sqlLiteral as e}from"../../../core/sql.js";import{getMetersPerUnitForSR as n}from"../../../core/units.js";import t from"../../../geometry/Extent.js";import{getWebMercatorScalingFactor as r}from"../../../layers/orientedImagery/transformations/utils.js";import{clockwiseDirections as o}from"../constants.js";function i(e,o){const{x:i,y:u,spatialReference:
|
|
2
|
+
import{sqlLiteral as e}from"../../../core/sql.js";import{getMetersPerUnitForSR as n}from"../../../core/units.js";import t from"../../../geometry/Extent.js";import{getWebMercatorScalingFactor as r}from"../../../layers/orientedImagery/transformations/utils.js";import{clockwiseDirections as o}from"../constants.js";function i(e,o){const{x:i,y:u,spatialReference:l}=e,s=o*r(u,l)/n(l);return new t({xmin:i-s,xmax:i+s,ymin:u-s,ymax:u+s,spatialReference:e.spatialReference})}function u(e){return!e||null===e.previous||null===e.next}function l(e,n,t=1){if(null==e[n])return!0;const r=e=>e?o.reduce((n,t)=>e[t]?n+1:n,0):0,i=new Set,u=[{node:e,depth:0}];for(;u.length;){const{node:e,depth:n}=u.shift();if(e&&!i.has(e)){if(i.add(e),r(e)<2)return!0;if(n<t)for(const t of o){const r=e[t];r&&!i.has(r)&&u.push({node:r,depth:n+1})}}}return!1}function s(e,n,t){if(!e)return"1=1";switch(n){case"next":return c(e,"next",t);case"previous":return c(e,"previous",t);default:return"1=1"}}function a(e){return null!=e}function f(n,t,r){const o=r?.find(e=>e.name===n)?.type;return"date"===o||"string"===o?e(t,null,{type:o}):t}function c(e,n,t){return e.map((r,o)=>{const i=e.slice(0,o).map(e=>a(e?.value)?`(${e.fieldName} = ${f(e.fieldName,e.value,t)})`:null).filter(Boolean).join(" AND "),u="asc"===r.sortOrder?"next"===n?">":"<":"next"===n?"<":">",l=[i,a(r?.value)?`(${r.fieldName} ${u} ${f(r.fieldName,r.value,t)})`:null].filter(Boolean);return l.length>1?`(${l.join(" AND ")})`:l.join(" AND ")}).filter(Boolean).join(" OR ")}export{s as constructWhereClauseForSequenceFields,i as createExtentAroundPoint,l as shouldQueryAndNavigate,u as shouldQueryAndNavigateSequentially};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{throwIfAborted as t}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as a}from"../../../core/units.js";import n from"../../../geometry/Point.js";import r from"../../../geometry/Polygon.js";import e from"../../../geometry/SpatialReference.js";import{e as i}from"../../../chunks/intersectionOperator.js";import
|
|
2
|
+
import{throwIfAborted as t}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as a}from"../../../core/units.js";import n from"../../../geometry/Point.js";import r from"../../../geometry/Polygon.js";import e from"../../../geometry/SpatialReference.js";import{e as i}from"../../../chunks/intersectionOperator.js";import{computeFarplaneVertices as o,createRotationMatrixFromHPR as m}from"../../../layers/orientedImagery/transformations/utils.js";import{calculateUpdatedWmsf as h}from"../imageMeasurementUtils.js";const l=15,s=120,c=.9,M=1.1,f=1,x=179,u=3,y=2,g=1,p=150,d=16,w=32,I=8,b=.05,v=1,F=2,P=20,z=4096;function N(t,n){const{x:r=0,y:e=0,z:i=0}=n;if(0===r&&0===e&&0===i)return;const o=a(t.spatialReference),m=o?r/o:r,h=o?e/o:e,l=o?i/o:i,{position:s}=t.vertexAttributes,c=Math.floor(s.length/3);for(let a=0;a<c;a+=1)s[3*a]+=m,s[3*a+1]+=h,s[3*a+2]+=l;t.vertexAttributesChanged()}function R(t,n){const{radiusOffset:r=0}=n;if(0===r)return;const e=a(t.spatialReference),i=e?r/e:r,{position:o}=t.vertexAttributes,m=Math.floor(o.length/3);let h=0,l=0,s=0;for(let a=0;a<m;a++)h+=o[3*a],l+=o[3*a+1],s+=o[3*a+2];h/=m,l/=m,s/=m;let c=0;for(let a=0;a<m;a++){const t=o[3*a]-h,n=o[3*a+1]-l,r=o[3*a+2]-s;c+=Math.sqrt(t*t+n*n+r*r)}c/=m;const M=c>0?(c+i)/c:1;for(let a=0;a<m;a++){let t=o[3*a]-h,n=o[3*a+1]-l,r=o[3*a+2]-s;t*=M,n*=M,r*=M,o[3*a]=h+t,o[3*a+1]=l+n,o[3*a+2]=s+r}t.vertexAttributesChanged()}function j(t,a){const{columns:n,rows:r}=Q(t,a),[e,i]=t,o=a?.xmin??0,m=a?.ymin??0,h=a?Math.max(1,a.xmax-a.xmin):e,l=a?Math.max(1,a.ymax-a.ymin):i,s=new Array;for(let c=0;c<=r;c+=1){const t=m+c/r*l;for(let a=0;a<=n;a+=1)s.push({x:o+a/n*h,y:t})}return s}function A(t,a,n){const{columns:r,rows:e}=Q(a,n),i=r+1,o=new Float64Array(3*t.length),m=new Float32Array(2*t.length),h=new Array;t.forEach((t,a)=>{const n=3*a,h=2*a,l=a%i,s=Math.floor(a/i);o[n]=t.x,o[n+1]=t.y,o[n+2]=t.z??0,m[h]=l/r,m[h+1]=s/e});for(let l=0;l<e;l+=1)for(let t=0;t<r;t+=1){const a=l*i+t,n=a+1,r=a+i,e=r+1;h.push(a,n,e,a,e,r)}return{faces:h,position:o,uv:m}}function S(t,a,n,r=y){return{width:Math.ceil(t/r**n),height:Math.ceil(a/r**n)}}function L(t,a,n){const{width:r,height:e,storageInfo:i}=t.rasterInfo,{pyramidScalingFactor:o}=i,m=S(r,e,a,o??void 0);if(!n)return{offset:{x:0,y:0},size:m};const h=(o??y)**a,l={x:Math.max(0,Math.floor(n.xmin/h)),y:Math.max(0,Math.floor(n.ymin/h))},s=Math.min(m.width,Math.ceil(n.xmax/h)),c=Math.min(m.height,Math.ceil(n.ymax/h));return{offset:l,size:{width:Math.max(g,s-l.x),height:Math.max(g,c-l.y)}}}function O(t,a,n){const{maximumPyramidLevel:r,pyramidScalingFactor:e}=t.rasterInfo.storageInfo,i=e??y,o=Math.max(g,(n?.xmax??t.rasterInfo.width)-(n?.xmin??0)),m=Math.max(g,(n?.ymax??t.rasterInfo.height)-(n?.ymin??0)),h=Math.max(g,a.width),l=Math.max(g,a.height),s=Math.max(g,o/h,m/l),c=Math.ceil(Math.log(s)/Math.log(i));return Math.max(0,Math.min(r,Number.isFinite(c)?c:r))}function q(t,a,n){const{maximumPyramidLevel:r,pyramidScalingFactor:e}=t.rasterInfo.storageInfo,i=e??y,o=Math.max(g,(n?.xmax??t.rasterInfo.width)-(n?.xmin??0)),m=Math.max(g,(n?.ymax??t.rasterInfo.height)-(n?.ymin??0)),h=Math.max(g,a.width),l=Math.max(g,a.height);let s=r;for(let c=r;c>=0&&(s=c,!(0===c||o/i**c>h||m/i**c>l));c-=1);return s}function D(t,a,n=z){const{maximumPyramidLevel:r,pyramidScalingFactor:e}=t.rasterInfo.storageInfo,i=e??y;let o=Math.max(0,Math.min(r,a));for(;o<r;){const a=S(t.rasterInfo.width,t.rasterInfo.height,o,i);if(a.width<=n&&a.height<=n)break;o+=1}return o}function W(t){const{camera:a,width:n,height:r}=t;if(n<=0||r<=0)return{horizontal:a.fov,vertical:a.fov};const e=Math.sqrt(n*n+r*r);return{horizontal:2*Math.atan(Math.tan(a.fov*Math.PI/360)*n/e)*180/Math.PI,vertical:2*Math.atan(Math.tan(a.fov*Math.PI/360)*r/e)*180/Math.PI}}function k(t,a,n){if(null==t||null==a||!Number.isFinite(t)||!Number.isFinite(a))return{horizontal:t??null,vertical:a??null};const r=Math.sin(n*Math.PI/180),e=Math.cos(n*Math.PI/180),i=[[t,0],[t,a],[0,a]].map(([t,a])=>[e*t-r*a,r*t+e*a]),o=Math.min(0,...i.map(([t])=>t)),m=Math.max(0,...i.map(([t])=>t)),h=Math.min(0,...i.map(([,t])=>t)),l=Math.max(0,...i.map(([,t])=>t));return{horizontal:Math.min(Math.abs(m-o),p),vertical:Math.min(Math.abs(l-h),p)}}function C(t,a,n,r){const{width:e,height:i}=t,o=k(a,n,r),m=Math.sqrt(e*e+i*i);if(m<=0)return o.vertical??o.horizontal??null;if(e>=i){const t=o.vertical;return null==t||i<=0?null:2*Math.atan(Math.tan(t*Math.PI/360)*m/i)*180/Math.PI}const h=o.horizontal;return null==h||e<=0?null:2*Math.atan(Math.tan(h*Math.PI/360)*m/e)*180/Math.PI}function U(t,a,r=d,e=0){const i=t.camera.position,{horizontal:l,vertical:s}=W(t),c=i.spatialReference.isWebMercator?h(i.y):1,M=o({cameraLocation:i,farDistance:a,horizontalFieldOfView:l,rotationMatrix:m([t.camera.heading,t.camera.tilt,e]),scalingFactor:c,verticalFieldOfView:s}),f=[];for(let o=0;o<M.length;o+=1){const t=M[o],a=M[(o+1)%M.length];for(let e=0;e<r;e+=1){const o=e/r;f.push(new n({x:t[0]+(a[0]-t[0])*o,y:t[1]+(a[1]-t[1])*o,z:t[2]+(a[2]-t[2])*o,spatialReference:i.spatialReference}))}}return f}async function V(a,n,o,m,h){if("3d"!==n.type)return null;const{cameraRoll:l,farDistance:s}=a.attributes;if("number"!=typeof s||!Number.isFinite(s)||s<=0)return null;const c=U(n,s,w,l??0),M=await m(c,h);t(h);const f=M.filter(({x:t,y:a})=>Number.isFinite(t)&&Number.isFinite(a));if(f.length<4)return null;const[x,u]=o,y=new r({rings:[[[0,0],[x,0],[x,u],[0,u],[0,0]]],spatialReference:e.WebMercator}),g=new r({rings:[[...f.map(({x:t,y:a})=>[t,a]),[f[0].x,f[0].y]]],spatialReference:e.WebMercator}),p=i(g,y),d=p?p.rings.flatMap(t=>t.map(([t,a])=>({x:t,y:a}))):f;if(!d.length)return null;const I=d.map(({x:t})=>Math.max(0,Math.min(x,t))),b=d.map(({y:t})=>Math.max(0,Math.min(u,t)));return B({xmin:Math.floor(Math.max(0,Math.min(...I))),xmax:Math.ceil(Math.min(x,Math.max(...I))),ymin:Math.floor(Math.max(0,Math.min(...b))),ymax:Math.ceil(Math.min(u,Math.max(...b)))},x,u)}async function E(a,n,r,e,i){if("3d"!==n.type)return null;const{farDistance:o}=a.attributes;if("number"!=typeof o||!Number.isFinite(o)||o<=0)return null;const m=o,[h,l]=r,s=U(n,m),c=await e(s,i);t(i);const M=c.filter(({x:t,y:a})=>Number.isFinite(t)&&Number.isFinite(a));if(M.length<4)return null;const f=G(M,l);if(!f)return null;const x=J(M.map(({x:t})=>H(t,h)),h),u=h-x.gap;return u<=0?null:u>=h-v?[{xmin:0,xmax:h,ymin:f.ymin,ymax:f.ymax}]:K(x,h,f)}function B(t,a,n){const r=Math.max(g,t.xmax-t.xmin),e=Math.max(g,t.ymax-t.ymin),i=Math.max(I,Math.round(r*b)),o=Math.max(I,Math.round(e*b)),m=Math.floor(Math.max(0,t.xmin-i)),h=Math.ceil(Math.min(a,t.xmax+i)),l=Math.floor(Math.max(0,t.ymin-o)),s=Math.ceil(Math.min(n,t.ymax+o));return h>m&&s>l?{xmin:m,xmax:h,ymin:l,ymax:s}:null}function G(t,a){const n=t.map(({y:t})=>Math.max(0,Math.min(a,t))),r=Math.floor(Math.max(0,Math.min(...n))),e=Math.ceil(Math.min(a,Math.max(...n)));return e>r?{ymin:r,ymax:e}:null}function H(t,a){return(t%a+a)%a}function J(t,a){const n=t.slice().sort((t,a)=>t-a);let r=-1,e=0,i=0;for(let o=0;o<n.length;o+=1){const t=n[o],m=o===n.length-1?n[0]+a:n[o+1],h=m-t;h>r&&(r=h,e=t,i=m)}return{gap:r,start:e,end:i}}function K(t,a,n){const r=H(t.end,a),e=H(t.start,a);return r<=e?[{xmin:Math.floor(r),xmax:Math.ceil(e),...n}]:[{xmin:0,xmax:Math.ceil(e),...n},{xmin:Math.floor(r),xmax:a,...n}].filter(({xmin:t,xmax:a})=>a>t)}function Q(t,a){const[n,r]=t,e=a?Math.max(g,a.xmax-a.xmin):n,i=a?Math.max(g,a.ymax-a.ymin):r;if(e<=0||i<=0)return{columns:F,rows:F};const o=e/i;return o>=1?{columns:P,rows:Math.max(F,Math.round(P/o))}:{columns:Math.max(F,Math.round(P*o)),rows:P}}export{N as applyMeshOffsetInMeters,R as applySphereMeshOffsetInMeters,D as clampRasterLevelForTextureSize,V as computeDefaultAreaOfInterest,E as computePanoramicAreasOfInterest,U as createFarplaneSamplePoints,A as createSuperimposeGridVertexAttributes,j as createSuperimposeSamplePixels,q as getBaseRasterLevel,C as getDefaultSuperimposeFov,k as getEffectiveImageFieldOfView,L as getRasterFetchParameters,S as getRasterLevelSize,W as getViewCameraFieldOfView,O as getViewDependentRasterLevel,u as panoramicSuperimposeKeyboardAngleStep,s as panoramicSuperimposeMaxFov,x as panoramicSuperimposeMaxTilt,l as panoramicSuperimposeMinFov,f as panoramicSuperimposeMinTilt,c as panoramicSuperimposeZoomInFactor,M as panoramicSuperimposeZoomOutFactor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import r from"../../core/Logger.js";import{sectorsRadii as n}from"./constants.js";import t from"./support/NonPanoramicMedia.js";import
|
|
2
|
+
import r from"../../core/Logger.js";import{sectorsRadii as n}from"./constants.js";import t from"./support/NonPanoramicMedia.js";import i from"../PanoramicViewer/support/PanoramicMedia.js";function e(r){return"3d"===r?.type}function o(r){return"esri.Graphic"===r?.declaredClass}function a(r){return/(tiff|tif|mrf)$/i.test(r??"")}function c(r){if(!r)return!1;if(!URL.canParse(r))return!1;const{pathname:n}=new URL(r);return/.*\.(tiff|tif|mrf)$/i.test(n??"")}function s(r){return Math.abs(r)>=135?"WEST":r<-45&&r>-135?"SOUTH":r<=45?"EAST":"NORTH"}function u(r,t){const i=r/t*n[2];return i<=n[0]?"NEAR":i<=n[1]?"":"FAR"}const f=r=>n=>n.layer===r;function m(r){return"NoAttachmentError"===r?.name}const p=r=>`${r}:missing-property`,d=(r,n)=>`Property ${n} is missing in ${r}`,h=(n="esri.widgets.OrientedImageryViewer",t)=>{throw r.getLogger(n).error(t),t};function l(r,n){0!==n&&(r.xmin/=n,r.xmax*=n,r.ymin/=n,r.ymax*=n)}function g(r,n){n&&r.forEach(r=>{r.elevationSample=n})}function w(r){return new i(r)}function P(r){return new t(r)}function y(r,n,t){return t?r.filter(({attributes:{location:r}})=>Math.abs((r.z??0)-(n.z??0))<t):r}function R(r){return!!r&&"esri.widgets.PanoramicViewer.support.PanoramicMedia"===r.declaredClass}function x(r){if(!R(r))return;const{horizonPitch:n,horizonRoll:t,horizonYaw:i}=r;return[n,t,i]}export{g as assignElevationSampleToFeatures,s as calculateDirection,u as calculateSegment,P as createNonPanoramicMedia,w as createPanoramicMedia,x as extractHorizonAnglesFromMedia,y as filterByZ,f as filterOILLayerView,d as getMissingPropertyErrorMessage,p as getMissingPropertyErrorName,o as isGraphic,m as isNoAttachmentError,R as isPanoramicMedia,e as isSceneView,c as isTifOrMrf,h as logAndThrow,l as scaleExtent,a as validateTifOrMrfExtension};
|