@arcgis/core 4.34.0-next.58 → 4.34.0-next.59
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/Basemap.js +1 -1
- package/LICENSE.md +19 -0
- package/README.md +2 -18
- package/applications/KnowledgeStudio/reshape.d.ts +5 -0
- package/applications/KnowledgeStudio/reshape.js +5 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{26975e5b3fb7f2ed45a4.js → 03fe4164abd12abc7921.js} +1 -1
- package/assets/esri/core/workers/chunks/{893e5eb5c028c4704317.js → 0427f66b56ec6601deb0.js} +1 -1
- package/assets/esri/core/workers/chunks/0cb2f7172190babb4139.js +1 -0
- package/assets/esri/core/workers/chunks/0e28cb5d8d89ae29cdd0.js +1 -0
- package/assets/esri/core/workers/chunks/{1776ef96c9f4636f8838.js → 138c11b5eca621e51396.js} +1 -1
- package/assets/esri/core/workers/chunks/{57c438bb0da6410df525.js → 1bf17c6548ac4cd5a166.js} +1 -1
- package/assets/esri/core/workers/chunks/{043bb97e38e3a54aa2ab.js → 1ed7a8f4a0058d3b69ef.js} +1 -1
- package/assets/esri/core/workers/chunks/{827bebb4bcdde23adc91.js → 251b7f2e295ce191eb62.js} +1 -1
- package/assets/esri/core/workers/chunks/{02a31483e09652a1a1a2.js → 2b7f9a57a2cfbc108673.js} +1 -1
- package/assets/esri/core/workers/chunks/{7c86af4f60cea383ed96.js → 39a1f361bb69073af765.js} +1 -1
- package/assets/esri/core/workers/chunks/{327b0da744426ce40e60.js → 3a7ac10a6614fe5745f7.js} +1 -1
- package/assets/esri/core/workers/chunks/{8c79945909069733558f.js → 4094cebc4b92c52f4e27.js} +1 -1
- package/assets/esri/core/workers/chunks/{82de1b50ae286f1e6c44.js → 451761c7bd2da530e1d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{cc748d4f4adb9c584aa4.js → 45aeff2f751f124f8e53.js} +1 -1
- package/assets/esri/core/workers/chunks/{d20af70b23f175fb5442.js → 48b9ba825856a0c843ff.js} +1 -1
- package/assets/esri/core/workers/chunks/4dee2f05508e90410f13.js +1 -0
- package/assets/esri/core/workers/chunks/{d630fc3acd2552c98dc0.js → 547af4ffbeeccba9d187.js} +1 -1
- package/assets/esri/core/workers/chunks/{ff14b632f147cb68ed59.js → 58422c616a824ab49218.js} +1 -1
- package/assets/esri/core/workers/chunks/589a0e244ef5f1b84ab6.js +1 -0
- package/assets/esri/core/workers/chunks/{2c7e7895c4dda176220e.js → 5d4b24c864ebb68ae61e.js} +1 -1
- package/assets/esri/core/workers/chunks/{a1ff4c252012d5026133.js → 65eb183b5d001dfc42c8.js} +1 -1
- package/assets/esri/core/workers/chunks/{f1b6d6ee03635d985c3e.js → 6688efc71d9d8f4d2559.js} +1 -1
- package/assets/esri/core/workers/chunks/{d5faf3ddf9a39de826be.js → 672c04d48aa51f16e9b7.js} +1 -1
- package/assets/esri/core/workers/chunks/{17e203e4680c07bd02f1.js → 7aa7aff6d42be7c2d1d2.js} +1 -1
- package/assets/esri/core/workers/chunks/{549e073fe276363a9896.js → 7db105f6b688b6da8106.js} +1 -1
- package/assets/esri/core/workers/chunks/{945c5a477940ebd23a4c.js → 7f0c78bcba0aed3c4eff.js} +1 -1
- package/assets/esri/core/workers/chunks/{3eb792863a789b97ec58.js → 831a69e5a87e92830fbe.js} +1 -1
- package/assets/esri/core/workers/chunks/83dfaa6e3bd58d544f35.js +1 -0
- package/assets/esri/core/workers/chunks/8bbae8ac586e5c0819d2.js +1 -0
- package/assets/esri/core/workers/chunks/{9275313e0f1f521b2658.js → 9325000c87295c473291.js} +1 -1
- package/assets/esri/core/workers/chunks/{944d1608f935516951c4.js → 94b9948ec628187c19fc.js} +1 -1
- package/assets/esri/core/workers/chunks/{757717416d909059df2f.js → 981275b6f008431c983a.js} +1 -1
- package/assets/esri/core/workers/chunks/{c71dac67f95d694bf67e.js → 9f4e23bae621ff3ecea3.js} +1 -1
- package/assets/esri/core/workers/chunks/{989251f5e0d6a08b1afa.js → a17ed7ce97e69466d730.js} +1 -1
- package/assets/esri/core/workers/chunks/{319fe6a02ec630a827ea.js → a7ea2e3895046e566bc6.js} +1 -1
- package/assets/esri/core/workers/chunks/{5cfec58c7c31e6d8c6ea.js → abe60d92e0219ee97036.js} +1 -1
- package/assets/esri/core/workers/chunks/{4193691ca076948f4f90.js → b53008c1461dd6bacc63.js} +1 -1
- package/assets/esri/core/workers/chunks/{1d234c057a6671acc59f.js → b605dfdfed8ff8eda4f3.js} +1 -1
- package/assets/esri/core/workers/chunks/{0fb2dcbd54175e75d94d.js → b68b54be3d67595a9446.js} +4 -6
- package/assets/esri/core/workers/chunks/{7eda1c400658b6a99be8.js → ba0c7339fa19cc7cbde7.js} +1 -1
- package/assets/esri/core/workers/chunks/{724de82d101eb59c2834.js → bd451668c4ce9f7d7128.js} +1 -1
- package/assets/esri/core/workers/chunks/{91ede8c62a7b1e8b8023.js → be06c8a58c217a17451b.js} +1 -1
- package/assets/esri/core/workers/chunks/{08c0c016787caa169492.js → c24214666d10cb648428.js} +1 -1
- package/assets/esri/core/workers/chunks/{a3a23a56df4e5ee86bb2.js → c5fe356fc5b8b7be0d31.js} +1 -1
- package/assets/esri/core/workers/chunks/{64fab4e1e28c06c83403.js → c779c8b98e07fa881c1d.js} +1 -1
- package/assets/esri/core/workers/chunks/{4a0257c449f31bdadf26.js → cef9ff811221a7c3812c.js} +1 -1
- package/assets/esri/core/workers/chunks/{b1982490762972ae023d.js → d0296368ae143de4d5ce.js} +1 -1
- package/assets/esri/core/workers/chunks/{3d5954478864a975e65e.js → d07d3b0e06f12aee4a8b.js} +1 -1
- package/assets/esri/core/workers/chunks/{e1472dbf0795d737d6f8.js → d2371f5034b2a32e2523.js} +1 -1
- package/assets/esri/core/workers/chunks/{2f65081bfedeab44d6cb.js → d35cadfb78ac9803069b.js} +1 -1
- package/assets/esri/core/workers/chunks/d7ce68667bb355ef8e5d.js +1 -0
- package/assets/esri/core/workers/chunks/{8c2fcfcfbb6b70f7bada.js → d823277612f971a9c2f0.js} +1 -1
- package/assets/esri/core/workers/chunks/{c4ff5c78fc8668af9c05.js → d91b80aa4f847c2e2a33.js} +1 -1
- package/assets/esri/core/workers/chunks/{c4ceb267d4004d8da8cc.js → e0bbfbe1ed39c82f1bd4.js} +1 -1
- package/assets/esri/core/workers/chunks/e58c5c8639aa837c84d1.js +1 -0
- package/assets/esri/core/workers/chunks/{a24762e976c1459b12de.js → e689a4849f5af3f2f641.js} +1 -1
- package/assets/esri/core/workers/chunks/{5787101b2b814c5d2439.js → eacc7fccdc3fb670ac8f.js} +1 -1
- package/assets/esri/core/workers/chunks/{0df1f56df6d47dfbb6ea.js → eada3483116a5ea8baed.js} +1 -1
- package/assets/esri/core/workers/chunks/{47682247910271077333.js → ee78a38a0cacb19b2fd4.js} +1 -1
- package/assets/esri/core/workers/chunks/{f4061587ff5789fa4e1f.js → f594df2f5ce6ca41a254.js} +1 -1
- package/assets/esri/core/workers/chunks/{d7b3e81cc313fd0a33b0.js → f5c821ca2911a5103c9a.js} +1 -1
- package/assets/esri/core/workers/chunks/f711aeba1a2c184ddb43.js +1 -0
- package/assets/esri/core/workers/chunks/fdae43a97537093e4b97.js +1 -0
- package/chunks/BloomComposition.glsl.js +36 -18
- package/chunks/ComponentShader.glsl.js +1 -1
- package/chunks/CompositeGeographicTransformation.js +1 -1
- package/chunks/DefaultMaterial.glsl.js +1 -1
- package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +1 -1
- package/chunks/GeographicTransformation.js +1 -1
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/Path.glsl.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/RealisticTree.glsl.js +1 -1
- package/chunks/SpatialReference.js +1 -1
- package/chunks/UnitFactory.js +1 -1
- package/chunks/sphere.js +1 -1
- package/chunks/vec42.js +1 -1
- package/config.js +1 -1
- package/copyright.txt +2 -20
- package/core/accessorSupport/layerContainerType.js +1 -1
- package/core/libs/gl-matrix-2/math/quat.js +1 -1
- package/core/libs/gl-matrix-2/math/vec4.js +1 -1
- package/core/quantityFormatUtils.js +1 -1
- package/core/unitFormatUtils.js +1 -1
- package/editing/geometry/coordUtils.js +5 -0
- package/editing/geometry/lineUtils.js +5 -0
- package/editing/sharedTemplates/executor/builders/equallySpaced.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtIntersectionVerticesOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/support/builderUtils.js +1 -1
- package/editing/sharedTemplates/executor/builders/support/offsetUtils.js +1 -1
- package/editing/sharedTemplates/executor/builders/support/shapeUtils.js +1 -1
- package/geometry/coordinateFormatter.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorIntegrate.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/support/apiConverter.js +1 -1
- package/geometry/operators/support/initNoPeFactory.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/graphic/KnowledgeGraphGraphicOrigin.js +1 -1
- package/graphic/LinkChartGraphicOrigin.js +5 -0
- package/graphic/isLinkChartGraphicOrigin.js +5 -0
- package/interfaces.d.ts +129 -10
- package/kernel.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/GroundLayer.js +1 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/catalog/catalogUtils.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/knowledgeGraph/nodeMovementUtils.js +5 -0
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/mixins/operationalLayers.js +1 -1
- package/layers/support/RasterStorageInfo.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/layersCreator.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
- package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/ElevationContext.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/pointUtils.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/support/FlowTileTree3DDebugger.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/CombinedElevationProvider.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +2 -4
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomCompositionTechniqueConfiguration.js +5 -0
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/octreeUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/LinkChartView.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/support/HighlightHelper.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/drawUtils.js +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/sketch/SketchLabelOptions.js +1 -1
- package/views/interactive/sketch/SketchOptions.js +1 -1
- package/views/interactive/sketch/SketchTooltipOptions.js +1 -1
- package/views/interactive/sketch/SketchTooltipVisibleElements.js +1 -1
- package/views/interactive/sketch/SketchValueOptions.js +1 -1
- package/views/interactive/sketch/Units.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
- package/views/interactive/tooltip/fields/fields.js +1 -1
- package/views/interactive/tooltip/fields/parsingAndFormattingUtils.js +1 -1
- package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
- package/views/support/angularMeasurementUtils.js +1 -1
- package/webdoc/support/writeUtils.js +1 -1
- package/webscene/spec-certification/api.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
- package/widgets/Editor/support/splitFeatureUtils.js +5 -0
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/EULA.pdf +0 -0
- package/assets/esri/core/workers/chunks/00ee6f84119bc55a222f.js +0 -1
- package/assets/esri/core/workers/chunks/0569698a3e4eaf2bac8e.js +0 -1
- package/assets/esri/core/workers/chunks/0e4976f92b66793137c4.js +0 -1
- package/assets/esri/core/workers/chunks/171ce8c64f322cd5d6d1.js +0 -1
- package/assets/esri/core/workers/chunks/1ae15163af8875148fb8.js +0 -1
- package/assets/esri/core/workers/chunks/373c9e17e2834dfc1839.js +0 -1
- package/assets/esri/core/workers/chunks/55bb794bcdd9cc788322.js +0 -1
- package/assets/esri/core/workers/chunks/6acffacbb4a03af52e3b.js +0 -1
- package/assets/esri/core/workers/chunks/b457b7dd907f06278bee.js +0 -1
- package/assets/esri/core/workers/chunks/e7ccf067bea8f4766424.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import"../../core/has.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import t from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import o from"../../layers/support/RasterInfo.js";import{colorize as n,remapColor as i,lookupPixels as l,createColormapLUT as u,isValidPixelBlock as c}from"../../layers/support/rasterFunctions/pixelUtils.js";import{stretch as p,getStretchCutoff as d,isStandardU8Histogram as m,createStretchLUT as h,computeGammaValues as f,createHistogramEqualizationLUT as b}from"../../layers/support/rasterFunctions/stretchUtils.js";import{hillshade as g,tintHillshade as y,calculateHillshadeParams as S}from"../../layers/support/rasterFunctions/surfaceUtils.js";import{convertColorRampToColormap as x,createHsvMap as R}from"./colorRampUtils.js";import{isUVRendererSupported as I,isColormapSupportedByWebGL as k,isColormapRendererSupported as C,isShadedReliefRendererSupported as L}from"./rasterRendererChecks.js";let _=class extends r{constructor(e){super(e),this.lookup={rendererJSON:{}},this.canRenderInWebGL=!1}bind(){const{rendererJSON:e}=this;if(!e)return{success:!1};let r;switch(this.lookup={rendererJSON:{}},e.type){case"uniqueValue":r=this._updateUVRenderer(e);break;case"rasterColormap":r=this._updateColormapRenderer(e);break;case"rasterStretch":r=this._updateStretchRenderer(e);break;case"classBreaks":r=this._updateClassBreaksRenderer(e);break;case"rasterShadedRelief":r=this._updateShadedReliefRenderer(e);break;case"vectorField":r=this._updateVectorFieldRenderer();break;case"flowRenderer":r=this._updateFlowRenderer()}return r}symbolize(e){let r=e?.pixelBlock;if(!T(r))return r;if(e.simpleStretchParams&&"rasterStretch"===this.rendererJSON.type)return this.simpleStretch(r,e.simpleStretchParams);try{let t;switch(r.pixels.length>3&&(r=r.extractBands(e.bandIds??[0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":t=this._symbolizeColormap(r);break;case"classBreaks":t=this._symbolizeClassBreaks(r);break;case"rasterStretch":t=this._symbolizeStretch(r,e.bandIds);break;case"rasterShadedRelief":{const s=e.extent,a=s.spatialReference.isGeographic,o={x:(s.xmax-s.xmin)/r.width,y:(s.ymax-s.ymin)/r.height};t=this._symbolizeShadedRelief(r,{isGCS:a,resolution:o});break}}return t}catch(s){return t.getLogger(this).error("symbolize",s.message),r}}simpleStretch(e,r){if(!T(e))return e;try{return e.pixels.length>3&&(e=e.extractBands([0,1,2])),p(e,{...r,isRenderer:!0})}catch(s){return t.getLogger(this).error("symbolize",s.message),e}}generateWebGLParameters(e){const{rendererJSON:r}=this;switch(r.type){case"uniqueValue":case"rasterColormap":case"classBreaks":return this._generateColormapWebGLParams("classBreaks"===r.type);case"rasterStretch":return this._generateStretchWebGLParams(e.pixelBlock,r,e.bandIds);case"rasterShadedRelief":return this._generateShadedReliefWebGLParams(r,e.isGCS,e.resolution??void 0);case"vectorField":return this._generateVectorFieldWebGLParams(r);default:return null}}_isLUTChanged(e){const r=this.lookup.rendererJSON;if(!r)return!0;const{rendererJSON:t}=this;if("colorRamp"in t&&t.colorRamp){const s=t.colorRamp;if(e)return JSON.stringify(s)!==JSON.stringify(r.colorRamp)}return JSON.stringify(t)!==JSON.stringify(r)}_symbolizeColormap(e){if(this._isLUTChanged()){if(!this.bind().success)return e}return n(e,this.lookup.colormapLut)}_symbolizeClassBreaks(e){const{canUseIndexedLUT:r}=this._analyzeClassBreaks(this.rendererJSON);if(this._isLUTChanged()){if(!this.bind().success)return e}return r?n(e,this.lookup.colormapLut):i(e,this.lookup.remapLut??[])}_symbolizeStretch(e,r){if(!e)return null;const{rasterInfo:t,lookup:s}=this,{pixelType:a,bandCount:o}=t,i=this.rendererJSON,u=["u8","u16","s8","s16"].includes(a);let c;const{dra:f}=i,{gamma:b}=s;if("histogramEqualization"===i.stretchType){const a=f?null:s.histogramLut,o=d(i,{rasterInfo:t,pixelBlock:e,bandIds:r,returnHistogramLut:!a}),n="u8"===t.pixelType&&!f&&m(t.histograms?.[0])?e:p(e,{...o,gamma:b,isRenderer:!0});c=l(n,{lut:f?o.histogramLut:r?.length?r.map(e=>a[e]):a,offset:0})}else if(u){let n;if(f){const s=d(i,{rasterInfo:t,pixelBlock:e,bandIds:r});n=h({pixelType:a,...s,gamma:b,rounding:"floor"})}else{if(this._isLUTChanged()){if(!this.bind().success)return e}n=s.stretchLut}if(!n)return e;o>1&&null!=r&&r.length===e?.pixels.length&&n.lut.length===o&&(n={lut:r.map(e=>n.lut[e]),offset:n.offset}),c=l(e,n)}else{const s=d(i,{rasterInfo:t,pixelBlock:e,bandIds:r});c=p(e,{...s,gamma:b,isRenderer:!0})}if(i.colorRamp){if(this._isLUTChanged(!0)){if(!this.bind().success)return e}c=n(c,s.colormapLut)}return c}_symbolizeShadedRelief(e,r){const t=this.rendererJSON,s={...t,...r},a=g(e,s);if(!t.colorRamp)return a;if(this._isLUTChanged(!0)){if(!this.bind().success)return a}const{hsvMap:o}=this.lookup;if(!o)return a;const n=this.rasterInfo.statistics?.[0]??{min:0,max:8e3};return y(a,e,o,n),a}_isVectorFieldData(){const{bandCount:e,dataType:r}=this.rasterInfo;return 2===e&&("vector-magdir"===r||"vector-uv"===r)}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(e){const{bandCount:r,attributeTable:t,pixelType:s}=this.rasterInfo,a=e.field1;if(!a)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const o=e.defaultSymbol,n=1===r&&["u8","s8"].includes(s);if(!I(this.rasterInfo,a)&&!n)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const i=[];if(null!=t){const r=t.fields.find(e=>"value"===e.name.toLowerCase());if(!r)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};t.features.forEach(t=>{const s=e.uniqueValueInfos?.find(e=>String(e.value)===String(t.attributes[a])),n=s?.symbol?.color;n?i.push([t.attributes[r.name]].concat(n)):o&&i.push([t.attributes[r.name]].concat(o.color))})}else{if("value"!==a.toLowerCase())return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not available.'};e.uniqueValueInfos?.forEach(e=>{const r=e?.symbol?.color;r?i.push([parseInt(""+e.value,10)].concat(r)):o&&i.push([parseInt(""+e.value,10)].concat(o?.color))})}if(0===i.length)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const l=u({colormap:i});return this.lookup={rendererJSON:e,colormapLut:l},this.canRenderInWebGL=k(l?.indexedColormap),{success:!0}}_updateColormapRenderer(e){if(!C(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const r=e.colormapInfos.map(e=>[e.value].concat(e.color)).sort((e,r)=>e[0]-r[0]);if(!r||0===r.length)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const t=u({colormap:r});return this.lookup={rendererJSON:e,colormapLut:t},this.canRenderInWebGL=k(t?.indexedColormap),{success:!0}}_updateShadedReliefRenderer(e){if(!L(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(e.colorRamp){const r=x(e.colorRamp,{interpolateAlpha:!0}),t=u({colormap:r}),s=R(t.indexedColormap);this.lookup={rendererJSON:e,colormapLut:t,hsvMap:s}}else this.lookup={rendererJSON:e};return this.canRenderInWebGL=!0,{success:!0}}_analyzeClassBreaks(e){const{attributeTable:r,pixelType:t}=this.rasterInfo,s=r?.fields.find(e=>"value"===e.name.toLowerCase()),a=r?.fields.find(r=>r.name.toLowerCase()===e.field.toLowerCase()),o=null!=s&&null!==a;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(t)||o,tableValueField:s,tableBreakField:a}}_updateClassBreaksRenderer(e){const{attributeTable:r}=this.rasterInfo,{canUseIndexedLUT:t,tableValueField:s,tableBreakField:a}=this._analyzeClassBreaks(e),o=e.classBreakInfos;if(!o?.length)return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const n=o.sort((e,r)=>e.classMaxValue-r.classMaxValue),i=n[n.length-1];let l=e.minValue;if(!t){const r=[];for(let e=0;e<n.length;e++)r.push({value:n[e].classMinValue??l,mappedColor:n[e].symbol.color}),l=n[e].classMaxValue;return r.push({value:i.classMaxValue,mappedColor:i.symbol.color}),this.lookup={rendererJSON:e,remapLut:r},this.canRenderInWebGL=!1,{success:!0}}const c=[];if(null!=r&&null!=s&&null!==a&&s!==a){const t=s.name,o=a.name,i=n[n.length-1],{classMaxValue:u}=i;l=e.minValue;for(const e of r.features){const r=e.attributes[t],s=e.attributes[o],a=s===u?i:s<l?null:n.find(({classMaxValue:e})=>e>s);a&&c.push([r].concat(a.symbol.color))}}else{l=Math.floor(e.minValue);for(let e=0;e<n.length;e++){const r=n[e];for(let e=l;e<r.classMaxValue;e++)c.push([e].concat(r.symbol.color));l=Math.ceil(r.classMaxValue)}i.classMaxValue===l&&c.push([i.classMaxValue].concat(i.symbol.color))}const p=u({colormap:c,fillUnspecified:!1});return this.lookup={rendererJSON:e,colormapLut:p},this.canRenderInWebGL=k(p?.indexedColormap),{success:!0}}_updateStretchRenderer(e){let{stretchType:r,dra:t}=e;if(!("none"===r||e.statistics?.length||v(this.rasterInfo.statistics)||t))return{success:!1,error:"Unsupported renderer; StretchRenderer.customStatistics is required when dynamic range adjustment is not used."};const s=e.histograms||this.rasterInfo.histograms;!V(e.stretchType)||s?.length||t||(r="minMax");const{computeGamma:a,useGamma:o,colorRamp:n}=e;let{gamma:i}=e;if(o&&a&&!i?.length){const r=e.statistics?.length?e.statistics:this.rasterInfo.statistics;i=f(this.rasterInfo.pixelType,r)}const l=this.rasterInfo.pixelType,c=!t&&["u8","u16","s8","s16"].includes(l);if("histogramEqualization"===r){const r=s.map(e=>b(e));this.lookup={rendererJSON:e,histogramLut:r}}else if(c){const r=d(e,{rasterInfo:this.rasterInfo}),t=h({pixelType:l,...r,gamma:o?i:null,rounding:"floor"});this.lookup={rendererJSON:e,stretchLut:t}}else this.lookup={rendererJSON:e};if(n&&!O(n)){const r=x(n,{interpolateAlpha:!0});this.lookup.colormapLut=u({colormap:r}),this.lookup.rendererJSON=e}return this.lookup.gamma=o&&i?.length?i:null,this.canRenderInWebGL="histogramEqualization"!==r,{success:!0}}_generateColormapWebGLParams(e){const{indexedColormap:r,offset:t}=this.lookup.colormapLut||{};return{colormap:r,colormapOffset:t,isClassBreaks:e,type:"lut"}}_generateStretchWebGLParams(e,r,t){const{colormapLut:s}=this.lookup,a=r.colorRamp?s?.indexedColormap:null,o=r.colorRamp?s?.offset:null;"histogramEqualization"===r.stretchType&&(r={...r,stretchType:"minMax"});const{gamma:n}=this.lookup,i=!(!r.useGamma||!n?.some(e=>1!==e)),{minCutOff:l,maxCutOff:u,minOutput:c,maxOutput:p}=d(r,{rasterInfo:this.rasterInfo,pixelBlock:e,bandIds:t});let m=0;null!=e&&(m=e.getPlaneCount(),2===m&&((e=e.clone()).statistics=[e.statistics[0]],e.pixels=[e.pixels[0]]));const{bandCount:h}=this.rasterInfo,f=Math.min(3,t?.length||m||h,h),b=a||i?1:255,g=new Float32Array(f);if(i&&n)for(let d=0;d<f;d++)n[d]>1?n[d]>2?g[d]=6.5+(n[d]-2)**2.5:g[d]=6.5+100*(2-n[d])**4:g[d]=1;1===l.length&&(l[2]=l[1]=l[0]),1===u.length&&(u[2]=u[1]=u[0]);const y=i&&n?[n[0],n[1]??n[0],n[2]??n[0]]:[1,1,1],S=i?[g[0],g[1]??g[0],g[2]??g[0]]:[1,1,1],x=u.map((e,r)=>u[r]===l[r]?0:(p-c)/(u[r]-l[r])/b);return{bandCount:f,minOutput:c/b,maxOutput:p/b,minCutOff:l,maxCutOff:u,factor:x,useGamma:i,gamma:y,gammaCorrection:S,colormap:a,colormapOffset:o,stretchType:r.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(e,r=!1,t={x:0,y:0}){const{colormapLut:s}=this.lookup,a=e.colorRamp?s?.indexedColormap:null,o=e.colorRamp?s?.offset:null,n={...e,isGCS:r,resolution:t},i=S(n),l=this.rasterInfo.statistics?.[0];return{...i,minValue:l?.min??0,maxValue:l?.max??8e3,hillshadeType:"traditional"===e.hillshadeType?0:1,type:"hillshade",colormap:a,colormapOffset:o}}_generateVectorFieldWebGLParams(e){const{style:r,inputUnit:t,outputUnit:s,visualVariables:a,symbolTileSize:o,flowRepresentation:n}=e,i=this.rasterInfo.statistics?.[0].min??0,l=this.rasterInfo.statistics?.[0].max??50,u=a?.find(e=>"sizeInfo"===e.type)??{maxDataValue:l,maxSize:.8*o,minDataValue:i,minSize:.2*o},c=u.minDataValue??i,p=u.maxDataValue??l,d=null!=u.maxSize&&null!=u.minSize?[u.minSize/o,u.maxSize/o]:[.2,.8];if("wind_speed"===r){const e=(d[0]+d[1])/2;d[0]=d[1]=e}const m=null!=c&&null!=p?[c,p]:null;let h=null;if("classified_arrow"===r)if(null!=c&&null!=p&&null!=u){h=[];const e=(u.maxDataValue-u.minDataValue)/5;for(let r=0;r<6;r++)h.push(u.minDataValue+e*r)}else h=[0,1e-6,3.5,7,10.5,14];const f="flow_to"===n===("ocean_current_kn"===r||"ocean_current_m"===r)?0:Math.PI,b=a?.find(e=>"rotationInfo"===e.type);return{breakValues:h,dataRange:m,inputUnit:t,outputUnit:s,symbolTileSize:o,symbolPercentRange:d,style:r||"single_arrow",rotation:f,rotationType:this.rasterInfo.storageInfo?.tileInfo&&"vector-uv"===this.rasterInfo.dataType?"geographic":b?.rotationType||e.rotationType,type:"vectorField"}}};function V(e){return"percentClip"===e||"histogramEqualization"===e}function v(e){return null!=e&&e.length>0&&null!=e[0].min&&null!=e[0].max}function T(e){return c(e)&&0!==e.validPixelCount}function O(e){return"algorithmic"===e.type&&["0,0,0,255","0,0,0"].includes(e.fromColor.join(","))&&["255,255,255,255","255,255,255"].includes(e.toColor.join(","))}e([s({json:{write:!0}})],_.prototype,"rendererJSON",void 0),e([s({type:o,json:{write:!0}})],_.prototype,"rasterInfo",void 0),e([s({json:{write:!0}})],_.prototype,"lookup",void 0),e([s()],_.prototype,"canRenderInWebGL",void 0),_=e([a("esri.renderers.support.RasterSymbolizer")],_);export{_ as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import"../../core/has.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import t from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import o from"../../layers/support/RasterInfo.js";import{colorize as n,remapColor as i,lookupPixels as l,createColormapLUT as u,isValidPixelBlock as c}from"../../layers/support/rasterFunctions/pixelUtils.js";import{stretch as p,getStretchCutoff as d,isStandardU8Histogram as m,createStretchLUT as h,computeGammaValues as f,createHistogramEqualizationLUT as b}from"../../layers/support/rasterFunctions/stretchUtils.js";import{hillshade as g,tintHillshade as y,calculateHillshadeParams as S}from"../../layers/support/rasterFunctions/surfaceUtils.js";import{convertColorRampToColormap as x,createHsvMap as R}from"./colorRampUtils.js";import{isUVRendererSupported as I,isColormapSupportedByWebGL as k,isColormapRendererSupported as C,isShadedReliefRendererSupported as L}from"./rasterRendererChecks.js";let _=class extends r{constructor(e){super(e),this.lookup={rendererJSON:{}},this.canRenderInWebGL=!1}bind(){const{rendererJSON:e}=this;if(!e)return{success:!1};let r;switch(this.lookup={rendererJSON:{}},e.type){case"uniqueValue":r=this._updateUVRenderer(e);break;case"rasterColormap":r=this._updateColormapRenderer(e);break;case"rasterStretch":r=this._updateStretchRenderer(e);break;case"classBreaks":r=this._updateClassBreaksRenderer(e);break;case"rasterShadedRelief":r=this._updateShadedReliefRenderer(e);break;case"vectorField":r=this._updateVectorFieldRenderer();break;case"flowRenderer":r=this._updateFlowRenderer()}return r}symbolize(e){let r=e?.pixelBlock;if(!T(r))return r;if(e.simpleStretchParams&&"rasterStretch"===this.rendererJSON.type)return this.simpleStretch(r,e.simpleStretchParams);try{let t;switch(r.pixels.length>3&&(r=r.extractBands(e.bandIds??[0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":t=this._symbolizeColormap(r);break;case"classBreaks":t=this._symbolizeClassBreaks(r);break;case"rasterStretch":t=this._symbolizeStretch(r,e.bandIds);break;case"rasterShadedRelief":{const s=e.extent,a=s.spatialReference.isGeographic,o={x:(s.xmax-s.xmin)/r.width,y:(s.ymax-s.ymin)/r.height};t=this._symbolizeShadedRelief(r,{isGCS:a,resolution:o});break}}return t}catch(s){return t.getLogger(this).error("symbolize",s.message),r}}simpleStretch(e,r){if(!T(e))return e;try{return e.pixels.length>3&&(e=e.extractBands([0,1,2])),p(e,{...r,isRenderer:!0})}catch(s){return t.getLogger(this).error("symbolize",s.message),e}}generateWebGLParameters(e){const{rendererJSON:r}=this;switch(r.type){case"uniqueValue":case"rasterColormap":case"classBreaks":return this._generateColormapWebGLParams("classBreaks"===r.type);case"rasterStretch":return this._generateStretchWebGLParams(e.pixelBlock,r,e.bandIds);case"rasterShadedRelief":return this._generateShadedReliefWebGLParams(r,e.isGCS,e.resolution??void 0);case"vectorField":return this._generateVectorFieldWebGLParams(r);default:return null}}_isLUTChanged(e){const r=this.lookup.rendererJSON;if(!r)return!0;const{rendererJSON:t}=this;if("colorRamp"in t&&t.colorRamp){const s=t.colorRamp;if(e)return JSON.stringify(s)!==JSON.stringify(r.colorRamp)}return JSON.stringify(t)!==JSON.stringify(r)}_symbolizeColormap(e){if(this._isLUTChanged()){if(!this.bind().success)return e}return n(e,this.lookup.colormapLut)}_symbolizeClassBreaks(e){const{canUseIndexedLUT:r}=this._analyzeClassBreaks(this.rendererJSON);if(this._isLUTChanged()){if(!this.bind().success)return e}return r?n(e,this.lookup.colormapLut):i(e,this.lookup.remapLut??[])}_symbolizeStretch(e,r){if(!e)return null;const{rasterInfo:t,lookup:s}=this,{pixelType:a,bandCount:o}=t,i=this.rendererJSON,u=["u8","u16","s8","s16"].includes(a);let c;const{dra:f}=i,{gamma:b}=s;if(f&&(r=null),"histogramEqualization"===i.stretchType){const a=f?null:s.histogramLut,o=d(i,{rasterInfo:t,pixelBlock:e,bandIds:r,returnHistogramLut:!a}),n="u8"===t.pixelType&&!f&&m(t.histograms?.[0])?e:p(e,{...o,gamma:b,isRenderer:!0});c=l(n,{lut:f?o.histogramLut:r?.length?r.map(e=>a[e]):a,offset:0})}else if(u){let n;if(f){const s=d(i,{rasterInfo:t,pixelBlock:e,bandIds:r});n=h({pixelType:a,...s,gamma:b,rounding:"floor"})}else{if(this._isLUTChanged()){if(!this.bind().success)return e}n=s.stretchLut}if(!n)return e;o>1&&null!=r&&r.length===e?.pixels.length&&n.lut.length===o&&(n={lut:r.map(e=>n.lut[e]),offset:n.offset}),c=l(e,n)}else{const s=d(i,{rasterInfo:t,pixelBlock:e,bandIds:r});c=p(e,{...s,gamma:b,isRenderer:!0})}if(i.colorRamp){if(this._isLUTChanged(!0)){if(!this.bind().success)return e}c=n(c,s.colormapLut)}return c}_symbolizeShadedRelief(e,r){const t=this.rendererJSON,s={...t,...r},a=g(e,s);if(!t.colorRamp)return a;if(this._isLUTChanged(!0)){if(!this.bind().success)return a}const{hsvMap:o}=this.lookup;if(!o)return a;const n=this.rasterInfo.statistics?.[0]??{min:0,max:8e3};return y(a,e,o,n),a}_isVectorFieldData(){const{bandCount:e,dataType:r}=this.rasterInfo;return 2===e&&("vector-magdir"===r||"vector-uv"===r)}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(e){const{bandCount:r,attributeTable:t,pixelType:s}=this.rasterInfo,a=e.field1;if(!a)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const o=e.defaultSymbol,n=1===r&&["u8","s8"].includes(s);if(!I(this.rasterInfo,a)&&!n)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const i=[];if(null!=t){const r=t.fields.find(e=>"value"===e.name.toLowerCase());if(!r)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};t.features.forEach(t=>{const s=e.uniqueValueInfos?.find(e=>String(e.value)===String(t.attributes[a])),n=s?.symbol?.color;n?i.push([t.attributes[r.name]].concat(n)):o&&i.push([t.attributes[r.name]].concat(o.color))})}else{if("value"!==a.toLowerCase())return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not available.'};e.uniqueValueInfos?.forEach(e=>{const r=e?.symbol?.color;r?i.push([parseInt(""+e.value,10)].concat(r)):o&&i.push([parseInt(""+e.value,10)].concat(o?.color))})}if(0===i.length)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const l=u({colormap:i});return this.lookup={rendererJSON:e,colormapLut:l},this.canRenderInWebGL=k(l?.indexedColormap),{success:!0}}_updateColormapRenderer(e){if(!C(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const r=e.colormapInfos.map(e=>[e.value].concat(e.color)).sort((e,r)=>e[0]-r[0]);if(!r||0===r.length)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const t=u({colormap:r});return this.lookup={rendererJSON:e,colormapLut:t},this.canRenderInWebGL=k(t?.indexedColormap),{success:!0}}_updateShadedReliefRenderer(e){if(!L(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(e.colorRamp){const r=x(e.colorRamp,{interpolateAlpha:!0}),t=u({colormap:r}),s=R(t.indexedColormap);this.lookup={rendererJSON:e,colormapLut:t,hsvMap:s}}else this.lookup={rendererJSON:e};return this.canRenderInWebGL=!0,{success:!0}}_analyzeClassBreaks(e){const{attributeTable:r,pixelType:t}=this.rasterInfo,s=r?.fields.find(e=>"value"===e.name.toLowerCase()),a=r?.fields.find(r=>r.name.toLowerCase()===e.field.toLowerCase()),o=null!=s&&null!==a;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(t)||o,tableValueField:s,tableBreakField:a}}_updateClassBreaksRenderer(e){const{attributeTable:r}=this.rasterInfo,{canUseIndexedLUT:t,tableValueField:s,tableBreakField:a}=this._analyzeClassBreaks(e),o=e.classBreakInfos;if(!o?.length)return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const n=o.sort((e,r)=>e.classMaxValue-r.classMaxValue),i=n[n.length-1];let l=e.minValue;if(!t){const r=[];for(let e=0;e<n.length;e++)r.push({value:n[e].classMinValue??l,mappedColor:n[e].symbol.color}),l=n[e].classMaxValue;return r.push({value:i.classMaxValue,mappedColor:i.symbol.color}),this.lookup={rendererJSON:e,remapLut:r},this.canRenderInWebGL=!1,{success:!0}}const c=[];if(null!=r&&null!=s&&null!==a&&s!==a){const t=s.name,o=a.name,i=n[n.length-1],{classMaxValue:u}=i;l=e.minValue;for(const e of r.features){const r=e.attributes[t],s=e.attributes[o],a=s===u?i:s<l?null:n.find(({classMaxValue:e})=>e>s);a&&c.push([r].concat(a.symbol.color))}}else{l=Math.floor(e.minValue);for(let e=0;e<n.length;e++){const r=n[e];for(let e=l;e<r.classMaxValue;e++)c.push([e].concat(r.symbol.color));l=Math.ceil(r.classMaxValue)}i.classMaxValue===l&&c.push([i.classMaxValue].concat(i.symbol.color))}const p=u({colormap:c,fillUnspecified:!1});return this.lookup={rendererJSON:e,colormapLut:p},this.canRenderInWebGL=k(p?.indexedColormap),{success:!0}}_updateStretchRenderer(e){let{stretchType:r,dra:t}=e;if(!("none"===r||e.statistics?.length||v(this.rasterInfo.statistics)||t))return{success:!1,error:"Unsupported renderer; StretchRenderer.customStatistics is required when dynamic range adjustment is not used."};const s=e.histograms||this.rasterInfo.histograms;!V(e.stretchType)||s?.length||t||(r="minMax");const{computeGamma:a,useGamma:o,colorRamp:n}=e;let{gamma:i}=e;if(o&&a&&!i?.length){const r=e.statistics?.length?e.statistics:this.rasterInfo.statistics;i=f(this.rasterInfo.pixelType,r)}const l=this.rasterInfo.pixelType,c=!t&&["u8","u16","s8","s16"].includes(l);if("histogramEqualization"===r){const r=s.map(e=>b(e));this.lookup={rendererJSON:e,histogramLut:r}}else if(c){const r=d(e,{rasterInfo:this.rasterInfo}),t=h({pixelType:l,...r,gamma:o?i:null,rounding:"floor"});this.lookup={rendererJSON:e,stretchLut:t}}else this.lookup={rendererJSON:e};if(n&&!O(n)){const r=x(n,{interpolateAlpha:!0});this.lookup.colormapLut=u({colormap:r}),this.lookup.rendererJSON=e}return this.lookup.gamma=o&&i?.length?i:null,this.canRenderInWebGL="histogramEqualization"!==r,{success:!0}}_generateColormapWebGLParams(e){const{indexedColormap:r,offset:t}=this.lookup.colormapLut||{};return{colormap:r,colormapOffset:t,isClassBreaks:e,type:"lut"}}_generateStretchWebGLParams(e,r,t){const{colormapLut:s}=this.lookup,a=r.colorRamp?s?.indexedColormap:null,o=r.colorRamp?s?.offset:null;"histogramEqualization"===r.stretchType&&(r={...r,stretchType:"minMax"});const{gamma:n}=this.lookup,i=!(!r.useGamma||!n?.some(e=>1!==e)),{minCutOff:l,maxCutOff:u,minOutput:c,maxOutput:p}=d(r,{rasterInfo:this.rasterInfo,pixelBlock:e,bandIds:t});let m=0;null!=e&&(m=e.getPlaneCount(),2===m&&((e=e.clone()).statistics=[e.statistics[0]],e.pixels=[e.pixels[0]]));const{bandCount:h}=this.rasterInfo,f=Math.min(3,t?.length||m||h,h),b=a||i?1:255,g=new Float32Array(f);if(i&&n)for(let d=0;d<f;d++)n[d]>1?n[d]>2?g[d]=6.5+(n[d]-2)**2.5:g[d]=6.5+100*(2-n[d])**4:g[d]=1;1===l.length&&(l[2]=l[1]=l[0]),1===u.length&&(u[2]=u[1]=u[0]);const y=i&&n?[n[0],n[1]??n[0],n[2]??n[0]]:[1,1,1],S=i?[g[0],g[1]??g[0],g[2]??g[0]]:[1,1,1],x=u.map((e,r)=>u[r]===l[r]?0:(p-c)/(u[r]-l[r])/b);return{bandCount:f,minOutput:c/b,maxOutput:p/b,minCutOff:l,maxCutOff:u,factor:x,useGamma:i,gamma:y,gammaCorrection:S,colormap:a,colormapOffset:o,stretchType:r.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(e,r=!1,t={x:0,y:0}){const{colormapLut:s}=this.lookup,a=e.colorRamp?s?.indexedColormap:null,o=e.colorRamp?s?.offset:null,n={...e,isGCS:r,resolution:t},i=S(n),l=this.rasterInfo.statistics?.[0];return{...i,minValue:l?.min??0,maxValue:l?.max??8e3,hillshadeType:"traditional"===e.hillshadeType?0:1,type:"hillshade",colormap:a,colormapOffset:o}}_generateVectorFieldWebGLParams(e){const{style:r,inputUnit:t,outputUnit:s,visualVariables:a,symbolTileSize:o,flowRepresentation:n}=e,i=this.rasterInfo.statistics?.[0].min??0,l=this.rasterInfo.statistics?.[0].max??50,u=a?.find(e=>"sizeInfo"===e.type)??{maxDataValue:l,maxSize:.8*o,minDataValue:i,minSize:.2*o},c=u.minDataValue??i,p=u.maxDataValue??l,d=null!=u.maxSize&&null!=u.minSize?[u.minSize/o,u.maxSize/o]:[.2,.8];if("wind_speed"===r){const e=(d[0]+d[1])/2;d[0]=d[1]=e}const m=null!=c&&null!=p?[c,p]:null;let h=null;if("classified_arrow"===r)if(null!=c&&null!=p&&null!=u){h=[];const e=(u.maxDataValue-u.minDataValue)/5;for(let r=0;r<6;r++)h.push(u.minDataValue+e*r)}else h=[0,1e-6,3.5,7,10.5,14];const f="flow_to"===n===("ocean_current_kn"===r||"ocean_current_m"===r)?0:Math.PI,b=a?.find(e=>"rotationInfo"===e.type);return{breakValues:h,dataRange:m,inputUnit:t,outputUnit:s,symbolTileSize:o,symbolPercentRange:d,style:r||"single_arrow",rotation:f,rotationType:this.rasterInfo.storageInfo?.tileInfo&&"vector-uv"===this.rasterInfo.dataType?"geographic":b?.rotationType||e.rotationType,type:"vectorField"}}};function V(e){return"percentClip"===e||"histogramEqualization"===e}function v(e){return null!=e&&e.length>0&&null!=e[0].min&&null!=e[0].max}function T(e){return c(e)&&0!==e.validPixelCount}function O(e){return"algorithmic"===e.type&&["0,0,0,255","0,0,0"].includes(e.fromColor.join(","))&&["255,255,255,255","255,255,255"].includes(e.toColor.join(","))}e([s({json:{write:!0}})],_.prototype,"rendererJSON",void 0),e([s({type:o,json:{write:!0}})],_.prototype,"rasterInfo",void 0),e([s({json:{write:!0}})],_.prototype,"lookup",void 0),e([s()],_.prototype,"canRenderInWebGL",void 0),_=e([a("esri.renderers.support.RasterSymbolizer")],_);export{_ as default};
|
package/support/basemapUtils.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../core/Collection.js";import{mappedFind as r}from"../core/maybe.js";import{Url as t,makeAbsolute as a,normalize as n}from"../core/urlUtils.js";import{effectEquals as l}from"../layers/effects/utils.js";import{esriBasemapDefinitions as i}from"./basemapDefinitions.js";function
|
|
5
|
+
import e from"../core/Collection.js";import{mappedFind as r}from"../core/maybe.js";import{Url as t,makeAbsolute as a,normalize as n}from"../core/urlUtils.js";import{effectEquals as l}from"../layers/effects/utils.js";import{esriBasemapDefinitions as i}from"./basemapDefinitions.js";function s(e){return"Web Scene"===e.portalItem?.type||e.referenceLayers.some(e=>"scene"===e.type)}function u(e){return!!e?.portalItem?.tags?.some(e=>"beta"===e.toLowerCase())}function c(e,r){const t=e.allLayerViews.find(e=>e.uid===r);return t?.layer.parent===e.map?.basemap}let o;function f(e){if(o)return o(e);let r=null;const t=v(e),a=!t?.baseLayers.length;for(const n in i){const e=w(t,R(i[n]),{mustMatchReferences:a});if("equal"===e){r=n;break}"base-layers-equal"===e&&(r=n)}return r}function y(e){o=e}function p(e,r){if(e===r)return!0;if(null!=e?.portalItem?.id&&e.portalItem.id===r?.portalItem?.id)return!0;return"equal"===w(v(e),v(r),{mustMatchReferences:!0})}function m(e){return!!e?.baseLayers.concat(e.referenceLayers).some(b)}function b(e){if(S(e.url))return!0;if("vector-tile"===e.type)for(const r in e.sourceNameToSource){const t=e.sourceNameToSource[r];if(S(t?.sourceUrl))return!0}return!1}function d(e,r){if(null==r||null==e)return{spatialReference:null,updating:!1};if("not-loaded"===r.loadStatus)return r.load(),{spatialReference:null,updating:!0};if(r.spatialReference)return{spatialReference:r.spatialReference,updating:!1};if(0===r.baseLayers.length)return{spatialReference:null,updating:!1};const t=r.baseLayers.at(0);switch(t.loadStatus){case"not-loaded":t.load();case"loading":return{spatialReference:null,updating:!0};case"failed":return{spatialReference:null,updating:!1}}const a=(("supportedSpatialReferences"in t?t.supportedSpatialReferences:null)||["tileInfo"in t?t.tileInfo?.spatialReference:t.spatialReference]).filter(Boolean),n=e.spatialReference;return n?{spatialReference:a.find(e=>n.equals(e))??a[0]??null,updating:!1}:{spatialReference:a[0],updating:!1}}const L=/^(basemaps|ibasemaps).*-api\.arcgis\.com$/i;function S(e){if(!e)return!1;const r=new t(a(e));return!!r.authority&&L.test(r.authority)}function v(e){return e?!e.loaded&&e.resourceInfo?R(e.resourceInfo.data):{baseLayers:g(e.baseLayers),referenceLayers:g(e.referenceLayers),groundLayers:g(e.groundLayers)}:null}function g(r){return(e.isCollection(r)?r.toArray():r).map(I)}function I(e){return{type:e.type,effect:"effect"in e?e.effect:void 0,url:M("urlTemplate"in e&&e.urlTemplate||e.url||"styleUrl"in e&&e.styleUrl||""),minScale:"minScale"in e&&null!=e.minScale?e.minScale:0,maxScale:"maxScale"in e&&null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visible||!!e.visible,sublayers:"map-image"!==e.type&&"wms"!==e.type||null==e.sublayers?void 0:e.sublayers?.map(e=>({id:e.id,visible:e.visible})),activeLayerId:"wmts"===e.type?e.activeLayer?.id:void 0}}function h(e){return e.isReference||"ArcGISSceneServiceLayer"===e.layerType}function R(e){return e?{baseLayers:T((e.baseMapLayers??[]).filter(e=>!h(e))),referenceLayers:T((e.baseMapLayers??[]).filter(e=>h(e))),groundLayers:T(e.groundLayers??[])}:null}function T(e){return e.map(e=>q(e))}function q(e){let r;switch(e.layerType){case"VectorTileLayer":r="vector-tile";break;case"ArcGISTiledMapServiceLayer":r="tile";break;case"ArcGISSceneServiceLayer":r="scene";break;case"IntegratedMesh3DTilesLayer":r="IntegratedMesh3DTilesLayer";break;default:r="unknown"}return{type:r,effect:e.effect,url:M(e.templateUrl||e.urlTemplate||e.styleUrl||e.url),minScale:e.minScale??0,maxScale:e.maxScale??0,opacity:e.opacity??1,visible:null==e.visibility||!!e.visibility,sublayers:void 0,activeLayerId:void 0}}function w(e,r,t){if(null!=e!=(null!=r))return"not-equal";if(!e||!r)return"equal";if(!x(e.baseLayers,r.baseLayers))return"not-equal";return x(e.referenceLayers,r.referenceLayers)?"equal":t.mustMatchReferences?"not-equal":"base-layers-equal"}function x(e,r){if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(!U(e[t],r[t]))return!1;return!0}function U(e,r){if(e.type!==r.type||e.url!==r.url||e.minScale!==r.minScale||e.maxScale!==r.maxScale||e.visible!==r.visible||e.opacity!==r.opacity)return!1;if(!l(e.effect,r.effect))return!1;if(null!=e.activeLayerId||null!=r.activeLayerId)return e.activeLayerId===r.activeLayerId;if(null!=e.sublayers||null!=r.sublayers){if(null==e.sublayers||null==r.sublayers||e.sublayers.length!==r.sublayers.length)return!1;for(let t=0;t<e.sublayers.length;t++){const a=e.sublayers.at(t),n=r.sublayers.at(t);if(a?.id!==n?.id||a?.visible!==n?.visible)return!1}}return!0}function M(e){return e?n(e).replace(/^\s*https?:/i,"").toLowerCase():""}function k(e){if(!e)return null;const{thumbnailUrl:t}=e;if(t)return t;const a=f(e);return a?i[a].thumbnailUrl:r(e.baseLayers,j)}function j(e){return"portalItem"in e?e.portalItem?.thumbnailUrl:void 0}export{p as contentEquals,d as findSpatialReference,k as getBasemapThumbnailUrl,f as getWellKnownBasemapId,m as hasDeveloperBasemapLayer,s as isBasemap3D,u as isBasemapInBeta,c as isBasemapLayerView,b as isDeveloperBasemapLayer,U as layerDefinitionEquals,I as layerToDefinition,y as overrideGetWellKnownBasemapId};
|
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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const d="20250814",e="1db6a2e00fb3d6fcda7c9c0d497b5a2deeaf6fe0";export{d as buildDate,e 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{assertIsSome as s}from"../../../../core/maybe.js";import{debounce as r,isAbortError as a}from"../../../../core/promiseUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as n}from"../../../../core/support/UpdatingHandles.js";import h from"../../../../geometry/Extent.js";import c from"../../../../geometry/Point.js";import u from"../../../../layers/support/PixelBlock.js";import d from"../../../../layers/support/TileInfo.js";import{update as p,unregister as m,getRasterId as y,register as g}from"../../../../layers/support/rasterDatasets/RawBlockCache.js";import{getWorldWidth as _,computeProjectedScales as f}from"../../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import b from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import w from"../../tiling/TileQueue.js";import P from"../../tiling/TileStrategy.js";import{tileSize as I}from"../../engine/webgl/definitions.js";import{TaskPriority as S}from"../../../support/Scheduler.js";import{getWebGLCapabilities as R}from"../../../webgl/capabilities.js";const C=[0,0];let U=class extends t{constructor(){super(...arguments),this._updatingHandles=new n,this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=[],this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._maxIndexedColormapSize=0,this._rasterFunctionState="na",this._globalUpdateRequested=!1,this.attached=!1,this.timeExtent=null,this.redrawOrRefetch=r(async(e={})=>{const t=this._rasterFunctionState,i=e.reprocess||"gpu"===t&&!this.canUseWebGLForProcessing||"cpu"===t&&this.canUseWebGLForProcessing;if(i&&(await this._updatingHandles.addPromise(this.layer.updateRasterFunction()),this.updateRasterFunctionParameters()),!this.previousLOD||this.layerView.suspended)return;const s=this._rasterFunctionState,{type:r}=this;return e.refetch||"raster"!==r&&!!i||"cpu"===s||"cpu"===t?this._updatingHandles.addPromise(this.doRefresh()):this._updatingHandles.addPromise(this._redrawImage(e.signal))})}destroy(){this._updatingHandles.destroy()}get canUseWebGLForProcessing(){return!1}get canUseLocalSymbolizerParams(){return(this.canUseWebGLForProcessing||"rasterVF"===this.type)&&!this.layerView.hasTilingEffects}get useWebGLForProcessing(){return this._get("useWebGLForProcessing")??!0}set useWebGLForProcessing(e){this._set("useWebGLForProcessing",e)}get useProgressiveUpdate(){return this._get("useProgressiveUpdate")??!0}set useProgressiveUpdate(e){if(this._tileStrategy&&this.useProgressiveUpdate!==e){this._tileStrategy.destroy(),this.container.removeAllChildren();const t=this._getCacheSize(e);this._tileStrategy=new P({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._set("useProgressiveUpdate",e),this.layerView.requestUpdate()}}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume();const{extent:t,resolution:i,scale:s}=e.state,r=this._tileInfoView.getClosestInfoForScale(s);if(this.layer.raster){if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){const e=this._srcResolutions[r.level],s="toJSON"in t?t:h.fromJSON(t);p(this._blockCacheRegistryUrl,this._blockCacheRegistryId,s,i,e,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,this.previousLOD?.level!==r.level&&(this.previousLOD=r,null!=this._symbolizerParams&&this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._tileStrategy.updateCacheSize(0))}}moveEnd(){!this.layerView.hasTilingEffects&&this.useProgressiveUpdate||(this._abortController&&this._abortController.abort(),this._abortController=new AbortController,0===this._fetchQueue.length&&this._redrawImage(this._abortController.signal).then(()=>{this._globalUpdateRequested=!1,this.layerView.requestUpdate()}));const e=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy.updateCacheSize(e),this.layerView.requestUpdate()}get updating(){return this._globalUpdateRequested||this._updatingHandles?.updating}attach(){const e=R();this._maxIndexedColormapSize=4*(e.maxTextureSize||4096),this._initializeTileInfo(),this._tileInfoView=new b(this.layerView.tileInfo,this.layerView.fullExtent);const t=this._computeFetchConcurrency();this._fetchQueue=new w({tileInfoView:this._tileInfoView,concurrency:t,process:(e,t)=>this._fetchTile(e,t),priority:S.MAPVIEW_FETCH_QUEUE,scheduler:this.scheduler});const i=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new P({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:i,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}detach(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,m(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryUrl=this._blockCacheRegistryId=null}acquireTile(e){const t=this.container.createTile(e);return this._updatingHandles.addPromise(this._enqueueTileFetch(t)),this.layerView.requestUpdate(),this._needBlockCacheUpdate=!0,this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,t}releaseTile(e){this._fetchQueue.abort(e.key.id),this.container.removeChild(e),e.once("detach",()=>{e.destroy(),this.layerView.requestUpdate()}),this.layerView.requestUpdate()}createEmptyTilePixelBlock(e=null){const t=null==e||e.join(",")===this._tileInfoView.tileInfo.size.join(",");if(t&&null!=this._emptyTilePixelBlock)return this._emptyTilePixelBlock;e=e||this._tileInfoView.tileInfo.size;const[i,s]=e,r=new u({width:i,height:s,pixels:[new Uint8Array(i*s)],mask:new Uint8Array(i*s),pixelType:"u8"});return t&&(this._emptyTilePixelBlock=r),r}_getBandIds(){if(!("rasterFunctionChain"in this.container)||!this.container.rasterFunctionChain)return this.layer.bandIds;const{bandIds:e,raster:t}=this.layer,i="rasterFunction"in t?t.rasterFunction.rawInputBandIds:null;return e?.length&&i?.length&&1!==t.rasterInfo.bandCount?e.map(e=>i[Math.min(e,i.length-1)]):"rasterFunction"in t?i:e}updateRasterFunctionParameters(){}_fetchTile(e,t){const i=this._getFetchOptions(e.level,t.signal);return this.fetchTile(e,i)}_getFetchOptions(e,t){const{canUseWebGLForProcessing:i}=this,{layerView:s}=this,{tileInfo:r}=s,a=!r.isWrappable&&null!=_(s.view.spatialReference),o=i&&this.layer.raster.hasUniqueSourceStorageInfo,{layer:l}=this.layerView,n=l.serviceRasterInfo?.storageInfo.isBsqTile?l.bandIds:void 0;return{allowPartialFill:!0,datumTransformation:s.datumTransformation,interpolation:i?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:o,skipRasterFunction:"raster"===this.type&&null!=this.container.rasterFunctionChain,signal:t,srcResolution:this._srcResolutions[e],timeExtent:s.timeExtent,tileInfo:r,bandIds:n,disableWrapAround:a}}_getCacheSize(e){return e?40:0}_initializeTileInfo(){const{layerView:e}=this,t=e.view.spatialReference;if(this._canUseLayerLODs()){const{origin:i,lods:s}=this.layer.tileInfo,r=s.map(({scale:e})=>e),a=d.create({spatialReference:t,size:I,scales:r,origin:i});return e.set("tileInfo",a),void(this._srcResolutions=s.map(({resolution:e})=>({x:e,y:e})))}const{scales:i,srcResolutions:r,isCustomTilingScheme:a}=f(this.layer.serviceRasterInfo,t,{tileSize:I,alignGlobalDatasetWithAGOL:!0,limitToSrcResolution:!1}),o=d.create({spatialReference:t,size:I,scales:i}),l=0===o.origin.x;s(e.fullExtent);const{xmin:n,ymax:h}=e.fullExtent;(l||a&&o.origin.x>n)&&(o.origin=new c({x:n,y:h,spatialReference:t})),this._isCustomTilingScheme=a,e.set("tileInfo",o),this._srcResolutions=r??[]}_canUseLayerLODs(){const{layer:e,layerView:t}=this;if("Map"!==e.raster.tileType)return!1;const{lods:i}=e.tileInfo,s=t.view.constraints?.effectiveLODs;return s?.length===i.length&&s.every(({scale:e},t)=>Math.abs(e-i[t].scale)<.001)}_computeFetchConcurrency(){const{blockBoundary:e}=this.layer.serviceRasterInfo.storageInfo,t=e[e.length-1];return(t.maxCol-t.minCol+1)*(t.maxRow-t.minRow+1)>64?2:10}async _enqueueTileFetch(e,t){if(!this._fetchQueue.has(e.key.id)){try{const t=await this._fetchQueue.push(e.key),r=this._getBandIds();let o=!this.useProgressiveUpdate||this.layerView.hasTilingEffects&&!this._globalSymbolizerParams;if(this._globalUpdateRequested&&!this.layerView.moving&&0===this._fetchQueue.length){o=!1;try{await this._redrawImage(this._abortController?.signal)}catch(s){a(s)&&i.getLogger(this).error(s)}this._globalUpdateRequested=!1}this.canUseLocalSymbolizerParams&&null==this._symbolizerParams&&this._updateSymbolizerParams();const l=this._tileInfoView.getTileCoords(C,e.key),n=this._tileInfoView.getTileResolution(e.key);await this.updateTileSource(e,{source:t,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:o,bandIds:r,coords:l,resolution:n}),e.once("attach",()=>this.layerView.requestUpdate()),this.container.addChild(e)}catch(s){a(s)||i.getLogger(this).error(s)}this.layerView.requestUpdate()}}async _redrawImage(e){if(0===this.container.children.length)return;await this.layer.updateRenderer(),this.layerView.hasTilingEffects?await this._updateGlobalSymbolizerParams(e):(this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._globalSymbolizerParams=null);const t=this.container.children.map(async e=>this.updateTileSymbolizerParameters(e,{local:this._symbolizerParams,global:this._globalSymbolizerParams}));await Promise.allSettled(t),this.container.requestRender()}async _updateGlobalSymbolizerParams(e){const t=this._getFetchOptions(this.previousLOD.level,e),i=await this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,{...t,interpolation:"nearest",requestRawData:!1,skipRasterFunction:!1});if(!i?.pixelBlock)return;const{resolution:s}=this.previousLOD,r=this._getBandIds(),a=this.layer.symbolizer.generateWebGLParameters({pixelBlock:i.pixelBlock.extractBands(r),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:s,y:s},bandIds:r});!this.canUseWebGLForProcessing&&a&&"stretch"===a.type&&this.layer.renderer&&"raster-stretch"===this.layer.renderer.type&&(a.factor=a.factor.map(e=>255*e),a.minOutput=Math.round(255*a.minOutput),a.maxOutput=Math.round(255*a.maxOutput)),this._globalSymbolizerParams=a}_updateSymbolizerParams(){const{resolution:e}=this.previousLOD,t=this._getBandIds();this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:e,y:e},bandIds:t})}_updateBlockCacheRegistry(e=!1){const{layer:t,layerView:i}=this,{raster:s}=t,{multidimensionalDefinition:r}=t.normalizeRasterFetchOptions({multidimensionalDefinition:t.multidimensionalDefinition,timeExtent:i.timeExtent}),a=s.rasterInfo.multidimensionalInfo?s.getSliceIndex(r):null,o=s.rasterInfo.storageInfo.isBsqTile&&t.bandIds?.length?t.bandIds:null,l=y(s.rasterId,a,o);if(l!==this._blockCacheRegistryUrl){if(null!=this._blockCacheRegistryUrl&&m(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=g(l,s.rasterInfo),e){const{view:e}=i,t=this._tileInfoView.getClosestInfoForScale(e.scale),r=this._srcResolutions[t.level];p(l,this._blockCacheRegistryId,e.extent,e.resolution,r,s.ioConfig.sampling)}this._blockCacheRegistryUrl=l}}async doRefresh(){if(!this.attached||!this.previousLOD||this.layerView.suspended)return;await this.layer.updateRenderer(),this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset();const e=[];this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,this._tileStrategy.refresh(t=>e.push(this._enqueueTileFetch(t))),await this._updatingHandles.addPromise(Promise.allSettled(e))}};e([o()],U.prototype,"_globalUpdateRequested",void 0),e([o()],U.prototype,"attached",void 0),e([o()],U.prototype,"canUseWebGLForProcessing",null),e([o()],U.prototype,"canUseLocalSymbolizerParams",null),e([o()],U.prototype,"container",void 0),e([o()],U.prototype,"layer",void 0),e([o()],U.prototype,"layerView",void 0),e([o()],U.prototype,"scheduler",void 0),e([o()],U.prototype,"type",void 0),e([o()],U.prototype,"useWebGLForProcessing",null),e([o()],U.prototype,"useProgressiveUpdate",null),e([o()],U.prototype,"timeExtent",void 0),e([o()],U.prototype,"updating",null),U=e([l("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],U);export{U as BaseImageryTileSubView2D};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{assertIsSome as s}from"../../../../core/maybe.js";import{debounce as r,isAbortError as a}from"../../../../core/promiseUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as n}from"../../../../core/support/UpdatingHandles.js";import h from"../../../../geometry/Extent.js";import c from"../../../../geometry/Point.js";import u from"../../../../layers/support/PixelBlock.js";import p from"../../../../layers/support/TileInfo.js";import{update as d,unregister as y,getRasterId as m,register as g}from"../../../../layers/support/rasterDatasets/RawBlockCache.js";import{getWorldWidth as _,computeProjectedScales as f}from"../../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import b from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import w from"../../tiling/TileQueue.js";import I from"../../tiling/TileStrategy.js";import{tileSize as P}from"../../engine/webgl/definitions.js";import{TaskPriority as S}from"../../../support/Scheduler.js";import{getWebGLCapabilities as R}from"../../../webgl/capabilities.js";const C=[0,0];let U=class extends t{constructor(){super(...arguments),this._updatingHandles=new n,this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=[],this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._maxIndexedColormapSize=0,this._rasterFunctionState="na",this._globalUpdateRequested=!1,this.attached=!1,this.timeExtent=null,this.redrawOrRefetch=r(async(e={})=>{const t=this._rasterFunctionState,i=e.reprocess||"gpu"===t&&!this.canUseWebGLForProcessing||"cpu"===t&&this.canUseWebGLForProcessing;if(i&&(await this._updatingHandles.addPromise(this.layer.updateRasterFunction()),this.updateRasterFunctionParameters()),!this.previousLOD||this.layerView.suspended)return;const s=this._rasterFunctionState,{type:r}=this;return e.refetch||"raster"!==r&&!!i||"cpu"===s||"cpu"===t?this._updatingHandles.addPromise(this.doRefresh()):this._updatingHandles.addPromise(this._redrawImage(e.signal))})}destroy(){this._updatingHandles.destroy()}get canUseWebGLForProcessing(){return!1}get canUseLocalSymbolizerParams(){return(this.canUseWebGLForProcessing||"rasterVF"===this.type)&&!this.layerView.hasTilingEffects}get useWebGLForProcessing(){return this._get("useWebGLForProcessing")??!0}set useWebGLForProcessing(e){this._set("useWebGLForProcessing",e)}get useProgressiveUpdate(){return this._get("useProgressiveUpdate")??!0}set useProgressiveUpdate(e){if(this._tileStrategy&&this.useProgressiveUpdate!==e){this._tileStrategy.destroy(),this.container.removeAllChildren();const t=this._getCacheSize(e);this._tileStrategy=new I({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._set("useProgressiveUpdate",e),this.layerView.requestUpdate()}}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume();const{extent:t,resolution:i,scale:s}=e.state,r=this._tileInfoView.getClosestInfoForScale(s);if(this.layer.raster){if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){const e=this._srcResolutions[r.level],s="toJSON"in t?t:h.fromJSON(t);d(this._blockCacheRegistryUrl,this._blockCacheRegistryId,s,i,e,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,this.previousLOD?.level!==r.level&&(this.previousLOD=r,null!=this._symbolizerParams&&this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._tileStrategy.updateCacheSize(0))}}moveEnd(){!this.layerView.hasTilingEffects&&this.useProgressiveUpdate||(this._abortController&&this._abortController.abort(),this._abortController=new AbortController,0===this._fetchQueue.length&&this._redrawImage(this._abortController.signal).then(()=>{this._globalUpdateRequested=!1,this.layerView.requestUpdate()}));const e=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy.updateCacheSize(e),this.layerView.requestUpdate()}get updating(){return this._globalUpdateRequested||this._updatingHandles?.updating}attach(){const e=R();this._maxIndexedColormapSize=4*(e.maxTextureSize||4096),this._initializeTileInfo(),this._tileInfoView=new b(this.layerView.tileInfo,this.layerView.fullExtent);const t=this._computeFetchConcurrency();this._fetchQueue=new w({tileInfoView:this._tileInfoView,concurrency:t,process:(e,t)=>this._fetchTile(e,t),priority:S.MAPVIEW_FETCH_QUEUE,scheduler:this.scheduler});const i=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new I({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:i,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}detach(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,y(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryUrl=this._blockCacheRegistryId=null}acquireTile(e){const t=this.container.createTile(e);return this._updatingHandles.addPromise(this._enqueueTileFetch(t)),this.layerView.requestUpdate(),this._needBlockCacheUpdate=!0,this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,t}releaseTile(e){this._fetchQueue.abort(e.key.id),this.container.removeChild(e),e.once("detach",()=>{e.destroy(),this.layerView.requestUpdate()}),this.layerView.requestUpdate()}createEmptyTilePixelBlock(e=null){const t=null==e||e.join(",")===this._tileInfoView.tileInfo.size.join(",");if(t&&null!=this._emptyTilePixelBlock)return this._emptyTilePixelBlock;e=e||this._tileInfoView.tileInfo.size;const[i,s]=e,r=new u({width:i,height:s,pixels:[new Uint8Array(i*s)],mask:new Uint8Array(i*s),pixelType:"u8"});return t&&(this._emptyTilePixelBlock=r),r}_getBandIds(){if(!("rasterFunctionChain"in this.container)||!this.container.rasterFunctionChain)return this.layer.bandIds;const{bandIds:e,raster:t}=this.layer,i="rasterFunction"in t?t.rasterFunction.rawInputBandIds:null;return e?.length&&i?.length&&1!==t.rasterInfo.bandCount?e.map(e=>i[Math.min(e,i.length-1)]):"rasterFunction"in t?i:e}updateRasterFunctionParameters(){}_fetchTile(e,t){const i=this._getFetchOptions(e.level,t.signal);return this.fetchTile(e,i)}_getFetchOptions(e,t){const{canUseWebGLForProcessing:i}=this,{layerView:s}=this,{tileInfo:r}=s,a=!r.isWrappable&&null!=_(s.view.spatialReference),o=i&&this.layer.raster.hasUniqueSourceStorageInfo,{layer:l}=this.layerView,n=l.serviceRasterInfo?.storageInfo.isBsqTile?l.getRawDisplayBandIds():void 0;return{allowPartialFill:!0,datumTransformation:s.datumTransformation,interpolation:i?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:o,skipRasterFunction:"raster"===this.type&&null!=this.container.rasterFunctionChain,signal:t,srcResolution:this._srcResolutions[e],timeExtent:s.timeExtent,tileInfo:r,bandIds:n,disableWrapAround:a}}_getCacheSize(e){return e?40:0}_initializeTileInfo(){const{layerView:e}=this,t=e.view.spatialReference;if(this._canUseLayerLODs()){const{origin:i,lods:s}=this.layer.tileInfo,r=s.map(({scale:e})=>e),a=p.create({spatialReference:t,size:P,scales:r,origin:i});return e.set("tileInfo",a),void(this._srcResolutions=s.map(({resolution:e})=>({x:e,y:e})))}const{scales:i,srcResolutions:r,isCustomTilingScheme:a}=f(this.layer.serviceRasterInfo,t,{tileSize:P,alignGlobalDatasetWithAGOL:!0,limitToSrcResolution:!1}),o=p.create({spatialReference:t,size:P,scales:i}),l=0===o.origin.x;s(e.fullExtent);const{xmin:n,ymax:h}=e.fullExtent;(l||a&&o.origin.x>n)&&(o.origin=new c({x:n,y:h,spatialReference:t})),this._isCustomTilingScheme=a,e.set("tileInfo",o),this._srcResolutions=r??[]}_canUseLayerLODs(){const{layer:e,layerView:t}=this;if("Map"!==e.raster.tileType)return!1;const{lods:i}=e.tileInfo,s=t.view.constraints?.effectiveLODs;return s?.length===i.length&&s.every(({scale:e},t)=>Math.abs(e-i[t].scale)<.001)}_computeFetchConcurrency(){const{blockBoundary:e}=this.layer.serviceRasterInfo.storageInfo,t=e[e.length-1];return(t.maxCol-t.minCol+1)*(t.maxRow-t.minRow+1)>64?2:10}async _enqueueTileFetch(e,t){if(!this._fetchQueue.has(e.key.id)){try{const t=await this._fetchQueue.push(e.key),r=this._getBandIds();let o=!this.useProgressiveUpdate||this.layerView.hasTilingEffects&&!this._globalSymbolizerParams;if(this._globalUpdateRequested&&!this.layerView.moving&&0===this._fetchQueue.length){o=!1;try{await this._redrawImage(this._abortController?.signal)}catch(s){a(s)&&i.getLogger(this).error(s)}this._globalUpdateRequested=!1}this.canUseLocalSymbolizerParams&&null==this._symbolizerParams&&this._updateSymbolizerParams();const l=this._tileInfoView.getTileCoords(C,e.key),n=this._tileInfoView.getTileResolution(e.key);await this.updateTileSource(e,{source:t,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:o,bandIds:r,coords:l,resolution:n}),e.once("attach",()=>this.layerView.requestUpdate()),this.container.addChild(e)}catch(s){a(s)||i.getLogger(this).error(s)}this.layerView.requestUpdate()}}async _redrawImage(e){if(0===this.container.children.length)return;await this.layer.updateRenderer(),this.layerView.hasTilingEffects?await this._updateGlobalSymbolizerParams(e):(this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._globalSymbolizerParams=null);const t=this.container.children.map(async e=>this.updateTileSymbolizerParameters(e,{local:this._symbolizerParams,global:this._globalSymbolizerParams}));await Promise.allSettled(t),this.container.requestRender()}async _updateGlobalSymbolizerParams(e){const t=this._getFetchOptions(this.previousLOD.level,e),i=await this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,{...t,interpolation:"nearest",requestRawData:!1,skipRasterFunction:!1});if(!i?.pixelBlock)return;const{resolution:s}=this.previousLOD,{isBsqTile:r}=this.layer.raster.rasterInfo.storageInfo,a=r?null:this._getBandIds(),o=this.layer.symbolizer.generateWebGLParameters({pixelBlock:i.pixelBlock.extractBands(a),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:s,y:s},bandIds:a});!this.canUseWebGLForProcessing&&o&&"stretch"===o.type&&this.layer.renderer&&"raster-stretch"===this.layer.renderer.type&&(o.factor=o.factor.map(e=>255*e),o.minOutput=Math.round(255*o.minOutput),o.maxOutput=Math.round(255*o.maxOutput)),this._globalSymbolizerParams=o}_updateSymbolizerParams(){const{resolution:e}=this.previousLOD,t=this._getBandIds();this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:e,y:e},bandIds:t})}_updateBlockCacheRegistry(e=!1){const{layer:t,layerView:i}=this,{raster:s}=t,{multidimensionalDefinition:r}=t.normalizeRasterFetchOptions({multidimensionalDefinition:t.multidimensionalDefinition,timeExtent:i.timeExtent}),a=s.rasterInfo.multidimensionalInfo?s.getSliceIndex(r):null,o=s.rasterInfo.storageInfo.isBsqTile?t.getRawDisplayBandIds():null,l=m(s.rasterId,a,o);if(l!==this._blockCacheRegistryUrl){if(null!=this._blockCacheRegistryUrl&&y(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=g(l,s.rasterInfo),e){const{view:e}=i,t=this._tileInfoView.getClosestInfoForScale(e.scale),r=this._srcResolutions[t.level];d(l,this._blockCacheRegistryId,e.extent,e.resolution,r,s.ioConfig.sampling)}this._blockCacheRegistryUrl=l}}async doRefresh(){if(!this.attached||!this.previousLOD||this.layerView.suspended)return;await this.layer.updateRenderer(),this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset();const e=[];this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,this._tileStrategy.refresh(t=>e.push(this._enqueueTileFetch(t))),await this._updatingHandles.addPromise(Promise.allSettled(e))}};e([o()],U.prototype,"_globalUpdateRequested",void 0),e([o()],U.prototype,"attached",void 0),e([o()],U.prototype,"canUseWebGLForProcessing",null),e([o()],U.prototype,"canUseLocalSymbolizerParams",null),e([o()],U.prototype,"container",void 0),e([o()],U.prototype,"layer",void 0),e([o()],U.prototype,"layerView",void 0),e([o()],U.prototype,"scheduler",void 0),e([o()],U.prototype,"type",void 0),e([o()],U.prototype,"useWebGLForProcessing",null),e([o()],U.prototype,"useProgressiveUpdate",null),e([o()],U.prototype,"timeExtent",void 0),e([o()],U.prototype,"updating",null),U=e([l("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],U);export{U as BaseImageryTileSubView2D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../Color.js";import has from"../../../../core/has.js";import{numberMaxFloat32 as r}from"../../../../core/mathUtils.js";import{property as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../Color.js";import has from"../../../../core/has.js";import{numberMaxFloat32 as r}from"../../../../core/mathUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{isFunctionRaster as o}from"../../../../layers/support/rasterDatasets/datasetUtils.js";import{getBytesPerPixel as n}from"../../../../layers/support/rasterFormats/pixelRangeUtils.js";import{convertGeometryToMask as a}from"../../../../layers/support/rasterFunctions/clipUtils.js";import{maxMapSizeGpu as l}from"../../../../layers/support/rasterFunctions/pixelUtils.js";import{RasterTileContainer as c}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as p}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as u}from"../support/util.js";import{defaultColor as h}from"../../../support/HighlightDefaults.js";import{getHighlightName as d}from"../../../support/highlightOptionsUtils.js";let m=class extends p{constructor(){super(...arguments),this.type="raster"}get canUseWebGLForProcessing(){const{loaded:e,symbolizer:t}=this.layer;if(!e||!t)return!1;const r=t.lookup.colormapLut?.indexedColormap,s=r&&r.length>this._maxIndexedColormapSize,i=n(this.layer.serviceRasterInfo);return!(has("ios")&&i>4)&&this.useWebGLForProcessing&&t.canRenderInWebGL&&!s&&!("majority"===this.layer.interpolation&&u(this.layer))}attach(){super.attach(),this.container=new c(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this.updateRasterFunctionParameters()}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}fetchTile(e,t){return this.layer.fetchTile(e.level,e.row,e.col,t)}updateRasterFunctionParameters(){const{raster:e,type:t}=this.layer,{container:r}=this;if("Function"!==e.datasetFormat||"wcs"===t)return r.rasterFunctionChain=null,r.children.forEach(e=>{const{bitmap:t}=e;t&&(t.suspended=!0,t.processed=!1,t.projected&&(t.invalidateTexture(),t.rasterTexture=null))}),void(this._rasterFunctionState="na");const s=this._rasterFunctionState,{rasterFunction:i,primaryRasters:o}=e,n=i.supportsGPU&&(!o||o.rasters.length<=1),a=n?i.flatWebGLFunctionChain:null,{renderer:l}=this.layer,c=!n||!a?.functions.length||"raster-stretch"===l?.type&&l.dynamicRangeAdjustment||!this.canUseWebGLForProcessing;r.rasterFunctionChain=c?null:this._addProjection(a);const p=null==i?"na":r.rasterFunctionChain?"gpu":"cpu",u=s===p||"na"===s&&"cpu"===p&&0===a?.functions?.length;r.children.forEach(e=>{const{bitmap:t}=e;t&&(t.suspended=!u,t.processed=!1,t.processedTexture=null)}),this._rasterFunctionState=p}async updateTileSource(e,t){const r=this._getBandIds(),s=this._getLayerInterpolation(),{canUseWebGLForProcessing:i}=this,{source:n,globalSymbolizerParams:l,suspended:c,coords:p,resolution:u}=t,h=this.layerView.hasTilingEffects?l:t.symbolizerParams,{bitmap:d}=e;if([d.x,d.y]=p,d.resolution=u,null!=n?.pixelBlock){const e={extent:n.extent,pixelBlock:n.pixelBlock,srcPixelSize:n.srcTilePixelSize};if(d.rawPixelData=e,i)d.source=n.pixelBlock,d.isRendereredSource=!1;else{const t=await this.layer.applyRenderer(e,"stretch"===l?.type?l:void 0);d.source=t,d.isRendereredSource=!0}d.symbolizerParameters=i?h:null,d.transformGrid=i?n.transformGrid:null}else{const e=this.createEmptyTilePixelBlock();d.source=e,d.symbolizerParameters=i?h:null,d.transformGrid=null}const{isBsqTile:m}=this.layer.raster.rasterInfo.storageInfo;d.bandIds=i&&!m?r:null,d.width=this._tileInfoView.tileInfo.size[0],d.height=this._tileInfoView.tileInfo.size[1],d.interpolation=s,d.suspended=c;const{raster:f}=this.layer;if(o(f)){const t=f.getClippingGeometry(this.layerView.view.spatialReference);if(t){const r=f.getTileExtentFromTileInfo(e.key.level,e.key.row,e.key.col,this._tileInfoView.tileInfo);d.mask=a({srcExtent:r,geometry:t,size:[d.width,d.height]})}}d.invalidateTexture()}async updateTileSymbolizerParameters(e,t){const{local:r,global:s}=t,i=this._getBandIds(),o=this._getLayerInterpolation(),{canUseWebGLForProcessing:n}=this,{bitmap:a}=e,{rawPixelData:l}=a;n||null==l?(a.isRendereredSource&&null!=l&&(a.source=l.pixelBlock),a.isRendereredSource=!1):(a.source=await this.layer.applyRenderer(l,"stretch"===s?.type?s:void 0),a.isRendereredSource=!0),a.symbolizerParameters=n?this.layerView.hasTilingEffects?s:r:null;const{isBsqTile:c}=this.layer.raster.rasterInfo.storageInfo;a.bandIds=n&&!c?i:null,a.interpolation=o,a.suspended=!1}updateHighlightOptions(e){if(!e.length)return void(this.container.pixelHighlights=void 0);const s=[],{highlights:i}=this.layerView.view;e.sort((e,t)=>i.findIndex(({name:e})=>e===d(t.options))-i.findIndex(({name:t})=>t===d(e.options)));for(const{target:o,options:n}of e){const{pixelRanges:e}=o,a=Array.from({length:2*l},()=>0);for(let t=0;t<e.length;t++)a[2*t]=e[t][0],a[2*t+1]=e[t][1];for(let t=e.length;t<l;t++)a[2*t]=r,a[2*t+1]=-r;const c=o.bandId??0,p=d(n),u=i.find(e=>e.name===p)?.color??h,m=t.toUnitRGBA(u);s.push({ranges:a,bandId:c,color:m})}this.container.pixelHighlights=s}_getLayerInterpolation(){const{interpolation:e,renderer:t}=this.layer;if(!t)return e;const r=t.type;return"raster-colormap"===r||"unique-value"===r?"nearest":"raster-stretch"===t.type&&null!=t.colorRamp?"bilinear"===e||"cubic"===e?"bilinear":"nearest":e}_addProjection(e){return e?.functions?.length&&!e.hasFocalFunction&&e.functions.unshift({name:"Reproject",parameters:{targetImageSize:this._tileInfoView.tileInfo.size,requireNNEdge:e.isSourceSingleBand},pixelType:"f32",id:0,isNoopProcess:!1}),e}};e([s()],m.prototype,"canUseWebGLForProcessing",null),e([s()],m.prototype,"container",void 0),e([s()],m.prototype,"layer",void 0),e([s()],m.prototype,"type",void 0),m=e([i("esri.views.2d.layers.imagery.ImageryTileView2D")],m);export{m 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{c as e,d as n,f as r,j as t,E as o}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrap as c}from"../../../../geometry/support/ray.js";import{i as s,
|
|
5
|
+
import{c as e,d as n,f as r,j as t,E as o}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrap as c}from"../../../../geometry/support/ray.js";import{i as s,j as a}from"../../../../chunks/sphere.js";import{defaultConstraintOptions as f,interactionDirectionTowardsConstraintMinimization as m,adjustRangeForInteraction as u}from"./common.js";function p(e,n,r=f){if(!e.state.isLocal)return 0;const t=e.state.constraints.distance;if(!e.pointsOfInterest.surfaceOrigin.renderLocation||t===1/0)return 0;x.min=0,x.max=t,y(e,r,x);const o=l(e,n),i=x.max-o;return i>=-1e-6?0:i}function d(t,o,i=f){const u=p(t,o,i);if(0===u)return!1;const d=t.pointsOfInterest.surfaceOrigin;if(!d.renderLocation)return!1;const y=l(t,o)+u,x=e(L,o.eye),C=m(o,i.interactionDirection,j(o,d.renderLocation,I),O);if(!s(a(d.renderLocation,y),c(o.eye,C),h))return!1;o.eye=h;const k=n(g,o.eye,x);o.center=r(h,o.center,k);const v=t.renderCoordsHelper.getAltitude(o.center),H=t.renderCoordsHelper.intersectInfiniteManifold(o.ray,v,h);return null!=H&&(o.center=H),!0}function y(e,n,r){const t=n.interactionType;if(0===t)return;const{min:o,max:i}=r,{interactionStartCamera:c,interactionFactor:s}=n;if(!c)return;const a=1===t||4===t,f=p(e,c),m=0===f?0:l(e,c);r.min=o,r.max=i;u(f,m,a,s,.05*m,r)}function l(e,n){const r=e.pointsOfInterest.surfaceOrigin;return r.renderLocation?t(n.eye,r.renderLocation):0}function j(e,n,r){return o(r,e.eye,n)}const x={min:0,max:0},L=i(),g=i(),O=i(),I=i(),h=i();export{d as applyDistanceConstraint,p as getDistanceConstraintError};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{neverReached as e}from"../../../../core/compilerUtils.js";import{acosClamped as t,clamp as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{fromRotation as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as c,t as o,g as u,f as l,k as m,j as d,e as f,n as h,l as p}from"../../../../chunks/vec32.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as y}from"../../../../geometry/ellipsoidUtils.js";import{
|
|
5
|
+
import{neverReached as e}from"../../../../core/compilerUtils.js";import{acosClamped as t,clamp as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{fromRotation as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as c,t as o,g as u,f as l,k as m,j as d,e as f,n as h,l as p}from"../../../../chunks/vec32.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as y}from"../../../../geometry/ellipsoidUtils.js";import{l as C,b as I,t as x}from"../../../../chunks/sphere.js";import{defaultConstraintOptions as S,hasConstraintType as v,adjustRangeForInteraction as w}from"./common.js";import{viewAngle as A}from"../../state/utils/viewUtils.js";function R(t,r,n,i=!0){Q.eyeCenterDistance=0,Q.requiresTwoSteps=!1;const s=T(t,r,n,S,Q);if(0===s)return!1;switch(a(z,-s,r.viewRight),n.tiltMode){case 1:o(L,r.viewForward,z),u(L,L,Q.eyeCenterDistance),r.center=l(B,r.eye,L);break;case 0:c(L,r.center,r.eye),o(L,L,z),r.eye=c(B,r.center,L);break;default:e(n.tiltMode)}return r.up=o(B,r.up,z),!Q.requiresTwoSteps||!i||R(t,r,n,!1)}function T(e,t,r,n=S,i){if(!e.state.constraints.tilt)return 0;const a=Math.min(t.relativeElevation*J,t.distance),s=e.state.constraints.tilt(a,K);return E(e,r,s),2===n.interactionType&&v(n.selection,2)&&U(e,n.interactionStartCamera,s),1===r.tiltMode||1===n.tiltMode?P(e,t,s,i):j(e,t,s)}function j(e,t,n){const i=A(e.renderCoordsHelper,t.center,t.eye),a=i-r(i,n.min,n.max);return q(a)?a:0}function P(e,t,r,n){switch(n&&(n.requiresTwoSteps=!1),e.viewingMode){case"global":return g(e,t,r,n);case"local":return b(e,t,r,n)}}function b(e,t,n,i){const a=A(e.renderCoordsHelper,t.center,t.eye),s=r(a,n.min,n.max),c=a-s;if(!q(c))return 0;if(i){const r=Math.abs(e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude),n=e.renderCoordsHelper.getAltitude(t.eye)-r,a=Math.max(Math.cos(s),1e-4);Math.abs(a)>1e-4?i.eyeCenterDistance=n/a:i.eyeCenterDistance=t.distance}return c}function g(e,t,n,i){const a=O(e,t,N),s=r(a.tiltAtCenter,n.min,n.max);if(!q(a.tiltAtCenter-s))return 0;let c,o;return a.centerIsOnSurface?(c=H(a),o=k(a,c)):(c=a.constraints.clampTilt(a.distance,a.tiltAtCenter),i&&c<Math.PI/2&&(i.requiresTwoSteps=!0,c=Math.PI/2-1e-5),o=F(a,c)),i&&(i.eyeCenterDistance=D(a,c)),o}function O(e,r,n){const i=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,a=i+y(e.spatialReference).radius,s=e.renderCoordsHelper.intersectManifold(r.ray,i,B);return n.distance=Math.min(r.relativeElevation*J,r.distance),n.centerIsOnSurface=!1,null!=s?(n.distance=Math.min(r.relativeElevation*J,d(r.eye,s)),n.tiltAtCenter=A(e.renderCoordsHelper,s,r.eye),n.centerIsOnSurface=!0):e.state.isLocal?n.tiltAtCenter=A(e.renderCoordsHelper,r.center,r.eye):(C(I(x,a),r.ray,B),n.distance=Math.min(r.relativeElevation*J,d(r.eye,B)),n.tiltAtCenter=t(-f(r.viewForward,h(B,B)))),n.radius=a,n.eyeRadius=p(r.eye),n.constraints=e.state.constraints,n}function q(e){return Math.abs(e)>1e-9}function H(e){const{constraints:t,distance:r,tiltAtCenter:n}=e;let i=n,a=t.clampTilt(r,n);const s=D(e,a);if(t.clampTilt(s,n)===a)return a;let c=0;for(;c<10&&q(a-i);){const r=(i+a)/2,n=D(e,r);q(t.clampTilt(n,r)-r)?i=r:a=r,c++}return a}function D(e,t){if(!e.centerIsOnSurface)return e.distance;const i=Math.PI-r(t,0,Math.PI),a=n(e.radius/e.eyeRadius*Math.sin(i)),s=Math.PI-i-a,c=Math.sin(s)/Math.sin(i);if(e.eyeRadius<e.radius&&c>1){const t=Math.PI-a,r=Math.PI-i-t;return Math.sin(r)/Math.sin(i)*e.eyeRadius}return c*e.eyeRadius}function k(e,t){const r=n(e.radius/e.eyeRadius*Math.sin(e.tiltAtCenter)),i=n(e.radius/e.eyeRadius*Math.sin(t));return e.eyeRadius>e.radius?r-i:i-r}function F(e,t){return e.tiltAtCenter-Math.PI/2-(t-Math.PI/2)}function E(e,t,r){if(0===t.interactionType)return;const{interactionStartCamera:n,interactionFactor:i}=t;if(!n)return;const{min:a,max:s}=r,c=T(e,n,S,t),o=0===c?0:A(e.renderCoordsHelper,n.center,n.eye);r.min=a,r.max=s,2===t.interactionType?(v(t.selection,2)&&U(e,n,r),w(c,o,!0,i,G,r)):w(c,o,!1,i,G,r)}function U(e,r,n){const i=e.state.constraints;if(e.state.isLocal||!i.altitude||!r)return;const a=m(r.center),s=Math.sqrt(a),c=r.distance,o=y(e.spatialReference).radius,u=i.altitude.min+o,l=i.altitude.max+o,d=(u*u-c*c-a)/(-2*s*c),f=(l*l-c*c-a)/(-2*s*c);n.min=Math.max(n.min,Math.min(Math.PI-t(f),n.max)),n.max=Math.min(n.max,Math.PI-t(d))}const L=M(),z=s(),B=M(),G=i(5),J=30,K={min:0,max:0},N={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,distance:0,tiltAtCenter:0},Q={eyeCenterDistance:0,requiresTwoSteps:!1};export{R as applyTiltConstraint,T as getTiltConstraintError};
|