@arcgis/core 4.31.0-next.20240708 → 4.31.0-next.20240710
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/{0975e54c50383375cc09.js → 14cf7411e8318a1bccb9.js} +1 -1
- package/assets/esri/core/workers/chunks/{71852b8437ec66b9ef06.js → 2123ab24163a532ebc8d.js} +1 -1
- package/assets/esri/core/workers/chunks/{c91b3800cf3891bf2d59.js → 252ff37bf5e12dae0b18.js} +1 -1
- package/assets/esri/core/workers/chunks/2799007b5f3f4a2e364c.js +51 -0
- package/assets/esri/core/workers/chunks/{ff5e6d823d512f87a527.js → 2dddb8a989b9c96572fe.js} +1 -1
- package/assets/esri/core/workers/chunks/34b5bab6239c7277f854.js +1 -0
- package/assets/esri/core/workers/chunks/543f9db420c99d429637.js +1 -0
- package/assets/esri/core/workers/chunks/{5089a12084a8a8fb93d8.js → 61e5179fb49866241128.js} +1 -1
- package/assets/esri/core/workers/chunks/632e3ba2b8a881df29a0.js +1 -0
- package/assets/esri/core/workers/chunks/63eb1cc923bb8dcb3cb3.js +1 -0
- package/assets/esri/core/workers/chunks/{380e2654bc7e07163df0.js → 725a0eae5248a933db05.js} +1 -1
- package/assets/esri/core/workers/chunks/{1cc4a89c96a36d6b3d52.js → 7767559d56d16b644655.js} +1 -1
- package/assets/esri/core/workers/chunks/7baf288a07401f9e972d.js +1 -0
- package/assets/esri/core/workers/chunks/{43e83f4d827f59ff556a.js → 8087288f00dfdcc479b9.js} +1 -1
- package/assets/esri/core/workers/chunks/{a5fbe1c95e49093e5af4.js → 8cce4b218568638e6e64.js} +1 -1
- package/assets/esri/core/workers/chunks/{c7e2a97cb7bcd153bcef.js → 8e326def543268f8a08e.js} +1 -1
- package/assets/esri/core/workers/chunks/92cb45b18e151db007dc.js +1 -0
- package/assets/esri/core/workers/chunks/b2e8cc76381077b78d4c.js +1 -0
- package/assets/esri/core/workers/chunks/b6a8132708afcd988fa9.js +1 -0
- package/assets/esri/core/workers/chunks/{b4d850e82a8ae902d684.js → c44cc686774ff53c0a94.js} +1 -1
- package/assets/esri/core/workers/chunks/c52701477405c1fb2072.js +1 -0
- package/assets/esri/core/workers/chunks/{9ed11b9202013ca001ee.js → cfc2a1858a8bbb284979.js} +2 -2
- package/assets/esri/core/workers/chunks/{9ed11b9202013ca001ee.js.LICENSE.txt → cfc2a1858a8bbb284979.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/d9863289c69d2550cd49.js +1 -0
- package/assets/esri/core/workers/chunks/e1f4df3a5b0b31521b3c.js +1 -0
- package/assets/esri/core/workers/chunks/ee72a006e25e94a4cd4a.js +1039 -0
- package/assets/esri/core/workers/chunks/{61505947371cebab9cbe.js → fdebfe55cd097714ec11.js} +1 -1
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +13 -18
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/AtmosphereCompositing.glsl.js +6 -9
- package/chunks/BlendLayers.glsl.js +1 -7
- package/chunks/BlendWeights.glsl.js +81 -86
- package/chunks/Blur.glsl.js +1 -3
- package/chunks/ChapmanAtmosphere.glsl.js +3 -8
- package/chunks/CheckerBoard.glsl.js +3 -9
- package/chunks/Clouds.glsl.js +21 -10
- package/chunks/CloudsComposition.glsl.js +3 -7
- package/chunks/ColorMaterial.glsl.js +3 -9
- package/chunks/ComponentShader.glsl.js +41 -75
- package/chunks/Compositing.glsl.js +5 -7
- package/chunks/DefaultMaterial.glsl.js +68 -73
- package/chunks/EdgeDetect.glsl.js +29 -39
- package/chunks/EdgeShader.glsl.js +37 -60
- package/chunks/Fog.glsl.js +4 -9
- package/chunks/HUDCompositing.glsl.js +1 -3
- package/chunks/HUDMaterial.glsl.js +11 -20
- package/chunks/Heatmap.glsl.js +3 -11
- package/chunks/HeatmapDensity.glsl.js +12 -15
- package/chunks/HighlightApply.glsl.js +130 -174
- package/chunks/HighlightDownsample.glsl.js +29 -32
- package/chunks/ImageMaterial.glsl.js +11 -21
- package/chunks/LaserlinePath.glsl.js +6 -10
- package/chunks/Laserlines.glsl.js +8 -20
- package/chunks/LineCallout.glsl.js +91 -108
- package/chunks/LineMarker.glsl.js +62 -53
- package/chunks/Magnifier.glsl.js +4 -9
- package/chunks/MeasurementArrow.glsl.js +9 -15
- package/chunks/NativeLine.glsl.js +8 -12
- package/chunks/NoiseTextureAtlas.glsl.js +89 -86
- package/chunks/OITCompositing.glsl.js +8 -12
- package/chunks/OverlayCompositing.glsl.js +2 -4
- package/chunks/Path.glsl.js +31 -55
- package/chunks/Pattern.glsl.js +16 -20
- package/chunks/PointRenderer.glsl.js +39 -48
- package/chunks/Precipitation.glsl.js +22 -39
- package/chunks/RasterColorizer.glsl.js +25 -33
- package/chunks/RealisticTree.glsl.js +53 -65
- package/chunks/RibbonLine.glsl.js +31 -36
- package/chunks/SSAO.glsl.js +7 -10
- package/chunks/SSAOBlur.glsl.js +10 -14
- package/chunks/ShadedColorMaterial.glsl.js +12 -15
- package/chunks/ShadowCastAccumulate.glsl.js +6 -8
- package/chunks/ShadowCastVisualize.glsl.js +12 -18
- package/chunks/ShadowHighlight.glsl.js +49 -51
- package/chunks/SimpleAtmosphere.glsl.js +4 -13
- package/chunks/SlicePlaneMaterial.glsl.js +3 -7
- package/chunks/Stars.glsl.js +3 -7
- package/chunks/Terrain.glsl.js +20 -61
- package/chunks/TextureOnly.glsl.js +2 -4
- package/chunks/Viewshed.glsl.js +20 -38
- package/chunks/WaterSurface.glsl.js +34 -60
- package/core/accessorSupport/tracking.js +1 -1
- package/core/workers/registry.js +1 -1
- package/geometry/Circle.js +1 -1
- package/geometry/Polygon.js +1 -1
- package/geometry/Polyline.js +1 -1
- package/geometry/support/geodesicUtils.js +1 -1
- package/interfaces.d.ts +34 -4
- package/layers/WCSLayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
- package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
- package/package.json +3 -3
- package/support/revision.js +1 -1
- package/views/2d/engine/flow/styles/Imagery.js +1 -1
- package/views/2d/engine/flow/styles/Particles.js +1 -1
- package/views/2d/engine/flow/styles/Streamlines.js +1 -1
- package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
- package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
- package/views/2d/engine/webgl/BitBlitRenderer.js +1 -1
- package/views/2d/engine/webgl/DefaultVertexAttributeLayouts.js +1 -1
- package/views/2d/engine/webgl/Mesh2D.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/Utils.js +1 -1
- package/views/2d/engine/webgl/VertexStream.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushStencil.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushTileDebugInfo.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLBackground.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
- package/views/2d/engine/webgl/effects/highlight/HighlightRenderer.js +1 -1
- package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
- package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/ShaderBuilder2D.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
- package/views/2d/layers/graphics/GraphicBoundsRenderer.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/2d/magnifier/MagnifierView2D.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/LocalAtmosphere.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/environment/Stars.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/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/StreamLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +5 -0
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +5 -0
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +5 -0
- package/views/3d/layers/graphics/pipeline/PBFPointFeaturesView.js +5 -0
- package/views/3d/layers/graphics/pipeline/TestSymbol.js +5 -0
- package/views/3d/layers/graphics/pipeline/Tile.js +5 -0
- package/views/3d/layers/graphics/pipeline/Tile3DFetcher.js +5 -0
- package/views/3d/layers/graphics/pipeline/Tile3DProcessor.js +5 -0
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/projectExtentUtils.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/webgl/ManagedFBObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js +3 -5
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +29 -59
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +6 -12
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +11 -11
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassTerrainTest.glsl.js +4 -7
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/TextureTransformUV.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js +2 -4
- package/views/3d/webgl-engine/core/shaderLibrary/util/LocalFromScreenSpace.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
- package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
- package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/MagnifierRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
- package/views/3d/webgl-engine/materials/DrawParameters.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoCache.js +1 -1
- package/views/3d/webgl-engine/shaders/Heatmap.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/OITCompositing.glsl.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/interactive/tooltip/Tooltip.js +1 -1
- package/views/interactive/tooltip/fields/fields.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/Util.js +1 -1
- package/views/webgl/VertexArrayObject.js +1 -1
- package/views/webgl/enums.js +1 -1
- package/views/webgl/heatmapTextureUtils.js +1 -1
- package/views/webgl/testDoublePrecisionArithmetic.js +1 -1
- package/views/webgl/testFloatBufferBlend.js +1 -1
- package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/Feature/support/relatedFeatureUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/OrientedImageryViewer/constants.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/support/TimezonePicker.js +1 -1
- package/assets/esri/core/workers/chunks/0cb2eb96ffb1dbed00eb.js +0 -1
- package/assets/esri/core/workers/chunks/0d6ed27fc9948f4ea061.js +0 -1
- package/assets/esri/core/workers/chunks/225b947ba4b2fcfd5630.js +0 -1
- package/assets/esri/core/workers/chunks/7c7c3068da3bf7467685.js +0 -1
- package/assets/esri/core/workers/chunks/812e18c65aa6e398c338.js +0 -1
- package/assets/esri/core/workers/chunks/85e5cdd723f68dec8c25.js +0 -1
- package/assets/esri/core/workers/chunks/a7e2ca5ede46395f0787.js +0 -1
- package/assets/esri/core/workers/chunks/aed0db145187d9eb52f2.js +0 -51
- package/assets/esri/core/workers/chunks/cf9a32a03b3d3b66effb.js +0 -1
- package/assets/esri/core/workers/chunks/d85c51abde781660b1f5.js +0 -1
- package/assets/esri/core/workers/chunks/e840e54455eb500b501d.js +0 -1098
- package/assets/esri/core/workers/chunks/fec53ce15ae52f8cb802.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../geometry/Extent.js";import t from"../../../geometry/Polygon.js";import{isAxesOrderReversedForWkid as n}from"../../ogc/crsUtils.js";import i from"../RasterInfo.js";import{getElements as s,isSameTagIgnoreNS as a,getElementValue as o,getElementValues as l,getNodeNameIgnoreNS as r,getElement as u,getSpaceDelimitedNumericValues as m}from"./xmlUtilities.js";function p(e){return{requestResponseCRSs:l(e,"requestResponseCRSs").map((e=>e.split(":")[1])),nativeCRSs:l(e,"nativeCRSs").map((e=>e.split(":")[1]))}}function c(e,t){const n=l(e,"1.0.0"===t?"interpolationMethod":"InterpolationMethod"),i="1.0.0"===t?e.getAttribute("default"):o(e,"InterpolationMethods/Default");return null!=i?[i].concat(n.filter((e=>e.toLowerCase()!==i.toLowerCase()))):n}function d(e){return null==e?["nearest"]:e.map((e=>{const t=e.toLowerCase();return t.includes("nearest")?"nearest":t.includes("linear")?"bilinear":t.includes("cubic")?"cubic":null})).filter((e=>!!e))}function f(t){const n=s(t,"pos"),i=m(n[0]),a=m(n[1]);return new e({xmin:i[0],ymin:i[1],xmax:a[0],ymax:a[1],spatialReference:{wkid:4326}})}function g(e,t){const n=l(e,t);return n?.length&&""!==n[0]&&!isNaN(Number(n[0]))?n.map((e=>Number(e))):null}function h(e){const t=m(e,"MinimumValue"),n=m(e,"MaximumValue");return t.length&&n.length?t.map(((e,t)=>({min:e,max:n[t],avg:-1,stddev:-1}))):null}function b(e){return null==e?null:e.every((t=>t===e[0]))?e[0]:e}function x(e){const t=[],n=s(e,"RangeSet");let i=[];for(let a=0;a<n.length;a++){const e=o(n[a],"name"),r=o(n[a],"label"),u=[],m=g(n[a],"nullValues/singleValue"),p=s(n[a],"AxisDescription");for(let t=0;t<p.length;t++){const e=o(p[t],"name"),n=o(p[t],"label"),s=l(p[t],"singleValue");if(0===s.length){const e=o(p[t],"min"),n=o(p[t],"max"),i=Number(o(p[t],"res"))||1;if(null!==e&&null!==n)for(let t=parseInt(e,10);t<=parseInt(n,10);t+=i)s.push(t.toString())}"band"===e.toLowerCase()&&(i=s),u.push({name:e,label:n,values:s})}t.push({name:e,label:r,nullValues:m,axis:u})}return{rangeSet:t,bandNames:i}}function v(e=null){if(!e)return{resolution:null,units:null};let t=e.toUpperCase();const n=["Y","M","D"],i=["H","M","S"],s=["Years","Months","Days","Hours","Minutes","Seconds"];let a,o,l;return t.includes("PT")?(t=t.slice(2),l=i.findIndex((e=>t.includes(e))),a=s[3+l],o=parseFloat(t.substring(0,t.length-1))):(t=t.slice(1),l=n.findIndex((e=>t.includes(e))),l>-1&&(a=s[l]),o=parseFloat(t.substring(0,t.length-1))),{resolution:o,units:a}}function D(e){const t=s(e,"timeposition");if(t.length>0){const e=[];for(let n=0;n<t.length;n++)e.push(new Date(o(t[n])));return{begin:e[0],end:e[e.length-1],values:e}}const n=u(e,"timePeriod")||u(e,"TimePeriod");if(n){return{begin:new Date(o(n,"beginPosition")||o(n,"BeginPosition")),end:new Date(o(n,"endPosition")||o(n,"EndPosition")),...v(o(n,"timeResolution")||o(n,"TimeResolution"))}}return null}function w(t){const n=u(t,"spatialDomain"),i=u(n,"Envelope")||u(n,"EnvelopeWithTimePeriod"),a=i.getAttribute("srsName").split(":"),l=a[a.length-1],r=s(i,"pos"),p=m(r[0]),c=m(r[1]),d=parseInt(l,10),f=isNaN(d)?null:{wkid:d},g=new e({xmin:p[0],ymin:p[1],xmax:c[0],ymax:c[1],spatialReference:f}),h=u(n,"RectifiedGrid"),b=o(h,"low").split(" "),x=o(h,"high").split(" "),v=parseInt(x[0],10)-parseInt(b[0],10)+1,w=parseInt(x[1],10)-parseInt(b[1],10)+1,y=m(n,"origin/pos"),S=s(n,"offsetVector"),L={envelope:g,columns:v,rows:w,offset:{x:parseFloat(o(S[0]).split(" ")[0]),y:parseFloat(o(S[1]).split(" ")[1])},origin:{x:y[0],y:y[1]}},I=u(t,"temporalDomain")||u(t,"TemporalDomain");return{spatialDomain:L,temporalDomain:I?D(I):null}}function y(e){const t={version:"1.0"};let n,s=[];for(let i=0;i<e.childNodes.length;i++){const r=e.childNodes[i];if(1===r.nodeType)if(a(r,"description"))t.description=o(r);else if(a(r,"name"))t.name=o(r);else if(a(r,"label"))t.label=o(r);else if(a(r,"supportedFormats"))t.supportedFormats=l(r,"formats");else if(a(r,"supportedCRSs"))t.supportedCRSs=p(r);else if(a(r,"supportedInterpolations"))t.supportedInterpolations=c(r,"1.0.0");else if(a(r,"lonLatEnvelope"))t.lonLatEnvelope=f(r);else if(a(r,"rangeSet")){const e=x(r);t.rangeSet=e.rangeSet,s=e.bandNames;const i=e.rangeSet[0].nullValues;i?.length&&(n=b(i))}else a(r,"domainSet")&&(t.domainSet=w(r))}const r=d(t.supportedInterpolations),{name:u,description:m,label:g,lonLatEnvelope:h,supportedFormats:v}=t,{spatialDomain:D}=t.domainSet,y={x:Math.abs(D.offset.x),y:Math.abs(D.offset.y)},L=S(t.domainSet),I=new i({width:D.columns,height:D.rows,pixelSize:y,extent:D.envelope,spatialReference:D.envelope.spatialReference,bandCount:s.length||1,noDataValue:n,multidimensionalInfo:L});return{id:u,title:t.name,description:m||g,lonLatEnvelope:h,rasterInfo:I,bandNames:s,supportedFormats:v,supportedInterpolations:r,coverageDescription:t,version:"1.0.0",useEPSGAxis:!1}}function S(e){if(!e.temporalDomain)return null;const{begin:t,end:n,values:i,units:s,resolution:a}=e.temporalDomain;return{variables:[{name:"default",description:"",dimensions:[{name:"StdTime",description:"",unit:"ISO8601",values:i?.map((e=>e.getTime())),hasRegularIntervals:!i,interval:a,intervalUnit:s,extent:[t.getTime(),n.getTime()]}]}]}}function L(e,t){const n=[],i=s(e,"Field");let a,r=[];for(let m=0;m<i.length;m++){const e=o(i[m],"Identifier"),p=o(i[m],"Description"),d=o(i[m],"Definition"),f=o(i[m],"Abstract"),b=o(i[m],"Title"),x=g(i[m],"NullValue"),v=u(i[m],"AllowedValues"),D=v?h(v):null,w=c(i[m],"1.1.0"),y=[],S=s(i[m],"Axis");for(let n=0;n<S.length;n++){const e=S[n].getAttribute("identifier"),i=o(S[n],"UOM"),s=o(S[n],"DataType"),u=l(S[n],"Key");t&&!e.toLowerCase().includes("band")||(r=u,a=x),y.push({identifier:e,uom:i,dataType:s,values:u,bandNoDataValues:a})}n.push({identifier:e,description:p,definition:d,abstract:f,title:b,supportedInterpolations:w,axis:y,nullValues:x,statistics:D})}return{rangeSet:n,bandNames:r,bandNoDataValues:a,statistics:n[0].statistics}}function I(e,t){if(!t.temporalDomain)return null;const n=e.filter((e=>!e.identifier.toLowerCase().includes("field_1")&&!e.axis.some((e=>e.identifier.includes("band"))))),i=[];if(n.length&&n.forEach((e=>{const t=e.axis.map((e=>{const t=e.values.map((t=>{if("ISO8601"===e.uom){return(t=t.trim()).toLowerCase().includes("z")?new Date(t).getTime():new Date(t+"Z").getTime()}return parseFloat(t.trim())})),n=[Math.min.apply(null,t),Math.max.apply(null,t)];return{name:e.identifier.trim(),description:"",field:e.identifier.trim(),unit:e.uom?e.uom.trim():"",hasRegularIntervals:!1,values:t,extent:n}}));i.push({name:e.identifier.trim(),description:e.description?.trim()??"",unit:"",dimensions:t,statistics:e.statistics})})),t.temporalDomain){const{begin:e,end:n,values:s,units:a,resolution:o}=t.temporalDomain;i.some((e=>e.dimensions.some((e=>"stdtime"===e.name.toLowerCase()))))||i.forEach((t=>{t.dimensions.push({name:"StdTime",description:"",unit:"ISO8601",values:s?.map((e=>e.getTime())),hasRegularIntervals:!s,interval:o,intervalUnit:a,extent:[e.getTime(),n.getTime()]})}))}return i.length?{variables:i}:null}function C(t){const i=u(t,"SpatialDomain"),a=u(i,"GridCRS"),l=o(a,"GridBaseCRS"),r=o(a,"GridOrigin"),p=r?.split(" ").map((e=>parseFloat(e)))??[0,0],c=m(a,"GridOffsets"),d=s(i,"BoundingBox");let f,g,h,b;for(let n=0;n<d.length;n++){const t=d[n].getAttribute("crs")?.toLowerCase();if(null!=t)if(t.includes("imagecrs")){const e=m(d[n],"LowerCorner"),t=m(d[n],"UpperCorner");f=t[0]-e[0]+1,g=t[1]-e[1]+1}else if(t.indexOf("epsg")>0){const i=t.split(":");h=parseInt(i[i.length-1],10);const s=m(d[n],"LowerCorner"),a=m(d[n],"UpperCorner");b=new e({xmin:s[0],ymin:s[1],xmax:a[0],ymax:a[1],spatialReference:{wkid:h}})}}const x=f>g,v=b.xmax-b.xmin>b.ymax-b.ymin;let w=!1;n(h)&&(x===v?w=!1:(w=!0,b=new e({xmin:b.ymin,ymin:b.xmin,xmax:b.ymax,ymax:b.xmax,spatialReference:{wkid:h}})));const y={columns:f,rows:g,origin:{x:p[0],y:p[1]},offset:{x:c[0],y:c[c.length-1]},gridBaseCRS:l,envelope:b,useEPSGAxis:w},S=u(t,"temporalDomain")||u(t,"TemporalDomain");return{spatialDomain:y,temporalDomain:S?D(S):null}}function R(e,t){const n=[],s=[],a={supportedFormats:n,supportedCRSs:s,version:"1.1"};let l,u,m=[];for(let i=0;i<e.childNodes.length;i++){const t=e.childNodes[i];if(1!==t.nodeType)continue;const p=r(t).toLowerCase();switch(p){case"title":case"abstract":case"identifier":a[p]=o(t);break;case"supportedformat":{const e=o(t);n.includes(e)||n.push(e)}break;case"supportedcrs":{const e=o(t);s.includes(e)||s.push(e)}break;case"range":{const e=L(t,!!a.domain?.temporalDomain);a.range=e.rangeSet,m=e.bandNames;const{bandNoDataValues:n}=e;n?.length&&(l=b(n)),u=e.statistics}break;case"domain":a.domain=C(t)}}const p=d(a.range[0].supportedInterpolations),{identifier:c,abstract:f,title:g,domain:h,range:x}=a,v={x:Math.abs(h.spatialDomain.offset.x),y:Math.abs(h.spatialDomain.offset.y)},D=I(x,h);D&&(l=x[0].nullValues,1===l?.length&&(l=l[0]));const w=new i({width:h.spatialDomain.columns,height:h.spatialDomain.rows,pixelSize:v,extent:h.spatialDomain.envelope,spatialReference:h.spatialDomain.envelope.spatialReference,bandCount:m.length||1,noDataValue:l,statistics:u,multidimensionalInfo:D});return{id:c,title:a.title,description:f||g,lonLatEnvelope:null,bandNames:m,rasterInfo:w,supportedFormats:n,supportedInterpolations:p,coverageDescription:a,version:t,useEPSGAxis:h.spatialDomain.useEPSGAxis}}function T(t){const n=u(t,"Envelope")||u(t,"EnvelopeWithTimePeriod"),i=n.getAttribute("srsName"),s=i.slice(i.lastIndexOf("/")+1),l=n.getAttribute("axisLabels").split(" ").map((e=>e.trim())).filter((e=>""!==e.trim())),r=m(n,"lowerCorner"),p=m(n,"upperCorner"),c=!["y","lat","latitude","north","nor","n","b"].includes(l[0].toLowerCase());let d;const f=parseInt(s,10),g=isNaN(f)?null:{wkid:f};d=new e(c?{xmin:r[0],ymin:r[1],xmax:p[0],ymax:p[1],spatialReference:g}:{xmin:r[1],ymin:r[0],xmax:p[1],ymax:p[0],spatialReference:g});const h={mins:r,maxs:p},b=n.getAttribute("uomLabels").trim().split(" ");let x,v;if(a(n,"EnvelopeWithTimePeriod")){x=new Date(o(t,"beginPosition")||o(t,"BeginPosition")),v=new Date(o(t,"endPosition")||o(t,"EndPosition"));const e=b?.findIndex((e=>"oledatetime"===e?.toLowerCase()));e>-1&&(b[e]="ISO8601")}return{envelope:d,axisLabels:l,uomLabels:b.length?b:null,envelopeAllDims:h,beginPosition:x,endPosition:v,isEastFirst:c}}function M(e,t){const n=[],i=s(e,"DataRecord"),a=[];let l,r=[];for(let p=0;p<i.length;p++){const e=s(i[p],"field"),c=[];for(let n=0;n<e.length;n++){const i=e[n].getAttribute("name"),s=o(e[n],"description")||"",p=u(e[n],"uom")?.getAttribute("code")||"",d=m(e[n],"interval"),f=g(e[n],"nilValue")?.[0];t&&!i.toLowerCase().includes("band")||(a.push(i),d?.length&&(l=l||[],l.push({min:d[0],max:d[1],avg:-1,stddev:-1})),r.push(f)),c.push({name:i,description:s,uom:p,allowedValues:d,nilValue:f})}n.push(c)}return r.some((e=>null!=e))||(r=null),{rangeType:n,bandNames:a,bandStats:l,bandNoDataValues:r}}function N(e){let t=1,n="";const i=.01;return Math.abs(e-1/24)<1/24*i?n="Hours":Math.abs(e-1)<1*i?n="Days":e<1?(t=Math.round(24*e),n="Hours"):e>28-i&&e<31+i||Math.round(e/30)<12?n="Months":e>365-i&&e<366+i&&(n="Years"),{interval:t,intervalUnit:n}}function P(e,t,n){if(n.axisLabels.length<=2)return null;const i=[];for(let a=0;a<e.length;a++){const t=e[a];for(let e=0;e<t.length;e++)t[e].name.toLowerCase().includes("band")||i.push(t[e])}const s=[];if(i.length){const e=[];for(let i=2;i<n.axisLabels.length;i++){const s=(t.uomLabels?.length??0)>i?t.uomLabels?.[i]:"",a=n.axisLabels[i].toLowerCase().includes("time")||"iso8601"===s.toLowerCase()||"oledatetime"===s.toLowerCase();let o,l;if(a){const e=N(n.offset[i]);o=e.interval,l=e.intervalUnit}else o=n.offset[i],l=s;const r=[];a?(r.push((new Date).setTime(24*(t.envelopeAllDims.mins[i]-25569)*3600*1e3)),r.push((new Date).setTime(24*(t.envelopeAllDims.maxs[i]-25569)*3600*1e3))):(r.push(t.envelopeAllDims.mins[i]),r.push(t.envelopeAllDims.maxs[i])),e.push({name:n.axisLabels[i].trim(),description:n.axisLabels[i].trim(),unit:t.uomLabels&&t.uomLabels.length>i?t.uomLabels[i].trim():"",hasRegularIntervals:!0,extent:r,interval:o,intervalUnit:l})}if(i.forEach((t=>{const{allowedValues:n}=t,i=2===n?.length?[{min:n[0],max:n[1],avg:-1,stddev:-1}]:null;s.push({name:t.name.trim(),description:t.description?.trim()??"",unit:t.uom.trim(),statistics:i,dimensions:e})})),s.length)return{variables:s}}return null}function E(e,t){const n=u(e,"RectifiedGrid"),i=m(n,"low"),a=m(n,"high"),l=[];for(let s=0;s<i.length;s++)l.push(a[s]-i[s]+1);const r=o(n,"axisLabels").split(" "),p=m(n,"origin/pos"),c=s(n,"offsetVector"),d=[];for(let s=0;s<c.length;s++){const e=m(c[s]),t=e.findIndex((e=>0!==e));d[t]=e[t]}const f=["y","lat","latitude","north","nor","n","b"];let g=!1;if(t?.length&&r?.length){g=[...t].sort(((e,t)=>e<t?-1:1)).join(",")===[...r].sort(((e,t)=>e<t?-1:1)).join(",")}const h=g?r:t;let b,x,v;return f.includes(h[0].toLowerCase())?(b=l[1],x=l[0],v={y:Math.abs(d[0]),x:Math.abs(d[1])}):(b=l[0],x=l[1],v={x:Math.abs(d[0]),y:Math.abs(d[1])}),{columns:b,rows:x,origin:p,offset:d,resolution:v,gridSamples:l,axisLabels:r,hasSameAxisLabelsAsBoundedBy:g}}function V(e){const n=u(e,"EarthObservation");if(!n)return null;const i=u(n,"phenomenonTime"),s=i?D(i):null,a=u(n,"phenomenonTime"),l=a?D(a):null,r=o(n,"featureOfInterest/Footprint/multiExtentOf/MultiSurface/surfaceMembers/Polygon/exterior/LinearRing/posList");let m=null;if(r){const e=r.split(" ").map((e=>e.trim())).filter((e=>null!=e&&""!==e));if(e.length){const n=[];for(let t=0;t<e.length/2;t+=2)n.push(e[t],e[t+1]);m=new t({rings:[n],spatialReference:{wkid:4326}})}}return{observation:{phenomenonTime:s,resultTime:l,footprint:m,identifier:o(e,"metaDataProperty/EarthObservationMetaData/identifier"),acquisitionType:o(e,"metaDataProperty/EarthObservationMetaData/acquisitionType"),status:o(e,"metaDataProperty/EarthObservationMetaData/status")}}}function A(e){const t={version:"2.0"};let n,s,r=[];for(let i=0;i<e.childNodes.length;i++){const m=e.childNodes[i];if(1===m.nodeType)if(a(m,"coverageId"))t.coverageId=o(m);else if(a(m,"ServiceParameters"))t.serviceParameters={supportedFormats:l(m,"nativeFormat")};else if(a(m,"boundedBy"))t.boundedBy=T(m);else if(a(m,"rangeType")){const e=M(m,t.boundedBy?.axisLabels.length>2||t.domainSet?.axisLabels.length>2);t.rangeType=e.rangeType,r=e.bandNames,n=e.bandStats;const{bandNoDataValues:i}=e;i?.length&&(s=b(i))}else if(a(m,"domainSet"))t.domainSet=E(m,t.boundedBy?.axisLabels);else if(a(m,"metadata")){const e=u(m,"EOMetadata");t.eoMetadata=e?V(e):null}}const{coverageId:m,boundedBy:p,domainSet:c,rangeType:d,serviceParameters:f}=t,g=P(d,p,c);!n&&g&&(n=g?.variables[0].statistics),null!=g&&(s=d[0][0].nilValue);return{id:m,title:m,description:m,lonLatEnvelope:null,bandNames:r,rasterInfo:new i({width:c.columns,height:c.rows,pixelSize:c.resolution,extent:p.envelope,spatialReference:p.envelope.spatialReference,bandCount:r.length||1,statistics:n,noDataValue:s,multidimensionalInfo:g}),supportedFormats:f.supportedFormats,supportedInterpolations:null,coverageDescription:t,version:"2.0.1",useEPSGAxis:!1}}function F(e,t){let n=null;if("string"==typeof e){n=(new DOMParser).parseFromString(e,"text/xml")}else n=e;if("1.0.0"===t){return s(n,"CoverageOffering").map((e=>y(e)))}const i=s(n,"CoverageDescription");return"1.1.0"===t||"1.1.1"===t||"1.1.2"===t?i.map((e=>R(e,t))):i.map((e=>A(e)))}export{F as parseCoverages,d as standardizeInterpolations};
|
|
5
|
+
import e from"../../../geometry/Extent.js";import t from"../../../geometry/Polygon.js";import{isAxesOrderReversedForWkid as n}from"../../ogc/crsUtils.js";import i from"../RasterInfo.js";import{getDimensionValues as s}from"./multidimensionalUtils.js";import{getElements as a,isSameTagIgnoreNS as o,getElementValue as l,getElementValues as r,getNodeNameIgnoreNS as u,getElement as m,getSpaceDelimitedNumericValues as p}from"./xmlUtilities.js";function c(e){e.variables.forEach((e=>e.dimensions.forEach((e=>e.values??=s(e)))))}function d(e){return{requestResponseCRSs:r(e,"requestResponseCRSs").map((e=>e.split(":")[1])),nativeCRSs:r(e,"nativeCRSs").map((e=>e.split(":")[1]))}}function f(e,t){const n=r(e,"1.0.0"===t?"interpolationMethod":"InterpolationMethod"),i="1.0.0"===t?e.getAttribute("default"):l(e,"InterpolationMethods/Default");return null!=i?[i].concat(n.filter((e=>e.toLowerCase()!==i.toLowerCase()))):n}function g(e){return null==e?["nearest"]:e.map((e=>{const t=e.toLowerCase();return t.includes("nearest")?"nearest":t.includes("linear")?"bilinear":t.includes("cubic")?"cubic":null})).filter((e=>!!e))}function h(t){const n=a(t,"pos"),i=p(n[0]),s=p(n[1]);return new e({xmin:i[0],ymin:i[1],xmax:s[0],ymax:s[1],spatialReference:{wkid:4326}})}function b(e,t){const n=r(e,t);return n?.length&&""!==n[0]&&!isNaN(Number(n[0]))?n.map((e=>Number(e))):null}function x(e){const t=p(e,"MinimumValue"),n=p(e,"MaximumValue");return t.length&&n.length?t.map(((e,t)=>({min:e,max:n[t],avg:-1,stddev:-1}))):null}function v(e){return null==e?null:e.every((t=>t===e[0]))?e[0]:e}function D(e){const t=[],n=a(e,"RangeSet");let i=[];for(let s=0;s<n.length;s++){const e=l(n[s],"name"),o=l(n[s],"label"),u=[],m=b(n[s],"nullValues/singleValue"),p=a(n[s],"AxisDescription");for(let t=0;t<p.length;t++){const e=l(p[t],"name"),n=l(p[t],"label"),s=r(p[t],"singleValue");if(0===s.length){const e=l(p[t],"min"),n=l(p[t],"max"),i=Number(l(p[t],"res"))||1;if(null!==e&&null!==n)for(let t=parseInt(e,10);t<=parseInt(n,10);t+=i)s.push(t.toString())}"band"===e.toLowerCase()&&(i=s),u.push({name:e,label:n,values:s})}t.push({name:e,label:o,nullValues:m,axis:u})}return{rangeSet:t,bandNames:i}}function w(e=null){if(!e)return{resolution:null,units:null};let t=e.toUpperCase();const n=["Y","M","D"],i=["H","M","S"],s=["Years","Months","Days","Hours","Minutes","Seconds"];let a,o,l;return t.includes("PT")?(t=t.slice(2),l=i.findIndex((e=>t.includes(e))),a=s[3+l],o=parseFloat(t.substring(0,t.length-1))):(t=t.slice(1),l=n.findIndex((e=>t.includes(e))),l>-1&&(a=s[l]),o=parseFloat(t.substring(0,t.length-1))),{resolution:o,units:a}}function y(e){const t=a(e,"timeposition");if(t.length>0){const e=[];for(let n=0;n<t.length;n++)e.push(new Date(l(t[n])));return{begin:e[0],end:e[e.length-1],values:e}}const n=m(e,"timePeriod")||m(e,"TimePeriod");if(n){return{begin:new Date(l(n,"beginPosition")||l(n,"BeginPosition")),end:new Date(l(n,"endPosition")||l(n,"EndPosition")),...w(l(n,"timeResolution")||l(n,"TimeResolution"))}}return null}function S(t){const n=m(t,"spatialDomain"),i=m(n,"Envelope")||m(n,"EnvelopeWithTimePeriod"),s=i.getAttribute("srsName").split(":"),o=s[s.length-1],r=a(i,"pos"),u=p(r[0]),c=p(r[1]),d=parseInt(o,10),f=isNaN(d)?null:{wkid:d},g=new e({xmin:u[0],ymin:u[1],xmax:c[0],ymax:c[1],spatialReference:f}),h=m(n,"RectifiedGrid"),b=l(h,"low").split(" "),x=l(h,"high").split(" "),v=parseInt(x[0],10)-parseInt(b[0],10)+1,D=parseInt(x[1],10)-parseInt(b[1],10)+1,w=p(n,"origin/pos"),S=a(n,"offsetVector"),I={envelope:g,columns:v,rows:D,offset:{x:parseFloat(l(S[0]).split(" ")[0]),y:parseFloat(l(S[1]).split(" ")[1])},origin:{x:w[0],y:w[1]}},L=m(t,"temporalDomain")||m(t,"TemporalDomain");return{spatialDomain:I,temporalDomain:L?y(L):null}}function I(e){const t={version:"1.0"};let n,s=[];for(let i=0;i<e.childNodes.length;i++){const a=e.childNodes[i];if(1===a.nodeType)if(o(a,"description"))t.description=l(a);else if(o(a,"name"))t.name=l(a);else if(o(a,"label"))t.label=l(a);else if(o(a,"supportedFormats"))t.supportedFormats=r(a,"formats");else if(o(a,"supportedCRSs"))t.supportedCRSs=d(a);else if(o(a,"supportedInterpolations"))t.supportedInterpolations=f(a,"1.0.0");else if(o(a,"lonLatEnvelope"))t.lonLatEnvelope=h(a);else if(o(a,"rangeSet")){const e=D(a);t.rangeSet=e.rangeSet,s=e.bandNames;const i=e.rangeSet[0].nullValues;i?.length&&(n=v(i))}else o(a,"domainSet")&&(t.domainSet=S(a))}const a=g(t.supportedInterpolations),{name:u,description:m,label:p,lonLatEnvelope:c,supportedFormats:b}=t,{spatialDomain:x}=t.domainSet,w={x:Math.abs(x.offset.x),y:Math.abs(x.offset.y)},y=L(t.domainSet),I=new i({width:x.columns,height:x.rows,pixelSize:w,extent:x.envelope,spatialReference:x.envelope.spatialReference,bandCount:s.length||1,noDataValue:n,multidimensionalInfo:y});return{id:u,title:t.name,description:m||p,lonLatEnvelope:c,rasterInfo:I,bandNames:s,supportedFormats:b,supportedInterpolations:a,coverageDescription:t,version:"1.0.0",useEPSGAxis:!1}}function L(e){if(!e.temporalDomain)return null;const{begin:t,end:n,values:i,units:s,resolution:a}=e.temporalDomain,o={variables:[{name:"default",description:"",dimensions:[{name:"StdTime",description:"",unit:"ISO8601",values:i?.map((e=>e.getTime())),hasRegularIntervals:!i,interval:a,intervalUnit:s,extent:[t.getTime(),n.getTime()]}]}]};return c(o),o}function C(e,t){const n=[],i=a(e,"Field");let s,o=[];for(let u=0;u<i.length;u++){const e=l(i[u],"Identifier"),p=l(i[u],"Description"),c=l(i[u],"Definition"),d=l(i[u],"Abstract"),g=l(i[u],"Title"),h=b(i[u],"NullValue"),v=m(i[u],"AllowedValues"),D=v?x(v):null,w=f(i[u],"1.1.0"),y=[],S=a(i[u],"Axis");for(let n=0;n<S.length;n++){const e=S[n].getAttribute("identifier"),i=l(S[n],"UOM"),a=l(S[n],"DataType"),u=r(S[n],"Key");t&&!e.toLowerCase().includes("band")||(o=u,s=h),y.push({identifier:e,uom:i,dataType:a,values:u,bandNoDataValues:s})}n.push({identifier:e,description:p,definition:c,abstract:d,title:g,supportedInterpolations:w,axis:y,nullValues:h,statistics:D})}return{rangeSet:n,bandNames:o,bandNoDataValues:s,statistics:n[0].statistics}}function T(e,t){if(!t.temporalDomain)return null;const n=e.filter((e=>!e.identifier.toLowerCase().includes("field_1")&&!e.axis.some((e=>e.identifier.includes("band"))))),i=[];if(n.length&&n.forEach((e=>{const t=e.axis.map((e=>{const t=e.values.map((t=>{if("ISO8601"===e.uom){return(t=t.trim()).toLowerCase().includes("z")?new Date(t).getTime():new Date(t+"Z").getTime()}return parseFloat(t.trim())})),n=[Math.min.apply(null,t),Math.max.apply(null,t)];return{name:e.identifier.trim(),description:"",field:e.identifier.trim(),unit:e.uom?e.uom.trim():"",hasRegularIntervals:!1,values:t,extent:n}}));i.push({name:e.identifier.trim(),description:e.description?.trim()??"",unit:"",dimensions:t,statistics:e.statistics})})),t.temporalDomain){const{begin:e,end:n,values:s,units:a,resolution:o}=t.temporalDomain;i.some((e=>e.dimensions.some((e=>"stdtime"===e.name.toLowerCase()))))||i.forEach((t=>{t.dimensions.push({name:"StdTime",description:"",unit:"ISO8601",values:s?.map((e=>e.getTime())),hasRegularIntervals:!s,interval:o,intervalUnit:a,extent:[e.getTime(),n.getTime()]})}))}if(i.length){const e={variables:i};return c(e),e}return null}function R(t){const i=m(t,"SpatialDomain"),s=m(i,"GridCRS"),o=l(s,"GridBaseCRS"),r=l(s,"GridOrigin"),u=r?.split(" ").map((e=>parseFloat(e)))??[0,0],c=p(s,"GridOffsets"),d=a(i,"BoundingBox");let f,g,h,b;for(let n=0;n<d.length;n++){const t=d[n].getAttribute("crs")?.toLowerCase();if(null!=t)if(t.includes("imagecrs")){const e=p(d[n],"LowerCorner"),t=p(d[n],"UpperCorner");f=t[0]-e[0]+1,g=t[1]-e[1]+1}else if(t.indexOf("epsg")>0){const i=t.split(":");h=parseInt(i[i.length-1],10);const s=p(d[n],"LowerCorner"),a=p(d[n],"UpperCorner");b=new e({xmin:s[0],ymin:s[1],xmax:a[0],ymax:a[1],spatialReference:{wkid:h}})}}const x=f>g,v=b.xmax-b.xmin>b.ymax-b.ymin;let D=!1;n(h)&&(x===v?D=!1:(D=!0,b=new e({xmin:b.ymin,ymin:b.xmin,xmax:b.ymax,ymax:b.xmax,spatialReference:{wkid:h}})));const w={columns:f,rows:g,origin:{x:u[0],y:u[1]},offset:{x:c[0],y:c[c.length-1]},gridBaseCRS:o,envelope:b,useEPSGAxis:D},S=m(t,"temporalDomain")||m(t,"TemporalDomain");return{spatialDomain:w,temporalDomain:S?y(S):null}}function M(e,t){const n=[],s=[],a={supportedFormats:n,supportedCRSs:s,version:"1.1"};let o,r,m=[];for(let i=0;i<e.childNodes.length;i++){const t=e.childNodes[i];if(1!==t.nodeType)continue;const p=u(t).toLowerCase();switch(p){case"title":case"abstract":case"identifier":a[p]=l(t);break;case"supportedformat":{const e=l(t);n.includes(e)||n.push(e)}break;case"supportedcrs":{const e=l(t);s.includes(e)||s.push(e)}break;case"range":{const e=C(t,!!a.domain?.temporalDomain);a.range=e.rangeSet,m=e.bandNames;const{bandNoDataValues:n}=e;n?.length&&(o=v(n)),r=e.statistics}break;case"domain":a.domain=R(t)}}const p=g(a.range[0].supportedInterpolations),{identifier:c,abstract:d,title:f,domain:h,range:b}=a,x={x:Math.abs(h.spatialDomain.offset.x),y:Math.abs(h.spatialDomain.offset.y)},D=T(b,h);D&&(o=b[0].nullValues,1===o?.length&&(o=o[0]));const w=new i({width:h.spatialDomain.columns,height:h.spatialDomain.rows,pixelSize:x,extent:h.spatialDomain.envelope,spatialReference:h.spatialDomain.envelope.spatialReference,bandCount:m.length||1,noDataValue:o,statistics:r,multidimensionalInfo:D});return{id:c,title:a.title,description:d||f,lonLatEnvelope:null,bandNames:m,rasterInfo:w,supportedFormats:n,supportedInterpolations:p,coverageDescription:a,version:t,useEPSGAxis:h.spatialDomain.useEPSGAxis}}function N(t){const n=m(t,"Envelope")||m(t,"EnvelopeWithTimePeriod"),i=n.getAttribute("srsName"),s=i.slice(i.lastIndexOf("/")+1),a=n.getAttribute("axisLabels").split(" ").map((e=>e.trim())).filter((e=>""!==e.trim())),r=p(n,"lowerCorner"),u=p(n,"upperCorner"),c=!["y","lat","latitude","north","nor","n","b"].includes(a[0].toLowerCase());let d;const f=parseInt(s,10),g=isNaN(f)?null:{wkid:f};d=new e(c?{xmin:r[0],ymin:r[1],xmax:u[0],ymax:u[1],spatialReference:g}:{xmin:r[1],ymin:r[0],xmax:u[1],ymax:u[0],spatialReference:g});const h={mins:r,maxs:u},b=n.getAttribute("uomLabels").trim().split(" ");let x,v;if(o(n,"EnvelopeWithTimePeriod")){x=new Date(l(t,"beginPosition")||l(t,"BeginPosition")),v=new Date(l(t,"endPosition")||l(t,"EndPosition"));const e=b?.findIndex((e=>"oledatetime"===e?.toLowerCase()));e>-1&&(b[e]="ISO8601")}return{envelope:d,axisLabels:a,uomLabels:b.length?b:null,envelopeAllDims:h,beginPosition:x,endPosition:v,isEastFirst:c}}function E(e,t){const n=[],i=a(e,"DataRecord"),s=[];let o,r=[];for(let u=0;u<i.length;u++){const e=a(i[u],"field"),c=[];for(let n=0;n<e.length;n++){const i=e[n].getAttribute("name"),a=l(e[n],"description")||"",u=m(e[n],"uom")?.getAttribute("code")||"",d=p(e[n],"interval"),f=b(e[n],"nilValue")?.[0];t&&!i.toLowerCase().includes("band")||(s.push(i),d?.length&&(o=o||[],o.push({min:d[0],max:d[1],avg:-1,stddev:-1})),r.push(f)),c.push({name:i,description:a,uom:u,allowedValues:d,nilValue:f})}n.push(c)}return r.some((e=>null!=e))||(r=null),{rangeType:n,bandNames:s,bandStats:o,bandNoDataValues:r}}function P(e){let t=1,n="";const i=.01;return Math.abs(e-1/24)<1/24*i?n="Hours":Math.abs(e-1)<1*i?n="Days":e<1?(t=Math.round(24*e),n="Hours"):e>28-i&&e<31+i||Math.round(e/30)<12?n="Months":e>365-i&&e<366+i&&(n="Years"),{interval:t,intervalUnit:n}}function V(e,t,n){if(n.axisLabels.length<=2)return null;const i=[];for(let a=0;a<e.length;a++){const t=e[a];for(let e=0;e<t.length;e++)t[e].name.toLowerCase().includes("band")||i.push(t[e])}const s=[];if(i.length){const e=[];for(let i=2;i<n.axisLabels.length;i++){const s=t.uomLabels?.[i]?.trim()??"",a=n.axisLabels[i].toLowerCase().includes("time")||"iso8601"===s.toLowerCase()||"oledatetime"===s.toLowerCase();let o,l;if(a){const e=P(n.offset[i]);o=e.interval,l=e.intervalUnit}else o=n.offset[i],l=s;const r=[];a?(r.push((new Date).setTime(24*(t.envelopeAllDims.mins[i]-25569)*3600*1e3)),r.push((new Date).setTime(24*(t.envelopeAllDims.maxs[i]-25569)*3600*1e3))):(r.push(t.envelopeAllDims.mins[i]),r.push(t.envelopeAllDims.maxs[i])),e.push({name:n.axisLabels[i].trim(),description:n.axisLabels[i].trim(),unit:a?"ISO8601":s,hasRegularIntervals:!0,extent:r,interval:o,intervalUnit:l})}if(i.forEach((t=>{const{allowedValues:n}=t,i=2===n?.length?[{min:n[0],max:n[1],avg:-1,stddev:-1}]:null;s.push({name:t.name.trim(),description:t.description?.trim()??"",unit:t.uom.trim(),statistics:i,dimensions:e})})),s.length){const e={variables:s};return c(e),e}}return null}function A(e,t){const n=m(e,"RectifiedGrid"),i=p(n,"low"),s=p(n,"high"),o=[];for(let a=0;a<i.length;a++)o.push(s[a]-i[a]+1);const r=l(n,"axisLabels").split(" "),u=p(n,"origin/pos"),c=a(n,"offsetVector"),d=[];for(let a=0;a<c.length;a++){const e=p(c[a]),t=e.findIndex((e=>0!==e));d[t]=e[t]}const f=["y","lat","latitude","north","nor","n","b"];let g=!1;if(t?.length&&r?.length){g=[...t].sort(((e,t)=>e<t?-1:1)).join(",")===[...r].sort(((e,t)=>e<t?-1:1)).join(",")}const h=g?r:t;let b,x,v;return f.includes(h[0].toLowerCase())?(b=o[1],x=o[0],v={y:Math.abs(d[0]),x:Math.abs(d[1])}):(b=o[0],x=o[1],v={x:Math.abs(d[0]),y:Math.abs(d[1])}),{columns:b,rows:x,origin:u,offset:d,resolution:v,gridSamples:o,axisLabels:r,hasSameAxisLabelsAsBoundedBy:g}}function F(e){const n=m(e,"EarthObservation");if(!n)return null;const i=m(n,"phenomenonTime"),s=i?y(i):null,a=m(n,"phenomenonTime"),o=a?y(a):null,r=l(n,"featureOfInterest/Footprint/multiExtentOf/MultiSurface/surfaceMembers/Polygon/exterior/LinearRing/posList");let u=null;if(r){const e=r.split(" ").map((e=>e.trim())).filter((e=>null!=e&&""!==e)).map(Number);if(e.length){const n=[];for(let t=0;t<e.length/2;t+=2)n.push(e[t],e[t+1]);u=new t({rings:[[n]]})}}return{observation:{phenomenonTime:s,resultTime:o,footprint:u,identifier:l(e,"metaDataProperty/EarthObservationMetaData/identifier"),acquisitionType:l(e,"metaDataProperty/EarthObservationMetaData/acquisitionType"),status:l(e,"metaDataProperty/EarthObservationMetaData/status")}}}function O(e){const t={version:"2.0"};let n,s,a=[];for(let i=0;i<e.childNodes.length;i++){const u=e.childNodes[i];if(1===u.nodeType)if(o(u,"coverageId"))t.coverageId=l(u);else if(o(u,"ServiceParameters"))t.serviceParameters={supportedFormats:r(u,"nativeFormat")};else if(o(u,"boundedBy"))t.boundedBy=N(u);else if(o(u,"rangeType")){const e=E(u,t.boundedBy?.axisLabels.length>2||t.domainSet?.axisLabels.length>2);t.rangeType=e.rangeType,a=e.bandNames,n=e.bandStats;const{bandNoDataValues:i}=e;i?.length&&(s=v(i))}else if(o(u,"domainSet"))t.domainSet=A(u,t.boundedBy?.axisLabels);else if(o(u,"metadata")){const e=m(u,"EOMetadata");t.eoMetadata=e?F(e):null}}const{coverageId:u,boundedBy:p,domainSet:c,rangeType:d,serviceParameters:f}=t,g=V(d,p,c);!n&&g&&(n=g?.variables[0].statistics),null!=g&&(s=d[0][0].nilValue);return{id:u,title:u,description:u,lonLatEnvelope:null,bandNames:a,rasterInfo:new i({width:c.columns,height:c.rows,pixelSize:c.resolution,extent:p.envelope,spatialReference:p.envelope.spatialReference,bandCount:a.length||1,statistics:n,noDataValue:s,multidimensionalInfo:g}),supportedFormats:f.supportedFormats,supportedInterpolations:null,coverageDescription:t,version:"2.0.1",useEPSGAxis:!1}}function B(e,t){let n=null;if("string"==typeof e){n=(new DOMParser).parseFromString(e,"text/xml")}else n=e;if("1.0.0"===t){return a(n,"CoverageOffering").map((e=>I(e)))}const i=a(n,"CoverageDescription");return"1.1.0"===t||"1.1.1"===t||"1.1.2"===t?i.map((e=>M(e,t))):i.map((e=>O(e)))}export{B as parseCoverages,g as standardizeInterpolations};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "4.31.0-next.
|
|
3
|
+
"version": "4.31.0-next.20240710",
|
|
4
4
|
"homepage": "https://js.arcgis.com",
|
|
5
5
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
6
6
|
"keywords": [
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"process": false
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@esri/arcgis-html-sanitizer": "~4.0.
|
|
28
|
+
"@esri/arcgis-html-sanitizer": "~4.0.3",
|
|
29
29
|
"@esri/calcite-colors": "~6.1.0",
|
|
30
30
|
"@esri/calcite-components": "^2.8.5",
|
|
31
|
-
"@vaadin/grid": "~24.3.
|
|
31
|
+
"@vaadin/grid": "~24.3.15",
|
|
32
32
|
"@zip.js/zip.js": "~2.7.45",
|
|
33
33
|
"luxon": "~3.4.4",
|
|
34
34
|
"marked": "~12.0.2",
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const e="
|
|
5
|
+
const e="20240710",c="5a554e150e88f13f4994ee3ce0ca468d7d6bc88d";export{e as buildDate,c as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{timeExtentsEqual as a,setUniforms as
|
|
5
|
+
import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{timeExtentsEqual as a,setUniforms as e}from"../utils.js";import{BufferObject as r}from"../../../../webgl/BufferObject.js";import{DataType as s,BlendFactor as o,PrimitiveType as i,Usage as n,PixelFormat as m,TextureWrapMode as l}from"../../../../webgl/enums.js";import{Texture as p}from"../../../../webgl/Texture.js";import{TextureDescriptor as c}from"../../../../webgl/TextureDescriptor.js";import{VertexArrayObject as h}from"../../../../webgl/VertexArrayObject.js";import{VertexElementDescriptor as _}from"../../../../webgl/VertexElementDescriptor.js";class f{constructor(t){this._params=t,this.animated=!1}isCompatible(t){if(!(t instanceof f))return!1;if(!a(this._params.timeExtent,t._params.timeExtent))return!1;let e=!0;return e=e&&this._params.loadImagery===t._params.loadImagery,e=e&&this._params.color.kind===t._params.color.kind,e=e&&this._params.opacity.kind===t._params.opacity.kind,e}async load(a,e){const{extent:r,size:s}=a;t(e);const o=await this._params.loadImagery(r,s[0],s[1],this._params.timeExtent,e);return new x(o,{color:this._params.color,opacity:this._params.opacity})}render(t,a,r){const{context:s}=t,{program:n}=r;s.setFaceCullingEnabled(!1),s.setBlendingEnabled(!0),s.setBlendFunction(o.ONE,o.ONE_MINUS_SRC_ALPHA),s.useProgram(n),n.setUniformMatrix3fv("u_dvsMat3",a.dvsMat3),s.bindTexture(r.texture,0),n.setUniform1i("u_texture",0),n.setUniform1f("u_Min",r.min),n.setUniform1f("u_Max",r.max),e(n,"color","vec4",this._params.color),e(n,"opacity","float",this._params.opacity),s.bindVAO(r.vertexArray),s.drawArrays(i.TRIANGLE_STRIP,0,4)}}const d=new Map;d.set("a_position",0),d.set("a_texcoord",1);const w=new Map([["geometry",[new _("a_position",2,s.UNSIGNED_SHORT,0,8),new _("a_texcoord",2,s.UNSIGNED_SHORT,4,8)]]]),u={vsPath:"raster/flow/imagery",fsPath:"raster/flow/imagery",attributes:d};class x{constructor(t,a){this._flowData=t,this._values=a}attach(t){const{context:a}=t,{width:e,height:s}=this._flowData,o=r.createVertex(a,n.STATIC_DRAW,new Uint16Array([0,0,0,1,e,0,1,1,0,s,0,0,e,s,1,0])),i=new Map([["geometry",o]]),_=new h(a,d,w,i),f=[];"ramp"===this._values.color.kind&&f.push("vvColor"),"ramp"===this._values.opacity.kind&&f.push("vvOpacity");const x=t.painter.materialManager.getProgram(u,f);let g=1e6,y=-1e6;for(let r=0;r<s;r++)for(let t=0;t<e;t++)if(0!==this._flowData.mask[r*e+t]){const a=this._flowData.data[2*(r*e+t)],s=this._flowData.data[2*(r*e+t)+1],o=Math.sqrt(a*a+s*s);g=Math.min(g,o),y=Math.max(y,o)}const A=new Uint8Array(4*e*s);for(let r=0;r<s;r++)for(let t=0;t<e;t++)if(0!==this._flowData.mask[r*e+t]){const a=this._flowData.data[2*(r*e+t)],s=this._flowData.data[2*(r*e+t)+1],o=(Math.sqrt(a*a+s*s)-g)/(y-g);A[4*(r*e+t)]=255*o,A[4*(r*e+t)+1]=0,A[4*(r*e+t)+2]=0,A[4*(r*e+t)+3]=255}else A[4*(r*e+t)]=0,A[4*(r*e+t)+1]=0,A[4*(r*e+t)+2]=0,A[4*(r*e+t)+3]=0;const M=new c;M.internalFormat=m.RGBA,M.wrapMode=l.CLAMP_TO_EDGE,M.flipped=!0,M.width=e,M.height=s;const b=new p(a,M,A);this.vertexArray=_,this.program=x,this.texture=b,this.min=g,this.max=y,this._flowData=null}detach(){this.vertexArray.dispose(),this.texture.dispose()}get ready(){return this.program.compiled}}export{f as Imagery,x as ImageryResources};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{areStreamlinesCompatible as e,setUniforms as a}from"../utils.js";import{BufferObject as s}from"../../../../webgl/BufferObject.js";import{DataType as r,BlendFactor as i,PrimitiveType as o,Usage as n}from"../../../../webgl/enums.js";import{VertexArrayObject as m}from"../../../../webgl/VertexArrayObject.js";import{VertexElementDescriptor as p}from"../../../../webgl/VertexElementDescriptor.js";class _{constructor(t){this._params=t}get animated(){return this._params.flowSpeed>0}isCompatible(t){return t instanceof _&&e(this._params,t._params)}async load(e,a){const{extent:s,size:r}=e;t(a);const i=await this._params.loadImagery(s,r[0],r[1],this._params.timeExtent,a),{vertexData:o,indexData:n}=await this._params.createFlowMesh("Particles",this._params.simulationSettings,i,a);return new c(o,n,{color:this._params.color,opacity:this._params.opacity,size:this._params.size})}render(t,e,s){const{context:n}=t,{program:m}=s;n.setFaceCullingEnabled(!1),n.setBlendingEnabled(!0),n.setBlendFunction(i.ONE,i.ONE_MINUS_SRC_ALPHA),n.useProgram(m),m.setUniform1f("u_time",e.time),m.setUniform1f("u_trailLength",this._params.trailLength),m.setUniform1f("u_flowSpeed",this._params.flowSpeed),m.setUniform1f("u_featheringSize",this._params.featheringSize),m.setUniform1f("u_featheringOffset",this._params.featheringOffset),m.setUniform1f("u_introFade",this._params.introFade?1:0),m.setUniform1f("u_fadeToZero",this._params.fadeToZero?1:0),m.setUniform1f("u_decayRate",this._params.decayRate),m.setUniformMatrix3fv("u_dvsMat3",e.dvsMat3),m.setUniformMatrix3fv("u_displayViewMat3",e.displayViewMat3),a(m,"color","vec4",this._params.color),a(m,"opacity","float",this._params.opacity),a(m,"size","float",this._params.size),n.bindVAO(s.vertexArray),n.drawElements(o.TRIANGLES,s.indexCount,r.UNSIGNED_INT,0)}}const l=new Map;l.set("a_xyts0",0),l.set("a_xyts1",1),l.set("a_typeIdDurationSeed",2),l.set("a_extrudeInfo",3);const h=
|
|
5
|
+
import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{areStreamlinesCompatible as e,setUniforms as a}from"../utils.js";import{BufferObject as s}from"../../../../webgl/BufferObject.js";import{DataType as r,BlendFactor as i,PrimitiveType as o,Usage as n}from"../../../../webgl/enums.js";import{VertexArrayObject as m}from"../../../../webgl/VertexArrayObject.js";import{VertexElementDescriptor as p}from"../../../../webgl/VertexElementDescriptor.js";class _{constructor(t){this._params=t}get animated(){return this._params.flowSpeed>0}isCompatible(t){return t instanceof _&&e(this._params,t._params)}async load(e,a){const{extent:s,size:r}=e;t(a);const i=await this._params.loadImagery(s,r[0],r[1],this._params.timeExtent,a),{vertexData:o,indexData:n}=await this._params.createFlowMesh("Particles",this._params.simulationSettings,i,a);return new c(o,n,{color:this._params.color,opacity:this._params.opacity,size:this._params.size})}render(t,e,s){const{context:n}=t,{program:m}=s;n.setFaceCullingEnabled(!1),n.setBlendingEnabled(!0),n.setBlendFunction(i.ONE,i.ONE_MINUS_SRC_ALPHA),n.useProgram(m),m.setUniform1f("u_time",e.time),m.setUniform1f("u_trailLength",this._params.trailLength),m.setUniform1f("u_flowSpeed",this._params.flowSpeed),m.setUniform1f("u_featheringSize",this._params.featheringSize),m.setUniform1f("u_featheringOffset",this._params.featheringOffset),m.setUniform1f("u_introFade",this._params.introFade?1:0),m.setUniform1f("u_fadeToZero",this._params.fadeToZero?1:0),m.setUniform1f("u_decayRate",this._params.decayRate),m.setUniformMatrix3fv("u_dvsMat3",e.dvsMat3),m.setUniformMatrix3fv("u_displayViewMat3",e.displayViewMat3),a(m,"color","vec4",this._params.color),a(m,"opacity","float",this._params.opacity),a(m,"size","float",this._params.size),n.bindVAO(s.vertexArray),n.drawElements(o.TRIANGLES,s.indexCount,r.UNSIGNED_INT,0)}}const l=new Map;l.set("a_xyts0",0),l.set("a_xyts1",1),l.set("a_typeIdDurationSeed",2),l.set("a_extrudeInfo",3);const h=new Map([["geometry",[new p("a_xyts0",4,r.FLOAT,0,64),new p("a_xyts1",4,r.FLOAT,16,64),new p("a_typeIdDurationSeed",4,r.FLOAT,32,64),new p("a_extrudeInfo",4,r.FLOAT,48,64)]]]),f={vsPath:"raster/flow/particles",fsPath:"raster/flow/particles",attributes:l};class c{constructor(t,e,a){this._vertexData=t,this._indexData=e,this._values=a}attach(t){const{context:e}=t,a=s.createVertex(e,n.STATIC_DRAW,this._vertexData),r=s.createIndex(e,n.STATIC_DRAW,this._indexData),i=new Map([["geometry",a]]),o=new m(e,l,h,i,r),p=[];"ramp"===this._values.color.kind&&p.push("vvColor"),"ramp"===this._values.opacity.kind&&p.push("vvOpacity"),"ramp"===this._values.size.kind&&p.push("vvSize");const _=t.painter.materialManager.getProgram(f,p);this.vertexArray=o,this.program=_,this.indexCount=this._indexData.length,this._vertexData=null,this._indexData=null}detach(){this.vertexArray.dispose()}get ready(){return this.program.compiled}}export{_ as Particles,c as ParticlesResources};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{throwIfAborted as e}from"../../../../../core/promiseUtils.js";import{areStreamlinesCompatible as t,setUniforms as a}from"../utils.js";import{BufferObject as s}from"../../../../webgl/BufferObject.js";import{DataType as r,BlendFactor as i,PrimitiveType as o,Usage as n}from"../../../../webgl/enums.js";import{VertexArrayObject as m}from"../../../../webgl/VertexArrayObject.js";import{VertexElementDescriptor as p}from"../../../../webgl/VertexElementDescriptor.js";class _{constructor(e){this._params=e}get animated(){return this._params.flowSpeed>0}isCompatible(e){return e instanceof _&&t(this._params,e._params)}async load(t,a){const{extent:s,size:r}=t;e(a);const i=await this._params.loadImagery(s,r[0],r[1],this._params.timeExtent,a),{vertexData:o,indexData:n}=await this._params.createFlowMesh("Streamlines",this._params.simulationSettings,i,a);return new d(o,n,{color:this._params.color,opacity:this._params.opacity,size:this._params.size})}render(e,t,s){const{context:n}=e,{program:m}=s;n.setFaceCullingEnabled(!1),n.setBlendingEnabled(!0),n.setBlendFunction(i.ONE,i.ONE_MINUS_SRC_ALPHA),n.useProgram(m),m.setUniform1f("u_time",t.time),m.setUniform1f("u_trailLength",this._params.trailLength),m.setUniform1f("u_flowSpeed",this._params.flowSpeed),m.setUniform1f("u_featheringSize",this._params.featheringSize),m.setUniform1f("u_featheringOffset",this._params.featheringOffset),m.setUniform1f("u_introFade",this._params.introFade?1:0),m.setUniform1f("u_fadeToZero",this._params.fadeToZero?1:0),m.setUniform1f("u_decayRate",this._params.decayRate),m.setUniformMatrix3fv("u_dvsMat3",t.dvsMat3),m.setUniformMatrix3fv("u_displayViewMat3",t.displayViewMat3),a(m,"color","vec4",this._params.color),a(m,"opacity","float",this._params.opacity),a(m,"size","float",this._params.size),n.bindVAO(s.vertexArray),n.drawElements(o.TRIANGLES,s.indexCount,r.UNSIGNED_INT,0)}}const l=new Map;l.set("a_positionAndSide",0),l.set("a_timeInfo",1),l.set("a_extrude",2),l.set("a_speed",3);const h=
|
|
5
|
+
import{throwIfAborted as e}from"../../../../../core/promiseUtils.js";import{areStreamlinesCompatible as t,setUniforms as a}from"../utils.js";import{BufferObject as s}from"../../../../webgl/BufferObject.js";import{DataType as r,BlendFactor as i,PrimitiveType as o,Usage as n}from"../../../../webgl/enums.js";import{VertexArrayObject as m}from"../../../../webgl/VertexArrayObject.js";import{VertexElementDescriptor as p}from"../../../../webgl/VertexElementDescriptor.js";class _{constructor(e){this._params=e}get animated(){return this._params.flowSpeed>0}isCompatible(e){return e instanceof _&&t(this._params,e._params)}async load(t,a){const{extent:s,size:r}=t;e(a);const i=await this._params.loadImagery(s,r[0],r[1],this._params.timeExtent,a),{vertexData:o,indexData:n}=await this._params.createFlowMesh("Streamlines",this._params.simulationSettings,i,a);return new d(o,n,{color:this._params.color,opacity:this._params.opacity,size:this._params.size})}render(e,t,s){const{context:n}=e,{program:m}=s;n.setFaceCullingEnabled(!1),n.setBlendingEnabled(!0),n.setBlendFunction(i.ONE,i.ONE_MINUS_SRC_ALPHA),n.useProgram(m),m.setUniform1f("u_time",t.time),m.setUniform1f("u_trailLength",this._params.trailLength),m.setUniform1f("u_flowSpeed",this._params.flowSpeed),m.setUniform1f("u_featheringSize",this._params.featheringSize),m.setUniform1f("u_featheringOffset",this._params.featheringOffset),m.setUniform1f("u_introFade",this._params.introFade?1:0),m.setUniform1f("u_fadeToZero",this._params.fadeToZero?1:0),m.setUniform1f("u_decayRate",this._params.decayRate),m.setUniformMatrix3fv("u_dvsMat3",t.dvsMat3),m.setUniformMatrix3fv("u_displayViewMat3",t.displayViewMat3),a(m,"color","vec4",this._params.color),a(m,"opacity","float",this._params.opacity),a(m,"size","float",this._params.size),n.bindVAO(s.vertexArray),n.drawElements(o.TRIANGLES,s.indexCount,r.UNSIGNED_INT,0)}}const l=new Map;l.set("a_positionAndSide",0),l.set("a_timeInfo",1),l.set("a_extrude",2),l.set("a_speed",3);const h=new Map([["geometry",[new p("a_positionAndSide",3,r.FLOAT,0,36),new p("a_timeInfo",3,r.FLOAT,12,36),new p("a_extrude",2,r.FLOAT,24,36),new p("a_speed",1,r.FLOAT,32,36)]]]),f={vsPath:"raster/flow/streamlines",fsPath:"raster/flow/streamlines",attributes:l};class d{constructor(e,t,a){this._vertexData=e,this._indexData=t,this._values=a}attach(e){const{context:t}=e,a=s.createVertex(t,n.STATIC_DRAW,this._vertexData),r=s.createIndex(t,n.STATIC_DRAW,this._indexData),i=new Map([["geometry",a]]),o=new m(t,l,h,i,r),p=[];"ramp"===this._values.color.kind&&p.push("vvColor"),"ramp"===this._values.opacity.kind&&p.push("vvOpacity"),"ramp"===this._values.size.kind&&p.push("vvSize");const _=e.painter.materialManager.getProgram(f,p);this.vertexArray=o,this.program=_,this.indexCount=this._indexData.length,this._vertexData=null,this._indexData=null}detach(){this.vertexArray.dispose()}get ready(){return this.program.compiled}}export{_ as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import{identity as t,translate as e,rotate as a,scaleByVec2 as s,multiply as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{createVFMesh as l,createVFMeshScalar as n}from"../../../../layers/support/rasterFunctions/vectorFieldUtils.js";import{DisplayObject as c}from"../DisplayObject.js";import{createProgramDescriptor as h}from"../webgl/Utils.js";import{BufferObject as m}from"../../../webgl/BufferObject.js";import{Usage as u,DataType as d}from"../../../webgl/enums.js";import{VertexArrayObject as v}from"../../../webgl/VertexArrayObject.js";class f extends c{constructor(t=null){super(),this._source=null,this._symbolizerParameters=null,this._vaoInvalidated=!0,this.coordScale=[1,1],this.height=null,this.key=null,this.offset=null,this.stencilRef=0,this.resolution=null,this.pixelRatio=1,this.x=0,this.y=0,this.rotation=0,this.rawPixelData=null,this.vaoData=null,this.width=null,this.source=t}destroy(){null!=this.vaoData&&(this.vaoData.magdir?.vao.dispose(),this.vaoData.scalar?.vao.dispose(),this.vaoData=null)}get symbolizerParameters(){return this._symbolizerParameters}set symbolizerParameters(t){JSON.stringify(this._symbolizerParameters)!==JSON.stringify(t)&&(this._symbolizerParameters=t,this.invalidateVAO())}get source(){return this._source}set source(t){this._source=t,this.invalidateVAO()}invalidateVAO(){this._vaoInvalidated||null==this.vaoData||(this.vaoData.magdir?.vao.dispose(),this.vaoData.scalar?.vao.dispose(),this.vaoData=null,this._vaoInvalidated=!0,this.requestRender())}updateVectorFieldVAO(t){if(this._vaoInvalidated){if(this._vaoInvalidated=!1,null!=this.source&&null==this.vaoData){const{style:e}=this.symbolizerParameters;switch(e){case"beaufort_ft":case"beaufort_km":case"beaufort_kn":case"beaufort_m":case"beaufort_mi":case"classified_arrow":case"ocean_current_kn":case"ocean_current_m":case"single_arrow":{const e=l(this.source,this.symbolizerParameters),a=this._createVectorFieldVAO(t.context,e);this.vaoData={magdir:a}}break;case"simple_scalar":{const e=n(this.source,this.symbolizerParameters),a=this._createVectorFieldVAO(t.context,e);this.vaoData={scalar:a}}break;case"wind_speed":{const e=l(this.source,this.symbolizerParameters),a=this._createVectorFieldVAO(t.context,e),s=n(this.source,this.symbolizerParameters),i=this._createVectorFieldVAO(t.context,s);this.vaoData={magdir:a,scalar:i}}}}this.ready(),this.requestRender()}}_createTransforms(){return{displayViewScreenMat3:r()}}setTransform(r){const l=t(this.transforms.displayViewScreenMat3),[n,c]=r.toScreenNoRotation([0,0],[this.x,this.y]),h=this.resolution/this.pixelRatio/r.resolution,m=h*this.width,u=h*this.height,d=Math.PI*this.rotation/180;e(l,l,o(n,c)),e(l,l,o(m/2,u/2)),a(l,l,-d),e(l,l,o(-m/2,-u/2)),s(l,l,o(m,u)),i(this.transforms.displayViewScreenMat3,r.displayViewMat3,l)}onAttach(){this.invalidateVAO()}onDetach(){this.invalidateVAO()}_createVectorFieldVAO(t,e){const{vertexData:a,indexData:s}=e,i=m.createVertex(t,u.STATIC_DRAW,new Float32Array(a)),r=m.createIndex(t,u.STATIC_DRAW,new Uint32Array(s)),o=h("vector-field",{geometry:[{location:0,name:"a_pos",count:2,type:d.FLOAT,normalized:!1},{location:1,name:"a_offset",count:2,type:d.FLOAT,normalized:!1},{location:2,name:"a_vv",count:2,type:d.FLOAT,normalized:!1}]});return{vao:new v(t,o.attributes,o.bufferLayouts,
|
|
5
|
+
import"../../../../core/has.js";import{identity as t,translate as e,rotate as a,scaleByVec2 as s,multiply as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{createVFMesh as l,createVFMeshScalar as n}from"../../../../layers/support/rasterFunctions/vectorFieldUtils.js";import{DisplayObject as c}from"../DisplayObject.js";import{createProgramDescriptor as h}from"../webgl/Utils.js";import{BufferObject as m}from"../../../webgl/BufferObject.js";import{Usage as u,DataType as d}from"../../../webgl/enums.js";import{VertexArrayObject as v}from"../../../webgl/VertexArrayObject.js";class f extends c{constructor(t=null){super(),this._source=null,this._symbolizerParameters=null,this._vaoInvalidated=!0,this.coordScale=[1,1],this.height=null,this.key=null,this.offset=null,this.stencilRef=0,this.resolution=null,this.pixelRatio=1,this.x=0,this.y=0,this.rotation=0,this.rawPixelData=null,this.vaoData=null,this.width=null,this.source=t}destroy(){null!=this.vaoData&&(this.vaoData.magdir?.vao.dispose(),this.vaoData.scalar?.vao.dispose(),this.vaoData=null)}get symbolizerParameters(){return this._symbolizerParameters}set symbolizerParameters(t){JSON.stringify(this._symbolizerParameters)!==JSON.stringify(t)&&(this._symbolizerParameters=t,this.invalidateVAO())}get source(){return this._source}set source(t){this._source=t,this.invalidateVAO()}invalidateVAO(){this._vaoInvalidated||null==this.vaoData||(this.vaoData.magdir?.vao.dispose(),this.vaoData.scalar?.vao.dispose(),this.vaoData=null,this._vaoInvalidated=!0,this.requestRender())}updateVectorFieldVAO(t){if(this._vaoInvalidated){if(this._vaoInvalidated=!1,null!=this.source&&null==this.vaoData){const{style:e}=this.symbolizerParameters;switch(e){case"beaufort_ft":case"beaufort_km":case"beaufort_kn":case"beaufort_m":case"beaufort_mi":case"classified_arrow":case"ocean_current_kn":case"ocean_current_m":case"single_arrow":{const e=l(this.source,this.symbolizerParameters),a=this._createVectorFieldVAO(t.context,e);this.vaoData={magdir:a}}break;case"simple_scalar":{const e=n(this.source,this.symbolizerParameters),a=this._createVectorFieldVAO(t.context,e);this.vaoData={scalar:a}}break;case"wind_speed":{const e=l(this.source,this.symbolizerParameters),a=this._createVectorFieldVAO(t.context,e),s=n(this.source,this.symbolizerParameters),i=this._createVectorFieldVAO(t.context,s);this.vaoData={magdir:a,scalar:i}}}}this.ready(),this.requestRender()}}_createTransforms(){return{displayViewScreenMat3:r()}}setTransform(r){const l=t(this.transforms.displayViewScreenMat3),[n,c]=r.toScreenNoRotation([0,0],[this.x,this.y]),h=this.resolution/this.pixelRatio/r.resolution,m=h*this.width,u=h*this.height,d=Math.PI*this.rotation/180;e(l,l,o(n,c)),e(l,l,o(m/2,u/2)),a(l,l,-d),e(l,l,o(-m/2,-u/2)),s(l,l,o(m,u)),i(this.transforms.displayViewScreenMat3,r.displayViewMat3,l)}onAttach(){this.invalidateVAO()}onDetach(){this.invalidateVAO()}_createVectorFieldVAO(t,e){const{vertexData:a,indexData:s}=e,i=m.createVertex(t,u.STATIC_DRAW,new Float32Array(a)),r=m.createIndex(t,u.STATIC_DRAW,new Uint32Array(s)),o=h("vector-field",{geometry:[{location:0,name:"a_pos",count:2,type:d.FLOAT,normalized:!1},{location:1,name:"a_offset",count:2,type:d.FLOAT,normalized:!1},{location:2,name:"a_vv",count:2,type:d.FLOAT,normalized:!1}]});return{vao:new v(t,o.attributes,o.bufferLayouts,new Map([["geometry",i]]),r),elementCount:s.length}}}export{f as RasterVFDisplayObject};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as t}from"../../../../core/maybe.js";import{estimateSize as e}from"../../../../core/typedArrayUtil.js";import"../../tiling/TileInfoView.js";import r from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{BucketType as n}from"./enums.js";import{deserializeSymbols as s}from"./decluttering/util.js";import{BufferObject as i}from"../../../webgl/BufferObject.js";import{Usage as a}from"../../../webgl/enums.js";import{VertexArrayObject as o}from"../../../webgl/VertexArrayObject.js";class h{constructor(t,e){this.layerUIDs=[],this.isDestroyed=!1,this._data=t;let r=1;const n=new Uint32Array(t);this.layerUIDs=[];const s=n[r++];for(let i=0;i<s;i++)this.layerUIDs[i]=n[r++];this.bufferDataOffset=r,e&&(this.layer=e.getStyleLayerByUID(this.layerUIDs[0]))}get isPreparedForRendering(){return null==this._data}get offset(){return this.bufferDataOffset}get data(){return this._data}destroy(){this.isDestroyed||(this.doDestroy(),this._data=null,this.isDestroyed=!0)}prepareForRendering(t){null!=this._data&&(this.doPrepareForRendering(t,this._data,this.bufferDataOffset),this._data=null)}}class l extends h{constructor(t,e){super(t,e),this.type=n.LINE,this.lineIndexStart=0,this.lineIndexCount=0;const r=new Uint32Array(t);let s=this.bufferDataOffset;this.lineIndexStart=r[s++],this.lineIndexCount=r[s++];const i=r[s++];if(i>0){this.patternMap=new Map;for(let t=0;t<i;t++){const t=r[s++],e=r[s++],n=r[s++];this.patternMap.set(t,[e,n])}}this.bufferDataOffset=s}get usedMemory(){return(this.data?.byteLength??0)+(this.vao?.usedMemory??0)}hasData(){return this.lineIndexCount>0}triangleCount(){return this.lineIndexCount/3}doDestroy(){this.vao=t(this.vao)}doPrepareForRendering(t,e,r){const n=new Uint32Array(e),s=new Int32Array(n.buffer),h=n[r++],l=i.createVertex(t,a.STATIC_DRAW,new Int32Array(s.buffer,4*r,h));r+=h;const f=n[r++],u=i.createIndex(t,a.STATIC_DRAW,new Uint32Array(n.buffer,4*r,f));r+=f;const c=this.layer.lineMaterial;this.vao=new o(t,c.getAttributeLocations(),c.getLayoutInfo(),
|
|
5
|
+
import{disposeMaybe as t}from"../../../../core/maybe.js";import{estimateSize as e}from"../../../../core/typedArrayUtil.js";import"../../tiling/TileInfoView.js";import r from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{BucketType as n}from"./enums.js";import{deserializeSymbols as s}from"./decluttering/util.js";import{BufferObject as i}from"../../../webgl/BufferObject.js";import{Usage as a}from"../../../webgl/enums.js";import{VertexArrayObject as o}from"../../../webgl/VertexArrayObject.js";class h{constructor(t,e){this.layerUIDs=[],this.isDestroyed=!1,this._data=t;let r=1;const n=new Uint32Array(t);this.layerUIDs=[];const s=n[r++];for(let i=0;i<s;i++)this.layerUIDs[i]=n[r++];this.bufferDataOffset=r,e&&(this.layer=e.getStyleLayerByUID(this.layerUIDs[0]))}get isPreparedForRendering(){return null==this._data}get offset(){return this.bufferDataOffset}get data(){return this._data}destroy(){this.isDestroyed||(this.doDestroy(),this._data=null,this.isDestroyed=!0)}prepareForRendering(t){null!=this._data&&(this.doPrepareForRendering(t,this._data,this.bufferDataOffset),this._data=null)}}class l extends h{constructor(t,e){super(t,e),this.type=n.LINE,this.lineIndexStart=0,this.lineIndexCount=0;const r=new Uint32Array(t);let s=this.bufferDataOffset;this.lineIndexStart=r[s++],this.lineIndexCount=r[s++];const i=r[s++];if(i>0){this.patternMap=new Map;for(let t=0;t<i;t++){const t=r[s++],e=r[s++],n=r[s++];this.patternMap.set(t,[e,n])}}this.bufferDataOffset=s}get usedMemory(){return(this.data?.byteLength??0)+(this.vao?.usedMemory??0)}hasData(){return this.lineIndexCount>0}triangleCount(){return this.lineIndexCount/3}doDestroy(){this.vao=t(this.vao)}doPrepareForRendering(t,e,r){const n=new Uint32Array(e),s=new Int32Array(n.buffer),h=n[r++],l=i.createVertex(t,a.STATIC_DRAW,new Int32Array(s.buffer,4*r,h));r+=h;const f=n[r++],u=i.createIndex(t,a.STATIC_DRAW,new Uint32Array(n.buffer,4*r,f));r+=f;const c=this.layer.lineMaterial;this.vao=new o(t,c.getAttributeLocations(),c.getLayoutInfo(),new Map([["geometry",l]]),u)}}class f extends h{constructor(t,e){super(t,e),this.type=n.FILL,this.fillIndexStart=0,this.fillIndexCount=0,this.outlineIndexStart=0,this.outlineIndexCount=0;const r=new Uint32Array(t);let s=this.bufferDataOffset;this.fillIndexStart=r[s++],this.fillIndexCount=r[s++],this.outlineIndexStart=r[s++],this.outlineIndexCount=r[s++];const i=r[s++];if(i>0){this.patternMap=new Map;for(let t=0;t<i;t++){const t=r[s++],e=r[s++],n=r[s++];this.patternMap.set(t,[e,n])}}this.bufferDataOffset=s}get usedMemory(){return(this.data?.byteLength??0)+(this.fillVAO?.usedMemory??0)+(this.outlineVAO?.usedMemory??0)}hasData(){return this.fillIndexCount>0||this.outlineIndexCount>0}triangleCount(){return(this.fillIndexCount+this.outlineIndexCount)/3}doDestroy(){this.fillVAO=t(this.fillVAO),this.outlineVAO=t(this.outlineVAO)}doPrepareForRendering(t,e,r){const n=new Uint32Array(e),s=new Int32Array(n.buffer),h=n[r++],l=i.createVertex(t,a.STATIC_DRAW,new Int32Array(s.buffer,4*r,h));r+=h;const f=n[r++],u=i.createIndex(t,a.STATIC_DRAW,new Uint32Array(n.buffer,4*r,f));r+=f;const c=n[r++],y=i.createVertex(t,a.STATIC_DRAW,new Int32Array(s.buffer,4*r,c));r+=c;const d=n[r++],A=i.createIndex(t,a.STATIC_DRAW,new Uint32Array(n.buffer,4*r,d));r+=d;const p=this.layer,I=p.fillMaterial,g=p.outlineMaterial;this.fillVAO=new o(t,I.getAttributeLocations(),I.getLayoutInfo(),new Map([["geometry",l]]),u),this.outlineVAO=new o(t,g.getAttributeLocations(),g.getLayoutInfo(),new Map([["geometry",y]]),A)}}class u extends h{constructor(t,e,i){super(t,e),this.type=n.SYMBOL,this.iconPerPageElementsMap=new Map,this.glyphPerPageElementsMap=new Map,this.symbolInstances=[],this.isIconSDF=!1,this.opacityChanged=!1,this.lastOpacityUpdate=0,this.symbols=[];const a=new Uint32Array(t),o=new Int32Array(t),h=new Float32Array(t);let l=this.bufferDataOffset;this.isIconSDF=!!a[l++];const f=a[l++],u=a[l++],c=a[l++],y=new r(f,u,c,0),d=a[l++];for(let r=0;r<d;r++){const t=a[l++],e=a[l++],r=a[l++];this.iconPerPageElementsMap.set(t,[e,r])}const A=a[l++];for(let r=0;r<A;r++){const t=a[l++],e=a[l++],r=a[l++];this.glyphPerPageElementsMap.set(t,[e,r])}const p=a[l++],I=a[l++];this.iconOpacity=new Int32Array(p),this.textOpacity=new Int32Array(I),l=s(a,o,h,l,this.symbols,i,y),this.bufferDataOffset=l}get usedMemory(){return(this.data?.byteLength??0)+(this.iconVAO?.usedMemory??0)+(this.textVAO?.usedMemory??0)+e(this.iconOpacity)+e(this.textOpacity)}hasData(){return this.iconPerPageElementsMap.size>0||this.glyphPerPageElementsMap.size>0}triangleCount(){let t=0;for(const e of this.iconPerPageElementsMap.values())t+=e[1];for(const e of this.glyphPerPageElementsMap.values())t+=e[1];return t/3}doDestroy(){this.iconVAO=t(this.iconVAO),this.textVAO=t(this.textVAO)}updateOpacityInfo(){if(!this.opacityChanged)return;this.opacityChanged=!1;const t=this.iconOpacity,e=this.iconVAO.vertexBuffers.get("opacity");t.length>0&&t.byteLength===e.usedMemory&&e.setSubData(t,0,0,t.length);const r=this.textOpacity,n=this.textVAO.vertexBuffers.get("opacity");r.length>0&&r.byteLength===n.usedMemory&&n.setSubData(r,0,0,r.length)}doPrepareForRendering(t,e,r){const n=new Uint32Array(e),s=new Int32Array(n.buffer),h=n[r++],l=i.createVertex(t,a.STATIC_DRAW,new Int32Array(s.buffer,4*r,h));r+=h;const f=n[r++],u=i.createIndex(t,a.STATIC_DRAW,new Uint32Array(n.buffer,4*r,f));r+=f;const c=n[r++],y=i.createVertex(t,a.STATIC_DRAW,new Int32Array(s.buffer,4*r,c));r+=c;const d=n[r++],A=i.createIndex(t,a.STATIC_DRAW,new Uint32Array(n.buffer,4*r,d));r+=d;const p=i.createVertex(t,a.STATIC_DRAW,this.iconOpacity.buffer),I=i.createVertex(t,a.STATIC_DRAW,this.textOpacity.buffer),g=this.layer,x=g.iconMaterial,b=g.textMaterial;this.iconVAO=new o(t,x.getAttributeLocations(),x.getLayoutInfo(),new Map([["geometry",l],["opacity",p]]),u),this.textVAO=new o(t,b.getAttributeLocations(),b.getLayoutInfo(),new Map([["geometry",y],["opacity",I]]),A)}}class c extends h{constructor(t,e){super(t,e),this.type=n.CIRCLE,this.circleIndexStart=0,this.circleIndexCount=0;const r=new Uint32Array(t);let s=this.bufferDataOffset;this.circleIndexStart=r[s++],this.circleIndexCount=r[s++],this.bufferDataOffset=s}get usedMemory(){return(this.data?.byteLength??0)+(this.vao?.usedMemory??0)}hasData(){return this.circleIndexCount>0}triangleCount(){return this.circleIndexCount/3}doDestroy(){this.vao=t(this.vao)}doPrepareForRendering(t,e,r){const n=new Uint32Array(e),s=new Int32Array(n.buffer),h=n[r++],l=i.createVertex(t,a.STATIC_DRAW,new Int32Array(s.buffer,4*r,h));r+=h;const f=n[r++],u=i.createIndex(t,a.STATIC_DRAW,new Uint32Array(n.buffer,4*r,f));r+=f;const c=this.layer.circleMaterial;this.vao=new o(t,c.getAttributeLocations(),c.getLayoutInfo(),new Map([["geometry",l]]),u)}}export{c as CircleRenderBucket,f as FillRenderBucket,l as LineRenderBucket,h as RenderBucketBase,u as SymbolRenderBucket};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../MemoryBuffer.js";import{EncodingType as e,AttributeStatus as n}from"./enums.js";import{DataType as o}from"../../../../webgl/enums.js";import{VertexElementDescriptor as s}from"../../../../webgl/VertexElementDescriptor.js";class r{constructor(t){this._locations=new Map,this._key=t}get key(){return this._key}get type(){return 7&this._key}defines(){return[]}getStride(){return this.
|
|
5
|
+
import t from"../MemoryBuffer.js";import{EncodingType as e,AttributeStatus as n}from"./enums.js";import{DataType as o}from"../../../../webgl/enums.js";import{VertexElementDescriptor as s}from"../../../../webgl/VertexElementDescriptor.js";class r{constructor(t){this._locations=new Map,this._key=t}get key(){return this._key}get type(){return 7&this._key}defines(){return[]}getStride(){return this._layout||this._buildAttributesInfo(),this._stride}getAttributeLocations(){return 0===this._locations.size&&this._buildAttributesInfo(),this._locations}getLayoutInfo(){return this._layout||this._buildAttributesInfo(),this._layout}getEncodingInfos(){return this._propertyEncodingInfo||this._buildAttributesInfo(),this._propertyEncodingInfo}getUniforms(){return this._uniforms||this._buildAttributesInfo(),this._uniforms}getShaderHeader(){return this._shaderHeader||this._buildAttributesInfo(),this._shaderHeader}getShaderMain(){return this._shaderMain||this._buildAttributesInfo(),this._shaderMain}setDataUniforms(t,e,n,o,s){const r=this.getUniforms();for(const i of r){const{name:r,type:a,getValue:c}=i,u=c(n,e,o,s);if(null!==u)switch(a){case"float":t.setUniform1f(r,u);break;case"vec2":t.setUniform2fv(r,u);break;case"vec4":t.setUniform4fv(r,u)}}}encodeAttributes(t,n,o,s){const r=this.attributesInfo(),i=this.getEncodingInfos(),a=[];let c=0,u=0;for(const _ of Object.keys(i)){const l=i[_],{type:f,precisionFactor:h,isLayout:d}=r[_],y=d?o.getLayoutProperty(_):o.getPaintProperty(_),m=y.interpolator?.getInterpolationRange(n);let E=0;for(const o of l){const{offset:r,bufferElementsToAdd:i}=o;if(i>0){for(let t=0;t<i;t++)a.push(0);c+=u,u=o.bufferElementsToAdd}const _=s??y.getValue(m?m[E]:n,t);switch(f){case e.R8_SIGNED:case e.R8_UNSIGNED:a[c]|=this._encodeByte(_*(h||1),8*r);break;case e.R16_SIGNED:case e.R16_UNSIGNED:a[c]|=this._encodeShort(_*(h||1),8*r);break;case e.R8G8_SIGNED:case e.R8G8_UNSIGNED:a[c]|=this._encodeByte(_*(h||1),8*r),a[c]|=this._encodeByte(_*(h||1),8*r+8);break;case e.R16G16_SIGNED:case e.R16G16_UNSIGNED:a[c]|=this._encodeShort(_*(h||1),8*r),a[c]|=this._encodeShort(_*(h||1),8*r+16);break;case e.R8G8B8A8_SIGNED:case e.R8G8B8A8_UNSIGNED:a[c]|=this._encodeByte(_*(h||1),8*r),a[c]|=this._encodeByte(_*(h||1),8*r+8),a[c]|=this._encodeByte(_*(h||1),8*r+16),a[c]|=this._encodeByte(_*(h||1),8*r+24);break;case e.R8G8B8A8_COLOR:a[c]=this._encodeColor(_);break;case e.R16G16B16A16_DASHARRAY:case e.R16G16B16A16_PATTERN:this._encodePattern(c,a,_);break;default:throw new Error("Unsupported encoding type")}E++}}return a}getAtributeState(t){let e=0;const n=3+2*t;return e|=this._bit(n),e|=this._bit(n+1)<<1,e}_buildAttributesInfo(){const t=[],e={},s={};let i=-1;const a=this.attributesInfo(),c=this.attributes();let u=-1;for(const o of c){u++;const c=this.getAtributeState(u);if(c===n.UNIFORM||c===n.UNUSED)continue;const _=a[o],l=[];e[o]=l;const f=_.type;for(let e=0;e<c;e++){const{dataType:e,bytesPerElement:n,count:o,normalized:a}=r._encodingInfo[f],c=n*o,u=`${e}-${!0===a}`;let _=s[u],h=0;if(!_||_.count+o>4)i++,_={dataIndex:i,count:0,offset:0},4!==o&&(s[u]=_),t.push({location:-1,name:"a_data_"+i,count:o,type:e,normalized:a}),h=Math.ceil(Math.max(c/4,1));else{const e=t[_.dataIndex];e.count+=o;h=Math.ceil(Math.max(e.count*n/4,1))-Math.ceil(Math.max(_.offset/4,1))}l.push({dataIndex:_.dataIndex,offset:_.offset,bufferElementsToAdd:h}),_.offset+=c,_.count+=o}}for(const n of t)switch(n.type){case o.BYTE:case o.UNSIGNED_BYTE:n.count=4;break;case o.SHORT:case o.UNSIGNED_SHORT:n.count+=n.count%2}this._buildVertexBufferLayout(t);let _=0;const l=this._layout.get("geometry");for(const n of l)this._locations.set(n.name,_++);const f=this._layout.get("opacity");if(f)for(const n of f)this._locations.set(n.name,_++);this._buildShaderInfo(t,e),this._propertyEncodingInfo=e}_buildVertexBufferLayout(t){const e=new Map,n=this.geometryInfo();let o=n[0].stride;if(0===t.length)e.set("geometry",n);else{const r=[];let a=o;for(const e of t)o+=i(e.type)*e.count;for(const t of n)r.push(new s(t.name,t.count,t.type,t.offset,o,t.normalized));for(const e of t)r.push(new s(e.name,e.count,e.type,a,o,e.normalized)),a+=i(e.type)*e.count;e.set("geometry",r)}const r=this.opacityInfo();r&&e.set("opacity",r),this._layout=e,this._stride=o}_buildShaderInfo(t,o){let s="\n",i="\n";const c=[];for(const e of t)s+=`attribute ${this._getType(e.count)} ${e.name};\n`;const u=this.attributes(),_=this.attributesInfo();let l=-1;for(const f of u){l++;const{name:t,type:u,precisionFactor:h,isLayout:d}=_[f],y=h&&1!==h?" * "+1/h:"",{bytesPerElement:m,count:E}=r._encodingInfo[u],I=t=>`a_data_${t.dataIndex}${a(E,t.offset,m)}`;switch(this.getAtributeState(l)){case n.UNIFORM:{const n=this._getType(E),o=`u_${t}`;c.push({name:o,type:n,getValue:(t,n,o,s)=>{const r=d?t.getLayoutValue(f,n):t.getPaintValue(f,n);if(u===e.R16G16B16A16_DASHARRAY){const e=t.getDashKey(r,t.getLayoutValue("line-cap",n)),o=s.getMosaicItemPosition(e,!1);if(null==o)return null;const{tl:i,br:a}=o;return[i[0],a[1],a[0],i[1]]}if(u===e.R16G16B16A16_PATTERN){const t=s.getMosaicItemPosition(r,!f.includes("line-"));if(null==t)return null;const{tl:e,br:n}=t;return[e[0],n[1],n[0],e[1]]}if(u===e.R8G8B8A8_COLOR){const t=r[3];return[t*r[0],t*r[1],t*r[2],t]}return r}}),s+=`uniform ${n} ${o};\n`,i+=`${n} ${t} = ${o};\n`}break;case n.DATA_DRIVEN:{const e=I(o[f][0]);i+=`${this._getType(E)} ${t} = ${e}${y};\n`}break;case n.INTERPOLATED_DATA_DRIVEN:{const e=`u_t_${t}`;c.push({name:e,type:"float",getValue:(t,e,n,o)=>(d?t.getLayoutProperty(f):t.getPaintProperty(f)).interpolator.interpolationUniformValue(n,e)}),s+=`uniform float ${e};\n`;const n=I(o[f][0]),r=I(o[f][1]);i+=`${this._getType(E)} ${t} = mix(${n}${y}, ${r}${y}, ${e});\n`}}}this._shaderHeader=s,this._shaderMain=i,this._uniforms=c}_bit(t){return(this._key&1<<t)>>t}_getType(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4"}throw new Error("Invalid count")}_encodeColor(e){const n=255*e[3];return t.i8888to32(e[0]*n,e[1]*n,e[2]*n,n)}_encodePattern(t,e,n){if(!n?.rect)return;const o=2,s=n.rect,r=n.width,i=n.height;e[t]=this._encodeShort(s.x+o,0),e[t]|=this._encodeShort(s.y+o+i,16),e[t+1]=this._encodeShort(s.x+o+r,0),e[t+1]|=this._encodeShort(s.y+o,16)}_encodeByte(t,e){return(255&t)<<e}_encodeShort(t,e){return(65535&t)<<e}}r._encodingInfo={[e.R8_SIGNED]:{dataType:o.BYTE,bytesPerElement:1,count:1,normalized:!1},[e.R8_UNSIGNED]:{dataType:o.UNSIGNED_BYTE,bytesPerElement:1,count:1,normalized:!1},[e.R16_SIGNED]:{dataType:o.SHORT,bytesPerElement:2,count:1,normalized:!1},[e.R16_UNSIGNED]:{dataType:o.UNSIGNED_SHORT,bytesPerElement:2,count:1,normalized:!1},[e.R8G8_SIGNED]:{dataType:o.BYTE,bytesPerElement:1,count:2,normalized:!1},[e.R8G8_UNSIGNED]:{dataType:o.UNSIGNED_BYTE,bytesPerElement:1,count:2,normalized:!1},[e.R16G16_SIGNED]:{dataType:o.SHORT,bytesPerElement:2,count:2,normalized:!1},[e.R16G16_UNSIGNED]:{dataType:o.UNSIGNED_SHORT,bytesPerElement:2,count:2,normalized:!1},[e.R8G8B8A8_SIGNED]:{dataType:o.BYTE,bytesPerElement:1,count:4,normalized:!1},[e.R8G8B8A8_UNSIGNED]:{dataType:o.UNSIGNED_BYTE,bytesPerElement:1,count:4,normalized:!1},[e.R8G8B8A8_COLOR]:{dataType:o.UNSIGNED_BYTE,bytesPerElement:1,count:4,normalized:!0},[e.R16G16B16A16_DASHARRAY]:{dataType:o.UNSIGNED_SHORT,bytesPerElement:2,count:4,normalized:!1},[e.R16G16B16A16_PATTERN]:{dataType:o.UNSIGNED_SHORT,bytesPerElement:2,count:4,normalized:!1}};const i=t=>{switch(t){case o.FLOAT:case o.INT:case o.UNSIGNED_INT:return 4;case o.SHORT:case o.UNSIGNED_SHORT:case o.HALF_FLOAT:return 2;case o.BYTE:case o.UNSIGNED_BYTE:return 1}},a=(t,e,n)=>{const o=e/n;if(1===t)switch(o){case 0:return".x";case 1:return".y";case 2:return".z";case 3:return".w"}else if(2===t)switch(o){case 0:return".xy";case 1:return".yz";case 2:return".zw"}else if(3===t)switch(o){case 0:return".xyz";case 1:return".yzw"}return""};export{r as VTLMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as r}from"../../../../core/maybe.js";import{PosTex2b as t}from"./DefaultVertexAttributeLayouts.js";import{bitBlit as e}from"./shaders/BitBlitPrograms.js";import{BufferObject as i}from"../../../webgl/BufferObject.js";import{BlendFactor as s,PrimitiveType as
|
|
5
|
+
import{disposeMaybe as r}from"../../../../core/maybe.js";import{PosTex2b as t}from"./DefaultVertexAttributeLayouts.js";import{bitBlit as e}from"./shaders/BitBlitPrograms.js";import{BufferObject as i}from"../../../webgl/BufferObject.js";import{BlendFactor as s,PrimitiveType as a,Usage as o}from"../../../webgl/enums.js";import{createProgram as m}from"../../../webgl/ProgramTemplate.js";import{VertexArrayObject as n}from"../../../webgl/VertexArrayObject.js";class _{constructor(){this._initialized=!1}dispose(){this._program=r(this._program),this._vertexArrayObject=r(this._vertexArrayObject)}render(r,t,e,i){r&&(this._initialized||this._initialize(r),r.setBlendFunctionSeparate(s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA),r.bindVAO(this._vertexArrayObject),r.useProgram(this._program),t.setSamplingMode(e),r.bindTexture(t,0),this._program.setUniform1i("u_tex",0),this._program.setUniform1f("u_opacity",i),r.drawArrays(a.TRIANGLE_STRIP,0,4),r.bindTexture(null,0),r.bindVAO())}_initialize(r){if(this._initialized)return!0;const s=m(r,e);if(!s)return!1;const a=new Int8Array(16);a[0]=-1,a[1]=-1,a[2]=0,a[3]=0,a[4]=1,a[5]=-1,a[6]=1,a[7]=0,a[8]=-1,a[9]=1,a[10]=0,a[11]=1,a[12]=1,a[13]=1,a[14]=1,a[15]=1;const _=e.attributes,p=new n(r,_,t,new Map([["geometry",i.createVertex(r,o.STATIC_DRAW,a)]]));return this._program=s,this._vertexArrayObject=p,this._initialized=!0,!0}}export{_ as BitBlitRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{DataType as e}from"../../../webgl/enums.js";import{VertexElementDescriptor as o}from"../../../webgl/VertexElementDescriptor.js";const r=
|
|
5
|
+
import{DataType as e}from"../../../webgl/enums.js";import{VertexElementDescriptor as o}from"../../../webgl/VertexElementDescriptor.js";const r=new Map([["geometry",[new o("a_pos",2,e.BYTE,0,2)]]]),t=new Map([["geometry",[new o("a_pos",2,e.BYTE,0,4),new o("a_tex",2,e.BYTE,2,4)]]]),n=new Map([["geometry",[new o("a_pos",2,e.UNSIGNED_SHORT,0,4)]]]);export{r as Pos2b,n as Pos2us,t as PosTex2b};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import r from"../../../../core/Logger.js";import{e as t}from"../../../../chunks/earcut.js";import{set as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{convertFromNestedArray as s,convertFromPolygon as i}from"../../../../layers/graphics/featureConversionUtils.js";import c from"../../../../layers/graphics/OptimizedGeometry.js";import{i1616to32 as a}from"./number.js";import{BufferObject as f}from"../../../webgl/BufferObject.js";import{PrimitiveType as m,Usage as h,DataType as u}from"../../../webgl/enums.js";const l=r=>{switch(r.BYTES_PER_ELEMENT){case 1:return u.UNSIGNED_BYTE;case 2:return u.UNSIGNED_SHORT;case 4:return u.UNSIGNED_INT;default:throw new e("Cannot get DataType of array")}},y=(e,r,t,n)=>{let o=0;for(let s=1;s<t;s++){const t=e[2*(r+s-1)],n=e[2*(r+s-1)+1];o+=(e[2*(r+s)]-t)*(e[2*(r+s)+1]+n)}return n?o>0:o<0},
|
|
5
|
+
import e from"../../../../core/Error.js";import r from"../../../../core/Logger.js";import{e as t}from"../../../../chunks/earcut.js";import{set as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{convertFromNestedArray as s,convertFromPolygon as i}from"../../../../layers/graphics/featureConversionUtils.js";import c from"../../../../layers/graphics/OptimizedGeometry.js";import{i1616to32 as a}from"./number.js";import{BufferObject as f}from"../../../webgl/BufferObject.js";import{PrimitiveType as m,Usage as h,DataType as u}from"../../../webgl/enums.js";const l=r=>{switch(r.BYTES_PER_ELEMENT){case 1:return u.UNSIGNED_BYTE;case 2:return u.UNSIGNED_SHORT;case 4:return u.UNSIGNED_INT;default:throw new e("Cannot get DataType of array")}},y=(e,r,t,n)=>{let o=0;for(let s=1;s<t;s++){const t=e[2*(r+s-1)],n=e[2*(r+s-1)+1];o+=(e[2*(r+s)]-t)*(e[2*(r+s)+1]+n)}return n?o>0:o<0},g=({coords:e,lengths:r},n)=>{const o=[];for(let s=0,i=0;s<r.length;i+=r[s],s+=1){const c=i,a=[];for(;s<r.length-1&&y(e,i+r[s],r[s+1],n);s+=1,i+=r[s])a.push(i+r[s]-c);const f=e.slice(2*c,2*(i+r[s])),m=t(f,a,2);for(const e of m)o.push(e+c)}return o};class p{constructor(e,r,t,n=!1){this._cache={},this.vertices=e,this.indices=r,this.primitiveType=t,this.isMapSpace=n}static fromPath(e){const r=s(new c,e.path,!1,!1),t=r.coords,n=new Uint32Array(g(r,!0)),o=new Uint32Array(t.length/2);for(let s=0;s<o.length;s++)o[s]=a(Math.floor(t[2*s]),Math.floor(t[2*s+1]));return new p({geometry:o},n,m.TRIANGLES)}static fromGeometry(t,n){const o=n.geometry?.type;switch(o){case"polygon":return p.fromPolygon(t,n.geometry);case"extent":return p.fromMapExtent(t,n.geometry);default:return r.getLogger("esri.views.2d.engine.webgl.Mesh2D").error(new e("mapview-bad-type",`Unable to create a mesh from type ${o}`,n)),p.fromScreenExtent({xmin:0,ymin:0,xmax:1,ymax:1})}}static fromPolygon(e,r){const t=i(new c,r,!1,!1),s=t.coords,f=new Uint32Array(g(t,!1)),h=new Uint32Array(s.length/2),u=o(),l=o();for(let o=0;o<h.length;o++)n(u,s[2*o],s[2*o+1]),e.toScreen(l,u),h[o]=a(Math.floor(l[0]),Math.floor(l[1]));return new p({geometry:h},f,m.TRIANGLES,!0)}static fromScreenExtent({xmin:e,xmax:r,ymin:t,ymax:n}){const o={geometry:new Uint32Array([a(e,t),a(r,t),a(e,n),a(e,n),a(r,t),a(r,n)])},s=new Uint32Array([0,1,2,3,4,5]);return new p(o,s,m.TRIANGLES)}static fromMapExtent(e,r){const[t,n]=e.toScreen([0,0],[r.xmin,r.ymin]),[o,s]=e.toScreen([0,0],[r.xmax,r.ymax]),i={geometry:new Uint32Array([a(t,n),a(o,n),a(t,s),a(t,s),a(o,n),a(o,s)])},c=new Uint32Array([0,1,2,3,4,5]);return new p(i,c,m.TRIANGLES)}destroy(){null!=this._cache.indexBuffer&&this._cache.indexBuffer.dispose(),this._cache.vertexBuffers?.forEach((e=>e?.dispose())),this._cache.indexBuffer=this._cache.vertexBuffers=null}get elementType(){return l(this.indices)}getIndexBuffer(e,r=h.STATIC_DRAW){return this._cache.indexBuffer??=f.createIndex(e,r,this.indices),this._cache.indexBuffer}getVertexBuffers(e,r=h.STATIC_DRAW){return this._cache.vertexBuffers??=new Map(Object.keys(this.vertices).reduce(((t,n)=>(t.push([n,f.createVertex(e,r,this.vertices[n])]),t)),new Array)),this._cache.vertexBuffers}}export{p as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Logger.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{getProjectiveTransform as i}from"../../../../core/perspectiveUtils.js";import{watch as o,when as n,initial as a}from"../../../../core/reactiveUtils.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{AnimatedSymbolRepeatType as p}from"../../../../symbols/cim/enums.js";import{DisplayObject as c}from"../DisplayObject.js";import{play as u}from"./animatedFormats/utils.js";import{BufferObject as d}from"../../../webgl/BufferObject.js";import{TextureWrapMode as f,PrimitiveType as w,Usage as y}from"../../../webgl/enums.js";import{Texture as g}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";import{VertexArrayObject as v}from"../../../webgl/VertexArrayObject.js";const _=[1,1],V=4,b=l(),j={none:p.None,loop:p.Loop,oscillate:p.Oscillate};function A(e){return e?{...e,playAnimation:e.playing,repeatType:e.repeatType?j[e.repeatType]:void 0}:{}}class T extends c{constructor(i){super(),this.elementView=i,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=h(),this._playHandle=null,this._vertices=new Float32Array(20),this._handles=[],this._handles.push(o((()=>this.elementView.element.opacity),(e=>this.opacity=e),a),o((()=>[this.elementView.coords]),(()=>{this.requestRender()}),a),o((()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions]),(()=>{this._playHandle?.remove(),this.texture=s(this.texture),this.requestRender()}),a),n((()=>this.elementView.element.loaded),(()=>{const e=this.elementView.element;this.ready(),"video"===e.type&&null!=e.content&&this._handles.push(t(e.content,"play",(()=>this.requestRender())))}),a)),i.element.load().catch((t=>{r.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:i,error:t}))}))}getMesh(e){throw new Error("Method not implemented.")}destroy(){this._playHandle?.remove(),this._handles.forEach((e=>e.remove())),this.texture=s(this.texture)}get textureSize(){return _}get dvsMat3(){return this.parent.dvsMat3}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const e=r instanceof HTMLImageElement,s=r instanceof HTMLVideoElement,i=e?r.naturalWidth:s?r.videoWidth:r.width,o=e?r.naturalHeight:s?r.videoHeight:r.height;if(this._updatePerspectiveTransform(i,o),this.texture)s&&!r.paused&&(this.texture.setData(r),this.requestRender(),this.texture.generateMipmap());else{const e=new x;if(e.wrapMode=f.CLAMP_TO_EDGE,e.preMultiplyAlpha=!0,e.width=i,e.height=o,"getFrame"in r){const s=r=>{this.texture?this.texture.setData(r):this.texture=new g(t,e,r),this.requestRender()};"animationOptions"in this.elementView.element&&(this._playHandle=u(r,A(this.elementView.element.animationOptions),null,s))}else this.texture=new g(t,e,r);this.texture.generateMipmap(),s&&!r.paused&&this.requestRender()}}super.beforeRender(e)}_createTransforms(){return null}draw(e){e.drawArrays(w.TRIANGLE_STRIP,0,V)}updateDrawCoords(e,t,r,s){const{coords:i,bounds:o}=this.elementView;if(null==i||null==o)return;const[n,a,l,m]=i.rings[0],h=this._vertices,{x:p,y:c}=e;h.set([a[0]-p,a[1]-c,n[0]-p,n[1]-c,l[0]-p,l[1]-c,m[0]-p,m[1]-c]);let u=t;if(s){const[e,,t]=o,{worldWidth:r,xBounds:i}=s,[n,a]=i;e<n&&t>n?u=r:t>a&&e<a&&(u=-r)}this.wrapAroundShift=u,this.isWrapAround=0!==u}getVAO(e,t,r){if(null==this.elementView.coords)return null;const s=this._vertices;if(this._vao)this._geometryVbo.setData(s);else{this._geometryVbo=d.createVertex(e,y.DYNAMIC_DRAW,s);const i=d.createVertex(e,y.STATIC_DRAW,new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]));this._vao=new v(e,r,t,
|
|
5
|
+
import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Logger.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{getProjectiveTransform as i}from"../../../../core/perspectiveUtils.js";import{watch as o,when as n,initial as a}from"../../../../core/reactiveUtils.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{AnimatedSymbolRepeatType as p}from"../../../../symbols/cim/enums.js";import{DisplayObject as c}from"../DisplayObject.js";import{play as u}from"./animatedFormats/utils.js";import{BufferObject as d}from"../../../webgl/BufferObject.js";import{TextureWrapMode as f,PrimitiveType as w,Usage as y}from"../../../webgl/enums.js";import{Texture as g}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";import{VertexArrayObject as v}from"../../../webgl/VertexArrayObject.js";const _=[1,1],V=4,b=l(),j={none:p.None,loop:p.Loop,oscillate:p.Oscillate};function A(e){return e?{...e,playAnimation:e.playing,repeatType:e.repeatType?j[e.repeatType]:void 0}:{}}class T extends c{constructor(i){super(),this.elementView=i,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=h(),this._playHandle=null,this._vertices=new Float32Array(20),this._handles=[],this._handles.push(o((()=>this.elementView.element.opacity),(e=>this.opacity=e),a),o((()=>[this.elementView.coords]),(()=>{this.requestRender()}),a),o((()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions]),(()=>{this._playHandle?.remove(),this.texture=s(this.texture),this.requestRender()}),a),n((()=>this.elementView.element.loaded),(()=>{const e=this.elementView.element;this.ready(),"video"===e.type&&null!=e.content&&this._handles.push(t(e.content,"play",(()=>this.requestRender())))}),a)),i.element.load().catch((t=>{r.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:i,error:t}))}))}getMesh(e){throw new Error("Method not implemented.")}destroy(){this._playHandle?.remove(),this._handles.forEach((e=>e.remove())),this.texture=s(this.texture)}get textureSize(){return _}get dvsMat3(){return this.parent.dvsMat3}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const e=r instanceof HTMLImageElement,s=r instanceof HTMLVideoElement,i=e?r.naturalWidth:s?r.videoWidth:r.width,o=e?r.naturalHeight:s?r.videoHeight:r.height;if(this._updatePerspectiveTransform(i,o),this.texture)s&&!r.paused&&(this.texture.setData(r),this.requestRender(),this.texture.generateMipmap());else{const e=new x;if(e.wrapMode=f.CLAMP_TO_EDGE,e.preMultiplyAlpha=!0,e.width=i,e.height=o,"getFrame"in r){const s=r=>{this.texture?this.texture.setData(r):this.texture=new g(t,e,r),this.requestRender()};"animationOptions"in this.elementView.element&&(this._playHandle=u(r,A(this.elementView.element.animationOptions),null,s))}else this.texture=new g(t,e,r);this.texture.generateMipmap(),s&&!r.paused&&this.requestRender()}}super.beforeRender(e)}_createTransforms(){return null}draw(e){e.drawArrays(w.TRIANGLE_STRIP,0,V)}updateDrawCoords(e,t,r,s){const{coords:i,bounds:o}=this.elementView;if(null==i||null==o)return;const[n,a,l,m]=i.rings[0],h=this._vertices,{x:p,y:c}=e;h.set([a[0]-p,a[1]-c,n[0]-p,n[1]-c,l[0]-p,l[1]-c,m[0]-p,m[1]-c]);let u=t;if(s){const[e,,t]=o,{worldWidth:r,xBounds:i}=s,[n,a]=i;e<n&&t>n?u=r:t>a&&e<a&&(u=-r)}this.wrapAroundShift=u,this.isWrapAround=0!==u}getVAO(e,t,r){if(null==this.elementView.coords)return null;const s=this._vertices;if(this._vao)this._geometryVbo.setData(s);else{this._geometryVbo=d.createVertex(e,y.DYNAMIC_DRAW,s);const i=d.createVertex(e,y.STATIC_DRAW,new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]));this._vao=new v(e,r,t,new Map([["geometry",this._geometryVbo],["tex",i]]))}return this._vao}_updatePerspectiveTransform(e,t){const r=this._vertices;i(b,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),m(this.perspectiveTransform,b[6]/b[8]*e,b[7]/b[8]*t)}}export{T as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../geometry.js";import{on as t}from"../../../../core/events.js";import e from"../../../../core/Handles.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{when as o,initial as i}from"../../../../core/reactiveUtils.js";import{createScreenPoint as s}from"../../../../core/screenUtils.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{project as l}from"../../../../geometry/projection.js";import{DisplayObject as a}from"../DisplayObject.js";import h from"../../../layers/support/Geometry.js";import{BufferObject as u}from"../../../webgl/BufferObject.js";import{TextureWrapMode as m,Usage as c,PrimitiveType as d}from"../../../webgl/enums.js";import{Texture as p}from"../../../webgl/Texture.js";import{TextureDescriptor as f}from"../../../webgl/TextureDescriptor.js";import{VertexArrayObject as x}from"../../../webgl/VertexArrayObject.js";import _ from"../../../../geometry/Polygon.js";import g from"../../../../geometry/Point.js";const y=2;class w extends a{constructor(r){super(),this.element=r,this._handles=new e,this.isWrapAround=!1,this.perspectiveTransform=n(),this.wrapAroundShift=0,this.clipGeometry=null,this._handles.add(o((()=>this.element),(()=>{const e=this.element;this.ready(),e&&this._handles.add(t(e,"play",(()=>this.requestRender())))}),i))}getMesh(t){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=r(this.texture),this._vao&&(this._vao.dispose(),this._vao=null),this._vbo&&(this._vbo.dispose(),this._vbo=null),this.texture&&(this.texture.dispose(),this.texture=null)}get textureSize(){if(!this.texture)return[1,1];const t=this.texture.descriptor;return[t.width,t.height]}get dvsMat3(){return this.parent.dvsMat3}beforeRender(t){const e=this.element;if(null==e)return;const{context:r}=t,{videoWidth:o,videoHeight:i}=e;if(0!==o&&0!==i){if(this.texture)e.paused||this.texture.setData(e);else{const t=new f;t.wrapMode=m.CLAMP_TO_EDGE,t.preMultiplyAlpha=!0,t.width=o,t.height=i,this.texture=new p(r,t,e)}e.paused||(this.texture.generateMipmap(),this.requestRender()),super.beforeRender(t)}}_createTransforms(){return null}updateDrawCoords(t,e,r,o){const i=this.element,s=this._getFrameInfo();if(!i||!s)return;this._initializeData(t,s,r);const{controlPoints:n,horizon:a}=s,u=Math.sqrt(n.length),m=u,{x:c,y:d}=t,p=this._vertices,f=n[0],x=n[u-1],g=n[(m-1)*u],w=n[(m-1)*u+u-1],P=l(a?a[0].mapPoint:f.mapPoint,r),v=l(a?a[1].mapPoint:x.mapPoint,r),j=l(g.mapPoint,r),b=l(w.mapPoint,r);this.clipGeometry=a?new h({geometry:_.fromJSON({rings:[[[j.x,j.y],[b.x,b.y],[v.x,v.y],[P.x,P.y],[j.x,j.y]]],spatialReference:r})}):null;for(let h=0;h<n.length;h++){const t=n[h],{sourcePoint:e,mapPoint:o}=t;if(null==e||null==o)continue;const i=l(o,r);p[h*y+0]=i.x-c,p[h*y+1]=i.y-d}let A=e;if(o){const t=Math.min(P.x,v.x,j.x,b.x),e=Math.max(P.x,v.x,j.x,b.x),{worldWidth:r,xBounds:i}=o,[s,n]=i;t<s&&e>s?A=r:e>n&&t<n&&(A=-r)}this.wrapAroundShift=A,this.isWrapAround=0!==A}getVAO(t,e,r){if(null==this._vertices)return null;const o=this._vertices;if(this._vao)this._vbo.setData(o);else{this._vbo=u.createVertex(t,c.DYNAMIC_DRAW,o);const i=u.createVertex(t,c.STATIC_DRAW,this._texCoords);this._ibo=u.createIndex(t,c.DYNAMIC_DRAW,this._indices),this._vao=new x(t,r,e,
|
|
5
|
+
import"../../../../geometry.js";import{on as t}from"../../../../core/events.js";import e from"../../../../core/Handles.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{when as o,initial as i}from"../../../../core/reactiveUtils.js";import{createScreenPoint as s}from"../../../../core/screenUtils.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{project as l}from"../../../../geometry/projection.js";import{DisplayObject as a}from"../DisplayObject.js";import h from"../../../layers/support/Geometry.js";import{BufferObject as u}from"../../../webgl/BufferObject.js";import{TextureWrapMode as m,Usage as c,PrimitiveType as d}from"../../../webgl/enums.js";import{Texture as p}from"../../../webgl/Texture.js";import{TextureDescriptor as f}from"../../../webgl/TextureDescriptor.js";import{VertexArrayObject as x}from"../../../webgl/VertexArrayObject.js";import _ from"../../../../geometry/Polygon.js";import g from"../../../../geometry/Point.js";const y=2;class w extends a{constructor(r){super(),this.element=r,this._handles=new e,this.isWrapAround=!1,this.perspectiveTransform=n(),this.wrapAroundShift=0,this.clipGeometry=null,this._handles.add(o((()=>this.element),(()=>{const e=this.element;this.ready(),e&&this._handles.add(t(e,"play",(()=>this.requestRender())))}),i))}getMesh(t){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=r(this.texture),this._vao&&(this._vao.dispose(),this._vao=null),this._vbo&&(this._vbo.dispose(),this._vbo=null),this.texture&&(this.texture.dispose(),this.texture=null)}get textureSize(){if(!this.texture)return[1,1];const t=this.texture.descriptor;return[t.width,t.height]}get dvsMat3(){return this.parent.dvsMat3}beforeRender(t){const e=this.element;if(null==e)return;const{context:r}=t,{videoWidth:o,videoHeight:i}=e;if(0!==o&&0!==i){if(this.texture)e.paused||this.texture.setData(e);else{const t=new f;t.wrapMode=m.CLAMP_TO_EDGE,t.preMultiplyAlpha=!0,t.width=o,t.height=i,this.texture=new p(r,t,e)}e.paused||(this.texture.generateMipmap(),this.requestRender()),super.beforeRender(t)}}_createTransforms(){return null}updateDrawCoords(t,e,r,o){const i=this.element,s=this._getFrameInfo();if(!i||!s)return;this._initializeData(t,s,r);const{controlPoints:n,horizon:a}=s,u=Math.sqrt(n.length),m=u,{x:c,y:d}=t,p=this._vertices,f=n[0],x=n[u-1],g=n[(m-1)*u],w=n[(m-1)*u+u-1],P=l(a?a[0].mapPoint:f.mapPoint,r),v=l(a?a[1].mapPoint:x.mapPoint,r),j=l(g.mapPoint,r),b=l(w.mapPoint,r);this.clipGeometry=a?new h({geometry:_.fromJSON({rings:[[[j.x,j.y],[b.x,b.y],[v.x,v.y],[P.x,P.y],[j.x,j.y]]],spatialReference:r})}):null;for(let h=0;h<n.length;h++){const t=n[h],{sourcePoint:e,mapPoint:o}=t;if(null==e||null==o)continue;const i=l(o,r);p[h*y+0]=i.x-c,p[h*y+1]=i.y-d}let A=e;if(o){const t=Math.min(P.x,v.x,j.x,b.x),e=Math.max(P.x,v.x,j.x,b.x),{worldWidth:r,xBounds:i}=o,[s,n]=i;t<s&&e>s?A=r:e>n&&t<n&&(A=-r)}this.wrapAroundShift=A,this.isWrapAround=0!==A}getVAO(t,e,r){if(null==this._vertices)return null;const o=this._vertices;if(this._vao)this._vbo.setData(o);else{this._vbo=u.createVertex(t,c.DYNAMIC_DRAW,o);const i=u.createVertex(t,c.STATIC_DRAW,this._texCoords);this._ibo=u.createIndex(t,c.DYNAMIC_DRAW,this._indices),this._vao=new x(t,r,e,new Map([["geometry",this._vbo],["tex",i]]),this._ibo)}return this._vao}draw(t){t.drawElements(d.TRIANGLE_STRIP,this._indices.length,t.gl.UNSIGNED_SHORT,0)}_initializeData(t,e,r){if(null!=this._vertices&&null!=this._indices)return;const{controlPoints:o}=e,i=Math.sqrt(o.length),s=i,n=new Float32Array(y*o.length),a=new Uint16Array(2*o.length);for(let m=0;m<o.length;m++){const e=o[m],{sourcePoint:i,mapPoint:s}=e;if(null==i||null==s)continue;const h=l(s,r);n[m*y+0]=h.x-t.x,n[m*y+1]=h.y-t.y,a[2*m+0]=i.x,a[2*m+1]=i.y}const h=new Uint16Array(s*i+(s-2)*(i+2));let u=0;for(let l=0;l<s;l++){for(let t=0;t<i;t++)h[u++]=l*i+t,h[u++]=(l+1)*i+t;l<s-2&&(h[u++]=(l+1)*i+(i-1),h[u++]=(l+1)*i)}this._vertices=n,this._texCoords=a,this._indices=h}_getFrameInfo(){if(!this.groundControlPoints)return null;const t=this._getFrameControlPoints(),e=this.frameHorizonPoints;let r=null;if(e){const t=e.startX,o=e.startY,i=e.endX,n=e.endY;r=[{sourcePoint:s(t,o),mapPoint:new g(e.startLongitude,e.startLatitude)},{sourcePoint:s(i,n),mapPoint:new g(e.endLongitude,e.endLatitude)}]}return{controlPoints:t,horizon:r}}_getFrameControlPoints(){const t=this.groundControlPoints,e=t?.length;if(!e)return[];const r=new Array(e);for(let o=0;o<e;o++){const{x:e,y:i,lat:n,lon:l}=t[o];r[o]={sourcePoint:s(e,-i),mapPoint:new g(l,n)}}return r}}export{w as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import{CapType as r,JoinType as n}from"../../../../symbols/cim/enums.js";import"../../../../core/RandomLCG.js";import"../../../../core/has.js";import"../../../webgl/checkWebGLError.js";import{PixelType as o}from"../../../webgl/enums.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/GLObjectType.js";import{getDataTypeBytes as
|
|
5
|
+
import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import{CapType as r,JoinType as n}from"../../../../symbols/cim/enums.js";import"../../../../core/RandomLCG.js";import"../../../../core/has.js";import"../../../webgl/checkWebGLError.js";import{PixelType as o}from"../../../webgl/enums.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/GLObjectType.js";import{getDataTypeBytes as a}from"../../../webgl/getDataTypeBytes.js";import{Texture as i}from"../../../webgl/Texture.js";import{TextureDescriptor as s}from"../../../webgl/TextureDescriptor.js";import{VertexElementDescriptor as p}from"../../../webgl/VertexElementDescriptor.js";const u=()=>t.getLogger("esri.views.2d.engine.webgl.Utils");function l(t){switch(t){case"butt":return r.BUTT;case"round":return r.ROUND;case"square":return r.SQUARE;default:return u().error(new e("mapview-invalid-type",`Cap type ${t} is not a valid option. Defaulting to round`)),r.ROUND}}function m(t){switch(t){case"miter":return n.MITER;case"bevel":return n.BEVEL;case"round":return n.ROUND;default:return u().error(new e("mapview-invalid-type",`Join type ${t} is not a valid option. Defaulting to round`)),n.ROUND}}function c(t){switch(t){case o.UNSIGNED_BYTE:return 1;case o.UNSIGNED_SHORT_4_4_4_4:return 2;case o.FLOAT:return 4;default:return void u().error(new e("webgl-utils",`Unable to handle type ${t}`))}}function d(t){switch(t){case o.UNSIGNED_BYTE:return Uint8Array;case o.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case o.FLOAT:return Float32Array;default:return void u().error(new e("webgl-utils",`Unable to handle type ${t}`))}}function f(e){const t=new Map;for(const r in e){const n=e[r];let o=0;t.set(r,n.map((e=>{const t=new p(e.name,e.count,e.type,o,0,e.normalized||!1);return o+=e.count*a(e.type),t}))),t.get(r).forEach((e=>e.stride=o))}return t}const g=e=>{const t=new Map;for(const r in e)for(const n of e[r])t.set(n.name,n.location);return t},w=e=>{const t={};return e.forEach(((e,r)=>t[r]=e?.length?e[0].stride:0)),t},h=new Map,b=(e,t)=>{if(!h.has(e)){const r=f(t),n={strides:w(r),bufferLayouts:r,attributes:g(t)};h.set(e,n)}return h.get(e)},y=e=>e.includes("data:image/svg+xml");function A(e){const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return t}const M=e=>!!e&&(e=e.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(e)&&/[\dz]$/i.test(e)&&e.length>4));function T(e,t,r){const n=new s(t.width,t.height);return n.dataType=t.dataType,t.depth&&(n.depth=t.depth),t.flipped&&(n.flipped=t.flipped),t.hasMipmap&&(n.hasMipmap=t.hasMipmap),n.internalFormat=t.internalFormat,t.isImmutable&&(n.isImmutable=t.isImmutable),t.isOpaque&&(n.isOpaque=t.isOpaque),t.maxAnisotropy&&(n.maxAnisotropy=t.maxAnisotropy),n.pixelFormat=t.pixelFormat,t.preMultiplyAlpha&&(n.preMultiplyAlpha=t.preMultiplyAlpha),t.samplingMode&&(n.samplingMode=t.samplingMode),t.target&&(n.target=t.target),n.uniform=t.uniform,t.unpackAlignment&&(n.unpackAlignment=t.unpackAlignment),t.wrapMode&&(n.wrapMode=t.wrapMode),new i(e,n,r)}function j(e){return"url"in e&&"urlHash"in e?{...e,url:""}:e}export{A as charCodes,f as createAttributeLayout,b as createProgramDescriptor,T as createTexture,j as discardUrlIfHasUrlHash,l as getCapType,m as getJoinType,d as getPixelArrayCtor,c as getPixelBytes,y as isSVGImage,M as isValidSVG};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{vertexLayoutHash as t}from"./shaderGraph/techniques/mesh/utils.js";import{BufferObject as e}from"../../../webgl/BufferObject.js";import{DataType as r,Usage as s,PrimitiveType as i}from"../../../webgl/enums.js";import{VertexArrayObject as o}from"../../../webgl/VertexArrayObject.js";import{VertexElementDescriptor as a}from"../../../webgl/VertexElementDescriptor.js";class
|
|
5
|
+
import{vertexLayoutHash as t}from"./shaderGraph/techniques/mesh/utils.js";import{BufferObject as e}from"../../../webgl/BufferObject.js";import{DataType as r,Usage as s,PrimitiveType as i}from"../../../webgl/enums.js";import{VertexArrayObject as o}from"../../../webgl/VertexArrayObject.js";import{VertexElementDescriptor as a}from"../../../webgl/VertexElementDescriptor.js";class n{constructor(i,n){this._rctx=i,this._attributes=[{name:"position",offset:0,type:r.SHORT,count:2}],this.layout={hash:t(this._attributes),attributes:this._attributes,stride:4},this._vertexBuffer=e.createVertex(i,s.STATIC_DRAW,new Uint16Array(n)),this._vao=new o(i,new Map([["a_position",0]]),new Map([["geometry",[new a("a_position",2,r.SHORT,0,4)]]]),new Map([["geometry",this._vertexBuffer]])),this._count=n.length/2}bind(){this._rctx.bindVAO(this._vao)}unbind(){this._rctx.bindVAO(null)}dispose(){this._vao.dispose()}draw(){this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.TRIANGLE_STRIP,0,this._count)}}export{n as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{Pos2b as r}from"../DefaultVertexAttributeLayouts.js";import t from"./WGLBrush.js";import{background as i}from"../shaders/BackgroundPrograms.js";import{BufferObject as s}from"../../../../webgl/BufferObject.js";import{StencilOperation as o,Face as a,CompareFunction as l,PrimitiveType as n,Usage as d}from"../../../../webgl/enums.js";import{createProgram as m}from"../../../../webgl/ProgramTemplate.js";import{VertexArrayObject as c}from"../../../../webgl/VertexArrayObject.js";class _ extends t{constructor(){super(...arguments),this._color=e(1,0,0,1),this._initialized=!1}dispose(){this._solidProgram&&(this._solidProgram.dispose(),this._solidProgram=null),this._solidVertexArrayObject&&(this._solidVertexArrayObject.dispose(),this._solidVertexArrayObject=null)}prepareState({context:e}){e.setDepthWriteEnabled(!1),e.setDepthTestEnabled(!1),e.setStencilTestEnabled(!0),e.setBlendingEnabled(!1),e.setColorMask(!1,!1,!1,!1),e.setStencilOp(o.KEEP,o.KEEP,o.REPLACE),e.setStencilWriteMask(255)}draw(e,r){const{context:t,requestRender:i,allowDelayedRender:s}=e;this._initialized||this._initialize(t),!s||null==i||this._solidProgram.compiled?(t.setStencilFunctionSeparate(a.FRONT_AND_BACK,l.GREATER,r.stencilRef,255),t.bindVAO(this._solidVertexArrayObject),t.useProgram(this._solidProgram),this._solidProgram.setUniformMatrix3fv("u_dvsMat3",r.transforms.displayViewScreenMat3),this._solidProgram.setUniform2fv("u_coord_range",[r.rangeX,r.rangeY]),this._solidProgram.setUniform1f("u_depth",0),this._solidProgram.setUniform4fv("u_color",this._color),t.drawArrays(n.TRIANGLE_STRIP,0,4),t.bindVAO()):i()}_initialize(e){if(this._initialized)return!0;const t=m(e,i);if(!t)return!1;const o=new Int8Array([0,0,1,0,0,1,1,1]),a=s.createVertex(e,d.STATIC_DRAW,o),l=new c(e,i.attributes,r,
|
|
5
|
+
import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{Pos2b as r}from"../DefaultVertexAttributeLayouts.js";import t from"./WGLBrush.js";import{background as i}from"../shaders/BackgroundPrograms.js";import{BufferObject as s}from"../../../../webgl/BufferObject.js";import{StencilOperation as o,Face as a,CompareFunction as l,PrimitiveType as n,Usage as d}from"../../../../webgl/enums.js";import{createProgram as m}from"../../../../webgl/ProgramTemplate.js";import{VertexArrayObject as c}from"../../../../webgl/VertexArrayObject.js";class _ extends t{constructor(){super(...arguments),this._color=e(1,0,0,1),this._initialized=!1}dispose(){this._solidProgram&&(this._solidProgram.dispose(),this._solidProgram=null),this._solidVertexArrayObject&&(this._solidVertexArrayObject.dispose(),this._solidVertexArrayObject=null)}prepareState({context:e}){e.setDepthWriteEnabled(!1),e.setDepthTestEnabled(!1),e.setStencilTestEnabled(!0),e.setBlendingEnabled(!1),e.setColorMask(!1,!1,!1,!1),e.setStencilOp(o.KEEP,o.KEEP,o.REPLACE),e.setStencilWriteMask(255)}draw(e,r){const{context:t,requestRender:i,allowDelayedRender:s}=e;this._initialized||this._initialize(t),!s||null==i||this._solidProgram.compiled?(t.setStencilFunctionSeparate(a.FRONT_AND_BACK,l.GREATER,r.stencilRef,255),t.bindVAO(this._solidVertexArrayObject),t.useProgram(this._solidProgram),this._solidProgram.setUniformMatrix3fv("u_dvsMat3",r.transforms.displayViewScreenMat3),this._solidProgram.setUniform2fv("u_coord_range",[r.rangeX,r.rangeY]),this._solidProgram.setUniform1f("u_depth",0),this._solidProgram.setUniform4fv("u_color",this._color),t.drawArrays(n.TRIANGLE_STRIP,0,4),t.bindVAO()):i()}_initialize(e){if(this._initialized)return!0;const t=m(e,i);if(!t)return!1;const o=new Int8Array([0,0,1,0,0,1,1,1]),a=s.createVertex(e,d.STATIC_DRAW,o),l=new c(e,i.attributes,r,new Map([["geometry",a]]));return this._solidProgram=t,this._solidVertexArrayObject=l,this._initialized=!0,!0}}export{_ as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{Pos2b as t}from"../DefaultVertexAttributeLayouts.js";import{FeatureTile as r}from"../FeatureTile.js";import o from"./WGLBrush.js";import{background as i}from"../shaders/BackgroundPrograms.js";import{tileInfo as s}from"../shaders/TileInfoPrograms.js";import{BufferObject as n}from"../../../../webgl/BufferObject.js";import{BlendFactor as
|
|
5
|
+
import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{Pos2b as t}from"../DefaultVertexAttributeLayouts.js";import{FeatureTile as r}from"../FeatureTile.js";import o from"./WGLBrush.js";import{background as i}from"../shaders/BackgroundPrograms.js";import{tileInfo as s}from"../shaders/TileInfoPrograms.js";import{BufferObject as n}from"../../../../webgl/BufferObject.js";import{BlendFactor as a,PrimitiveType as l,Usage as f,TextureWrapMode as m,TextureSamplingMode as u}from"../../../../webgl/enums.js";import{createProgram as c}from"../../../../webgl/ProgramTemplate.js";import{Texture as d}from"../../../../webgl/Texture.js";import{TextureDescriptor as h}from"../../../../webgl/TextureDescriptor.js";import{VertexArrayObject as g}from"../../../../webgl/VertexArrayObject.js";const _=512,x=512,b=16,p=8,T=(x-2*p)/5;class y extends o{constructor(){super(...arguments),this._color=e(1,0,0,1)}dispose(){this._outlineProgram?.dispose(),this._outlineProgram=null,this._tileInfoProgram?.dispose(),this._tileInfoProgram=null,this._outlineVertexArrayObject?.dispose(),this._outlineVertexArrayObject=null,this._tileInfoVertexArrayObject?.dispose(),this._tileInfoVertexArrayObject=null,this._ctx=null}prepareState({context:e}){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(a.ONE,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),e.setStencilWriteMask(0),e.setStencilTestEnabled(!1)}draw(e,t){const{context:o,requestRender:i,allowDelayedRender:s}=e;if(!t.isReady&&t instanceof r&&t.hasData)return;if(this._loadWGLResources(o),s&&null!=i&&(!this._outlineProgram.compiled||!this._tileInfoProgram.compiled))return void i();o.bindVAO(this._outlineVertexArrayObject),o.useProgram(this._outlineProgram),this._outlineProgram.setUniformMatrix3fv("u_dvsMat3",t.transforms.displayViewScreenMat3),this._outlineProgram.setUniform2f("u_coord_range",t.rangeX,t.rangeY),this._outlineProgram.setUniform1f("u_depth",0),this._outlineProgram.setUniform4fv("u_color",this._color),o.drawArrays(l.LINE_STRIP,0,4);const n=this._getTexture(o,t);n?(o.bindVAO(this._tileInfoVertexArrayObject),o.useProgram(this._tileInfoProgram),o.bindTexture(n,0),this._tileInfoProgram.setUniformMatrix3fv("u_dvsMat3",t.transforms.displayViewScreenMat3),this._tileInfoProgram.setUniform1f("u_depth",0),this._tileInfoProgram.setUniform2f("u_coord_ratio",t.rangeX/t.width,t.rangeY/t.height),this._tileInfoProgram.setUniform2f("u_delta",0,0),this._tileInfoProgram.setUniform2f("u_dimensions",n.descriptor.width,n.descriptor.height),o.drawArrays(l.TRIANGLE_STRIP,0,4),o.bindVAO()):o.bindVAO()}_loadWGLResources(e){if(this._outlineProgram&&this._tileInfoProgram)return;const r=c(e,i),o=c(e,s),a=new Int8Array([0,0,1,0,1,1,0,1]),l=n.createVertex(e,f.STATIC_DRAW,a),m=new g(e,i.attributes,t,new Map([["geometry",l]])),u=new Int8Array([0,0,1,0,0,1,1,1]),d=n.createVertex(e,f.STATIC_DRAW,u),h=new g(e,s.attributes,t,new Map([["geometry",d]]));this._outlineProgram=r,this._tileInfoProgram=o,this._outlineVertexArrayObject=m,this._tileInfoVertexArrayObject=h}_getTexture(e,t){if(!this._ctx){const e=document.createElement("canvas");e.width=_,e.height=x,this._ctx=e.getContext("2d")}if(!t.tileDebugInfoTexture){const r=new h;r.wrapMode=m.CLAMP_TO_EDGE,r.samplingMode=u.LINEAR,r.isImmutable=!0,r.width=_,r.height=x,t.tileDebugInfoTexture=new d(e,r)}const r=this._ctx;r.clearRect(0,0,r.canvas.width,r.canvas.height),r.textAlign="left",r.textBaseline="top",r.font=b-2+"px sans-serif",r.lineWidth=2,r.fillStyle="white",r.strokeStyle="black";const{debugSlot:o}=t;let i=p+T*o;const s=`${o}) ${t.key.id} (${t.constructor.name})`;r.strokeText(s,p,i),r.fillText(s,p,i),i+=b;const{debugInfo:n}=t;if(n){const{length:e,minOrderedLength:t,minUnorderedLength:o,triangleCount:s}=n.display;if(e>0){const t=`Length: ${e}`;r.strokeText(t,p,i),r.fillText(t,p,i),i+=b}if(t){const e=`Min ordered length: ${t}`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}if(o){const e=`Min unordered length: ${o}`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}if(s>0){s>1e5&&(r.fillStyle="red",r.strokeStyle="white");const e=`Triangle count: ${s}`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}const{bytesUsed:a,bytesReserved:l}=n.memory;if(r.fillStyle="white",r.strokeStyle="black",a>0||l>0){const e=`Memory usage: ${a} of ${l} bytes`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}}return t.tileDebugInfoTexture.setData(r.canvas),t.tileDebugInfoTexture}}export{y as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{nextPowerOfTwo as t}from"../../../../../core/mathUtils.js";import{create as e}from"../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as r}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{vtlTextureBindingUnitSprites as o,vtlHighResCutoff as i}from"../definitions.js";import s from"./WGLBrush.js";import{BufferObject as a}from"../../../../webgl/BufferObject.js";import{TextureSamplingMode as n,CompareFunction as c,PrimitiveType as l,Usage as f}from"../../../../webgl/enums.js";import{VertexArrayObject as m}from"../../../../webgl/VertexArrayObject.js";class u extends s{constructor(){super(...arguments),this._color=r(1,0,0,1),this._patternMatrix=e(),this._programOptions={id:!1,pattern:!1}}dispose(){this._vao&&(this._vao.dispose(),this._vao=null)}drawMany(e,r){const{context:s,painter:a,requestRender:f,allowDelayedRender:m}=e;this._loadWGLResources(e);const u=e.displayLevel,p=e.styleLayer,_=p.backgroundMaterial,d=a.vectorTilesMaterialManager,g=p.getPaintValue("background-color",u),h=p.getPaintValue("background-opacity",u),x=p.getPaintValue("background-pattern",u),
|
|
5
|
+
import{nextPowerOfTwo as t}from"../../../../../core/mathUtils.js";import{create as e}from"../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as r}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{vtlTextureBindingUnitSprites as o,vtlHighResCutoff as i}from"../definitions.js";import s from"./WGLBrush.js";import{BufferObject as a}from"../../../../webgl/BufferObject.js";import{TextureSamplingMode as n,CompareFunction as c,PrimitiveType as l,Usage as f}from"../../../../webgl/enums.js";import{VertexArrayObject as m}from"../../../../webgl/VertexArrayObject.js";class u extends s{constructor(){super(...arguments),this._color=r(1,0,0,1),this._patternMatrix=e(),this._programOptions={id:!1,pattern:!1}}dispose(){this._vao&&(this._vao.dispose(),this._vao=null)}drawMany(e,r){const{context:s,painter:a,requestRender:f,allowDelayedRender:m}=e;this._loadWGLResources(e);const u=e.displayLevel,p=e.styleLayer,_=p.backgroundMaterial,d=a.vectorTilesMaterialManager,g=p.getPaintValue("background-color",u),h=p.getPaintValue("background-opacity",u),x=p.getPaintValue("background-pattern",u),M=void 0!==x,b=1|window.devicePixelRatio,v=e.spriteMosaic;let y,w;const j=b>i?2:1,A=this._programOptions;A.pattern=M;const L=d.getMaterialProgram(s,_,A);if(!m||null==f||L.compiled){if(s.bindVAO(this._vao),s.useProgram(L),M){const t=v.getMosaicItemPosition(x,!0);if(null!=t){const{tl:e,br:r,page:i}=t;y=r[0]-e[0],w=r[1]-e[1];const a=v.getPageSize(i);null!=a&&(v.bind(s,n.LINEAR,i,o),L.setUniform4f("u_tlbr",e[0],e[1],r[0],r[1]),L.setUniform2fv("u_mosaicSize",a),L.setUniform1i("u_texture",o))}L.setUniform1f("u_opacity",h)}else{const t=g[3]*h;this._color[0]=t*g[0],this._color[1]=t*g[1],this._color[2]=t*g[2],this._color[3]=t,L.setUniform4fv("u_color",this._color)}L.setUniform1f("u_depth",p.z||0);for(const e of r){if(L.setUniform1f("u_coord_range",e.rangeX),L.setUniformMatrix3fv("u_dvsMat3",e.transforms.displayViewScreenMat3),M){const r=Math.max(2**(Math.round(u)-e.key.level),1),o=j*e.width*r,i=o/t(y),s=o/t(w);this._patternMatrix[0]=i,this._patternMatrix[4]=s,L.setUniformMatrix3fv("u_pattern_matrix",this._patternMatrix)}s.setStencilFunction(c.EQUAL,0,255),s.drawArrays(l.TRIANGLE_STRIP,0,4)}}else f()}_loadWGLResources(t){if(this._vao)return;const{context:e,styleLayer:r}=t,o=r.backgroundMaterial,i=new Int8Array([0,0,1,0,0,1,1,1]),s=a.createVertex(e,f.STATIC_DRAW,i),n=new m(e,o.getAttributeLocations(),o.getLayoutInfo(),new Map([["geometry",s]]));this._vao=n}}export{u as WGLBrushVTLBackground};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{destroyMaybe as e}from"../../../../../core/maybe.js";import{i1616to32 as t}from"../number.js";import{MappedBuffer as r}from"./Buffer.js";import{unpackDataView as i}from"../shaderGraph/techniques/mesh/dataViewUtils.js";import{PrimitiveType as s}from"../../../../webgl/enums.js";import{VertexArrayObject as f}from"../../../../webgl/VertexArrayObject.js";const o=1e3;function n(e,t){const r=
|
|
5
|
+
import{destroyMaybe as e}from"../../../../../core/maybe.js";import{i1616to32 as t}from"../number.js";import{MappedBuffer as r}from"./Buffer.js";import{unpackDataView as i}from"../shaderGraph/techniques/mesh/dataViewUtils.js";import{PrimitiveType as s}from"../../../../webgl/enums.js";import{VertexArrayObject as f}from"../../../../webgl/VertexArrayObject.js";const o=1e3;function n(e,t){const r=e.attributes.filter((e=>t.locations.has(e.name))).map((t=>({name:t.name,type:t.type,count:t.count,divisor:0,normalized:t.normalized??!1,offset:t.offset,stride:e.stride})));return new Map([["geometry",r]])}function u(e,t){const r=[],i=e.attributes.filter((e=>t.locations.has(e.name)));for(const s of i){r.push({name:s.name,type:s.type,count:s.count,divisor:0,normalized:s.normalized??!1,offset:s.offset,stride:e.stride});const i=t.computeAttributeMap[s.name];null!=i&&2===i.length&&(r.push({name:i[0],count:s.count,divisor:0,type:s.type,normalized:s.normalized??!1,offset:s.offset+e.stride,stride:e.stride}),r.push({name:i[1],count:s.count,divisor:0,type:s.type,normalized:s.normalized??!1,offset:s.offset+2*e.stride,stride:e.stride}))}return new Map([["geometry",r]])}class a{constructor(e,t){if(this._bufferPool=e,this._layout=t,this._invalidated=!1,this._position=this._layout.attributes.find((e=>"pos"===e.name||"position"===e.name)),!this._position)throw new Error("InternalError: Unable to find position attribute")}destroy(){this._indexBuffer=e(this._indexBuffer),this._vertexBuffer=e(this._vertexBuffer),this._computeVAO?.disposeVAOOnly(),this._geometryVAO?.disposeVAOOnly()}get layout(){return this._layout}getDrawArgs(e,t,r,i){return i?{primitive:s.POINTS,count:t/3,offset:r/3}:{primitive:e,count:t,offset:r}}getAttributePrecisionPackFactors(){const e={};for(const t of this.layout.attributes)t.packPrecisionFactor&&(e[t.name]=t.packPrecisionFactor);return e}getDebugVertexInfo(e=!1){if(!this._vertexBuffer)return null;const t=this._layout,r=t.stride,s=this._vertexBuffer.getView(0,this._vertexBuffer.byteSize),f=new DataView(s.slice().buffer);let o=s.byteLength/r;e&&(o=this._indexBuffer.fillPointer/3);const n=this._indexBuffer.getView(0,this._indexBuffer.byteSize);let u=0;const a=[];for(let h=0;h<o;h++){if(e){u=n[3*h]*r}const s={};for(const e of t.attributes){let t=`${e.offset} ${e.name}`,r=i(f,e,u);if(e.packPrecisionFactor)if(t+=` (precision: ${e.packPrecisionFactor})`,"number"==typeof r)r/=e.packPrecisionFactor;else for(let i=0;i<r.length;i++)r[i]/=e.packPrecisionFactor;s[t]=r}u+=r,a.push(s)}return{vertices:a,layout:t}}_ensure(e,t){if(this._vertexBuffer&&this._indexBuffer)this._indexBuffer.ensure(Math.max(e,1e3)),this._vertexBuffer.ensure(Math.max(t,1e3));else{const i=this._layout.stride/Uint32Array.BYTES_PER_ELEMENT;this._indexBuffer=new r("index",Math.max(e,o),1,this._bufferPool),this._vertexBuffer=new r("vertex",Math.max(t,o),i,this._bufferPool)}}append(e){const t=e.layout.stride,r=e.indices.byteLength/Uint32Array.BYTES_PER_ELEMENT,i=e.vertices.byteLength/t;this._ensure(r,i);const{vertices:s,indices:f}=e,o=this._vertexBuffer.insert(s,0,s.byteLength/t,0);return{vertexFrom:o,indexFrom:this._indexBuffer.insert(f,0,f.byteLength/4,o)}}copyRecordFrom(e,r,i,s){const{indexStart:f,indexCount:o,vertexStart:n,vertexCount:u}=r;this._ensure(o,u);const a=e._position,h=i*(a.packPrecisionFactor??1),d=s*(a.packPrecisionFactor??1),_=a.offset,c=t(h,d),l=this._vertexBuffer.copyFrom(e._vertexBuffer,n,u,c,_),m=this._indexBuffer.copyFrom(e._indexBuffer,f,o,l-n,0),x=r.clone();return x.vertexStart=l,x.indexStart=m,x.overlaps=0,x}remove(e,t,r,i){this._indexBuffer.free(e,t),this._vertexBuffer.free(r,i)}upload(){this._invalidated=!0}getGeometryVAO(e,t){if(!this._vertexBuffer||!this._indexBuffer||!this._vertexBuffer.bufferSize)return null;if(this._invalidated){(this._vertexBuffer.invalidated||this._indexBuffer.invalidated)&&(this._vertexBuffer.invalidate(),this._indexBuffer.invalidate(),this._geometryVAO?.disposeVAOOnly(),this._geometryVAO=null),this._vertexBuffer.upload(),this._indexBuffer.upload();const r=this._indexBuffer.getGPUBuffer(e,!1),i=this._vertexBuffer.getGPUBuffer(e);this._geometryVAO||(this._geometryVAO=new f(e,t.locations,n(this.layout,t),new Map([["geometry",i]]),r)),this._invalidated=!1}return this._geometryVAO}getComputeVAO(e,t){if(!this._vertexBuffer||!this._indexBuffer||!this._vertexBuffer.bufferSize)return null;(this._vertexBuffer.invalidated||this._indexBuffer.invalidatedComputeBuffer)&&(this._vertexBuffer.invalidate(),this._indexBuffer.invalidate(),this._computeVAO?.disposeVAOOnly(),this._computeVAO=null),this._vertexBuffer.upload(),this._indexBuffer.upload();const r=this._indexBuffer.getGPUBuffer(e,!0),i=this._vertexBuffer.getGPUBuffer(e);return this._computeVAO||(this._computeVAO=new f(e,t.locations,u(this.layout,t),new Map([["geometry",i]]),r),this._invalidated=!1),this._computeVAO}get memoryStats(){return{bytesUsed:this._vertexBuffer.memoryStats.bytesUsed+this._indexBuffer.memoryStats.bytesUsed,bytesReserved:this._vertexBuffer.memoryStats.bytesReserved+this._indexBuffer.memoryStats.bytesReserved,vertex:this._vertexBuffer.memoryStats,index:this._indexBuffer.memoryStats}}reshuffle(e){this._vertexBuffer&&this._vertexBuffer.reshuffle(e.vertex.count,e.vertex.operations),this._indexBuffer&&this._indexBuffer.reshuffle(e.index.count,e.index.operations)}}export{a as MappedMesh};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{textureBindingHighlight0 as r,textureBindingHighlight1 as e}from"../../definitions.js";import{alphaToRgbaChannelSelectorMatrix as s,rgbaToRgbaChannelSelectorMatrix as i,sigma as t}from"./parameters.js";import{highlight as o,blur as u}from"../../shaders/HighlightPrograms.js";import{BufferObject as
|
|
5
|
+
import{textureBindingHighlight0 as r,textureBindingHighlight1 as e}from"../../definitions.js";import{alphaToRgbaChannelSelectorMatrix as s,rgbaToRgbaChannelSelectorMatrix as i,sigma as t}from"./parameters.js";import{highlight as o,blur as u}from"../../shaders/HighlightPrograms.js";import{BufferObject as a}from"../../../../../webgl/BufferObject.js";import{PrimitiveType as h,BlendFactor as m,Usage as n,DataType as _}from"../../../../../webgl/enums.js";import{createProgram as g}from"../../../../../webgl/ProgramTemplate.js";import{VertexArrayObject as d}from"../../../../../webgl/VertexArrayObject.js";import{VertexElementDescriptor as l}from"../../../../../webgl/VertexElementDescriptor.js";class c{constructor(){this._width=void 0,this._height=void 0,this._resources=null}dispose(){this._resources&&(this._resources.quadGeometry.dispose(),this._resources.quadVAO.dispose(),this._resources.highlightProgram.dispose(),this._resources.blurProgram.dispose(),this._resources=null)}preBlur(e,i){e.bindTexture(i,r),e.useProgram(this._resources.blurProgram),this._resources.blurProgram.setUniform4fv("u_direction",[1,0,1/this._width,0]),this._resources.blurProgram.setUniformMatrix4fv("u_channelSelector",s),e.bindVAO(this._resources.quadVAO),e.drawArrays(h.TRIANGLE_STRIP,0,4),e.bindVAO()}finalBlur(e,s){e.bindTexture(s,r),e.useProgram(this._resources.blurProgram),this._resources.blurProgram.setUniform4fv("u_direction",[0,1,0,1/this._height]),this._resources.blurProgram.setUniformMatrix4fv("u_channelSelector",i),e.bindVAO(this._resources.quadVAO),e.drawArrays(h.TRIANGLE_STRIP,0,4),e.bindVAO()}renderHighlight(e,s,i){e.bindTexture(s,r),e.useProgram(this._resources.highlightProgram),i.applyHighlightOptions(e,this._resources.highlightProgram),e.bindVAO(this._resources.quadVAO),e.setBlendingEnabled(!0),e.setBlendFunction(m.ONE,m.ONE_MINUS_SRC_ALPHA),e.drawArrays(h.TRIANGLE_STRIP,0,4),e.bindVAO()}_initialize(s,i,h){this._width=i,this._height=h;const m=a.createVertex(s,n.STATIC_DRAW,new Int8Array([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]).buffer),c=new d(s,new Map([["a_position",0],["a_texcoord",1]]),new Map([["geometry",[new l("a_position",2,_.BYTE,0,4),new l("a_texcoord",2,_.UNSIGNED_BYTE,2,4)]]]),new Map([["geometry",m]])),f=g(s,o),b=g(s,u);s.useProgram(f),f.setUniform1i("u_texture",r),f.setUniform1i("u_shade",e),f.setUniform1f("u_sigma",t),s.useProgram(b),b.setUniform1i("u_texture",r),b.setUniform1f("u_sigma",t),this._resources={quadGeometry:m,quadVAO:c,highlightProgram:f,blurProgram:b}}setup(r,e,s){this._resources?(this._width=e,this._height=s):this._initialize(r,e,s)}}export{c as default};
|