@arcgis/core 6.0.0-next.5 → 6.0.0-next.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/AreaMeasurementAnalysis.d.ts +11 -1
- package/analysis/DirectLineMeasurementAnalysis.d.ts +11 -1
- package/analysis/DistanceMeasurementAnalysis.d.ts +8 -0
- package/arcade/geometry/unitConversion.js +1 -1
- package/arcgisGlobal.d.ts +5 -5
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{1ede8666d804c553803e.js → 0b6941781e35ce0f7274.js} +1 -1
- package/assets/esri/core/workers/chunks/0ccab50877b24f862d6e.js +1 -0
- package/assets/esri/core/workers/chunks/{a0d459bdb91ee892d4b6.js → 116293b1ee788a89ce1e.js} +1 -1
- package/assets/esri/core/workers/chunks/{8959a825f5e1ce6f38ac.js → 1c65ab9ed611c322ce27.js} +1 -1
- package/assets/esri/core/workers/chunks/{ff3a53c3f00335552317.js → 250d3be6d3849d71fed8.js} +1 -1
- package/assets/esri/core/workers/chunks/257910cca66dc5df465e.js +1 -0
- package/assets/esri/core/workers/chunks/27da9ece2afaeec39f59.js +1 -0
- package/assets/esri/core/workers/chunks/2c90f7a6432cd716db8b.js +1 -0
- package/assets/esri/core/workers/chunks/2e096537a3a5555a4a93.js +1 -0
- package/assets/esri/core/workers/chunks/{b612de42ee86c0d95247.js → 3d9d7d3a40b51eb7ee3d.js} +1 -1
- package/assets/esri/core/workers/chunks/4d3f97a48046021713a6.js +1 -0
- package/assets/esri/core/workers/chunks/505227797bcf2a1d908d.js +1 -0
- package/assets/esri/core/workers/chunks/557671c897ca5563be6c.js +1 -0
- package/assets/esri/core/workers/chunks/56851011276de0b3e318.js +1 -0
- package/assets/esri/core/workers/chunks/56a24061589f4a968818.js +1 -0
- package/assets/esri/core/workers/chunks/{9232f57623e1fa3ccabc.js → 67e4b5651fd7ff7d8cf0.js} +1 -1
- package/assets/esri/core/workers/chunks/{e521bb9ee2030245c3ce.js → 6f358116f79021ff9687.js} +1 -1
- package/assets/esri/core/workers/chunks/76196c414e48834f7b92.js +1 -0
- package/assets/esri/core/workers/chunks/{5078b66ba31b770b689f.js → 85908e6e9c50749cee60.js} +1 -1
- package/assets/esri/core/workers/chunks/943a0f140813ee4ab04a.js +1 -0
- package/assets/esri/core/workers/chunks/aba42885c5d6b2b5fe7f.js +1 -0
- package/assets/esri/core/workers/chunks/ae40eac1eadd1a537bf4.js +1 -0
- package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +1 -0
- package/assets/esri/core/workers/chunks/bfd85e8d54062a590f0e.js +1 -0
- package/assets/esri/core/workers/chunks/d21257d2e2a37266c0f7.js +1 -0
- package/assets/esri/core/workers/chunks/d90a3bfd45b5ed4092e0.js +1 -0
- package/assets/esri/core/workers/chunks/f43a50d4bd9636e68ae5.js +1118 -0
- package/assets/esri/core/workers/chunks/f46a0d7cf588ba1b4157.js +1 -0
- package/{basemaps/BasemapCollection.d.ts → basemapGallery/BasemapGalleryModel.d.ts} +8 -8
- package/{basemaps/BasemapCollection.js → basemapGallery/BasemapGalleryModel.js} +1 -1
- package/{basemaps → basemapGallery}/BasemapsSource.d.ts +1 -1
- package/{basemaps → basemapGallery}/BasemapsSource.js +1 -1
- package/{basemaps → basemapGallery}/LocalBasemapsSource.d.ts +2 -2
- package/{basemaps → basemapGallery}/LocalBasemapsSource.js +1 -1
- package/{basemaps → basemapGallery}/PortalBasemapsSource.d.ts +2 -2
- package/{basemaps → basemapGallery}/PortalBasemapsSource.js +1 -1
- package/{basemaps → basemapGallery}/support/BasemapItem.d.ts +2 -2
- package/{basemaps → basemapGallery}/support/BasemapItem.js +1 -1
- package/{basemaps → basemapGallery}/types.d.ts +2 -2
- package/config.js +1 -1
- package/core/units.js +1 -1
- package/geometry/support/wkt.js +2 -0
- package/kernel.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/graphics/transferFeatures.js +1 -1
- package/package.json +2 -2
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +4 -4
- package/views/2d/analysis/DistanceMeasurementAnalysisView2D.d.ts +4 -4
- package/views/2d/layers/features/sources/strategies/FeatureDrillDownTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +3 -0
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.d.ts +2 -1
- package/views/3d/layers/support/FeatureMemory.js +1 -1
- package/views/3d/layers/support/FeatureTile.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/support/PBFDecoder.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadGlobalIllumination.glsl.js +16 -11
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/SceneView.d.ts +4 -10
- package/views/View.d.ts +4 -12
- package/views/interactive/options/SnappingOptions.d.ts +28 -12
- package/views/interactive/options/TooltipOptions.d.ts +8 -1
- package/views/interactive/options/ValueOptions.d.ts +9 -2
- package/views/interactive/options/ViewOptions.d.ts +81 -6
- package/widgets/BasemapGallery/BasemapGalleryViewModel.d.ts +2 -2
- package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
- package/widgets/BasemapGallery/support/BasemapGalleryItem.d.ts +3 -3
- package/widgets/BasemapGallery/support/LocalBasemapsSource.d.ts +2 -2
- package/widgets/BasemapGallery/support/PortalBasemapsSource.d.ts +2 -2
- package/widgets/BasemapGallery/types.d.ts +3 -3
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +13 -8
- package/widgets/Editor.d.ts +9 -9
- package/widgets/Sketch/SketchViewModel.d.ts +13 -8
- package/widgets/Sketch.d.ts +9 -9
- package/arcade/geometry/wkt.js +0 -2
- package/assets/esri/core/workers/chunks/05d865b2736f452ad2aa.js +0 -1
- package/assets/esri/core/workers/chunks/1b551ef3d84d9c1e93f9.js +0 -1
- package/assets/esri/core/workers/chunks/260dcb79dfd0f981949f.js +0 -1
- package/assets/esri/core/workers/chunks/303676d1b10676c9cab4.js +0 -1
- package/assets/esri/core/workers/chunks/33956f12505e72e60293.js +0 -1
- package/assets/esri/core/workers/chunks/512628db534605a2a93e.js +0 -1742
- package/assets/esri/core/workers/chunks/57970d43cdcc5cf57a30.js +0 -1
- package/assets/esri/core/workers/chunks/5e184fd47e76eb976fa9.js +0 -1
- package/assets/esri/core/workers/chunks/5fd099ca1024707387b2.js +0 -1
- package/assets/esri/core/workers/chunks/68e24fa3f564c2a5c9fd.js +0 -1
- package/assets/esri/core/workers/chunks/6aebf7cfd294e88bf926.js +0 -1
- package/assets/esri/core/workers/chunks/71103472c45928bd730c.js +0 -1
- package/assets/esri/core/workers/chunks/73a87fb270818aa75fc5.js +0 -1
- package/assets/esri/core/workers/chunks/776565dd9741ba2ba151.js +0 -1
- package/assets/esri/core/workers/chunks/8e7a33cc1f83063043f2.js +0 -1
- package/assets/esri/core/workers/chunks/a23272a7a47a95f6ddea.js +0 -1
- package/assets/esri/core/workers/chunks/aa5b42e44d2959fdacd3.js +0 -1
- package/assets/esri/core/workers/chunks/cbdebdfa5f2cded29d0d.js +0 -1
- package/assets/esri/core/workers/chunks/d56780290e0218d3e9de.js +0 -1
- package/assets/esri/core/workers/chunks/d89fe41c71c9621c41ae.js +0 -1
- package/assets/esri/core/workers/chunks/e22d45aeef293a5ffb78.js +0 -1
- package/assets/esri/core/workers/chunks/edf3be87a997f4f05b96.js +0 -1
- package/assets/esri/core/workers/chunks/f0c0c02730fe0d948fc1.js +0 -1
- /package/{basemaps → basemapGallery}/support/basemapCompatibilityUtils.js +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as t}from"../../core/fontUtils.js";import"../../core/has.js";import{clone as n}from"../../core/lang.js";import r from"../../core/Logger.js";import{pt2px as i,px2pt as a}from"../../core/screenUtils.js";import{numericHash as o}from"../../core/string.js";import{isCurvedGeometry as s}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as c}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{checkForAnimations as l,globalRotation as u,getAnimationParams as d,handleAbsoluteAnchor as f,handleMarker as p,handleRelativeAnchor as m,getFrameTranslation as h,translate as g,getStaticParam as _,shouldUseAnimatedPath as v}from"./animationUtils.js";import{CIMSymbolInflatedSizeHelper as y,CIMSymbolHelper as b,forEachSymbolLayer as x}from"./CIMSymbolHelper.js";import{antialiasingOutlineFillSettings as S}from"./constants.js";import{defaultCIMValues as C}from"./defaultCIMValues.js";import{fitVectorMarker as w}from"./fitVectorMarker.js";import{fromCIMFontStyle as T}from"./fromCIMFontStyle.js";import{OverrideHelper as E}from"./OverrideHelper.js";import{hasRichTextFormattingTags as D}from"./richTextUtils.js";import{getSDFInfo as O,getExtent as k,getSDFMetrics as A,getSDFDimensions as j}from"./SDFHelper.js";import{CIMSymbolUnits as M}from"./types.js";import{colorToArray as N,normalizeAlpha as P,getSize as F,isCIMMarkerStrokePlacement as I,hasStrokeLayer as L,getNumericValue as R,getMaxStrokeWidth as z,getTintColor as B,normalizePrimitiveOverrideProps as V,getDefaultCIMValue as H,getEnum as U,getFillColor as W,getStrokeColor as G,fromCIMFontDecoration as K,getStrokeWidth as q,fromCIMVerticalAlignment as ee,fromCIMHorizontalAlignment as te,getTextCasing as J,isValidCIMValue as ne,uncapitalize as re}from"./utils.js";import{isSupportedCallout as ie,getPointSymbolCalloutTransforms as ae,normalizePointSymbolCalloutScale as oe,normalizeLeaderLineStyle as Y,getPointSymbolCalloutFitProperties as se,normalizeBalloonCalloutStyle as ce}from"./callouts/calloutAnalysisUtils.js";import{EffectHelper as le}from"./effects/EffectHelper.js";import{rasterizedVectorMarkerMinSize as ue,randomInsidePolygonTextureSize as de}from"../../views/2d/engine/webgl/definitions.js";const X=()=>r.getLogger(`esri.symbols.cim.cimAnalyzer`);function fe(e){let t=e.markerPlacement;return t&&t.angleToLine?1:0}class pe{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._hasTextStringTemplates=!1,e&&(this._resourceManager=e)}analyzeSymbolReference(t,n,r){if(this._cimLayers=r??[],!t)return this._cimLayers;if(this._reset(),this._hasTextStringTemplates=t.hasTextStringTemplates??!1,t.primitiveOverrides){this._primitiveOverrides=t.primitiveOverrides;for(let t of this._primitiveOverrides){let n=t.valueExpressionInfo;if(n)this._setPoMap(t.primitiveName,t.propertyName,n);else if(t.value!=null){let n=t.value;t.propertyName.includes(`Color`)&&(e(n)&&(n=N(n)),n=P(n)),this._setPoMap(t.primitiveName,t.propertyName,n)}}}return this._analyzeSymbol(t.symbol,n),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,t){switch(e?.type){case`CIMPointSymbol`:case`CIMLineSymbol`:case`CIMPolygonSymbol`:this._analyzeMultiLayerSymbol(e,t)}}_analyzeMultiLayerSymbol(e,t){let n=e?.symbolLayers;if(!n)return;for(let e=0;e<n.length;e++){let t=n[e];t.type===`CIMVectorMarker`&&(n[e]=w(t))}let r=e.effects,i=0,a=F(e)??0;e.type===`CIMPointSymbol`&&e.angleAlignment===`Map`&&(i=1);let o={transform:[0,0,0,1],fromColor:[1,1,1,1],toColor:[1,1,1,1],colorMix:[0,0,0,0],toOpacity:[1,1,1,1],opacityMix:[0,0,0,0],shift:[1,1,1,1],hasAnimations:l(e),hasShiftAnimation:!1,hasMotionAnimations:!1};o=u(o),o=d(this._poMap,e,o);let s=null;e.type===`CIMPointSymbol`&&(s=this._analyzePointSymbolHalo(e,i,a,r,o),this._analyzeCallout(e,null,[],o,a,i,t));let c=s?n.filter(e=>e!==s):n;if(Ce(c,r))return this._analyzeCompositeOutlineFill(c,r,a);this._analyzeSymbolLayer(s?{...e,symbolLayers:c}:e,null,[],o,a,i,t)}_analyzeSymbolLayer(e,t,n,r,i,a,o){let s=e?.symbolLayers;if(!s)return;let c=e.type===`CIMPolygonSymbol`,l=e.effects,u=s.length;for(;u--;){let d=s[u];if(!d||d.enable===!1)continue;let f;l?.length&&(f=[...l]);let p=d.effects;p?.length&&(l?f.push(...p):f=[...p]);let m=t?[...t]:null;if(f){m??=[];for(let e of f){let t=E.findEffectOverrides(e,this._primitiveOverrides);t&&m.push(t)}}E.findApplicableOverrides(d,this._primitiveOverrides,[]);let h=this._cimLayers.length;switch(d.type){case`CIMSolidFill`:this._analyzeSolidFill(d,m,r,L(s));break;case`CIMPictureFill`:this._analyzePictureFill(d,m,r);break;case`CIMHatchFill`:this._analyzeHatchFill(d,m,r);break;case`CIMGradientFill`:this._analyzeGradientFill(d,m);break;case`CIMSolidStroke`:this._analyzeSolidStroke(d,m,c,i,r);break;case`CIMPictureStroke`:this._analyzePictureStroke(d,m,c,i,r);break;case`CIMGradientStroke`:this._analyzeGradientStroke(d,m,c,i);break;case`CIMCharacterMarker`:case`CIMPictureMarker`:case`CIMVectorMarker`:{(e.type===`CIMLineSymbol`||e.type===`CIMPolygonSymbol`)&&(a=fe(d));let t=[],s=d.primitiveName;s&&t.push(s);let l=c&&I(d.markerPlacement);this._analyzeMarker(d,m,null,t,a,i,o,n,r,!1,l);break}default:X().error(`Cannot analyze CIM layer`,d.type)}if(m?.some(({effect:e})=>Z(e)))for(let e=h;e<this._cimLayers.length;e++)this._cimLayers[e].effectsChangeGeometryType=!0}}_analyzePointSymbolHalo(e,t,r,i,o){let{haloSymbol:s}=e,c=R(e.haloSize,0);if(c<=0||!s?.symbolLayers)return null;let u=s.symbolLayers.filter(e=>e.enable!==!1),f=u[0];if(!f)return null;let p=u.length===1&&f.type===`CIMSolidFill`;if(e.symbolLayers?.some(e=>l(e))===!0||l(s))return X().warnOnce(`CIM point symbol halos do not support independently animated symbol components`),null;let m=i?.map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null);if(m?.some(({effect:e})=>Z(e))){if(!p)return X().warnOnce(`Complex CIM point symbol halos are not supported with geometry-changing effects`),null;let t=e.symbolLayers?.filter(e=>e.enable!==!1)??[];if(!xe(t,m))return X().warnOnce(`CIM point symbol halos with geometry-changing effects currently require polygon-producing effects and an unambiguous solid-fill effect chain`),null;let n=t.find(e=>e.type===`CIMSolidFill`);if(!n)return null;let i=[...m,...(n.effects??[]).map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null)],a=z(t),o=this._getValueOrOverrideExpression(f.type,f.primitiveName,`Color`,P(f.color));return this._cimLayers.push({type:`outlineFill`,name:n.name,colorLocked:!!n.colorLocked,color:this._getValueOrOverrideExpression(n.type,n.primitiveName,`Color`,P(n.color)),effects:i,effectsChangeGeometryType:!0,outlineColorLocked:!0,outlineColor:o,outlineWidth:2*c+a,cap:`Round`,join:`Round`,referenceWidth:r,pixelBufferSize:2*c+a,outlineEffects:i}),n}let h=e.symbolLayers?.filter(e=>e.enable!==!1)??[],g=h.length===1&&h[0].type===`CIMVectorMarker`?h[0]:null,_=n(e);if(_.effects=void 0,_.angle=0,_.scaleX=1,g){let e=_.symbolLayers?.find(e=>e.type===`CIMVectorMarker`&&e.enable!==!1);e&&(e.rotation=0,e.offsetX=0,e.offsetY=0)}let v={..._,haloSize:0,haloSymbol:void 0},x=y.getPointSymbolHaloPadding(e,this._resourceManager),[S,C,w]=b.getTextureAnchor(v,this._resourceManager,ue,x),T=a(w),D=[];E.findApplicableOverrides(_,this._primitiveOverrides,D);let k=g?D.filter(e=>e.primitiveName!==g.primitiveName||![`Rotation`,`OffsetX`,`OffsetY`].includes(e.propertyName)):D,A=g?[{offsetX:this._getValueOrOverrideExpression(g.type,g.primitiveName,`OffsetX`,R(g.offsetX)),offsetY:this._getValueOrOverrideExpression(g.type,g.primitiveName,`OffsetY`,R(g.offsetY)),rotation:this._getValueOrOverrideExpression(g.type,g.primitiveName,`Rotation`,R(g.rotation)),size:T,frameHeight:T,rotateClockWise:!!g.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:!1}]:[],j=$(p?d(this._poMap,f,o):o),M,N;if(j){let e=b.getEnvelope(v,null,this._resourceManager);e&&(M=[e.width,e.height],N=[e.width+2*x,e.height+2*x])}return this._cimLayers.push({type:`marker`,spriteRasterizationParam:{type:`sprite-rasterization-param`,resource:{type:`cim-point-symbol-halo`,symbol:_,sdf:!j&&p&&O(v)!=null},overrides:k},colorLocked:!0,color:p?this._getValueOrOverrideExpression(f.type,f.primitiveName,`Color`,P(f.color)):[255,255,255,1],effects:m??null,effectsChangeGeometryType:m?.some(({effect:e})=>Z(e)),scaleSymbolsProportionally:!1,alignment:t,anchorPoint:{x:S,y:C},isAbsoluteAnchorPoint:!1,size:T,scaleX:R(e.scaleX,1),rotation:g?0:R(e.angle,0),offsetX:0,offsetY:0,outlineColor:[0,0,0,0],outlineWidth:0,transform:{type:`cim-marker-transform-param`,params:A},frameHeight:T,widthRatio:1,rotateClockwise:!1,referenceSize:r||T,sizeRatio:1,markerPlacement:null,isOutline:!1,animationParams:j,baseSize:r||T,pixelDimensions:M,texelDimensions:N}),null}_analyzeSolidFill(e,t,n,r){let{primitiveName:i,type:a}=e,o=P(e.color),s=d(this._poMap,e,n);if(!r&&t?.some(e=>e.effect.type===`CIMGeometricEffectTaperedPolygon`)){let n=this._getValueOrOverrideExpression(a,i,`Color`,o);this._cimLayers.push({type:`outlineFill`,name:e.name,colorLocked:!!e.colorLocked,color:n,effects:t,outlineColor:n,outlineColorLocked:!!e.colorLocked,...S,outlineEffects:t})}else this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(a,i,`Color`,o),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:t,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1,animationParams:$(s)})}_analyzePictureFill(e,t,n){let{primitiveName:r,type:i}=e,a=B(e),o=R(e.height,C.CIMPictureFill.height),s=R(e.scaleX,1);if(`width`in e&&typeof e.width==`number`){let t=e.width,n=1,r=this._resourceManager.getResource(e.url);r!=null&&(n=r.width/r.height),s/=o/t*n}let c={type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(r,i)},l=d(this._poMap,e,n);this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:c,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(i,r,`TintColor`,a),height:this._getValueOrOverrideExpression(i,r,`Height`,o),scaleX:this._getValueOrOverrideExpression(i,r,`ScaleX`,s),angle:this._getValueOrOverrideExpression(i,r,`Rotation`,R(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,r,`OffsetX`,R(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,r,`OffsetY`,R(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1,animationParams:$(l)})}_analyzeHatchFill(e,t,n){let{primitiveName:r,type:i}=e,a=d(this._poMap,e,n),o=this._analyzeMaterialOverrides(r,[`Rotation`,`OffsetX`,`OffsetY`]),s=V(o),c=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(let t of e.lineSymbol.symbolLayers){if(t.type!==`CIMSolidStroke`)continue;let e=t.primitiveName??r;!l&&e&&!t.colorLocked&&(this._poMap[e]?.Color!=null||this._poMap[e]?.StrokeColor!=null)&&(c=P(t.color),c=this._maybeGetValueOrOverrideExpression(e,`StrokeColor`)??this._getValueOrOverrideExpression(i,e,`Color`,c),l=!0);let n=this._maybeGetValueOrOverrideExpression(e,`StrokeWidth`);if(n){let t=null,r=null;typeof n==`number`?t=n:r=n.valueExpressionInfo;let a=s.find(e=>e.propertyName===`strokeWidth`);a?a.propertyName=`width`:(a={type:`CIMPrimitiveOverride`,primitiveName:e,propertyName:`width`,valueExpressionInfo:r,value:t,defaultValue:H(i,`width`)},s.push(a))}}let u={type:`sprite-rasterization-param`,resource:e,overrides:s};this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:u,colorLocked:!!e.colorLocked,effects:t,color:c,height:this._getValueOrOverrideExpression(i,r,`Separation`,R(e.separation,C.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,r,`Rotation`,R(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,r,`OffsetX`,R(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,r,`OffsetY`,R(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l,animationParams:$(a)})}_analyzeGradientFill(e,t){let{angle:n,gradientMethod:r,gradientSize:i,gradientSizeUnits:a,gradientType:o,interval:s,primitiveName:c,type:l}=e,u=C.CIMGradientFill,d=e.colorRamp;this._cimLayers.push({type:`gradientFill`,name:e.name,spriteRasterizationParam:{type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(c,l)},colorLocked:!1,effects:t,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(l,c,`GradientMethod`,r??`Linear`),angle:this._getValueOrOverrideExpression(l,c,`Angle`,R(n,u.angle)),gradientType:this._getValueOrOverrideExpression(l,c,`GradientType`,o??u.gradientType),interval:this._getValueOrOverrideExpression(l,c,`Interval`,R(s,d.type===`CIMFixedColorRamp`?d.colors.length:u.interval)),gradientSize:this._getValueOrOverrideExpression(l,c,`GradientSize`,R(i,u.gradientSize)),gradientSizeUnits:a===`Absolute`?M.Absolute:a===`Relative`?M.Relative:u.gradientSizeUnits})}_analyzeCompositeOutlineFill(e,t,n,r=[]){let i=e.find(e=>e.type===`CIMSolidFill`),a=e.find(e=>e.type===`CIMSolidStroke`);if(i==null||a==null)return;let o=[...r,...[...t??[],...i.effects??[]].map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null)],s=[...r,...[...t??[],...a.effects??[]].map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null)],c=R(a.width,C.CIMSolidStroke.width),l=U(a.capStyle,C.CIMSolidStroke.capstyle),u=U(a.joinStyle,C.CIMSolidStroke.joinstyle),d=a.miterLimit;this._cimLayers.push({type:`outlineFill`,name:i.name,colorLocked:!!i.colorLocked,color:this._getValueOrOverrideExpression(i.type,i.primitiveName,`Color`,P(i.color)),effects:o,effectsChangeGeometryType:o.some(({effect:e})=>Z(e))||s.some(({effect:e})=>Z(e)),outlineColorLocked:!!a.colorLocked,outlineColor:this._getValueOrOverrideExpression(a.type,a.primitiveName,`Color`,P(a.color)),outlineWidth:this._getValueOrOverrideExpression(a.type,a.primitiveName,`Width`,c),cap:this._getValueOrOverrideExpression(a.type,a.primitiveName,`CapStyle`,l),join:this._getValueOrOverrideExpression(a.type,a.primitiveName,`JoinStyle`,u),miterLimit:d&&this._getValueOrOverrideExpression(a.type,a.primitiveName,`MiterLimit`,d),referenceWidth:n,outlineEffects:s})}_analyzeSolidStroke(e,t,n,r,i){let{primitiveName:a,type:o}=e,s=P(e.color),c=R(e.width,C.CIMSolidStroke.width),l=U(e.capStyle,C.CIMSolidStroke.capstyle),u=U(e.joinStyle,C.CIMSolidStroke.joinstyle),f=e.miterLimit,p=this._analyzePrimitiveOverrides(a,t,null,null),m=[];p&&(m=this._getPrimitiveMaterialOverrides(a,o));let h,g,_,v;if(t&&Array.isArray(t)&&t.length>0){let e=t[t.length-1].effect;e&&e.type===`CIMGeometricEffectDashes`&&e.lineDashEnding===`NoConstraint`&&(h=e.dashTemplate,g=e.scaleDash,_=e.offsetAlongLine,v=e.primitiveName,t=[...t],t.pop())}v!=null&&m.push(...this._getPrimitiveMaterialOverrides(v,o).filter(e=>e.propertyName===`dashTemplate`));let y=h===void 0?null:{type:`sprite-rasterization-param`,resource:{type:`dash`,dashTemplate:h,primitiveName:v},overrides:m},b=d(this._poMap,e,i);this._cimLayers.push({type:`line`,name:e.name,spriteRasterizationParam:y,isOutline:n,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(o,a,`Color`,s),width:this._getValueOrOverrideExpression(o,a,`Width`,c),cap:this._getValueOrOverrideExpression(o,a,`CapStyle`,l),join:this._getValueOrOverrideExpression(o,a,`JoinStyle`,u),miterLimit:f&&this._getValueOrOverrideExpression(o,a,`MiterLimit`,f),referenceWidth:r,zOrder:he(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(v,`DashTemplate`)??h,offsetAlongLine:this._getValueOrOverrideExpression(o,v,`OffsetAlongLine`,_??0),scaleDash:g,sampleAlphaOnly:!0,animationParams:$(b)})}_analyzePictureStroke(e,t,n,r,i){let{primitiveName:a,type:o}=e,s=B(e),c=R(e.width,C.CIMPictureStroke.width),l=U(e.capStyle,C.CIMPictureStroke.capstyle),u=U(e.joinStyle,C.CIMPictureStroke.joinstyle),f=e.miterLimit,p={type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(a,o)},m=d(this._poMap,e,i);this._cimLayers.push({type:`line`,name:e.name,spriteRasterizationParam:p,isOutline:n,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(o,a,`TintColor`,s),width:this._getValueOrOverrideExpression(o,a,`Width`,c),cap:this._getValueOrOverrideExpression(o,a,`CapStyle`,l),join:this._getValueOrOverrideExpression(o,a,`JoinStyle`,u),miterLimit:f&&this._getValueOrOverrideExpression(o,a,`MiterLimit`,f),referenceWidth:r,zOrder:he(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1,animationParams:$(m)})}_analyzeGradientStroke(e,t,n,r){let{gradientMethod:i,gradientSize:a,gradientSizeUnits:o,gradientType:s,interval:c,primitiveName:l,type:u}=e,d=C.CIMGradientStroke,f=R(e.width,d.width),p=U(e.capStyle,d.capstyle),m=U(e.joinStyle,d.joinstyle),h=e.miterLimit,g=e.colorRamp;this._cimLayers.push({type:`gradientStroke`,name:e.name,spriteRasterizationParam:{type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(l,u)},colorLocked:!!e.colorLocked,effects:t,color:[255,255,255,1],width:this._getValueOrOverrideExpression(u,l,`Width`,f),cap:this._getValueOrOverrideExpression(u,l,`CapStyle`,p),join:this._getValueOrOverrideExpression(u,l,`JoinStyle`,m),miterLimit:h&&this._getValueOrOverrideExpression(u,l,`MiterLimit`,h),referenceWidth:r,isOutline:n,gradientMethod:this._getValueOrOverrideExpression(u,l,`GradientMethod`,i??d.gradientMethod),gradientType:this._getValueOrOverrideExpression(u,l,`GradientType`,s??d.gradientType),interval:this._getValueOrOverrideExpression(u,l,`Interval`,R(c,g.type===`CIMFixedColorRamp`?g.colors.length:d.interval)),gradientSize:this._getValueOrOverrideExpression(u,l,`GradientSize`,R(a,d.gradientSize)),gradientSizeUnits:o===`Absolute`?M.Absolute:o===`Relative`?M.Relative:d.gradientSizeUnits})}_analyzeMarker(e,t,n,r,i,a,o,s,c,l=!1,u=!1){l||=!!e.colorLocked;let h=c;if(h=f(e,h),h=p(this._poMap,e,h),h=m(e,h),h=d(this._poMap,e,h),this._analyzeMarkerInsidePolygon(e,t,l,h))return;let g=R(e.size,C.CIMVectorMarker.size),_=R(e.rotation),v=R(e.offsetX),y=R(e.offsetY),{primitiveName:b,type:x}=e,S=this._getValueOrOverrideExpression(x,b,`Size`,g),w=this._getValueOrOverrideExpression(x,b,`Rotation`,_),T=this._getValueOrOverrideExpression(x,b,`OffsetX`,v),E=this._getValueOrOverrideExpression(x,b,`OffsetY`,y);switch(e.type){case`CIMPictureMarker`:this._analyzePictureMarker(e,t,n,r,i,a,S,w,T,E,s,h,l,u);break;case`CIMVectorMarker`:this._analyzeVectorMarker(e,t,n,r,i,a,S,w,T,E,s,h,o,l,u)}}_analyzeMarkerInsidePolygon(e,t,n,r){let{markerPlacement:i,type:o}=e;if(!i||i.type!==`CIMMarkerPlacementInsidePolygon`||r.hasMotionAnimations)return!1;if(o===`CIMVectorMarker`||o===`CIMPictureMarker`){let n=e.primitiveName;if(n&&this._analyzePrimitiveOverrides([n],t,null,null))return!1;let r=i.primitiveName;if(r&&this._analyzePrimitiveOverrides([r],t,null,null))return!1;if(o===`CIMVectorMarker`){let{markerGraphics:t}=e;if(t)for(let e of t){let{symbol:t}=e;if(t?.type===`CIMPolygonSymbol`&&t.symbolLayers){let{symbolLayers:e}=t;for(let t of e)if(t.type===`CIMSolidStroke`)return!1}}}else{let{animatedSymbolProperties:t}=e;if(t)return!1}}let s=Math.abs(i.stepX),c=Math.abs(i.stepY);if(s===0||c===0)return!0;let l,u;if(i.gridType===`Random`){let e=a(de),t=Math.max(Math.floor(e/s),1);l=c*Math.max(Math.floor(e/c),1),u=t*s/l}else i.shiftOddRows?(l=c*2,u=s/c*.5):(l=c,u=s/c);let d=B(e),f=e.type===`CIMCharacterMarker`?null:{type:`sprite-rasterization-param`,resource:{...e,effects:e.effects?.filter(e=>!ye(e))},overrides:[]};return this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:f,colorLocked:n,effects:t,color:d,height:l,scaleX:u,angle:i.gridAngle??0,offsetX:R(i.offsetX),offsetY:R(i.offsetY),applyRandomOffset:i.gridType===`Random`,sampleAlphaOnly:e.type!==`CIMPictureMarker`,hasUnresolvedReplacementColor:!0,animationParams:$(r)}),!0}_analyzePictureMarker(e,t,r,i,a,s,c,l,u,d,f,p,m,h){let{animatedSymbolProperties:g,primitiveName:_,type:v}=e,y=R(e.scaleX,1),b=B(e);r||=this._createMarkerPlacementOverrideExpression(e.markerPlacement);let x=this._createGIFAnimatedSymbolPropertiesOverrideExpression(g),S=e.anchorPoint??{x:0,y:0};if(`width`in e&&typeof e.width==`number`){let t=e.width,n=1,r=this._resourceManager.getResource(e.url);r!=null&&(n=r.width/r.height);let i=R(e.size);y/=i/t*n}let C=[...i];e.primitiveName&&C.push(e.primitiveName);let w;g||x?w={type:`animated`,url:e.url,urlHash:`H`+o(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(w=n(e),w.markerPlacement=null);let T={type:`sprite-rasterization-param`,resource:w,overrides:this._getMaterialOverrides(C,v)};x&&T.overrides.push(...x.overrides);let E=c;this._cimLayers.push({type:`marker`,name:e.name,spriteRasterizationParam:T,colorLocked:m,effects:t,scaleSymbolsProportionally:!1,alignment:a,size:c,scaleX:this._getValueOrOverrideExpression(v,_,`ScaleX`,y),rotation:l,offsetX:u,offsetY:d,transform:{type:`cim-marker-transform-param`,params:f},color:this._getValueOrOverrideExpression(v,_,`TintColor`,b),anchorPoint:{x:S.x,y:S.y},isAbsoluteAnchorPoint:e.anchorPointUnits!==`Relative`,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:s,sizeRatio:1,isOutline:h,markerPlacement:r,animationParams:$(p),baseSize:E})}_analyzeVectorMarker(e,t,n,r,i,a,o,l,u,d,f,p,m,v,y){let b=e.markerGraphics;if(!b)return;let x=e.frame,S=0;S=x?x.ymax-x.ymin:a;let C=!!e.scaleSymbolsProportionally;if(S){let t={offsetX:u,offsetY:d,rotation:l,size:o,frameHeight:S,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:C};f=[...f,t]}n||=this._createMarkerPlacementOverrideExpression(e.markerPlacement);for(let o of b)if(o){let l=o.symbol;if(!l)continue;let u=o.primitiveName;u&&r.push(u);let d=p,b;if((l.type===`CIMPointSymbol`||l.type===`CIMTextSymbol`)&&x){let t=0,n=0,r=o.geometry;`x`in r&&`y`in r&&(t+=r.x-(x.xmin+x.xmax)*.5,n+=r.y-(x.ymin+x.ymax)*.5);let i=e.anchorPoint,a=!1;i&&(e.anchorPointUnits===`Absolute`?(t-=i.x,n-=i.y,a=!0):x&&(t-=(x.xmax-x.xmin)*i.x,n-=(x.ymax-x.ymin)*i.y));let s={offsetX:t,offsetY:n,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:a,scaleSymbolsProportionally:C};b=[...f,s]}(l.type===`CIMPointSymbol`||l.type===`CIMTextSymbol`)&&this._analyzeCallout(l,t,b??f,d,a,i,m);let w=s(o.geometry)?{...o,geometry:c(o.geometry,{maxDeviation:.01})}:o,T=w.geometry,[E,D]=h(T,x);switch((E!==0||D!==0)&&(d=g(d,E,D)),l.type){case`CIMPointSymbol`:case`CIMLineSymbol`:case`CIMPolygonSymbol`:m||ve(l)?(d={...d,transform:{type:`AnimatedTransform`,relativeTranslation:!1,absoluteScale:!0,selectGlobalRotation:!1,translation:_([0,0]),rotation:_(0),scale:_(S),parent:p.transform}},this._analyzeMultiLayerGraphicNonSDF(e,t,n,w,r,i,a,b??f,d,S,v,y)):this._analyzeMultiLayerGraphic(e,t,n,w,r,i,a,b??f,d,S,v,y);break;case`CIMTextSymbol`:this._analyzeTextGraphic(t,n,w,r,i,a,b??f,v)}u&&r.pop()}}_analyzeCallout(e,t,n,r,i,a,o){let s=e.callout;if(!s||!ie(s))return;let c=t??[],{leaderTolerance:l,leaderOffset:u}=s;switch(s.type){case`CIMSimpleLineCallout`:{let{lineSymbol:e,autoSnap:t}=s,d={type:`CIMSimpleLineCallout`,leaderTolerance:l,leaderOffset:u,autoSnap:t,inflateSize:500};this._analyzeSymbolLayer(e,[...c,{type:`cim-effect-param`,effect:d,overrides:[]}],n,r,i,a,o);break}case`CIMBackgroundCallout`:{let{accentBarSymbol:e,gap:t,backgroundSymbol:d,leaderLineSymbol:f,lineStyle:p,margin:m}=s,h=n=>({type:`CIMBackgroundCallout`,leaderTolerance:l,leaderOffset:u,lineStyle:Y(p),gap:t,hasAccentBar:!!e,margin:m,inflateSize:500,part:n}),g=[...c,{type:`cim-effect-param`,effect:h(`background`),overrides:[]}];if(f&&this._analyzeSymbolLayer(f,[...c,{type:`cim-effect-param`,effect:h(`leader`),overrides:[]}],n,r,i,a,o),d){let e=d.symbolLayers??[];Q(e)?this._analyzeCompositeOutlineFill(e,null,i,g):this._analyzeSymbolLayer(d,g,n,r,i,a,o)}e&&this._analyzeSymbolLayer(e,[...c,{type:`cim-effect-param`,effect:h(`accent-bar`),overrides:[]}],n,r,i,a,o);break}case`CIMBalloonCallout`:{let{balloonStyle:e,backgroundSymbol:t,dartSymbol:d,fixedDartWidth:f,margin:p,useDartSymbol:m,useFixedDartWidth:h}=s,g=m===!0&&d!=null,_=t=>({type:`CIMBalloonCallout`,leaderTolerance:l,leaderOffset:u,margin:p,balloonStyle:ce(e),dartWidth:h?f:void 0,inflateSize:500,part:t,separateDart:g}),v=(e,t)=>{let s=[...c,{type:`cim-effect-param`,effect:_(t),overrides:[]}],l=e.symbolLayers??[];Q(l)?this._analyzeCompositeOutlineFill(l,null,i,s):this._analyzeSymbolLayer(e,s,n,r,i,a,o)};g&&v(d,`dart`),v(t,`background`);break}case`CIMPointSymbolCallout`:{let{backgroundScale:e,gap:t,leaderLineSymbol:d,lineStyle:f,pointSymbol:p}=s,m=oe(e),h=ae(p,n),g=e=>({type:`CIMPointSymbolCallout`,leaderTolerance:l,leaderOffset:u,backgroundScale:m,...se(p,e),lineStyle:Y(f),gap:t,inflateSize:500,part:e});d&&this._analyzeSymbolLayer(d,[...c,{type:`cim-effect-param`,effect:g(`leader`),overrides:[]}],n,r,i,a,o),this._analyzeSymbolLayer(p,[...c,{type:`cim-effect-param`,effect:g(`marker`),overrides:[]}],h,r,i,a,o||m!==0);break}case`CIMCompositeCallout`:{let{backgroundSymbol:e,margin:t,shadowSymbol:d}=s,f={type:`CIMBalloonCallout`,leaderTolerance:l,leaderOffset:u,margin:t,balloonStyle:1,inflateSize:500,part:`background`},p=[...c,{type:`cim-effect-param`,effect:f,overrides:[]}],m=e=>{let t=e.symbolLayers??[];Q(t)?this._analyzeCompositeOutlineFill(t,null,i,p):this._analyzeSymbolLayer(e,p,n,r,i,a,o)};d&&m(d),m(e);break}}}_analyzeMultiLayerGraphic(e,t,n,r,i,a,o,s,c,l,u,d){let f=r.symbol,p=f.symbolLayers;p&&(_e(p)&&!v(c)?this._analyzeCompositeMarkerGraphic(e,t,n,r,p,a,o,s,l,u,d):Se(p)?(x(f,e=>{e.colorLocked&&(u=!0)}),this._analyzeMultiLayerGraphicNonSDF(e,t,n,r,i,a,o,s,c,l,u,d)):this._analyzeMarkerGraphicSymbolLayers(e,t,n,r,i,a,o,s,c,l,u,d))}_analyzeMarkerGraphicSymbolLayers(e,t,n,r,i,a,o,s,c,l,u,f){let p=r.symbol,m=p.symbolLayers;if(!m)return;let h=le.applyEffects(p.effects,r.geometry);if(!h)return;let g=m.length;for(;g--;){let p=m[g];if(!p||p.enable===!1)continue;let _=p.primitiveName;switch(_&&i.push(_),p.type){case`CIMSolidFill`:case`CIMSolidStroke`:{let i=le.applyEffects(p.effects,h),m=k(i);if(!m)continue;let g=e.anchorPointUnits!==`Relative`,v=p.type===`CIMSolidStroke`?p.width:0,{frameSizeRatio:y,anchorX:b,anchorY:x,widthRatio:S,sdfPaddingRatio:w,sdfTextureSize:T}=A(m,e.frame,e.size,e.anchorPoint,g,v,e.scaleSymbolsProportionally),E=p.type===`CIMSolidFill`,D={type:`sdf`,geometry:i,sdfPaddingRatio:w,asFill:E,sdfTextureSize:T},{path:O}=p,M=E?P(W(p)):O==null?P(G(p)):[0,0,0,0],N=E?[0,0,0,0]:P(G(p));if(!E&&!v)break;let F=r.primitiveName,I=null;E&&!p.colorLocked&&(I=this._maybeGetValueOrOverrideExpression(F,`FillColor`));let L=null;!E&&!p.colorLocked&&(L=this._maybeGetValueOrOverrideExpression(F,`StrokeColor`));let z=I??this._getValueOrOverrideExpression(p.type,_,`Color`,M),B=L??this._getValueOrOverrideExpression(p.type,_,`Color`,N),V=this._maybeGetValueOrOverrideExpression(F,`StrokeWidth`)??this._getValueOrOverrideExpression(p.type,_,`Width`,v),H=O?{type:`sprite-rasterization-param`,resource:{type:`path`,path:O,asFill:E},overrides:[]}:{type:`sprite-rasterization-param`,resource:D,overrides:[]},U=d(this._poMap,p,c),K=R(e.size,C.CIMVectorMarker.size),q=this._getValueOrOverrideExpression(e.type,e.primitiveName,`Size`,K);this._cimLayers.push({type:`marker`,name:p.name,groupName:e.name,spriteRasterizationParam:H,colorLocked:!!p.colorLocked||!!u,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:b,y:x},isAbsoluteAnchorPoint:g,size:l,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:`cim-marker-transform-param`,params:s},frameHeight:l,widthRatio:S,rotateClockwise:!1,referenceSize:o,sizeRatio:y,color:z,outlineColor:B,outlineWidth:V,isOutline:f,markerPlacement:n,animationParams:$(U),isStroke:p.type!==`CIMSolidFill`,baseSize:q,...j(i,T,w)});break}case`CIMPictureMarker`:case`CIMVectorMarker`:if(p.markerPlacement){X().error(`Error analyzing CIM, got unexpected marker placement`);break}this._analyzeMarker(p,t,n,i,a,o,!1,s,c,u,f)}_&&i.pop()}}_analyzeTextGraphic(e,n,r,i,a,o,s,c){E.findApplicableOverrides(r,this._primitiveOverrides,[]);let l=r.geometry;if(!(`x`in l)||!(`y`in l))return;let u=r.symbol,d=K(u),f=T(u.fontStyleName),p=t(u.fontFamilyName);u.font={family:p,decoration:d,...f};let m=R(u.height,C.CIMTextSymbol.height),h=R(u.angle),g=R(u.offsetX),_=R(u.offsetY),{haloSymbol:v}=u,y=R(u.haloSize,0),b=[0,0,0,0];if(v?.symbolLayers?.length){let e=v.symbolLayers;for(let t of e)if(t.color){b=this._getValueOrOverrideExpression(u?.haloSymbol?.type??`CIMPolygonSymbol`,t.primitiveName,`Color`,P(t.color));break}}let x=r.primitiveName,S=[0,0,0,1],w=[0,0,0,0],O=0,k=!1;if(u.symbol?.symbolLayers)for(let e of u.symbol.symbolLayers){let t=e.primitiveName;if(e.type===`CIMSolidStroke`)w=this._getValueOrOverrideExpression(`CIMSolidStroke`,t,`Color`,P(e.color)),O=this._getValueOrOverrideExpression(`CIMSolidStroke`,t,`Width`,q(e)??0);else if(e.type===`CIMSolidFill`){let n=P(e.color);k??=!!e.colorLocked,S=this._getValueOrOverrideExpression(`CIMSolidFill`,t??x,`Color`,n)}}let A=null,j=null,M=null,N=null,F=null;x&&(A=this._maybeGetValueOrOverrideExpression(x,`TextSize`),j=this._maybeGetValueOrOverrideExpression(x,`TextAngle`),M=this._maybeGetValueOrOverrideExpression(x,`TextOffsetX`),N=this._maybeGetValueOrOverrideExpression(x,`TextOffsetY`),k||(F=this._maybeGetValueOrOverrideExpression(x,`FillColor`)));let I=F??S,L=null,z=null,B=0,V=u.callout?.type===`CIMBackgroundCallout`;if(u.callout?.type===`CIMBackgroundCallout`){let e=u.callout;if(e.backgroundSymbol){let t=e.backgroundSymbol.symbolLayers;if(t)for(let e of t)e.type===`CIMSolidFill`?L=P(e.color):e.type===`CIMSolidStroke`&&(z=P(e.color),B=R(e.width,C.CIMSolidStroke.width))}}let H=this._getValueOrOverrideExpression(u.type,r.primitiveName,`TextString`,r.textString??``);if(H==null)return;let{fontStyleName:U}=u,W=p+(U?`-`+U.toLowerCase():`-regular`),G=this._getMaterialOverrides(i,u.type);G.push(...this._getPrimitiveMaterialOverrides(r.primitiveName,u.type)),this._collectDictionaryTemplateOverrides(G,r);let J={type:`text-rasterization-param`,resource:{type:`text`,textString:r.textString??``,font:u.font,symbol:u,primitiveName:r.primitiveName,supportsRichText:D(r.textString??``)||G.some(e=>e.propertyName===`textString`)},overrides:G};this._cimLayers.push({type:`text`,lineWidth:u.lineWidth,textRasterizationParam:J,colorLocked:!!c||!!k,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:W,decoration:d,haloSize:y,haloColor:b,weight:f.weight,style:f.style,size:A??m,angle:j??h,offsetX:M??g,offsetY:N??_,transform:{type:`cim-marker-transform-param`,params:s},horizontalAlignment:te(u.horizontalAlignment),verticalAlignment:ee(u.verticalAlignment),text:H,color:I,outlineColor:w,outlineSize:O,backgroundColor:L,borderLineColor:z,borderLineWidth:B,useBackgroundCallout:V,referenceSize:o,sizeRatio:1,markerPlacement:n})}_collectDictionaryTemplateOverrides(e,t){if(t.textString&&this._hasTextStringTemplates){let n=J(t.symbol);e.push({propertyName:`textString`,defaultValue:``,valueExpressionInfo:{type:`dictionary-template`,textCase:n,template:t.textString},primitiveName:t.primitiveName})}}_analyzeMultiLayerGraphicNonSDF(e,t,n,r,a,o,s,c,l,u,d,f){let p=me(e,r),m=e.primitiveName,h=this._analyzeMaterialOverrides(m,[`Rotation`,`OffsetX`,`OffsetY`]),g=V(h),[_,v,y]=b.getTextureAnchor(p,this._resourceManager,ue),x=this._getMaterialOverrides(a,e.type).filter(e=>e.primitiveName!==m||![`rotation`,`offsetX`,`offsetY`].includes(e.propertyName));x.push(...g);let S={type:`sprite-rasterization-param`,resource:{...p,avoidSDFRasterization:!0},overrides:x},w=R(e.size,C.CIMVectorMarker.size),T=this._getValueOrOverrideExpression(e.type,m,`Size`,w);this._cimLayers.push({type:`marker`,name:e.name,spriteRasterizationParam:S,colorLocked:d,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:o,anchorPoint:{x:_,y:v},isAbsoluteAnchorPoint:!1,size:u,rotation:0,offsetX:0,offsetY:0,transform:{type:`cim-marker-transform-param`,params:c},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:u,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:s,sizeRatio:y/i(e.size),isOutline:f,markerPlacement:n,animationParams:$(l),baseSize:T})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;let t=[];return E.findApplicableOverrides(e,this._primitiveOverrides,t),{type:`cim-marker-placement-param`,placement:e,overrides:we(t)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;let t=[];return E.findApplicableOverrides(e,this._primitiveOverrides,t),{type:`cim-gif-animation-params`,animation:e,overrides:we(t)}}_analyzeCompositeMarkerGraphic(e,t,n,r,i,a,o,s,c,l,u){let d=r.geometry,f=i[0],p=i[1],m=k(d);if(!m)return;let h=e.anchorPointUnits!==`Relative`,g=R(f.width,C.CIMSolidStroke.width),{frameSizeRatio:_,anchorX:v,anchorY:y,widthRatio:b,sdfPaddingRatio:x,sdfTextureSize:S}=A(m,e.frame,e.size,e.anchorPoint,h,g,e.scaleSymbolsProportionally),{path:w}=p,T=p.primitiveName,E=f.primitiveName,D=r.primitiveName,O=null;!p.colorLocked&&!l&&(O=this._maybeGetValueOrOverrideExpression(D,`FillColor`));let j=O??this._getValueOrOverrideExpression(p.type,T,`Color`,P(p.color)),M=null;!f.colorLocked&&!l&&(M=this._maybeGetValueOrOverrideExpression(D,`StrokeColor`));let N=M??this._getValueOrOverrideExpression(f.type,E,`Color`,P(f.color)),F=this._maybeGetValueOrOverrideExpression(D,`StrokeWidth`)??this._getValueOrOverrideExpression(f.type,E,`Width`,g),I={type:`sprite-rasterization-param`,resource:w?{type:`path`,path:w,asFill:!0}:{type:`sdf`,geometry:d,sdfTextureSize:S,sdfPaddingRatio:x,asFill:!0},overrides:[]};this._cimLayers.push({type:`marker`,name:e.name,spriteRasterizationParam:I,colorLocked:l,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:v,y},isAbsoluteAnchorPoint:h,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:`cim-marker-transform-param`,params:s},frameHeight:c,widthRatio:b,rotateClockwise:!1,referenceSize:o,sizeRatio:_,color:j,outlineColor:N,outlineWidth:F,isOutline:u,markerPlacement:n})}_setPoMap(e,t,n){let r;this._poMap[e]?r=this._poMap[e]:(r={},this._poMap[e]=r),r[t]=n}_maybeGetValueOrOverrideExpression(e,t,n){return this._getValueOrOverrideExpression(``,e,t,n,!1)}_getValueOrOverrideExpression(e,t,n,r,i=!0){if(i&&!ne(r)&&(r=H(e,n.toLowerCase())),t==null)return r;let a=this._poMap[t];if(a==null)return r;let o=a[n];return typeof o==`string`||typeof o==`number`||Array.isArray(o)?o:o?{valueExpressionInfo:o,defaultValue:r}:r}_analyzePrimitiveOverrides(e,t,n,r){if(e==null)return!1;typeof e==`string`&&(e=[e]);for(let t of this._primitiveOverrides)if(e.includes(t.primitiveName)&&t.valueExpressionInfo)return!0;if(t!=null){for(let e of t)if(e?.overrides.length>0)return!0}if(n!=null){for(let e of n)if(e?.overrides.length>0)return!0}if(r!=null){for(let e of r)if(e?.overrides.length>0)return!0}return!1}_getMaterialOverrides(e,t){if(!e)return[];let n=[];for(let r of e)n.push(...this._getPrimitiveMaterialOverrides(r,t));return n}_getPrimitiveMaterialOverrides(e,t){if(!e)return[];let n=V(this._primitiveOverrides.filter(t=>t.primitiveName===e));return n.forEach(e=>e.defaultValue=H(t,e.propertyName.toLowerCase())),n}_analyzeMaterialOverrides(e,t){return this._primitiveOverrides.filter(n=>n.primitiveName!==e||!t.includes(n.propertyName))}}function me(e,t){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[{...t}],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}function he(e){if(e?.startsWith(`Level_`)){let t=parseInt(e.slice(6),10);if(!isNaN(t))return t}return 0}function ge(e,t){if(!t||t.length===0)return e;let r=n(e);return E.applyOverrides(r,t),r}const _e=e=>e&&e.length===2&&e[0].enable&&e[1].enable&&e[0].type===`CIMSolidStroke`&&e[1].type===`CIMSolidFill`&&e[0].path==null&&e[1].path==null&&!e[0].effects&&!e[1].effects&&!e[0].animations&&!e[1].animations;function ve(e){let t=e.symbolLayers;if(!t)return!1;let n=t.find(e=>e.effects?.find(e=>e.type===`CIMGeometricEffectDashes`&&e.dashTemplate!=null)),r=t.find(e=>e.effects?.find(e=>e.type===`CIMGeometricEffectAddControlPoints`));return!!n||!!r}function ye(e){return Z(e)}function Z(e){return e.type===`CIMGeometricEffectCircularSector`||e.type===`CIMGeometricEffectRadial`||e.type===`CIMGeometricEffectTaperedPolygon`||e.type===`PrivateDimensionEffect`||e.type===`PrivateMatcherGeometryOverrideEffect`}function be(e){return e.type===`CIMGeometricEffectCircularSector`||e.type===`CIMGeometricEffectTaperedPolygon`}function xe(e,t){let n=e.filter(e=>e.type===`CIMSolidFill`),r=e.every(e=>e.type===`CIMSolidFill`||e.type===`CIMSolidStroke`),i=e.filter(e=>e.effects?.length),a=i.length===0||i.length===1&&n.length===1&&i[0]===n[0];return n.length>0&&r&&a&&t.some(({effect:e})=>be(e))}function Se(e){return e.some(e=>e.type!==`CIMSolidFill`&&e.type!==`CIMSolidStroke`&&(e.type!==`CIMVectorMarker`&&e.type!==`CIMPictureMarker`||e.markerPlacement!=null))}function Ce(e,t){return!!(t?.some(e=>e.type===`CIMGeometricEffectRadial`)&&t?.some(e=>e.type===`CIMGeometricEffectTaperedPolygon`)||t?.some(e=>e.type===`CIMGeometricEffectCircularSector`))&&Q(e)}function Q(e){if(e?.length!==2)return!1;let t=e.find(e=>e.type===`CIMSolidFill`),n=e.find(e=>e.type===`CIMSolidStroke`),r=n?.effects?.some(e=>e.type===`CIMGeometricEffectDashes`);return t!=null&&n!=null&&!r}function we(e){return n(e).map(e=>({...e,propertyName:re(e.propertyName)}))}function $(e){return v(e)?{type:`animation-params`,params:e}:null}export{pe as CIMAnalyzer,ge as analyzeCIMResource};
|
|
2
|
+
import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as t}from"../../core/fontUtils.js";import"../../core/has.js";import{clone as n}from"../../core/lang.js";import r from"../../core/Logger.js";import{pt2px as i,px2pt as a}from"../../core/screenUtils.js";import{numericHash as o}from"../../core/string.js";import{isCurvedGeometry as s}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as c}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{checkForAnimations as l,globalRotation as u,getAnimationParams as d,handleAbsoluteAnchor as f,handleMarker as p,handleRelativeAnchor as m,getFrameTranslation as h,translate as g,getStaticParam as _,shouldUseAnimatedPath as v}from"./animationUtils.js";import{CIMSymbolInflatedSizeHelper as y,CIMSymbolHelper as b,forEachSymbolLayer as x}from"./CIMSymbolHelper.js";import{antialiasingOutlineFillSettings as S}from"./constants.js";import{defaultCIMValues as C}from"./defaultCIMValues.js";import{fitVectorMarker as w}from"./fitVectorMarker.js";import{fromCIMFontStyle as T}from"./fromCIMFontStyle.js";import{OverrideHelper as E}from"./OverrideHelper.js";import{hasRichTextFormattingTags as D}from"./richTextUtils.js";import{getSDFInfo as O,getExtent as k,getSDFMetrics as A,getSDFDimensions as j}from"./SDFHelper.js";import{CIMSymbolUnits as M}from"./types.js";import{colorToArray as N,normalizeAlpha as P,getSize as F,isCIMMarkerStrokePlacement as I,hasStrokeLayer as L,getNumericValue as R,getMaxStrokeWidth as z,getTintColor as B,normalizePrimitiveOverrideProps as V,getDefaultCIMValue as H,getEnum as U,getFillColor as W,getStrokeColor as G,fromCIMFontDecoration as K,getStrokeWidth as q,fromCIMVerticalAlignment as ee,fromCIMHorizontalAlignment as te,getTextCasing as J,isValidCIMValue as ne,uncapitalize as re}from"./utils.js";import{isSupportedCallout as ie,getPointSymbolCalloutTransforms as ae,normalizePointSymbolCalloutScale as oe,normalizeLeaderLineStyle as Y,getPointSymbolCalloutFitProperties as se,normalizeBalloonCalloutStyle as ce}from"./callouts/calloutAnalysisUtils.js";import{EffectHelper as le}from"./effects/EffectHelper.js";import{rasterizedVectorMarkerMinSize as ue,randomInsidePolygonTextureSize as de}from"../../views/2d/engine/webgl/definitions.js";const X=()=>r.getLogger(`esri.symbols.cim.cimAnalyzer`);function fe(e){let t=e.markerPlacement;return t&&t.angleToLine?1:0}class pe{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._hasTextStringTemplates=!1,e&&(this._resourceManager=e)}analyzeSymbolReference(t,n,r){if(this._cimLayers=r??[],!t)return this._cimLayers;if(this._reset(),this._hasTextStringTemplates=t.hasTextStringTemplates??!1,t.primitiveOverrides){this._primitiveOverrides=t.primitiveOverrides;for(let t of this._primitiveOverrides){let n=t.valueExpressionInfo;if(n)this._setPoMap(t.primitiveName,t.propertyName,n);else if(t.value!=null){let n=t.value;t.propertyName.includes(`Color`)&&(e(n)&&(n=N(n)),n=P(n)),this._setPoMap(t.primitiveName,t.propertyName,n)}}}return this._analyzeSymbol(t.symbol,n),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,t){switch(e?.type){case`CIMPointSymbol`:case`CIMLineSymbol`:case`CIMPolygonSymbol`:this._analyzeMultiLayerSymbol(e,t)}}_analyzeMultiLayerSymbol(e,t){let n=e?.symbolLayers;if(!n)return;for(let e=0;e<n.length;e++){let t=n[e];t.type===`CIMVectorMarker`&&(n[e]=w(t))}let r=e.effects,i=0,a=F(e)??0;e.type===`CIMPointSymbol`&&e.angleAlignment===`Map`&&(i=1);let o={transform:[0,0,0,1],fromColor:[1,1,1,1],toColor:[1,1,1,1],colorMix:[0,0,0,0],toOpacity:[1,1,1,1],opacityMix:[0,0,0,0],shift:[1,1,1,1],hasAnimations:l(e),hasShiftAnimation:!1,hasMotionAnimations:!1};o=u(o),o=d(this._poMap,e,o);let s=null;e.type===`CIMPointSymbol`&&(s=this._analyzePointSymbolHalo(e,i,a,r,o),this._analyzeCallout(e,null,[],o,a,i,t));let c=s?n.filter(e=>e!==s):n;if(Ce(c,r))return this._analyzeCompositeOutlineFill(c,r,a);this._analyzeSymbolLayer(s?{...e,symbolLayers:c}:e,null,[],o,a,i,t)}_analyzeSymbolLayer(e,t,n,r,i,a,o){let s=e?.symbolLayers;if(!s)return;let c=e.type===`CIMPolygonSymbol`,l=e.effects,u=s.length;for(;u--;){let d=s[u];if(!d||d.enable===!1)continue;let f;l?.length&&(f=[...l]);let p=d.effects;p?.length&&(l?f.push(...p):f=[...p]);let m=t?[...t]:null;if(f){m??=[];for(let e of f){let t=E.findEffectOverrides(e,this._primitiveOverrides);t&&m.push(t)}}E.findApplicableOverrides(d,this._primitiveOverrides,[]);let h=this._cimLayers.length;switch(d.type){case`CIMSolidFill`:this._analyzeSolidFill(d,m,r,L(s));break;case`CIMPictureFill`:this._analyzePictureFill(d,m,r);break;case`CIMHatchFill`:this._analyzeHatchFill(d,m,r);break;case`CIMGradientFill`:this._analyzeGradientFill(d,m);break;case`CIMSolidStroke`:this._analyzeSolidStroke(d,m,c,i,r);break;case`CIMPictureStroke`:this._analyzePictureStroke(d,m,c,i,r);break;case`CIMGradientStroke`:this._analyzeGradientStroke(d,m,c,i);break;case`CIMCharacterMarker`:case`CIMPictureMarker`:case`CIMVectorMarker`:{(e.type===`CIMLineSymbol`||e.type===`CIMPolygonSymbol`)&&(a=fe(d));let t=[],s=d.primitiveName;s&&t.push(s);let l=c&&I(d.markerPlacement);this._analyzeMarker(d,m,null,t,a,i,o,n,r,!1,l);break}default:X().error(`Cannot analyze CIM layer`,d.type)}if(m?.some(({effect:e})=>Z(e)))for(let e=h;e<this._cimLayers.length;e++)this._cimLayers[e].effectsChangeGeometryType=!0}}_analyzePointSymbolHalo(e,t,r,i,o){let{haloSymbol:s}=e,c=R(e.haloSize,0);if(c<=0||!s?.symbolLayers)return null;let u=s.symbolLayers.filter(e=>e.enable!==!1),f=u[0];if(!f)return null;let p=u.length===1&&f.type===`CIMSolidFill`;if(e.symbolLayers?.some(e=>l(e))===!0||l(s))return X().warnOnce(`CIM point symbol halos do not support independently animated symbol components`),null;let m=i?.map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null);if(m?.some(({effect:e})=>Z(e))){if(!p)return X().warnOnce(`Complex CIM point symbol halos are not supported with geometry-changing effects`),null;let t=e.symbolLayers?.filter(e=>e.enable!==!1)??[];if(!xe(t,m))return X().warnOnce(`CIM point symbol halos with geometry-changing effects currently require polygon-producing effects and an unambiguous solid-fill effect chain`),null;let n=t.find(e=>e.type===`CIMSolidFill`);if(!n)return null;let i=[...m,...(n.effects??[]).map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null)],a=z(t),o=this._getValueOrOverrideExpression(f.type,f.primitiveName,`Color`,P(f.color));return this._cimLayers.push({type:`outlineFill`,name:n.name,colorLocked:!!n.colorLocked,color:this._getValueOrOverrideExpression(n.type,n.primitiveName,`Color`,P(n.color)),effects:i,effectsChangeGeometryType:!0,outlineColorLocked:!0,outlineColor:o,outlineWidth:c+a,cap:`Round`,join:`Round`,referenceWidth:r,pixelBufferSize:c+a,outlineEffects:i}),n}let h=e.symbolLayers?.filter(e=>e.enable!==!1)??[],g=h.length===1&&h[0].type===`CIMVectorMarker`?h[0]:null,_=n(e);if(_.effects=void 0,_.angle=0,_.scaleX=1,g){let e=_.symbolLayers?.find(e=>e.type===`CIMVectorMarker`&&e.enable!==!1);e&&(e.rotation=0,e.offsetX=0,e.offsetY=0)}let v={..._,haloSize:0,haloSymbol:void 0},x=y.getPointSymbolHaloPadding(e,this._resourceManager),[S,C,w]=b.getTextureAnchor(v,this._resourceManager,ue,x),T=a(w),D=[];E.findApplicableOverrides(_,this._primitiveOverrides,D);let k=g?D.filter(e=>e.primitiveName!==g.primitiveName||![`Rotation`,`OffsetX`,`OffsetY`].includes(e.propertyName)):D,A=g?[{offsetX:this._getValueOrOverrideExpression(g.type,g.primitiveName,`OffsetX`,R(g.offsetX)),offsetY:this._getValueOrOverrideExpression(g.type,g.primitiveName,`OffsetY`,R(g.offsetY)),rotation:this._getValueOrOverrideExpression(g.type,g.primitiveName,`Rotation`,R(g.rotation)),size:T,frameHeight:T,rotateClockWise:!!g.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:!1}]:[],j=$(p?d(this._poMap,f,o):o),M,N;if(j){let e=b.getEnvelope(v,null,this._resourceManager);e&&(M=[e.width,e.height],N=[e.width+2*x,e.height+2*x])}return this._cimLayers.push({type:`marker`,spriteRasterizationParam:{type:`sprite-rasterization-param`,resource:{type:`cim-point-symbol-halo`,symbol:_,sdf:!j&&p&&O(v)!=null},overrides:k},colorLocked:!0,color:p?this._getValueOrOverrideExpression(f.type,f.primitiveName,`Color`,P(f.color)):[255,255,255,1],effects:m??null,effectsChangeGeometryType:m?.some(({effect:e})=>Z(e)),scaleSymbolsProportionally:!1,alignment:t,anchorPoint:{x:S,y:C},isAbsoluteAnchorPoint:!1,size:T,scaleX:R(e.scaleX,1),rotation:g?0:R(e.angle,0),offsetX:0,offsetY:0,outlineColor:[0,0,0,0],outlineWidth:0,transform:{type:`cim-marker-transform-param`,params:A},frameHeight:T,widthRatio:1,rotateClockwise:!1,referenceSize:r||T,sizeRatio:1,markerPlacement:null,isOutline:!1,animationParams:j,baseSize:r||T,pixelDimensions:M,texelDimensions:N}),null}_analyzeSolidFill(e,t,n,r){let{primitiveName:i,type:a}=e,o=P(e.color),s=d(this._poMap,e,n);if(!r&&t?.some(e=>e.effect.type===`CIMGeometricEffectTaperedPolygon`)){let n=this._getValueOrOverrideExpression(a,i,`Color`,o);this._cimLayers.push({type:`outlineFill`,name:e.name,colorLocked:!!e.colorLocked,color:n,effects:t,outlineColor:n,outlineColorLocked:!!e.colorLocked,...S,outlineEffects:t})}else this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(a,i,`Color`,o),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:t,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1,animationParams:$(s)})}_analyzePictureFill(e,t,n){let{primitiveName:r,type:i}=e,a=B(e),o=R(e.height,C.CIMPictureFill.height),s=R(e.scaleX,1);if(`width`in e&&typeof e.width==`number`){let t=e.width,n=1,r=this._resourceManager.getResource(e.url);r!=null&&(n=r.width/r.height),s/=o/t*n}let c={type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(r,i)},l=d(this._poMap,e,n);this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:c,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(i,r,`TintColor`,a),height:this._getValueOrOverrideExpression(i,r,`Height`,o),scaleX:this._getValueOrOverrideExpression(i,r,`ScaleX`,s),angle:this._getValueOrOverrideExpression(i,r,`Rotation`,R(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,r,`OffsetX`,R(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,r,`OffsetY`,R(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1,animationParams:$(l)})}_analyzeHatchFill(e,t,n){let{primitiveName:r,type:i}=e,a=d(this._poMap,e,n),o=this._analyzeMaterialOverrides(r,[`Rotation`,`OffsetX`,`OffsetY`]),s=V(o),c=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(let t of e.lineSymbol.symbolLayers){if(t.type!==`CIMSolidStroke`)continue;let e=t.primitiveName??r;!l&&e&&!t.colorLocked&&(this._poMap[e]?.Color!=null||this._poMap[e]?.StrokeColor!=null)&&(c=P(t.color),c=this._maybeGetValueOrOverrideExpression(e,`StrokeColor`)??this._getValueOrOverrideExpression(i,e,`Color`,c),l=!0);let n=this._maybeGetValueOrOverrideExpression(e,`StrokeWidth`);if(n){let t=null,r=null;typeof n==`number`?t=n:r=n.valueExpressionInfo;let a=s.find(e=>e.propertyName===`strokeWidth`);a?a.propertyName=`width`:(a={type:`CIMPrimitiveOverride`,primitiveName:e,propertyName:`width`,valueExpressionInfo:r,value:t,defaultValue:H(i,`width`)},s.push(a))}}let u={type:`sprite-rasterization-param`,resource:e,overrides:s};this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:u,colorLocked:!!e.colorLocked,effects:t,color:c,height:this._getValueOrOverrideExpression(i,r,`Separation`,R(e.separation,C.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,r,`Rotation`,R(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,r,`OffsetX`,R(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,r,`OffsetY`,R(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l,animationParams:$(a)})}_analyzeGradientFill(e,t){let{angle:n,gradientMethod:r,gradientSize:i,gradientSizeUnits:a,gradientType:o,interval:s,primitiveName:c,type:l}=e,u=C.CIMGradientFill,d=e.colorRamp;this._cimLayers.push({type:`gradientFill`,name:e.name,spriteRasterizationParam:{type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(c,l)},colorLocked:!1,effects:t,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(l,c,`GradientMethod`,r??`Linear`),angle:this._getValueOrOverrideExpression(l,c,`Angle`,R(n,u.angle)),gradientType:this._getValueOrOverrideExpression(l,c,`GradientType`,o??u.gradientType),interval:this._getValueOrOverrideExpression(l,c,`Interval`,R(s,d.type===`CIMFixedColorRamp`?d.colors.length:u.interval)),gradientSize:this._getValueOrOverrideExpression(l,c,`GradientSize`,R(i,u.gradientSize)),gradientSizeUnits:a===`Absolute`?M.Absolute:a===`Relative`?M.Relative:u.gradientSizeUnits})}_analyzeCompositeOutlineFill(e,t,n,r=[]){let i=e.find(e=>e.type===`CIMSolidFill`),a=e.find(e=>e.type===`CIMSolidStroke`);if(i==null||a==null)return;let o=[...r,...[...t??[],...i.effects??[]].map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null)],s=[...r,...[...t??[],...a.effects??[]].map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null)],c=R(a.width,C.CIMSolidStroke.width),l=U(a.capStyle,C.CIMSolidStroke.capstyle),u=U(a.joinStyle,C.CIMSolidStroke.joinstyle),d=a.miterLimit;this._cimLayers.push({type:`outlineFill`,name:i.name,colorLocked:!!i.colorLocked,color:this._getValueOrOverrideExpression(i.type,i.primitiveName,`Color`,P(i.color)),effects:o,effectsChangeGeometryType:o.some(({effect:e})=>Z(e))||s.some(({effect:e})=>Z(e)),outlineColorLocked:!!a.colorLocked,outlineColor:this._getValueOrOverrideExpression(a.type,a.primitiveName,`Color`,P(a.color)),outlineWidth:this._getValueOrOverrideExpression(a.type,a.primitiveName,`Width`,c),cap:this._getValueOrOverrideExpression(a.type,a.primitiveName,`CapStyle`,l),join:this._getValueOrOverrideExpression(a.type,a.primitiveName,`JoinStyle`,u),miterLimit:d&&this._getValueOrOverrideExpression(a.type,a.primitiveName,`MiterLimit`,d),referenceWidth:n,outlineEffects:s})}_analyzeSolidStroke(e,t,n,r,i){let{primitiveName:a,type:o}=e,s=P(e.color),c=R(e.width,C.CIMSolidStroke.width),l=U(e.capStyle,C.CIMSolidStroke.capstyle),u=U(e.joinStyle,C.CIMSolidStroke.joinstyle),f=e.miterLimit,p=this._analyzePrimitiveOverrides(a,t,null,null),m=[];p&&(m=this._getPrimitiveMaterialOverrides(a,o));let h,g,_,v;if(t&&Array.isArray(t)&&t.length>0){let e=t[t.length-1].effect;e&&e.type===`CIMGeometricEffectDashes`&&e.lineDashEnding===`NoConstraint`&&(h=e.dashTemplate,g=e.scaleDash,_=e.offsetAlongLine,v=e.primitiveName,t=[...t],t.pop())}v!=null&&m.push(...this._getPrimitiveMaterialOverrides(v,o).filter(e=>e.propertyName===`dashTemplate`));let y=h===void 0?null:{type:`sprite-rasterization-param`,resource:{type:`dash`,dashTemplate:h,primitiveName:v},overrides:m},b=d(this._poMap,e,i);this._cimLayers.push({type:`line`,name:e.name,spriteRasterizationParam:y,isOutline:n,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(o,a,`Color`,s),width:this._getValueOrOverrideExpression(o,a,`Width`,c),cap:this._getValueOrOverrideExpression(o,a,`CapStyle`,l),join:this._getValueOrOverrideExpression(o,a,`JoinStyle`,u),miterLimit:f&&this._getValueOrOverrideExpression(o,a,`MiterLimit`,f),referenceWidth:r,zOrder:he(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(v,`DashTemplate`)??h,offsetAlongLine:this._getValueOrOverrideExpression(o,v,`OffsetAlongLine`,_??0),scaleDash:g,sampleAlphaOnly:!0,animationParams:$(b)})}_analyzePictureStroke(e,t,n,r,i){let{primitiveName:a,type:o}=e,s=B(e),c=R(e.width,C.CIMPictureStroke.width),l=U(e.capStyle,C.CIMPictureStroke.capstyle),u=U(e.joinStyle,C.CIMPictureStroke.joinstyle),f=e.miterLimit,p={type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(a,o)},m=d(this._poMap,e,i);this._cimLayers.push({type:`line`,name:e.name,spriteRasterizationParam:p,isOutline:n,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(o,a,`TintColor`,s),width:this._getValueOrOverrideExpression(o,a,`Width`,c),cap:this._getValueOrOverrideExpression(o,a,`CapStyle`,l),join:this._getValueOrOverrideExpression(o,a,`JoinStyle`,u),miterLimit:f&&this._getValueOrOverrideExpression(o,a,`MiterLimit`,f),referenceWidth:r,zOrder:he(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1,animationParams:$(m)})}_analyzeGradientStroke(e,t,n,r){let{gradientMethod:i,gradientSize:a,gradientSizeUnits:o,gradientType:s,interval:c,primitiveName:l,type:u}=e,d=C.CIMGradientStroke,f=R(e.width,d.width),p=U(e.capStyle,d.capstyle),m=U(e.joinStyle,d.joinstyle),h=e.miterLimit,g=e.colorRamp;this._cimLayers.push({type:`gradientStroke`,name:e.name,spriteRasterizationParam:{type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(l,u)},colorLocked:!!e.colorLocked,effects:t,color:[255,255,255,1],width:this._getValueOrOverrideExpression(u,l,`Width`,f),cap:this._getValueOrOverrideExpression(u,l,`CapStyle`,p),join:this._getValueOrOverrideExpression(u,l,`JoinStyle`,m),miterLimit:h&&this._getValueOrOverrideExpression(u,l,`MiterLimit`,h),referenceWidth:r,isOutline:n,gradientMethod:this._getValueOrOverrideExpression(u,l,`GradientMethod`,i??d.gradientMethod),gradientType:this._getValueOrOverrideExpression(u,l,`GradientType`,s??d.gradientType),interval:this._getValueOrOverrideExpression(u,l,`Interval`,R(c,g.type===`CIMFixedColorRamp`?g.colors.length:d.interval)),gradientSize:this._getValueOrOverrideExpression(u,l,`GradientSize`,R(a,d.gradientSize)),gradientSizeUnits:o===`Absolute`?M.Absolute:o===`Relative`?M.Relative:d.gradientSizeUnits})}_analyzeMarker(e,t,n,r,i,a,o,s,c,l=!1,u=!1){l||=!!e.colorLocked;let h=c;if(h=f(e,h),h=p(this._poMap,e,h),h=m(e,h),h=d(this._poMap,e,h),this._analyzeMarkerInsidePolygon(e,t,l,h))return;let g=R(e.size,C.CIMVectorMarker.size),_=R(e.rotation),v=R(e.offsetX),y=R(e.offsetY),{primitiveName:b,type:x}=e,S=this._getValueOrOverrideExpression(x,b,`Size`,g),w=this._getValueOrOverrideExpression(x,b,`Rotation`,_),T=this._getValueOrOverrideExpression(x,b,`OffsetX`,v),E=this._getValueOrOverrideExpression(x,b,`OffsetY`,y);switch(e.type){case`CIMPictureMarker`:this._analyzePictureMarker(e,t,n,r,i,a,S,w,T,E,s,h,l,u);break;case`CIMVectorMarker`:this._analyzeVectorMarker(e,t,n,r,i,a,S,w,T,E,s,h,o,l,u)}}_analyzeMarkerInsidePolygon(e,t,n,r){let{markerPlacement:i,type:o}=e;if(!i||i.type!==`CIMMarkerPlacementInsidePolygon`||r.hasMotionAnimations)return!1;if(o===`CIMVectorMarker`||o===`CIMPictureMarker`){let n=e.primitiveName;if(n&&this._analyzePrimitiveOverrides([n],t,null,null))return!1;let r=i.primitiveName;if(r&&this._analyzePrimitiveOverrides([r],t,null,null))return!1;if(o===`CIMVectorMarker`){let{markerGraphics:t}=e;if(t)for(let e of t){let{symbol:t}=e;if(t?.type===`CIMPolygonSymbol`&&t.symbolLayers){let{symbolLayers:e}=t;for(let t of e)if(t.type===`CIMSolidStroke`)return!1}}}else{let{animatedSymbolProperties:t}=e;if(t)return!1}}let s=Math.abs(i.stepX),c=Math.abs(i.stepY);if(s===0||c===0)return!0;let l,u;if(i.gridType===`Random`){let e=a(de),t=Math.max(Math.floor(e/s),1);l=c*Math.max(Math.floor(e/c),1),u=t*s/l}else i.shiftOddRows?(l=c*2,u=s/c*.5):(l=c,u=s/c);let d=B(e),f=e.type===`CIMCharacterMarker`?null:{type:`sprite-rasterization-param`,resource:{...e,effects:e.effects?.filter(e=>!ye(e))},overrides:[]};return this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:f,colorLocked:n,effects:t,color:d,height:l,scaleX:u,angle:i.gridAngle??0,offsetX:R(i.offsetX),offsetY:R(i.offsetY),applyRandomOffset:i.gridType===`Random`,sampleAlphaOnly:e.type!==`CIMPictureMarker`,hasUnresolvedReplacementColor:!0,animationParams:$(r)}),!0}_analyzePictureMarker(e,t,r,i,a,s,c,l,u,d,f,p,m,h){let{animatedSymbolProperties:g,primitiveName:_,type:v}=e,y=R(e.scaleX,1),b=B(e);r||=this._createMarkerPlacementOverrideExpression(e.markerPlacement);let x=this._createGIFAnimatedSymbolPropertiesOverrideExpression(g),S=e.anchorPoint??{x:0,y:0};if(`width`in e&&typeof e.width==`number`){let t=e.width,n=1,r=this._resourceManager.getResource(e.url);r!=null&&(n=r.width/r.height);let i=R(e.size);y/=i/t*n}let C=[...i];e.primitiveName&&C.push(e.primitiveName);let w;g||x?w={type:`animated`,url:e.url,urlHash:`H`+o(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(w=n(e),w.markerPlacement=null);let T={type:`sprite-rasterization-param`,resource:w,overrides:this._getMaterialOverrides(C,v)};x&&T.overrides.push(...x.overrides);let E=c;this._cimLayers.push({type:`marker`,name:e.name,spriteRasterizationParam:T,colorLocked:m,effects:t,scaleSymbolsProportionally:!1,alignment:a,size:c,scaleX:this._getValueOrOverrideExpression(v,_,`ScaleX`,y),rotation:l,offsetX:u,offsetY:d,transform:{type:`cim-marker-transform-param`,params:f},color:this._getValueOrOverrideExpression(v,_,`TintColor`,b),anchorPoint:{x:S.x,y:S.y},isAbsoluteAnchorPoint:e.anchorPointUnits!==`Relative`,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:s,sizeRatio:1,isOutline:h,markerPlacement:r,animationParams:$(p),baseSize:E})}_analyzeVectorMarker(e,t,n,r,i,a,o,l,u,d,f,p,m,v,y){let b=e.markerGraphics;if(!b)return;let x=e.frame,S=0;S=x?x.ymax-x.ymin:a;let C=!!e.scaleSymbolsProportionally;if(S){let t={offsetX:u,offsetY:d,rotation:l,size:o,frameHeight:S,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:C};f=[...f,t]}n||=this._createMarkerPlacementOverrideExpression(e.markerPlacement);for(let o of b)if(o){let l=o.symbol;if(!l)continue;let u=o.primitiveName;u&&r.push(u);let d=p,b;if((l.type===`CIMPointSymbol`||l.type===`CIMTextSymbol`)&&x){let t=0,n=0,r=o.geometry;`x`in r&&`y`in r&&(t+=r.x-(x.xmin+x.xmax)*.5,n+=r.y-(x.ymin+x.ymax)*.5);let i=e.anchorPoint,a=!1;i&&(e.anchorPointUnits===`Absolute`?(t-=i.x,n-=i.y,a=!0):x&&(t-=(x.xmax-x.xmin)*i.x,n-=(x.ymax-x.ymin)*i.y));let s={offsetX:t,offsetY:n,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:a,scaleSymbolsProportionally:C};b=[...f,s]}(l.type===`CIMPointSymbol`||l.type===`CIMTextSymbol`)&&this._analyzeCallout(l,t,b??f,d,a,i,m);let w=s(o.geometry)?{...o,geometry:c(o.geometry,{maxDeviation:.01})}:o,T=w.geometry,[E,D]=h(T,x);switch((E!==0||D!==0)&&(d=g(d,E,D)),l.type){case`CIMPointSymbol`:case`CIMLineSymbol`:case`CIMPolygonSymbol`:m||ve(l)?(d={...d,transform:{type:`AnimatedTransform`,relativeTranslation:!1,absoluteScale:!0,selectGlobalRotation:!1,translation:_([0,0]),rotation:_(0),scale:_(S),parent:p.transform}},this._analyzeMultiLayerGraphicNonSDF(e,t,n,w,r,i,a,b??f,d,S,v,y)):this._analyzeMultiLayerGraphic(e,t,n,w,r,i,a,b??f,d,S,v,y);break;case`CIMTextSymbol`:this._analyzeTextGraphic(t,n,w,r,i,a,b??f,v)}u&&r.pop()}}_analyzeCallout(e,t,n,r,i,a,o){let s=e.callout;if(!s||!ie(s))return;let c=t??[],{leaderTolerance:l,leaderOffset:u}=s;switch(s.type){case`CIMSimpleLineCallout`:{let{lineSymbol:e,autoSnap:t}=s,d={type:`CIMSimpleLineCallout`,leaderTolerance:l,leaderOffset:u,autoSnap:t,inflateSize:500};this._analyzeSymbolLayer(e,[...c,{type:`cim-effect-param`,effect:d,overrides:[]}],n,r,i,a,o);break}case`CIMBackgroundCallout`:{let{accentBarSymbol:e,gap:t,backgroundSymbol:d,leaderLineSymbol:f,lineStyle:p,margin:m}=s,h=n=>({type:`CIMBackgroundCallout`,leaderTolerance:l,leaderOffset:u,lineStyle:Y(p),gap:t,hasAccentBar:!!e,margin:m,inflateSize:500,part:n}),g=[...c,{type:`cim-effect-param`,effect:h(`background`),overrides:[]}];if(f&&this._analyzeSymbolLayer(f,[...c,{type:`cim-effect-param`,effect:h(`leader`),overrides:[]}],n,r,i,a,o),d){let e=d.symbolLayers??[];Q(e)?this._analyzeCompositeOutlineFill(e,null,i,g):this._analyzeSymbolLayer(d,g,n,r,i,a,o)}e&&this._analyzeSymbolLayer(e,[...c,{type:`cim-effect-param`,effect:h(`accent-bar`),overrides:[]}],n,r,i,a,o);break}case`CIMBalloonCallout`:{let{balloonStyle:e,backgroundSymbol:t,dartSymbol:d,fixedDartWidth:f,margin:p,useDartSymbol:m,useFixedDartWidth:h}=s,g=m===!0&&d!=null,_=t=>({type:`CIMBalloonCallout`,leaderTolerance:l,leaderOffset:u,margin:p,balloonStyle:ce(e),dartWidth:h?f:void 0,inflateSize:500,part:t,separateDart:g}),v=(e,t)=>{let s=[...c,{type:`cim-effect-param`,effect:_(t),overrides:[]}],l=e.symbolLayers??[];Q(l)?this._analyzeCompositeOutlineFill(l,null,i,s):this._analyzeSymbolLayer(e,s,n,r,i,a,o)};g&&v(d,`dart`),v(t,`background`);break}case`CIMPointSymbolCallout`:{let{backgroundScale:e,gap:t,leaderLineSymbol:d,lineStyle:f,pointSymbol:p}=s,m=oe(e),h=ae(p,n),g=e=>({type:`CIMPointSymbolCallout`,leaderTolerance:l,leaderOffset:u,backgroundScale:m,...se(p,e),lineStyle:Y(f),gap:t,inflateSize:500,part:e});d&&this._analyzeSymbolLayer(d,[...c,{type:`cim-effect-param`,effect:g(`leader`),overrides:[]}],n,r,i,a,o),this._analyzeSymbolLayer(p,[...c,{type:`cim-effect-param`,effect:g(`marker`),overrides:[]}],h,r,i,a,o||m!==0);break}case`CIMCompositeCallout`:{let{backgroundSymbol:e,margin:t,shadowSymbol:d}=s,f={type:`CIMBalloonCallout`,leaderTolerance:l,leaderOffset:u,margin:t,balloonStyle:1,inflateSize:500,part:`background`},p=[...c,{type:`cim-effect-param`,effect:f,overrides:[]}],m=e=>{let t=e.symbolLayers??[];Q(t)?this._analyzeCompositeOutlineFill(t,null,i,p):this._analyzeSymbolLayer(e,p,n,r,i,a,o)};d&&m(d),m(e);break}}}_analyzeMultiLayerGraphic(e,t,n,r,i,a,o,s,c,l,u,d){let f=r.symbol,p=f.symbolLayers;p&&(_e(p)&&!v(c)?this._analyzeCompositeMarkerGraphic(e,t,n,r,p,a,o,s,l,u,d):Se(p)?(x(f,e=>{e.colorLocked&&(u=!0)}),this._analyzeMultiLayerGraphicNonSDF(e,t,n,r,i,a,o,s,c,l,u,d)):this._analyzeMarkerGraphicSymbolLayers(e,t,n,r,i,a,o,s,c,l,u,d))}_analyzeMarkerGraphicSymbolLayers(e,t,n,r,i,a,o,s,c,l,u,f){let p=r.symbol,m=p.symbolLayers;if(!m)return;let h=le.applyEffects(p.effects,r.geometry);if(!h)return;let g=m.length;for(;g--;){let p=m[g];if(!p||p.enable===!1)continue;let _=p.primitiveName;switch(_&&i.push(_),p.type){case`CIMSolidFill`:case`CIMSolidStroke`:{let i=le.applyEffects(p.effects,h),m=k(i);if(!m)continue;let g=e.anchorPointUnits!==`Relative`,v=p.type===`CIMSolidStroke`?p.width:0,{frameSizeRatio:y,anchorX:b,anchorY:x,widthRatio:S,sdfPaddingRatio:w,sdfTextureSize:T}=A(m,e.frame,e.size,e.anchorPoint,g,v,e.scaleSymbolsProportionally),E=p.type===`CIMSolidFill`,D={type:`sdf`,geometry:i,sdfPaddingRatio:w,asFill:E,sdfTextureSize:T},{path:O}=p,M=E?P(W(p)):O==null?P(G(p)):[0,0,0,0],N=E?[0,0,0,0]:P(G(p));if(!E&&!v)break;let F=r.primitiveName,I=null;E&&!p.colorLocked&&(I=this._maybeGetValueOrOverrideExpression(F,`FillColor`));let L=null;!E&&!p.colorLocked&&(L=this._maybeGetValueOrOverrideExpression(F,`StrokeColor`));let z=I??this._getValueOrOverrideExpression(p.type,_,`Color`,M),B=L??this._getValueOrOverrideExpression(p.type,_,`Color`,N),V=this._maybeGetValueOrOverrideExpression(F,`StrokeWidth`)??this._getValueOrOverrideExpression(p.type,_,`Width`,v),H=O?{type:`sprite-rasterization-param`,resource:{type:`path`,path:O,asFill:E},overrides:[]}:{type:`sprite-rasterization-param`,resource:D,overrides:[]},U=d(this._poMap,p,c),K=R(e.size,C.CIMVectorMarker.size),q=this._getValueOrOverrideExpression(e.type,e.primitiveName,`Size`,K);this._cimLayers.push({type:`marker`,name:p.name,groupName:e.name,spriteRasterizationParam:H,colorLocked:!!p.colorLocked||!!u,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:b,y:x},isAbsoluteAnchorPoint:g,size:l,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:`cim-marker-transform-param`,params:s},frameHeight:l,widthRatio:S,rotateClockwise:!1,referenceSize:o,sizeRatio:y,color:z,outlineColor:B,outlineWidth:V,isOutline:f,markerPlacement:n,animationParams:$(U),isStroke:p.type!==`CIMSolidFill`,baseSize:q,...j(i,T,w)});break}case`CIMPictureMarker`:case`CIMVectorMarker`:if(p.markerPlacement){X().error(`Error analyzing CIM, got unexpected marker placement`);break}this._analyzeMarker(p,t,n,i,a,o,!1,s,c,u,f)}_&&i.pop()}}_analyzeTextGraphic(e,n,r,i,a,o,s,c){E.findApplicableOverrides(r,this._primitiveOverrides,[]);let l=r.geometry;if(!(`x`in l)||!(`y`in l))return;let u=r.symbol,d=K(u),f=T(u.fontStyleName),p=t(u.fontFamilyName);u.font={family:p,decoration:d,...f};let m=R(u.height,C.CIMTextSymbol.height),h=R(u.angle),g=R(u.offsetX),_=R(u.offsetY),{haloSymbol:v}=u,y=R(u.haloSize,0),b=[0,0,0,0];if(v?.symbolLayers?.length){let e=v.symbolLayers;for(let t of e)if(t.color){b=this._getValueOrOverrideExpression(u?.haloSymbol?.type??`CIMPolygonSymbol`,t.primitiveName,`Color`,P(t.color));break}}let x=r.primitiveName,S=[0,0,0,1],w=[0,0,0,0],O=0,k=!1;if(u.symbol?.symbolLayers)for(let e of u.symbol.symbolLayers){let t=e.primitiveName;if(e.type===`CIMSolidStroke`)w=this._getValueOrOverrideExpression(`CIMSolidStroke`,t,`Color`,P(e.color)),O=this._getValueOrOverrideExpression(`CIMSolidStroke`,t,`Width`,q(e)??0);else if(e.type===`CIMSolidFill`){let n=P(e.color);k??=!!e.colorLocked,S=this._getValueOrOverrideExpression(`CIMSolidFill`,t??x,`Color`,n)}}let A=null,j=null,M=null,N=null,F=null;x&&(A=this._maybeGetValueOrOverrideExpression(x,`TextSize`),j=this._maybeGetValueOrOverrideExpression(x,`TextAngle`),M=this._maybeGetValueOrOverrideExpression(x,`TextOffsetX`),N=this._maybeGetValueOrOverrideExpression(x,`TextOffsetY`),k||(F=this._maybeGetValueOrOverrideExpression(x,`FillColor`)));let I=F??S,L=null,z=null,B=0,V=u.callout?.type===`CIMBackgroundCallout`;if(u.callout?.type===`CIMBackgroundCallout`){let e=u.callout;if(e.backgroundSymbol){let t=e.backgroundSymbol.symbolLayers;if(t)for(let e of t)e.type===`CIMSolidFill`?L=P(e.color):e.type===`CIMSolidStroke`&&(z=P(e.color),B=R(e.width,C.CIMSolidStroke.width))}}let H=this._getValueOrOverrideExpression(u.type,r.primitiveName,`TextString`,r.textString??``);if(H==null)return;let{fontStyleName:U}=u,W=p+(U?`-`+U.toLowerCase():`-regular`),G=this._getMaterialOverrides(i,u.type);G.push(...this._getPrimitiveMaterialOverrides(r.primitiveName,u.type)),this._collectDictionaryTemplateOverrides(G,r);let J={type:`text-rasterization-param`,resource:{type:`text`,textString:r.textString??``,font:u.font,symbol:u,primitiveName:r.primitiveName,supportsRichText:D(r.textString??``)||G.some(e=>e.propertyName===`textString`)},overrides:G};this._cimLayers.push({type:`text`,lineWidth:u.lineWidth,textRasterizationParam:J,colorLocked:!!c||!!k,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:W,decoration:d,haloSize:y,haloColor:b,weight:f.weight,style:f.style,size:A??m,angle:j??h,offsetX:M??g,offsetY:N??_,transform:{type:`cim-marker-transform-param`,params:s},horizontalAlignment:te(u.horizontalAlignment),verticalAlignment:ee(u.verticalAlignment),text:H,color:I,outlineColor:w,outlineSize:O,backgroundColor:L,borderLineColor:z,borderLineWidth:B,useBackgroundCallout:V,referenceSize:o,sizeRatio:1,markerPlacement:n})}_collectDictionaryTemplateOverrides(e,t){if(t.textString&&this._hasTextStringTemplates){let n=J(t.symbol);e.push({propertyName:`textString`,defaultValue:``,valueExpressionInfo:{type:`dictionary-template`,textCase:n,template:t.textString},primitiveName:t.primitiveName})}}_analyzeMultiLayerGraphicNonSDF(e,t,n,r,a,o,s,c,l,u,d,f){let p=me(e,r),m=e.primitiveName,h=this._analyzeMaterialOverrides(m,[`Rotation`,`OffsetX`,`OffsetY`]),g=V(h),[_,v,y]=b.getTextureAnchor(p,this._resourceManager,ue),x=this._getMaterialOverrides(a,e.type).filter(e=>e.primitiveName!==m||![`rotation`,`offsetX`,`offsetY`].includes(e.propertyName));x.push(...g);let S={type:`sprite-rasterization-param`,resource:{...p,avoidSDFRasterization:!0},overrides:x},w=R(e.size,C.CIMVectorMarker.size),T=this._getValueOrOverrideExpression(e.type,m,`Size`,w);this._cimLayers.push({type:`marker`,name:e.name,spriteRasterizationParam:S,colorLocked:d,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:o,anchorPoint:{x:_,y:v},isAbsoluteAnchorPoint:!1,size:u,rotation:0,offsetX:0,offsetY:0,transform:{type:`cim-marker-transform-param`,params:c},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:u,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:s,sizeRatio:y/i(e.size),isOutline:f,markerPlacement:n,animationParams:$(l),baseSize:T})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;let t=[];return E.findApplicableOverrides(e,this._primitiveOverrides,t),{type:`cim-marker-placement-param`,placement:e,overrides:we(t)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;let t=[];return E.findApplicableOverrides(e,this._primitiveOverrides,t),{type:`cim-gif-animation-params`,animation:e,overrides:we(t)}}_analyzeCompositeMarkerGraphic(e,t,n,r,i,a,o,s,c,l,u){let d=r.geometry,f=i[0],p=i[1],m=k(d);if(!m)return;let h=e.anchorPointUnits!==`Relative`,g=R(f.width,C.CIMSolidStroke.width),{frameSizeRatio:_,anchorX:v,anchorY:y,widthRatio:b,sdfPaddingRatio:x,sdfTextureSize:S}=A(m,e.frame,e.size,e.anchorPoint,h,g,e.scaleSymbolsProportionally),{path:w}=p,T=p.primitiveName,E=f.primitiveName,D=r.primitiveName,O=null;!p.colorLocked&&!l&&(O=this._maybeGetValueOrOverrideExpression(D,`FillColor`));let j=O??this._getValueOrOverrideExpression(p.type,T,`Color`,P(p.color)),M=null;!f.colorLocked&&!l&&(M=this._maybeGetValueOrOverrideExpression(D,`StrokeColor`));let N=M??this._getValueOrOverrideExpression(f.type,E,`Color`,P(f.color)),F=this._maybeGetValueOrOverrideExpression(D,`StrokeWidth`)??this._getValueOrOverrideExpression(f.type,E,`Width`,g),I={type:`sprite-rasterization-param`,resource:w?{type:`path`,path:w,asFill:!0}:{type:`sdf`,geometry:d,sdfTextureSize:S,sdfPaddingRatio:x,asFill:!0},overrides:[]};this._cimLayers.push({type:`marker`,name:e.name,spriteRasterizationParam:I,colorLocked:l,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:v,y},isAbsoluteAnchorPoint:h,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:`cim-marker-transform-param`,params:s},frameHeight:c,widthRatio:b,rotateClockwise:!1,referenceSize:o,sizeRatio:_,color:j,outlineColor:N,outlineWidth:F,isOutline:u,markerPlacement:n})}_setPoMap(e,t,n){let r;this._poMap[e]?r=this._poMap[e]:(r={},this._poMap[e]=r),r[t]=n}_maybeGetValueOrOverrideExpression(e,t,n){return this._getValueOrOverrideExpression(``,e,t,n,!1)}_getValueOrOverrideExpression(e,t,n,r,i=!0){if(i&&!ne(r)&&(r=H(e,n.toLowerCase())),t==null)return r;let a=this._poMap[t];if(a==null)return r;let o=a[n];return typeof o==`string`||typeof o==`number`||Array.isArray(o)?o:o?{valueExpressionInfo:o,defaultValue:r}:r}_analyzePrimitiveOverrides(e,t,n,r){if(e==null)return!1;typeof e==`string`&&(e=[e]);for(let t of this._primitiveOverrides)if(e.includes(t.primitiveName)&&t.valueExpressionInfo)return!0;if(t!=null){for(let e of t)if(e?.overrides.length>0)return!0}if(n!=null){for(let e of n)if(e?.overrides.length>0)return!0}if(r!=null){for(let e of r)if(e?.overrides.length>0)return!0}return!1}_getMaterialOverrides(e,t){if(!e)return[];let n=[];for(let r of e)n.push(...this._getPrimitiveMaterialOverrides(r,t));return n}_getPrimitiveMaterialOverrides(e,t){if(!e)return[];let n=V(this._primitiveOverrides.filter(t=>t.primitiveName===e));return n.forEach(e=>e.defaultValue=H(t,e.propertyName.toLowerCase())),n}_analyzeMaterialOverrides(e,t){return this._primitiveOverrides.filter(n=>n.primitiveName!==e||!t.includes(n.propertyName))}}function me(e,t){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[{...t}],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}function he(e){if(e?.startsWith(`Level_`)){let t=parseInt(e.slice(6),10);if(!isNaN(t))return t}return 0}function ge(e,t){if(!t||t.length===0)return e;let r=n(e);return E.applyOverrides(r,t),r}const _e=e=>e&&e.length===2&&e[0].enable&&e[1].enable&&e[0].type===`CIMSolidStroke`&&e[1].type===`CIMSolidFill`&&e[0].path==null&&e[1].path==null&&!e[0].effects&&!e[1].effects&&!e[0].animations&&!e[1].animations;function ve(e){let t=e.symbolLayers;if(!t)return!1;let n=t.find(e=>e.effects?.find(e=>e.type===`CIMGeometricEffectDashes`&&e.dashTemplate!=null)),r=t.find(e=>e.effects?.find(e=>e.type===`CIMGeometricEffectAddControlPoints`));return!!n||!!r}function ye(e){return Z(e)}function Z(e){return e.type===`CIMGeometricEffectCircularSector`||e.type===`CIMGeometricEffectRadial`||e.type===`CIMGeometricEffectTaperedPolygon`||e.type===`PrivateDimensionEffect`||e.type===`PrivateMatcherGeometryOverrideEffect`}function be(e){return e.type===`CIMGeometricEffectCircularSector`||e.type===`CIMGeometricEffectTaperedPolygon`}function xe(e,t){let n=e.filter(e=>e.type===`CIMSolidFill`),r=e.every(e=>e.type===`CIMSolidFill`||e.type===`CIMSolidStroke`),i=e.filter(e=>e.effects?.length),a=i.length===0||i.length===1&&n.length===1&&i[0]===n[0];return n.length>0&&r&&a&&t.some(({effect:e})=>be(e))}function Se(e){return e.some(e=>e.type!==`CIMSolidFill`&&e.type!==`CIMSolidStroke`&&(e.type!==`CIMVectorMarker`&&e.type!==`CIMPictureMarker`||e.markerPlacement!=null))}function Ce(e,t){return!!(t?.some(e=>e.type===`CIMGeometricEffectRadial`)&&t?.some(e=>e.type===`CIMGeometricEffectTaperedPolygon`)||t?.some(e=>e.type===`CIMGeometricEffectCircularSector`))&&Q(e)}function Q(e){if(e?.length!==2)return!1;let t=e.find(e=>e.type===`CIMSolidFill`),n=e.find(e=>e.type===`CIMSolidStroke`),r=n?.effects?.some(e=>e.type===`CIMGeometricEffectDashes`);return t!=null&&n!=null&&!r}function we(e){return n(e).map(e=>({...e,propertyName:re(e.propertyName)}))}function $(e){return v(e)?{type:`animation-params`,params:e}:null}export{pe as CIMAnalyzer,ge as analyzeCIMResource};
|
|
@@ -53,17 +53,17 @@ export default abstract class AreaMeasurementAnalysisView2D extends AnalysisView
|
|
|
53
53
|
*/
|
|
54
54
|
get result(): AreaMeasurementResult | null | undefined;
|
|
55
55
|
/**
|
|
56
|
-
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
57
|
-
* It supports [self](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
58
|
-
* [feature](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
56
|
+
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/) for measuring.
|
|
57
|
+
* It supports [self](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/#selfEnabled) and
|
|
58
|
+
* [feature](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/#featureEnabled) snapping.
|
|
59
59
|
*
|
|
60
60
|
* > [!WARNING]
|
|
61
61
|
* >
|
|
62
62
|
* > **Known Limitations**
|
|
63
63
|
* >
|
|
64
64
|
* > This analysis currently uses its `snappingOptions` rather than [ViewOptions.snapping](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/#snapping).
|
|
65
|
-
* > Tooltips and units configured through `view.options` still apply.
|
|
66
65
|
* > Support for `view.options.snapping` in this analysis is planned for a future release.
|
|
66
|
+
* > Tooltips and units configured through `view.options` still apply.
|
|
67
67
|
*
|
|
68
68
|
* @since 5.0
|
|
69
69
|
*/
|
|
@@ -52,17 +52,17 @@ export default abstract class DistanceMeasurementAnalysisView2D extends Analysis
|
|
|
52
52
|
*/
|
|
53
53
|
get result(): DistanceMeasurementResult | null | undefined;
|
|
54
54
|
/**
|
|
55
|
-
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
56
|
-
* It supports [self](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
57
|
-
* [feature](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
55
|
+
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/) for measuring.
|
|
56
|
+
* It supports [self](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/#selfEnabled) and
|
|
57
|
+
* [feature](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/#featureEnabled) snapping.
|
|
58
58
|
*
|
|
59
59
|
* > [!WARNING]
|
|
60
60
|
* >
|
|
61
61
|
* > **Known Limitations**
|
|
62
62
|
* >
|
|
63
63
|
* > This analysis currently uses its `snappingOptions` rather than [ViewOptions.snapping](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/#snapping).
|
|
64
|
-
* > Tooltips and units configured through `view.options` still apply.
|
|
65
64
|
* > Support for `view.options.snapping` in this analysis is planned for a future release.
|
|
65
|
+
* > Tooltips and units configured through `view.options` still apply.
|
|
66
66
|
*
|
|
67
67
|
* @since 5.0
|
|
68
68
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{handlesGroup as e}from"../../../../../../core/handleUtils.js";import has from"../../../../../../core/has.js";import{throwIfAborted as t,onAbort as n}from"../../../../../../core/promiseUtils.js";import{AFeatureTileLoadStrategy as r}from"./AFeatureTileLoadStrategy.js";import{DrillDownTileSourceChunk as i}from"./chunks/DrillDownTileSourceChunk.js";import{FeatureSetReaderJSON as a}from"../../support/FeatureSetReaderJSON.js";const o=has(`featurelayer-query-max-depth`);class s{constructor(t,r){this.subscription=t,this._tileIdToResult=new Map,this._controller=new AbortController,this._handles=e([n(t.signal,()=>this._controller.abort()),n(r,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get(e){return this._tileIdToResult.get(e)}set(e,t){this._tileIdToResult.set(e,t)}get options(){return{signal:this._controller.signal}}}class c extends r{constructor(){super(...arguments),this._loadStates=new Map}destroy(){super.destroy();for(let e of this._loadStates.values())e.destroy();this._loadStates.clear()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(e){this._loadStates.has(e.key.id)||this._loadStates.set(e.key.id,new s(e,this._options));let n=this._loadStates.get(e.key.id),r;try{for await(let r of this._fetchChunkInfos(n,e.tile,0)){let{queryJSON:e,reader:a,sourceTile:o,sourceTileDepth:s,tile:c}=r,l=new i(a,e,c,o,s,!1);t(n.options),this._addChunk(l)}}catch(e){r=e}t(n.options);let o=new i(a.empty(this.metadata),null,e.tile,null,-1,!0);if(this._addChunk(o),r)throw r}unload(e){super.unload(e),this._loadStates.get(e.key.id)?.destroy(),this._loadStates.delete(e.key.id)}async*_fetchChunkInfos(e,t,n){let r=e.get(t.id),i=!!r;if(r||(r=await this._fetchChunkInfo(e,t,n),e.set(t.id,r)),r.reader.exceededTransferLimit&&n<has(`featurelayer-query-max-depth`))for(let r of t.createChildTiles())yield*this._fetchChunkInfos(e,r,n+1);else i||(yield r)}async _fetchChunkInfo(e,t,n){let r=e.subscription.tile.getQuantizationParameters(),i=this._queryInfo.createTileQuery(t,{returnExceededLimitFeatures:n===o,quantizationParameters:r});return i?{reader:await this._fetch(i,e.options,{chunkId:t.id}),queryJSON:i.inner.toJSON(),tile:e.subscription.tile,sourceTile:t,sourceTileDepth:n}:{reader:a.empty(this.metadata),queryJSON:null,tile:e.subscription.tile,sourceTile:t,sourceTileDepth:n}}}export{c as FeatureDrillDownTileLoadStrategy};
|
|
2
|
+
import{handlesGroup as e}from"../../../../../../core/handleUtils.js";import has from"../../../../../../core/has.js";import{throwIfAborted as t,onAbort as n}from"../../../../../../core/promiseUtils.js";import{AFeatureTileLoadStrategy as r}from"./AFeatureTileLoadStrategy.js";import{DrillDownTileSourceChunk as i}from"./chunks/DrillDownTileSourceChunk.js";import{FeatureSetReaderJSON as a}from"../../support/FeatureSetReaderJSON.js";const o=has(`featurelayer-query-max-depth`);class s{constructor(t,r){this.subscription=t,this._tileIdToResult=new Map,this._controller=new AbortController,this._emittedObjectIds=new Set,this._handles=e([n(t.signal,()=>this._controller.abort()),n(r,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get(e){return this._tileIdToResult.get(e)}set(e,t){this._tileIdToResult.set(e,t)}deduplicate(e){let t=e.getCursor();for(;t.next();){let e=t.getObjectId();this._emittedObjectIds.has(e)?t.delete():this._emittedObjectIds.add(e)}}get options(){return{signal:this._controller.signal}}}class c extends r{constructor(){super(...arguments),this._loadStates=new Map}destroy(){super.destroy();for(let e of this._loadStates.values())e.destroy();this._loadStates.clear()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(e){this._loadStates.has(e.key.id)||this._loadStates.set(e.key.id,new s(e,this._options));let n=this._loadStates.get(e.key.id),r;try{for await(let r of this._fetchChunkInfos(n,e.tile,0)){let{queryJSON:e,reader:a,sourceTile:o,sourceTileDepth:s,tile:c}=r,l=new i(a,e,c,o,s,!1);t(n.options),this._addChunk(l)}}catch(e){r=e}t(n.options);let o=new i(a.empty(this.metadata),null,e.tile,null,-1,!0);if(this._addChunk(o),r)throw r}unload(e){super.unload(e),this._loadStates.get(e.key.id)?.destroy(),this._loadStates.delete(e.key.id)}async*_fetchChunkInfos(e,t,n){let r=e.get(t.id),i=!!r;if(r||(r=await this._fetchChunkInfo(e,t,n),e.set(t.id,r)),r.reader.exceededTransferLimit&&n<has(`featurelayer-query-max-depth`))for(let r of t.createChildTiles())yield*this._fetchChunkInfos(e,r,n+1);else i||(e.deduplicate(r.reader),yield r)}async _fetchChunkInfo(e,t,n){let r=e.subscription.tile.getQuantizationParameters(),i=this._queryInfo.createTileQuery(t,{returnExceededLimitFeatures:n===o,quantizationParameters:r});return i?{reader:await this._fetch(i,e.options,{chunkId:t.id}),queryJSON:i.inner.toJSON(),tile:e.subscription.tile,sourceTile:t,sourceTileDepth:n}:{reader:a.empty(this.metadata),queryJSON:null,tile:e.subscription.tile,sourceTile:t,sourceTileDepth:n}}}export{c as FeatureDrillDownTileLoadStrategy};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import{createArcadeGeometryFromOptimizedGeometry as t}from"../../../../../arcade/geometry/adapters/optimized.js";import has from"../../../../../core/has.js";import{estimateNumberArrayMemory as n}from"../../../../../core/memoryEstimations.js";import{DateOnly as r}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as i}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as a}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as o}from"../../../../../geometry/support/aaBoundingBox.js";import{getLabelPoint as s}from"../../../../../geometry/support/labelPoint.js";import{quantizeX as c,quantizeY as l}from"../../../../../geometry/support/quantizationUtils.js";import{zScale as u}from"../../../../../geometry/support/zscale.js";import{getCentroidOptimizedGeometry as d}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as f,generalizeOptimizedGeometry as p,quantizeOptimizedGeometry as m,unquantizeOptimizedGeometryInPlace as h}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as g}from"../../../../../layers/graphics/OptimizedFeature.js";import _ from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as v,unknown as y}from"../../../../../time/constants.js";import{FeatureSetCache as b}from"./FeatureSetCache.js";const x=has(`featurelayer-simplify-thresholds`)??[.5,.5,.5,.5],S=x[0],C=x[1],w=x[2],T=x[3],E=has(`featurelayer-simplify-payload-size-factors`)??[1,2,4],D=E[0],O=E[1],k=E[2],A=has(`featurelayer-simplify-mobile-factor`)??2,j=has(`esri-mobile`),M=4294967295;function N(e,t,n){if(!(e.length>t))for(;e.length<=t;)e.push(n)}class P{constructor(e){this.metadata=e,this.type=`FeatureSetReader`,this._overrides=null,this._postQueryFilteredIds=new Set,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._deleted=new Set,this._caches=new Map,this.arcadeDeclaredClass=`esri.arcade.Feature`,this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}getAreaSimplificationThreshold(e,t){let n=1,r=j?A:1;t>4e6?n=k*r:t>1e6?n=O*r:t>5e5?n=D*r:t>1e5&&(n=r);let i=0;return e>4e3?i=T*n:e>2e3?i=w*n:e>100?i=C:e>15&&(i=S),i}getBounds(e){N(this._boundsBuffer,this.getIndex()*4+4,0);let t=this.getBoundsXMin();if(t===M||!isFinite(t))return!1;if(this.getBoundsXMin()===0){let t=this.readGeometryWorldSpace();if(t?.isPoint&&t.coords[0]===0&&t.coords[1]===0)return o(e,0,0,0,0),!0;if(!t)return this.setBoundsXMin(M),!1;let n=1/0,r=1/0,i=-1/0,a=-1/0;return t.forEachVertex((e,t)=>{n=Math.min(n,e),r=Math.min(r,t),i=Math.max(i,e),a=Math.max(a,t)}),this.setBoundsXMin(n),this.setBoundsYMin(r),this.setBoundsXMax(i),this.setBoundsYMax(a),o(e,n,r,i,a),!0}let n=this.getBoundsXMin(),r=this.getBoundsYMin(),i=this.getBoundsXMax(),a=this.getBoundsYMax();return o(e,n,r,i,a),!0}getBoundsXMin(){return this._boundsBuffer[this.getIndex()*4]}setBoundsXMin(e){this._boundsBuffer[this.getIndex()*4]=e}getBoundsYMin(){return this._boundsBuffer[this.getIndex()*4+1]}setBoundsYMin(e){this._boundsBuffer[this.getIndex()*4+1]=e}getBoundsXMax(){return this._boundsBuffer[this.getIndex()*4+2]}setBoundsXMax(e){this._boundsBuffer[this.getIndex()*4+2]=e}getBoundsYMax(){return this._boundsBuffer[this.getIndex()*4+3]}setBoundsYMax(e){this._boundsBuffer[this.getIndex()*4+3]=e}readAttributeAsTimestamp(e){let t=this.readAttribute(e);return typeof t==`string`?new Date(t).getTime():typeof t==`number`||t==null?t:null}readAttribute(e,t=!1){let n=this._readAttribute(e,t);if(n!==void 0)return n;for(let n of this._joined){n.setIndex(this.getIndex());let r=n._readAttribute(e,t);if(r!==void 0)return r}}readAttributes(){let e=this._readAttributes();for(let t of this._joined){t.setIndex(this.getIndex());let n=t._readAttributes();for(let t of Object.keys(n))e[t]=n[t]}return e}joinAttributes(e){this._joined.push(e)}registerOverrides(e){this._overrides=e}withoutOverrides(){let e=this.copy();return e._overrides=null,e}readOptimizedFeatureWorldSpace(){let e=this.readGeometryWorldSpace(),t=this.readAttributes(),n=this.readCentroidWorldSpace();return new g(e,t,n,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){let e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){let e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){let e=this.readGeometryForDisplay();return f(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){let e=this._readX(),t=this.getInTransform();return t==null?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){let e=this._readY(),t=this.getInTransform();return t==null?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){let e=this._readGeometryDeltaDecoded(!0);if(!e){let e=this._createDeltaQuantizedGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryForDisplayTransformed(e){let t=this.readGeometryForDisplay();if(t&&this.metadata.geometryType===`esriGeometryPolyline`&&(t=p(t,this.metadata.geometryType,e.scale[0])),t&&=m(t,this.metadata.geometryType,e,t.hasZ,t.hasM,!0),!t){let t=this.readCentroidForDisplay();if(!t)return null;let n=c(e,t.coords[0]),r=l(e,t.coords[1]);return this._createDeltaQuantizedExtrudedGeometry(n,r).deltaDecode()}return t}_transformToWorldSpace(e){if(!e)return null;e=e.clone();let t=this.getInTransform();t&&h(e,t);let n=u(this.metadata.spatialReference,this.metadata.outSpatialReference);if(e.hasZ&&n!==1){let{stride:t,coords:r}=e;for(let e=2;e<r.length;e+=t)r[e]*=n}return e}readGeometryWorldSpace(){let e=this._readGeometry();return e||=this._createDeltaQuantizedGeometryFromServerCentroid(),this._transformToWorldSpace(e)}readCentroidForDisplay(){let e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){let e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();return this._transformToWorldSpace(t)}setCache(e){let t=this._caches.get(e);t??(t=new b(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}delete(){this._deleted.add(this.getObjectId())}getByReferenceVertexCount(){return null}get underlyingMemory(){let e=0;e+=n(this._boundsBuffer);for(let t of this._caches.values())e+=t.usedMemory;return e}getDisplayTransform(){return null}_readGeometryDeltaDecoded(e){let t=this._readGeometry(e);if(this.geometryType===`esriGeometryPoint`||!t)return t;let n=this.getInTransform();if(!t||!n)return t;let r=n.scale[2]??1,i=n.translate[2]??0,a=n.scale[3]??1,o=n.translate[3]??0,{hasZ:s,hasM:c,stride:l,size:u,coords:d}=t,f=s&&(r!==1||i!==0),p=c&&(a!==1||o!==0);if(f||p){let e=s?3:2;for(let t=0,n=l*u;t<n;t+=l)f&&(d[t+2]=r*d[t+2]+i),p&&(d[t+e]=a*d[t+e]+o)}return t.deltaDecode()}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some(t=>t.hasField(e))}geometry(){let e=this.readGeometryWorldSpace();if(e==null)return null;let n;switch(this.geometryType){case`esriGeometryPoint`:n=`point`;break;case`esriGeometryMultipoint`:n=`multipoint`;break;case`esriGeometryPolyline`:n=`polyline`;break;case`esriGeometryPolygon`:n=`polygon`;break;default:throw Error(`Unexpected geometry type: ${this.geometryType}`)}return t(n,{lengths:e.lengths,coords:e.coords,hasZ:this.hasZ,hasM:this.hasM},this.metadata.outSpatialReference)}autocastArcadeDate(t,n){return n&&n instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(n):e.dateJSAndZoneToArcadeDate(n,this.contextTimeZone??v):n}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===y}field(t){let n=this.fields.get(t);if(n)switch(n.type){case`date-only`:case`esriFieldTypeDateOnly`:return r.fromReader(this.readAttribute(t,!1));case`time-only`:case`esriFieldTypeTimeOnly`:return i.fromReader(this.readAttribute(t,!1));case`esriFieldTypeTimestampOffset`:case`timestamp-offset`:return e.fromReaderAsTimeStampOffset(this.readAttribute(t,!1));case`date`:case`esriFieldTypeDate`:return this.autocastArcadeDate(t,this.readAttribute(t,!0));default:return this.readAttribute(t,!1)}for(let a of this._joined)if(a.setIndex(this.getIndex()),n=a.fields.get(t),n)switch(n.type){case`date-only`:case`esriFieldTypeDateOnly`:return r.fromReader(a._readAttribute(t,!1));case`time-only`:case`esriFieldTypeTimeOnly`:return i.fromReader(a._readAttribute(t,!1));case`esriFieldTypeTimestampOffset`:case`timestamp-offset`:return e.fromReaderAsTimeStampOffset(a._readAttribute(t,!1));case`date`:case`esriFieldTypeDate`:return this.autocastArcadeDate(t,a._readAttribute(t,!0));default:return this.readAttribute(t,!1)}throw Error(`Field ${t} does not exist`)}setField(e,t){throw Error(`Unable to update feature attribute values, feature is readonly`)}keys(){return this.fields.fields.map(e=>e.name)}isEmpty(){return this.fields.fields.length<=0&&this.geometry()==null}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());let t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);let n={geometry:t.geometry,attributes:{...t.attributes}};for(let e in n.attributes){let t=n.attributes[e];t instanceof Date&&(n.attributes[e]=t.getTime())}return JSON.stringify(n)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(){return{attributes:this._readAttributes(),geometry:this.geometry()?.castAsJson()??null}}castAsJsonAsync(){return Promise.resolve(this.castAsJson())}applyPostQueryFilter(e){if(this._postQueryFilteredIds.clear(),!e)return;let t=this.getCursor();for(;t.next();)e.check(t,{currentUser:null})||this._postQueryFilteredIds.add(t.getObjectId())}_getExists(){if(this._overrides){let e=this.getObjectId();return!this._overrides.hasOverride(e)}let e=this.getObjectId();return this._deleted.has(e)||!this._postQueryFilteredIds.has(e)}_computeDisplayCentroid(e){if(this.getInTransform()==null)return d(e);let t=a.fromOptimized(e,this.geometryType);t.yFactor*=-1;let n=s(t);return n?isNaN(n[0])||isNaN(n[1])?d(e):(n[1]*=-1,new _([],n)):null}copyInto(e){e._joined=this._joined,e._overrides=this._overrides,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._activeCache=this._activeCache,e._caches=this._caches,e._contextTimeZone=this._contextTimeZone,e._postQueryFilteredIds=this._postQueryFilteredIds,e._deleted=this._deleted}_readLegacyGeometryWorldSpace(){let e=this.readGeometryWorldSpace();return f(e,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){let e=this._readServerCentroid();if(!e)return null;let[t,n]=e.coords;return this._createDeltaQuantizedExtrudedGeometry(t,n)}_createDeltaQuantizedExtrudedGeometry(e,t){return this.geometryType===`esriGeometryPolyline`?this._createDeltaQuantizedExtrudedLine(e,t):this._createDeltaQuantizedExtrudedQuad(e,t)}_createDeltaQuantizedExtrudedQuad(e,t){return new _([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(e,t){return new _([2],[e-1,t+1,1,-1])}}export{P as FeatureSetReader};
|
|
2
|
+
import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import{createArcadeGeometryFromOptimizedGeometry as t}from"../../../../../arcade/geometry/adapters/optimized.js";import has from"../../../../../core/has.js";import{estimateNumberArrayMemory as n}from"../../../../../core/memoryEstimations.js";import{DateOnly as r}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as i}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as a}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as o}from"../../../../../geometry/support/aaBoundingBox.js";import{getLabelPoint as s}from"../../../../../geometry/support/labelPoint.js";import{quantizeX as c,quantizeY as l}from"../../../../../geometry/support/quantizationUtils.js";import{zScale as u}from"../../../../../geometry/support/zscale.js";import{getCentroidOptimizedGeometry as d}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as f,generalizeOptimizedGeometry as p,quantizeOptimizedGeometry as m,unquantizeOptimizedGeometryInPlace as h}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as g}from"../../../../../layers/graphics/OptimizedFeature.js";import _ from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as v,unknown as y}from"../../../../../time/constants.js";import{FeatureSetCache as b}from"./FeatureSetCache.js";const x=has(`featurelayer-simplify-thresholds`)??[.5,.5,.5,.5],S=x[0],C=x[1],w=x[2],T=x[3],E=has(`featurelayer-simplify-payload-size-factors`)??[1,2,4],D=E[0],O=E[1],k=E[2],A=has(`featurelayer-simplify-mobile-factor`)??2,j=has(`esri-mobile`),M=4294967295;function N(e,t,n){if(!(e.length>t))for(;e.length<=t;)e.push(n)}class P{constructor(e){this.metadata=e,this.type=`FeatureSetReader`,this._overrides=null,this._postQueryFilteredIds=new Set,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._deleted=new Set,this._caches=new Map,this.arcadeDeclaredClass=`esri.arcade.Feature`,this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}getAreaSimplificationThreshold(e,t){let n=1,r=j?A:1;t>4e6?n=k*r:t>1e6?n=O*r:t>5e5?n=D*r:t>1e5&&(n=r);let i=0;return e>4e3?i=T*n:e>2e3?i=w*n:e>100?i=C:e>15&&(i=S),i}getBounds(e){N(this._boundsBuffer,this.getIndex()*4+4,0);let t=this.getBoundsXMin();if(t===M||!isFinite(t))return!1;if(this.getBoundsXMin()===0){let t=this.readGeometryWorldSpace();if(t?.isPoint&&t.coords[0]===0&&t.coords[1]===0)return o(e,0,0,0,0),!0;if(!t)return this.setBoundsXMin(M),!1;let n=1/0,r=1/0,i=-1/0,a=-1/0;return t.forEachVertex((e,t)=>{n=Math.min(n,e),r=Math.min(r,t),i=Math.max(i,e),a=Math.max(a,t)}),this.setBoundsXMin(n),this.setBoundsYMin(r),this.setBoundsXMax(i),this.setBoundsYMax(a),o(e,n,r,i,a),!0}let n=this.getBoundsXMin(),r=this.getBoundsYMin(),i=this.getBoundsXMax(),a=this.getBoundsYMax();return o(e,n,r,i,a),!0}getBoundsXMin(){return this._boundsBuffer[this.getIndex()*4]}setBoundsXMin(e){this._boundsBuffer[this.getIndex()*4]=e}getBoundsYMin(){return this._boundsBuffer[this.getIndex()*4+1]}setBoundsYMin(e){this._boundsBuffer[this.getIndex()*4+1]=e}getBoundsXMax(){return this._boundsBuffer[this.getIndex()*4+2]}setBoundsXMax(e){this._boundsBuffer[this.getIndex()*4+2]=e}getBoundsYMax(){return this._boundsBuffer[this.getIndex()*4+3]}setBoundsYMax(e){this._boundsBuffer[this.getIndex()*4+3]=e}readAttributeAsTimestamp(e){let t=this.readAttribute(e);return typeof t==`string`?new Date(t).getTime():typeof t==`number`||t==null?t:null}readAttribute(e,t=!1){let n=this._readAttribute(e,t);if(n!==void 0)return n;for(let n of this._joined){n.setIndex(this.getIndex());let r=n._readAttribute(e,t);if(r!==void 0)return r}}readAttributes(){let e=this._readAttributes();for(let t of this._joined){t.setIndex(this.getIndex());let n=t._readAttributes();for(let t of Object.keys(n))e[t]=n[t]}return e}joinAttributes(e){this._joined.push(e)}registerOverrides(e){this._overrides=e}withoutOverrides(){let e=this.copy();return e._overrides=null,e}readOptimizedFeatureWorldSpace(){let e=this.readGeometryWorldSpace(),t=this.readAttributes(),n=this.readCentroidWorldSpace();return new g(e,t,n,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){let e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){let e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){let e=this.readGeometryForDisplay();return f(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){let e=this._readX(),t=this.getInTransform();return t==null?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){let e=this._readY(),t=this.getInTransform();return t==null?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){let e=this._readGeometryDeltaDecoded(!0);if(!e){let e=this._createDeltaQuantizedGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryForDisplayTransformed(e){let t=this.readGeometryForDisplay();if(t&&this.metadata.geometryType===`esriGeometryPolyline`&&(t=p(t,this.metadata.geometryType,e.scale[0])),t&&=m(t,this.metadata.geometryType,e,t.hasZ,t.hasM,!0),!t){let t=this.readCentroidForDisplay();if(!t)return null;let n=c(e,t.coords[0]),r=l(e,t.coords[1]);return this._createDeltaQuantizedExtrudedGeometry(n,r).deltaDecode()}return t}_transformToWorldSpace(e){if(!e)return null;e=e.clone();let t=this.getInTransform();t&&h(e,t);let n=u(this.metadata.spatialReference,this.metadata.outSpatialReference);if(e.hasZ&&n!==1){let{stride:t,coords:r}=e;for(let e=2;e<r.length;e+=t)r[e]*=n}return e}readGeometryWorldSpace(){let e=this._readGeometry();return e||=this._createDeltaQuantizedGeometryFromServerCentroid(),this._transformToWorldSpace(e)}readCentroidForDisplay(){let e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){let e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();return this._transformToWorldSpace(t)}setCache(e){let t=this._caches.get(e);t??(t=new b(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}delete(){this._deleted.add(this.getObjectId())}getByReferenceVertexCount(){return null}get underlyingMemory(){let e=0;e+=n(this._boundsBuffer);for(let t of this._caches.values())e+=t.usedMemory;return e}getDisplayTransform(){return null}_readGeometryDeltaDecoded(e){let t=this._readGeometry(e);if(this.geometryType===`esriGeometryPoint`||!t)return t;let n=this.getInTransform();if(!t||!n)return t;let r=n.scale[2]??1,i=n.translate[2]??0,a=n.scale[3]??1,o=n.translate[3]??0,{hasZ:s,hasM:c,stride:l,size:u,coords:d}=t,f=s&&(r!==1||i!==0),p=c&&(a!==1||o!==0);if(f||p){let e=s?3:2;for(let t=0,n=l*u;t<n;t+=l)f&&(d[t+2]=r*d[t+2]+i),p&&(d[t+e]=a*d[t+e]+o)}return t.deltaDecode()}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some(t=>t.hasField(e))}geometry(){let e=this.readGeometryWorldSpace();if(e==null)return null;let n;switch(this.geometryType){case`esriGeometryPoint`:n=`point`;break;case`esriGeometryMultipoint`:n=`multipoint`;break;case`esriGeometryPolyline`:n=`polyline`;break;case`esriGeometryPolygon`:n=`polygon`;break;default:throw Error(`Unexpected geometry type: ${this.geometryType}`)}return t(n,{lengths:e.lengths,coords:e.coords,hasZ:this.hasZ,hasM:this.hasM},this.metadata.outSpatialReference)}autocastArcadeDate(t,n){return n&&n instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(n):e.dateJSAndZoneToArcadeDate(n,this.contextTimeZone??v):n}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===y}field(t){let n=this.fields.get(t);if(n)switch(n.type){case`date-only`:case`esriFieldTypeDateOnly`:return r.fromReader(this.readAttribute(t,!1));case`time-only`:case`esriFieldTypeTimeOnly`:return i.fromReader(this.readAttribute(t,!1));case`esriFieldTypeTimestampOffset`:case`timestamp-offset`:return e.fromReaderAsTimeStampOffset(this.readAttribute(t,!1));case`date`:case`esriFieldTypeDate`:return this.autocastArcadeDate(t,this.readAttribute(t,!0));default:return this.readAttribute(t,!1)}for(let a of this._joined)if(a.setIndex(this.getIndex()),n=a.fields.get(t),n)switch(n.type){case`date-only`:case`esriFieldTypeDateOnly`:return r.fromReader(a._readAttribute(t,!1));case`time-only`:case`esriFieldTypeTimeOnly`:return i.fromReader(a._readAttribute(t,!1));case`esriFieldTypeTimestampOffset`:case`timestamp-offset`:return e.fromReaderAsTimeStampOffset(a._readAttribute(t,!1));case`date`:case`esriFieldTypeDate`:return this.autocastArcadeDate(t,a._readAttribute(t,!0));default:return this.readAttribute(t,!1)}throw Error(`Field ${t} does not exist`)}setField(e,t){throw Error(`Unable to update feature attribute values, feature is readonly`)}keys(){return this.fields.fields.map(e=>e.name)}isEmpty(){return this.fields.fields.length<=0&&this.geometry()==null}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());let t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);let n={geometry:t.geometry,attributes:{...t.attributes}};for(let e in n.attributes){let t=n.attributes[e];t instanceof Date&&(n.attributes[e]=t.getTime())}return JSON.stringify(n)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(){return{attributes:this._readAttributes(),geometry:this.geometry()?.castAsJson()??null}}castAsJsonAsync(){return Promise.resolve(this.castAsJson())}applyPostQueryFilter(e){if(this._postQueryFilteredIds.clear(),!e)return;let t=this.getCursor();for(;t.next();)e.check(t,{currentUser:null})||this._postQueryFilteredIds.add(t.getObjectId())}_getExists(){let e=this.getObjectId();return this._deleted.has(e)?!1:this._overrides?!this._overrides.hasOverride(e):!this._postQueryFilteredIds.has(e)}_computeDisplayCentroid(e){if(this.getInTransform()==null)return d(e);let t=a.fromOptimized(e,this.geometryType);t.yFactor*=-1;let n=s(t);return n?isNaN(n[0])||isNaN(n[1])?d(e):(n[1]*=-1,new _([],n)):null}copyInto(e){e._joined=this._joined,e._overrides=this._overrides,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._activeCache=this._activeCache,e._caches=this._caches,e._contextTimeZone=this._contextTimeZone,e._postQueryFilteredIds=this._postQueryFilteredIds,e._deleted=this._deleted}_readLegacyGeometryWorldSpace(){let e=this.readGeometryWorldSpace();return f(e,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){let e=this._readServerCentroid();if(!e)return null;let[t,n]=e.coords;return this._createDeltaQuantizedExtrudedGeometry(t,n)}_createDeltaQuantizedExtrudedGeometry(e,t){return this.geometryType===`esriGeometryPolyline`?this._createDeltaQuantizedExtrudedLine(e,t):this._createDeltaQuantizedExtrudedQuad(e,t)}_createDeltaQuantizedExtrudedQuad(e,t){return new _([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(e,t){return new _([2],[e-1,t+1,1,-1])}}export{P as FeatureSetReader};
|
|
@@ -14,6 +14,9 @@ import type { ViewshedPlacementOptions, ViewshedPlacementResult } from "./Viewsh
|
|
|
14
14
|
* or to make existing viewsheds selectable and editable by enabling the [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#interactive) property.
|
|
15
15
|
* To select a viewshed, hover and click on its field-of-view manipulators.
|
|
16
16
|
*
|
|
17
|
+
* Snapping, tooltips, display units, and input units used during interactive placement and editing are inherited from
|
|
18
|
+
* [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/).
|
|
19
|
+
*
|
|
17
20
|
* The view for an analysis can be retrieved using [SceneView.whenAnalysisView()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#whenAnalysisView)
|
|
18
21
|
* similar to how layer views are retrieved for layers using [SceneView.whenLayerView()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#whenLayerView).
|
|
19
22
|
*
|
|
@@ -28,7 +28,8 @@ import type { VolumeMeasurementPlacementResult } from "./VolumeMeasurement/types
|
|
|
28
28
|
* > **Things to consider:**
|
|
29
29
|
* >
|
|
30
30
|
* > - When using the "cut-fill" [VolumeMeasurementAnalysis.measureType](https://developers.arcgis.com/javascript/latest/references/core/analysis/VolumeMeasurementAnalysis/#measureType) in [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/VolumeMeasurementAnalysisView3D/#interactive) mode, hover over the shift manipulator, press `Tab` to activate the tooltip input mode, and enter the elevation of the target surface.
|
|
31
|
-
* > - The cut-fill elevation tooltip
|
|
31
|
+
* > - The cut-fill elevation tooltip remains enabled independently of [ViewOptions.tooltips](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/#tooltips). Support for this setting is planned for a future release.
|
|
32
|
+
* > Its display and input units can still inherit [ViewOptions.displayUnits](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/#displayUnits) and [ViewOptions.inputUnits](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/#inputUnits).
|
|
32
33
|
* > - Snapping is enabled by default. This can be temporarily disabled by holding the `CTRL` key.
|
|
33
34
|
* > - Layer types currently supported for snapping are: [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/), [GraphicsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GraphicsLayer/) (except Mesh geometries),
|
|
34
35
|
* > [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/), [WFSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WFSLayer/), [CSVLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CSVLayer/),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import"../../../../core/has.js";import{
|
|
2
|
+
import"../../../../core/has.js";import{getOrCreateMapValue as e}from"../../../../core/MapUtils.js";import{estimateAttributesMemory as t}from"../../../../core/memoryEstimations.js";import{signal as n}from"../../../../core/signal.js";import{estimateGeometryMemory as r}from"../../../../layers/graphics/dehydratedFeatures.js";class i{constructor(e=()=>void 0){this._getGeometryKey=e,this._payloads=new Map,this._geometries=new Map,this._usedMemory=n(0),this._duplicatedMemory=n(0),this._referenceCount=n(0)}findGeometry(e,t){if(e===void 0)return;let n=this._geometries.get(e);if(n){for(let e of n)if(t(e))return e}}get usedMemory(){return this._usedMemory.value}get usedMemoryPerFeature(){return this._referenceCount.value>0?this._duplicatedMemory.value/this._referenceCount.value:0}ref(n,i,a=!0){let o;a&&n.geometry&&!this._payloads.has(n.geometry)&&(o=this._getGeometryKey(n.geometry,i),o!==void 0&&e(this._geometries,o,()=>new Set).add(n.geometry)),this._duplicatedMemory.value+=this._refPayload(n.geometry,r,o)+this._refPayload(n.attributes,t),this._referenceCount.value++}unref(e){let t=e.geometry,n=t&&this._payloads.get(t);if(t&&n?.count===1&&n.geometryKey!==void 0){let e=this._geometries.get(n.geometryKey);e.delete(t),e.size===0&&this._geometries.delete(n.geometryKey)}this._duplicatedMemory.value-=this._unrefPayload(e.geometry)+this._unrefPayload(e.attributes),this._referenceCount.value--}_refPayload(e,t,n){if(e==null)return 0;let r=this._payloads.get(e);if(r)return r.count++,r.size;let i=t(e);return this._payloads.set(e,new a(i,n)),this._usedMemory.value+=i,i}_unrefPayload(e){if(e==null)return 0;let t=this._payloads.get(e);return--t.count===0&&(this._payloads.delete(e),this._usedMemory.value-=t.size),t.size}get test(){}}class a{constructor(e,t){this.size=e,this.geometryKey=t,this.count=1}}export{i as FeatureMemory};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{shuffle as e}from"../../../../core/arrayUtils.js";import{baseObjectMemory as t}from"../../../../core/memoryEstimations.js";import{signal as n}from"../../../../core/signal.js";import{create as r,diameter as i}from"../../../../geometry/support/aaBoundingBox.js";import{create as a,fromExtent as o,intersects as s,copy as c,positiveInfinity as l,intersection as u}from"../../../../geometry/support/aaBoundingRect.js";import{numVertices as d,estimateSize as f,getObjectId as p,computeAABB as m}from"../../../../layers/graphics/dehydratedFeatures.js";import{computeMaxZ as h}from"../graphics/graphicUtils.js";import{SampledGeometryMaxDistanceRatio as g}from"./SampledGeometryMaxDistanceRatio.js";class _{constructor(e,t){this.descriptor=e,this._memory=t,this._numVertices=0,this.exceededTransferLimit=n(!1),this._fetchFailed=n(!1),this._sorted=!1,this._numFeatures=n(v),this._emptyFeatureRatio=n(0),this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._displayingFeatures=null,this.alive=!0,this.filtered=!1,this._features=null,this._featuresLength=n(0),this._featureLimit=n(0),this._fetchStatus=0,this.fetchInformation=n(``),this.fetchingResolution=this.displayingResolution=e.resolution}get featuresMissing(){return this.fetchFailed||(this.hasPreciseFeatureCount?this._featuresLength.value<this.numFeatures:this.exceededTransferLimit.value)}get showsAllFeatures(){return!this.fetchFailed&&this.displayingFeatures!=null&&(this.hasPreciseFeatureCount?this.displayingFeatures.length===this.numFeatures:!this.exceededTransferLimit.value)}get missingAttributes(){return this._missingAttributes}get fetchFailed(){return this._fetchFailed.value}set fetchFailed(e){this._fetchFailed.value=e}get displayingFeatures(){return this._displayingFeatures}set displayingFeatures(e){this._displayingFeatures=e,this.extentIncludingBorrowedFeatures=null}get perTileMaximumNumberOfFeaturesExceeded(){let e=this.isFetched&&this.featuresMissing;return!this.filtered&&(e||this.hasFeatureLimit)}get features(){return this._features}get featureLimit(){return this._featureLimit.value}set featureLimit(e){this._featureLimit.value=e}get hasFeatureLimit(){return this.featureLimit!==this._featuresLength.value}get availableFields(){return this._availableFields}setFeatures(e,t,n,r){this._replaceFeatures(e),this._availableFields=n,this._featuresLength.value=e?.length??0,this._sorted=!1,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._missingAttributes=r,e&&e.length>0?(this._emptyFeatureRatio.value=t/(e.length+t),this._numVertices=e.reduce((e,t)=>e+d(t.geometry),0)):(this._emptyFeatureRatio.value=0,this._numVertices=0)}computeZQuantizationFactor(){if(this._features&&this._features.length>0){let e=this._features.reduce((e,{geometry:t})=>Math.max(e,h(t)??0),0);return Math.floor(e/this.descriptor.planetRadius)+1}return 1}get emptyFeatureRatio(){return this._emptyFeatureRatio.value}get numFeatures(){return this.hasPreciseFeatureCount?this._numFeatures.value:this._features?this._featuresLength.value:0}set numFeatures(e){this._numFeatures.value=e}get hasPreciseFeatureCount(){return this._numFeatures.value>v}get needsFeatureCount(){return this._numFeatures.value===v}get numVertices(){return this._numVertices}get id(){return this.descriptor.id}get estimatedSize(){return this.updateEstimates(),this._estimatedSize}get sampledDensityEstimate(){return this._sampledDensityEstimate}updateEstimates(){if(this._estimatedSize<0||this._sampledDensityEstimate<0){this._estimatedSize=0,this._sampledDensityEstimate=0;let e=Math.floor(Math.sqrt(S));if(this._features){let t=null,n=new g(S,w*this.fetchingResolution),r=this._features.length;for(let i=0;i<r;++i){let a=this._features[i],o=f(a);if(this._estimatedSize+=o,!n.done){let o=r-i,s=Math.ceil(o/Math.max(1,Math.floor(Math.sqrt(n.numRemainingSamples))));if(i%s===0){let r=Math.max(Math.floor(n.numRemainingSamples/o),e);n.sampleGeometry(a.geometry,t,r)}}t=a.geometry}this._sampledDensityEstimate=n.numSamples>=C?n.ratio:0}return!0}return!1}get fetchStatus(){return this._fetchStatus}requestFetch(){this._fetchStatus=0}requestRefetch(){this._fetchStatus=1}startFetch(){this._fetchStatus=this.needsRefetch?3:2}fetchDone(e){this._fetchStatus=e}get isFetching(){return this._fetchStatus===2||this._fetchStatus===3}get isRefetching(){return this._fetchStatus===3}get needsFetch(){return this._fetchStatus===0||this._fetchStatus===1}get needsRefetch(){return this._fetchStatus===1}get isFetched(){return this._fetchStatus===4||this._fetchStatus===5}isFullyFetched(e){return!!this.features&&(this.features.length>=e||this.fetchStatus===5)}resetFetching(){this._fetchStatus=+!!this.isRefetching}get needsDisplayUpdate(){return!!this._features&&!x(this._features,this.displayingFeatures,this.featureLimit)}intersects(e){return e==null||!this.descriptor.extent||(o(e,T),s(this.descriptor.extent,T))}intersectionIncludingBorrowed(e,t){let n=this.extentIncludingBorrowedFeatures==null?this.descriptor.extent:this.extentIncludingBorrowedFeatures;return!e&&!n?(c(t,l),t):(e==null?c(t,n):(o(e,t),u(t,n,t)),t)}_shuffle(t){this._features?.sort((e,n)=>p(e,t)-p(n,t)),e(this._features,16438)}_sortBySize(e){this._features?.sort((t,n)=>i(m(n.geometry,E))-i(m(t.geometry,E))||p(t,e)-p(n,e))}reduceFeatures(e,t,n,r){if(e<=0)return!1;if(!this._features)return this.featureLimit=0,!1;let i=!1;this.featureLimit=Math.ceil(this.numFeatures*e),this.featureLimit>this._features.length&&this._fetchStatus===4&&this._features.length>0&&(this._fetchStatus=1,i=!0),!this._sorted&&e<1&&(r===1?this._shuffle(n):this._sortBySize(n),this._sorted=!0);let a=Math.max(this.featureLimit,Math.ceil(t*this.numFeatures));if(this._features.length>a){for(let e=a;e<this._features.length;e++)this._memory.unref(this._features[e]);this._features.length=this._featuresLength.value=a,this._estimatedSize=-1,this.exceededTransferLimit.value=!1,this._fetchStatus===5&&(this._fetchStatus=4)}return i}get cache(){return new b(this,this._features,this._numFeatures.value,this._emptyFeatureRatio.value)}set cache(e){this._replaceFeatures(e.features),this.requestController=null,this._availableFields=e.availableFields,this._featuresLength.value=e.features?.length??0,this._numFeatures.value=e.numFeatures,this._emptyFeatureRatio.value=e.emptyFeatureRatio,this._fetchStatus=e.fetchStatus,this.exceededTransferLimit.value=e.exceededTransferLimit,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this.fetchInformation.value=e.fetchInformation}_replaceFeatures(e){for(let
|
|
2
|
+
import{shuffle as e}from"../../../../core/arrayUtils.js";import{baseObjectMemory as t}from"../../../../core/memoryEstimations.js";import{signal as n}from"../../../../core/signal.js";import{create as r,diameter as i}from"../../../../geometry/support/aaBoundingBox.js";import{create as a,fromExtent as o,intersects as s,copy as c,positiveInfinity as l,intersection as u}from"../../../../geometry/support/aaBoundingRect.js";import{numVertices as d,estimateSize as f,getObjectId as p,computeAABB as m}from"../../../../layers/graphics/dehydratedFeatures.js";import{computeMaxZ as h}from"../graphics/graphicUtils.js";import{SampledGeometryMaxDistanceRatio as g}from"./SampledGeometryMaxDistanceRatio.js";class _{constructor(e,t){this.descriptor=e,this._memory=t,this._numVertices=0,this.exceededTransferLimit=n(!1),this._fetchFailed=n(!1),this._sorted=!1,this._numFeatures=n(v),this._emptyFeatureRatio=n(0),this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._displayingFeatures=null,this.alive=!0,this.filtered=!1,this._features=null,this._featuresLength=n(0),this._featureLimit=n(0),this._fetchStatus=0,this.fetchInformation=n(``),this.fetchingResolution=this.displayingResolution=e.resolution}get featuresMissing(){return this.fetchFailed||(this.hasPreciseFeatureCount?this._featuresLength.value<this.numFeatures:this.exceededTransferLimit.value)}get showsAllFeatures(){return!this.fetchFailed&&this.displayingFeatures!=null&&(this.hasPreciseFeatureCount?this.displayingFeatures.length===this.numFeatures:!this.exceededTransferLimit.value)}get missingAttributes(){return this._missingAttributes}get fetchFailed(){return this._fetchFailed.value}set fetchFailed(e){this._fetchFailed.value=e}get displayingFeatures(){return this._displayingFeatures}set displayingFeatures(e){this._displayingFeatures=e,this.extentIncludingBorrowedFeatures=null}get perTileMaximumNumberOfFeaturesExceeded(){let e=this.isFetched&&this.featuresMissing;return!this.filtered&&(e||this.hasFeatureLimit)}get features(){return this._features}get featureLimit(){return this._featureLimit.value}set featureLimit(e){this._featureLimit.value=e}get hasFeatureLimit(){return this.featureLimit!==this._featuresLength.value}get availableFields(){return this._availableFields}setFeatures(e,t,n,r,i=this.fetchingResolution,a=!0){this._replaceFeatures(e,i,a),this._availableFields=n,this._featuresLength.value=e?.length??0,this._sorted=!1,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._missingAttributes=r,e&&e.length>0?(this._emptyFeatureRatio.value=t/(e.length+t),this._numVertices=e.reduce((e,t)=>e+d(t.geometry),0)):(this._emptyFeatureRatio.value=0,this._numVertices=0)}computeZQuantizationFactor(){if(this._features&&this._features.length>0){let e=this._features.reduce((e,{geometry:t})=>Math.max(e,h(t)??0),0);return Math.floor(e/this.descriptor.planetRadius)+1}return 1}get emptyFeatureRatio(){return this._emptyFeatureRatio.value}get numFeatures(){return this.hasPreciseFeatureCount?this._numFeatures.value:this._features?this._featuresLength.value:0}set numFeatures(e){this._numFeatures.value=e}get hasPreciseFeatureCount(){return this._numFeatures.value>v}get needsFeatureCount(){return this._numFeatures.value===v}get numVertices(){return this._numVertices}get id(){return this.descriptor.id}get estimatedSize(){return this.updateEstimates(),this._estimatedSize}get sampledDensityEstimate(){return this._sampledDensityEstimate}updateEstimates(){if(this._estimatedSize<0||this._sampledDensityEstimate<0){this._estimatedSize=0,this._sampledDensityEstimate=0;let e=Math.floor(Math.sqrt(S));if(this._features){let t=null,n=new g(S,w*this.fetchingResolution),r=this._features.length;for(let i=0;i<r;++i){let a=this._features[i],o=f(a);if(this._estimatedSize+=o,!n.done){let o=r-i,s=Math.ceil(o/Math.max(1,Math.floor(Math.sqrt(n.numRemainingSamples))));if(i%s===0){let r=Math.max(Math.floor(n.numRemainingSamples/o),e);n.sampleGeometry(a.geometry,t,r)}}t=a.geometry}this._sampledDensityEstimate=n.numSamples>=C?n.ratio:0}return!0}return!1}get fetchStatus(){return this._fetchStatus}requestFetch(){this._fetchStatus=0}requestRefetch(){this._fetchStatus=1}startFetch(){this._fetchStatus=this.needsRefetch?3:2}fetchDone(e){this._fetchStatus=e}get isFetching(){return this._fetchStatus===2||this._fetchStatus===3}get isRefetching(){return this._fetchStatus===3}get needsFetch(){return this._fetchStatus===0||this._fetchStatus===1}get needsRefetch(){return this._fetchStatus===1}get isFetched(){return this._fetchStatus===4||this._fetchStatus===5}isFullyFetched(e){return!!this.features&&(this.features.length>=e||this.fetchStatus===5)}resetFetching(){this._fetchStatus=+!!this.isRefetching}get needsDisplayUpdate(){return!!this._features&&!x(this._features,this.displayingFeatures,this.featureLimit)}intersects(e){return e==null||!this.descriptor.extent||(o(e,T),s(this.descriptor.extent,T))}intersectionIncludingBorrowed(e,t){let n=this.extentIncludingBorrowedFeatures==null?this.descriptor.extent:this.extentIncludingBorrowedFeatures;return!e&&!n?(c(t,l),t):(e==null?c(t,n):(o(e,t),u(t,n,t)),t)}_shuffle(t){this._features?.sort((e,n)=>p(e,t)-p(n,t)),e(this._features,16438)}_sortBySize(e){this._features?.sort((t,n)=>i(m(n.geometry,E))-i(m(t.geometry,E))||p(t,e)-p(n,e))}reduceFeatures(e,t,n,r){if(e<=0)return!1;if(!this._features)return this.featureLimit=0,!1;let i=!1;this.featureLimit=Math.ceil(this.numFeatures*e),this.featureLimit>this._features.length&&this._fetchStatus===4&&this._features.length>0&&(this._fetchStatus=1,i=!0),!this._sorted&&e<1&&(r===1?this._shuffle(n):this._sortBySize(n),this._sorted=!0);let a=Math.max(this.featureLimit,Math.ceil(t*this.numFeatures));if(this._features.length>a){for(let e=a;e<this._features.length;e++)this._memory.unref(this._features[e]);this._features.length=this._featuresLength.value=a,this._estimatedSize=-1,this.exceededTransferLimit.value=!1,this._fetchStatus===5&&(this._fetchStatus=4)}return i}get cache(){return new b(this,this._features,this._numFeatures.value,this._emptyFeatureRatio.value)}set cache(e){this._replaceFeatures(e.features,e.resolution),this.requestController=null,this._availableFields=e.availableFields,this._featuresLength.value=e.features?.length??0,this._numFeatures.value=e.numFeatures,this._emptyFeatureRatio.value=e.emptyFeatureRatio,this._fetchStatus=e.fetchStatus,this.exceededTransferLimit.value=e.exceededTransferLimit,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this.fetchInformation.value=e.fetchInformation}_replaceFeatures(e,t,n=!0){for(let r of e??[])this._memory.ref(r,t,n);for(let e of this._features??[])this._memory.unref(e);this._features=e}}const v=-1,y=-2;class b{constructor(e,n,r,i){this.features=n,this.numFeatures=r,this.emptyFeatureRatio=i,this.usedMemory=t+e.estimatedSize,this.resolution=e.displayingResolution,this.availableFields=e.availableFields,this.fetchStatus=e.fetchStatus,this.exceededTransferLimit=e.exceededTransferLimit.value,this.fetchInformation=e.fetchInformation.value}}function x(e,t,n){if(t==null||e==null||n!==t.length||n>e.length)return!1;for(let r=0;r<n;++r)if(e[r]!==t[r])return!1;return!0}const S=150,C=100,w=2,T=a(),E=r();export{_ as FeatureTile,b as FeatureTileCacheItem,y as failedFeatureCount};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{filterInPlace as n}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import s from"../../../../core/ReactiveMap.js";import{on as c,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as u}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as f}from"../../../../core/sql.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getEpsilon as h}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as g,equals as _,clone as v,expand as y,toExtent as b,width as x,height as S}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as C,hasVertices as w,computeAABR as T}from"../../../../layers/graphics/dehydratedFeatures.js";import E from"../../../../rest/support/QuantizationParameters.js";import D from"../../../../rest/support/Query.js";import{FeatureMemory as O}from"./FeatureMemory.js";import{MultiFeatureReference as k,SingleFeatureReference as A}from"./featureReference.js";import{failedFeatureCount as j,FeatureTile as M}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as N,virtualSnapshotTileId as P}from"./FeatureTileDescriptor.js";import{tilesAreRelated as F}from"../../terrain/tileUtils.js";import{ImmediateTask as I,TaskPriority as L}from"../../../support/Scheduler.js";let R=class extends t{set maximumNumberOfFeatures(e){e||=1/0;let t=this._get(`maximumNumberOfFeatures`);e===t||e<1||(this._set(`maximumNumberOfFeatures`,e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set(`memoryFactor`,e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set(`lodFactor`,e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&this.context.query.queryFeatureCount!=null}set useTileCount(e){this._useTileCount=e,this.notifyChange(`useTileCount`)}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}get usedMemory(){return this._memory.usedMemory}get usedMemoryPerFeature(){return this._memory.usedMemoryPerFeature}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(let e of this._featureTiles.values())if(!this.hasFullGeometries&&e.emptyFeatureRatio!==0||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){return!this._supportsResolution||this.tileDescriptors?.some(z)||!this.context.capabilities.supportsQuantization&&this.context.geometryType!==`polyline`}set filterExtent(e){if(e!=null&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference)){r.getLogger(this).error(`#filterExtent=`,`extent needs to be in the same spatial reference as the tiling scheme`);return}let t=this._get(`filterExtent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`filterExtent`,n),this._reclip(n,t)}_updateTileZQuantization(e){if(this.context.viewingMode===1){let t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:[],removes:[]},adds:[],removes:[]},this._featureTiles=new s,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._memory=new O,this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this.snappingComplexityExceeded=!0,this._isFetching=!1;let t=e.context;this._frameTask=t.scheduler?.registerTask(L.FEATURE_TILE_FETCHER,this)??I,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?k:A,this._objectIdField=t.objectIdField}initialize(){this.addHandles([c(()=>this.tileDescriptors,`change`,()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),l(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){let e=this._featureTiles.get(N);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(let t of this._featureTiles.values()){let n=t.missingAttributes?.get(e);if(n!=null)return n}}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{t.displayingFeatures!=null&&t.displayingFeatures.length!==0&&(e==null?e=new Set(t.availableFields):e.forEach(n=>{t.availableFields?.has(n)||e.delete(n)}))}),e??new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());let t=this._pendingEdits;t.count++;let n=t.edits.then(()=>e.result.catch(e=>{if(a(e))throw e;return null}).then(e=>e&&(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e))).then(e=>(--t.count===0&&(this._pendingEdits===t&&(this._pendingEdits=null),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)));return t.edits=n,this._updated(),n}_applyEditsDeleteFeatures(e){if(e.length===0)return;let t=this.context.globalIdField,n=t&&this.availableFields.has(t),i=new Set,a=this._objectIdField;e.forEach(({objectId:e,globalId:o})=>{(!e||e<0)&&t&&o&&(n||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(o,a,t)),e!=null&&e>=0&&i.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;let t=e.features.filter(e=>!i.has(C(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,n){if(e==null)return null;let r=this.features.find(t=>t.attributes?.[n]===e);return r?C(r,t):null}async _applyEditsAddUpdateFeatures(e,t,n){let{objectIdField:i,globalIdField:a}=this.context,o=a&&this.availableFields.has(a),s=new Set,c=new Set;for(let t of e){let e=t.objectId;e!=null&&s.add(e)}for(let{objectId:e,globalId:n}of t){let t=e;(t==null||t<0)&&a&&(o||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),t=this._objectIdFromGlobalId(n,i,a)),t!=null&&t>=0&&(s.add(t),c.add(t))}if(s.size===0)return;let l=[];this._featureTiles.forEach(e=>{let t=this._applyEditsAddUpdateTile(e,s,c,n);l.push(t)}),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,n,r){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;let i=this._createQuery(e);i.resultType=void 0,i.cacheHint=!1,i.objectIds=Array.from(t);let a=await this._queryFeatures(i,r),o=null;if(n.size>0){let t=e.features.filter(e=>!n.has(C(e,this._objectIdField)));t.length!==e.features.length&&(o=t)}if(a.features.length>0){o||=e.features.slice();for(let e of a.features)o.push(e)}o&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,o.length)),this._applyEditsTileUpdated(),e.setFeatures(o,0,G(e.availableFields,a.fields),K(e.missingAttributes,a.missingAttributes)),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:Z})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){let t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;let n=this._featureTilesArray;if(this._markTilesNotAlive(n),!e.run(()=>this._addTiles(n,e))||!e.run(()=>this._filterExtentTiles(n,e))||!e.run(()=>this._removeTiles(n,e))||e.done){this._setDirty();return}let r=this._sortTiles(n);(!e.run(()=>this._showTiles(r,e))||!e.run(()=>this._fetchTiles(r,e))||!e.run(()=>this._updateMemoryEstimates(r,e)))&&this._setDirty(),this._updated(),this.updating||(this._updateMaximumNumberOfFeaturesExceeded(),this._updateSnappingComplexityExceeded(r))}_updateSnappingComplexityExceeded(e){let t=ee;for(let n of e){if(z(n)||t<=0)break;if(!B(n)&&(t--,n.sampledDensityEstimate>$)){this.snappingComplexityExceeded=!0;return}}this.snappingComplexityExceeded=this._featureTiles.size===0}_markTilesNotAlive(e){for(let t of e)t.alive=!1}_addTiles(e,t){return this._suspended||!this.tileDescriptors?!1:(this.tileDescriptors.forEach(n=>{let r=this._featureTiles.get(n.id);r?r.alive=!0:t.done||(e.push(this._addTile(n)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(let n of e){if(t.done)break;n.alive&&(n.filtered=!n.intersects(this.filterExtent),n.filtered&&(this._clearTile(n),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let n=e.length-1;n>=0&&!t.done;n--){let r=e[n];r.alive||(this._removeTile(r),n!==e.length-1&&(e[n]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_showTiles(e,t){let n=this._updateRatio(e),r=e=>{let t=this._fullRatio<1?n(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();let{numFeatures:r,fetchingResolution:i,descriptor:a,isFetched:o}=e;return this._supportsResolution&&r>0&&i!==a.resolution&&o&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(let n of e)if(!t.run(()=>r(n))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let n=!1;for(let r of e){if(!r.needsFetch)continue;let e=this.context.memoryCache==null?null:this.context.memoryCache.pop(r.id);if(e?.resolution===r.displayingResolution)r.cache=e,r.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(r)){let e=new AbortController,i=this._fetchTileCount(r,e.signal);this._handleRequest(r,i,e,()=>r.resetFetching(),()=>r.numFeatures=j),n=!0,t.madeProgress()}if(t.done)return!0}}if(n)return t.hasProgressed;for(let n of e){if(!n.needsFetch)continue;let e=new AbortController,i=this._fetchTile(n,e.signal);if(this._handleRequest(n,i,e,e=>n.fetchDone(e),e=>{n.fetchFailed=!0,this.context.logFetchError(r.getLogger(this),e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;let n=[];this._featureTiles.forEach(r=>{r.displayingFeatures!=null&&r.displayingFeatures.length!==0&&(r.intersectionIncludingBorrowed(t,J),r.intersectionIncludingBorrowed(e,Y),_(J,Y)||n.push(r))}),this._refreshDisplayingFeatures(n),this._updated()}_refreshDisplayingFeatures(e){let t=new Set,n=this._changes.updates;for(let r of e)if(r.displayingFeatures!=null)for(let e of r.displayingFeatures){let r=C(e,this._objectIdField);if(t.has(r))continue;t.add(r);let i=this._displayingFeatureReferences.get(r).feature;n.removes.push(i),n.adds.push(i)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set(`dataUpdating`,!1),this.updating){let t=0,n=0,r=0,i=0,a=0,o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++n,e.isFetching&&e.hasPreciseFeatureCount){let t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),n=e.displayingFeatures==null?0:e.displayingFeatures.length*o;a+=t-n}e.needsFetch?++i:e.numFeatures>0&&(++r,t+=e.numFeatures)}),i+=e;let s=0,c=0;t?(c=t,s=Math.min(i*t/r,t)):(c=n,s=i),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set(`updatingTotal`,c),this._set(`updatingRemaining`,s),this._set(`expectedFeatureDiff`,a)}else this._set(`updatingTotal`,0),this._set(`updatingRemaining`,0),this._set(`expectedFeatureDiff`,0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(let{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e){this._set(`maximumNumberOfFeaturesExceeded`,!0);return}this._set(`maximumNumberOfFeaturesExceeded`,!1)}_updateRatio(e){let t=H(e),n=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0])),r=0,i=0;for(let t of e){let e=t.numFeatures;r+=e,i+=e*n(t)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/r),this._farRatio=this.maximumNumberOfFeatures/i,this._scheduleUpdated(),n}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach(e=>{if(!e.featuresMissing)return;let t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){let t=new M(e,this._memory);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){let t=e.displayingResolution;this._featureTiles.forEach(n=>{if(n.displayingFeatures!=null&&e!==n&&F(e.descriptor.lij,n.descriptor.lij)){e.displayingFeatures??=[],e.descriptor.extent&&n.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=v(e.descriptor.extent),y(e.extentIncludingBorrowedFeatures,n.descriptor.extent,e.extentIncludingBorrowedFeatures));for(let r of n.displayingFeatures){e.displayingFeatures.push(r),this._memory.ref(r);let n=this._displayingFeatureReferences.get(C(r,this._objectIdField));n.ref(this._memory,n.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(4):e.requestFetch()}_cancelFetchTile(e){let t=e.requestController;t!=null&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t}),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){e.fetchFailed=!1;let n=this._maximumFeaturesForTile(e);if(n<=0)return(!e.hasPreciseFeatureCount||e.numFeatures!==0)&&(e.fetchFailed=!0),U(e),e.fetchInformation.value=`Empty tile`,4;let r=this._getMaxRecordCount(e),i=Math.ceil(n/r);if(e.fetchingResolution=e.descriptor.resolution,V(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=n&&i>D.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);let a=this._createQuery(e);if(a.maxRecordCountFactor=i,e.isRefetching&&e.features&&e.features.length>0){let t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/r);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${n} features`;let{features:s,exceededTransferLimit:c,fields:l,missingAttributes:u}=await this._queryFeatures(a,t),d=c||a.maxRecordCountFactor>=D.MAX_MAX_RECORD_COUNT_FACTOR||n===this._totalFeaturesForTile(e)?5:4,f=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!c;let t=this._removeEmptyFeatures(s,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${s.length}/${n} features`,e.setFeatures(s,t,W(l),K(void 0,u)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>n?1:d},t);return o(t),this._invalidateCounts(),f}async _fetchPagedTile(e,t){let n=0,r=0,i,a=0,s=this._maximumFeaturesForTile(e)-a,c=this._getMaxRecordCount(e),l=null,u;for(;;){let d=this._createQuery(e),f=this._setPagingParameters(d,n,s,c);e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${s} features`;let{features:p,exceededTransferLimit:m,fields:h,missingAttributes:g}=await this._queryFeatures(d,t);if(await this._frameTask.schedule(()=>{f&&(n+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!m,i=i?.concat(p)??p,l=G(l,h),u=K(u,g),e.setFeatures(i,r,l,u),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),o(t),s=this._maximumFeaturesForTile(e)-(i?.length??0),!f||!m||s<=0)return m?4:5}}_createFeatureCountQuery(e){let t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){let t=this.context.createQuery();if(t.resultType=this._resultType(e),!V(e)&&e.descriptor.extent&&this.context.tilingScheme&&(t.geometry=b(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),t.resultType!==`tile`&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),B(e)){let{highlightIds:e}=this.context;e&&e.length>q&&r.getLogger(this).warn(`highlight-too-many-features`,`highlight is limited to ${q} features on large layers configured with a display filter to avoid performance issues`),t.objectIds=e?.slice(0,q)}else!z(e)&&this.context.effectiveDisplayFilter&&(t.where=f(t.where,this.context.effectiveDisplayFilter.where));return t}_setPagingParameters(e,t,n,r){return this.context.capabilities.supportsPagination?(e.start=t,n>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(n/r),e.num=Math.min(e.maxRecordCountFactor*r,n)):e.num=Math.min(r),!0):!1}_getEffectiveTileResolution(e){if(V(e)||!this._supportsResolution)return null;let t=this.context.viewingMode===1&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&this.context.geometryType!==`point`}_setResolutionParams(e,t){let n=this._getEffectiveTileResolution(t);n!=null&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new E({mode:`view`,originPosition:`upper-left`,tolerance:n,extent:this.context.fullExtent}):this.context.geometryType===`polyline`&&(e.maxAllowableOffset=n))}_removeEmptyFeatures(e,t){let r=e.length;if(t&&this._supportsResolution){let r=t*(1+h());n(e,({geometry:e})=>!e||!w(e)?!1:(T(e,X),x(X)>r||S(X)>r))}else n(e,({geometry:e})=>w(e));return r-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!z(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case`tile`:if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case`standard`:if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||q}_resultType(e){if(this.context.capabilities.supportsResultType)return z(e)?`standard`:`tile`}get _reduceMode(){let e=this.context.geometryType;return e===`polygon`||e===`polyline`?0:1}_handleRequest(e,t,n,r,i){e.startFetch(),e.requestController=n;let o=!1;t.then(t=>{e.requestController=null,r(t)}).catch(t=>{e.requestController===n&&(e.requestController=null,e.fetchDone(4)),a(t)?o=!0:i(t)}).then(()=>{o||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles(`scheduleUpdated`)||this.addHandles(u(()=>{this.removeHandles(`scheduleUpdated`),this._updated()}),`scheduleUpdated`)}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;let t=e.features;if(e.featureLimit===0||!t){let t=e.displayingFeatures!=null&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}let n=e.fetchingResolution,{adds:r,updates:i}=this._changes,a=Math.min(e.featureLimit,t.length);for(let e=0;e<a;++e){let a=t[e],o=C(a,this._objectIdField),s=this._displayingFeatureReferences.get(o);if(this._memory.ref(a),s){let{oldVersion:e,newVersion:t}=s.ref(this._memory,a,n);e!==t&&(e&&i.removes.push(e),t&&i.adds.push(t))}else this._displayingFeatureReferences.set(o,new this.FeatureReferenceClass(a,n,this._memory)),r.push(a);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(e.displayingFeatures==null)return;let{updates:t,removes:n}=this._changes;for(let r of e.displayingFeatures){this._memory.unref(r);let i=C(r,this._objectIdField),a=this._displayingFeatureReferences.get(i);if(!a)continue;let{oldVersion:o,newVersion:s}=a.unref(this._memory,e.displayingResolution);this._numDisplayingFeatureReferences--,o!==s&&(s==null?(this._displayingFeatureReferences.delete(i),o&&n.push(o)):(t.adds.push(s),o&&t.removes.push(o)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get(`dataUpdating`)||this._set(`dataUpdating`,!0)}_applyChanges(){let e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);let t=this._changes.adds,n=this._changes.removes,r=Math.min(t.length,n.length),i=0;for(;i<r;){let e=Math.min(i+Q,r);this._notifyDataUpdating(),this.features.addMany(t.slice(i,e)),this.features.removeMany(n.slice(i,e)),i=e}t.length>r&&(this._notifyDataUpdating(),this.features.addMany(i===0?t:t.slice(i))),n.length>r&&(this._notifyDataUpdating(),this.features.removeMany(i===0?n:n.slice(i))),t.length=0,n.length=0}_clearTile(e){this._hideTile(e),e.features&&this.context.memoryCache!=null&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange(`totalVertices`),this.notifyChange(`totalFeatures`)}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return this._featureTiles.values().reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){let t=this._totalFeaturesForTile(e),n=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*n/(1-e.emptyFeatureRatio)),t)}get test(){}};e([p({constructOnly:!0})],R.prototype,`features`,void 0),e([p({constructOnly:!0})],R.prototype,`context`,void 0),e([p()],R.prototype,`tileDescriptors`,void 0),e([p({value:1/0})],R.prototype,`maximumNumberOfFeatures`,null),e([p({value:1})],R.prototype,`memoryFactor`,null),e([p({value:1})],R.prototype,`lodFactor`,null),e([p()],R.prototype,`useTileCount`,null),e([p({readOnly:!0})],R.prototype,`updating`,null),e([p({readOnly:!0})],R.prototype,`dataUpdating`,void 0),e([p({readOnly:!0})],R.prototype,`updatingTotal`,void 0),e([p({readOnly:!0})],R.prototype,`updatingRemaining`,void 0),e([p({readOnly:!0})],R.prototype,`expectedFeatureDiff`,void 0),e([p()],R.prototype,`usedMemory`,null),e([p()],R.prototype,`usedMemoryPerFeature`,null),e([p({readOnly:!0})],R.prototype,`maximumNumberOfFeaturesExceeded`,void 0),e([p({readOnly:!0})],R.prototype,`totalVertices`,null),e([p({readOnly:!0})],R.prototype,`totalFeatures`,null),e([p({readOnly:!0})],R.prototype,`showsAllFeatures`,null),e([p({readOnly:!0})],R.prototype,`hasFullGeometries`,null),e([p()],R.prototype,`filterExtent`,null),e([p()],R.prototype,`_dirty`,void 0),e([p()],R.prototype,`_suspended`,void 0),e([p()],R.prototype,`_pendingEdits`,void 0),e([p()],R.prototype,`_applyEditsTilesUpdated`,void 0),e([p()],R.prototype,`_paused`,null),e([p()],R.prototype,`snappingComplexityExceeded`,void 0),e([p()],R.prototype,`_isFetching`,void 0),R=e([m(`esri.views.3d.layers.support.FeatureTileFetcher3D`)],R);function z(e){return e.id===P}function B(e){return e.id===N}function V(e){return z(e)||B(e)}function H(e){let t=0;for(let n of e)n.features&&n.features.length>0&&n.alive&&(t=Math.max(t,n.descriptor.lij[0]));return t}function U(e){e.setFeatures([],0,null,void 0)}function W(e){return e==null?new Set:new Set(e.map(e=>e.name))}function G(e,t){if(e==null||t==null)return W(t);let n=new Set;for(let{name:r}of t)e.has(r)&&n.add(r);return n}function K(e,t){if(!t?.length)return e;e??=new Map;let n=()=>new Set;for(let{objectId:r,attribute:a}of t)i(e,r,n).add(a);return e}const q=2e3,J=g(),Y=g(),X=g(),Z=6e5,Q=200,$=.95,ee=10;export{R as FeatureTileFetcher3D};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{filterInPlace as n}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import s from"../../../../core/ReactiveMap.js";import{on as c,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as u}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as f}from"../../../../core/sql.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getEpsilon as h}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as g,equals as _,clone as v,expand as y,toExtent as b,width as x,height as S}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as C,hasVertices as w,computeAABR as T}from"../../../../layers/graphics/dehydratedFeatures.js";import{geometryKey as E,transferGeometryKey as D,identicalTransferGeometry as O,completeDehydratedFeatureFromTransfer as k}from"../../../../layers/graphics/transferFeatures.js";import A from"../../../../rest/support/QuantizationParameters.js";import j from"../../../../rest/support/Query.js";import{FeatureMemory as M}from"./FeatureMemory.js";import{MultiFeatureReference as ee,SingleFeatureReference as te}from"./featureReference.js";import{failedFeatureCount as N,FeatureTile as P}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as F,virtualSnapshotTileId as I}from"./FeatureTileDescriptor.js";import{tilesAreRelated as L}from"../../terrain/tileUtils.js";import{ImmediateTask as R,TaskPriority as z}from"../../../support/Scheduler.js";let B=class extends t{set maximumNumberOfFeatures(e){e||=1/0;let t=this._get(`maximumNumberOfFeatures`);e===t||e<1||(this._set(`maximumNumberOfFeatures`,e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set(`memoryFactor`,e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set(`lodFactor`,e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&this.context.query.queryFeatureCount!=null}set useTileCount(e){this._useTileCount=e,this.notifyChange(`useTileCount`)}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}get usedMemory(){return this._memory.usedMemory}get usedMemoryPerFeature(){return this._memory.usedMemoryPerFeature}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(let e of this._featureTiles.values())if(!this.hasFullGeometries&&e.emptyFeatureRatio!==0||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){return!this._supportsResolution||this.tileDescriptors?.some(V)||!this.context.capabilities.supportsQuantization&&this.context.geometryType!==`polyline`}set filterExtent(e){if(e!=null&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference)){r.getLogger(this).error(`#filterExtent=`,`extent needs to be in the same spatial reference as the tiling scheme`);return}let t=this._get(`filterExtent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`filterExtent`,n),this._reclip(n,t)}_updateTileZQuantization(e){if(this.context.viewingMode===1){let t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:[],removes:[]},adds:[],removes:[]},this._featureTiles=new s,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._memory=new M(E),this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this.snappingComplexityExceeded=!0,this._isFetching=!1;let t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??R,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?ee:te,this._objectIdField=t.objectIdField}initialize(){this.addHandles([c(()=>this.tileDescriptors,`change`,()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),l(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){let e=this._featureTiles.get(F);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(let t of this._featureTiles.values()){let n=t.missingAttributes?.get(e);if(n!=null)return n}}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{t.displayingFeatures!=null&&t.displayingFeatures.length!==0&&(e==null?e=new Set(t.availableFields):e.forEach(n=>{t.availableFields?.has(n)||e.delete(n)}))}),e??new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());let t=this._pendingEdits;t.count++;let n=t.edits.then(()=>e.result.catch(e=>{if(a(e))throw e;return null}).then(e=>e&&(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e))).then(e=>(--t.count===0&&(this._pendingEdits===t&&(this._pendingEdits=null),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)));return t.edits=n,this._updated(),n}_applyEditsDeleteFeatures(e){if(e.length===0)return;let t=this.context.globalIdField,n=t&&this.availableFields.has(t),i=new Set,a=this._objectIdField;e.forEach(({objectId:e,globalId:o})=>{(!e||e<0)&&t&&o&&(n||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(o,a,t)),e!=null&&e>=0&&i.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;let t=e.features.filter(e=>!i.has(C(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,n){if(e==null)return null;let r=this.features.find(t=>t.attributes?.[n]===e);return r?C(r,t):null}async _applyEditsAddUpdateFeatures(e,t,n){let{objectIdField:i,globalIdField:a}=this.context,o=a&&this.availableFields.has(a),s=new Set,c=new Set;for(let t of e){let e=t.objectId;e!=null&&s.add(e)}for(let{objectId:e,globalId:n}of t){let t=e;(t==null||t<0)&&a&&(o||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),t=this._objectIdFromGlobalId(n,i,a)),t!=null&&t>=0&&(s.add(t),c.add(t))}if(s.size===0)return;let l=[];this._featureTiles.forEach(e=>{let t=this._applyEditsAddUpdateTile(e,s,c,n);l.push(t)}),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,n,r){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;let i=this._createQuery(e);i.resultType=void 0,i.cacheHint=!1,i.objectIds=Array.from(t);let a=await this.context.query.queryFeaturesDehydrated(i,{signal:r,timeout:$}),o=null;if(n.size>0){let t=e.features.filter(e=>!n.has(C(e,this._objectIdField)));t.length!==e.features.length&&(o=t)}if(a.features.length>0){o||=e.features.slice();for(let e of a.features)o.push(e)}o&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,o.length)),this._applyEditsTileUpdated(),e.setFeatures(o,0,q(e.availableFields,a.fields),J(e.missingAttributes,a.missingAttributes),void 0,!1),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t,n){return this.context.query.queryFeaturesDehydrated(e,{signal:n,timeout:$,completeFeatureFromTransfer:(e,n,r)=>{let i=D(e.geometry,n,t),a=this._memory.findGeometry(i,t=>O(e.geometry,n,t));a?e.geometry=a:k(e,n,r)}})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){let t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;let n=this._featureTilesArray;if(this._markTilesNotAlive(n),!e.run(()=>this._addTiles(n,e))||!e.run(()=>this._filterExtentTiles(n,e))||!e.run(()=>this._removeTiles(n,e))||e.done){this._setDirty();return}let r=this._sortTiles(n);(!e.run(()=>this._showTiles(r,e))||!e.run(()=>this._fetchTiles(r,e))||!e.run(()=>this._updateMemoryEstimates(r,e)))&&this._setDirty(),this._updated(),this.updating||(this._updateMaximumNumberOfFeaturesExceeded(),this._updateSnappingComplexityExceeded(r))}_updateSnappingComplexityExceeded(e){let t=ie;for(let n of e){if(V(n)||t<=0)break;if(!H(n)&&(t--,n.sampledDensityEstimate>re)){this.snappingComplexityExceeded=!0;return}}this.snappingComplexityExceeded=this._featureTiles.size===0}_markTilesNotAlive(e){for(let t of e)t.alive=!1}_addTiles(e,t){return this._suspended||!this.tileDescriptors?!1:(this.tileDescriptors.forEach(n=>{let r=this._featureTiles.get(n.id);r?r.alive=!0:t.done||(e.push(this._addTile(n)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(let n of e){if(t.done)break;n.alive&&(n.filtered=!n.intersects(this.filterExtent),n.filtered&&(this._clearTile(n),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let n=e.length-1;n>=0&&!t.done;n--){let r=e[n];r.alive||(this._removeTile(r),n!==e.length-1&&(e[n]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_showTiles(e,t){let n=this._updateRatio(e),r=e=>{let t=this._fullRatio<1?n(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();let{numFeatures:r,fetchingResolution:i,descriptor:a,isFetched:o}=e;return this._supportsResolution&&r>0&&i!==a.resolution&&o&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(let n of e)if(!t.run(()=>r(n))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let n=!1;for(let r of e){if(!r.needsFetch)continue;let e=this.context.memoryCache==null?null:this.context.memoryCache.pop(r.id);if(e?.resolution===r.displayingResolution)r.cache=e,r.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(r)){let e=new AbortController,i=this._fetchTileCount(r,e.signal);this._handleRequest(r,i,e,()=>r.resetFetching(),()=>r.numFeatures=N),n=!0,t.madeProgress()}if(t.done)return!0}}if(n)return t.hasProgressed;for(let n of e){if(!n.needsFetch)continue;let e=new AbortController,i=this._fetchTile(n,e.signal);if(this._handleRequest(n,i,e,e=>n.fetchDone(e),e=>{n.fetchFailed=!0,this.context.logFetchError(r.getLogger(this),e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;let n=[];this._featureTiles.forEach(r=>{r.displayingFeatures!=null&&r.displayingFeatures.length!==0&&(r.intersectionIncludingBorrowed(t,X),r.intersectionIncludingBorrowed(e,Z),_(X,Z)||n.push(r))}),this._refreshDisplayingFeatures(n),this._updated()}_refreshDisplayingFeatures(e){let t=new Set,n=this._changes.updates;for(let r of e)if(r.displayingFeatures!=null)for(let e of r.displayingFeatures){let r=C(e,this._objectIdField);if(t.has(r))continue;t.add(r);let i=this._displayingFeatureReferences.get(r).feature;n.removes.push(i),n.adds.push(i)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set(`dataUpdating`,!1),this.updating){let t=0,n=0,r=0,i=0,a=0,o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++n,e.isFetching&&e.hasPreciseFeatureCount){let t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),n=e.displayingFeatures==null?0:e.displayingFeatures.length*o;a+=t-n}e.needsFetch?++i:e.numFeatures>0&&(++r,t+=e.numFeatures)}),i+=e;let s=0,c=0;t?(c=t,s=Math.min(i*t/r,t)):(c=n,s=i),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set(`updatingTotal`,c),this._set(`updatingRemaining`,s),this._set(`expectedFeatureDiff`,a)}else this._set(`updatingTotal`,0),this._set(`updatingRemaining`,0),this._set(`expectedFeatureDiff`,0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(let{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e){this._set(`maximumNumberOfFeaturesExceeded`,!0);return}this._set(`maximumNumberOfFeaturesExceeded`,!1)}_updateRatio(e){let t=W(e),n=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0])),r=0,i=0;for(let t of e){let e=t.numFeatures;r+=e,i+=e*n(t)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/r),this._farRatio=this.maximumNumberOfFeatures/i,this._scheduleUpdated(),n}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach(e=>{if(!e.featuresMissing)return;let t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){let t=new P(e,this._memory);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){let t=e.displayingResolution;this._featureTiles.forEach(n=>{if(n.displayingFeatures!=null&&e!==n&&L(e.descriptor.lij,n.descriptor.lij)){e.displayingFeatures??=[],e.descriptor.extent&&n.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=v(e.descriptor.extent),y(e.extentIncludingBorrowedFeatures,n.descriptor.extent,e.extentIncludingBorrowedFeatures));for(let r of n.displayingFeatures){e.displayingFeatures.push(r),this._memory.ref(r);let n=this._displayingFeatureReferences.get(C(r,this._objectIdField));n.ref(this._memory,n.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(4):e.requestFetch()}_cancelFetchTile(e){let t=e.requestController;t!=null&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t}),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){e.fetchFailed=!1;let n=this._maximumFeaturesForTile(e);if(n<=0)return(!e.hasPreciseFeatureCount||e.numFeatures!==0)&&(e.fetchFailed=!0),G(e),e.fetchInformation.value=`Empty tile`,4;let r=this._getMaxRecordCount(e),i=Math.ceil(n/r);if(e.fetchingResolution=e.descriptor.resolution,U(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=n&&i>j.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);let a=this._createQuery(e);if(a.maxRecordCountFactor=i,e.isRefetching&&e.features&&e.features.length>0){let t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/r);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${n} features`;let{features:s,exceededTransferLimit:c,fields:l,missingAttributes:u}=await this._queryFeatures(a,e.fetchingResolution,t),d=c||a.maxRecordCountFactor>=j.MAX_MAX_RECORD_COUNT_FACTOR||n===this._totalFeaturesForTile(e)?5:4,f=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!c;let t=this._removeEmptyFeatures(s,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${s.length}/${n} features`,e.setFeatures(s,t,K(l),J(void 0,u)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>n?1:d},t);return o(t),this._invalidateCounts(),f}async _fetchPagedTile(e,t){let n=0,r=0,i,a=0,s=this._maximumFeaturesForTile(e)-a,c=this._getMaxRecordCount(e),l=null,u;for(;;){let d=this._createQuery(e),f=this._setPagingParameters(d,n,s,c);e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${s} features`;let{features:p,exceededTransferLimit:m,fields:h,missingAttributes:g}=await this._queryFeatures(d,e.fetchingResolution,t);if(await this._frameTask.schedule(()=>{f&&(n+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!m,i=i?.concat(p)??p,l=q(l,h),u=J(u,g),e.setFeatures(i,r,l,u),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),o(t),s=this._maximumFeaturesForTile(e)-(i?.length??0),!f||!m||s<=0)return m?4:5}}_createFeatureCountQuery(e){let t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){let t=this.context.createQuery();if(t.resultType=this._resultType(e),!U(e)&&e.descriptor.extent&&this.context.tilingScheme&&(t.geometry=b(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),t.resultType!==`tile`&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),H(e)){let{highlightIds:e}=this.context;e&&e.length>Y&&r.getLogger(this).warn(`highlight-too-many-features`,`highlight is limited to ${Y} features on large layers configured with a display filter to avoid performance issues`),t.objectIds=e?.slice(0,Y)}else!V(e)&&this.context.effectiveDisplayFilter&&(t.where=f(t.where,this.context.effectiveDisplayFilter.where));return t}_setPagingParameters(e,t,n,r){return this.context.capabilities.supportsPagination?(e.start=t,n>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(n/r),e.num=Math.min(e.maxRecordCountFactor*r,n)):e.num=Math.min(r),!0):!1}_getEffectiveTileResolution(e){if(U(e)||!this._supportsResolution)return null;let t=this.context.viewingMode===1&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&this.context.geometryType!==`point`}_setResolutionParams(e,t){let n=this._getEffectiveTileResolution(t);n!=null&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new A({mode:`view`,originPosition:`upper-left`,tolerance:n,extent:this.context.fullExtent}):this.context.geometryType===`polyline`&&(e.maxAllowableOffset=n))}_removeEmptyFeatures(e,t){let r=e.length;if(t&&this._supportsResolution){let r=t*(1+h());n(e,({geometry:e})=>!e||!w(e)?!1:(T(e,Q),x(Q)>r||S(Q)>r))}else n(e,({geometry:e})=>w(e));return r-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!V(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case`tile`:if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case`standard`:if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||Y}_resultType(e){if(this.context.capabilities.supportsResultType)return V(e)?`standard`:`tile`}get _reduceMode(){let e=this.context.geometryType;return e===`polygon`||e===`polyline`?0:1}_handleRequest(e,t,n,r,i){e.startFetch(),e.requestController=n;let o=!1;t.then(t=>{e.requestController=null,r(t)}).catch(t=>{e.requestController===n&&(e.requestController=null,e.fetchDone(4)),a(t)?o=!0:i(t)}).then(()=>{o||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles(`scheduleUpdated`)||this.addHandles(u(()=>{this.removeHandles(`scheduleUpdated`),this._updated()}),`scheduleUpdated`)}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;let t=e.features;if(e.featureLimit===0||!t){let t=e.displayingFeatures!=null&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}let n=e.fetchingResolution,{adds:r,updates:i}=this._changes,a=Math.min(e.featureLimit,t.length);for(let e=0;e<a;++e){let a=t[e],o=C(a,this._objectIdField),s=this._displayingFeatureReferences.get(o);if(this._memory.ref(a),s){let{oldVersion:e,newVersion:t}=s.ref(this._memory,a,n);e!==t&&(e&&i.removes.push(e),t&&i.adds.push(t))}else this._displayingFeatureReferences.set(o,new this.FeatureReferenceClass(a,n,this._memory)),r.push(a);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(e.displayingFeatures==null)return;let{updates:t,removes:n}=this._changes;for(let r of e.displayingFeatures){this._memory.unref(r);let i=C(r,this._objectIdField),a=this._displayingFeatureReferences.get(i);if(!a)continue;let{oldVersion:o,newVersion:s}=a.unref(this._memory,e.displayingResolution);this._numDisplayingFeatureReferences--,o!==s&&(s==null?(this._displayingFeatureReferences.delete(i),o&&n.push(o)):(t.adds.push(s),o&&t.removes.push(o)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get(`dataUpdating`)||this._set(`dataUpdating`,!0)}_applyChanges(){let e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);let t=this._changes.adds,n=this._changes.removes,r=Math.min(t.length,n.length),i=0;for(;i<r;){let e=Math.min(i+ne,r);this._notifyDataUpdating(),this.features.addMany(t.slice(i,e)),this.features.removeMany(n.slice(i,e)),i=e}t.length>r&&(this._notifyDataUpdating(),this.features.addMany(i===0?t:t.slice(i))),n.length>r&&(this._notifyDataUpdating(),this.features.removeMany(i===0?n:n.slice(i))),t.length=0,n.length=0}_clearTile(e){this._hideTile(e),e.features&&this.context.memoryCache!=null&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange(`totalVertices`),this.notifyChange(`totalFeatures`)}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return this._featureTiles.values().reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){let t=this._totalFeaturesForTile(e),n=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*n/(1-e.emptyFeatureRatio)),t)}get test(){}};e([p({constructOnly:!0})],B.prototype,`features`,void 0),e([p({constructOnly:!0})],B.prototype,`context`,void 0),e([p()],B.prototype,`tileDescriptors`,void 0),e([p({value:1/0})],B.prototype,`maximumNumberOfFeatures`,null),e([p({value:1})],B.prototype,`memoryFactor`,null),e([p({value:1})],B.prototype,`lodFactor`,null),e([p()],B.prototype,`useTileCount`,null),e([p({readOnly:!0})],B.prototype,`updating`,null),e([p({readOnly:!0})],B.prototype,`dataUpdating`,void 0),e([p({readOnly:!0})],B.prototype,`updatingTotal`,void 0),e([p({readOnly:!0})],B.prototype,`updatingRemaining`,void 0),e([p({readOnly:!0})],B.prototype,`expectedFeatureDiff`,void 0),e([p()],B.prototype,`usedMemory`,null),e([p()],B.prototype,`usedMemoryPerFeature`,null),e([p({readOnly:!0})],B.prototype,`maximumNumberOfFeaturesExceeded`,void 0),e([p({readOnly:!0})],B.prototype,`totalVertices`,null),e([p({readOnly:!0})],B.prototype,`totalFeatures`,null),e([p({readOnly:!0})],B.prototype,`showsAllFeatures`,null),e([p({readOnly:!0})],B.prototype,`hasFullGeometries`,null),e([p()],B.prototype,`filterExtent`,null),e([p()],B.prototype,`_dirty`,void 0),e([p()],B.prototype,`_suspended`,void 0),e([p()],B.prototype,`_pendingEdits`,void 0),e([p()],B.prototype,`_applyEditsTilesUpdated`,void 0),e([p()],B.prototype,`_paused`,null),e([p()],B.prototype,`snappingComplexityExceeded`,void 0),e([p()],B.prototype,`_isFetching`,void 0),B=e([m(`esri.views.3d.layers.support.FeatureTileFetcher3D`)],B);function V(e){return e.id===I}function H(e){return e.id===F}function U(e){return V(e)||H(e)}function W(e){let t=0;for(let n of e)n.features&&n.features.length>0&&n.alive&&(t=Math.max(t,n.descriptor.lij[0]));return t}function G(e){e.setFeatures([],0,null,void 0)}function K(e){return e==null?new Set:new Set(e.map(e=>e.name))}function q(e,t){if(e==null||t==null)return K(t);let n=new Set;for(let{name:r}of t)e.has(r)&&n.add(r);return n}function J(e,t){if(!t?.length)return e;e??=new Map;let n=()=>new Set;for(let{objectId:r,attribute:a}of t)i(e,r,n).add(a);return e}const Y=2e3,X=g(),Z=g(),Q=g(),$=6e5,ne=200,re=.95,ie=10;export{B as FeatureTileFetcher3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import n from"../../../../core/Error.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as i,createAbortError as a}from"../../../../core/promiseUtils.js";import{difference as o}from"../../../../core/SetUtils.js";import{parseWhereClause as s}from"../../../../core/sql.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{fromFeatureSetJSON as u}from"../../../../layers/graphics/dehydratedFeatures.js";import{canConvertSqlRelativeTime as d,sqlRelativeTimeToAbsolute as f}from"../../../../layers/support/relativeTimeQueryUtils.js";import{queueAutoPriority as p}from"../../../../request/queue.js";import{runQuery as m,executeQuery as h,executeQueryForCount as g}from"../../../../rest/query/operations/query.js";import{PBFDecoder as _}from"../../support/PBFDecoder.js";let v=class extends t{constructor(e){super(e)}get implicitFields(){if(!this.layer.outFields?.includes(`*`))return new Set;let e=new Set(this.layerView.requiredFields),t=new Set(this.layerView.availableFields);return o(t,e)}async queryFeaturesDehydrated(e,t){let{layer:n}=this,r=n.capabilities,o=r?.query?.supportsFormatPBF,c=n.parsedUrl,l=d(e.where)?await f(n.fieldsIndex,e.where,r.query.relativeTimeBinWindow):e.where,p=e.where;l!==e.where&&(e=e.clone(),e.where=l);let g;if(o){this._decoder??=new _(this.controller);let r={sourceSpatialReference:n.spatialReference?.toJSON()??null,applyTransform:!0,maxStringAttributeFields:this.implicitFields,maxStringAttributeLength:S};g=await m(c,e,`pbf`,this._createRequestOptions(t)).then(e=>(i(t),this._decoder==null?Promise.reject(a()):this._decoder.invoke({buffer:e,options:r},t.signal)))}else g=await h(c,e,n.spatialReference,this._createRequestOptions(t)).then(e=>u(e,{maxStringAttributeFields:this.implicitFields,maxStringAttributeLength:S}));if(p&&e.where!==p){let e=await this.controller.schedule(()=>s(p,this.layer.fieldsIndex),t.signal);g.features=await this.controller.schedule(()=>g.features.filter(t=>e.testFeatureCompiled(t)),t.signal)}return g}queryFeatureCount(e,t){return g(this.layer.parsedUrl,e,this._createRequestOptions(t))}destroy(){this._decoder=r(this._decoder)}_createRequestOptions(e){return{...p,...e,query:{...this.layer.customParameters,token:this.layer.apiKey,...e?.query}}}};e([c({constructOnly:!0})],v.prototype,`layer`,void 0),e([c({constructOnly:!0})],v.prototype,`layerView`,void 0),e([c({constructOnly:!0})],v.prototype,`controller`,void 0),e([c({readOnly:!0})],v.prototype,`implicitFields`,null),v=e([l(`esri.views.3d.layers.support.featureTileQuery3D.FeatureTileServiceQuery3D`)],v);let y=class extends t{constructor(e){super(e)}queryFeaturesDehydrated(e,t){return this.layer.queryFeatures(e,t)}};e([c({constructOnly:!0})],y.prototype,`layer`,void 0),y=e([l(`esri.views.3d.layers.support.featureTileQuery3D.FeatureTileOGCServiceQuery3D`)],y);let b=class extends t{constructor(e){super(e)}queryFeaturesDehydrated(e,t){return this.layer.source.queryFeaturesJSON(e,t).then(u,n=>{if(n&&n.name===`query-features-json:unsupported`)return this.layer.queryFeatures(e,t);throw n})}queryFeatureCount(e,t){return this.layer.queryFeatureCount(e,t)}};e([c({constructOnly:!0})],b.prototype,`layer`,void 0),b=e([l(`esri.views.3d.layers.support.featureTileQuery3D.FeatureTileClientQuery3D`)],b);function x(e,t){let{layer:r}=e;switch(r.type){case`feature`:switch(r.source.type){case`feature-layer`:return new v({layer:r,layerView:e,controller:t});case`memory`:return new b({layer:r});case`csv`:case`geojson`:case`oriented-imagery`:case`wfs`:case`ogc-feature`:case`parquet`:break;default:r.source.type}break;case`catalog-footprint`:return new v({layer:r,layerView:e,controller:t});case`csv`:case`geojson`:case`oriented-imagery`:case`wfs`:return new b({layer:r});case`ogc-feature`:return new y({layer:r})}throw new n(`feature-layer:unsupported`,`Unsupported Feature layer type ${e.layer.type}:${e.layer.source.type}`)}const S=1024;export{x as createFeatureTileQuery3D};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import n from"../../../../core/Error.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as i,createAbortError as a}from"../../../../core/promiseUtils.js";import{difference as o}from"../../../../core/SetUtils.js";import{parseWhereClause as s}from"../../../../core/sql.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{fromFeatureSetJSON as u}from"../../../../layers/graphics/dehydratedFeatures.js";import{canConvertSqlRelativeTime as d,sqlRelativeTimeToAbsolute as f}from"../../../../layers/support/relativeTimeQueryUtils.js";import{queueAutoPriority as p}from"../../../../request/queue.js";import{runQuery as m,executeQuery as h,executeQueryForCount as g}from"../../../../rest/query/operations/query.js";import{PBFDecoder as _}from"../../support/PBFDecoder.js";let v=class extends t{constructor(e){super(e)}get implicitFields(){if(!this.layer.outFields?.includes(`*`))return new Set;let e=new Set(this.layerView.requiredFields),t=new Set(this.layerView.availableFields);return o(t,e)}async queryFeaturesDehydrated(e,t){let{layer:n}=this,r=n.capabilities,o=r?.query?.supportsFormatPBF,c=n.parsedUrl,l=d(e.where)?await f(n.fieldsIndex,e.where,r.query.relativeTimeBinWindow):e.where,p=e.where;l!==e.where&&(e=e.clone(),e.where=l);let g;if(o){this._decoder??=new _(this.controller);let r={sourceSpatialReference:n.spatialReference?.toJSON()??null,applyTransform:!0,maxStringAttributeFields:this.implicitFields,maxStringAttributeLength:S};g=await m(c,e,`pbf`,this._createRequestOptions(t)).then(e=>(i(t),this._decoder==null?Promise.reject(a()):this._decoder.invoke({buffer:e,options:r},t.completeFeatureFromTransfer,t.signal)))}else g=await h(c,e,n.spatialReference,this._createRequestOptions(t)).then(e=>u(e,{maxStringAttributeFields:this.implicitFields,maxStringAttributeLength:S}));if(p&&e.where!==p){let e=await this.controller.schedule(()=>s(p,this.layer.fieldsIndex),t.signal);g.features=await this.controller.schedule(()=>g.features.filter(t=>e.testFeatureCompiled(t)),t.signal)}return g}queryFeatureCount(e,t){return g(this.layer.parsedUrl,e,this._createRequestOptions(t))}destroy(){this._decoder=r(this._decoder)}_createRequestOptions(e){return{...p,...e,query:{...this.layer.customParameters,token:this.layer.apiKey,...e?.query}}}};e([c({constructOnly:!0})],v.prototype,`layer`,void 0),e([c({constructOnly:!0})],v.prototype,`layerView`,void 0),e([c({constructOnly:!0})],v.prototype,`controller`,void 0),e([c({readOnly:!0})],v.prototype,`implicitFields`,null),v=e([l(`esri.views.3d.layers.support.featureTileQuery3D.FeatureTileServiceQuery3D`)],v);let y=class extends t{constructor(e){super(e)}queryFeaturesDehydrated(e,t){return this.layer.queryFeatures(e,t)}};e([c({constructOnly:!0})],y.prototype,`layer`,void 0),y=e([l(`esri.views.3d.layers.support.featureTileQuery3D.FeatureTileOGCServiceQuery3D`)],y);let b=class extends t{constructor(e){super(e)}queryFeaturesDehydrated(e,t){return this.layer.source.queryFeaturesJSON(e,t).then(u,n=>{if(n&&n.name===`query-features-json:unsupported`)return this.layer.queryFeatures(e,t);throw n})}queryFeatureCount(e,t){return this.layer.queryFeatureCount(e,t)}};e([c({constructOnly:!0})],b.prototype,`layer`,void 0),b=e([l(`esri.views.3d.layers.support.featureTileQuery3D.FeatureTileClientQuery3D`)],b);function x(e,t){let{layer:r}=e;switch(r.type){case`feature`:switch(r.source.type){case`feature-layer`:return new v({layer:r,layerView:e,controller:t});case`memory`:return new b({layer:r});case`csv`:case`geojson`:case`oriented-imagery`:case`wfs`:case`ogc-feature`:case`parquet`:break;default:r.source.type}break;case`catalog-footprint`:return new v({layer:r,layerView:e,controller:t});case`csv`:case`geojson`:case`oriented-imagery`:case`wfs`:return new b({layer:r});case`ogc-feature`:return new y({layer:r})}throw new n(`feature-layer:unsupported`,`Unsupported Feature layer type ${e.layer.type}:${e.layer.source.type}`)}const S=1024;export{x as createFeatureTileQuery3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{generateUID as t}from"../../../core/uid.js";import{WorkerHandle as n}from"../../../core/workers/WorkerHandle.js";import r from"../../../geometry/SpatialReference.js";import{
|
|
2
|
+
import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{generateUID as t}from"../../../core/uid.js";import{WorkerHandle as n}from"../../../core/workers/WorkerHandle.js";import r from"../../../geometry/SpatialReference.js";import{completeDehydratedGeometryFromTransfer as i,completeDehydratedFeatureFromTransfer as a}from"../../../layers/graphics/transferFeatures.js";import o from"../../../layers/support/Field.js";class s{constructor(e){this._controller=e,this._abortController=new AbortController,this._handle=new c((t,n)=>e.schedule(t,n))}destroy(){this._abortController.abort(),this._handle.destroy()}async invoke(n,s,c){if(c=AbortSignal.any([c,this._abortController.signal]),e(c),!n.buffer||n.buffer.byteLength===0)return null;n.options.sourceSpatialReference&&n.options.sourceSpatialReference instanceof r&&(n.options={...n.options,sourceSpatialReference:n.options.sourceSpatialReference.toJSON()});let{featureSet:l,coordinates:u,queryGeometry:d,queryCoordinates:f}=await this._handle.invoke(n,c);return await this._controller.scheduleGenerator(function*(e){let n=r.fromJSON(l.spatialReference),c=[];for(let t=0;t<l.fields.length;++t)c.push(o.fromJSON(l.fields[t])),e.madeProgress()&&(e=yield);let p=l.features,m=[],h=s??a;for(let r=0;r<p.length;++r){let i=p[r],a=u[r];h(i,a,n),i.uid=t(),i.centroid&&(i.centroid.spatialReference=n),m.push(i),p[r]=null,u[r]=null,e.madeProgress()&&(e=yield)}return i(d,f,n),Object.assign(l,{spatialReference:n,fields:c,features:m,queryGeometry:d})},c)}}class c extends n{constructor(e){super(`PBFDecoderWorker`,`parseFeatureQuery`,{parseFeatureQuery:e=>[e.buffer]},e)}}export{s as PBFDecoder};
|