@arcgis/core 4.27.2 → 4.27.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/b9979426e3677501fa11.js +1 -0
- package/assets/esri/core/workers/chunks/{b3c42e9ba07217a51911.js → bae9d006fac6a82cfab3.js} +1 -1
- package/assets/esri/core/workers/chunks/{3c3f65913006b84b2289.js → de20572d334abd4a7d82.js} +1 -1
- package/assets/esri/themes/base/widgets/_Feature.scss +3 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/interfaces.d.ts +0 -12
- package/kernel.js +1 -1
- package/layers/support/TileInfoTilemapCache.js +1 -1
- package/package.json +1 -1
- package/rest/places.js +1 -1
- package/rest/support/PlacesQueryResult.js +1 -1
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/FieldInput.js +1 -1
- package/assets/esri/core/workers/chunks/0a86c458916e83d6c523.js +0 -1
package/interfaces.d.ts
CHANGED
|
@@ -53484,12 +53484,6 @@ declare namespace __esri {
|
|
|
53484
53484
|
}
|
|
53485
53485
|
|
|
53486
53486
|
export class PlacesQueryResult extends Accessor {
|
|
53487
|
-
/**
|
|
53488
|
-
* Property indicating whether the query resulted in more than **200** places.
|
|
53489
|
-
*
|
|
53490
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-PlacesQueryResult.html#maxResultsExceeded)
|
|
53491
|
-
*/
|
|
53492
|
-
maxResultsExceeded: boolean;
|
|
53493
53487
|
/**
|
|
53494
53488
|
* The query parameters for the next set of results.
|
|
53495
53489
|
*
|
|
@@ -53520,12 +53514,6 @@ declare namespace __esri {
|
|
|
53520
53514
|
export type PlacesQueryResultConstructor = typeof PlacesQueryResult;
|
|
53521
53515
|
|
|
53522
53516
|
interface PlacesQueryResultProperties {
|
|
53523
|
-
/**
|
|
53524
|
-
* Property indicating whether the query resulted in more than **200** places.
|
|
53525
|
-
*
|
|
53526
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-PlacesQueryResult.html#maxResultsExceeded)
|
|
53527
|
-
*/
|
|
53528
|
-
maxResultsExceeded?: boolean;
|
|
53529
53517
|
/**
|
|
53530
53518
|
* The query parameters for the next set of results.
|
|
53531
53519
|
*
|
package/kernel.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"./core/has.js";import{getInterceptor as t,addQueryParameter as e}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";const a="4.27";let s=a;s="4.27.
|
|
5
|
+
import has from"./core/has.js";import{getInterceptor as t,addQueryParameter as e}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";const a="4.27";let s=a;s="4.27.4";const r={async request(e,a){const{default:s}=await import("./request.js"),r=e.options,n=r.responseType;r.signal=a?.signal,r.responseType="native"===n||"native-request-init"===n?"native-request-init":n&&["blob","json","text"].includes(n)&&t(e.url)?.after?n:"array-buffer";const o=await s(e.url,r),i={data:o.data,httpStatus:o.httpStatus,ssl:o.ssl};switch(o.requestOptions?.responseType){case"native-request-init":return delete i.data.signal,i;case"blob":i.data=await i.data.arrayBuffer();break;case"json":i.data=(new TextEncoder).encode(JSON.stringify(i.data)).buffer;break;case"text":i.data=(new TextEncoder).encode(i.data).buffer}return{result:i,transferList:[i.data]}}};let n;function o(t){n=t}function i(t){const a=n?.findCredential(t);return a?.token?e(t,"token",a.token):t}has("host-webworker");export{i as addTokenParameter,s as fullVersion,n as id,o as setId,a as version,r as workerMessages};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import l from"../../core/Error.js";import{waitTick as t,isAbortError as i}from"../../core/promiseUtils.js";class e{constructor(l,t=0,i=l.lods[l.lods.length-1].level){this.tileInfo=l,this.minLOD=t,this.maxLOD=i,l.lodAt(t)||(this.minLOD=l.lods[0].level),l.lodAt(i)||(this.maxLOD=l.lods[l.lods.length-1].level)}get effectiveMinLOD(){return this.minLOD??this.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.tileInfo.lods[this.tileInfo.lods.length-1].level}getAvailability(l,t,i){const e=this.tileInfo?.lodAt(l);return!e||l<this.minLOD||l>this.maxLOD?"unavailable":e.cols&&e.rows?i>=e.cols[0]&&i<=e.cols[1]&&t>=e.rows[0]&&t<=e.rows[1]?"unknown":"unavailable":"unknown"}async fetchAvailability(i,e,o,s){await t(s);const a=this.getAvailability(i,e,o);if("unavailable"===a)throw new l("tile-map:tile-unavailable","Tile is not available",{level:i,row:e,col:o});return a}async fetchAvailabilityUpsample(l,e,o,s,a){await t(a),s.level=l,s.row=e,s.col=o;const n=this.tileInfo;return n.updateTileInfo(s),this.fetchAvailability(l,e,o,a).catch((l=>{if(i(l))throw l;if(n.upsampleTile(s))return this.fetchAvailabilityUpsample(s.level,s.row,s.col,s,a);throw l}))}}export{e as default};
|
package/package.json
CHANGED
package/rest/places.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../geometry.js";import e from"../request.js";import{ensureClass as t}from"../core/accessorSupport/ensureType.js";import r from"../portal/Portal.js";import{asValidOptions as s,parseUrl as
|
|
5
|
+
import"../geometry.js";import e from"../request.js";import{ensureClass as t}from"../core/accessorSupport/ensureType.js";import r from"../portal/Portal.js";import{asValidOptions as s,parseUrl as o}from"./utils.js";import a from"./support/FetchPlaceParameters.js";import i from"./support/PlacesQueryParameters.js";import n from"./support/PlacesQueryResult.js";import{projectWithEngineOrService as p}from"../views/support/projectionUtils.js";import u from"../geometry/SpatialReference.js";async function m(r,o){r=t(a,r);const i={requestedFields:r.requestedFields?.join(),token:r.apiKey},n=s(i,o),{data:p}=await e(`${r.url}/places/${r.placeId}`,n);return p}async function c(e,s){const o={radius:(e=t(i,e)).radius};let a=e.point;return a&&!a.spatialReference.isWGS84&&(a=await p(a,u.WGS84,r.getDefault(),s?.signal)),a&&(o.x=a.x,o.y=a.y),f(`${e.url}/places/near-point`,o,e,s)}async function l(e,s){const o={};let a=(e=t(i,e)).extent;return a&&!a.spatialReference.isWGS84&&(a=await p(a,u.WGS84,r.getDefault(),s?.signal)),a&&(o.xmin=a.xmin,o.ymin=a.ymin,o.xmax=a.xmax,o.ymax=a.ymax),f(`${e.url}/places/within-extent`,o,e,s)}async function f(t,r,a,i){r={...r,categoryIds:a.categoryIds?.join(),offset:a.offset,pageSize:a.pageSize,searchText:a.searchText,token:a.apiKey};const p=s(r,i),{data:u}=await e(t,p),m=new n;m.results=u.results;const{pagination:c,links:l}=u;if(c?.nextUrl||l?.next){m.nextQueryParams=a.clone();const e=o(c?.nextUrl||l?.next).query;m.nextQueryParams.offset=Number(e.offset)}if(c?.previousUrl||l?.previous){m.previousQueryParams=a.clone();const e=o(c?.previousUrl||l?.previous).query;m.previousQueryParams.offset=Number(e.offset)}return m}export{m as fetchPlace,c as queryPlacesNearPoint,l as queryPlacesWithinExtent};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import{property as
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import t from"./PlaceResult.js";let p=class extends s{constructor(r){super(r),this.nextQueryParams=null,this.previousQueryParams=null,this.results=null}};r([o()],p.prototype,"nextQueryParams",void 0),r([o()],p.prototype,"previousQueryParams",void 0),r([o({type:[t]})],p.prototype,"results",void 0),p=r([e("esri.rest.support.PlacesQueryResult")],p);const c=p;export{c as default};
|
package/support/basemapUtils.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../Basemap.js";import r from"../config.js";import n from"../core/Collection.js";import a from"../core/Logger.js";import{Url as t,makeAbsolute as l,normalize as i}from"../core/urlUtils.js";import{ensureType as s}from"../core/accessorSupport/ensureType.js";import{esriBasemapDefinitions as u}from"./basemapDefinitions.js";const c=a.getLogger("esri.support.basemapUtils");function o(){return{}}function f(e){for(const r in e){const n=e[r];!1===n?.destroyed&&n.destroy(),delete e[r]}}function p(n,a){let t;if("string"==typeof n){if(!(n in u)){const e=Object.entries(u).filter((([e,n])=>r.apiKey&&!n.classic||!r.apiKey&&n.classic&&!n.deprecated)).map((([e])=>`"${e}"`)).join(", ");return c.warn(`Unable to find basemap definition for: ${n}. Try one of these: ${e}`),null}a&&(t=a[n]),t||(t=e.fromId(n),a&&(a[n]=t))}else t=s(e,n);return t?.destroyed&&(c.warn("The provided basemap is already destroyed",{basemap:t}),t=null),t}function y(e){return"Web Scene"===e.portalItem?.type}function m(e,r=null){const n=p(e);if(!n)return null;const a=n.clone();return r&&(a.baseLayers=
|
|
5
|
+
import e from"../Basemap.js";import r from"../config.js";import n from"../core/Collection.js";import a from"../core/Logger.js";import{Url as t,makeAbsolute as l,normalize as i}from"../core/urlUtils.js";import{ensureType as s}from"../core/accessorSupport/ensureType.js";import{esriBasemapDefinitions as u}from"./basemapDefinitions.js";const c=a.getLogger("esri.support.basemapUtils");function o(){return{}}function f(e){for(const r in e){const n=e[r];!1===n?.destroyed&&n.destroy(),delete e[r]}}function p(n,a){let t;if("string"==typeof n){if(!(n in u)){const e=Object.entries(u).filter((([e,n])=>r.apiKey&&!n.classic||!r.apiKey&&n.classic&&!n.deprecated)).map((([e])=>`"${e}"`)).join(", ");return c.warn(`Unable to find basemap definition for: ${n}. Try one of these: ${e}`),null}a&&(t=a[n]),t||(t=e.fromId(n),a&&(a[n]=t))}else t=s(e,n);return t?.destroyed&&(c.warn("The provided basemap is already destroyed",{basemap:t}),t=null),t}function y(e){return"Web Scene"===e.portalItem?.type}function m(e,r){return e.basemap?.referenceLayers?.some((e=>e.uid===r))||e.basemap?.baseLayers?.some((e=>e.uid===r))}function d(e,r=null){const n=p(e);if(!n)return null;const a=n.clone();return r&&(a.baseLayers=g(a.baseLayers,r.baseLayers),a.referenceLayers=g(a.referenceLayers,r.referenceLayers)),a}let b;function L(e){if(b)return b(e);let r=null;const n=w(e),a=!n?.baseLayers.length;for(const t in u){const e=$(n,U(u[t]),{mustMatchReferences:a});if("equal"===e){r=t;break}"base-layers-equal"===e&&(r=t)}return r}function S(e){b=e}function v(e,r){if(e===r)return!0;return"equal"===$(w(e),w(r),{mustMatchReferences:!0})}function g(e,r){const a=new n;return e.forEach((e=>{const n=r.find((r=>A(j(e),j(r))))||e;a.includes(n)?a.push(e):a.push(n)})),a}function h(e){return!!e?.baseLayers.concat(e.referenceLayers).some(R)}function R(e){if(q(e.url))return!0;if("vector-tile"===e.type)for(const r in e.sourceNameToSource){const n=e.sourceNameToSource[r];if(q(n?.sourceUrl))return!0}return!1}function I(e,r){if(null==r||null==e)return{spatialReference:null,updating:!1};if("not-loaded"===r.loadStatus)return r.load(),{spatialReference:null,updating:!0};if(r.spatialReference)return{spatialReference:r.spatialReference,updating:!1};if(0===r.baseLayers.length)return{spatialReference:null,updating:!1};const n=r.baseLayers.at(0);switch(n.loadStatus){case"not-loaded":n.load();case"loading":return{spatialReference:null,updating:!0};case"failed":return{spatialReference:null,updating:!1}}const a=(("supportedSpatialReferences"in n?n.supportedSpatialReferences:null)||["tileInfo"in n?n.tileInfo?.spatialReference:n.spatialReference]).filter(Boolean),t=e.spatialReference;return t?{spatialReference:a.find((e=>t.equals(e)))??a[0]??null,updating:!1}:{spatialReference:a[0],updating:!1}}const T=/^(basemaps|ibasemaps).*-api\.arcgis\.com$/i;function q(e){if(!e)return!1;const r=new t(l(e));return!!r.authority&&T.test(r.authority)}function w(e){return e?!e.loaded&&e.resourceInfo?U(e.resourceInfo.data):{baseLayers:x(e.baseLayers),referenceLayers:x(e.referenceLayers)}:null}function x(e){return(n.isCollection(e)?e.toArray():e).map(j)}function j(e){return{type:e.type,url:B("urlTemplate"in e&&e.urlTemplate||e.url||"styleUrl"in e&&e.styleUrl||""),minScale:"minScale"in e&&null!=e.minScale?e.minScale:0,maxScale:"maxScale"in e&&null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visible||!!e.visible,sublayers:"map-image"!==e.type&&"wms"!==e.type||null==e.sublayers?void 0:e.sublayers?.map((e=>({id:e.id,visible:e.visible}))),activeLayerId:"wmts"===e.type?e.activeLayer?.id:void 0}}function U(e){return e?{baseLayers:M((e.baseMapLayers??[]).filter((e=>!e.isReference))),referenceLayers:M((e.baseMapLayers??[]).filter((e=>e.isReference)))}:null}function M(e){return e.map((e=>k(e)))}function k(e){let r;switch(e.layerType){case"VectorTileLayer":r="vector-tile";break;case"ArcGISTiledMapServiceLayer":r="tile";break;default:r="unknown"}return{type:r,url:B(e.templateUrl||e.urlTemplate||e.styleUrl||e.url),minScale:null!=e.minScale?e.minScale:0,maxScale:null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visibility||!!e.visibility,sublayers:void 0,activeLayerId:void 0}}function $(e,r,n){if(null!=e!=(null!=r))return"not-equal";if(!e||!r)return"equal";if(!C(e.baseLayers,r.baseLayers))return"not-equal";return C(e.referenceLayers,r.referenceLayers)?"equal":n.mustMatchReferences?"not-equal":"base-layers-equal"}function C(e,r){if(e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(!A(e[n],r[n]))return!1;return!0}function A(e,r){if(e.type!==r.type||"scene"===e.type||e.url!==r.url||e.minScale!==r.minScale||e.maxScale!==r.maxScale||e.visible!==r.visible||e.opacity!==r.opacity)return!1;if(null!=e.activeLayerId||null!=r.activeLayerId)return e.activeLayerId===r.activeLayerId;if(null!=e.sublayers||null!=r.sublayers){if(null==e.sublayers||null==r.sublayers||e.sublayers.length!==r.sublayers.length)return!1;for(let n=0;n<e.sublayers.length;n++){const a=e.sublayers.at(n),t=r.sublayers.at(n);if(a?.id!==t?.id||a?.visible!==t?.visible)return!1}}return!0}function B(e){return e?i(e).replace(/^\s*https?:/i,"").toLowerCase():""}export{d as clonePreservingTiledLayers,v as contentEquals,o as createCache,f as destroyCache,p as ensureType,I as findSpatialReference,L as getWellKnownBasemapId,h as hasDeveloperBasemapLayer,y as isBasemap3D,m as isBasemapLayer,R as isDeveloperBasemapLayer,S as overrideGetWellKnownBasemapId};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const a="20230622",c="b70a0c92a2665fa713efc11a4c3dd3ae40775cee";export{a as buildDate,c as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../Color.js";import{getFontFamily as t}from"../../core/fontUtils.js";import{clone as i}from"../../core/lang.js";import r from"../../core/Logger.js";import{pt2px as o,px2pt as n}from"../../core/screenUtils.js";import{numericHash as a}from"../../core/string.js";import{createRendererExpression as s,ArcadeExpression as l}from"../../support/arcadeOnDemand.js";import{DEFAULT_PICTURE_FILL_HEIGHT as c,DEFAULT_HATCH_FILL_SEPARATION as m,DEFAULT_STROKE_WIDTH as f,DEFAULT_MARKER_SIZE as h,DEFAULT_TEXT_HEIGHT as p}from"./CIMSymbolDrawHelper.js";import{CIMSymbolHelper as u,OverrideHelper as y}from"./CIMSymbolHelper.js";import{Alignment as d,CapType as v,JoinType as _}from"./enums.js";import{quantizeIfNeeded as O}from"./quantizeTime.js";import{getExtent as S,getSDFMetrics as g}from"./SDFHelper.js";import{fromCIMColor as M,getTintColor as k,getValue as b,getFillColor as N,getStrokeColor as P,getStrokeWidth as z,isFeatureValueFn as L,fromCIMFontDecoration as C,fromCIMFontStyle as F,adjustTextCase as I,createLabelOverrideFunction as w,evaluateValueOrFunction as x,fromCIMHorizontalAlignment as A,fromCIMVerticalAlignment as R}from"./utils.js";import{CIMEffectHelper as X}from"./effects/CIMEffectHelper.js";import H from"../../views/2d/arcade/callExpressionWithFeature.js";import{RANDOM_INSIDE_POLYGON_TEXTURE_SIZE as J}from"../../views/2d/engine/webgl/definitions.js";import{getMaterialGroup as Y}from"../../views/2d/engine/webgl/grouping.js";const E=r.getLogger("esri.symbols.cim.cimAnalyzer");function T(e){switch(e){case"Butt":return v.BUTT;case"Square":return v.SQUARE;default:return v.ROUND}}function $(e){switch(e){case"Bevel":return _.BEVEL;case"Miter":return _.MITER;default:return _.ROUND}}function j(e){const t=e.markerPlacement;return t&&t.angleToLine?d.MAP:d.SCREEN}class G{constructor(e,t){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._resourceManager=e,this._info=t}async analyzeSymbolReference(e,t,i){if(this._cimLayers=i??[],!e)return this._cimLayers;if(e.primitiveOverrides){this._primitiveOverrides=e.primitiveOverrides,this._poMap={};const t=[],i=this._info;for(const e of this._primitiveOverrides){const r=e.valueExpressionInfo;if(r&&i){const o=r.expression,n=s(o,i.spatialReference,i.fields).then((t=>{null!=t&&this._setPoMap(e.primitiveName,e.propertyName,t)}));t.push(n)}else null!=e.value&&this._setPoMap(e.primitiveName,e.propertyName,e.value);t.length>0&&await Promise.all(t)}}const r=e.symbol,o=[];return u.fetchResources(r,this._resourceManager,o),o.length>0&&await Promise.all(o),this._analyzeSymbol(r,t),this._cimLayers}_analyzeSymbol(e,t){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,t,1,0,0,0)}}_analyzeMultiLayerSymbol(e,t,i,r,o,n){const a=e?.symbolLayers;if(!a)return;const s=e.effects;let l=d.SCREEN;const c=u.getSize(e)??0;"CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(l=d.MAP);const m="CIMPolygonSymbol"===e.type;let f=a.length;for(;f--;){const h=a[f];if(!h||!1===h.enable)continue;let p;s&&s.length&&(p=[...s]);const u=h.effects;u&&u.length&&(s?p.push(...u):p=[...u]);const d=[];let v;y.findEffectOverrides(p,this._primitiveOverrides,d),v=d.length>0?this._createEffectsOverrideFunction(p,d):p;const _=[];switch(y.findApplicableOverrides(h,this._primitiveOverrides,_),h.type){case"CIMSolidFill":this._analyzeSolidFill(h,v);break;case"CIMPictureFill":this._analyzePictureFill(h,v);break;case"CIMHatchFill":this._analyzeHatchFill(h,v);break;case"CIMGradientFill":this._analyzeGradientFill(h,v);break;case"CIMSolidStroke":this._analyzeSolidStroke(h,v,m,c);break;case"CIMPictureStroke":this._analyzePictureStroke(h,v,m,c);break;case"CIMGradientStroke":this._analyzeGradientStroke(h,v,m,c);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"===e.type&&(l=j(h));const a=[],s=h.primitiveName;s&&a.push(s),this._analyzeMarker(h,v,null,a,l,c,1,t,i,r,o,n);break}default:E.error("Cannot analyze CIM layer",h.type)}}}_analyzeSolidFill(e,t){const i=e.primitiveName,r=M(e.color),[o,n]=this._analyzePrimitiveOverrides(i,t,null,null),s=a(JSON.stringify(e)+n).toString();this._cimLayers.push({type:"fill",templateHash:s,materialHash:o?()=>s:s,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked,color:this._createOverrideFunction(i,"Color",r,U),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:t,applyRandomOffset:!1,sampleAlphaOnly:!0})}_analyzePictureFill(e,t){const i=e.primitiveName,r=k(e),[o,n]=this._analyzePrimitiveOverrides(i,t,null,null),s=a(JSON.stringify(e)+n).toString(),l=a(`${e.url}${JSON.stringify(e.colorSubstitutions)}`).toString(),m=b(e.height,c);let f=b(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const t=e.width;let i=1;const r=this._resourceManager.getResource(e.url);null!=r&&(i=r.width/r.height),f/=i*(m/t)}this._cimLayers.push({type:"fill",templateHash:s,materialHash:o?()=>l:l,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked,effects:t,color:this._createOverrideFunction(i,"TintColor",r,U),height:this._createOverrideFunction(i,"Height",m),scaleX:this._createOverrideFunction(i,"ScaleX",f),angle:this._createOverrideFunction(i,"Rotation",b(e.rotation)),offsetX:this._createOverrideFunction(i,"OffsetX",b(e.offsetX)),offsetY:this._createOverrideFunction(i,"OffsetY",b(e.offsetY)),url:e.url,applyRandomOffset:!1,sampleAlphaOnly:!1})}_analyzeHatchFill(e,t){const i=e.primitiveName,r=this._analyzeMaterialOverrides(i,["Rotation","OffsetX","OffsetY"]);let[o,n]=this._analyzePrimitiveOverrides(i,t,null,null);const s=a(JSON.stringify(e)+n).toString(),l=a(`${e.separation}${JSON.stringify(e.lineSymbol)}`).toString();let c={r:255,g:255,b:255,a:1},f=!1;const h=e.lineSymbol?.symbolLayers?.find((e=>"CIMSolidStroke"===e.type&&null!=this._poMap[e.primitiveName]?.Color));if(h){c=M(h.color),c=this._createOverrideFunction(h.primitiveName,"Color",c,U);const e="function"==typeof c;o=o||e,f=null!=h.color||e}this._cimLayers.push({type:"fill",templateHash:s,materialHash:o&&r?this._createMaterialHashFunction(l,r):l,cim:e,materialOverrides:r,colorLocked:!!e.colorLocked,effects:t,color:c,height:this._createOverrideFunction(i,"Separation",b(e.separation,m)),scaleX:1,angle:this._createOverrideFunction(i,"Rotation",b(e.rotation)),offsetX:this._createOverrideFunction(i,"OffsetX",b(e.offsetX)),offsetY:this._createOverrideFunction(i,"OffsetY",b(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!f})}_analyzeGradientFill(e,t){const i=e.primitiveName,[r,o]=this._analyzePrimitiveOverrides(i,t,null,null),n=a(JSON.stringify(e)+o).toString();this._cimLayers.push({type:"fill",templateHash:n,materialHash:r?()=>n:n,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked,effects:t,color:{r:128,g:128,b:128,a:1},height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,applyRandomOffset:!1,sampleAlphaOnly:!1})}_analyzeSolidStroke(e,t,i,r){const o=e.primitiveName,n=M(e.color),s=b(e.width,f),l=T(e.capStyle),c=$(e.joinStyle),m=e.miterLimit,[h,p]=this._analyzePrimitiveOverrides(o,t,null,null),u=a(JSON.stringify(e)+p).toString();let y,d;if(t&&t instanceof Array&&t.length>0){const e=t[t.length-1];if("CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&null===e.offsetAlongLine){const e=(t=[...t]).pop();y=e.dashTemplate,d=e.scaleDash}}this._cimLayers.push({type:"line",templateHash:u,materialHash:h?()=>u:u,cim:e,materialOverrides:null,isOutline:i,colorLocked:!!e.colorLocked,effects:t,color:this._createOverrideFunction(o,"Color",n,U),width:this._createOverrideFunction(o,"Width",s),cap:this._createOverrideFunction(o,"CapStyle",l),join:this._createOverrideFunction(o,"JoinStyle",c),miterLimit:m&&this._createOverrideFunction(o,"MiterLimit",m),referenceWidth:r,zOrder:D(e.name),dashTemplate:y,scaleDash:d,sampleAlphaOnly:!0})}_analyzePictureStroke(e,t,i,r){const o=a(`${e.url}${JSON.stringify(e.colorSubstitutions)}`).toString(),n=e.primitiveName,s=k(e),l=b(e.width,f),c=T(e.capStyle),m=$(e.joinStyle),h=e.miterLimit,[p,u]=this._analyzePrimitiveOverrides(n,t,null,null),y=a(JSON.stringify(e)+u).toString();this._cimLayers.push({type:"line",templateHash:y,materialHash:p?()=>o:o,cim:e,materialOverrides:null,isOutline:i,colorLocked:!!e.colorLocked,effects:t,color:this._createOverrideFunction(n,"TintColor",s,U),width:this._createOverrideFunction(n,"Width",l),cap:this._createOverrideFunction(n,"CapStyle",c),join:this._createOverrideFunction(n,"JoinStyle",m),miterLimit:h&&this._createOverrideFunction(n,"MiterLimit",h),referenceWidth:r,zOrder:D(e.name),dashTemplate:null,scaleDash:!1,url:e.url,sampleAlphaOnly:!1})}_analyzeGradientStroke(e,t,i,r){const o=e.primitiveName,n=b(e.width,f),s=T(e.capStyle),l=$(e.joinStyle),c=e.miterLimit,[m,h]=this._analyzePrimitiveOverrides(o,t,null,null),p=a(JSON.stringify(e)+h).toString();this._cimLayers.push({type:"line",templateHash:p,materialHash:m?()=>p:p,cim:e,materialOverrides:null,isOutline:i,colorLocked:!!e.colorLocked,effects:t,color:{r:128,g:128,b:128,a:1},width:this._createOverrideFunction(o,"Width",n),cap:this._createOverrideFunction(o,"CapStyle",s),join:this._createOverrideFunction(o,"JoinStyle",l),miterLimit:c&&this._createOverrideFunction(o,"MiterLimit",c),referenceWidth:r,zOrder:D(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeMarker(e,t,i,r,o,n,a,s,l,c,m,f,p=!1){if(this._analyzeMarkerInsidePolygon(e,t))return;const u=b(e.size,h),y=b(e.rotation),d=b(e.offsetX),v=b(e.offsetY);let _=this._createOverrideFunction(e.primitiveName,"Size",u),O=this._createOverrideFunction(e.primitiveName,"Rotation",y),S=this._createOverrideFunction(e.primitiveName,"OffsetX",d),g=this._createOverrideFunction(e.primitiveName,"OffsetY",v);_=this._transformSize(_,a),O=this._transformRotation(O,!!e.rotateClockwise,c);const M=this._transformOffsetX(S,g,c,a,m),k=this._transformOffsetY(S,g,c,a,f);switch(S=M,g=k,e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,t,i,r,o,n,_,O,S,g,e.colorLocked||p);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,t,i,r,o,n,a,s,_,O,S,g,e.colorLocked||p)}}_analyzeMarkerInsidePolygon(e,t){const{markerPlacement:i,type:r}=e;if(!i||"CIMMarkerPlacementInsidePolygon"!==i.type)return!1;if("CIMVectorMarker"===r||"CIMPictureMarker"===r){const o=e.primitiveName;if(o){const[e,i]=this._analyzePrimitiveOverrides([o],t,null,null);if(e)return!1}const n=i.primitiveName;if(n){const[e,i]=this._analyzePrimitiveOverrides([n],t,null,null);if(e)return!1}if("CIMVectorMarker"===r){const{markerGraphics:t}=e;if(t)for(const e of t){const{symbol:t}=e;if("CIMPolygonSymbol"===t?.type&&t.symbolLayers){const{symbolLayers:e}=t;for(const t of e)if("CIMSolidStroke"===t.type)return!1}}}else{const{animatedSymbolProperties:t}=e;if(t)return!1}}const o=i,s=Math.abs(o.stepX),l=Math.abs(o.stepY);if(0===s||0===l)return!0;const c=["Rotation","OffsetX","OffsetY"],m=this._primitiveOverrides.filter((t=>t.primitiveName!==e.primitiveName||!c.includes(t.propertyName))),f="url"in e&&"string"==typeof e.url?e.url:void 0,h=a(JSON.stringify(e)).toString();let p,u,y=null;if("Random"===i.gridType){const e=n(J),t=Math.max(Math.floor(e/s),1),i=Math.max(Math.floor(e/l),1);p=l*i,y=e=>e?e*i:0;u=t*s/p}else i.shiftOddRows?(p=2*l,y=e=>e?2*e:0,u=s/l*.5):(p=l,y=null,u=s/l);const d=k(e);return this._cimLayers.push({type:"fill",templateHash:h,materialHash:h,cim:e,materialOverrides:m,colorLocked:!!e.colorLocked,effects:t,color:d,height:this._createOverrideFunction(o.primitiveName,"StepY",p,y),scaleX:u,angle:o.gridAngle,offsetX:b(o.offsetX),offsetY:b(o.offsetY),url:f,applyRandomOffset:"Random"===i.gridType,sampleAlphaOnly:!f,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(e,t,i,r,o,n,s,l,c,m,f){let h=b(e.scaleX,1);const p=k(e),u=a(`${e.url}${JSON.stringify(e.colorSubstitutions)}${JSON.stringify(e.animatedSymbolProperties)}`).toString();i||(i=this._createMarkerPlacementOverrideFunction(e.markerPlacement));const y=this._createAnimatedSymbolPropertiesOverrideFunction(e.animatedSymbolProperties),[d,v]=this._analyzePrimitiveOverrides(r,t,i,y),_=a(JSON.stringify(e)+v).toString(),O=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const t=e.width;let i=1;const r=this._resourceManager.getResource(e.url);null!=r&&(i=r.width/r.height);h/=i*(b(e.size)/t)}function S(e,t){return null!=y?x(y,e,t):null}const g=e.animatedSymbolProperties&&!0===e.animatedSymbolProperties.randomizeStartTime?(e,t,i,r)=>{const o=Y(r??0),n=S(e,t);return u+`-MATERIALGROUP(${o})`+`-ASP(${JSON.stringify(n)})`}:d?(e,t)=>{const i=S(e,t);return u+`-ASP(${JSON.stringify(i)})`}:u;this._cimLayers.push({type:"marker",templateHash:_,materialHash:g,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked||!!f,effects:t,scaleSymbolsProportionally:!1,alignment:o,size:s,scaleX:this._createOverrideFunction(e.primitiveName,"ScaleX",h),rotation:l,offsetX:c,offsetY:m,color:this._createOverrideFunction(e.primitiveName,"TintColor",p,U),anchorPoint:{x:O.x,y:O.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:{r:0,g:0,b:0,a:0},outlineWidth:0,frameHeight:0,rotateClockwise:!1,referenceSize:n,sizeRatio:1,markerPlacement:i,url:e.url,animatedSymbolProperties:y})}_analyzeVectorMarker(e,t,i,r,o,n,a,s,l,c,m,f,h){const p=e.markerGraphics;if(!p)return;let u,y=0,d=1;e.scaleSymbolsProportionally&&(u=e.frame,u&&(y=u.ymax-u.ymin,d=this._transformSize(l,1/y))),d=this._transformSize(d,a),i||(i=this._createMarkerPlacementOverrideFunction(e.markerPlacement));for(const v of p)if(v){const a=v.symbol;if(!a)continue;const p=v.primitiveName;p&&r.push(p);let _=m,O=f;if(("CIMPointSymbol"===a.type||"CIMTextSymbol"===a.type)&&u){let t=0,i=0;const r=v.geometry;"x"in r&&"y"in r&&(t+=r.x-.5*(u.xmin+u.xmax),i+=r.y-.5*(u.ymin+u.ymax));const o=e.anchorPoint;o&&("Absolute"===e.anchorPointUnits?(t-=o.x,i-=o.y):u&&(t-=(u.xmax-u.xmin)*o.x,i-=(u.ymax-u.ymin)*o.y)),_=this._transformOffsetX(t,i,c,d,m),O=this._transformOffsetY(t,i,c,d,f)}switch(a.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":s?this._analyzeMultiLayerGraphicNonSDF(e,t,i,null,v,r,o,n,y,!!h||!!e.colorLocked):this._analyzeMultiLayerGraphic(e,t,i,null,v,r,o,n,y,d,l,c,_,O,!!h||!!e.colorLocked);break;case"CIMTextSymbol":this._analyzeTextGraphic(e,t,i,v,r,o,n,y,d,l,c,_,O,h)}p&&r.pop()}}_analyzeMultiLayerGraphic(e,t,i,r,o,n,s,l,c,m,f,h,p,u,y){const d=o.symbol,v=d.symbolLayers;if(!v)return;let _=v.length;if(B(v))return void this._analyzeCompositeMarkerGraphic(e,t,i,r,o,v,n,s,l,c,f,h,p,u,!!y||!!e.colorLocked);const O=this._resourceManager.geometryEngine,k=X.applyEffects(d.effects,o.geometry,O);if(k)for(;_--;){const d=v[_];if(!d||!1===d.enable)continue;const b=d.primitiveName;switch(b&&n.push(b),d.type){case"CIMSolidFill":case"CIMSolidStroke":{const m=X.applyEffects(d.effects,k,O),v=S(m);if(!v)continue;const _="Relative"!==e.anchorPointUnits,[C,F,I]=g(v,e.frame,e.size,e.anchorPoint,_),w="CIMSolidFill"===d.type,x={type:"sdf",geom:m,asFill:w},A=d.path,R=M(w?N(d):P(d)),H=w?{r:0,g:0,b:0,a:0}:M(P(d)),J=z(d)??0;if(!w&&!J)break;const Y=o.primitiveName;let E=null;!w||d.colorLocked||y||(E=this._createOverrideFunction(Y,"FillColor",R,U));let T=null;d.colorLocked||y||(T=this._createOverrideFunction(Y,"StrokeColor",H,U));const $=this._createOverrideFunction(Y,"StrokeWidth",J);let j=!1,G="";for(const e of this._primitiveOverrides)n.includes(e.primitiveName)&&(null!=e.value?G+=`-${e.primitiveName}-${e.propertyName}-${JSON.stringify(e.value)}`:e.valueExpressionInfo&&(j=!0));(null!=t&&"function"==typeof t||null!=i&&"function"==typeof i)&&(j=!0),(L(f)||L(h)||L(p)||L(u))&&(j=!0);const D=JSON.stringify({...e,markerGraphics:null}),W=a(JSON.stringify(x)+A).toString(),V=a(JSON.stringify(o)+JSON.stringify(d)+D+G).toString();this._cimLayers.push({type:"marker",templateHash:V,materialHash:j?()=>W:W,cim:x,materialOverrides:null,colorLocked:!!d.colorLocked||!!y,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:F,y:I},isAbsoluteAnchorPoint:_,size:f,rotation:h,offsetX:p,offsetY:u,scaleX:1,frameHeight:c,rotateClockwise:!1,referenceSize:l,sizeRatio:C,color:L(E)?E:this._createOverrideFunction(b,"Color",R,U),outlineColor:L(T)?T:this._createOverrideFunction(b,"Color",H,U),outlineWidth:L($)?$:this._createOverrideFunction(b,"Width",J),markerPlacement:i,animatedSymbolProperties:r,path:A});break}case"CIMVectorMarker":d.markerPlacement?this._analyzeMultiLayerGraphicNonSDF(e,t,i,r,o,n,s,l,c,!!y||!!d.colorLocked):this._analyzeMarker(d,t,i,n,s,l,m,!1,f,h,p,u,!!y||!!e.colorLocked);break;default:this._analyzeMultiLayerGraphicNonSDF(e,t,i,r,o,n,s,l,c,!!y||!!e.colorLocked)}b&&n.pop()}}_analyzeTextGraphic(e,i,r,o,n,s,l,c,m,h,u,d,v,_){const O=[];y.findApplicableOverrides(o,this._primitiveOverrides,O);const S=o.geometry;if(!("x"in S)||!("y"in S))return;const g=o.symbol,k=C(g),L=F(g.fontStyleName),X=t(g.fontFamilyName);g.font={family:X,decoration:k,...L};let H=b(g.height,p),J=b(g.angle),Y=b(g.offsetX),E=b(g.offsetY);H=this._transformSize(H,m),J=this._transformRotation(J,!1,u);const T=this._transformOffsetX(Y,E,u,m,d),$=this._transformOffsetY(Y,E,u,m,v);Y=T,E=$;const j=M(N(g));let G=M(P(g)),D=z(g)??0;D||(G=M(N(g.haloSymbol)),D=b(g.haloSize)),D=this._transformSize(D,m);let U=null,W=null,V=0;if(g.callout&&"CIMBackgroundCallout"===g.callout.type){const e=g.callout;if(e.backgroundSymbol){const t=e.backgroundSymbol.symbolLayers;if(t)for(const e of t)"CIMSolidFill"===e.type?U=M(e.color):"CIMSolidStroke"===e.type&&(W=M(e.color),V=b(e.width,f))}}const[B,q]=this._analyzePrimitiveOverrides(n,i,r,null),K=JSON.stringify(e.effects)+Number(e.colorLocked||_).toString()+JSON.stringify(e.anchorPoint)+e.anchorPointUnits+JSON.stringify(e.markerPlacement)+e.size.toString(),Q=a(JSON.stringify(o)+K+q).toString();let Z=this._createOverrideFunction(o.primitiveName,"TextString",o.textString??"",I,g.textCase);if(null==Z)return;const{fontStyleName:ee}=g,te=X+(ee?"-"+ee.toLowerCase():"-regular"),ie=te;"string"==typeof Z&&Z.includes("[")&&g.fieldMap&&(Z=w(g.fieldMap,Z,g.textCase)),this._cimLayers.push({type:"text",templateHash:Q,materialHash:B||"function"==typeof Z||/\[(.*?)\]/.test(Z)?(e,t,i)=>ie+"-"+x(Z,e,t,i):ie+"-"+a(Z),cim:g,materialOverrides:null,colorLocked:!!e.colorLocked||!!_,effects:i,alignment:s,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,fontName:te,decoration:k,weight:L.weight,style:L.style,size:H,angle:J,offsetX:Y,offsetY:E,horizontalAlignment:A(g.horizontalAlignment),verticalAlignment:R(g.verticalAlignment),text:Z,color:j,outlineColor:G,outlineSize:D,backgroundColor:U,borderLineColor:W,borderLineWidth:V,referenceSize:l,sizeRatio:1,markerPlacement:r})}_analyzeMultiLayerGraphicNonSDF(e,t,i,r,n,s,l,c,m,f){const p=this._buildSimpleMarker(e,n),y=e.primitiveName,d=this._analyzeMaterialOverrides(y,["Rotation","OffsetX","OffsetY"]),[v,_]=this._analyzePrimitiveOverrides(s,null,null,null),[O,S,g]=u.getTextureAnchor(p,this._resourceManager),M=b(e.rotation),k=b(e.offsetX),N=b(e.offsetY),P=a(JSON.stringify(p)+_).toString(),z=d&&d.length>0||null!=t&&"function"==typeof t;this._cimLayers.push({type:"marker",templateHash:P,materialHash:z&&d?this._createMaterialHashFunction(P,d):P,cim:p,materialOverrides:d,colorLocked:!!e.colorLocked||!!f,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:l,anchorPoint:{x:O,y:S},isAbsoluteAnchorPoint:!1,size:b(e.size,h),rotation:this._createOverrideFunction(y,"Rotation",M),offsetX:this._createOverrideFunction(y,"OffsetX",k),offsetY:this._createOverrideFunction(y,"OffsetY",N),color:{r:255,g:255,b:255,a:1},outlineColor:{r:0,g:0,b:0,a:0},outlineWidth:0,scaleX:1,frameHeight:m,rotateClockwise:!!e.rotateClockwise,referenceSize:c,sizeRatio:g/o(e.size),markerPlacement:i,animatedSymbolProperties:r,avoidSDFRasterization:!0})}_buildSimpleMarker(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}}_analyzeCompositeMarkerGraphic(e,t,i,r,o,n,s,l,c,m,h,p,u,y,d){const v=o.geometry,_=n[0],O=n[1],k=S(v);if(!k)return;const N="Relative"!==e.anchorPointUnits,[P,z,C]=g(k,e.frame,e.size,e.anchorPoint,N),F={type:"sdf",geom:v,asFill:!0},I=O.path,w=O.primitiveName,x=_.primitiveName,A=M(O.color),R=M(_.color),X=b(_.width,f),H=o.primitiveName;let J=null;O.colorLocked||d||(J=this._createOverrideFunction(H,"FillColor",A,U));let Y=null;_.colorLocked||d||(Y=this._createOverrideFunction(H,"StrokeColor",R,U));const E=this._createOverrideFunction(H,"StrokeWidth",X);let T=!1,$="";for(const a of this._primitiveOverrides)(a.primitiveName===w||a.primitiveName===x||s.includes(a.primitiveName))&&(null!=a.value?$+=`-${a.primitiveName}-${a.propertyName}-${JSON.stringify(a.value)}`:a.valueExpressionInfo&&(T=!0));null!=i&&"function"==typeof i&&(T=!0),(L(h)||L(p)||L(u)||L(y))&&(T=!0);const j=JSON.stringify({...e,markerGraphics:null}),G=a(JSON.stringify(F)+I).toString(),D=a(JSON.stringify(o)+JSON.stringify(O)+JSON.stringify(_)+j+$).toString();this._cimLayers.push({type:"marker",templateHash:D,materialHash:T?()=>G:G,cim:F,materialOverrides:null,colorLocked:!!d,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:l,anchorPoint:{x:z,y:C},isAbsoluteAnchorPoint:N,size:h,rotation:p,offsetX:u,offsetY:y,scaleX:1,frameHeight:m,rotateClockwise:!1,referenceSize:c,sizeRatio:P,color:L(J)?J:this._createOverrideFunction(w,"Color",A,U),outlineColor:L(Y)?Y:this._createOverrideFunction(x,"Color",R,U),outlineWidth:L(E)?E:this._createOverrideFunction(x,"Width",X),markerPlacement:i,path:I,animatedSymbolProperties:r})}_createMaterialHashFunction(e,t){const i=this._info?.geometryType;if(i){const e=this._poMap;for(const r of t){if(r.valueExpressionInfo){const t=e[r.primitiveName]&&e[r.primitiveName][r.propertyName];t instanceof l&&(r.fn=(e,r,o)=>H(t,e,{$view:o},i,r))}}}return(i,r,o)=>{for(const e of t)e.fn&&(e.value=e.fn(i,r,o));return a(e+y.buildOverrideKey(t)).toString()}}_setPoMap(e,t,i){let r;this._poMap[e]?r=this._poMap[e]:(r={},this._poMap[e]=r),r[t]=i}_createOverrideFunction(e,t,i,r,o){if(null==e)return i;const n=this._poMap[e];if(null==n)return i;const a=n[t];if("string"==typeof a||"number"==typeof a||a instanceof Array)return r?r.call(null,a,o):a;const s=this._info?.geometryType;return null!=a&&a instanceof l&&null!=s?(e,t,n)=>{let l=H(a,e,{$view:n},s,t);return null!==l&&r&&(l=r.call(null,l,o)),null!==l?l:i}:i}_createEffectsOverrideFunction(e,t){const r=this._poMap,o=this._info?.geometryType;for(const i of t){if(i.valueExpressionInfo&&o){const e=r[i.primitiveName]&&r[i.primitiveName][i.propertyName];e instanceof l&&(i.fn=(t,i,r)=>H(e,t,{$view:r},o,i))}}return(r,o,n)=>{for(const e of t)e.fn&&(e.value=e.fn(r,o,n));const a=[];for(let s of e){const e=s?.primitiveName;if(e){let r=!1;for(const o of t)if(o.primitiveName===e){const e=W(o.propertyName);null!=o.value&&o.value!==s[e]&&(r||(s=i(s),r=!0),s[e]=o.value)}}a.push(s)}return a}}_createMarkerPlacementOverrideFunction(e){const t=[];if(y.findApplicableOverrides(e,this._primitiveOverrides,t),null==e||0===t.length)return e;const r=this._poMap,o=this._info?.geometryType;for(const i of t){if(i.valueExpressionInfo&&o){const e=r[i.primitiveName]&&r[i.primitiveName][i.propertyName];e instanceof l&&(i.fn=(t,i,r)=>H(e,t,{$view:r},o,i))}}return(r,o,n)=>{for(const e of t)e.fn&&(e.value=e.fn(r,o,n));const a=i(e),s=e.primitiveName;for(const e of t)if(e.primitiveName===s){const t=W(e.propertyName);null!=e.value&&e.value!==a[t]&&(a[t]=e.value)}return a}}_createAnimatedSymbolPropertiesOverrideFunction(e){const t=[];if(y.findApplicableOverrides(e,this._primitiveOverrides,t),null==e||0===t.length)return e;const r=this._info?.geometryType;if(r){const e=this._poMap;for(const i of t){if(i.valueExpressionInfo){const t=e[i.primitiveName]&&e[i.primitiveName][i.propertyName];t instanceof l&&(i.fn=(e,i,o)=>H(t,e,{$view:o},r,i))}}}return(r,o,n)=>{for(const e of t)e.fn&&(e.value=e.fn(r,o,n));const a=i(e),s=e.primitiveName;for(const e of t)if(e.primitiveName===s){const t=W(e.propertyName);if(null!=e.value){const i=O(e.value,e.propertyName);i!==a[t]&&(a[t]=i)}}return a}}_analyzePrimitiveOverrides(e,t,i,r){let o=!1,n="";"string"==typeof e&&(e=[e]);for(const a of this._primitiveOverrides)e?.includes(a.primitiveName)&&(null!=a.value?n+=`-${a.primitiveName}-${a.propertyName}-${JSON.stringify(a.value)}`:a.valueExpressionInfo&&(o=!0));return null!=t&&"function"==typeof t&&(o=!0),null!=i&&"function"==typeof i&&(o=!0),null!=r&&"function"==typeof r&&(o=!0),[o,n]}_analyzeMaterialOverrides(e,t){return this._primitiveOverrides.filter((i=>i.primitiveName!==e||!t.includes(i.propertyName)))}_transformSize(e,t){return L(e)||L(t)?(i,r,o)=>(L(e)?e(i,r,o):e)*(L(t)?t(i,r,o):t):e*t}_transformRotation(e,t,i){return L(e)||L(i)?(r,o,n)=>{const a=L(e)?e(r,o,n):e,s=L(i)?i(r,o,n):i;return t?s-a:s+a}:t?i-e:i+e}_transformOffsetX(e,t,i,r,o){if(!(L(e)||L(t)||L(i)||L(r)||L(o))){const n=i*Math.PI/180;if(n){const i=Math.cos(n),a=Math.sin(n);return(i*e-a*t)*r+o}return e*r+o}return(n,a,s)=>{let l=L(i)?i(n,a,s):i;const c=L(r)?r(n,a,s):r,m=L(e)?e(n,a,s):e,f=L(o)?o(n,a,s):o;if(l){l*=Math.PI/180;return(Math.cos(l)*m-Math.sin(l)*(L(t)?t(n,a,s):t))*c+f}return m*c+f}}_transformOffsetY(e,t,i,r,o){if(!(L(e)||L(t)||L(i)||L(r)||L(o))){const n=i*Math.PI/180;if(n){const i=Math.cos(n);return(Math.sin(n)*e+i*t)*r+o}return t*r+o}return(n,a,s)=>{let l=L(i)?i(n,a,s):i;const c=L(r)?r(n,a,s):r,m=L(t)?t(n,a,s):t,f=L(o)?o(n,a,s):o;if(l){l*=Math.PI/180;const t=Math.cos(l);return(Math.sin(l)*(L(e)?e(n,a,s):e)+t*m)*c+f}return m*c+f}}}function D(e){if(e&&0===e.indexOf("Level_")){const t=parseInt(e.substr(6),10);if(!isNaN(t))return t}return 0}function U(t){if(!t||0===t.length)return null;const i=new e(t).toRgba();return{r:i[0],g:i[1],b:i[2],a:i[3]}}function W(e){return e?e.charAt(0).toLowerCase()+e.substr(1):e}function V(e,t){if(!t||0===t.length)return e;const r=i(e);return y.applyOverrides(r,t),r}const B=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&!e[0].effects&&!e[1].effects;export{G as CIMAnalyzer,V as analyzeCIMResource};
|
|
5
|
+
import e from"../../Color.js";import{getFontFamily as t}from"../../core/fontUtils.js";import{clone as i}from"../../core/lang.js";import r from"../../core/Logger.js";import{pt2px as o,px2pt as n}from"../../core/screenUtils.js";import{numericHash as a}from"../../core/string.js";import{createRendererExpression as s,ArcadeExpression as l}from"../../support/arcadeOnDemand.js";import{DEFAULT_PICTURE_FILL_HEIGHT as c,DEFAULT_HATCH_FILL_SEPARATION as m,DEFAULT_STROKE_WIDTH as f,DEFAULT_MARKER_SIZE as h,DEFAULT_TEXT_HEIGHT as p}from"./CIMSymbolDrawHelper.js";import{CIMSymbolHelper as u,OverrideHelper as y}from"./CIMSymbolHelper.js";import{Alignment as d,CapType as v,JoinType as _}from"./enums.js";import{quantizeIfNeeded as O}from"./quantizeTime.js";import{getExtent as S,getSDFMetrics as g}from"./SDFHelper.js";import{fromCIMColor as M,getTintColor as k,getValue as b,getFillColor as N,getStrokeColor as P,getStrokeWidth as z,isFeatureValueFn as L,fromCIMFontDecoration as C,fromCIMFontStyle as F,adjustTextCase as I,createLabelOverrideFunction as w,evaluateValueOrFunction as x,fromCIMHorizontalAlignment as A,fromCIMVerticalAlignment as R}from"./utils.js";import{CIMEffectHelper as X}from"./effects/CIMEffectHelper.js";import H from"../../views/2d/arcade/callExpressionWithFeature.js";import{RANDOM_INSIDE_POLYGON_TEXTURE_SIZE as J}from"../../views/2d/engine/webgl/definitions.js";import{getMaterialGroup as Y}from"../../views/2d/engine/webgl/grouping.js";const E=r.getLogger("esri.symbols.cim.cimAnalyzer");function T(e){switch(e){case"Butt":return v.BUTT;case"Square":return v.SQUARE;default:return v.ROUND}}function $(e){switch(e){case"Bevel":return _.BEVEL;case"Miter":return _.MITER;default:return _.ROUND}}function j(e){const t=e.markerPlacement;return t&&t.angleToLine?d.MAP:d.SCREEN}class G{constructor(e,t){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._resourceManager=e,this._info=t}async analyzeSymbolReference(e,t,i){if(this._cimLayers=i??[],!e)return this._cimLayers;if(e.primitiveOverrides){this._primitiveOverrides=e.primitiveOverrides,this._poMap={};const t=[],i=this._info;for(const e of this._primitiveOverrides){const r=e.valueExpressionInfo;if(r&&i){const o=r.expression,n=s(o,i.spatialReference,i.fields).then((t=>{null!=t&&this._setPoMap(e.primitiveName,e.propertyName,t)}));t.push(n)}else null!=e.value&&this._setPoMap(e.primitiveName,e.propertyName,e.value);t.length>0&&await Promise.all(t)}}const r=e.symbol,o=[];return u.fetchResources(r,this._resourceManager,o),o.length>0&&await Promise.all(o),this._analyzeSymbol(r,t),this._cimLayers}_analyzeSymbol(e,t){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,t,1,0,0,0)}}_analyzeMultiLayerSymbol(e,t,i,r,o,n){const a=e?.symbolLayers;if(!a)return;const s=e.effects;let l=d.SCREEN;const c=u.getSize(e)??0;"CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(l=d.MAP);const m="CIMPolygonSymbol"===e.type;let f=a.length;for(;f--;){const h=a[f];if(!h||!1===h.enable)continue;let p;s&&s.length&&(p=[...s]);const u=h.effects;u&&u.length&&(s?p.push(...u):p=[...u]);const d=[];let v;y.findEffectOverrides(p,this._primitiveOverrides,d),v=d.length>0?this._createEffectsOverrideFunction(p,d):p;const _=[];switch(y.findApplicableOverrides(h,this._primitiveOverrides,_),h.type){case"CIMSolidFill":this._analyzeSolidFill(h,v);break;case"CIMPictureFill":this._analyzePictureFill(h,v);break;case"CIMHatchFill":this._analyzeHatchFill(h,v);break;case"CIMGradientFill":this._analyzeGradientFill(h,v);break;case"CIMSolidStroke":this._analyzeSolidStroke(h,v,m,c);break;case"CIMPictureStroke":this._analyzePictureStroke(h,v,m,c);break;case"CIMGradientStroke":this._analyzeGradientStroke(h,v,m,c);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"===e.type&&(l=j(h));const a=[],s=h.primitiveName;s&&a.push(s),this._analyzeMarker(h,v,null,a,l,c,1,t,i,r,o,n);break}default:E.error("Cannot analyze CIM layer",h.type)}}}_analyzeSolidFill(e,t){const i=e.primitiveName,r=M(e.color),[o,n]=this._analyzePrimitiveOverrides(i,t,null,null),s=a(JSON.stringify(e)+n).toString();this._cimLayers.push({type:"fill",templateHash:s,materialHash:o?()=>s:s,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked,color:this._createOverrideFunction(i,"Color",r,U),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:t,applyRandomOffset:!1,sampleAlphaOnly:!0})}_analyzePictureFill(e,t){const i=e.primitiveName,r=k(e),[o,n]=this._analyzePrimitiveOverrides(i,t,null,null),s=a(JSON.stringify(e)+n).toString(),l=a(`${e.url}${JSON.stringify(e.colorSubstitutions)}`).toString(),m=b(e.height,c);let f=b(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const t=e.width;let i=1;const r=this._resourceManager.getResource(e.url);null!=r&&(i=r.width/r.height),f/=i*(m/t)}this._cimLayers.push({type:"fill",templateHash:s,materialHash:o?()=>l:l,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked,effects:t,color:this._createOverrideFunction(i,"TintColor",r,U),height:this._createOverrideFunction(i,"Height",m),scaleX:this._createOverrideFunction(i,"ScaleX",f),angle:this._createOverrideFunction(i,"Rotation",b(e.rotation)),offsetX:this._createOverrideFunction(i,"OffsetX",b(e.offsetX)),offsetY:this._createOverrideFunction(i,"OffsetY",b(e.offsetY)),url:e.url,applyRandomOffset:!1,sampleAlphaOnly:!1})}_analyzeHatchFill(e,t){const i=e.primitiveName,r=this._analyzeMaterialOverrides(i,["Rotation","OffsetX","OffsetY"]);let[o,n]=this._analyzePrimitiveOverrides(i,t,null,null);const s=a(JSON.stringify(e)+n).toString(),l=a(`${e.separation}${JSON.stringify(e.lineSymbol)}`).toString();let c={r:255,g:255,b:255,a:1},f=!1;const h=e.lineSymbol?.symbolLayers?.find((e=>"CIMSolidStroke"===e.type&&null!=this._poMap[e.primitiveName]?.Color));if(h){c=M(h.color),c=this._createOverrideFunction(h.primitiveName,"Color",c,U);const e="function"==typeof c;o=o||e,f=null!=h.color||e}this._cimLayers.push({type:"fill",templateHash:s,materialHash:o&&r?this._createMaterialHashFunction(l,r):l,cim:e,materialOverrides:r,colorLocked:!!e.colorLocked,effects:t,color:c,height:this._createOverrideFunction(i,"Separation",b(e.separation,m)),scaleX:1,angle:this._createOverrideFunction(i,"Rotation",b(e.rotation)),offsetX:this._createOverrideFunction(i,"OffsetX",b(e.offsetX)),offsetY:this._createOverrideFunction(i,"OffsetY",b(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!f})}_analyzeGradientFill(e,t){const i=e.primitiveName,[r,o]=this._analyzePrimitiveOverrides(i,t,null,null),n=a(JSON.stringify(e)+o).toString();this._cimLayers.push({type:"fill",templateHash:n,materialHash:r?()=>n:n,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked,effects:t,color:{r:128,g:128,b:128,a:1},height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,applyRandomOffset:!1,sampleAlphaOnly:!1})}_analyzeSolidStroke(e,t,i,r){const o=e.primitiveName,n=M(e.color),s=b(e.width,f),l=T(e.capStyle),c=$(e.joinStyle),m=e.miterLimit,[h,p]=this._analyzePrimitiveOverrides(o,t,null,null),u=a(JSON.stringify(e)+p).toString();let y,d;if(t&&t instanceof Array&&t.length>0){const e=t[t.length-1];if("CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&null===e.offsetAlongLine){const e=(t=[...t]).pop();y=e.dashTemplate,d=e.scaleDash}}this._cimLayers.push({type:"line",templateHash:u,materialHash:h?()=>u:u,cim:e,materialOverrides:null,isOutline:i,colorLocked:!!e.colorLocked,effects:t,color:this._createOverrideFunction(o,"Color",n,U),width:this._createOverrideFunction(o,"Width",s),cap:this._createOverrideFunction(o,"CapStyle",l),join:this._createOverrideFunction(o,"JoinStyle",c),miterLimit:m&&this._createOverrideFunction(o,"MiterLimit",m),referenceWidth:r,zOrder:D(e.name),dashTemplate:y,scaleDash:d,sampleAlphaOnly:!0})}_analyzePictureStroke(e,t,i,r){const o=a(`${e.url}${JSON.stringify(e.colorSubstitutions)}`).toString(),n=e.primitiveName,s=k(e),l=b(e.width,f),c=T(e.capStyle),m=$(e.joinStyle),h=e.miterLimit,[p,u]=this._analyzePrimitiveOverrides(n,t,null,null),y=a(JSON.stringify(e)+u).toString();this._cimLayers.push({type:"line",templateHash:y,materialHash:p?()=>o:o,cim:e,materialOverrides:null,isOutline:i,colorLocked:!!e.colorLocked,effects:t,color:this._createOverrideFunction(n,"TintColor",s,U),width:this._createOverrideFunction(n,"Width",l),cap:this._createOverrideFunction(n,"CapStyle",c),join:this._createOverrideFunction(n,"JoinStyle",m),miterLimit:h&&this._createOverrideFunction(n,"MiterLimit",h),referenceWidth:r,zOrder:D(e.name),dashTemplate:null,scaleDash:!1,url:e.url,sampleAlphaOnly:!1})}_analyzeGradientStroke(e,t,i,r){const o=e.primitiveName,n=b(e.width,f),s=T(e.capStyle),l=$(e.joinStyle),c=e.miterLimit,[m,h]=this._analyzePrimitiveOverrides(o,t,null,null),p=a(JSON.stringify(e)+h).toString();this._cimLayers.push({type:"line",templateHash:p,materialHash:m?()=>p:p,cim:e,materialOverrides:null,isOutline:i,colorLocked:!!e.colorLocked,effects:t,color:{r:128,g:128,b:128,a:1},width:this._createOverrideFunction(o,"Width",n),cap:this._createOverrideFunction(o,"CapStyle",s),join:this._createOverrideFunction(o,"JoinStyle",l),miterLimit:c&&this._createOverrideFunction(o,"MiterLimit",c),referenceWidth:r,zOrder:D(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeMarker(e,t,i,r,o,n,a,s,l,c,m,f,p=!1){if(this._analyzeMarkerInsidePolygon(e,t))return;const u=b(e.size,h),y=b(e.rotation),d=b(e.offsetX),v=b(e.offsetY);let _=this._createOverrideFunction(e.primitiveName,"Size",u),O=this._createOverrideFunction(e.primitiveName,"Rotation",y),S=this._createOverrideFunction(e.primitiveName,"OffsetX",d),g=this._createOverrideFunction(e.primitiveName,"OffsetY",v);_=this._transformSize(_,a),O=this._transformRotation(O,!!e.rotateClockwise,c);const M=this._transformOffsetX(S,g,c,a,m),k=this._transformOffsetY(S,g,c,a,f);switch(S=M,g=k,e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,t,i,r,o,n,_,O,S,g,e.colorLocked||p);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,t,i,r,o,n,a,s,_,O,S,g,e.colorLocked||p)}}_analyzeMarkerInsidePolygon(e,t){const{markerPlacement:i,type:r}=e;if(!i||"CIMMarkerPlacementInsidePolygon"!==i.type)return!1;if("CIMVectorMarker"===r||"CIMPictureMarker"===r){const o=e.primitiveName;if(o){const[e,i]=this._analyzePrimitiveOverrides([o],t,null,null);if(e)return!1}const n=i.primitiveName;if(n){const[e,i]=this._analyzePrimitiveOverrides([n],t,null,null);if(e)return!1}if("CIMVectorMarker"===r){const{markerGraphics:t}=e;if(t)for(const e of t){const{symbol:t}=e;if("CIMPolygonSymbol"===t?.type&&t.symbolLayers){const{symbolLayers:e}=t;for(const t of e)if("CIMSolidStroke"===t.type)return!1}}}else{const{animatedSymbolProperties:t}=e;if(t)return!1}}const o=i,s=Math.abs(o.stepX),l=Math.abs(o.stepY);if(0===s||0===l)return!0;const c=["Rotation","OffsetX","OffsetY"],m=this._primitiveOverrides.filter((t=>t.primitiveName!==e.primitiveName||!c.includes(t.propertyName))),f="url"in e&&"string"==typeof e.url?e.url:void 0,h=a(JSON.stringify(e)).toString();let p,u,y=null;if("Random"===i.gridType){const e=n(J),t=Math.max(Math.floor(e/s),1),i=Math.max(Math.floor(e/l),1);p=l*i,y=e=>e?e*i:0;u=t*s/p}else i.shiftOddRows?(p=2*l,y=e=>e?2*e:0,u=s/l*.5):(p=l,y=null,u=s/l);const d=k(e);return this._cimLayers.push({type:"fill",templateHash:h,materialHash:h,cim:e,materialOverrides:m,colorLocked:!!e.colorLocked,effects:t,color:d,height:this._createOverrideFunction(o.primitiveName,"StepY",p,y),scaleX:u,angle:o.gridAngle,offsetX:b(o.offsetX),offsetY:b(o.offsetY),url:f,applyRandomOffset:"Random"===i.gridType,sampleAlphaOnly:!f,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(e,t,i,r,o,n,s,l,c,m,f){let h=b(e.scaleX,1);const p=k(e),u=a(`${e.url}${JSON.stringify(e.colorSubstitutions)}${JSON.stringify(e.animatedSymbolProperties)}`).toString();i||(i=this._createMarkerPlacementOverrideFunction(e.markerPlacement));const y=this._createAnimatedSymbolPropertiesOverrideFunction(e.animatedSymbolProperties),[d,v]=this._analyzePrimitiveOverrides(r,t,i,y),_=a(JSON.stringify(e)+v).toString(),O=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const t=e.width;let i=1;const r=this._resourceManager.getResource(e.url);null!=r&&(i=r.width/r.height);h/=i*(b(e.size)/t)}function S(e,t){return null!=y?x(y,e,t):null}const g=e.animatedSymbolProperties&&!0===e.animatedSymbolProperties.randomizeStartTime?(e,t,i,r)=>{const o=Y(r??0),n=S(e,t);return u+`-MATERIALGROUP(${o})`+`-ASP(${JSON.stringify(n)})`}:d?(e,t)=>{const i=S(e,t);return u+`-ASP(${JSON.stringify(i)})`}:u;this._cimLayers.push({type:"marker",templateHash:_,materialHash:g,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked||!!f,effects:t,scaleSymbolsProportionally:!1,alignment:o,size:s,scaleX:this._createOverrideFunction(e.primitiveName,"ScaleX",h),rotation:l,offsetX:c,offsetY:m,color:this._createOverrideFunction(e.primitiveName,"TintColor",p,U),anchorPoint:{x:O.x,y:O.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:{r:0,g:0,b:0,a:0},outlineWidth:0,frameHeight:0,rotateClockwise:!1,referenceSize:n,sizeRatio:1,markerPlacement:i,url:e.url,animatedSymbolProperties:y})}_analyzeVectorMarker(e,t,i,r,o,n,a,s,l,c,m,f,h){const p=e.markerGraphics;if(!p)return;const u=e.frame;let y=0,d=1;e.scaleSymbolsProportionally&&u&&(y=u.ymax-u.ymin,d=this._transformSize(l,1/y)),d=this._transformSize(d,a),i||(i=this._createMarkerPlacementOverrideFunction(e.markerPlacement));for(const v of p)if(v){const a=v.symbol;if(!a)continue;const p=v.primitiveName;p&&r.push(p);let _=m,O=f;if(("CIMPointSymbol"===a.type||"CIMTextSymbol"===a.type)&&u){let t=0,i=0;const r=v.geometry;"x"in r&&"y"in r&&(t+=r.x-.5*(u.xmin+u.xmax),i+=r.y-.5*(u.ymin+u.ymax));const o=e.anchorPoint;o&&("Absolute"===e.anchorPointUnits?(t-=o.x,i-=o.y):u&&(t-=(u.xmax-u.xmin)*o.x,i-=(u.ymax-u.ymin)*o.y)),_=this._transformOffsetX(t,i,c,d,m),O=this._transformOffsetY(t,i,c,d,f)}switch(a.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":s?this._analyzeMultiLayerGraphicNonSDF(e,t,i,null,v,r,o,n,y,!!h||!!e.colorLocked):this._analyzeMultiLayerGraphic(e,t,i,null,v,r,o,n,y,d,l,c,_,O,!!h||!!e.colorLocked);break;case"CIMTextSymbol":this._analyzeTextGraphic(e,t,i,v,r,o,n,y,d,l,c,_,O,h)}p&&r.pop()}}_analyzeMultiLayerGraphic(e,t,i,r,o,n,s,l,c,m,f,h,p,u,y){const d=o.symbol,v=d.symbolLayers;if(!v)return;let _=v.length;if(B(v))return void this._analyzeCompositeMarkerGraphic(e,t,i,r,o,v,n,s,l,c,f,h,p,u,!!y||!!e.colorLocked);const O=this._resourceManager.geometryEngine,k=X.applyEffects(d.effects,o.geometry,O);if(k)for(;_--;){const d=v[_];if(!d||!1===d.enable)continue;const b=d.primitiveName;switch(b&&n.push(b),d.type){case"CIMSolidFill":case"CIMSolidStroke":{const m=X.applyEffects(d.effects,k,O),v=S(m);if(!v)continue;const _="Relative"!==e.anchorPointUnits,[C,F,I]=g(v,e.frame,e.size,e.anchorPoint,_),w="CIMSolidFill"===d.type,x={type:"sdf",geom:m,asFill:w},A=d.path,R=M(w?N(d):P(d)),H=w?{r:0,g:0,b:0,a:0}:M(P(d)),J=z(d)??0;if(!w&&!J)break;const Y=o.primitiveName;let E=null;!w||d.colorLocked||y||(E=this._createOverrideFunction(Y,"FillColor",R,U));let T=null;d.colorLocked||y||(T=this._createOverrideFunction(Y,"StrokeColor",H,U));const $=this._createOverrideFunction(Y,"StrokeWidth",J);let j=!1,G="";for(const e of this._primitiveOverrides)n.includes(e.primitiveName)&&(null!=e.value?G+=`-${e.primitiveName}-${e.propertyName}-${JSON.stringify(e.value)}`:e.valueExpressionInfo&&(j=!0));(null!=t&&"function"==typeof t||null!=i&&"function"==typeof i)&&(j=!0),(L(f)||L(h)||L(p)||L(u))&&(j=!0);const D=JSON.stringify({...e,markerGraphics:null}),W=a(JSON.stringify(x)+A).toString(),V=a(JSON.stringify(o)+JSON.stringify(d)+D+G).toString();this._cimLayers.push({type:"marker",templateHash:V,materialHash:j?()=>W:W,cim:x,materialOverrides:null,colorLocked:!!d.colorLocked||!!y,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:F,y:I},isAbsoluteAnchorPoint:_,size:f,rotation:h,offsetX:p,offsetY:u,scaleX:1,frameHeight:c,rotateClockwise:!1,referenceSize:l,sizeRatio:C,color:L(E)?E:this._createOverrideFunction(b,"Color",R,U),outlineColor:L(T)?T:this._createOverrideFunction(b,"Color",H,U),outlineWidth:L($)?$:this._createOverrideFunction(b,"Width",J),markerPlacement:i,animatedSymbolProperties:r,path:A});break}case"CIMVectorMarker":d.markerPlacement?this._analyzeMultiLayerGraphicNonSDF(e,t,i,r,o,n,s,l,c,!!y||!!d.colorLocked):this._analyzeMarker(d,t,i,n,s,l,m,!1,f,h,p,u,!!y||!!e.colorLocked);break;default:this._analyzeMultiLayerGraphicNonSDF(e,t,i,r,o,n,s,l,c,!!y||!!e.colorLocked)}b&&n.pop()}}_analyzeTextGraphic(e,i,r,o,n,s,l,c,m,h,u,d,v,_){const O=[];y.findApplicableOverrides(o,this._primitiveOverrides,O);const S=o.geometry;if(!("x"in S)||!("y"in S))return;const g=o.symbol,k=C(g),L=F(g.fontStyleName),X=t(g.fontFamilyName);g.font={family:X,decoration:k,...L};let H=b(g.height,p),J=b(g.angle),Y=b(g.offsetX),E=b(g.offsetY);H=this._transformSize(H,m),J=this._transformRotation(J,!1,u);const T=this._transformOffsetX(Y,E,u,m,d),$=this._transformOffsetY(Y,E,u,m,v);Y=T,E=$;const j=M(N(g));let G=M(P(g)),D=z(g)??0;D||(G=M(N(g.haloSymbol)),D=b(g.haloSize)),D=this._transformSize(D,m);let U=null,W=null,V=0;if(g.callout&&"CIMBackgroundCallout"===g.callout.type){const e=g.callout;if(e.backgroundSymbol){const t=e.backgroundSymbol.symbolLayers;if(t)for(const e of t)"CIMSolidFill"===e.type?U=M(e.color):"CIMSolidStroke"===e.type&&(W=M(e.color),V=b(e.width,f))}}const[B,q]=this._analyzePrimitiveOverrides(n,i,r,null),K=JSON.stringify(e.effects)+Number(e.colorLocked||_).toString()+JSON.stringify(e.anchorPoint)+e.anchorPointUnits+JSON.stringify(e.markerPlacement)+e.size.toString(),Q=a(JSON.stringify(o)+K+q).toString();let Z=this._createOverrideFunction(o.primitiveName,"TextString",o.textString??"",I,g.textCase);if(null==Z)return;const{fontStyleName:ee}=g,te=X+(ee?"-"+ee.toLowerCase():"-regular"),ie=te;"string"==typeof Z&&Z.includes("[")&&g.fieldMap&&(Z=w(g.fieldMap,Z,g.textCase)),this._cimLayers.push({type:"text",templateHash:Q,materialHash:B||"function"==typeof Z||/\[(.*?)\]/.test(Z)?(e,t,i)=>ie+"-"+x(Z,e,t,i):ie+"-"+a(Z),cim:g,materialOverrides:null,colorLocked:!!e.colorLocked||!!_,effects:i,alignment:s,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,fontName:te,decoration:k,weight:L.weight,style:L.style,size:H,angle:J,offsetX:Y,offsetY:E,horizontalAlignment:A(g.horizontalAlignment),verticalAlignment:R(g.verticalAlignment),text:Z,color:j,outlineColor:G,outlineSize:D,backgroundColor:U,borderLineColor:W,borderLineWidth:V,referenceSize:l,sizeRatio:1,markerPlacement:r})}_analyzeMultiLayerGraphicNonSDF(e,t,i,r,n,s,l,c,m,f){const p=this._buildSimpleMarker(e,n),y=e.primitiveName,d=this._analyzeMaterialOverrides(y,["Rotation","OffsetX","OffsetY"]),[v,_]=this._analyzePrimitiveOverrides(s,null,null,null),[O,S,g]=u.getTextureAnchor(p,this._resourceManager),M=b(e.rotation),k=b(e.offsetX),N=b(e.offsetY),P=a(JSON.stringify(p)+_).toString(),z=d&&d.length>0||null!=t&&"function"==typeof t;this._cimLayers.push({type:"marker",templateHash:P,materialHash:z&&d?this._createMaterialHashFunction(P,d):P,cim:p,materialOverrides:d,colorLocked:!!e.colorLocked||!!f,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:l,anchorPoint:{x:O,y:S},isAbsoluteAnchorPoint:!1,size:b(e.size,h),rotation:this._createOverrideFunction(y,"Rotation",M),offsetX:this._createOverrideFunction(y,"OffsetX",k),offsetY:this._createOverrideFunction(y,"OffsetY",N),color:{r:255,g:255,b:255,a:1},outlineColor:{r:0,g:0,b:0,a:0},outlineWidth:0,scaleX:1,frameHeight:m,rotateClockwise:!!e.rotateClockwise,referenceSize:c,sizeRatio:g/o(e.size),markerPlacement:i,animatedSymbolProperties:r,avoidSDFRasterization:!0})}_buildSimpleMarker(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}}_analyzeCompositeMarkerGraphic(e,t,i,r,o,n,s,l,c,m,h,p,u,y,d){const v=o.geometry,_=n[0],O=n[1],k=S(v);if(!k)return;const N="Relative"!==e.anchorPointUnits,[P,z,C]=g(k,e.frame,e.size,e.anchorPoint,N),F={type:"sdf",geom:v,asFill:!0},I=O.path,w=O.primitiveName,x=_.primitiveName,A=M(O.color),R=M(_.color),X=b(_.width,f),H=o.primitiveName;let J=null;O.colorLocked||d||(J=this._createOverrideFunction(H,"FillColor",A,U));let Y=null;_.colorLocked||d||(Y=this._createOverrideFunction(H,"StrokeColor",R,U));const E=this._createOverrideFunction(H,"StrokeWidth",X);let T=!1,$="";for(const a of this._primitiveOverrides)(a.primitiveName===w||a.primitiveName===x||s.includes(a.primitiveName))&&(null!=a.value?$+=`-${a.primitiveName}-${a.propertyName}-${JSON.stringify(a.value)}`:a.valueExpressionInfo&&(T=!0));null!=i&&"function"==typeof i&&(T=!0),(L(h)||L(p)||L(u)||L(y))&&(T=!0);const j=JSON.stringify({...e,markerGraphics:null}),G=a(JSON.stringify(F)+I).toString(),D=a(JSON.stringify(o)+JSON.stringify(O)+JSON.stringify(_)+j+$).toString();this._cimLayers.push({type:"marker",templateHash:D,materialHash:T?()=>G:G,cim:F,materialOverrides:null,colorLocked:!!d,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:l,anchorPoint:{x:z,y:C},isAbsoluteAnchorPoint:N,size:h,rotation:p,offsetX:u,offsetY:y,scaleX:1,frameHeight:m,rotateClockwise:!1,referenceSize:c,sizeRatio:P,color:L(J)?J:this._createOverrideFunction(w,"Color",A,U),outlineColor:L(Y)?Y:this._createOverrideFunction(x,"Color",R,U),outlineWidth:L(E)?E:this._createOverrideFunction(x,"Width",X),markerPlacement:i,path:I,animatedSymbolProperties:r})}_createMaterialHashFunction(e,t){const i=this._info?.geometryType;if(i){const e=this._poMap;for(const r of t){if(r.valueExpressionInfo){const t=e[r.primitiveName]&&e[r.primitiveName][r.propertyName];t instanceof l&&(r.fn=(e,r,o)=>H(t,e,{$view:o},i,r))}}}return(i,r,o)=>{for(const e of t)e.fn&&(e.value=e.fn(i,r,o));return a(e+y.buildOverrideKey(t)).toString()}}_setPoMap(e,t,i){let r;this._poMap[e]?r=this._poMap[e]:(r={},this._poMap[e]=r),r[t]=i}_createOverrideFunction(e,t,i,r,o){if(null==e)return i;const n=this._poMap[e];if(null==n)return i;const a=n[t];if("string"==typeof a||"number"==typeof a||a instanceof Array)return r?r.call(null,a,o):a;const s=this._info?.geometryType;return null!=a&&a instanceof l&&null!=s?(e,t,n)=>{let l=H(a,e,{$view:n},s,t);return null!==l&&r&&(l=r.call(null,l,o)),null!==l?l:i}:i}_createEffectsOverrideFunction(e,t){const r=this._poMap,o=this._info?.geometryType;for(const i of t){if(i.valueExpressionInfo&&o){const e=r[i.primitiveName]&&r[i.primitiveName][i.propertyName];e instanceof l&&(i.fn=(t,i,r)=>H(e,t,{$view:r},o,i))}}return(r,o,n)=>{for(const e of t)e.fn&&(e.value=e.fn(r,o,n));const a=[];for(let s of e){const e=s?.primitiveName;if(e){let r=!1;for(const o of t)if(o.primitiveName===e){const e=W(o.propertyName);null!=o.value&&o.value!==s[e]&&(r||(s=i(s),r=!0),s[e]=o.value)}}a.push(s)}return a}}_createMarkerPlacementOverrideFunction(e){const t=[];if(y.findApplicableOverrides(e,this._primitiveOverrides,t),null==e||0===t.length)return e;const r=this._poMap,o=this._info?.geometryType;for(const i of t){if(i.valueExpressionInfo&&o){const e=r[i.primitiveName]&&r[i.primitiveName][i.propertyName];e instanceof l&&(i.fn=(t,i,r)=>H(e,t,{$view:r},o,i))}}return(r,o,n)=>{for(const e of t)e.fn&&(e.value=e.fn(r,o,n));const a=i(e),s=e.primitiveName;for(const e of t)if(e.primitiveName===s){const t=W(e.propertyName);null!=e.value&&e.value!==a[t]&&(a[t]=e.value)}return a}}_createAnimatedSymbolPropertiesOverrideFunction(e){const t=[];if(y.findApplicableOverrides(e,this._primitiveOverrides,t),null==e||0===t.length)return e;const r=this._info?.geometryType;if(r){const e=this._poMap;for(const i of t){if(i.valueExpressionInfo){const t=e[i.primitiveName]&&e[i.primitiveName][i.propertyName];t instanceof l&&(i.fn=(e,i,o)=>H(t,e,{$view:o},r,i))}}}return(r,o,n)=>{for(const e of t)e.fn&&(e.value=e.fn(r,o,n));const a=i(e),s=e.primitiveName;for(const e of t)if(e.primitiveName===s){const t=W(e.propertyName);if(null!=e.value){const i=O(e.value,e.propertyName);i!==a[t]&&(a[t]=i)}}return a}}_analyzePrimitiveOverrides(e,t,i,r){let o=!1,n="";"string"==typeof e&&(e=[e]);for(const a of this._primitiveOverrides)e?.includes(a.primitiveName)&&(null!=a.value?n+=`-${a.primitiveName}-${a.propertyName}-${JSON.stringify(a.value)}`:a.valueExpressionInfo&&(o=!0));return null!=t&&"function"==typeof t&&(o=!0),null!=i&&"function"==typeof i&&(o=!0),null!=r&&"function"==typeof r&&(o=!0),[o,n]}_analyzeMaterialOverrides(e,t){return this._primitiveOverrides.filter((i=>i.primitiveName!==e||!t.includes(i.propertyName)))}_transformSize(e,t){return L(e)||L(t)?(i,r,o)=>(L(e)?e(i,r,o):e)*(L(t)?t(i,r,o):t):e*t}_transformRotation(e,t,i){return L(e)||L(i)?(r,o,n)=>{const a=L(e)?e(r,o,n):e,s=L(i)?i(r,o,n):i;return t?s-a:s+a}:t?i-e:i+e}_transformOffsetX(e,t,i,r,o){if(!(L(e)||L(t)||L(i)||L(r)||L(o))){const n=i*Math.PI/180;if(n){const i=Math.cos(n),a=Math.sin(n);return(i*e-a*t)*r+o}return e*r+o}return(n,a,s)=>{let l=L(i)?i(n,a,s):i;const c=L(r)?r(n,a,s):r,m=L(e)?e(n,a,s):e,f=L(o)?o(n,a,s):o;if(l){l*=Math.PI/180;return(Math.cos(l)*m-Math.sin(l)*(L(t)?t(n,a,s):t))*c+f}return m*c+f}}_transformOffsetY(e,t,i,r,o){if(!(L(e)||L(t)||L(i)||L(r)||L(o))){const n=i*Math.PI/180;if(n){const i=Math.cos(n);return(Math.sin(n)*e+i*t)*r+o}return t*r+o}return(n,a,s)=>{let l=L(i)?i(n,a,s):i;const c=L(r)?r(n,a,s):r,m=L(t)?t(n,a,s):t,f=L(o)?o(n,a,s):o;if(l){l*=Math.PI/180;const t=Math.cos(l);return(Math.sin(l)*(L(e)?e(n,a,s):e)+t*m)*c+f}return m*c+f}}}function D(e){if(e&&0===e.indexOf("Level_")){const t=parseInt(e.substr(6),10);if(!isNaN(t))return t}return 0}function U(t){if(!t||0===t.length)return null;const i=new e(t).toRgba();return{r:i[0],g:i[1],b:i[2],a:i[3]}}function W(e){return e?e.charAt(0).toLowerCase()+e.substr(1):e}function V(e,t){if(!t||0===t.length)return e;const r=i(e);return y.applyOverrides(r,t),r}const B=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&!e[0].effects&&!e[1].effects;export{G as CIMAnalyzer,V as analyzeCIMResource};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import{HandleOwner as t}from"../../../../core/HandleOwner.js";import i from"../../../../core/Logger.js";import{debounce as s,isAbortError as r,eachAlways as a}from"../../../../core/promiseUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import n from"../../../../geometry/Point.js";import h from"../../../../layers/support/PixelBlock.js";import c from"../../../../layers/support/TileInfo.js";import{update as u,unregister as p,register as d,getRasterId as y}from"../../../../layers/support/rasterDatasets/RawBlockCache.js";import{getWorldWidth as g,computeProjectedScales as m}from"../../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{isShadedReliefRendererSupported as _}from"../../../../renderers/support/rasterRendererChecks.js";import"../../tiling/PagedTileQueue.js";import f from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import b from"../../tiling/TileQueue.js";import w from"../../tiling/TileStrategy.js";import{TILE_SIZE as I}from"../../engine/webgl/definitions.js";import{getWebGLCapabilities as P}from"../../../webgl/capabilities.js";import R from"../../../../geometry/Extent.js";const C=[0,0];let S=class extends t{constructor(){super(...arguments),this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=[],this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._rasterFunctionState="na",this._globalUpdateRequested=!1,this.attached=!1,this.timeExtent=null,this.redrawOrRefetch=s((async(e={})=>{if(!this.previousLOD||this.layerView.suspended)return;const t=this._rasterFunctionState;e.reprocess&&(await this.updatingHandles.addPromise(this.layer.updateRasterFunction()),this.updateRasterFunctionParameters());const i=this._rasterFunctionState,{type:s}=this;return e.refetch||"raster"!==s&&!!e.reprocess||"cpu"===i||"cpu"===t?this.updatingHandles.addPromise(this.doRefresh()):this.updatingHandles.addPromise(this._redrawImage(e.signal))}))}get useWebGLForProcessing(){return this._get("useWebGLForProcessing")??!0}set useWebGLForProcessing(e){this._set("useWebGLForProcessing",e)}get useProgressiveUpdate(){return this._get("useProgressiveUpdate")??!0}set useProgressiveUpdate(e){if(this._tileStrategy&&this.useProgressiveUpdate!==e){this._tileStrategy.destroy(),this.container.removeAllChildren();const t=this._getCacheSize(e);this._tileStrategy=new w({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._set("useProgressiveUpdate",e),this.layerView.requestUpdate()}}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume();const{extent:t,resolution:i,scale:s}=e.state,r=this._tileInfoView.getClosestInfoForScale(s);if(this.layer.raster){if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){const e=this._srcResolutions[r.level],s=t.toJSON?t:R.fromJSON(t);u(this._blockCacheRegistryUrl,this._blockCacheRegistryId,s,i,e,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,this.previousLOD?.level!==r.level&&(this.previousLOD=r,null==this._symbolizerParams||this.layerView.hasTilingEffects||this._updateSymbolizerParams(),this._tileStrategy.updateCacheSize(0))}}moveEnd(){!this.layerView.hasTilingEffects&&this.useProgressiveUpdate||(this._abortController&&this._abortController.abort(),this._abortController=new AbortController,0===this._fetchQueue.length&&this._redrawImage(this._abortController.signal).then((()=>{this._globalUpdateRequested=!1,this.layerView.requestUpdate()})));const e=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy.updateCacheSize(e),this.layerView.requestUpdate()}get updating(){return this._fetchQueue?.updating||this._globalUpdateRequested||!(!this.updatingHandles||!this.updatingHandles.updating)}attach(){P("2d").supportsTextureFloat||(this.useWebGLForProcessing=!1),this._initializeTileInfo(),this._tileInfoView=new f(this.layerView.tileInfo,this.layerView.fullExtent);const e=this._computeFetchConcurrency();this._fetchQueue=new b({tileInfoView:this._tileInfoView,concurrency:e,process:(e,t)=>this._fetchTile1(e,t)});const t=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new w({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}detach(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,p(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryUrl=this._blockCacheRegistryId=null}acquireTile(e){const t=this.container.createTile(e);return this._enqueueTileFetch(t),this.layerView.requestUpdate(),this._needBlockCacheUpdate=!0,this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,t}releaseTile(e){this._fetchQueue.abort(e.key.id),this.container.removeChild(e),e.once("detach",(()=>{e.destroy(),this.layerView.requestUpdate()})),this.layerView.requestUpdate()}createEmptyTilePixelBlock(e=null){const t=null==e||e.join(",")===this._tileInfoView.tileInfo.size.join(",");if(t&&null!=this._emptyTilePixelBlock)return this._emptyTilePixelBlock;e=e||this._tileInfoView.tileInfo.size;const[i,s]=e,r=new h({width:i,height:s,pixels:[new Uint8Array(i*s)],mask:new Uint8Array(i*s),pixelType:"u8"});return t&&(this._emptyTilePixelBlock=r),r}_getBandIds(){if(!("rasterFunctionChain"in this.container)||!this.container.rasterFunctionChain)return this.layer.bandIds;const{bandIds:e,raster:t}=this.layer,i="rasterFunction"in t?t.rasterFunction.rawInputBandIds:null;return e?.length&&i?.length&&1!==t.rasterInfo.bandCount?e.map((e=>i[Math.min(e,i.length-1)])):e||i}updateRasterFunctionParameters(){}_fetchTile1(e,t){const i=null!=t?t.signal:null,s=this.canUseWebGLForProcessing(),{layerView:r}=this,{tileInfo:a}=r,o=!a.isWrappable&&null!=g(r.view.spatialReference),l=s&&this.layer.raster.hasUniqueSourceStorageInfo,n={allowPartialFill:!0,datumTransformation:r.datumTransformation,interpolation:s?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:l,skipRasterFunction:"raster"===this.type&&null!=this.container.rasterFunctionChain,signal:i,srcResolution:this._srcResolutions[e.level],timeExtent:r.timeExtent,tileInfo:a,disableWrapAround:o};return this.fetchTile(e,n)}_getCacheSize(e){return e?40:0}_initializeTileInfo(){const{layerView:e}=this,t=e.view.spatialReference;if(this._canUseLayerLODs()){const{origin:i,lods:s}=this.layer.tileInfo,r=s.map((({scale:e})=>e)),a=c.create({spatialReference:t,size:I,scales:r,origin:i});return e.set("tileInfo",a),void(this._srcResolutions=s.map((({resolution:e})=>({x:e,y:e}))))}const i=_(this.layer.rasterInfo),{scales:s,srcResolutions:r,isCustomTilingScheme:a}=m(this.layer.rasterInfo,t,{tileSize:I,alignGlobalDatasetWithAGOL:!0,limitToSrcResolution:i}),o=c.create({spatialReference:t,size:I,scales:s}),l=new n({x:e.fullExtent.xmin,y:e.fullExtent.ymax,spatialReference:t});(0===o.origin.x||o.origin.x>l.x)&&(o.origin=l),this._isCustomTilingScheme=a,e.set("tileInfo",o),this._srcResolutions=r??[]}_canUseLayerLODs(){const{layer:e,layerView:t}=this;if("Map"!==e.raster.tileType)return!1;const{lods:i}=e.tileInfo,s=t.view.constraints?.effectiveLODs;return s?.length===i.length&&s.every((({scale:e},t)=>Math.abs(e-i[t].scale)<.001))}_computeFetchConcurrency(){const{blockBoundary:e}=this.layer.rasterInfo.storageInfo,t=e[e.length-1];return(t.maxCol-t.minCol+1)*(t.maxRow-t.minRow+1)>64?2:10}async _enqueueTileFetch(e,t){this.updatingHandles.addPromise(this._enqueueTileFetch1(e,t))}async _enqueueTileFetch1(e,t){if(!this._fetchQueue.has(e.key.id)){try{const t=await this._fetchQueue.push(e.key),a=this._getBandIds();let o=!this.useProgressiveUpdate||this.layerView.hasTilingEffects&&!this._globalSymbolizerParams;if(this._globalUpdateRequested&&!this.layerView.moving&&0===this._fetchQueue.length){o=!1;try{await this._redrawImage(this._abortController?.signal)}catch(s){r(s)&&i.getLogger(this).error(s)}this._globalUpdateRequested=!1}!this.canUseWebGLForProcessing()&&"rasterVF"!==this.type||this.layerView.hasTilingEffects||null!=this._symbolizerParams||this._updateSymbolizerParams();const l=this._tileInfoView.getTileCoords(C,e.key),n=this._tileInfoView.getTileResolution(e.key);await this.updateTileSource(e,{source:t,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:o,bandIds:a,coords:l,resolution:n}),e.once("attach",(()=>this.layerView.requestUpdate())),this.container.addChild(e)}catch(s){r(s)||i.getLogger(this).error(s)}this.layerView.requestUpdate()}}async _redrawImage(e){if(0===this.container.children.length)return;await this.layer.updateRenderer(),this.layerView.hasTilingEffects?await this._updateGlobalSymbolizerParams(e):(this._updateSymbolizerParams(),this._globalSymbolizerParams=null);const t=this.container.children.map((async e=>this.updateTileSymbolizerParameters(e,{local:this._symbolizerParams,global:this._globalSymbolizerParams})));await a(t),this.container.requestRender()}async _updateGlobalSymbolizerParams(e){const t={srcResolution:this._srcResolutions[this.previousLOD.level],registryId:this._blockCacheRegistryId,signal:e},i=await this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,t);if(!i||!i.pixelBlock)return;const{resolution:s}=this.previousLOD,r=this._getBandIds(),a=this.layer.symbolizer.generateWebGLParameters({pixelBlock:i.pixelBlock.extractBands(r),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:s,y:s},bandIds:r});!this.canUseWebGLForProcessing()&&a&&"stretch"===a.type&&this.layer.renderer&&"raster-stretch"===this.layer.renderer.type&&(a.factor=a.factor.map((e=>255*e)),a.outMin=Math.round(255*a.outMin),a.outMax=Math.round(255*a.outMax)),this._globalSymbolizerParams=a}_updateSymbolizerParams(){const{resolution:e}=this.previousLOD,t=this._getBandIds();this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:e,y:e},bandIds:t})}_updateBlockCacheRegistry(e=!1){const{layer:t,layerView:i}=this,{url:s,raster:r}=t,{multidimensionalDefinition:a}=t.normalizeRasterFetchOptions({multidimensionalDefinition:t.multidimensionalDefinition,timeExtent:i.timeExtent}),o=r.rasterInfo.multidimensionalInfo?r.getSliceIndex(a):null,l=y(s,o);if(l!==this._blockCacheRegistryUrl){if(null!=this._blockCacheRegistryUrl&&p(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=d(l,r.rasterInfo),e){const{view:e}=i,t=this._tileInfoView.getClosestInfoForScale(e.scale),s=this._srcResolutions[t.level];u(l,this._blockCacheRegistryId,e.extent,e.resolution,s,r.ioConfig.sampling)}this._blockCacheRegistryUrl=l}}async doRefresh(){if(!this.attached)return;await this.layer.updateRenderer(),this.layerView.hasTilingEffects||this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset();const e=[];this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,this._tileStrategy.refresh((t=>e.push(this._enqueueTileFetch(t)))),await a(e)}};e([o()],S.prototype,"_fetchQueue",void 0),e([o()],S.prototype,"_globalUpdateRequested",void 0),e([o()],S.prototype,"attached",void 0),e([o()],S.prototype,"container",void 0),e([o()],S.prototype,"layer",void 0),e([o()],S.prototype,"layerView",void 0),e([o()],S.prototype,"type",void 0),e([o()],S.prototype,"useWebGLForProcessing",null),e([o()],S.prototype,"useProgressiveUpdate",null),e([o()],S.prototype,"timeExtent",void 0),e([o()],S.prototype,"updating",null),S=e([l("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],S);export{S as BaseImageryTileSubView2D};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import{HandleOwner as t}from"../../../../core/HandleOwner.js";import i from"../../../../core/Logger.js";import{debounce as s,isAbortError as r,eachAlways as a}from"../../../../core/promiseUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import n from"../../../../geometry/Point.js";import h from"../../../../layers/support/PixelBlock.js";import c from"../../../../layers/support/TileInfo.js";import{update as u,unregister as p,register as d,getRasterId as y}from"../../../../layers/support/rasterDatasets/RawBlockCache.js";import{getWorldWidth as g,computeProjectedScales as m}from"../../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{isShadedReliefRendererSupported as _}from"../../../../renderers/support/rasterRendererChecks.js";import"../../tiling/PagedTileQueue.js";import f from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import b from"../../tiling/TileQueue.js";import w from"../../tiling/TileStrategy.js";import{TILE_SIZE as I}from"../../engine/webgl/definitions.js";import{getWebGLCapabilities as P}from"../../../webgl/capabilities.js";import C from"../../../../geometry/Extent.js";const R=[0,0];let S=class extends t{constructor(){super(...arguments),this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=[],this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._maxIndexedColormapSize=0,this._rasterFunctionState="na",this._globalUpdateRequested=!1,this.attached=!1,this.timeExtent=null,this.redrawOrRefetch=s((async(e={})=>{if(!this.previousLOD||this.layerView.suspended)return;const t=this._rasterFunctionState;e.reprocess&&(await this.updatingHandles.addPromise(this.layer.updateRasterFunction()),this.updateRasterFunctionParameters());const i=this._rasterFunctionState,{type:s}=this;return e.refetch||"raster"!==s&&!!e.reprocess||"cpu"===i||"cpu"===t?this.updatingHandles.addPromise(this.doRefresh()):this.updatingHandles.addPromise(this._redrawImage(e.signal))}))}get useWebGLForProcessing(){return this._get("useWebGLForProcessing")??!0}set useWebGLForProcessing(e){this._set("useWebGLForProcessing",e)}get useProgressiveUpdate(){return this._get("useProgressiveUpdate")??!0}set useProgressiveUpdate(e){if(this._tileStrategy&&this.useProgressiveUpdate!==e){this._tileStrategy.destroy(),this.container.removeAllChildren();const t=this._getCacheSize(e);this._tileStrategy=new w({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._set("useProgressiveUpdate",e),this.layerView.requestUpdate()}}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume();const{extent:t,resolution:i,scale:s}=e.state,r=this._tileInfoView.getClosestInfoForScale(s);if(this.layer.raster){if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){const e=this._srcResolutions[r.level],s=t.toJSON?t:C.fromJSON(t);u(this._blockCacheRegistryUrl,this._blockCacheRegistryId,s,i,e,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,this.previousLOD?.level!==r.level&&(this.previousLOD=r,null==this._symbolizerParams||this.layerView.hasTilingEffects||this._updateSymbolizerParams(),this._tileStrategy.updateCacheSize(0))}}moveEnd(){!this.layerView.hasTilingEffects&&this.useProgressiveUpdate||(this._abortController&&this._abortController.abort(),this._abortController=new AbortController,0===this._fetchQueue.length&&this._redrawImage(this._abortController.signal).then((()=>{this._globalUpdateRequested=!1,this.layerView.requestUpdate()})));const e=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy.updateCacheSize(e),this.layerView.requestUpdate()}get updating(){return this._fetchQueue?.updating||this._globalUpdateRequested||!(!this.updatingHandles||!this.updatingHandles.updating)}attach(){const e=P("2d");this._maxIndexedColormapSize=4*(e.maxTextureSize||4096),e.supportsTextureFloat||(this.useWebGLForProcessing=!1),this._initializeTileInfo(),this._tileInfoView=new f(this.layerView.tileInfo,this.layerView.fullExtent);const t=this._computeFetchConcurrency();this._fetchQueue=new b({tileInfoView:this._tileInfoView,concurrency:t,process:(e,t)=>this._fetchTile1(e,t)});const i=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new w({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:i,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}detach(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,p(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryUrl=this._blockCacheRegistryId=null}acquireTile(e){const t=this.container.createTile(e);return this._enqueueTileFetch(t),this.layerView.requestUpdate(),this._needBlockCacheUpdate=!0,this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,t}releaseTile(e){this._fetchQueue.abort(e.key.id),this.container.removeChild(e),e.once("detach",(()=>{e.destroy(),this.layerView.requestUpdate()})),this.layerView.requestUpdate()}createEmptyTilePixelBlock(e=null){const t=null==e||e.join(",")===this._tileInfoView.tileInfo.size.join(",");if(t&&null!=this._emptyTilePixelBlock)return this._emptyTilePixelBlock;e=e||this._tileInfoView.tileInfo.size;const[i,s]=e,r=new h({width:i,height:s,pixels:[new Uint8Array(i*s)],mask:new Uint8Array(i*s),pixelType:"u8"});return t&&(this._emptyTilePixelBlock=r),r}_getBandIds(){if(!("rasterFunctionChain"in this.container)||!this.container.rasterFunctionChain)return this.layer.bandIds;const{bandIds:e,raster:t}=this.layer,i="rasterFunction"in t?t.rasterFunction.rawInputBandIds:null;return e?.length&&i?.length&&1!==t.rasterInfo.bandCount?e.map((e=>i[Math.min(e,i.length-1)])):e||i}updateRasterFunctionParameters(){}_fetchTile1(e,t){const i=null!=t?t.signal:null,s=this.canUseWebGLForProcessing(),{layerView:r}=this,{tileInfo:a}=r,o=!a.isWrappable&&null!=g(r.view.spatialReference),l=s&&this.layer.raster.hasUniqueSourceStorageInfo,n={allowPartialFill:!0,datumTransformation:r.datumTransformation,interpolation:s?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:l,skipRasterFunction:"raster"===this.type&&null!=this.container.rasterFunctionChain,signal:i,srcResolution:this._srcResolutions[e.level],timeExtent:r.timeExtent,tileInfo:a,disableWrapAround:o};return this.fetchTile(e,n)}_getCacheSize(e){return e?40:0}_initializeTileInfo(){const{layerView:e}=this,t=e.view.spatialReference;if(this._canUseLayerLODs()){const{origin:i,lods:s}=this.layer.tileInfo,r=s.map((({scale:e})=>e)),a=c.create({spatialReference:t,size:I,scales:r,origin:i});return e.set("tileInfo",a),void(this._srcResolutions=s.map((({resolution:e})=>({x:e,y:e}))))}const i=_(this.layer.rasterInfo),{scales:s,srcResolutions:r,isCustomTilingScheme:a}=m(this.layer.rasterInfo,t,{tileSize:I,alignGlobalDatasetWithAGOL:!0,limitToSrcResolution:i}),o=c.create({spatialReference:t,size:I,scales:s}),l=new n({x:e.fullExtent.xmin,y:e.fullExtent.ymax,spatialReference:t});(0===o.origin.x||o.origin.x>l.x)&&(o.origin=l),this._isCustomTilingScheme=a,e.set("tileInfo",o),this._srcResolutions=r??[]}_canUseLayerLODs(){const{layer:e,layerView:t}=this;if("Map"!==e.raster.tileType)return!1;const{lods:i}=e.tileInfo,s=t.view.constraints?.effectiveLODs;return s?.length===i.length&&s.every((({scale:e},t)=>Math.abs(e-i[t].scale)<.001))}_computeFetchConcurrency(){const{blockBoundary:e}=this.layer.rasterInfo.storageInfo,t=e[e.length-1];return(t.maxCol-t.minCol+1)*(t.maxRow-t.minRow+1)>64?2:10}async _enqueueTileFetch(e,t){this.updatingHandles.addPromise(this._enqueueTileFetch1(e,t))}async _enqueueTileFetch1(e,t){if(!this._fetchQueue.has(e.key.id)){try{const t=await this._fetchQueue.push(e.key),a=this._getBandIds();let o=!this.useProgressiveUpdate||this.layerView.hasTilingEffects&&!this._globalSymbolizerParams;if(this._globalUpdateRequested&&!this.layerView.moving&&0===this._fetchQueue.length){o=!1;try{await this._redrawImage(this._abortController?.signal)}catch(s){r(s)&&i.getLogger(this).error(s)}this._globalUpdateRequested=!1}!this.canUseWebGLForProcessing()&&"rasterVF"!==this.type||this.layerView.hasTilingEffects||null!=this._symbolizerParams||this._updateSymbolizerParams();const l=this._tileInfoView.getTileCoords(R,e.key),n=this._tileInfoView.getTileResolution(e.key);await this.updateTileSource(e,{source:t,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:o,bandIds:a,coords:l,resolution:n}),e.once("attach",(()=>this.layerView.requestUpdate())),this.container.addChild(e)}catch(s){r(s)||i.getLogger(this).error(s)}this.layerView.requestUpdate()}}async _redrawImage(e){if(0===this.container.children.length)return;await this.layer.updateRenderer(),this.layerView.hasTilingEffects?await this._updateGlobalSymbolizerParams(e):(this._updateSymbolizerParams(),this._globalSymbolizerParams=null);const t=this.container.children.map((async e=>this.updateTileSymbolizerParameters(e,{local:this._symbolizerParams,global:this._globalSymbolizerParams})));await a(t),this.container.requestRender()}async _updateGlobalSymbolizerParams(e){const t={srcResolution:this._srcResolutions[this.previousLOD.level],registryId:this._blockCacheRegistryId,signal:e},i=await this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,t);if(!i||!i.pixelBlock)return;const{resolution:s}=this.previousLOD,r=this._getBandIds(),a=this.layer.symbolizer.generateWebGLParameters({pixelBlock:i.pixelBlock.extractBands(r),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:s,y:s},bandIds:r});!this.canUseWebGLForProcessing()&&a&&"stretch"===a.type&&this.layer.renderer&&"raster-stretch"===this.layer.renderer.type&&(a.factor=a.factor.map((e=>255*e)),a.outMin=Math.round(255*a.outMin),a.outMax=Math.round(255*a.outMax)),this._globalSymbolizerParams=a}_updateSymbolizerParams(){const{resolution:e}=this.previousLOD,t=this._getBandIds();this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:e,y:e},bandIds:t})}_updateBlockCacheRegistry(e=!1){const{layer:t,layerView:i}=this,{url:s,raster:r}=t,{multidimensionalDefinition:a}=t.normalizeRasterFetchOptions({multidimensionalDefinition:t.multidimensionalDefinition,timeExtent:i.timeExtent}),o=r.rasterInfo.multidimensionalInfo?r.getSliceIndex(a):null,l=y(s,o);if(l!==this._blockCacheRegistryUrl){if(null!=this._blockCacheRegistryUrl&&p(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=d(l,r.rasterInfo),e){const{view:e}=i,t=this._tileInfoView.getClosestInfoForScale(e.scale),s=this._srcResolutions[t.level];u(l,this._blockCacheRegistryId,e.extent,e.resolution,s,r.ioConfig.sampling)}this._blockCacheRegistryUrl=l}}async doRefresh(){if(!this.attached)return;await this.layer.updateRenderer(),this.layerView.hasTilingEffects||this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset();const e=[];this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,this._tileStrategy.refresh((t=>e.push(this._enqueueTileFetch(t)))),await a(e)}};e([o()],S.prototype,"_fetchQueue",void 0),e([o()],S.prototype,"_globalUpdateRequested",void 0),e([o()],S.prototype,"attached",void 0),e([o()],S.prototype,"container",void 0),e([o()],S.prototype,"layer",void 0),e([o()],S.prototype,"layerView",void 0),e([o()],S.prototype,"type",void 0),e([o()],S.prototype,"useWebGLForProcessing",null),e([o()],S.prototype,"useProgressiveUpdate",null),e([o()],S.prototype,"timeExtent",void 0),e([o()],S.prototype,"updating",null),S=e([l("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],S);export{S as BaseImageryTileSubView2D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as t}from"../../../../core/accessorSupport/decorators/subclass.js";import{RasterTileContainer as s}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as i}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as t}from"../../../../core/accessorSupport/decorators/subclass.js";import{RasterTileContainer as s}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as i}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as o}from"../support/util.js";let n=class extends i{constructor(){super(...arguments),this.type="raster"}attach(){super.attach(),this.container=new s(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this.updateRasterFunctionParameters()}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}canUseWebGLForProcessing(){const{symbolizer:e}=this.layer,r=e.lookup?.colormapLut?.indexedColormap,t=r&&r.length>this._maxIndexedColormapSize;return this.useWebGLForProcessing&&e.canRenderInWebGL&&!t&&!("majority"===this.layer.interpolation&&o(this.layer))}fetchTile(e,r){return this.layer.fetchTile(e.level,e.row,e.col,r)}updateRasterFunctionParameters(){const{raster:e,type:r}=this.layer,{container:t}=this;if("Function"!==e.datasetFormat||"wcs"===r)return t.rasterFunctionChain=null,t.children.forEach((e=>{const{bitmap:r}=e;r&&(r.suspended=!0,r.processed=!1,r.projected&&(r.invalidateTexture(),r.rasterTexture=null))})),void(this._rasterFunctionState="na");const s=this._rasterFunctionState,{rasterFunction:i,primaryRasters:o}=e,n=i.supportsGPU&&(!o||o.rasters.length<=1),a=n?i.flatWebGLFunctionChain:null,{renderer:l}=this.layer,c=!n||!a?.functions.length||"raster-stretch"===l?.type&&l.dynamicRangeAdjustment||!this.canUseWebGLForProcessing();t.rasterFunctionChain=c?null:a;const u=null==i?"na":t.rasterFunctionChain?"gpu":"cpu";t.children.forEach((e=>{const{bitmap:r}=e;r&&(r.suspended=s!==u,r.processed=!1,r.processedTexture=null)})),this._rasterFunctionState=u}async updateTileSource(e,r){const t=this._getBandIds(),s=this._getLayerInterpolation(),i=this.canUseWebGLForProcessing(),{source:o,globalSymbolizerParams:n,suspended:a,coords:l,resolution:c}=r,u=this.layerView.hasTilingEffects?n:r.symbolizerParams,{bitmap:p}=e;if([p.x,p.y]=l,p.resolution=c,o&&null!=o&&null!=o.pixelBlock){const e={extent:o.extent,pixelBlock:o.pixelBlock};if(p.rawPixelData=e,i)p.source=o.pixelBlock,p.isRendereredSource=!1;else{const r=await this.layer.applyRenderer(e,"stretch"===n?.type?n:void 0);p.source=r,p.isRendereredSource=!0}p.symbolizerParameters=i?u:null,i?p.transformGrid||(p.transformGrid=o.transformGrid):p.transformGrid=null}else{const e=this.createEmptyTilePixelBlock();p.source=e,p.symbolizerParameters=i?u:null,p.transformGrid=null}p.bandIds=i?t:null,p.width=this._tileInfoView.tileInfo.size[0],p.height=this._tileInfoView.tileInfo.size[1],p.interpolation=s,p.suspended=a,p.invalidateTexture()}async updateTileSymbolizerParameters(e,r){const{local:t,global:s}=r,i=this._getBandIds(),o=this._getLayerInterpolation(),n=this.canUseWebGLForProcessing(),{bitmap:a}=e,{rawPixelData:l}=a;n||null==l?(a.isRendereredSource&&null!=l&&(a.source=l.pixelBlock),a.isRendereredSource=!1):(a.source=await this.layer.applyRenderer(l,"stretch"===s?.type?s:void 0),a.isRendereredSource=!0),a.symbolizerParameters=n?this.layerView.hasTilingEffects?s:t:null,a.bandIds=n?i:null,a.interpolation=o,a.suspended=!1}_getLayerInterpolation(){const{interpolation:e,renderer:r}=this.layer;if(!r)return e;const t=r.type;return"raster-colormap"===t||"unique-value"===t||"class-breaks"===t?"nearest":"raster-stretch"===r.type&&null!=r.colorRamp?"bilinear"===e||"cubic"===e?"bilinear":"nearest":e}};e([r()],n.prototype,"container",void 0),e([r()],n.prototype,"layer",void 0),e([r()],n.prototype,"type",void 0),n=e([t("esri.views.2d.layers.imagery.ImageryTileView2D")],n);const a=n;export{a as default};
|