@arcgis/core 4.23.0-next.20220131 → 4.23.0-next.20220202
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/Graphic.js +1 -1
- package/TimeExtent.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/01a10fe5ad6941b0ee8c.js +1 -0
- package/assets/esri/core/workers/chunks/{7a5f5acfbd4ca1a5c1f3.js → 06116433eb6e669f146b.js} +1 -1
- package/assets/esri/core/workers/chunks/09a05d778b6fac710828.js +1 -0
- package/assets/esri/core/workers/chunks/{83d00afae4406ec78bc9.js → 0c6be307709523eb8a05.js} +1 -1
- package/assets/esri/core/workers/chunks/0e215fa28a0448169132.js +1 -0
- package/assets/esri/core/workers/chunks/{391e96192d1ec4e55ce2.js → 101b4f02f0572afb666f.js} +1 -1
- package/assets/esri/core/workers/chunks/11750e96065b4d7b926b.js +1 -0
- package/assets/esri/core/workers/chunks/{929c9b7cdab7c4ca3d87.js → 17c51f5a13f471e6656a.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed0bcc66fb1e0ee75a4b.js → 1f34957ef42e5b5977d0.js} +1 -1
- package/assets/esri/core/workers/chunks/2f4e425be3a3bdfd8d29.js +1 -0
- package/assets/esri/core/workers/chunks/34bed896b68993cabaa1.js +1 -0
- package/assets/esri/core/workers/chunks/3e1679b01429fd73cffe.js +1 -0
- package/assets/esri/core/workers/chunks/{99619fcb772807c74f3b.js → 444829a840b8ded16fd7.js} +1 -1
- package/assets/esri/core/workers/chunks/467b5faa1c90d9821609.js +1 -0
- package/assets/esri/core/workers/chunks/49353182a16218a84251.js +1 -0
- package/assets/esri/core/workers/chunks/4bfc2eeb0738c393d8ec.js +1 -0
- package/assets/esri/core/workers/chunks/4de996ebc432f5e149bc.js +1 -0
- package/assets/esri/core/workers/chunks/{422537fc3df707bb62c9.js → 5038935db9b1ebe61d02.js} +1 -1
- package/assets/esri/core/workers/chunks/50976921acf7bd636123.js +1 -0
- package/assets/esri/core/workers/chunks/50ef2622fd0d9a241979.js +1 -0
- package/assets/esri/core/workers/chunks/{5790d171072b3c7d108f.js → 53aa2ab4e569c994a32d.js} +1 -1
- package/assets/esri/core/workers/chunks/{db3c729ce0c0b2690dc9.js → 574e33f28c106d607fe3.js} +1 -1
- package/assets/esri/core/workers/chunks/{952980635afc7ec81804.js → 5b02ba8ed152dba53155.js} +1 -1
- package/assets/esri/core/workers/chunks/60c06d1bb3f8a26cb5ac.js +1 -0
- package/assets/esri/core/workers/chunks/{c2253a9f29c1aabb2b75.js → 66c47983e93071de28b1.js} +1 -1
- package/assets/esri/core/workers/chunks/6be326edd9829781d926.js +1 -0
- package/assets/esri/core/workers/chunks/{5bcb3240b3c005e5fe72.js → 7215af7810d15e89aa5a.js} +1 -1
- package/assets/esri/core/workers/chunks/7509c1693ffedc0fa018.js +1 -0
- package/assets/esri/core/workers/chunks/76c1d663f6d3f935c87f.js +1 -0
- package/assets/esri/core/workers/chunks/7ccbb923f113b3e21545.js +1 -0
- package/assets/esri/core/workers/chunks/82194fec53054c37061f.js +1 -0
- package/assets/esri/core/workers/chunks/82c59a71b7f087148089.js +1 -0
- package/assets/esri/core/workers/chunks/84eee02122b56a22d49e.js +1 -0
- package/assets/esri/core/workers/chunks/{dd13772a5e2eccc6a2bc.js → 8598f762f15ca68d52b7.js} +1 -1
- package/assets/esri/core/workers/chunks/{fc046a15466c25d081ff.js → 88458dcaff8edc50620c.js} +1 -1
- package/assets/esri/core/workers/chunks/{5ec98f4ddac707d0fbd1.js → 88815d533808aabb1fa9.js} +1 -1
- package/assets/esri/core/workers/chunks/{0463ba46df855a92b9c0.js → 8941f09329d9d39fb2fe.js} +1 -1
- package/assets/esri/core/workers/chunks/{655b55ac0cd533d7e9d7.js → 8ad5dc818dc73f4b9a76.js} +1 -1
- package/assets/esri/core/workers/chunks/8e96cddb069b643d864a.js +1 -0
- package/assets/esri/core/workers/chunks/{f2124f4d0f2b8a91f0ea.js → 90c5edcd8a609224ce55.js} +1 -1
- package/assets/esri/core/workers/chunks/9230b20eba4304d421b4.js +1 -0
- package/assets/esri/core/workers/chunks/{bac9fc90e6756e211160.js → 94d9951509c0db09547a.js} +1 -1
- package/assets/esri/core/workers/chunks/996d6ae7f2e2273f9bce.js +1 -0
- package/assets/esri/core/workers/chunks/{37c03cfc19086ce631c6.js → 9bd603ec98d24cd918e9.js} +1 -1
- package/assets/esri/core/workers/chunks/{c1135cb02ec46c491459.js → 9ce961bc390202c87941.js} +1 -1
- package/assets/esri/core/workers/chunks/9d4a35d4a85db80c4071.js +1 -0
- package/assets/esri/core/workers/chunks/9f0ad28e66862ba971a3.js +1 -0
- package/assets/esri/core/workers/chunks/{b3f5e91116112b0b612a.js → 9fd47b8fe25657ac0237.js} +1 -1
- package/assets/esri/core/workers/chunks/{b9e9cb354822c6d995a4.js → a276e60209f3d877a8d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{aeaa1667c2d9f1b3366b.js → a85ed251d3d3668e474f.js} +1 -1
- package/assets/esri/core/workers/chunks/{44f0c3663b293afbd172.js → acf10f747215e9ff54dc.js} +1 -1
- package/assets/esri/core/workers/chunks/{69fd99b7c76e9992ccf3.js → b32bf9808cb4be3a6bd0.js} +1 -1
- package/assets/esri/core/workers/chunks/b3dc80ddbfa81026e937.js +1 -0
- package/assets/esri/core/workers/chunks/b548e6b3add4154ac4e6.js +1 -0
- package/assets/esri/core/workers/chunks/b6c55bdd8c957b062bc1.js +1 -0
- package/assets/esri/core/workers/chunks/{1f8c6a179e39fd4c5e6f.js → bd152e8b43cc4a6844dd.js} +1 -1
- package/assets/esri/core/workers/chunks/{0d02c6ad1f4688bfa374.js → bf7c44644fe7b0aa60cf.js} +1 -1
- package/assets/esri/core/workers/chunks/c0dc5882362479794224.js +1 -0
- package/assets/esri/core/workers/chunks/c8b574a76807f4ea7a70.js +1 -0
- package/assets/esri/core/workers/chunks/d09a0b2dc3a6fc10fa41.js +1 -0
- package/assets/esri/core/workers/chunks/{ec10151a2a95e95a0bb5.js → d304fe0ac836afd46e3d.js} +1 -1
- package/assets/esri/core/workers/chunks/{37a7bd30352b1309b8f8.js → d3f05b8e4bd53eb1eb9d.js} +1 -1
- package/assets/esri/core/workers/chunks/{be588873c16770ceb9ef.js → d46b511bbb83e68f1ece.js} +1 -1
- package/assets/esri/core/workers/chunks/{17de7a324dfa7f57ad5d.js → d780e946149b1c3d1246.js} +1 -1
- package/assets/esri/core/workers/chunks/d80bcf5ed1f54e0c4f5a.js +1 -0
- package/assets/esri/core/workers/chunks/{8cbb04a9065aa3756638.js → dc04a8ba6c770bdc2bd4.js} +1 -1
- package/assets/esri/core/workers/chunks/{89820b200ee44e678af5.js → dd891a98105904f8a06b.js} +1 -1
- package/assets/esri/core/workers/chunks/e5ab037c2a90411c453b.js +1 -0
- package/assets/esri/core/workers/chunks/ef2df21e1af3aa7ced29.js +1 -0
- package/assets/esri/core/workers/chunks/f5a7281ae24e837efc61.js +1 -0
- package/assets/esri/core/workers/chunks/{2c607d30ff8ca1b61286.js → fe0c3b7c9b428d9c3f25.js} +1 -1
- package/chunks/Heatmap.glsl.js +10 -0
- package/chunks/HeatmapDensity.glsl.js +21 -0
- package/core/maybe.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/interfaces.d.ts +6 -0
- package/layers/graphics/data/optimizedFeatureQueryEngineAdapter.js +1 -1
- package/layers/graphics/featureConversionUtils.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
- package/package.json +1 -1
- package/renderers/support/rendererConversion.js +1 -1
- package/rest/support/FeatureSet.js +1 -1
- package/support/featureFlags.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/TextSymbol3DLayer.js +1 -1
- package/symbols/support/Symbol3DHalo.js +1 -1
- package/symbols/support/Symbol3DTextBackground.js +5 -0
- package/views/2d/engine/RasterVFContainer.js +5 -0
- package/views/2d/engine/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/flow/AnimatedFlowView2D.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/brushes/raster/BrushVectorField.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLBaseTextTemplate.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/features/processors/HeatmapProcessor.js +1 -1
- package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/ClusterStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryVFStrategy.js +5 -0
- package/views/2d/layers/imagery/ImageryView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldView2D.js +5 -0
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/SimpleAtmosphere.js +1 -1
- package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/labelPlacement.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +5 -0
- package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +5 -0
- package/views/3d/webgl-engine/shaders/Heatmap.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +5 -0
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/support/HighlightHelper.js +5 -0
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/layerUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/support/vnodeCache.js +5 -0
- package/widgets/support/widgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0453fad5cb819797b4f6.js +0 -1
- package/assets/esri/core/workers/chunks/0c15d77d8e817cf45a9a.js +0 -1
- package/assets/esri/core/workers/chunks/0cd0a6eef51fc5b9ea61.js +0 -1
- package/assets/esri/core/workers/chunks/0d684f16f37d5dc385dd.js +0 -1
- package/assets/esri/core/workers/chunks/16b6d0f8378582c051c3.js +0 -1
- package/assets/esri/core/workers/chunks/1877ab1b6a115dbba1c5.js +0 -1
- package/assets/esri/core/workers/chunks/1b2a961f776a0b57e57a.js +0 -1
- package/assets/esri/core/workers/chunks/1b3fd66577b19aa5f2b6.js +0 -1
- package/assets/esri/core/workers/chunks/1c733b7db092a2a88ef3.js +0 -1
- package/assets/esri/core/workers/chunks/27474b007988855bea9d.js +0 -1
- package/assets/esri/core/workers/chunks/2b25fc7945a187c2bb9d.js +0 -1
- package/assets/esri/core/workers/chunks/483d5d8593d96d0f0b15.js +0 -1
- package/assets/esri/core/workers/chunks/4ba6de8aa7e2960bad49.js +0 -1
- package/assets/esri/core/workers/chunks/4be35af7d6babbfe9d84.js +0 -1
- package/assets/esri/core/workers/chunks/5457962a70bd3c557a75.js +0 -1
- package/assets/esri/core/workers/chunks/57856b4a9b8784a69844.js +0 -1
- package/assets/esri/core/workers/chunks/57b349d1dbc0bed75b79.js +0 -1
- package/assets/esri/core/workers/chunks/5d11b97b667921d67ae7.js +0 -1
- package/assets/esri/core/workers/chunks/5dbe555a5a662ff3d9ce.js +0 -1
- package/assets/esri/core/workers/chunks/64b7e8d812ea8fcf269e.js +0 -1
- package/assets/esri/core/workers/chunks/75d812955a473d0e8960.js +0 -1
- package/assets/esri/core/workers/chunks/96f148a556a2418038de.js +0 -1
- package/assets/esri/core/workers/chunks/9876a1bae350795fab36.js +0 -1
- package/assets/esri/core/workers/chunks/a8692bffb76444c34760.js +0 -1
- package/assets/esri/core/workers/chunks/ba762bcfd74af0bb8218.js +0 -1
- package/assets/esri/core/workers/chunks/c984b3040e120e502b11.js +0 -1
- package/assets/esri/core/workers/chunks/cdbc005eebec1503b99d.js +0 -1
- package/assets/esri/core/workers/chunks/d1fe53b597351dc58305.js +0 -1
- package/assets/esri/core/workers/chunks/d98dab12b71912fa397b.js +0 -1
- package/assets/esri/core/workers/chunks/e218bde41ffbcc5194f5.js +0 -1
- package/assets/esri/core/workers/chunks/e287f49184d076af17e2.js +0 -1
- package/assets/esri/core/workers/chunks/e9e5196b44b6923be1a3.js +0 -1
- package/assets/esri/core/workers/chunks/ea595b0df5050eda2a13.js +0 -1
- package/assets/esri/core/workers/chunks/eb82ff10cef2bde6e57f.js +0 -1
- package/assets/esri/core/workers/chunks/ee6e0db58dc64410e687.js +0 -1
- package/assets/esri/core/workers/chunks/f0a9f161805fc7a30fc5.js +0 -1
- package/views/2d/layers/imagery/ImageryGraphicsView2D.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{applySome as e,isNone as t,isSome as i,unwrap as r}from"../../../../../../core/maybe.js";import{pt2px as s}from"../../../../../../core/screenUtils.js";import{deltaDecodeGeometry as o,convertFromGeometry as n}from"../../../../../../layers/graphics/featureConversionUtils.js";import{CIMMarkerPlacementHelper as h}from"../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{MAGIC_LABEL_LINE_HEIGHT as a}from"../../definitions.js";import{WGLGeometryType as x}from"../../enums.js";import{i8888to32 as l,i1616to32 as m}from"../../number.js";import{MaterialKeyBase as d}from"../../materialKey/MaterialKey.js";import{shapeGlyphs as c}from"./shapingUtils.js";const f=8,_=_=>class extends _{constructor(...e){super(...e),this._isCIM=!1,this._vertexBoundsScale=1,this.geometryType=x.TEXT,this._aux=l(0,0,this._referenceSize,this._bitset)}bindTextInfo(t,i){t&&t.length?this._shapingInfo=e(t,(e=>c(e,i,{scale:this._scale,angle:this._angle,xOffset:this._xOffset,yOffset:this._yOffset,hAlign:this._xAlignD,vAlign:this._yAlignD,maxLineWidth:Math.max(32,Math.min(this._lineWidth,512)),lineHeight:a*Math.max(.25,Math.min(this._lineHeight,4)),decoration:this._decoration,isCIM:this._isCIM}))):this._shapingInfo=null}_write(e,t,i,r){const s=t.getDisplayId();this._writeGeometry(e,t,s,i,r)}_writeGeometry(e,r,s,h,a){const x=this._shapingInfo;if(t(x))return;if(i(this._textPlacement)){const t=null!=a?a:r.readLegacyGeometryForDisplay();return this._writePlacedText(e,s,t,x,h)}const l=a?o(n(a),2):"esriGeometryPolygon"===r.geometryType?r.readCentroid():r.readGeometryForDisplay();if(!t(l)){if(l.isPoint){const[t,i]=l.coords;if(!e.hasAggregates&&e.hasPixelBufferEnabled&&(t<0||t>=512||i<0||i>=512))return;return this._writeGlyphs(e,s,{x:t,y:i},x)}l.forEachVertex(((t,i)=>this._writeGlyphs(e,s,{x:t,y:i},x)))}}_writePlacedText(e,t,i,o,n){const a=r(this._textPlacement),x=h.getPlacement(i,a,s(1),n.geometryEngine);if(!x)return;let l=x.next();for(;null!=l;){const i=l.getAngle();o.setRotation(i);const r=l.tx,s=l.ty;r<0||r>=512||s<0||s>=512?l=x.next():(this._writeGlyphs(e,t,{x:r,y:s},o),o.setRotation(-i),l=x.next())}}_writeGlyphs(e,t,i,r){const s=d.load(this._materialKey),o=m(Math.round(f*i.x),Math.round(f*i.y)),n=this._vertexBoundsScale,h=r.bounds,a=2*Math.max(h.width,h.height);for(const x of r.glyphs)s.textureBinding=x.textureBinding,e.recordStart(t,s.data,this.geometryType,!0),e.vertexBounds(i.x+h.x+this._xOffset,i.y+h.y-this._yOffset,a*n,a*n),this._writeVertices(e,t,o,x),e.recordEnd()}_writeGlyph(e,t,i,r,s){const o=d.load(this._materialKey),n=m(Math.round(f*i),Math.round(f*r));o.textureBinding=s.textureBinding,e.recordStart(t,o.data,this.geometryType,!0);const h=s.bounds,a=this._vertexBoundsScale;e.vertexBounds(i+h.x*a,r+h.y*a,h.width*a,h.height*a),this._writeVertices(e,t,n,s),e.recordEnd()}_writeVertices(e,t,i,r){const s=e.vertexCount();this._writeVertexCommon(e,t,i,r),e.vertexWrite(r.offsets.upperLeft),e.vertexWrite(r.texcoords.upperLeft),e.vertexEnd(),this._writeVertexCommon(e,t,i,r),e.vertexWrite(r.offsets.upperRight),e.vertexWrite(r.texcoords.upperRight),e.vertexEnd(),this._writeVertexCommon(e,t,i,r),e.vertexWrite(r.offsets.lowerLeft),e.vertexWrite(r.texcoords.lowerLeft),e.vertexEnd(),this._writeVertexCommon(e,t,i,r),e.vertexWrite(r.offsets.lowerRight),e.vertexWrite(r.texcoords.lowerRight),e.vertexEnd(),e.indexWrite(s+0),e.indexWrite(s+1),e.indexWrite(s+2),e.indexWrite(s+1),e.indexWrite(s+3),e.indexWrite(s+2)}_writeVertexCommon(e,t,i,r){const s=this._color,o=this._haloColor,n=l(0,0,this._referenceSize,this._bitset),h=l(0,0,this._size,this._haloSize);e.vertexWrite(i),e.vertexWrite(t),e.vertexWrite(s),e.vertexWrite(o),e.vertexWrite(h),e.vertexWrite(n),e.vertexWrite(this._minMaxZoom)}};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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import i from"../../../Graphic.js";import r from"../../../core/Collection.js";import s from"../../../core/Error.js";import a from"../../../core/has.js";import{clone as n}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{andThen as l,isSome as h,unwrap as u,isNone as d}from"../../../core/maybe.js";import{debounce as p,isAbortError as c}from"../../../core/promiseUtils.js";import{watch as y}from"../../../core/reactiveUtils.js";import{init as f,whenFalseOnce as g}from"../../../core/watchUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import v from"../../../layers/effects/FeatureEffectView.js";import b from"../../../layers/support/FeatureFilter.js";import{calculateTolerance as R}from"../../../renderers/support/clickToleranceUtils.js";import w from"../../../rest/support/FeatureSet.js";import x from"../../../rest/support/Query.js";import{MAX_FILTERS as S}from"../engine/webgl/definitions.js";import{LayerView2DMixin as U}from"./LayerView2D.js";import{createSchema as F}from"./features/schemaUtils.js";import{createOrReuseTileRenderer as I}from"./features/tileRenderers.js";import{findSizeVV as C,createClusterCountSizeVariable as O,isClusterCompatibleRenderer as E,createClusterRenderer as q}from"./support/clusterUtils.js";import T from"./support/FeatureCommandQueue.js";import j from"./support/FeatureLayerProxy.js";import{toJSONGeometryType as V}from"./support/util.js";import{TileManager as N}from"../tiling/TileManager.js";import{FeatureLayerView as P}from"../../layers/FeatureLayerView.js";import k from"../../layers/LayerView.js";import{RefreshableLayerView as L}from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as H}from"../../support/drapedUtils.js";import{getWebGL1Capabilities as z}from"../../webgl/capabilities.js";import J from"../../../geometry/Extent.js";function Q(e){return e&&"openPorts"in e}const A=o.getLogger("esri.views.2d.layers.FeatureLayerView2D");let M=class extends(P(L(U(k)))){constructor(){super(...arguments),this._pipelineIsUpdating=!0,this._commandsQueue=new T({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"refresh":return this._doRefresh(e.dataChanged);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightIds=new Map,this._updateHighlight=p((async()=>this._proxy.setHighlight(Array.from(this._highlightIds.keys())))),this._uploadsLocked=!1,this._needsClusterSizeUpdate=!1,this.featureEffectView=new v,this._lastDefinitionExpression=null}destroy(){var e,t;l(this._updateClusterSizeTask,(e=>e.remove())),null==(e=this._proxy)||e.destroy(),null==(t=this.tileRenderer)||t.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(Promise.all([this._initProxy(),this._initServiceOptions()])),this.handles.add([this.on("valueRangesChanged",(e=>{this._set("_aggregateValueRanges",e.valueRanges)})),y((()=>this.featureEffect),(e=>{this.featureEffectView.featureEffect=e}),{initial:!0,sync:!0})])}async _initProxy(){if("isTable"in this.layer&&this.layer.isTable)throw new s("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:this.layer});this._proxy&&this._proxy.destroy();const e=this._createClientOptions();return this._set("_proxy",new j({client:e})),this._proxy.when()}async _initServiceOptions(){this._set("_serviceOptions",await this._createServiceOptions())}get orderByFields(){return"stream"!==this._serviceOptions.type&&this._serviceOptions.orderByFields}get labelsVisible(){const e="subtype-group"===this.layer.type?this.layer.sublayers.items:[this.layer];return!this.suspended&&e.some((e=>e.labelingInfo&&e.labelsVisible))}get queryMode(){return this._serviceOptions.type}get renderingConfigHash(){if(!this.layer)return null;const e=this.availableFields,t=this.layer,i=this.view.floors,{definitionExpression:r}=t,s="subtype-group"!==this.layer.type&&this.layer.labelsVisible&&this.layer.labelingInfo,a="renderer"in t&&t.renderer,n="feature"===t.type?t.gdbVersion:void 0,o="feature"===t.type&&t.historicMoment?t.historicMoment.getTime():void 0,{timeExtent:l}=this,u="customParameters"in t?JSON.stringify(t.customParameters):void 0,d="apiKey"in t?t.apiKey:void 0,p="stream"===t.type?`${JSON.stringify(t.geometryDefinition)}${t.definitionExpression}`:null,c=JSON.stringify(this.clips),y=t.featureReduction&&t.featureReduction.toJSON(),f="orderBy"in this.layer&&JSON.stringify(this.layer.orderBy),g="sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),"");return JSON.stringify({orderBy:f,sublayerHash:g,filterHash:h(this.filter)&&this.filter.toJSON(),effectHash:h(this.featureEffect)&&this.featureEffect.toJSON(),streamFilter:p,gdbVersion:n,definitionExpression:r,historicMoment:o,availableFields:e,renderer:a,labelingInfo:s,timeExtent:l,floors:i,clipsHash:c,featureReduction:y,customParameters:u,apiKey:d})}async fetchPopupFeatures(e,t){var i;if(h(t)&&0===t.clientGraphics.length)return[];if(!("cluster"===(null==(i=this.layer.featureReduction)?void 0:i.type))){const i=R({renderer:"renderer"in this.layer&&this.layer.renderer,event:h(t)&&t.event}),r=H(e,i,this.view),{features:s}=await this.queryVisibleFeatures(new x({geometry:r,outFields:["*"],returnGeometry:!0}));t=h(t)?t:{};const a=new Set(t.clientGraphics.map((e=>e.getObjectId())));for(const e of s)a.has(e.getObjectId())||t.clientGraphics.push(e)}return super.fetchPopupFeatures(e,t)}highlight(e){var t;let s;return e instanceof i?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:Array.isArray(e)&&e.length>0?s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>null==e?void 0:e.getObjectId())):r.isCollection(e)&&e.length>0&&(s=e.map((e=>null==e?void 0:e.getObjectId())).toArray()),s=null==(t=s)?void 0:t.filter((e=>null!=e)),s&&s.length?(this._addHighlight(s),{remove:()=>this._removeHighlight(s)}):{remove:()=>{}}}hasHighlight(){return!!this._highlightIds.size}async hitTest(e,r){if(!this.tileRenderer)return null;const s=await this.tileRenderer.hitTest(r);if(0===s.length)return null;const{features:a,aggregates:n}=await this._proxy.getFeatures(s);return[...n.map((e=>this._createHittestResult(t.fromJSON(e)))),...a.map((e=>this._createHittestResult(i.fromJSON(e))))]}async queryAggregates(){return(await this._proxy.getAggregates()).map((e=>t.fromJSON(e)))}queryStatistics(){return this._proxy.queryStatistics()}async querySummaryStatistics(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.querySummaryStatistics(this._cleanUpQuery(e),r,i)}async queryUniqueValues(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryUniqueValues(this._cleanUpQuery(e),r,i)}async queryClassBreaks(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryClassBreaks(this._cleanUpQuery(e),r,i)}async queryHistogram(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryHistogram(this._cleanUpQuery(e),r,i)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=w.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryVisibleFeatures(e,t){return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e),t).then((e=>{const t=w.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryFeaturesJSON(e,t){return this._proxy.queryFeatures(this._cleanUpQuery(e),t)}queryObjectIds(e,t){return this._proxy.queryObjectIds(this._cleanUpQuery(e),t)}queryFeatureCount(e,t){return this._proxy.queryFeatureCount(this._cleanUpQuery(e),t)}queryExtent(e,t){return this._proxy.queryExtent(this._cleanUpQuery(e),t).then((e=>({count:e.count,extent:J.fromJSON(e.extent)})))}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._tileStrategy||!this.tileRenderer)return;const{hasMissingTiles:t,added:i,removed:r}=this._tileStrategy.update(e);(i.length||r.length)&&this._proxy.updateTiles({added:i,removed:r}),t&&this.requestUpdate(),this.notifyChange("updating")}attach(){this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._tileStrategy=new N({acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme,buffer:0}),this.handles.add(f(this,"renderingConfigHash",(()=>this._update())),"attach"),"stream"!==this.layer.type&&this.handles.add(this.layer.on("edits",(e=>this._edit(e))),"attach")}detach(){this.container.removeAllChildren(),this.handles.remove("attach"),this.tileRenderer&&(this.tileRenderer.uninstall(this.container),this.tileRenderer=null),this._tileStrategy&&(this._tileStrategy.destroy(),this._tileStrategy=null),this._tileRendererHash=null}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){var e;const t="renderer"in this.layer&&null!=this.layer.renderer,i=this._commandsQueue.updating,r=null!=this._updatingRequiredFieldsPromise,s=!this._proxy||!this._proxy.isReady,n=this._pipelineIsUpdating,o=null===this.tileRenderer||(null==(e=this.tileRenderer)?void 0:e.updating),l=t&&(i||r||s||n||o);return a("esri-2d-log-updating")&&console.log(`Updating FLV2D: ${l}\n -> hasRenderer ${t}\n -> hasPendingCommand ${i}\n -> updatingRequiredFields ${r}\n -> updatingProxy ${s}\n -> updatingPipeline ${n}\n -> updatingTileRenderer ${o}\n`),l}_createClientOptions(){return{setUpdating:e=>{this._set("_pipelineIsUpdating",e)},emitEvent:e=>{this.emit(e.name,e.event)}}}async _detectQueryMode(e){var t;const i="path"in e,r="editingInfo"in this.layer&&(null==(t=this.layer.editingInfo)?void 0:t.lastEditDate),s=!!this.layer.refreshInterval,n=!r&&s;if(i&&("feature"===this.layer.type||"subtype-group"===this.layer.type)&&"point"===this.layer.geometryType&&this.layer.capabilities.query.supportsPagination&&!this.layer.capabilities.operations.supportsEditing&&!n&&a("featurelayer-snapshot-enabled"))try{const e=await this.layer.queryFeatureCount();if(e<=a("featurelayer-snapshot-point-min-threshold"))return{mode:"snapshot",featureCount:e};const t=a("featurelayer-snapshot-point-max-threshold"),i=a("featurelayer-snapshot-point-coverage"),r=this.view.extent,s=u(this.layer.fullExtent),n=null==s?void 0:s.clone().intersection(r),o=h(n)?n.width*n.height:0,l=(null==s?void 0:s.width)*(null==s?void 0:s.height),d=0===l?0:o/l;if(e<=t&&d>=i)return{mode:"snapshot",featureCount:e}}catch(o){A.warn("mapview-feature-layer","Encountered an error when querying for featureCount",{error:o})}return{mode:"on-demand"}}async _createServiceOptions(){var e;const t=this.layer;if("stream"===t.type)return null;const{capabilities:i,objectIdField:r}=t,s=t.fields.map((e=>e.toJSON())),a=h(t.fullExtent)&&t.fullExtent.toJSON(),o=V(t.geometryType),l=t.timeInfo&&t.timeInfo.toJSON()||null,u=t.spatialReference?t.spatialReference.toJSON():null,d="feature"===t.type?t.globalIdField:null;let p;"ogc-feature"===t.type?p=t.source.getFeatureDefinition():Q(t.source)?p=await t.source.openPorts():t.parsedUrl&&(p=n(t.parsedUrl),"dynamicDataSource"in t&&t.dynamicDataSource&&(p.query={layer:JSON.stringify({source:t.dynamicDataSource})}));const c="datesInUnknownTimezone"in this.layer&&this.layer.datesInUnknownTimezone,y=null!=(e="subtypeField"in this.layer&&this.layer.subtypeField)?e:null,{mode:f,featureCount:g}=await this._detectQueryMode(p);let m=this.layer.objectIdField;if("feature"===this.layer.type&&h(this.layer.orderBy)&&this.layer.orderBy.length){const e=!this.layer.orderBy[0].valueExpression&&this.layer.orderBy[0].field;e&&(m=e)}return{type:f,timeReferenceUnknownClient:c,subtypeField:y,featureCount:g,globalIdField:d,maxRecordCount:i.query.maxRecordCount,tileMaxRecordCount:i.query.tileMaxRecordCount,capabilities:i,fields:s,fullExtent:a,geometryType:o,objectIdField:r,source:p,timeInfo:l,spatialReference:u,orderByFields:m}}async _createMemoryServiceOptions(e){const t=await e.openPorts();return{...this._createServiceOptions(),type:"memory",source:t}}_cleanUpQuery(e){const t=x.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this._validateEdit(e))return this._commandsQueue.push({type:"edit",edits:e})}async doRefresh(e){return this._commandsQueue.push({type:"refresh",dataChanged:e})}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,i=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),r=t&&this.availableFields.includes(t);return i&&!r?(A.error(new s("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){try{if(this.destroyed||!this._hasRequiredSupport(this.layer)||!this._tileStrategy)return;const{featureEffectView:t,filter:i}=this;await this._updateRequiredFields();const{renderer:r}=this._getEffectiveRenderer();this._set("_effectiveRenderer",r);const s=this._createSchemaConfig(),a=this._createConfiguration(s,i,t.filter),n=this._lastDefinitionExpression!==a.definitionExpression;this._lastDefinitionExpression=a.definitionExpression;const o=this._createTileRendererHash(r);if("snapshot"===this._serviceOptions.type&&(a.schema.source.featureCount=this._serviceOptions.featureCount),o!==this._tileRendererHash){await this._initTileRenderer(r);const e=this._serviceOptions;this.tileRenderer.onConfigUpdate(r);const t=this.layer;"stream"!==t.type&&Q(t.source)&&(e.source=await t.source.openPorts()),"stream"===t.type&&await this._initServiceOptions();const i={added:this._tileStrategy.tileKeys(),removed:[]};await this._proxy.startup(this.view.featuresTilingScheme,a,e,i),this.hasHighlight()&&await this._proxy.setHighlight(Array.from(this._highlightIds.keys())),await this._onceTilesUpdated(),this.tileRenderer.onConfigUpdate(r)}else{"snapshot"===this._serviceOptions.type&&n&&(a.schema.source.featureCount=await this.layer.queryFeatureCount());const t=await this._proxy.update(a);(t.mesh||t.targets.aggregate)&&this._lockGPUUploads();try{await this._proxy.applyUpdate(t)}catch(e){c(e)||A.error(e)}(t.mesh||t.targets.aggregate)&&this._unlockGPUUploads(),this.tileRenderer.onConfigUpdate(r),this._updateClusterSizeVariable(),this._forceAttributeTextureUpload()}this._tileRendererHash=o,this.tileRenderer.invalidateLabels(),this.requestUpdate()}catch(e){}}async _doEdit(e){try{await this._proxy.onEdits(e)}catch(t){c(t),0}}async _doRefresh(e){this._lockGPUUploads();try{await this._proxy.refresh(e)}catch(t){c(t),0}this._unlockGPUUploads()}_updateClusterSizeVariable(){this._needsClusterSizeUpdate&&(this.tileRenderer.onConfigUpdate(this._effectiveRenderer),this._needsClusterSizeUpdate=!1)}_createUpdateClusterSizeTask(e,t){return this.watch("_aggregateValueRanges",(async i=>{this._updateClusterEffectiveRendererSizeVariable(e,t,i),this._needsClusterSizeUpdate=!0,this._uploadsLocked||this._updateClusterSizeVariable()}))}async _updateClusterEffectiveRendererSizeVariable(e,t,i){if(e.dynamicClusterSize&&"visualVariables"in e&&e.visualVariables){const r=C(e.visualVariables);if(h(r)&&"cluster_count"===r.field){const s=e.visualVariables.indexOf(r);e.visualVariables[s]=O(t,i);const a=e.clone();a.dynamicClusterSize=!0,this._set("_effectiveRenderer",a)}}}_getEffectiveRenderer(){const e="renderer"in this.layer&&this.layer.renderer,t=this.layer.featureReduction;if(h(this._updateClusterSizeTask)&&(this._updateClusterSizeTask.remove(),this._updateClusterSizeTask=null),t&&"cluster"===t.type&&E(e)){const i=t,r=[],s=q(r,e,i,this._aggregateValueRanges);return l(this._updateClusterSizeTask,(e=>e.remove())),this._updateClusterSizeTask=this._createUpdateClusterSizeTask(s,i),{renderer:s,aggregateFields:r,featureReduction:t}}return{renderer:e,aggregateFields:[],featureReduction:null}}_acquireTile(e){const t=this.tileRenderer.acquireTile(e);return t.once("attach",(()=>{this.requestUpdate()})),t}_releaseTile(e){this.tileRenderer.releaseTile(e)}async _initTileRenderer(e){const t=await I(e,{layerView:this,tileInfoView:this.view.featuresTilingScheme,layer:this.layer});return this.tileRenderer&&(this._tileStrategy.clear(),this.tileRenderer.uninstall(this.container),this.tileRenderer.destroy(),this.tileRenderer=null),this.destroyed?null:(this._proxy.tileRenderer=t,this._set("tileRenderer",t),this.tileRenderer.install(this.container),this.tileRenderer.onConfigUpdate(e),this.requestUpdate(),this.tileRenderer)}_createTileRendererHash(e){return`${"heatmap"===e.type?"heatmap":"symbol"}.${"dot-density"===e.type}`}get hasFilter(){const e=!!("floorInfo"in this.layer&&this.layer.floorInfo&&this.view.floors&&this.view.floors.length);return!!this.filter||e||!!this._visibilityOverrides.size||!!this.timeExtent}_injectOverrides(e){const t=h(e)?e.timeExtent:null,i=h(this.timeExtent)&&h(t)?this.timeExtent.intersection(t):this.timeExtent||t;let r=null;const s="floorInfo"in this.layer&&this.layer.floorInfo;if(s){const t=h(e)&&e.where;r=this._addFloorFilterClause(t)}if(!this._visibilityOverrides.size&&!i&&!s)return h(e)?e.toJSON():null;(e=h(e)&&e.clone()||new b).timeExtent=i,r&&(e.where=r);const a=e.toJSON();return a.hiddenIds=Array.from(this._visibilityOverrides),a}_addFloorFilterClause(e){const t=this.layer;let i=e||"";if("floorInfo"in t&&t.floorInfo){var r;let e=this.view.floors;if(!e||!e.length)return i;null!=(r=t.floorInfo.viewAllLevelIds)&&r.length&&(e=t.floorInfo.viewAllLevelIds);const s=e.filter((e=>""!==e)).map((e=>"'"+e+"'"));s.push("''");const a=t.floorInfo.floorField;let n="("+a+" IN ({ids}) OR "+a+" IS NULL)";if(n=n.replace("{ids}",s.join(", ")),h(i)&&i.includes(a)){let e=new RegExp("AND \\("+a+".*NULL\\)","g");i=i.replace(e,""),e=new RegExp("\\("+a+".*NULL\\)","g"),i=i.replace(e,""),i=i.replace(/\s+/g," ").trim()}i=""!==i?"("+i+") AND "+n:n}return""!==i?i:null}_createConfiguration(e,t,i){const r="feature"===this.layer.type&&this.layer.historicMoment?this.layer.historicMoment.getTime():void 0,s="feature"===this.layer.type?this.layer.gdbVersion:void 0,a=new Array(S),n=this._injectOverrides(t);a[0]=n,a[1]=h(i)?i.toJSON():null;const o=F(e);if(d(o))return null;const l=z();return{definitionExpression:this.layer.definitionExpression,availableFields:this.availableFields,gdbVersion:s,historicMoment:r,devicePixelRatio:window.devicePixelRatio||1,filters:a,schema:o,supportsTextureFloat:l.supportsTextureFloat,maxTextureSize:l.maxTextureSize}}_hasRequiredSupport(e){var t;return!("renderer"in e&&"dot-density"===(null==(t=e.renderer)?void 0:t.type)&&!z().supportsTextureFloat)||(A.error(new s("webgl-missing-extension","Missing WebGL extension OES_Texture_Float which is required for DotDensity")),!1)}_onceTilesUpdated(){return this.requestUpdate(),g(this,"_pipelineIsUpdating",!1)}_lockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!0,this.tileRenderer.lockGPUUploads())}_unlockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!1,this.tileRenderer.unlockGPUUploads())}_forceAttributeTextureUpload(){this.tileRenderer&&this.tileRenderer.forceAttributeTextureUpload()}_createSchemaConfig(){const e="feature"===this.layer.type?this.layer.historicMoment:null,t="feature"===this.layer.type?this.layer.gdbVersion:null;return{renderer:"renderer"in this.layer&&this.layer.renderer,spatialReference:this.layer.spatialReference,timeExtent:this.layer.timeExtent,definitionExpression:this.layer.definitionExpression,featureReduction:this.layer.featureReduction,fields:this.layer.fields,geometryType:this.layer.geometryType,historicMoment:e,labelsVisible:"labelsVisible"in this.layer&&this.layer.labelsVisible,labelingInfo:"labelingInfo"in this.layer&&this.layer.labelingInfo,availableFields:this.availableFields,featureEffect:this.featureEffect,filter:this.filter,gdbVersion:t,pixelBuffer:0,orderBy:"orderBy"in this.layer&&this.layer.orderBy?this.layer.orderBy:null,customParameters:{..."customParameters"in this.layer?this.layer.customParameters:void 0,token:"apiKey"in this.layer?this.layer.apiKey:void 0}}}_addHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t);this._highlightIds.set(t,e+1)}else this._highlightIds.set(t,1);this._updateHighlight().catch((e=>{c(e)||A.error(e)}))}_removeHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t)-1;0===e?this._highlightIds.delete(t):this._highlightIds.set(t,e)}this._updateHighlight().catch((e=>{c(e)||A.error(e)}))}_setLayersForFeature(e){const t=this.layer;e.layer=t,e.sourceLayer=t}_createHittestResult(e){return this._setLayersForFeature(e),h(e.geometry)&&(e.geometry.spatialReference=this.view.spatialReference),e}};e([m()],M.prototype,"_serviceOptions",void 0),e([m()],M.prototype,"_proxy",void 0),e([m()],M.prototype,"_pipelineIsUpdating",void 0),e([m()],M.prototype,"_effectiveRenderer",void 0),e([m()],M.prototype,"_aggregateValueRanges",void 0),e([m()],M.prototype,"_commandsQueue",void 0),e([m()],M.prototype,"featureEffectView",void 0),e([m()],M.prototype,"labelsVisible",null),e([m({readOnly:!0})],M.prototype,"queryMode",null),e([m()],M.prototype,"renderingConfigHash",null),e([m()],M.prototype,"tileRenderer",void 0),e([m()],M.prototype,"updating",void 0),M=e([_("esri.views.2d.layers.FeatureLayerView2D")],M);const B=M;export{B as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import i from"../../../Graphic.js";import r from"../../../core/Collection.js";import s from"../../../core/Error.js";import a from"../../../core/has.js";import{clone as n}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{applySome as l,isSome as h,unwrap as u,isNone as d}from"../../../core/maybe.js";import{debounce as p,isAbortError as c}from"../../../core/promiseUtils.js";import{watch as y}from"../../../core/reactiveUtils.js";import{init as f,whenFalseOnce as g}from"../../../core/watchUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import v from"../../../layers/effects/FeatureEffectView.js";import b from"../../../layers/support/FeatureFilter.js";import{calculateTolerance as R}from"../../../renderers/support/clickToleranceUtils.js";import w from"../../../rest/support/FeatureSet.js";import x from"../../../rest/support/Query.js";import{MAX_FILTERS as S}from"../engine/webgl/definitions.js";import{LayerView2DMixin as U}from"./LayerView2D.js";import{createSchema as F}from"./features/schemaUtils.js";import{createOrReuseTileRenderer as I}from"./features/tileRenderers.js";import{findSizeVV as C,createClusterCountSizeVariable as O,isClusterCompatibleRenderer as E,createClusterRenderer as q}from"./support/clusterUtils.js";import T from"./support/FeatureCommandQueue.js";import j from"./support/FeatureLayerProxy.js";import{toJSONGeometryType as V}from"./support/util.js";import{TileManager as N}from"../tiling/TileManager.js";import{FeatureLayerView as P}from"../../layers/FeatureLayerView.js";import k from"../../layers/LayerView.js";import{RefreshableLayerView as L}from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as H}from"../../support/drapedUtils.js";import{getWebGL1Capabilities as z}from"../../webgl/capabilities.js";import J from"../../../geometry/Extent.js";function Q(e){return e&&"openPorts"in e}const A=o.getLogger("esri.views.2d.layers.FeatureLayerView2D");let M=class extends(P(L(U(k)))){constructor(){super(...arguments),this._pipelineIsUpdating=!0,this._commandsQueue=new T({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"refresh":return this._doRefresh(e.dataChanged);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightIds=new Map,this._updateHighlight=p((async()=>this._proxy.setHighlight(Array.from(this._highlightIds.keys())))),this._uploadsLocked=!1,this._needsClusterSizeUpdate=!1,this.featureEffectView=new v,this._lastDefinitionExpression=null}destroy(){var e,t;l(this._updateClusterSizeTask,(e=>e.remove())),null==(e=this._proxy)||e.destroy(),null==(t=this.tileRenderer)||t.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(Promise.all([this._initProxy(),this._initServiceOptions()])),this.handles.add([this.on("valueRangesChanged",(e=>{this._set("_aggregateValueRanges",e.valueRanges)})),y((()=>this.featureEffect),(e=>{this.featureEffectView.featureEffect=e}),{initial:!0,sync:!0})])}async _initProxy(){if("isTable"in this.layer&&this.layer.isTable)throw new s("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:this.layer});this._proxy&&this._proxy.destroy();const e=this._createClientOptions();return this._set("_proxy",new j({client:e})),this._proxy.when()}async _initServiceOptions(){this._set("_serviceOptions",await this._createServiceOptions())}get orderByFields(){return"stream"!==this._serviceOptions.type&&this._serviceOptions.orderByFields}get labelsVisible(){const e="subtype-group"===this.layer.type?this.layer.sublayers.items:[this.layer];return!this.suspended&&e.some((e=>e.labelingInfo&&e.labelsVisible))}get queryMode(){return this._serviceOptions.type}get renderingConfigHash(){if(!this.layer)return null;const e=this.availableFields,t=this.layer,i=this.view.floors,{definitionExpression:r}=t,s="subtype-group"!==this.layer.type&&this.layer.labelsVisible&&this.layer.labelingInfo,a="renderer"in t&&t.renderer,n="feature"===t.type?t.gdbVersion:void 0,o="feature"===t.type&&t.historicMoment?t.historicMoment.getTime():void 0,{timeExtent:l}=this,u="customParameters"in t?JSON.stringify(t.customParameters):void 0,d="apiKey"in t?t.apiKey:void 0,p="stream"===t.type?`${JSON.stringify(t.geometryDefinition)}${t.definitionExpression}`:null,c=JSON.stringify(this.clips),y=t.featureReduction&&t.featureReduction.toJSON(),f="orderBy"in this.layer&&JSON.stringify(this.layer.orderBy),g="sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),"");return JSON.stringify({orderBy:f,sublayerHash:g,filterHash:h(this.filter)&&this.filter.toJSON(),effectHash:h(this.featureEffect)&&this.featureEffect.toJSON(),streamFilter:p,gdbVersion:n,definitionExpression:r,historicMoment:o,availableFields:e,renderer:a,labelingInfo:s,timeExtent:l,floors:i,clipsHash:c,featureReduction:y,customParameters:u,apiKey:d})}async fetchPopupFeatures(e,t){var i;if(h(t)&&0===t.clientGraphics.length)return[];if(!("cluster"===(null==(i=this.layer.featureReduction)?void 0:i.type))){const i=R({renderer:"renderer"in this.layer&&this.layer.renderer,event:h(t)&&t.event}),r=H(e,i,this.view),{features:s}=await this.queryVisibleFeatures(new x({geometry:r,outFields:["*"],returnGeometry:!0}));t=h(t)?t:{};const a=new Set(t.clientGraphics.map((e=>e.getObjectId())));for(const e of s)a.has(e.getObjectId())||t.clientGraphics.push(e)}return super.fetchPopupFeatures(e,t)}highlight(e){var t;let s;return e instanceof i?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:Array.isArray(e)&&e.length>0?s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>null==e?void 0:e.getObjectId())):r.isCollection(e)&&e.length>0&&(s=e.map((e=>null==e?void 0:e.getObjectId())).toArray()),s=null==(t=s)?void 0:t.filter((e=>null!=e)),s&&s.length?(this._addHighlight(s),{remove:()=>this._removeHighlight(s)}):{remove:()=>{}}}hasHighlight(){return!!this._highlightIds.size}async hitTest(e,r){if(!this.tileRenderer)return null;const s=await this.tileRenderer.hitTest(r);if(0===s.length)return null;const{features:a,aggregates:n}=await this._proxy.getFeatures(s);return[...n.map((e=>this._createHittestResult(t.fromJSON(e)))),...a.map((e=>this._createHittestResult(i.fromJSON(e))))]}async queryAggregates(){return(await this._proxy.getAggregates()).map((e=>t.fromJSON(e)))}queryStatistics(){return this._proxy.queryStatistics()}async querySummaryStatistics(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.querySummaryStatistics(this._cleanUpQuery(e),r,i)}async queryUniqueValues(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryUniqueValues(this._cleanUpQuery(e),r,i)}async queryClassBreaks(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryClassBreaks(this._cleanUpQuery(e),r,i)}async queryHistogram(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryHistogram(this._cleanUpQuery(e),r,i)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=w.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryVisibleFeatures(e,t){return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e),t).then((e=>{const t=w.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryFeaturesJSON(e,t){return this._proxy.queryFeatures(this._cleanUpQuery(e),t)}queryObjectIds(e,t){return this._proxy.queryObjectIds(this._cleanUpQuery(e),t)}queryFeatureCount(e,t){return this._proxy.queryFeatureCount(this._cleanUpQuery(e),t)}queryExtent(e,t){return this._proxy.queryExtent(this._cleanUpQuery(e),t).then((e=>({count:e.count,extent:J.fromJSON(e.extent)})))}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._tileStrategy||!this.tileRenderer)return;const{hasMissingTiles:t,added:i,removed:r}=this._tileStrategy.update(e);(i.length||r.length)&&this._proxy.updateTiles({added:i,removed:r}),t&&this.requestUpdate(),this.notifyChange("updating")}attach(){this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._tileStrategy=new N({acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme,buffer:0}),this.handles.add(f(this,"renderingConfigHash",(()=>this._update())),"attach"),"stream"!==this.layer.type&&this.handles.add(this.layer.on("edits",(e=>this._edit(e))),"attach")}detach(){this.container.removeAllChildren(),this.handles.remove("attach"),this.tileRenderer&&(this.tileRenderer.uninstall(this.container),this.tileRenderer=null),this._tileStrategy&&(this._tileStrategy.destroy(),this._tileStrategy=null),this._tileRendererHash=null}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){var e;const t="renderer"in this.layer&&null!=this.layer.renderer,i=this._commandsQueue.updating,r=null!=this._updatingRequiredFieldsPromise,s=!this._proxy||!this._proxy.isReady,n=this._pipelineIsUpdating,o=null===this.tileRenderer||(null==(e=this.tileRenderer)?void 0:e.updating),l=t&&(i||r||s||n||o);return a("esri-2d-log-updating")&&console.log(`Updating FLV2D: ${l}\n -> hasRenderer ${t}\n -> hasPendingCommand ${i}\n -> updatingRequiredFields ${r}\n -> updatingProxy ${s}\n -> updatingPipeline ${n}\n -> updatingTileRenderer ${o}\n`),l}_createClientOptions(){return{setUpdating:e=>{this._set("_pipelineIsUpdating",e)},emitEvent:e=>{this.emit(e.name,e.event)}}}async _detectQueryMode(e){var t;const i="path"in e,r="editingInfo"in this.layer&&(null==(t=this.layer.editingInfo)?void 0:t.lastEditDate),s=!!this.layer.refreshInterval,n=!r&&s;if(i&&("feature"===this.layer.type||"subtype-group"===this.layer.type)&&"point"===this.layer.geometryType&&this.layer.capabilities.query.supportsPagination&&!this.layer.capabilities.operations.supportsEditing&&!n&&a("featurelayer-snapshot-enabled"))try{const e=await this.layer.queryFeatureCount();if(e<=a("featurelayer-snapshot-point-min-threshold"))return{mode:"snapshot",featureCount:e};const t=a("featurelayer-snapshot-point-max-threshold"),i=a("featurelayer-snapshot-point-coverage"),r=this.view.extent,s=u(this.layer.fullExtent),n=null==s?void 0:s.clone().intersection(r),o=h(n)?n.width*n.height:0,l=(null==s?void 0:s.width)*(null==s?void 0:s.height),d=0===l?0:o/l;if(e<=t&&d>=i)return{mode:"snapshot",featureCount:e}}catch(o){A.warn("mapview-feature-layer","Encountered an error when querying for featureCount",{error:o})}return{mode:"on-demand"}}async _createServiceOptions(){var e;const t=this.layer;if("stream"===t.type)return null;const{capabilities:i,objectIdField:r}=t,s=t.fields.map((e=>e.toJSON())),a=h(t.fullExtent)&&t.fullExtent.toJSON(),o=V(t.geometryType),l=t.timeInfo&&t.timeInfo.toJSON()||null,u=t.spatialReference?t.spatialReference.toJSON():null,d="feature"===t.type?t.globalIdField:null;let p;"ogc-feature"===t.type?p=t.source.getFeatureDefinition():Q(t.source)?p=await t.source.openPorts():t.parsedUrl&&(p=n(t.parsedUrl),"dynamicDataSource"in t&&t.dynamicDataSource&&(p.query={layer:JSON.stringify({source:t.dynamicDataSource})}));const c="datesInUnknownTimezone"in this.layer&&this.layer.datesInUnknownTimezone,y=null!=(e="subtypeField"in this.layer&&this.layer.subtypeField)?e:null,{mode:f,featureCount:g}=await this._detectQueryMode(p);let m=this.layer.objectIdField;if("feature"===this.layer.type&&h(this.layer.orderBy)&&this.layer.orderBy.length){const e=!this.layer.orderBy[0].valueExpression&&this.layer.orderBy[0].field;e&&(m=e)}return{type:f,timeReferenceUnknownClient:c,subtypeField:y,featureCount:g,globalIdField:d,maxRecordCount:i.query.maxRecordCount,tileMaxRecordCount:i.query.tileMaxRecordCount,capabilities:i,fields:s,fullExtent:a,geometryType:o,objectIdField:r,source:p,timeInfo:l,spatialReference:u,orderByFields:m}}async _createMemoryServiceOptions(e){const t=await e.openPorts();return{...this._createServiceOptions(),type:"memory",source:t}}_cleanUpQuery(e){const t=x.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this._validateEdit(e))return this._commandsQueue.push({type:"edit",edits:e})}async doRefresh(e){return this._commandsQueue.push({type:"refresh",dataChanged:e})}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,i=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),r=t&&this.availableFields.includes(t);return i&&!r?(A.error(new s("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){try{if(this.destroyed||!this._hasRequiredSupport(this.layer)||!this._tileStrategy)return;const{featureEffectView:t,filter:i}=this;await this._updateRequiredFields();const{renderer:r}=this._getEffectiveRenderer();this._set("_effectiveRenderer",r);const s=this._createSchemaConfig(),a=this._createConfiguration(s,i,t.filter),n=this._lastDefinitionExpression!==a.definitionExpression;this._lastDefinitionExpression=a.definitionExpression;const o=this._createTileRendererHash(r);if("snapshot"===this._serviceOptions.type&&(a.schema.source.featureCount=this._serviceOptions.featureCount),o!==this._tileRendererHash){await this._initTileRenderer(r);const e=this._serviceOptions;this.tileRenderer.onConfigUpdate(r);const t=this.layer;"stream"!==t.type&&Q(t.source)&&(e.source=await t.source.openPorts()),"stream"===t.type&&await this._initServiceOptions();const i={added:this._tileStrategy.tileKeys(),removed:[]};await this._proxy.startup(this.view.featuresTilingScheme,a,e,i),this.hasHighlight()&&await this._proxy.setHighlight(Array.from(this._highlightIds.keys())),await this._onceTilesUpdated(),this.tileRenderer.onConfigUpdate(r)}else{"snapshot"===this._serviceOptions.type&&n&&(a.schema.source.featureCount=await this.layer.queryFeatureCount());const t=await this._proxy.update(a);(t.mesh||t.targets.aggregate)&&this._lockGPUUploads();try{await this._proxy.applyUpdate(t)}catch(e){c(e)||A.error(e)}(t.mesh||t.targets.aggregate)&&this._unlockGPUUploads(),this.tileRenderer.onConfigUpdate(r),this._updateClusterSizeVariable(),this._forceAttributeTextureUpload()}this._tileRendererHash=o,this.tileRenderer.invalidateLabels(),this.requestUpdate()}catch(e){}}async _doEdit(e){try{await this._proxy.onEdits(e)}catch(t){c(t),0}}async _doRefresh(e){this._lockGPUUploads();try{await this._proxy.refresh(e)}catch(t){c(t),0}this._unlockGPUUploads()}_updateClusterSizeVariable(){this._needsClusterSizeUpdate&&(this.tileRenderer.onConfigUpdate(this._effectiveRenderer),this._needsClusterSizeUpdate=!1)}_createUpdateClusterSizeTask(e,t){return this.watch("_aggregateValueRanges",(async i=>{this._updateClusterEffectiveRendererSizeVariable(e,t,i),this._needsClusterSizeUpdate=!0,this._uploadsLocked||this._updateClusterSizeVariable()}))}async _updateClusterEffectiveRendererSizeVariable(e,t,i){if(e.dynamicClusterSize&&"visualVariables"in e&&e.visualVariables){const r=C(e.visualVariables);if(h(r)&&"cluster_count"===r.field){const s=e.visualVariables.indexOf(r);e.visualVariables[s]=O(t,i);const a=e.clone();a.dynamicClusterSize=!0,this._set("_effectiveRenderer",a)}}}_getEffectiveRenderer(){const e="renderer"in this.layer&&this.layer.renderer,t=this.layer.featureReduction;if(h(this._updateClusterSizeTask)&&(this._updateClusterSizeTask.remove(),this._updateClusterSizeTask=null),t&&"cluster"===t.type&&E(e)){const i=t,r=[],s=q(r,e,i,this._aggregateValueRanges);return l(this._updateClusterSizeTask,(e=>e.remove())),this._updateClusterSizeTask=this._createUpdateClusterSizeTask(s,i),{renderer:s,aggregateFields:r,featureReduction:t}}return{renderer:e,aggregateFields:[],featureReduction:null}}_acquireTile(e){const t=this.tileRenderer.acquireTile(e);return t.once("attach",(()=>{this.requestUpdate()})),t}_releaseTile(e){this.tileRenderer.releaseTile(e)}async _initTileRenderer(e){const t=await I(e,{layerView:this,tileInfoView:this.view.featuresTilingScheme,layer:this.layer});return this.tileRenderer&&(this._tileStrategy.clear(),this.tileRenderer.uninstall(this.container),this.tileRenderer.destroy(),this.tileRenderer=null),this.destroyed?null:(this._proxy.tileRenderer=t,this._set("tileRenderer",t),this.tileRenderer.install(this.container),this.tileRenderer.onConfigUpdate(e),this.requestUpdate(),this.tileRenderer)}_createTileRendererHash(e){return`${"heatmap"===e.type?"heatmap":"symbol"}.${"dot-density"===e.type}`}get hasFilter(){const e=!!("floorInfo"in this.layer&&this.layer.floorInfo&&this.view.floors&&this.view.floors.length);return!!this.filter||e||!!this._visibilityOverrides.size||!!this.timeExtent}_injectOverrides(e){const t=h(e)?e.timeExtent:null,i=h(this.timeExtent)&&h(t)?this.timeExtent.intersection(t):this.timeExtent||t;let r=null;const s="floorInfo"in this.layer&&this.layer.floorInfo;if(s){const t=h(e)&&e.where;r=this._addFloorFilterClause(t)}if(!this._visibilityOverrides.size&&!i&&!s)return h(e)?e.toJSON():null;(e=h(e)&&e.clone()||new b).timeExtent=i,r&&(e.where=r);const a=e.toJSON();return a.hiddenIds=Array.from(this._visibilityOverrides),a}_addFloorFilterClause(e){const t=this.layer;let i=e||"";if("floorInfo"in t&&t.floorInfo){var r;let e=this.view.floors;if(!e||!e.length)return i;null!=(r=t.floorInfo.viewAllLevelIds)&&r.length&&(e=t.floorInfo.viewAllLevelIds);const s=e.filter((e=>""!==e)).map((e=>"'"+e+"'"));s.push("''");const a=t.floorInfo.floorField;let n="("+a+" IN ({ids}) OR "+a+" IS NULL)";if(n=n.replace("{ids}",s.join(", ")),h(i)&&i.includes(a)){let e=new RegExp("AND \\("+a+".*NULL\\)","g");i=i.replace(e,""),e=new RegExp("\\("+a+".*NULL\\)","g"),i=i.replace(e,""),i=i.replace(/\s+/g," ").trim()}i=""!==i?"("+i+") AND "+n:n}return""!==i?i:null}_createConfiguration(e,t,i){const r="feature"===this.layer.type&&this.layer.historicMoment?this.layer.historicMoment.getTime():void 0,s="feature"===this.layer.type?this.layer.gdbVersion:void 0,a=new Array(S),n=this._injectOverrides(t);a[0]=n,a[1]=h(i)?i.toJSON():null;const o=F(e);if(d(o))return null;const l=z();return{definitionExpression:this.layer.definitionExpression,availableFields:this.availableFields,gdbVersion:s,historicMoment:r,devicePixelRatio:window.devicePixelRatio||1,filters:a,schema:o,supportsTextureFloat:l.supportsTextureFloat,maxTextureSize:l.maxTextureSize}}_hasRequiredSupport(e){var t;return!("renderer"in e&&"dot-density"===(null==(t=e.renderer)?void 0:t.type)&&!z().supportsTextureFloat)||(A.error(new s("webgl-missing-extension","Missing WebGL extension OES_Texture_Float which is required for DotDensity")),!1)}_onceTilesUpdated(){return this.requestUpdate(),g(this,"_pipelineIsUpdating",!1)}_lockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!0,this.tileRenderer.lockGPUUploads())}_unlockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!1,this.tileRenderer.unlockGPUUploads())}_forceAttributeTextureUpload(){this.tileRenderer&&this.tileRenderer.forceAttributeTextureUpload()}_createSchemaConfig(){const e="feature"===this.layer.type?this.layer.historicMoment:null,t="feature"===this.layer.type?this.layer.gdbVersion:null;return{renderer:"renderer"in this.layer&&this.layer.renderer,spatialReference:this.layer.spatialReference,timeExtent:this.layer.timeExtent,definitionExpression:this.layer.definitionExpression,featureReduction:this.layer.featureReduction,fields:this.layer.fields,geometryType:this.layer.geometryType,historicMoment:e,labelsVisible:"labelsVisible"in this.layer&&this.layer.labelsVisible,labelingInfo:"labelingInfo"in this.layer&&this.layer.labelingInfo,availableFields:this.availableFields,featureEffect:this.featureEffect,filter:this.filter,gdbVersion:t,pixelBuffer:0,orderBy:"orderBy"in this.layer&&this.layer.orderBy?this.layer.orderBy:null,customParameters:{..."customParameters"in this.layer?this.layer.customParameters:void 0,token:"apiKey"in this.layer?this.layer.apiKey:void 0}}}_addHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t);this._highlightIds.set(t,e+1)}else this._highlightIds.set(t,1);this._updateHighlight().catch((e=>{c(e)||A.error(e)}))}_removeHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t)-1;0===e?this._highlightIds.delete(t):this._highlightIds.set(t,e)}this._updateHighlight().catch((e=>{c(e)||A.error(e)}))}_setLayersForFeature(e){const t=this.layer;e.layer=t,e.sourceLayer=t}_createHittestResult(e){return this._setLayersForFeature(e),h(e.geometry)&&(e.geometry.spatialReference=this.view.spatialReference),e}};e([m()],M.prototype,"_serviceOptions",void 0),e([m()],M.prototype,"_proxy",void 0),e([m()],M.prototype,"_pipelineIsUpdating",void 0),e([m()],M.prototype,"_effectiveRenderer",void 0),e([m()],M.prototype,"_aggregateValueRanges",void 0),e([m()],M.prototype,"_commandsQueue",void 0),e([m()],M.prototype,"featureEffectView",void 0),e([m()],M.prototype,"labelsVisible",null),e([m({readOnly:!0})],M.prototype,"queryMode",null),e([m()],M.prototype,"renderingConfigHash",null),e([m()],M.prototype,"tileRenderer",void 0),e([m()],M.prototype,"updating",void 0),M=e([_("esri.views.2d.layers.FeatureLayerView2D")],M);const B=M;export{B 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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import i from"../../../Graphic.js";import t from"../../../core/Collection.js";import{watch as r,syncAndInitial as s,sync as a}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{GraphicsCollection as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import i from"../../../Graphic.js";import t from"../../../core/Collection.js";import{watch as r,syncAndInitial as s,sync as a}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{GraphicsCollection as n}from"../../../support/GraphicsCollection.js";import l from"../engine/flow/AnimatedFlowView2D.js";import{LayerView2DMixin as u}from"./LayerView2D.js";import c from"./graphics/GraphicsView2D.js";import w from"./graphics/HighlightGraphicContainer.js";import d from"./imagery/ImageryView2D.js";import v from"./imagery/VectorFieldView2D.js";import{ImageryLayerView as p}from"../../layers/ImageryLayerView.js";import m from"../../layers/LayerView.js";import{RefreshableLayerView as y}from"../../layers/RefreshableLayerView.js";let g=class extends(p(y(u(m)))){constructor(){super(...arguments),this._exportImageVersion=-1,this._highlightGraphics=new n,this.subview=null}destroy(){var e;null==(e=this._highlightGraphics)||e.destroy()}get pixelData(){return this.updating?null:"getPixelData"in this.subview?this.subview.getPixelData():null}get updating(){return!!(!this.subview||"updating"in this.subview&&this.subview.updating)}async hitTest(e,i){return this.subview?[this.subview.hitTest(e)]:null}update(e){var i;null==(i=this.subview)||i.update(e)}attach(){this.layer.increaseRasterJobHandlerUsage(),this._setSubView(),this.view&&(this._highlightView=new c({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new w(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container)),this.handles.add([r((()=>{var e,i;return this.subview&&null!=(e=null==(i=this.layer)?void 0:i.blendMode)?e:"normal"}),(e=>{this.subview&&(this.subview.container.blendMode=e)}),s),r((()=>{var e,i;return this.subview&&null!=(e=null==(i=this.layer)?void 0:i.effect)?e:null}),(e=>{this.subview&&(this.subview.container.effect=e)}),s),r((()=>{var e,i;return null==(e=this.layer)||null==(i=e.exportImageServiceParameters)?void 0:i.version}),(e=>{e&&this._exportImageVersion!==e&&(this._exportImageVersion=e,this.requestUpdate())}),a),r((()=>this.subview?this.layer.timeExtent:null),(e=>{"timeExtent"in this.subview&&(this.subview.timeExtent=e),this.requestUpdate()})),this.layer.on("redraw",(()=>{"redraw"in this.subview?this.subview.redraw():this.subview.redrawOrRefetch()})),r((()=>this.layer.renderer),(()=>this._setSubView()))],"imagerylayerview-update")}detach(){var e,i;this.layer.decreaseRasterJobHandlerUsage(),this._detachSubview(this.subview),null==(e=this.subview)||e.destroy(),null==(i=this._highlightView)||i.destroy(),this.container.removeAllChildren(),this.handles.remove("imagerylayerview-update"),this._exportImageVersion=-1}moveStart(){}viewChange(){}moveEnd(){this.requestUpdate()}highlight(e,r){if(!((Array.isArray(e)?e[0]:t.isCollection(e)?e.getItemAt(0):e)instanceof i))return{remove:()=>{}};let s=[];return Array.isArray(e)||t.isCollection(e)?s=e.map((e=>e.clone())):e instanceof i&&(s=[e.clone()]),this._highlightGraphics.addMany(s),{remove:()=>{this._highlightGraphics.removeMany(s)}}}async doRefresh(){this.requestUpdate()}isUpdating(){return!this.subview||this.subview.updating}_setSubView(){var e;if(!this.view)return;const i=null==(e=this.layer.renderer)?void 0:e.type;let t="Imagery";if("vector-field"===i&&"lerc"===this.layer.format?t="ImageryVF":"animated-flow"===i&&(t="Flow"),this.subview){var r;if(this.subview.type===t)return void this._attachSubview(this.subview);this._detachSubview(this.subview),null==(r=this.subview)||r.destroy(),this.subview=null}this.subview="Imagery"===t?new d({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):"ImageryVF"===t?new v({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):new l({layer:this.layer,layerView:this}),this._attachSubview(this.subview),this.requestUpdate()}_attachSubview(e){e&&!e.attached&&(e.attach(),e.attached=!0,this.container.addChildAt(e.container,0),e.container.blendMode=this.layer.blendMode,e.container.effect=this.layer.effect)}_detachSubview(e){null!=e&&e.attached&&(this.container.removeChild(e.container),e.detach(),e.attached=!1)}};e([h()],g.prototype,"pixelData",null),e([h({readOnly:!0})],g.prototype,"updating",null),e([h()],g.prototype,"subview",void 0),g=e([o("esri.views.2d.layers.ImageryLayerView2D")],g);const b=g;export{b 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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import s from"../../../Graphic.js";import
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import s from"../../../Graphic.js";import t from"../../../core/Logger.js";import{isAbortError as i}from"../../../core/promiseUtils.js";import{watch as r,syncAndInitial as o,initial as a}from"../../../core/reactiveUtils.js";import{watch as n}from"../../../core/watchUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import l from"../engine/flow/AnimatedFlowView2D.js";import{LayerView2DMixin as c}from"./LayerView2D.js";import d from"./imagery/ImageryTileView2D.js";import p from"./imagery/VectorFieldTileView2D.js";import{canUseMajorityInterpolationOnDataSource as v}from"./support/util.js";import{ImageryTileLayerView as w}from"../../layers/ImageryTileLayerView.js";import b from"../../layers/LayerView.js";import{RefreshableLayerView as m}from"../../layers/RefreshableLayerView.js";const y=t.getLogger("esri.views.2d.layers.ImageryTileLayerView2D");let g=class extends(w(m(c(b)))){constructor(){super(...arguments),this._useWebGLForProcessing=!0,this._useProgressiveUpdate=!0,this.subview=null}get useWebGLForProcessing(){return this._useWebGLForProcessing}set useWebGLForProcessing(e){this._useWebGLForProcessing=e,this.subview&&"useWebGLForProcessing"in this.subview&&(this.subview.useWebGLForProcessing=e)}get useProgressiveUpdate(){return this._useWebGLForProcessing}set useProgressiveUpdate(e){this._useProgressiveUpdate=e,this.subview&&"useProgressiveUpdate"in this.subview&&(this.subview.useProgressiveUpdate=e)}update(e){this.subview.update(e),this.notifyChange("updating")}isUpdating(){return!this.subview||this.subview.updating}attach(){this.layer.increaseRasterJobHandlerUsage(),this._updateSubview(),this.handles.add([n(this.layer,["bandIds","renderer","interpolation","multidimensionalDefinition"],((e,s,t)=>{const r="multidimensionalDefinition"===t,o="interpolation"===t&&("majority"===e||"majority"===s)&&v(this.layer),a="renderer"===t&&s.type!==e.type;a&&this._updateSubview();const n=r||o||a;this.subview.redrawOrRefetch(n).catch((e=>{i(e)||y.error(e)})),this.notifyChange("updating")})),r((()=>{var e,s;return this.subview&&null!=(e=null==(s=this.layer)?void 0:s.blendMode)?e:"normal"}),(e=>{this.subview&&(this.subview.container.blendMode=e)}),o),r((()=>{var e,s;return this.subview&&null!=(e=null==(s=this.layer)?void 0:s.effect)?e:null}),(e=>{this.subview&&(this.subview.container.effect=e)}),o),r((()=>this.timeExtent),(()=>{this.subview.redrawOrRefetch(!0).catch((e=>{i(e)||y.error(e)}))}),a)],"attach")}detach(){this.handles.remove("attach"),this.layer.decreaseRasterJobHandlerUsage(),this._detachSubview(this.subview)}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.subview.moveEnd()}async hitTest(e,t){return[new s({attributes:{},geometry:e.clone()})]}doRefresh(){return this.subview.doRefresh()}_updateSubview(){const e="vector-field"===this.layer.renderer.type?"rasterVF":"animated-flow"===this.layer.renderer.type?"rasterAnimatedFlow":"raster";if(this.subview){var s;if(this.subview.type===e)return void this._attachSubview(this.subview);this._detachSubview(this.subview),null==(s=this.subview)||s.destroy(),this.subview=null}const{layer:t}=this;let i;i="rasterVF"===e?new p({layer:t,layerView:this}):"rasterAnimatedFlow"===e?new l({layer:t,layerView:this}):new d({layer:t,layerView:this}),"useWebGLForProcessing"in i&&(i.useWebGLForProcessing=this._useWebGLForProcessing),"useProgressiveUpdate"in i&&(i.useProgressiveUpdate=this._useProgressiveUpdate),"previousLOD"in i&&(i.previousLOD=this.subview&&"previousLOD"in this.subview&&this.subview.previousLOD),this._attachSubview(i),this.subview=i,this.requestUpdate()}_attachSubview(e){e&&!e.attached&&(e.attach(),e.attached=!0,this.container.addChild(e.container),e.container.blendMode=this.layer.blendMode,e.container.effect=this.layer.effect)}_detachSubview(e){null!=e&&e.attached&&(this.container.removeChild(e.container),e.detach(),e.attached=!1,e.destroy())}};e([u()],g.prototype,"subview",void 0),e([u()],g.prototype,"useWebGLForProcessing",null),e([u()],g.prototype,"useProgressiveUpdate",null),g=e([h("esri.views.2d.layers.ImageryTileLayerView2D")],g);const f=g;export{f 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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{isSome as t,
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{isSome as t,applySome as s}from"../../../../../core/maybe.js";import"../../../../../core/Logger.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/accessorSupport/set.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{diff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{calculateHeatmapIntensityInfoReaders as o}from"../../../../../renderers/support/heatmapUtils.js";import{TILE_SIZE as a}from"../../../engine/webgl/definitions.js";import n from"./BaseProcessor.js";import{getPow2NeighborKey as d}from"../support/tileUtils.js";class p{constructor(e,t){this.offset=e,this.extent=t}}function c(e){const t=e.key,s=new Map,r=256,i=a,o=e.tileInfoView.tileInfo.isWrappable;return s.set(d(t,-1,-1,o).id,new p([-i,-i],[i-r,i-r,i,i])),s.set(d(t,0,-1,o).id,new p([0,-i],[0,i-r,i,i])),s.set(d(t,1,-1,o).id,new p([i,-i],[0,i-r,r,i])),s.set(d(t,-1,0,o).id,new p([-i,0],[i-r,0,i,i])),s.set(d(t,1,0,o).id,new p([i,0],[0,0,r,i])),s.set(d(t,-1,1,o).id,new p([-i,i],[i-r,0,i,r])),s.set(d(t,0,1,o).id,new p([0,i],[0,0,i,r])),s.set(d(t,1,1,o).id,new p([i,i],[0,0,r,r])),s}let l=class extends n{constructor(){super(...arguments),this.type="heatmap",this._tileKeyToFeatureSets=new Map}initialize(){this.handles.add([this.tileStore.on("update",this.onTileUpdate.bind(this))])}async update(e,t){const s=t.schema.processors[0];if("heatmap"!==s.type)return;i(this._schema,s)&&(e.mesh=!0,this._schema=s)}onTileUpdate(e){for(const t of e.removed)this._tileKeyToFeatureSets.delete(t.key.id)}onTileClear(e){const t={clear:!0};return this._tileKeyToFeatureSets.delete(e.key.id),this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:e.id,data:t})}async onTileMessage(e,r,i){this._tileKeyToFeatureSets.has(e.key.id)||this._tileKeyToFeatureSets.set(e.key.id,new Map);const a=this._tileKeyToFeatureSets.get(e.key.id);if(t(r.addOrUpdate)&&r.addOrUpdate.hasFeatures&&a.set(r.addOrUpdate.instance,r),r.end){const t=[],r=c(e);this._tileKeyToFeatureSets.forEach(((i,o)=>{if(o===e.key.id)i.forEach((e=>s(e.addOrUpdate,(e=>t.push(e)))));else if(r.has(o)){const e=r.get(o),[a,n]=e.offset;i.forEach((e=>s(e.addOrUpdate,(e=>{const s=e.transform(a,n,1,1);t.push(s)}))))}}));const a=o(t,this._schema.mesh,512,512),n={tileKey:e.key.id,intensityInfo:a},d=[a.matrix];return this.remoteClient.invoke("tileRenderer.onTileData",n,{...i,transferList:d})}}onTileError(e,t,s){return this.remoteClient.invoke("tileRenderer.onTileError",{tileKey:e.id,error:t},s)}};l=e([r("esri.views.2d.layers.features.processors.HeatmapProcessor")],l);const h=l;export{h 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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{bidiText as t}from"../../../../../core/BidiText.js";import"../../../../../core/Error.js";import s from"../../../../../core/has.js";import r from"../../../../../core/Logger.js";import{
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{bidiText as t}from"../../../../../core/BidiText.js";import"../../../../../core/Error.js";import s from"../../../../../core/has.js";import r from"../../../../../core/Logger.js";import{applySome as i,isNone as a,isSome as o,unwrapOrThrow as n,unwrap as l}from"../../../../../core/maybe.js";import{throwIfAborted as c,all as d,isAbortError as f}from"../../../../../core/promiseUtils.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/accessorSupport/set.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{diff as u,hasDiff as m}from"../../../../../core/accessorSupport/diffUtils.js";import p from"../../../../../geometry/SpatialReference.js";import{isAggregateId as g}from"../../../engine/webgl/DisplayId.js";import{MeshData as y}from"../../../engine/webgl/mesh/MeshData.js";import{WGLMeshFactory as _}from"../../../engine/webgl/mesh/factories/WGLMeshFactory.js";import{WGLTemplateStore as b}from"../../../engine/webgl/mesh/templates/WGLTemplateStore.js";import{createMatcher as S}from"../../../engine/webgl/util/Matcher.js";import{codepoints as w}from"../textUtils.js";import I from"./BaseProcessor.js";import M from"../support/ResourceManagerProxy.js";function v(e,t){return(!e.minScale||e.minScale>=t)&&(!e.maxScale||e.maxScale<=t)}function x(e){const t=e.message,s={message:{data:{},tileKey:t.tileKey,tileKeyOrigin:t.tileKeyOrigin},transferList:new Array};for(const r in t.data){const e=t.data[r];if(s.message.data[r]=null,o(e)){const t=e.stride,a=e.indices.slice(0),o=e.vertices.slice(0),n=e.records.slice(0),l={stride:t,indices:a,vertices:o,records:n,metrics:i(e.metrics,(e=>e.slice(0)))};s.transferList.push(a,o,n),s.message.data[r]=l}}return s}r.getLogger("esri.views.2d.layers.features.processors.SymbolProcessor");let j=class extends I{constructor(){super(...arguments),this.type="symbol",this._matchers={feature:null,aggregate:null},this._bufferData=new Map,this._bufferIds=new Map}initialize(){this.handles.add([this.tileStore.on("update",this.onTileUpdate.bind(this))]),this._resourceManagerProxy=new M(this.remoteClient)}destroy(){this._resourceManagerProxy.destroy()}get supportsTileUpdates(){return!0}forEachBufferId(e){this._bufferIds.forEach((t=>{t.forEach(e)}))}async update(e,t){const r=t.schema.processors[0];if("symbol"!==r.type)return;const i=u(this._schema,r);m(i,"mesh")&&(s("esri-2d-update-debug")&&console.debug("Applying Update - Processor:",i),e.mesh=!0,e.why.mesh.push("Symbology changed"),this._schema=r,this._factory=this._createFactory(r),this._factory.update(r,this.tileStore.tileScheme.tileInfo))}onTileMessage(e,t,s,r){return c(r),this._onTileData(e,t,s,r)}onTileClear(e){const t={clear:!0};return this._bufferData.delete(e.key.id),this._bufferIds.delete(e.key.id),this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:e.id,data:t})}onTileError(e,t,s){const r=s.signal,i={tileKey:e.id,error:t};return this.remoteClient.invoke("tileRenderer.onTileError",i,{signal:r})}onTileUpdate(e){for(const t of e.removed)this._bufferData.has(t.key.id)&&this._bufferData.delete(t.key.id),this._bufferIds.has(t.key.id)&&this._bufferIds.delete(t.key.id);for(const t of e.added)this._bufferData.forEach((e=>{for(const s of e)s.message.tileKey===t.id&&this._updateTileMesh("append",t,x(s),[],!1,!1,null)}))}_addBufferData(e,t){this._bufferData.has(e)||this._bufferData.set(e,[]),this._bufferData.get(e).push(x(t))}_createFactory(e){const{geometryType:t,objectIdField:s,fields:r}=this.service,a=(e,t)=>this.remoteClient.invoke("tileRenderer.getMaterialItems",e,t),o={geometryType:t,fields:r,spatialReference:p.fromJSON(this.spatialReference)},n=new b(a,this.tileStore.tileScheme.tileInfo),{matcher:l,aggregateMatcher:c}=e.mesh;return this._store=n,this._matchers.feature=S(l,n,o,this._resourceManagerProxy),this._matchers.aggregate=i(c,(e=>S(e,n,o,this._resourceManagerProxy))),new _(t,s,n)}async _onTileData(e,t,s,r){c(r);const{type:i,addOrUpdate:n,remove:l}=t,f=t.end,h=!!this._schema.mesh.sortKey;if(!n){const t={type:i,addOrUpdate:null,remove:l,clear:!1,end:f,sort:h};return this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:e.id,data:t},r)}const u=this._processFeatures(e,n,s,r);try{const s=await u;if(a(s)){const t={type:i,addOrUpdate:null,remove:l,clear:!1,end:f,sort:h};return this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:e.id,data:t},r)}const n=[];for(const t of s){let s=!1;const r=t.message.bufferIds,i=e.key.id,a=t.message.tileKey;if(i!==a&&o(r)){if(!this.tileStore.get(a)){this._addBufferData(i,t),n.push(t);continue}let e=this._bufferIds.get(a);e||(e=new Set,this._bufferIds.set(a,e));const o=Array.from(r);for(const t of o){if(e.has(t)){s=!0;break}e.add(t)}}s||(this._addBufferData(i,t),n.push(t))}await d(n.map((s=>{const a=e.key.id===s.message.tileKey,o=a?t.remove:[],n=a&&t.end;return this._updateTileMesh(i,e,s,o,n,t.clear,r.signal)})))}catch(m){this._handleError(e,m,r)}}async _updateTileMesh(e,t,s,r,a,o,n){const d=e,f=s.message.tileKey,h=!!this._schema.mesh.sortKey;f!==t.key.id&&(a=!1);const u=i(s,(e=>e.message)),m=i(s,(e=>e.transferList))||[],p={type:d,addOrUpdate:u,remove:r,clear:!1,end:a,sort:h},g={transferList:l(m)||[],signal:n};return c(g),this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:f,data:p},g)}async _processFeatures(e,t,s,r){if(a(t)||!t.hasFeatures)return null;const i={transform:e.transform,hasZ:!1,hasM:!1},o=this._factory,n={viewingMode:"",scale:e.scale},l=await this._matchers.feature,d=await this._matchers.aggregate;c(r);const f=this._getLabelInfos(e,t);return await o.analyze(t.getCursor(),this._resourceManagerProxy,l,d,i,n),c(r),this._writeFeatureSet(e,t,i,f,o,s)}_writeFeatureSet(e,t,s,r,i,a){const n=t.getSize(),l=new y(e.key.id,{features:n,records:n,metrics:0},this._schema.mesh.matcher.stride,a,!0),c={viewingMode:"",scale:e.scale},d=t.getCursor();for(;d.next();)try{const t=d.getDisplayId(),a=o(r)?r.get(t):null;i.writeCursor(l,d,s,c,e.level,a,this._resourceManagerProxy)}catch(h){}const f=e.tileInfoView.tileInfo.isWrappable;return l.serialize(f)}_handleError(e,t,s){if(!f(t)){const r={tileKey:e.id,error:t.message};return this.remoteClient.invoke("tileRenderer.onTileError",r,{signal:s.signal})}}_getLabelingSchemaForScale(e){const t=this._schema.mesh.labels;if(a(t))return null;if("subtype"===t.type){const s={type:"subtype",classes:{}};let r=!1;for(const i in t.classes){const a=t.classes[i].filter((t=>v(t,e.scale)));r=r||!!a.length,s.classes[i]=a}return r?s:null}const s=t.classes.filter((t=>v(t,e.scale)));return s.length?{type:"simple",classes:s}:null}_getLabels(e,t){if("subtype"===t.type){var s;const r=this.service.subtypeField,i=n(r,"Expected to find subtype Field"),a=e.readAttribute(i);return null==a?[]:null!=(s=t.classes[a])?s:[]}return t.classes}_getLabelInfos(e,s){const r=this._getLabelingSchemaForScale(e);if(a(r))return null;const i=new Map,o=s.getCursor();for(;o.next();){const e=o.getDisplayId(),s=[],a=g(e),n=a&&1!==o.readAttribute("cluster_count")?"aggregate":"feature",l=this._getLabels(o,r);for(const r of l){if(r.target!==n)continue;const i=o.getStorage(),l=a&&"feature"===n?i.getComputedStringAtIndex(o.readAttribute("referenceId"),r.fieldIndex):i.getComputedStringAtIndex(e,r.fieldIndex);if(!l)continue;const c=t(l.toString()),d=c[0],f=c[1];this._store.getMosaicItem(r.symbol,w(d)).then((e=>{s[r.index]={glyphs:e.glyphMosaicItems,rtl:f,index:r.index}}))}i.set(e,s)}return i}};j=e([h("esri.views.2d.layers.features.processors.SymbolProcessor")],j);const T=j;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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../../core/Error.js";import e from"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import{clamp as s}from"../../../../../core/mathUtils.js";import{isNone as r,isSome as a,mapMany as o,forEachSome as n,andThen as l,unwrap as h}from"../../../../../core/maybe.js";import{createResolver as c,isAbortError as u}from"../../../../../core/promiseUtils.js";import{diff as d}from"../../../../../core/accessorSupport/diffUtils.js";import p from"../../../../../layers/support/FieldsIndex.js";import{MAX_FILTERS as _,HIGHLIGHT_FLAG as g,ATTRIBUTE_DATA_VV as f,NAN_MAGIC_NUMBER as m,ATTRIBUTE_DATA_ANIMATION as y}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TYPE_AGGREGATE as x,DISPLAY_ID_TYPE_FEATURE as b,getDisplayIdTexel as T,getDisplayIdType as z,getDisplayIdFilterMask as S}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as w}from"../../../engine/webgl/Utils.js";import{createDebugLogger as A,DEBUG_ATTR_UPDATES as E}from"../../../engine/webgl/util/debug.js";import{getVisualVariableSizeValueRepresentationRatio as D}from"../tileRenderers/support/visualVariablesUtils.js";import{PixelType as k}from"../../../../webgl/enums.js";const U=i.getLogger("esri.views.layers.2d.features.support.AttributeStore"),F=A(E,U),B={sharedArrayBuffer:e("esri-shared-array-buffer"),atomics:e("esri-atomics")};function C(t,e){return i=>e(t(i))}class R{constructor(t,e,i,s){this.size=0,this.texelSize=4;const{pixelType:r,layout:a,textureOnly:o}=s;this.textureOnly=o||!1,this.pixelType=r,this._ctype=e,this.layout=a,this._resetRange(),this._shared=t,this.size=i,o||(this.data=this._initData(r,i,t,e))}get buffer(){return l(this.data,(t=>t.buffer))}unsetComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=h(this.data);for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=T(t);return h(this.data)[i*this.texelSize+e]}setData(t,e,i){const s=T(t),r=1<<e;0!=(this.layout&r)?(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):U.error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}lock(){this.pixelType===k.UNSIGNED_BYTE&&this._shared&&B.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,1)}unlock(){this.pixelType===k.UNSIGNED_BYTE&&this._shared&&B.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,0)}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t,this._shared,this._ctype),i=h(this.data);e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!(this._shared||"local"===this._ctype),r=this.pixelType,a=this.layout,o=h(this.data);return{start:t,end:e,data:s&&o.slice(t*i,(e+1)*i)||null,pixelType:r,layout:a}}_initData(t,e,i,s){const r=i&&"local"!==s?SharedArrayBuffer:ArrayBuffer,a=w(t),o=new a(new r(e*e*4*a.BYTES_PER_ELEMENT));for(let n=0;n<o.length;n+=4)o[n+1]=255;return o}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class M{constructor(t,e){this._client=t,this.config=e,this._attributeComputeMap=new Map,this._blocks=new Array,this._filters=new Array(_),this._targetType=0,this._abortController=new AbortController,this._hasScaleExpr=!1,this._size=32,this._idsToHighlight=new Set;const i=e.supportsTextureFloat?k.FLOAT:k.UNSIGNED_BYTE;F(`Creating AttributeStore ${B.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:k.UNSIGNED_BYTE,layout:1},{pixelType:k.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:i,layout:15},{pixelType:i,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}destroy(){this._abortController.abort()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}update(t,i){this.config=i;const s=i.schema.processors[0].storage,o=d(this._schema,s);if((t.targets.feature||t.targets.aggregate)&&(t.storage.data=!0),o&&(e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",o),t.storage.data=!0,this._schema=s,this._attributeComputeMap.clear(),!r(s))){switch(s.target){case"feature":this._targetType=b;break;case"aggregate":this._targetType=x}if("subtype"===s.type)for(const t in s.mapping){const e=s.mapping[t];if(a(e))for(const t of e.mapping)this._bindAttribute(t)}else for(const t of s.mapping)this._bindAttribute(t)}}onTileData(t,e){if(r(e.addOrUpdate))return;const i=e.addOrUpdate.getCursor();for(;i.next();){const t=i.getDisplayId();this.setAttributeData(t,i)}}invalidateResources(){this._createResourcesPromise=null,this._abortController.abort(),this._abortController=new AbortController}async setHighlight(t,e){const i=1,s=this._getBlock(0),r=e.map((t=>T(t)));s.lock(),s.unsetComponentAllTexels(0,i),s.setComponent(0,i,r),s.unlock(),this._idsToHighlight.clear();for(const a of t)this._idsToHighlight.add(a);await this.sendUpdates()}async updateFilters(t,i){const{config:s,service:r,spatialReference:a}=i,{filters:o}=s,n=o.map(((t,e)=>this._updateFilter(t,e,r,a)));(await Promise.all(n)).some((t=>t))&&(t.storage.filters=!0,e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(t,e,i,s){const r=T(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlag(t){return this._idsToHighlight.has(t)?g:0}unsetAttributeData(t){const e=T(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e){const i=T(t);if(this._ensureSizeForTexel(i),this._getBlock(0).setData(i,0,this.getFilterFlags(e)),this._targetType!==z(t))return;const r=this._attributeComputeMap,a=this.config.supportsTextureFloat?1:2,o=4;r.size&&r.forEach(((t,r)=>{const n=r*a%o,l=Math.floor(r*a/o),h=this._getBlock(l+f),c=t(e);if(this.config.supportsTextureFloat)h.setData(i,n,c);else if(c===m)h.setData(i,n,255),h.setData(i,n+1,255);else{const t=s(Math.round(c),-32767,32766)+32768,e=255&t,r=(65280&t)>>8;h.setData(i,n,e),h.setData(i,n+1,r)}}))}sendUpdates(){if(this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=c(),this._nextUpdate.promise;const e={blocks:this._blocks.map((t=>a(t)?t.toMessage():null))};return this._currUpdate=this._createResources().then((()=>{const t=()=>{if(this._currUpdate=null,this._nextUpdate){const t=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then((()=>t.resolve()))}},i=this._client.update(e,this._signal).then(t).catch(t);return this._client.render(this._signal),i})).catch((e=>u(e)?(this._createResourcesPromise=null,this._createResources()):(U.error(new t("mapview-attribute-store","Encountered an error during client update",e)),Promise.resolve()))),this._currUpdate}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}_bindAttribute(t){function e(){return t.normalizationField?e=>{const i=e.readAttribute(t.normalizationField);if(!i)return null;return e.readAttribute(t.field)/i}:e=>e.readAttribute(t.field)}function i(){return t.normalizationField&&U.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),e=>e.getComputedNumericAtIndex(t.fieldIndex)}let s;if(null!=t.fieldIndex)s=i();else{if(!t.field)return;s=e()}if(t.valueRepresentation){s=C(s,(e=>D(e,t.valueRepresentation)))}const r=t=>null===t||isNaN(t)||t===1/0?m:t;this._attributeComputeMap.set(t.binding,C(s,r))}_createResources(){if(a(this._createResourcesPromise))return this._createResourcesPromise;this._getBlock(y),F("Initializing AttributeStore");const e={shared:B.sharedArrayBuffer&&!("local"===this._client.type),size:this._size,blocks:o(this._blocks,(t=>({textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType})))},i=this._client.initialize(e,this._signal).catch((e=>{u(e)?this._createResourcesPromise=null:U.error(new t("mapview-attribute-store","Encountered an error during client initialization",e))}));return this._createResourcesPromise=i,i.then((()=>r(this._createResourcesPromise)?this._createResources():void 0)),i}_getBlock(t){const e=this._blocks[t];if(a(e))return e;F(`Initializing AttributeBlock at index ${t}`);const i=B.sharedArrayBuffer,s=this._client.type,r=new R(i,s,this._size,this._blockDescriptors[t]);return this._blocks[t]=r,this._createResourcesPromise=null,r}_expand(){if(this._size<this.config.maxTextureSize){const t=this._size<<=1;return F("Expanding block size to",t,this._blocks),n(this._blocks,(e=>e.expand(t))),this._createResourcesPromise=null,this._size=t,0}return U.error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}async _updateFilter(t,e,i,s){const o=this._filters[e],n=a(o)&&o.hash;if(!o&&!t)return!1;if(n===JSON.stringify(t))return!1;if(r(t)){if(!o)return!1;const t=1<<e+1,i=this._getBlock(0);return this._filters[e]=null,i.setComponentAllTexels(0,t),this.sendUpdates(),!0}const l=await this._getFilter(e,i);return await l.update(t,s),!0}async _getFilter(t,e){const i=this._filters[t];if(a(i))return i;const{default:s}=await import("./FeatureFilter.js"),r=new s({geometryType:e.geometryType,hasM:!1,hasZ:!1,timeInfo:e.timeInfo,fieldsIndex:new p(e.fields)});return this._filters[t]=r,r}isVisible(t){return!!(2&this._getBlock(0).getData(t,0))}getFilterFlags(t){let e=0;const i=S(t.getDisplayId());for(let a=0;a<this._filters.length;a++){const s=!!(i&1<<a),o=this._filters[a];e|=(!s||r(o)||o.check(t)?1:0)<<a}let s=0;if(this._idsToHighlight.size){const e=t.getObjectId();s=this.getHighlightFlag(e)}return e<<1|s}}export{M as default};
|
|
5
|
+
import t from"../../../../../core/Error.js";import e from"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import{clamp as s}from"../../../../../core/mathUtils.js";import{isNone as r,isSome as a,mapMany as o,forEachSome as n,applySome as l,unwrap as h}from"../../../../../core/maybe.js";import{createResolver as c,isAbortError as u}from"../../../../../core/promiseUtils.js";import{diff as d}from"../../../../../core/accessorSupport/diffUtils.js";import p from"../../../../../layers/support/FieldsIndex.js";import{MAX_FILTERS as _,HIGHLIGHT_FLAG as g,ATTRIBUTE_DATA_VV as f,NAN_MAGIC_NUMBER as m,ATTRIBUTE_DATA_ANIMATION as y}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TYPE_AGGREGATE as x,DISPLAY_ID_TYPE_FEATURE as b,getDisplayIdTexel as T,getDisplayIdType as z,getDisplayIdFilterMask as S}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as w}from"../../../engine/webgl/Utils.js";import{createDebugLogger as A,DEBUG_ATTR_UPDATES as E}from"../../../engine/webgl/util/debug.js";import{getVisualVariableSizeValueRepresentationRatio as D}from"../tileRenderers/support/visualVariablesUtils.js";import{PixelType as k}from"../../../../webgl/enums.js";const U=i.getLogger("esri.views.layers.2d.features.support.AttributeStore"),F=A(E,U),B={sharedArrayBuffer:e("esri-shared-array-buffer"),atomics:e("esri-atomics")};function C(t,e){return i=>e(t(i))}class R{constructor(t,e,i,s){this.size=0,this.texelSize=4;const{pixelType:r,layout:a,textureOnly:o}=s;this.textureOnly=o||!1,this.pixelType=r,this._ctype=e,this.layout=a,this._resetRange(),this._shared=t,this.size=i,o||(this.data=this._initData(r,i,t,e))}get buffer(){return l(this.data,(t=>t.buffer))}unsetComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=h(this.data);for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=T(t);return h(this.data)[i*this.texelSize+e]}setData(t,e,i){const s=T(t),r=1<<e;0!=(this.layout&r)?(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):U.error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}lock(){this.pixelType===k.UNSIGNED_BYTE&&this._shared&&B.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,1)}unlock(){this.pixelType===k.UNSIGNED_BYTE&&this._shared&&B.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,0)}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t,this._shared,this._ctype),i=h(this.data);e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!(this._shared||"local"===this._ctype),r=this.pixelType,a=this.layout,o=h(this.data);return{start:t,end:e,data:s&&o.slice(t*i,(e+1)*i)||null,pixelType:r,layout:a}}_initData(t,e,i,s){const r=i&&"local"!==s?SharedArrayBuffer:ArrayBuffer,a=w(t),o=new a(new r(e*e*4*a.BYTES_PER_ELEMENT));for(let n=0;n<o.length;n+=4)o[n+1]=255;return o}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class M{constructor(t,e){this._client=t,this.config=e,this._attributeComputeMap=new Map,this._blocks=new Array,this._filters=new Array(_),this._targetType=0,this._abortController=new AbortController,this._hasScaleExpr=!1,this._size=32,this._idsToHighlight=new Set;const i=e.supportsTextureFloat?k.FLOAT:k.UNSIGNED_BYTE;F(`Creating AttributeStore ${B.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:k.UNSIGNED_BYTE,layout:1},{pixelType:k.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:i,layout:15},{pixelType:i,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}destroy(){this._abortController.abort()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}update(t,i){this.config=i;const s=i.schema.processors[0].storage,o=d(this._schema,s);if((t.targets.feature||t.targets.aggregate)&&(t.storage.data=!0),o&&(e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",o),t.storage.data=!0,this._schema=s,this._attributeComputeMap.clear(),!r(s))){switch(s.target){case"feature":this._targetType=b;break;case"aggregate":this._targetType=x}if("subtype"===s.type)for(const t in s.mapping){const e=s.mapping[t];if(a(e))for(const t of e.mapping)this._bindAttribute(t)}else for(const t of s.mapping)this._bindAttribute(t)}}onTileData(t,e){if(r(e.addOrUpdate))return;const i=e.addOrUpdate.getCursor();for(;i.next();){const t=i.getDisplayId();this.setAttributeData(t,i)}}invalidateResources(){this._createResourcesPromise=null,this._abortController.abort(),this._abortController=new AbortController}async setHighlight(t,e){const i=1,s=this._getBlock(0),r=e.map((t=>T(t)));s.lock(),s.unsetComponentAllTexels(0,i),s.setComponent(0,i,r),s.unlock(),this._idsToHighlight.clear();for(const a of t)this._idsToHighlight.add(a);await this.sendUpdates()}async updateFilters(t,i){const{config:s,service:r,spatialReference:a}=i,{filters:o}=s,n=o.map(((t,e)=>this._updateFilter(t,e,r,a)));(await Promise.all(n)).some((t=>t))&&(t.storage.filters=!0,e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(t,e,i,s){const r=T(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlag(t){return this._idsToHighlight.has(t)?g:0}unsetAttributeData(t){const e=T(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e){const i=T(t);if(this._ensureSizeForTexel(i),this._getBlock(0).setData(i,0,this.getFilterFlags(e)),this._targetType!==z(t))return;const r=this._attributeComputeMap,a=this.config.supportsTextureFloat?1:2,o=4;r.size&&r.forEach(((t,r)=>{const n=r*a%o,l=Math.floor(r*a/o),h=this._getBlock(l+f),c=t(e);if(this.config.supportsTextureFloat)h.setData(i,n,c);else if(c===m)h.setData(i,n,255),h.setData(i,n+1,255);else{const t=s(Math.round(c),-32767,32766)+32768,e=255&t,r=(65280&t)>>8;h.setData(i,n,e),h.setData(i,n+1,r)}}))}sendUpdates(){if(this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=c(),this._nextUpdate.promise;const e={blocks:this._blocks.map((t=>a(t)?t.toMessage():null))};return this._currUpdate=this._createResources().then((()=>{const t=()=>{if(this._currUpdate=null,this._nextUpdate){const t=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then((()=>t.resolve()))}},i=this._client.update(e,this._signal).then(t).catch(t);return this._client.render(this._signal),i})).catch((e=>u(e)?(this._createResourcesPromise=null,this._createResources()):(U.error(new t("mapview-attribute-store","Encountered an error during client update",e)),Promise.resolve()))),this._currUpdate}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}_bindAttribute(t){function e(){return t.normalizationField?e=>{const i=e.readAttribute(t.normalizationField);if(!i)return null;return e.readAttribute(t.field)/i}:e=>e.readAttribute(t.field)}function i(){return t.normalizationField&&U.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),e=>e.getComputedNumericAtIndex(t.fieldIndex)}let s;if(null!=t.fieldIndex)s=i();else{if(!t.field)return;s=e()}if(t.valueRepresentation){s=C(s,(e=>D(e,t.valueRepresentation)))}const r=t=>null===t||isNaN(t)||t===1/0?m:t;this._attributeComputeMap.set(t.binding,C(s,r))}_createResources(){if(a(this._createResourcesPromise))return this._createResourcesPromise;this._getBlock(y),F("Initializing AttributeStore");const e={shared:B.sharedArrayBuffer&&!("local"===this._client.type),size:this._size,blocks:o(this._blocks,(t=>({textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType})))},i=this._client.initialize(e,this._signal).catch((e=>{u(e)?this._createResourcesPromise=null:U.error(new t("mapview-attribute-store","Encountered an error during client initialization",e))}));return this._createResourcesPromise=i,i.then((()=>r(this._createResourcesPromise)?this._createResources():void 0)),i}_getBlock(t){const e=this._blocks[t];if(a(e))return e;F(`Initializing AttributeBlock at index ${t}`);const i=B.sharedArrayBuffer,s=this._client.type,r=new R(i,s,this._size,this._blockDescriptors[t]);return this._blocks[t]=r,this._createResourcesPromise=null,r}_expand(){if(this._size<this.config.maxTextureSize){const t=this._size<<=1;return F("Expanding block size to",t,this._blocks),n(this._blocks,(e=>e.expand(t))),this._createResourcesPromise=null,this._size=t,0}return U.error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}async _updateFilter(t,e,i,s){const o=this._filters[e],n=a(o)&&o.hash;if(!o&&!t)return!1;if(n===JSON.stringify(t))return!1;if(r(t)){if(!o)return!1;const t=1<<e+1,i=this._getBlock(0);return this._filters[e]=null,i.setComponentAllTexels(0,t),this.sendUpdates(),!0}const l=await this._getFilter(e,i);return await l.update(t,s),!0}async _getFilter(t,e){const i=this._filters[t];if(a(i))return i;const{default:s}=await import("./FeatureFilter.js"),r=new s({geometryType:e.geometryType,hasM:!1,hasZ:!1,timeInfo:e.timeInfo,fieldsIndex:new p(e.fields)});return this._filters[t]=r,r}isVisible(t){return!!(2&this._getBlock(0).getData(t,0))}getFilterFlags(t){let e=0;const i=S(t.getDisplayId());for(let a=0;a<this._filters.length;a++){const s=!!(i&1<<a),o=this._filters[a];e|=(!s||r(o)||o.check(t)?1:0)<<a}let s=0;if(this._idsToHighlight.size){const e=t.getObjectId();s=this.getHighlightFlag(e)}return e<<1|s}}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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../geometry.js";import e from"../../../../../core/Evented.js";import t from"../../../../../core/has.js";import{isNone as s,isSome as r,
|
|
5
|
+
import"../../../../../geometry.js";import e from"../../../../../core/Evented.js";import t from"../../../../../core/has.js";import{isNone as s,isSome as r,applySome as a}from"../../../../../core/maybe.js";import{diff as i,hasDiff as o}from"../../../../../core/accessorSupport/diffUtils.js";import{GeohashTree as h}from"../../../../../geohash/GeohashTree.js";import{setGeohashBuf as l,setGeohashXY as n}from"../../../../../geohash/geohashUtils.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{getInfo as c}from"../../../../../geometry/support/spatialReferenceUtils.js";import{quantizeX as g,quantizeY as d}from"../../../../../layers/graphics/featureConversionUtils.js";import p,{OptimizedFeatureWithGeometry as f}from"../../../../../layers/graphics/OptimizedFeature.js";import _ from"../../../../../layers/graphics/OptimizedGeometry.js";import{checkProjectionSupport as m,project as y}from"../../../../../layers/graphics/data/projectionSupport.js";import{TILE_SIZE as v}from"../../../engine/webgl/definitions.js";import{Store2D as I}from"../Store2D.js";import{FeatureSetReaderJSON as b}from"./FeatureSetReaderJSON.js";import R from"../../../../../geometry/SpatialReference.js";const C=12,M=1;class x extends f{constructor(e,t,s,r,a){super(new _([],[t,s]),r,null,e),this.geohashBoundsInfo=a}get count(){return this.attributes.cluster_count}static create(e,t,s,r,a,i,o,h){const l=new x(t,s,r,i,o);return l.displayId=e.createDisplayId(!0),l.referenceId=h,l.tileLevel=a,l}update(e,t,s,r,a,i){return this.geometry.coords[0]=e,this.geometry.coords[1]=t,this.tileLevel=s,this.attributes=r,this.geohashBoundsInfo=a,this.referenceId=null,this.referenceId=i,this}toJSON(){return{objectId:this.objectId,referenceId:1===this.attributes.cluster_count?this.referenceId:null,attributes:{...this.attributes,clusterId:this.objectId},geometry:{x:this.geometry.coords[0],y:this.geometry.coords[1]}}}}function L(e){return 57.29577951308232*e}class j extends I{constructor(t,s,r){super(t,r),this.events=new e,this._geohashLevel=0,this._tileLevel=0,this._aggregateValueRanges={},this._aggregateValueRangesChanged=!1,this._geohashBuf=[],this._clusters=new Map,this._tiles=new Map,this.geometryInfo=t.geometryInfo,this._spatialReference=s,this._projectionSupportCheck=m(s,R.WGS84),this._bitsets.geohash=r.getBitset(r.createBitset()),this._bitsets.inserted=r.getBitset(r.createBitset())}async updateSchema(e,r){const a=this._schema;try{await super.updateSchema(e,r),await this._projectionSupportCheck}catch(n){}const l=i(a,r);r&&(!s(l)||e.source||e.storage.filters)?((o(l,"params.fields")||!this._tree||e.source)&&(this._tree=new h(this._statisticFields),this._rebuildTree(),t("esri-2d-update-debug")&&console.debug("Aggregate mesh needs update due to tree changing")),t("esri-2d-update-debug")&&console.debug("Applying Update - ClusterStore:",l),e.targets[r.name]=!0,e.mesh=!1,this._aggregateValueRanges={}):a&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet((s=>{if(!e.has(s)){const e=t.lookupByDisplayIdUnsafe(s);this._remove(e)}}))}sweepClusters(e,t,s){this._clusters.forEach(((r,a)=>{r&&r.tileLevel!==s&&(e.releaseDisplayId(r.displayId),t.unsetAttributeData(r.displayId),this._clusters.delete(a))}))}onTileData(e,t,r,a,i=!0){if(!this._schema||s(t.addOrUpdate))return t;const o=this._getTransforms(e,this._spatialReference);{const e=t.addOrUpdate.getCursor();for(;e.next();)this._update(e,a)}if(t.status.mesh||!i)return t;const h=new Array,l=this._schema.params.clusterRadius;this._getClustersForTile(h,e,l,r,o),t.addOrUpdate=b.fromOptimizedFeatures(h,"esriGeometryPoint"),t.addOrUpdate.attachStorage(r),t.end=!0;{const s=t.addOrUpdate.getCursor();for(;s.next();){const t=s.getDisplayId();this._bitsets.computed.unset(t),this.setComputedAttributes(r,s,t,e.scale)}}return this._aggregateValueRangesChanged&&t.end&&(this.events.emit("valueRangesChanged",{valueRanges:this._aggregateValueRanges}),this._aggregateValueRangesChanged=!1),t}onTileUpdate({added:e,removed:t}){if(e.length){const t=e[0].level;this._tileLevel=t,this._setGeohashLevel(t)}if(!this._schema)return;const s=this._schema.params.clusterRadius;t.forEach((e=>{this._tiles.delete(e.key.id),this._markTileClustersForDeletion(e,s)}))}getAggregate(e){for(const t of this._clusters.values())if((null==t?void 0:t.displayId)===e)return t.toJSON();return null}getAggregates(){const e=[];for(const t of this._clusters.values())(null==t?void 0:t.tileLevel)===this._tileLevel&&e.push(t.toJSON());return e}getDisplayId(e){const t=this._clusters.get(e);return t?t.displayId:null}getFeatureDisplayIdsForAggregate(e){const t=this._clusters.get(e);if(!t)return[];const s=t.geohashBoundsInfo;return this._tree.getRegionDisplayIds(s.xLL,s.yLL,s.xTR,s.yTR,s.level)}getDisplayIdForReferenceId(e){for(const t of this._clusters.values())if((null==t?void 0:t.referenceId)===e)return t.displayId;return null}getAggregateValueRanges(){return this._aggregateValueRanges}forEach(e){for(const[t,s]of this._clusters)s&&e(s,t)}size(){let e=0;return this.forEach((t=>e++)),e}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),a=this._geohashBuf[2*t],i=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,a,i,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,a=t.isVisible(s);if(a===r.has(s))return;if(!a)return void this._remove(e);const i=e.getXHydrated(),o=e.getYHydrated();if(!this._setGeohash(s,i,o))return;const h=this._geohashBuf[2*s],l=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,i,o,h,l,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const a=L(t/u.radius),i=a-360*Math.floor((a+180)/360),o=L(Math.PI/2-2*Math.atan(Math.exp(-s/u.radius)));l(r,e,o,i,C)}else{const a=y({x:t,y:s},this._spatialReference,R.WGS84);if(!a)return!1;l(r,e,a.y,a.x,C)}return this._bitsets.geohash.set(e),!0}_getClustersForTile(e,t,i,o,h,l=!0){const n=this._schema.params.clusterPixelBuffer,u=2*i,c=this._getGeohashLevel(t.key.level),f=Math.ceil(2**t.key.level*v/u),_=Math.ceil(n/u)+0,m=Math.ceil(v/u),{row:y,col:I}=t.key,b=I*v,R=y*v,C=Math.floor(b/u)-_,M=Math.floor(R/u)-_,x=C+m+2*_,L=M+m+2*_,j=t.tileInfoView.getLODInfoAt(t.key.level);for(let v=C;v<=x;v++)for(let i=M;i<=L;i++){let n=v;j.wrap&&(n=v<0?v+f:v%f);const u=j.wrap&&v<0,_=j.wrap&&v%f!==v,m=this._lookupCluster(o,j,t.key.level,n,i,c);if(r(m)){const t=a(h,(e=>u?e.left:_?e.right:e.tile));if(l&&s(t))continue;if(!m.count)continue;if(r(t)&&l){const s=m.geometry.clone();let a=m.attributes;s.coords[0]=g(t,s.coords[0]),s.coords[1]=d(t,s.coords[1]),1===m.count&&r(m.referenceId)&&(a={...m.attributes,referenceId:m.referenceId});const i=new p(s,a);i.displayId=m.displayId,e.push(i)}}}}_getGeohashLevel(e){return Math.min(Math.ceil(e/2+2),C)}_setGeohashLevel(e){const t=this._getGeohashLevel(e),s=(Math.floor(t/M)+1)*M-1;if(this._geohashLevel!==s)return this._geohashLevel=s,this._rebuildTree(),void this._bitsets.geohash.clear()}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=c(t);if(!r)return{tile:s,left:null,right:null};const[a,i]=r.valid;return{tile:s,left:{...s,translate:[i,e.bounds[3]]},right:{...s,translate:[a-i+e.bounds[0],e.bounds[3]]}}}_getClusterId(e,t,s){return(15&e)<<28|(16383&t)<<14|16383&s}_markForDeletion(e,t,s){const r=this._getClusterId(e,t,s);this._clusters.delete(r)}_getClusterBounds(e,t,s){const r=this._schema.params.clusterRadius,a=2*r;let i=s%2?t*a:t*a-r;const o=s*a;let h=i+a;const l=o-a,n=2**e.level*v;e.wrap&&i<0&&(i=0),e.wrap&&h>n&&(h=n);const u=i/v,c=o/v,g=h/v,d=l/v;return[e.getXForColumn(u),e.getYForRow(c),e.getXForColumn(g),e.getYForRow(d)]}_lookupCluster(e,t,s,a,i,o){const h=this._getClusterId(s,a,i),l=this._clusters.get(h),[c,g,d,p]=this._getClusterBounds(t,a,i),f={x:c,y:g},_={x:d,y:p};let m=0,v=0,I=0,b=0;if(this._spatialReference.isWebMercator){{const e=L(f.x/u.radius);m=e-360*Math.floor((e+180)/360),v=L(Math.PI/2-2*Math.atan(Math.exp(-f.y/u.radius)))}{const e=L(_.x/u.radius);I=e-360*Math.floor((e+180)/360),b=L(Math.PI/2-2*Math.atan(Math.exp(-_.y/u.radius)))}}else{const e=y(f,this._spatialReference,R.WGS84),t=y(_,this._spatialReference,R.WGS84);if(!e||!t)return null;m=e.x,v=e.y,I=t.x,b=t.y}const C={geohashX:0,geohashY:0},M={geohashX:0,geohashY:0};n(C,v,m,o),n(M,b,I,o);const j=C.geohashX,w=C.geohashY,V=M.geohashX,S=M.geohashY,F={xLL:j,yLL:w,xTR:V,yTR:S,level:o},T=this._tree.getRegionStatistics(j,w,V,S,o),{count:D,xTotal:k,yTotal:B,referenceId:G}=T,O=D?k/D:0,A=D?B/D:0;if(0===D)return this._clusters.set(h,null),null;const U={cluster_count:D,...T.attributes},X=r(l)?l.update(O,A,s,U,F,G):x.create(e,h,O,A,s,U,F,G);return 0===D&&(X.geometry.coords[0]=(c+d)/2,X.geometry.coords[1]=(g+p)/2),this._clusters.set(h,X),this._updateAggregateValueRangeForCluster(X,X.tileLevel),X}_updateAggregateValueRangeForCluster(e,t){const s=this._aggregateValueRanges[t]||{minValue:1/0,maxValue:0},r=s.minValue,a=s.maxValue;s.minValue=Math.min(r,e.count),s.maxValue=Math.max(a,e.count),this._aggregateValueRanges[t]=s,r===s.minValue&&a===s.maxValue||(this._aggregateValueRangesChanged=!0)}_markTileClustersForDeletion(e,t){const s=2*t,r=Math.ceil(v/s),{row:a,col:i}=e.key,o=i*v,h=a*v,l=Math.floor(o/s),n=Math.floor(h/s);for(let u=l;u<l+r;u++)for(let t=n;t<n+r;t++)this._markForDeletion(e.key.level,u,t)}}export{x as ClusterInfo,j as ClusterStore};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isNone as t,isSome as e}from"../../../../../core/maybe.js";import{convertFromFeatures as r,convertFromFeatureSet as s,convertToFeature as i,convertToGeometry as n,getQuantizedArea as o,unquantizeOptimizedGeometry as a}from"../../../../../layers/graphics/featureConversionUtils.js";import{hasGeometry as u}from"../../../../../layers/graphics/OptimizedFeature.js";import{FeatureSetReader as h}from"./FeatureSetReader.js";function c({coords:t,lengths:e}){let r=0;for(const s of e){for(let e=1;e<s;e++)t[2*(r+e)]+=t[2*(r+e)-2],t[2*(r+e)+1]+=t[2*(r+e)-1];r+=s}}class d extends h{constructor(t,e,r){super(t),this._featureIndex=-1,this._dateFields=new Set,this._geometryType=r,this._features=e}static fromFeatures(t,e,s){const i=r([],t,e,!1,!1,s);for(let r=0;r<i.length;r++)i[r].displayId=t[r].displayId;return d.fromOptimizedFeatures(i,e)}static fromFeatureSet(t,e){const r=s(t,e);return d.fromOptimizedFeatureSet(r)}static fromOptimizedFeatureSet(t){const{features:e,geometryType:r}=t,s=d.fromOptimizedFeatures(e,r);s._exceededTransferLimit=t.exceededTransferLimit,s._transform=t.transform;for(const i of t.fields)"esriFieldTypeDate"===i.type&&s._dateFields.add(i.name);return s}static fromOptimizedFeatures(t,e,r){const s=h.createInstance(),i=new d(s,t,e);return i._transform=r,i}get _current(){return this._features[this._featureIndex]}get geometryType(){return this._geometryType}get hasFeatures(){return!!this._features.length}get hasNext(){return this._featureIndex+1<this._features.length}get exceededTransferLimit(){return this._exceededTransferLimit}get hasZ(){return!1}get hasM(){return!1}removeIds(t){const e=new Set(t);this._features=this._features.filter((t=>!e.has(t.objectId)))}append(t){for(const e of t)this._features.push(e)}getSize(){return this._features.length}getCursor(){return this.copy()}getQuantizationTransform(){return this._transform}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getIndex(){return this._featureIndex}setIndex(t){this._featureIndex=t}getObjectId(){return this._current.objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){this._current.displayId=t}getGroupId(){return this._current.groupId}setGroupId(t){this._current.groupId=t}copy(){const t=new d(this.instance,this._features,this.geometryType);return this.copyInto(t),t}next(){for(;++this._featureIndex<this._features.length&&!this._getExists(););return this._featureIndex<this._features.length}readLegacyFeature(){return i(this._current,this.geometryType,this.hasZ,this.hasM)}readOptimizedFeature(){return this._current}readLegacyPointGeometry(){return this.readGeometry()?{x:this.getX(),y:this.getY()}:null}readLegacyGeometry(){const t=this.readGeometry();return n(t,this.geometryType,this.hasZ,this.hasM)}readLegacyCentroid(){const e=this.readCentroid();return t(e)?null:{x:e.coords[0]*this._sx+this._tx,y:e.coords[1]*this._sy+this._ty}}readGeometryArea(){return u(this._current)?o(this._current.geometry,2):0}readUnquantizedGeometry(){const t=this.readGeometry();if("esriGeometryPoint"===this.geometryType||!t)return t;const e=t.clone();return c(e),e}readHydratedGeometry(){const r=this._current.geometry;if(t(r))return null;const s=r.clone();return e(this._transform)&&a(s,s,this.hasZ,this.hasM,this._transform),s}getXHydrated(){if(!u(this._current))return 0;const e=this._current.geometry.coords[0],r=this.getQuantizationTransform();return t(r)?e:e*r.scale[0]+r.translate[0]}getYHydrated(){if(!u(this._current))return 0;const e=this._current.geometry.coords[1],r=this.getQuantizationTransform();return t(r)?e:r.translate[1]-e*r.scale[1]}getX(){return u(this._current)?this._current.geometry.coords[0]*this._sx+this._tx:0}getY(){return u(this._current)?this._current.geometry.coords[1]*this._sy+this._ty:0}readGeometry(){if(!u(this._current))return null;const t=this._current.geometry.clone();if(t.isPoint)return t.coords[0]=t.coords[0]*this._sx+this._tx,t.coords[1]=t.coords[1]*this._sy+this._ty,t;let e=0;for(const r of t.lengths)t.coords[2*e]=t.coords[2*e]*this._sx+this._tx,t.coords[2*e+1]=t.coords[2*e+1]*this._sy+this._ty,e+=r;return t}readCentroid(){if(!u(this._current))return null;if(
|
|
5
|
+
import{isNone as t,isSome as e}from"../../../../../core/maybe.js";import{convertFromFeatures as r,convertFromFeatureSet as s,convertToFeature as i,convertToGeometry as n,getQuantizedArea as o,unquantizeOptimizedGeometry as a}from"../../../../../layers/graphics/featureConversionUtils.js";import{hasGeometry as u}from"../../../../../layers/graphics/OptimizedFeature.js";import{FeatureSetReader as h}from"./FeatureSetReader.js";function c({coords:t,lengths:e}){let r=0;for(const s of e){for(let e=1;e<s;e++)t[2*(r+e)]+=t[2*(r+e)-2],t[2*(r+e)+1]+=t[2*(r+e)-1];r+=s}}class d extends h{constructor(t,e,r){super(t),this._featureIndex=-1,this._dateFields=new Set,this._geometryType=r,this._features=e}static fromFeatures(t,e,s){const i=r([],t,e,!1,!1,s);for(let r=0;r<i.length;r++)i[r].displayId=t[r].displayId;return d.fromOptimizedFeatures(i,e)}static fromFeatureSet(t,e){const r=s(t,e);return d.fromOptimizedFeatureSet(r)}static fromOptimizedFeatureSet(t){const{features:e,geometryType:r}=t,s=d.fromOptimizedFeatures(e,r);s._exceededTransferLimit=t.exceededTransferLimit,s._transform=t.transform;for(const i of t.fields)"esriFieldTypeDate"===i.type&&s._dateFields.add(i.name);return s}static fromOptimizedFeatures(t,e,r){const s=h.createInstance(),i=new d(s,t,e);return i._transform=r,i}get _current(){return this._features[this._featureIndex]}get geometryType(){return this._geometryType}get hasFeatures(){return!!this._features.length}get hasNext(){return this._featureIndex+1<this._features.length}get exceededTransferLimit(){return this._exceededTransferLimit}get hasZ(){return!1}get hasM(){return!1}removeIds(t){const e=new Set(t);this._features=this._features.filter((t=>!e.has(t.objectId)))}append(t){for(const e of t)this._features.push(e)}getSize(){return this._features.length}getCursor(){return this.copy()}getQuantizationTransform(){return this._transform}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getIndex(){return this._featureIndex}setIndex(t){this._featureIndex=t}getObjectId(){return this._current.objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){this._current.displayId=t}getGroupId(){return this._current.groupId}setGroupId(t){this._current.groupId=t}copy(){const t=new d(this.instance,this._features,this.geometryType);return this.copyInto(t),t}next(){for(;++this._featureIndex<this._features.length&&!this._getExists(););return this._featureIndex<this._features.length}readLegacyFeature(){return i(this._current,this.geometryType,this.hasZ,this.hasM)}readOptimizedFeature(){return this._current}readLegacyPointGeometry(){return this.readGeometry()?{x:this.getX(),y:this.getY()}:null}readLegacyGeometry(){const t=this.readGeometry();return n(t,this.geometryType,this.hasZ,this.hasM)}readLegacyCentroid(){const e=this.readCentroid();return t(e)?null:{x:e.coords[0]*this._sx+this._tx,y:e.coords[1]*this._sy+this._ty}}readGeometryArea(){return u(this._current)?o(this._current.geometry,2):0}readUnquantizedGeometry(){const t=this.readGeometry();if("esriGeometryPoint"===this.geometryType||!t)return t;const e=t.clone();return c(e),e}readHydratedGeometry(){const r=this._current.geometry;if(t(r))return null;const s=r.clone();return e(this._transform)&&a(s,s,this.hasZ,this.hasM,this._transform),s}getXHydrated(){if(!u(this._current))return 0;const e=this._current.geometry.coords[0],r=this.getQuantizationTransform();return t(r)?e:e*r.scale[0]+r.translate[0]}getYHydrated(){if(!u(this._current))return 0;const e=this._current.geometry.coords[1],r=this.getQuantizationTransform();return t(r)?e:r.translate[1]-e*r.scale[1]}getX(){return u(this._current)?this._current.geometry.coords[0]*this._sx+this._tx:0}getY(){return u(this._current)?this._current.geometry.coords[1]*this._sy+this._ty:0}readGeometry(){if(!u(this._current))return null;const t=this._current.geometry.clone();if(t.isPoint)return t.coords[0]=t.coords[0]*this._sx+this._tx,t.coords[1]=t.coords[1]*this._sy+this._ty,t;let e=0;for(const r of t.lengths)t.coords[2*e]=t.coords[2*e]*this._sx+this._tx,t.coords[2*e+1]=t.coords[2*e+1]*this._sy+this._ty,e+=r;return t}readCentroid(){if(!u(this._current))return null;if(t(this._current.centroid)){const e=this._computeCentroid();if(t(e))return null;e.coords[0]=(e.coords[0]-this._tx)/this._sx,e.coords[1]=(e.coords[1]-this._ty)/this._sy,this._current.centroid=e}const e=this._current.centroid.clone();return e.coords[0]=e.coords[0]*this._sx+this._tx,e.coords[1]=e.coords[1]*this._sx+this._ty,e}_readAttribute(t,e){const r=this._current.attributes[t];if(void 0!==r)return null!=r&&e&&this._dateFields.has(t)?new Date(r):r;const s=this.readAttributes(),i=t.toLocaleLowerCase().trim();for(const n in s)if(n.toLocaleLowerCase().trim()===i){const t=this._current.attributes[n];return null!=t&&e&&this._dateFields.has(n)?new Date(t):t}}copyInto(t){super.copyInto(t),t._featureIndex=this._featureIndex,t._transform=this._transform,t._dateFields=this._dateFields}_readAttributes(){return this._current.attributes}}export{d as FeatureSetReaderJSON};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import{HandleOwner as t}from"../../../../core/HandleOwner.js";import i from"../../../../core/Logger.js";import{isSome as s,isNone as r,unwrap as l}from"../../../../core/maybe.js";import{debounce as a,isAbortError as o,eachAlways as n}from"../../../../core/promiseUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import u from"../../../../geometry/Point.js";import p from"../../../../layers/support/PixelBlock.js";import y from"../../../../layers/support/TileInfo.js";import{update as d,unregister as g,register as m,getRasterId as _}from"../../../../layers/support/rasterDatasets/RawBlockCache.js";import{extractBands as f}from"../../../../layers/support/rasterFunctions/pixelUtils.js";import{getWorldWidth as w,computeProjectedScales as b}from"../../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import"../../tiling/PagedTileQueue.js";import P from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import C from"../../tiling/TileQueue.js";import I from"../../tiling/TileStrategy.js";import{getWebGL1Capabilities as v}from"../../../webgl/capabilities.js";import V from"../../../../geometry/Extent.js";const R=[0,0],T=i.getLogger("esri.views.2d.layers.ImageryTileLayerView2D");let S=class extends t{constructor(){super(...arguments),this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=null,this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._globalUpdateRequested=!1,this.container=null,this.layer=null,this.redrawOrRefetch=a(((e,t)=>!this.previousLOD||this.layerView.suspended?Promise.resolve():e?this.doRefresh():this._redrawImage(t)))}get useWebGLForProcessing(){var e;return null==(e=this._get("useWebGLForProcessing"))||e}set useWebGLForProcessing(e){this._set("useWebGLForProcessing",e)}get useProgressiveUpdate(){return null==this._get("useProgressiveUpdate")||this._get("useProgressiveUpdate")}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){var l;if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){const e=this._srcResolutions[r.level],s=t.toJSON?t:V.fromJSON(t);d(this._blockCacheRegistryUrl,this._blockCacheRegistryId,s,i,e,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,(null==(l=this.previousLOD)?void 0:l.level)!==r.level&&(this.previousLOD=r,null==this._symbolizerParams||this.layerView.hasTilingEffects||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._fetchQueue.length>0||this._globalUpdateRequested||!(!this.updatingHandles||!this.updatingHandles.updating)}attach(){v().supportsTextureFloat||(this.useWebGLForProcessing=!1),this._initializeTileInfo(),this._tileInfoView=new P(this.layerView.tileInfo,this.layerView.fullExtent);const e=this._computeFetchConcurrency();this._fetchQueue=new C({tileInfoView:this._tileInfoView,concurrency:e,process:(e,t)=>this._fetchTile1(e,t)});const t=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new I({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}acquireTile(e){const t=this.container.createTile(e);return 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()}uninstall(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,this.notifyChange("updating"),g(this._blockCacheRegistryUrl,this._blockCacheRegistryId)}createEmptyTilePixelBlock(e=null){const t=null==e||e.join(",")===this._tileInfoView.tileInfo.size.join(",");if(t&&s(this._emptyTilePixelBlock))return this._emptyTilePixelBlock;e=e||this._tileInfoView.tileInfo.size;const[i,r]=e,l=new p({width:i,height:r,pixels:[new Uint8Array(i*r)],mask:new Uint8Array(i*r),pixelType:"u8"});return t&&(this._emptyTilePixelBlock=l),l}_fetchTile1(e,t){const i=!r(t)&&t.signal,a=this.canUseWebGLForProcessing(),{layerView:o}=this,n=!o.tileInfo.isWrappable&&s(w(o.view.spatialReference)),h={allowPartialFill:!0,datumTransformation:o.datumTransformation,interpolation:a?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:a,signal:l(i),srcResolution:this._srcResolutions[e.level],timeExtent:o.timeExtent,tileInfo:o.tileInfo,disableWrapAround:n};return this.fetchTile(e,h)}_getCacheSize(e){return e?40:0}_initializeTileInfo(){const e=this.layerView.view.spatialReference,t=new u({x:this.layerView.fullExtent.xmin,y:this.layerView.fullExtent.ymax,spatialReference:e}),{scales:i,srcResolutions:s,isCustomTilingScheme:r}=b(this.layer.rasterInfo,e),l=y.create({spatialReference:e,size:512,scales:i});(0===l.origin.x||l.origin.x>t.x)&&(l.origin=t),this._isCustomTilingScheme=r,this.layerView.set("tileInfo",l),this._srcResolutions=null!=s?s:[]}_computeFetchConcurrency(){const{blockBoundary:e}=this.layer.rasterInfo.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);this.notifyChange("updating");const{bandIds:s}=this.layer;let r=!this.useProgressiveUpdate||this.layerView.hasTilingEffects&&!this._globalSymbolizerParams;if(this._globalUpdateRequested&&!this.layerView.moving&&0===this._fetchQueue.length){r=!1;try{await this._redrawImage(this._abortController&&this._abortController.signal)}catch(i){o(i)&&T.error(i)}this._globalUpdateRequested=!1}!this.canUseWebGLForProcessing()&&"rasterVF"!==this.type||this.layerView.hasTilingEffects||null!=this._symbolizerParams||this._updateSymbolizerParams();const l=this._tileInfoView.getTileCoords(R,e.key),a=this._tileInfoView.getTileResolution(e.key);await this.updateTileSource(e,{source:t,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:r,bandIds:s,coords:l,resolution:a}),e.once("attach",(()=>this.layerView.requestUpdate())),this.container.addChild(e)}catch(i){o(i)||T.error(i)}this.layerView.requestUpdate()}}async _redrawImage(e){if(0===this.container.children.length)return;await this.updatingHandles.addPromise(this.layer.updateRenderer()),this.layerView.hasTilingEffects?await this._updateGlobalSymbolizerParams(e):(this._updateSymbolizerParams(),this._globalSymbolizerParams=null);const t=this.container.children.map((async e=>this.updateTileSymbolizerParameters(e,{local:this._symbolizerParams,global:this._globalSymbolizerParams})));await n(t),this.container.requestRender()}async _updateGlobalSymbolizerParams(e){const t={srcResolution:this._srcResolutions[this.previousLOD.level],registryId:this._blockCacheRegistryId,signal:e},i=await this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,t);if(!i||!i.pixelBlock)return;const s=this.layer.symbolizer.generateWebGLParameters({pixelBlock:f(i.pixelBlock,this.layer.bandIds),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:this.previousLOD.resolution,y:this.previousLOD.resolution},bandIds:this.layer.bandIds});!this.canUseWebGLForProcessing()&&s&&"stretch"===s.type&&this.layer.renderer&&"raster-stretch"===this.layer.renderer.type&&(s.factor=s.factor.map((e=>255*e)),s.outMin=Math.round(255*s.outMin),s.outMax=Math.round(255*s.outMax)),this._globalSymbolizerParams=s}_updateSymbolizerParams(){this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:this.previousLOD.resolution,y:this.previousLOD.resolution},bandIds:this.layer.bandIds})}_updateBlockCacheRegistry(e=!1){const{url:t,rasterInfo:i,raster:s}=this.layer,{multidimensionalDefinition:r}=this.layer.normalizeRasterFetchOptions({multidimensionalDefinition:this.layer.multidimensionalDefinition,timeExtent:this.layerView.timeExtent}),l=null!=i&&i.multidimensionalInfo?s.getSliceIndex(r):null,a=_(t,l);if(a!==this._blockCacheRegistryUrl){if(null!=this._blockCacheRegistryUrl&&g(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=m(a,this.layer.raster.rasterInfo),e){const e=this._tileInfoView.getClosestInfoForScale(this.layerView.view.scale),t=this._srcResolutions[e.level];d(a,this._blockCacheRegistryId,this.layerView.view.extent,this.layerView.view.resolution,t,this.layer.raster.ioConfig.sampling)}this._blockCacheRegistryUrl=a}}async doRefresh(){await this.updatingHandles.addPromise(this.layer.updateRenderer()),this.layerView.hasTilingEffects||this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset(),this.notifyChange("updating");const e=[];this._tileStrategy.tiles.forEach((t=>e.push(this._enqueueTileFetch(t)))),await n(e)}};e([h()],S.prototype,"_globalUpdateRequested",void 0),e([h()],S.prototype,"container",void 0),e([h()],S.prototype,"layer",void 0),e([h()],S.prototype,"layerView",void 0),e([h()],S.prototype,"type",void 0),e([h()],S.prototype,"useWebGLForProcessing",null),e([h()],S.prototype,"useProgressiveUpdate",null),e([h()],S.prototype,"updating",null),S=e([c("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],S);export{S as BaseImageryTileSubView2D};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import{HandleOwner as t}from"../../../../core/HandleOwner.js";import i from"../../../../core/Logger.js";import{isSome as s,isNone as r,unwrap as l}from"../../../../core/maybe.js";import{debounce as a,isAbortError as o,eachAlways as n}from"../../../../core/promiseUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import u from"../../../../geometry/Point.js";import p from"../../../../layers/support/PixelBlock.js";import y from"../../../../layers/support/TileInfo.js";import{update as d,unregister as g,register as m,getRasterId as _}from"../../../../layers/support/rasterDatasets/RawBlockCache.js";import{extractBands as f}from"../../../../layers/support/rasterFunctions/pixelUtils.js";import{getWorldWidth as w,computeProjectedScales as b}from"../../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import"../../tiling/PagedTileQueue.js";import P from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import C from"../../tiling/TileQueue.js";import I from"../../tiling/TileStrategy.js";import{getWebGL1Capabilities as v}from"../../../webgl/capabilities.js";import V from"../../../../geometry/Extent.js";const R=[0,0],T=i.getLogger("esri.views.2d.layers.ImageryTileLayerView2D");let S=class extends t{constructor(){super(...arguments),this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=null,this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._globalUpdateRequested=!1,this.attached=!1,this.container=null,this.layer=null,this.redrawOrRefetch=a(((e,t)=>!this.previousLOD||this.layerView.suspended?Promise.resolve():e?this.doRefresh():this._redrawImage(t)))}get useWebGLForProcessing(){var e;return null==(e=this._get("useWebGLForProcessing"))||e}set useWebGLForProcessing(e){this._set("useWebGLForProcessing",e)}get useProgressiveUpdate(){return null==this._get("useProgressiveUpdate")||this._get("useProgressiveUpdate")}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){var l;if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){const e=this._srcResolutions[r.level],s=t.toJSON?t:V.fromJSON(t);d(this._blockCacheRegistryUrl,this._blockCacheRegistryId,s,i,e,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,(null==(l=this.previousLOD)?void 0:l.level)!==r.level&&(this.previousLOD=r,null==this._symbolizerParams||this.layerView.hasTilingEffects||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._fetchQueue.length>0||this._globalUpdateRequested||!(!this.updatingHandles||!this.updatingHandles.updating)}attach(){v().supportsTextureFloat||(this.useWebGLForProcessing=!1),this._initializeTileInfo(),this._tileInfoView=new P(this.layerView.tileInfo,this.layerView.fullExtent);const e=this._computeFetchConcurrency();this._fetchQueue=new C({tileInfoView:this._tileInfoView,concurrency:e,process:(e,t)=>this._fetchTile1(e,t)});const t=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new I({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}detach(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,this.notifyChange("updating"),g(this._blockCacheRegistryUrl,this._blockCacheRegistryId)}acquireTile(e){const t=this.container.createTile(e);return 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&&s(this._emptyTilePixelBlock))return this._emptyTilePixelBlock;e=e||this._tileInfoView.tileInfo.size;const[i,r]=e,l=new p({width:i,height:r,pixels:[new Uint8Array(i*r)],mask:new Uint8Array(i*r),pixelType:"u8"});return t&&(this._emptyTilePixelBlock=l),l}_fetchTile1(e,t){const i=!r(t)&&t.signal,a=this.canUseWebGLForProcessing(),{layerView:o}=this,n=!o.tileInfo.isWrappable&&s(w(o.view.spatialReference)),h={allowPartialFill:!0,datumTransformation:o.datumTransformation,interpolation:a?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:a,signal:l(i),srcResolution:this._srcResolutions[e.level],timeExtent:o.timeExtent,tileInfo:o.tileInfo,disableWrapAround:n};return this.fetchTile(e,h)}_getCacheSize(e){return e?40:0}_initializeTileInfo(){const e=this.layerView.view.spatialReference,t=new u({x:this.layerView.fullExtent.xmin,y:this.layerView.fullExtent.ymax,spatialReference:e}),{scales:i,srcResolutions:s,isCustomTilingScheme:r}=b(this.layer.rasterInfo,e),l=y.create({spatialReference:e,size:512,scales:i});(0===l.origin.x||l.origin.x>t.x)&&(l.origin=t),this._isCustomTilingScheme=r,this.layerView.set("tileInfo",l),this._srcResolutions=null!=s?s:[]}_computeFetchConcurrency(){const{blockBoundary:e}=this.layer.rasterInfo.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);this.notifyChange("updating");const{bandIds:s}=this.layer;let r=!this.useProgressiveUpdate||this.layerView.hasTilingEffects&&!this._globalSymbolizerParams;if(this._globalUpdateRequested&&!this.layerView.moving&&0===this._fetchQueue.length){r=!1;try{await this._redrawImage(this._abortController&&this._abortController.signal)}catch(i){o(i)&&T.error(i)}this._globalUpdateRequested=!1}!this.canUseWebGLForProcessing()&&"rasterVF"!==this.type||this.layerView.hasTilingEffects||null!=this._symbolizerParams||this._updateSymbolizerParams();const l=this._tileInfoView.getTileCoords(R,e.key),a=this._tileInfoView.getTileResolution(e.key);await this.updateTileSource(e,{source:t,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:r,bandIds:s,coords:l,resolution:a}),e.once("attach",(()=>this.layerView.requestUpdate())),this.container.addChild(e)}catch(i){o(i)||T.error(i)}this.layerView.requestUpdate()}}async _redrawImage(e){if(0===this.container.children.length)return;await this.updatingHandles.addPromise(this.layer.updateRenderer()),this.layerView.hasTilingEffects?await this._updateGlobalSymbolizerParams(e):(this._updateSymbolizerParams(),this._globalSymbolizerParams=null);const t=this.container.children.map((async e=>this.updateTileSymbolizerParameters(e,{local:this._symbolizerParams,global:this._globalSymbolizerParams})));await n(t),this.container.requestRender()}async _updateGlobalSymbolizerParams(e){const t={srcResolution:this._srcResolutions[this.previousLOD.level],registryId:this._blockCacheRegistryId,signal:e},i=await this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,t);if(!i||!i.pixelBlock)return;const s=this.layer.symbolizer.generateWebGLParameters({pixelBlock:f(i.pixelBlock,this.layer.bandIds),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:this.previousLOD.resolution,y:this.previousLOD.resolution},bandIds:this.layer.bandIds});!this.canUseWebGLForProcessing()&&s&&"stretch"===s.type&&this.layer.renderer&&"raster-stretch"===this.layer.renderer.type&&(s.factor=s.factor.map((e=>255*e)),s.outMin=Math.round(255*s.outMin),s.outMax=Math.round(255*s.outMax)),this._globalSymbolizerParams=s}_updateSymbolizerParams(){this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:this.previousLOD.resolution,y:this.previousLOD.resolution},bandIds:this.layer.bandIds})}_updateBlockCacheRegistry(e=!1){const{url:t,rasterInfo:i,raster:s}=this.layer,{multidimensionalDefinition:r}=this.layer.normalizeRasterFetchOptions({multidimensionalDefinition:this.layer.multidimensionalDefinition,timeExtent:this.layerView.timeExtent}),l=null!=i&&i.multidimensionalInfo?s.getSliceIndex(r):null,a=_(t,l);if(a!==this._blockCacheRegistryUrl){if(null!=this._blockCacheRegistryUrl&&g(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=m(a,this.layer.raster.rasterInfo),e){const e=this._tileInfoView.getClosestInfoForScale(this.layerView.view.scale),t=this._srcResolutions[e.level];d(a,this._blockCacheRegistryId,this.layerView.view.extent,this.layerView.view.resolution,t,this.layer.raster.ioConfig.sampling)}this._blockCacheRegistryUrl=a}}async doRefresh(){await this.updatingHandles.addPromise(this.layer.updateRenderer()),this.layerView.hasTilingEffects||this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset(),this.notifyChange("updating");const e=[];this._tileStrategy.tiles.forEach((t=>e.push(this._enqueueTileFetch(t)))),await n(e)}};e([h()],S.prototype,"_globalUpdateRequested",void 0),e([h()],S.prototype,"attached",void 0),e([h()],S.prototype,"container",void 0),e([h()],S.prototype,"layer",void 0),e([h()],S.prototype,"layerView",void 0),e([h()],S.prototype,"type",void 0),e([h()],S.prototype,"useWebGLForProcessing",null),e([h()],S.prototype,"useProgressiveUpdate",null),e([h()],S.prototype,"updating",null),S=e([c("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],S);export{S 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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as r}from"../../../../core/maybe.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{RasterTileContainer as i}from"../../engine/RasterTileContainer.js";import{BaseImageryTileSubView2D as o}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as l}from"../support/util.js";let
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as r}from"../../../../core/maybe.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{RasterTileContainer as i}from"../../engine/RasterTileContainer.js";import{BaseImageryTileSubView2D as o}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as l}from"../support/util.js";let a=class extends o{constructor(){super(...arguments),this.container=null,this.layer=null,this.type="raster"}attach(){super.attach(),this.container=new i(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}canUseWebGLForProcessing(){return this.useWebGLForProcessing&&this.layer.symbolizer.canRenderInWebGL&&!("majority"===this.layer.interpolation&&l(this.layer))}fetchTile(e,r){return this.layer.fetchTile(e.level,e.row,e.col,r)}async updateTileSource(e,t){const{bandIds:s}=this.layer,i=this._getLayerInterpolation(),o=this.canUseWebGLForProcessing(),{source:l,symbolizerParams:a,globalSymbolizerParams:n,suspended:c,coords:p,resolution:u}=t,{bitmap:d}=e;if([d.x,d.y]=p,d.resolution=u,l&&r(l)&&r(l.pixelBlock)){const e={extent:l.extent,pixelBlock:l.pixelBlock};if(d.rawPixelData=e,o)d.source=l.pixelBlock,d.isRendereredSource=!1;else{const r=await this.layer.applyRenderer(e,"stretch"===(null==n?void 0:n.type)?n:null);d.source=r,d.isRendereredSource=!0}d.symbolizerParameters=o?a:null,o?d.transformGrid||(d.transformGrid=l.transformGrid):d.transformGrid=null}else{const e=this.createEmptyTilePixelBlock();d.source=e,d.symbolizerParameters=o?a:null,d.transformGrid=null}d.bandIds=o?s:null,d.width=this._tileInfoView.tileInfo.size[0],d.height=this._tileInfoView.tileInfo.size[1],d.interpolation=i,d.suspended=c,d.invalidateTexture()}async updateTileSymbolizerParameters(e,t){const{local:s,global:i}=t,{bandIds:o}=this.layer,l=this._getLayerInterpolation(),a=this.canUseWebGLForProcessing(),{bitmap:n}=e,{rawPixelData:c}=n;!a&&r(c)?(n.source=await this.layer.applyRenderer(c,"stretch"===(null==i?void 0:i.type)?i:null),n.isRendereredSource=!0):(n.isRendereredSource&&r(c)&&(n.source=c.pixelBlock),n.isRendereredSource=!1),n.symbolizerParameters=a?i||s:null,n.bandIds=a?o:null,n.interpolation=l,n.suspended=!1}_getLayerInterpolation(){const e=this.layer.renderer.type;if("raster-colormap"===e||"unique-value"===e||"class-breaks"===e)return"nearest";const{interpolation:r}=this.layer,{renderer:t}=this.layer;return"raster-stretch"===t.type&&null!=t.colorRamp?"bilinear"===r||"cubic"===r?"bilinear":"nearest":r}};e([t()],a.prototype,"container",void 0),e([t()],a.prototype,"layer",void 0),e([t()],a.prototype,"type",void 0),a=e([s("esri.views.2d.layers.imagery.ImageryTileView2D")],a);const n=a;export{n as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Logger.js";import{isNone as i}from"../../../../core/maybe.js";import{debounce as s,isAbortError as o}from"../../../../core/promiseUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import l from"../../../../geometry/Extent.js";import{RasterVFDisplayObject as c}from"../../engine/RasterVFDisplayObject.js";const p=r.getLogger("esri.views.2d.layers.imagery.VectorFieldView2D");let m=class extends t{constructor(e){super(e),this.update=s(((e,t)=>this._update(e,t).catch((e=>{o(e)||p.error(e)}))))}get updating(){return!!this._loading}redraw(e){if(!this.container.children.length)return;const t=this.container.children[0];t.symbolizerParameters=e,t.invalidateVAO(),this.container.symbolTypes="wind_speed"===e.style?["scalar","triangle"]:"simple_scalar"===e.style?["scalar"]:["triangle"],this.container.requestRender()}async _update(e,t,r){if(!e.stationary)return;const{extent:i,spatialReference:s}=e.state,o=new l({xmin:i.xmin,ymin:i.ymin,xmax:i.xmax,ymax:i.ymax,spatialReference:s}),[a,n]=e.state.size;this._loading=this.fetchPixels(o,a,n,r);const c=await this._loading;this._addToDisplay(c,t,e.state),this._loading=null}_addToDisplay(e,t,r){if(i(e.pixelBlock))return this.container.children.forEach((e=>e.destroy())),void this.container.removeAllChildren();const{extent:s,pixelBlock:o}=e,a=new c(o);a.offset=[0,0],a.symbolizerParameters=t,a.rawPixelData=e,a.invalidateVAO(),a.x=s.xmin,a.y=s.ymax,a.pixelRatio=r.pixelRatio,a.rotation=r.rotation,a.resolution=r.resolution,a.width=o.width*t.symbolTileSize,a.height=o.height*t.symbolTileSize,this.container.children.forEach((e=>e.destroy())),this.container.removeAllChildren(),this.container.symbolTypes="wind_speed"===t.style?["scalar","triangle"]:"simple_scalar"===t.style?["scalar"]:["triangle"],this.container.addChild(a)}};e([a()],m.prototype,"fetchPixels",void 0),e([a()],m.prototype,"container",void 0),e([a()],m.prototype,"_loading",void 0),e([a()],m.prototype,"updating",null),m=e([n("esri.views.2d.layers.imagery.ImageryVFStrategy")],m);const d=m;export{d 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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import r from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{isSome as s}from"../../../../core/maybe.js";import{isAbortError as o}from"../../../../core/promiseUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{enumeration as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import r from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{isSome as s}from"../../../../core/maybe.js";import{isAbortError as o}from"../../../../core/promiseUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{enumeration as p}from"../../../../core/accessorSupport/decorators/enumeration.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{mosaicPixelData as l}from"../../../../layers/support/rasterFunctions/pixelUtils.js";import{BitmapContainer as c}from"../../engine/BitmapContainer.js";import{Container as m}from"../../engine/Container.js";import h from"../../engine/ImageryBitmapSource.js";import u from"../support/ExportStrategy.js";const d=i.getLogger("esri.views.2d.layers.imagery.ImageryView2D");let y=class extends r{constructor(){super(...arguments),this.attached=!1,this.container=new m,this.updateRequested=!1,this.type="Imagery",this._bitmapView=new c}destroy(){this.attached&&(this.detach(),this.attached=!1),this.updateRequested=!1}get updating(){return!this.attached||this.isUpdating()}update(e){this.strategy.update(e).catch((e=>{o(e)||d.error(e)}))}hitTest(e){return new t({attributes:{},geometry:e.clone(),layer:this.layer})}attach(){this.container.addChild(this._bitmapView);const e=this.layer.version>=10,t=this.layer.version>=10.1?this.layer.imageMaxHeight:2048,r=this.layer.version>=10.1?this.layer.imageMaxWidth:2048;this.strategy=new u({container:this._bitmapView,imageNormalizationSupported:e,imageMaxHeight:t,imageMaxWidth:r,fetchSource:this._fetchImage.bind(this),requestUpdate:()=>this.requestUpdate()})}detach(){this.strategy.destroy(),this._bitmapView.removeAllChildren(),this.container.removeAllChildren()}redraw(){this.strategy.updateExports((e=>{e.source instanceof HTMLImageElement?e.requestRender():this.layer.applyRenderer({pixelBlock:e.source.pixelBlock}).then((t=>{const r=e.source;r.pixelBlock=t.pixelBlock,r.filter=e=>this.layer.applyFilter(e),this.container.requestRender()}))}))}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.view.requestUpdate())}isUpdating(){return this.strategy.updating||this.updateRequested}getPixelData(){if(this.updating)return null;const e=this.strategy.bitmaps;if(1===e.length&&e[0].source)return{extent:e[0].source.extent,pixelBlock:e[0].source.originalPixelBlock};if(e.length>1){const t=this.view.extent,r=e.map((e=>e.source)).filter((e=>e.extent&&e.extent.intersects(t))).map((e=>({extent:e.extent,pixelBlock:e.originalPixelBlock}))),i=l(r,t);return s(i)?{extent:i.extent,pixelBlock:i.pixelBlock}:null}return null}_fetchImage(e,t,r,i){return(i=i||{}).timeExtent=this.timeExtent,i.requestAsImageElement=!0,this.layer.fetchImage(e,t,r,i).then((e=>e.imageElement?e.imageElement:this.layer.applyRenderer(e.pixelData,{signal:i.signal}).then((t=>{const r=new h(t.pixelBlock,t.extent.clone(),e.pixelData.pixelBlock);return r.filter=e=>this.layer.applyFilter(e),r}))))}};e([a()],y.prototype,"attached",void 0),e([a()],y.prototype,"container",void 0),e([a()],y.prototype,"layer",void 0),e([a()],y.prototype,"strategy",void 0),e([a()],y.prototype,"timeExtent",void 0),e([a()],y.prototype,"view",void 0),e([a()],y.prototype,"updateRequested",void 0),e([a()],y.prototype,"updating",null),e([p({imagery:"Imagery"})],y.prototype,"type",void 0),y=e([n("esri.views.2d.layers.imagery.ImageryView2D")],y);const g=y;export{g 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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../core/maybe.js";import{
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../core/maybe.js";import{watch as i}from"../../../../core/reactiveUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{sampleVectorField as s}from"../../../../layers/support/rasterFunctions/vectorFieldUtils.js";import{RasterVFTileContainer as l}from"../../engine/RasterVFTileContainer.js";import{BaseImageryTileSubView2D as a}from"./BaseImageryTileSubView2D.js";let n=class extends a{constructor(){super(...arguments),this._handle=null,this.container=null,this.layer=null,this.type="rasterVF"}canUseWebGLForProcessing(){return!1}async fetchTile(e,t){const i=await this.layer.fetchTile(e.level,e.row,e.col,t);return"vector-magdir"===this.layer.rasterInfo.dataType&&null!=i&&i.pixelBlock&&(i.pixelBlock=await this.layer.convertVectorFieldData(i.pixelBlock,t)),i}updateTileSource(e,i){const r=i.symbolizerParams,{tileData:o}=e;o.key=e.key,o.width=this._tileInfoView.tileInfo.size[0],o.height=this._tileInfoView.tileInfo.size[1];const{symbolTileSize:s}=r,{source:l}=i;if(o.offset=this._getTileSymbolOffset(o.key,s),t(l)&&t(l.pixelBlock)){const e={extent:l.extent,pixelBlock:l.pixelBlock};o.rawPixelData=e,o.source=this._sampleVectorFieldData(l.pixelBlock,r,o.offset),o.symbolizerParameters=r}else{const e=[Math.round((this._tileInfoView.tileInfo[0]-o.offset[0])/s),Math.round((this._tileInfoView.tileInfo[1]-o.offset[1])/s)],t=this.createEmptyTilePixelBlock(e);o.source=t,o.symbolizerParameters=r}return o.invalidateVAO(),Promise.resolve(null)}updateTileSymbolizerParameters(e,i){var r;const o=i.local,{symbolTileSize:s}=o,{tileData:l}=e;l.offset=this._getTileSymbolOffset(l.key,s);const a=l.symbolizerParameters.symbolTileSize;return l.symbolizerParameters=o,t(null==(r=l.rawPixelData)?void 0:r.pixelBlock)&&a!==s&&(l.source=this._sampleVectorFieldData(l.rawPixelData.pixelBlock,l.symbolizerParameters,l.offset)),Promise.resolve(null)}attach(){super.attach(),this.container=new l(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this._updateSymbolType(this.layer.renderer),this._handle=i((()=>this.layer.renderer),(e=>this._updateSymbolType(e)))}detach(){super.detach(),this.container.removeAllChildren(),this._handle.remove(),this._handle=null}_getTileSymbolOffset(e,t){const i=e.col*this._tileInfoView.tileInfo.size[0]%t,r=e.row*this._tileInfoView.tileInfo.size[1]%t;return[i>t/2?t-i:-i,r>t/2?t-r:-r]}_sampleVectorFieldData(e,t,i){const{symbolTileSize:r}=t;return s(e,"vector-uv",r,i)}_updateSymbolType(e){"vector-field"===e.type&&(this.container.symbolTypes="wind-barb"===e.style?["scalar","triangle"]:"simple-scalar"===e.style?["scalar"]:["triangle"])}};e([r()],n.prototype,"container",void 0),e([r()],n.prototype,"layer",void 0),e([r()],n.prototype,"type",void 0),n=e([o("esri.views.2d.layers.imagery.VectorFieldTileView2D")],n);const c=n;export{c as default};
|