@arcgis/core 4.23.0-next.20211229 → 4.23.0-next.20220105
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/{12df4f05de1262f9940f.js → 0ce1dc14280d6f188468.js} +1 -1
- package/assets/esri/core/workers/chunks/{1baa6d8befbd0787c24e.js → 35961690afe9ea1f91b0.js} +1 -1
- package/assets/esri/core/workers/chunks/{86783c9b51dde845c24f.js → 7bd4c3ee43fb038b88d8.js} +1 -1
- package/interfaces.d.ts +24 -100
- package/layers/GroupLayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/package.json +1 -1
- package/renderers/support/rasterRendererHelper.js +1 -1
- package/rest/utils.js +1 -1
- package/smartMapping/raster/renderers/classBreaks.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/flow/AnimatedFlowView2D.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/lib/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
package/interfaces.d.ts
CHANGED
|
@@ -135,6 +135,29 @@ declare namespace __esri {
|
|
|
135
135
|
|
|
136
136
|
type DateProperties = number | string | Date;
|
|
137
137
|
|
|
138
|
+
interface ReactionOptions {
|
|
139
|
+
initial?: boolean;
|
|
140
|
+
sync?: boolean;
|
|
141
|
+
once?: boolean;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
interface ReactiveListenerOptions<Target> {
|
|
145
|
+
sync?: boolean;
|
|
146
|
+
once?: boolean;
|
|
147
|
+
onListenerAdd?: (target: Target) => void;
|
|
148
|
+
onListenerRemove?: (target: Target) => void;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
interface reactiveUtils {
|
|
152
|
+
watch<T>(getValue: () => T, callback: (newValue?: T, oldValue?: T) => void, options?: ReactionOptions): IHandle;
|
|
153
|
+
when<T>(getValue: () => T, callback: (newValue?: T, oldValue?: T) => void, options?: ReactionOptions): IHandle;
|
|
154
|
+
on<T extends Evented | EventTarget>(getTarget: () => T | null | undefined, eventName: string, callback: (value: any) => void, options?: ReactiveListenerOptions<T>): IHandle;
|
|
155
|
+
once<T>(getValue: () => T, signal?: AbortSignal | { signal?: AbortSignal } | null): Promise<T>;
|
|
156
|
+
whenOnce<T>(getValue: () => T, signal?: AbortSignal | { signal?: AbortSignal } | null): Promise<T>;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export const reactiveUtils: reactiveUtils;
|
|
160
|
+
|
|
138
161
|
/**
|
|
139
162
|
* An object describing the parameter values for the [attributeParameterValues](global.html#attributeParameterValues) property of [RouteParameters](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RouteParameters.html).
|
|
140
163
|
*
|
|
@@ -933,7 +956,7 @@ declare namespace __esri {
|
|
|
933
956
|
export type WatchCallback = (newValue: any, oldValue: any, propertyName: string, target: Accessor) => void;
|
|
934
957
|
|
|
935
958
|
/**
|
|
936
|
-
* Represents a watch
|
|
959
|
+
* Represents a watch or event handler which can be removed.
|
|
937
960
|
*
|
|
938
961
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Accessor.html#WatchHandle)
|
|
939
962
|
*/
|
|
@@ -1430,105 +1453,6 @@ declare namespace __esri {
|
|
|
1430
1453
|
export type RejectCallback = (error?: any) => void;
|
|
1431
1454
|
export type ResolveCallback = (value?: any | Promise<any>) => void;
|
|
1432
1455
|
|
|
1433
|
-
/**
|
|
1434
|
-
* Various utilities and convenience functions for watching [Accessor](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Accessor.html) properties.
|
|
1435
|
-
*
|
|
1436
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html)
|
|
1437
|
-
*/
|
|
1438
|
-
interface reactiveUtils {
|
|
1439
|
-
/**
|
|
1440
|
-
* Watches the value returned by the `getTarget` function for changes and automatically adds or removes an event listener for a given event, as needed.
|
|
1441
|
-
*
|
|
1442
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#on)
|
|
1443
|
-
*/
|
|
1444
|
-
on(getTarget: OnExpression, eventName: string, callback: OnCallback, options?: ListenerOptions): WatchHandle;
|
|
1445
|
-
/**
|
|
1446
|
-
* Tracks any properties accessed when getting the value and returns a promise which resolves with the value returned by `getValue()` when it changes.
|
|
1447
|
-
*
|
|
1448
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#once)
|
|
1449
|
-
*/
|
|
1450
|
-
once(getValue: WatchExpression, signal?: AbortSignal): Promise<any>;
|
|
1451
|
-
/**
|
|
1452
|
-
* Tracks any properties accessed when getting the value and calls the callback when any of them change.
|
|
1453
|
-
*
|
|
1454
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#watch)
|
|
1455
|
-
*/
|
|
1456
|
-
watch(getValue: WatchExpression, callback: reactiveUtilsWatchCallback, options?: WatchOptions): WatchHandle;
|
|
1457
|
-
/**
|
|
1458
|
-
* Watches the value returned by the `getValue` function and calls the callback when it becomes truthy.
|
|
1459
|
-
*
|
|
1460
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#when)
|
|
1461
|
-
*/
|
|
1462
|
-
when(getValue: WatchExpression, callback: reactiveUtilsWatchCallback, options?: WatchOptions): WatchHandle;
|
|
1463
|
-
/**
|
|
1464
|
-
* Tracks any properties accessed when getting the value and returns a promise which resolves with the value returned by `getValue()` when it changes.
|
|
1465
|
-
*
|
|
1466
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#whenOnce)
|
|
1467
|
-
*/
|
|
1468
|
-
whenOnce(getValue: WatchExpression, signal?: AbortSignal): Promise<any>;
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
export const reactiveUtils: reactiveUtils;
|
|
1472
|
-
export type EqualityFunction = (newValue: any, oldValue: any) => boolean;
|
|
1473
|
-
export type ListenerChangeCallback = (target?: any) => void;
|
|
1474
|
-
|
|
1475
|
-
/**
|
|
1476
|
-
* Options used to configure the behavior of module:esri/core/reactiveUtils#on.
|
|
1477
|
-
*
|
|
1478
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#ListenerOptions)
|
|
1479
|
-
*/
|
|
1480
|
-
export interface ListenerOptions extends Object {
|
|
1481
|
-
/**
|
|
1482
|
-
* Whether to fire the callback synchronously or on the next tick.
|
|
1483
|
-
*
|
|
1484
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#ListenerOptions)
|
|
1485
|
-
*/
|
|
1486
|
-
sync?: boolean;
|
|
1487
|
-
/**
|
|
1488
|
-
* Whether to fire the callback only once.
|
|
1489
|
-
*
|
|
1490
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#ListenerOptions)
|
|
1491
|
-
*/
|
|
1492
|
-
once?: boolean;
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
export type OnCallback = (event: any) => void;
|
|
1496
|
-
export type OnExpression = () => Evented;
|
|
1497
|
-
export type reactiveUtilsWatchCallback = (newValue: any, oldValue: any) => void;
|
|
1498
|
-
export type WatchExpression = () => any;
|
|
1499
|
-
|
|
1500
|
-
/**
|
|
1501
|
-
* Options used to configure how auto-tracking is performed and how the callback should be called.
|
|
1502
|
-
*
|
|
1503
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#WatchOptions)
|
|
1504
|
-
*/
|
|
1505
|
-
export interface WatchOptions extends Object {
|
|
1506
|
-
/**
|
|
1507
|
-
* Whether to fire the callback immediately after initialization, if the necessary conditions are met.
|
|
1508
|
-
*
|
|
1509
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#WatchOptions)
|
|
1510
|
-
*/
|
|
1511
|
-
initial?: boolean;
|
|
1512
|
-
/**
|
|
1513
|
-
* Whether to fire the callback synchronously or on the next tick.
|
|
1514
|
-
*
|
|
1515
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#WatchOptions)
|
|
1516
|
-
*/
|
|
1517
|
-
sync?: boolean;
|
|
1518
|
-
/**
|
|
1519
|
-
* Whether to fire the callback only once.
|
|
1520
|
-
*
|
|
1521
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#WatchOptions)
|
|
1522
|
-
*/
|
|
1523
|
-
once?: boolean;
|
|
1524
|
-
/**
|
|
1525
|
-
* Function used to check whether two values are the same, in which case the callback isn't called.
|
|
1526
|
-
*
|
|
1527
|
-
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#WatchOptions)
|
|
1528
|
-
*/
|
|
1529
|
-
equals?: EqualityFunction;
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
1456
|
/**
|
|
1533
1457
|
* Various utilities and convenience functions for executing code at various phases of browser frames.
|
|
1534
1458
|
*
|
package/layers/GroupLayer.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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as i}from"../chunks/tslib.es6.js";import{loadAll as e}from"../core/loadAll.js";import{isSome as t}from"../core/maybe.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import{getProperties as o}from"../core/accessorSupport/utils.js";import"../core/accessorSupport/ensureType.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../core/accessorSupport/decorators/writer.js";import p from"./Layer.js";import{BlendLayer as n}from"./mixins/BlendLayer.js";import{OperationalLayer as y}from"./mixins/OperationalLayer.js";import{PortalLayer as h}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as c}from"./mixins/ScaleRangeLayer.js";import{LayersMixin as d}from"../support/LayersMixin.js";import{TablesMixin as b}from"../support/TablesMixin.js";import{getLayerJSON as v}from"../webdoc/support/writeUtils.js";let m=class extends(n(c(y(h(b(d(s(p)))))))){constructor(i){super(i),this._visibilityHandles={},this.fullExtent=void 0,this.operationalLayerType="GroupLayer",this.spatialReference=void 0,this.type="group",this._visibilityWatcher=this._visibilityWatcher.bind(this)}initialize(){this._enforceVisibility(this.visibilityMode,this.visible),this.watch("visible",this._visibleWatcher.bind(this),!0)}_writeLayers(i,e,s,r){const o=[];if(!i)return o;i.forEach((i=>{const e=v(i,r.webmap?r.webmap.getLayerJSONFromResourceInfo(i):null,r);t(e)&&e.layerType&&o.push(e)})),e.layers=o}set portalItem(i){this._set("portalItem",i)}set visibilityMode(i){const e=this._get("visibilityMode")!==i;this._set("visibilityMode",i),e&&this._enforceVisibility(i,this.visible)}load(i){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"]},i)),Promise.resolve(this)}loadAll(){return e(this,(i=>{i(this.layers)}))}layerAdded(i){i.visible&&"exclusive"===this.visibilityMode?this._turnOffOtherLayers(i):"inherited"===this.visibilityMode&&(i.visible=this.visible),this._visibilityHandles[i.uid]=i.watch("visible",this._visibilityWatcher,!0)}layerRemoved(i){const e=this._visibilityHandles[i.uid];e&&(e.remove(),delete this._visibilityHandles[i.uid]),this._enforceVisibility(this.visibilityMode,this.visible)}_turnOffOtherLayers(i){this.layers.forEach((e=>{e!==i&&(e.visible=!1)}))}_enforceVisibility(i,e){if(!o(this).initialized)return;const t=this.layers;let s=t.find((i=>i.visible));switch(i){case"exclusive":t.length&&!s&&(s=t.getItemAt(0),s.visible=!0),this._turnOffOtherLayers(s);break;case"inherited":t.forEach((i=>{i.visible=e}))}}_visibleWatcher(i){"inherited"===this.visibilityMode&&this.layers.forEach((e=>{e.visible=i}))}_visibilityWatcher(i,e,t,s){const r=s;switch(this.visibilityMode){case"exclusive":i?this._turnOffOtherLayers(r):this._isAnyLayerVisible()||(r.visible=!0);break;case"inherited":r.visible=this.visible}}_isAnyLayerVisible(){return this.layers.some((i=>i.visible))}};i([r()],m.prototype,"fullExtent",void 0),i([r({json:{read:!1,write:{ignoreOrigin:!0}}})],m.prototype,"layers",void 0),i([a("layers")],m.prototype,"_writeLayers",null),i([r({type:["GroupLayer"]})],m.prototype,"operationalLayerType",void 0),i([r({json:{origins:{"web-document":{read:!1,write:!1}}}})],m.prototype,"portalItem",null),i([r()],m.prototype,"spatialReference",void 0),i([r({json:{read:!1},readOnly:!0,value:"group"})],m.prototype,"type",void 0),i([r({type:["independent","inherited","exclusive"],value:"independent",json:{write:!0,origins:{"web-map":{read:!1,write:!1}}}})],m.prototype,"visibilityMode",null),m=i([l("esri.layers.GroupLayer")],m);const u=m;export{u as default};
|
|
5
|
+
import{_ as i}from"../chunks/tslib.es6.js";import{loadAll as e}from"../core/loadAll.js";import{isSome as t}from"../core/maybe.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import{getProperties as o}from"../core/accessorSupport/utils.js";import"../core/accessorSupport/ensureType.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../core/accessorSupport/decorators/writer.js";import p from"./Layer.js";import{BlendLayer as n}from"./mixins/BlendLayer.js";import{OperationalLayer as y}from"./mixins/OperationalLayer.js";import{PortalLayer as h}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as c}from"./mixins/ScaleRangeLayer.js";import{LayersMixin as d}from"../support/LayersMixin.js";import{TablesMixin as b}from"../support/TablesMixin.js";import{getLayerJSON as v}from"../webdoc/support/writeUtils.js";let m=class extends(n(c(y(h(b(d(s(p)))))))){constructor(i){super(i),this._visibilityHandles={},this.fullExtent=void 0,this.operationalLayerType="GroupLayer",this.spatialReference=void 0,this.type="group",this._visibilityWatcher=this._visibilityWatcher.bind(this)}initialize(){this._enforceVisibility(this.visibilityMode,this.visible),this.watch("visible",this._visibleWatcher.bind(this),!0)}_writeLayers(i,e,s,r){const o=[];if(!i)return o;i.forEach((i=>{const e=v(i,r.webmap?r.webmap.getLayerJSONFromResourceInfo(i):null,r);t(e)&&e.layerType&&o.push(e)})),e.layers=o}set portalItem(i){this._set("portalItem",i)}set visibilityMode(i){const e=this._get("visibilityMode")!==i;this._set("visibilityMode",i),e&&this._enforceVisibility(i,this.visible)}load(i){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"]},i)),Promise.resolve(this)}loadAll(){return e(this,(i=>{i(this.layers,this.tables)}))}layerAdded(i){i.visible&&"exclusive"===this.visibilityMode?this._turnOffOtherLayers(i):"inherited"===this.visibilityMode&&(i.visible=this.visible),this._visibilityHandles[i.uid]=i.watch("visible",this._visibilityWatcher,!0)}layerRemoved(i){const e=this._visibilityHandles[i.uid];e&&(e.remove(),delete this._visibilityHandles[i.uid]),this._enforceVisibility(this.visibilityMode,this.visible)}_turnOffOtherLayers(i){this.layers.forEach((e=>{e!==i&&(e.visible=!1)}))}_enforceVisibility(i,e){if(!o(this).initialized)return;const t=this.layers;let s=t.find((i=>i.visible));switch(i){case"exclusive":t.length&&!s&&(s=t.getItemAt(0),s.visible=!0),this._turnOffOtherLayers(s);break;case"inherited":t.forEach((i=>{i.visible=e}))}}_visibleWatcher(i){"inherited"===this.visibilityMode&&this.layers.forEach((e=>{e.visible=i}))}_visibilityWatcher(i,e,t,s){const r=s;switch(this.visibilityMode){case"exclusive":i?this._turnOffOtherLayers(r):this._isAnyLayerVisible()||(r.visible=!0);break;case"inherited":r.visible=this.visible}}_isAnyLayerVisible(){return this.layers.some((i=>i.visible))}};i([r()],m.prototype,"fullExtent",void 0),i([r({json:{read:!1,write:{ignoreOrigin:!0}}})],m.prototype,"layers",void 0),i([a("layers")],m.prototype,"_writeLayers",null),i([r({type:["GroupLayer"]})],m.prototype,"operationalLayerType",void 0),i([r({json:{origins:{"web-document":{read:!1,write:!1}}}})],m.prototype,"portalItem",null),i([r()],m.prototype,"spatialReference",void 0),i([r({json:{read:!1},readOnly:!0,value:"group"})],m.prototype,"type",void 0),i([r({type:["independent","inherited","exclusive"],value:"independent",json:{write:!0,origins:{"web-map":{read:!1,write:!1}}}})],m.prototype,"visibilityMode",null),m=i([l("esri.layers.GroupLayer")],m);const u=m;export{u as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{read as r,rasterRendererTypes as i,websceneRasterRendererTypes as s}from"../../rasterRenderers.js";import n from"../../request.js";import a from"../../core/Error.js";import{strict as o}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{when as d}from"../../core/promiseUtils.js";import{urlToObject as h}from"../../core/urlUtils.js";import{aliasOf as f}from"../../core/accessorSupport/decorators/aliasOf.js";import{ensureClass as y,Integer as g,ensureNumber as R}from"../../core/accessorSupport/ensureType.js";import{property as v,ensureRange as x}from"../../core/accessorSupport/decorators/property.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as S}from"../../core/accessorSupport/decorators/subclass.js";import{writer as I}from"../../core/accessorSupport/decorators/writer.js";import{opacity as w,url as _}from"../support/commonProperties.js";import F from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as O}from"../support/ExportImageServiceParameters.js";import P from"../support/Field.js";import T from"../support/FieldsIndex.js";import{isSupportedRendererType as D}from"../support/imageryRendererUtils.js";import N from"../support/MosaicRule.js";import j from"../support/PixelBlock.js";import{interpolationKebab as C,noDataInterpretationKebab as M}from"../support/rasterEnums.js";import J from"../support/RasterFunction.js";import q from"../support/RasterInfo.js";import V from"../support/RasterJobHandler.js";import{decode as A,getFormat as z}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as Q}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as E,getDefaultBandCombination as U,createDefaultRenderer as H,normalizeRendererJSON as L}from"../../renderers/support/rasterRendererHelper.js";import k from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as B,computePixelSpaceLocations as G,computeHistograms as W,computeStatisticsHistograms as X,getImageSpatialReferenceQueryParameter as Y,getSamples as K,identify as $}from"../../rest/imageService.js";import"../../core/unitUtils.js";import"../../kernel.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as Z}from"../../rest/query/executeForCount.js";import ee from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import te from"../../geometry/Point.js";import re from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../support/arcgisLayerUrl.js";import"../../core/pbf.js";import"../../geometry/support/spatialReferenceUtils.js";import ie from"../../rest/support/Query.js";import{executeForIds as se}from"../../rest/query/executeForIds.js";import{executeQueryJSON as ne}from"../../rest/query/executeQueryJSON.js";import"../../core/has.js";import"../graphics/featureConversionUtils.js";import ae from"../../rest/support/FeatureSet.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import oe from"../../rest/support/ImageAngleParameters.js";import le from"../../rest/support/ImageHistogramParameters.js";import ue from"../../rest/support/ImageIdentifyParameters.js";import pe from"../../rest/support/ImagePixelLocationParameters.js";import ce from"../../rest/support/ImageSampleParameters.js";import{createStreamlinesMesh as me}from"../../views/2d/engine/flow/dataUtils.js";import de from"../../geometry/SpatialReference.js";const he=u.getLogger("esri.layers.mixins.ArcGISImageService"),fe=o()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),ye=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),ge=x(R,{min:0,max:255});function Re(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),r=null==t?void 0:t.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return r?r.join("/"):null}const ve=o=>{let u=class extends o{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._symbolizer=null,this._defaultServiceMosaicRule=null,this._serviceSourceType=null,this._serviceSupportsMosaicRule=null,this.rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandCount=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelSizeX=null,this.pixelSizeY=null,this.pixelFilter=null,this.raster=void 0,this.viewId=void 0,this.renderer=null,this.rasterAttributeTable=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=null}initialize(){this._set("exportImageServiceParameters",new O({layer:this}))}readDefaultServiceMosaicRule(e,t){return this._serviceSupportsMosaicRule?N.fromJSON(t):null}readServiceSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get fieldsIndex(){return this.fields?new T(this.fields):null}set format(e){e&&ye.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=N.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?N.fromJSON(r):this._isMosaicRuleSupported(t)?N.fromJSON(t):null}writeMosaicRule(e,t,r){let i=this.mosaicRule;const s=this.definitionExpression;i?s&&s!==i.where&&(i=i.clone(),i.where=s):s&&(i=new N({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=ge(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return this.url?h(this.url):null}readRenderer(e,t,i){var s,n;const a=null==t||null==(s=t.layerDefinition)||null==(n=s.drawingInfo)?void 0:n.renderer,o=r(a,i);return null==o?null:("vector-field"===o.type&&t.symbolTileSize&&!a.symbolTileSize&&(o.symbolTileSize=t.symbolTileSize),D(o)||he.warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),o)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this.rasterAttributeTableFieldPrefix||"Raster.",t=new P({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new P({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new P({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(r),this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new P({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),null==this.pixelFilter||"esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType||(s.push(new P({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new P({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const n=this.rasterInfo.attributeTable&&this.rasterInfo.attributeTable.fields||null;if(n&&n.length>0){const t=n.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=J.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?J.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){this._isRFTJson(e)||(t[r]=e.toJSON())}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?de.fromJSON(r):null}readPixelType(e){return fe.fromJSON(e)||e}writePixelType(e,t,r){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=fe.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;if(!this._isPicture()&&this.renderer&&this._symbolizer&&!this.pixelFilter){const i=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(this.renderer.toJSON()),s=this._rasterJobHandler.instance,{bandIds:n}=this;if(s){i&&(this._symbolizer.bind(),await s.updateSymbolizer(this._symbolizer,t),this._cachedRendererJson=this.renderer.toJSON());const a=await s.symbolize({bandIds:n,...e},t);r={extent:e.extent,pixelBlock:a}}else r={extent:e.extent,pixelBlock:this._symbolizer.symbolize({bandIds:n,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeAngles)throw new a("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=y(oe,e).clone(),B(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputePixelLocation)throw new a("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=y(pe,e).clone(),G(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeHistograms)throw new a("imagery-layer:compute-histograms","this operation is not supported on the input image service");e=y(le,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),W(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeStatisticsHistograms)throw new a("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");e=y(le,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),X(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)return Promise.reject(new a("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required."));const s=this.renderer||this._symbolizer?this.generateRasterInfo(this.renderingRule,{signal:i.signal}):null;return d(s).then((s=>{s&&(this.rasterInfo=s);const n={imageServiceParameters:this.getExportImageServiceParameters(e,t,r,i.timeExtent),imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}))}fetchKeyProperties(e){const t=e&&e.renderingRule&&e.renderingRule.toJSON();return n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3&&t?JSON.stringify(t):null})}).then((e=>e.data))}fetchRasterAttributeTable(e){const t=e&&e.renderingRule&&e.renderingRule.toJSON();return this.version<10.1?Promise.reject(new a("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3&&t?JSON.stringify(t):null})}).then((e=>ae.fromJSON(e.data)))}async getCatalogItemRasterInfo(e,t){const r=n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t}).then((e=>e.data)),i=n(this.parsedUrl.path+"/"+e+"/info/keyProperties",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>{})),s=await Promise.all([r,i]);if(!s[0])return;const a=ee.fromJSON(s[0].extent),o=s[0].statistics?s[0].statistics.map((e=>({min:e[0],max:e[1],avg:e[2],stddev:e[3]}))):null;return new q({bandCount:s[0].bandCount,extent:a,spatialReference:a.sr,pixelSize:new te({x:s[0].pixelSizeX,y:s[0].pixelSizeY,spatialReference:a.sr}),pixelType:s[0].pixelType.toLowerCase(),statistics:o,histograms:s[0].histograms,keyProperties:s[1]||{}})}async getCatalogItemICSInfo(e,t){const{data:r}=await n(this.parsedUrl.path+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?n(this.parsedUrl.path+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},o=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},u=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},y=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),g=await Promise.all([a,u,y]);let R=g[0].ipxf;if(null==R){var v,x,b;const e=null==(v=i.geodataXform)?void 0:v.xf_0;"topup"===(null==e||null==(x=e.name)?void 0:x.toLowerCase())&&6===(null==e||null==(b=e.coefficients)?void 0:b.length)&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const S=ee.fromJSON(g[1]&&g[1].geometries&&g[1].geometries[0]);S&&(S.spatialReference=new de({wkid:0,imageCoordinateSystem:i}));const I=g[2].geometries?g[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],w=I.length;if(w<3)return{ics:i,icsToPixelTransform:R,icsExtent:S,northDirection:null};let _=0,F=0,O=0,P=0;for(let n=0;n<w;n++)_+=I[n].x,F+=I[n].y,O+=I[n].x*I[n].x,P+=I[n].x*I[n].y;const T=(w*P-_*F)/(w*O-_*_);let D=0;const N=I[p-1].x>I[0].x,j=I[p-1].y>I[0].y;return T===1/0?D=j?90:270:0===T?D=N?0:180:T>0?D=N?180*Math.atan(T)/Math.PI:180*Math.atan(T)/Math.PI+180:T<0&&(D=j?180+180*Math.atan(T)/Math.PI:360+180*Math.atan(T)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:S,northDirection:D}}async generateRasterInfo(e,t){if((!e||"none"===e.functionName.toLowerCase()||this._isVectorFieldResampleFunction(e))&&p(this.serviceRasterInfo))return this.serviceRasterInfo;const r=Re(e);if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i=this._generateRasterInfo(e,t);this._functionRasterInfos[r]=i;try{return await i}catch{return this._functionRasterInfos[r]=null,null}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=Y(e.spatialReference,this.parsedUrl.path);p(this.serviceRasterInfo)&&this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:a,noData:o}=n;let{renderingRule:l}=n;const u=this.renderingRule&&"none"!==this.renderingRule.functionName.toLowerCase(),c=!this.renderer||"raster-stretch"===this.renderer.type;if(null!=a&&a.length&&u&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:a}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===(null==t?void 0:t.rasterFunction)?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=null==a?void 0:a.join(",");o instanceof Array&&o.length>0&&(n.noData=o.join(","));const m=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i):null;n.mosaicRule=m&&JSON.stringify(m),n.renderingRule=l&&JSON.stringify(l);const d={};if(i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${null==e?"null":e},${null==t?"null":t}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+r,...n,...d}}async getSamples(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsGetSamples)throw new a("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=y(ce,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),K(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsIdentify)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");e=y(ue,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=m(t)}return r&&null==e.raster&&(e.raster=r),$(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new ie;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ne(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),se(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Z(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new a("imagery-layer: query-visible-rasters","missing query parameter");const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const m="raster.servicepixelvalue",d=this.rasterFunctionNamesIndex;if(p(e.outFields)&&(o=e.outFields.some((e=>-1===e.toLowerCase().indexOf(m))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().indexOf(m)>-1&&e.length>m.length)).map((e=>{const t=e.slice(m.length+1);return[this._updateRenderingRulesFunctionName(t,d),t]}));l=t.map((e=>new J({functionName:e[0]}))),u=t.map((e=>e[1])),0===l.length?this.renderingRule?(l.push(this.renderingRule),u.push(this.renderingRule.functionName)):l=null:this.renderingRule&&!l.some((e=>e.functionName===this.renderingRule.functionName))&&(l.push(this.renderingRule),u.push(this.renderingRule.functionName))}const h=c(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),f=e.timeExtent||this.timeExtent,y=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,f),g=this._getQueryParams({geometry:e.geometry,timeExtent:f,mosaicRule:y,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:r,returnCatalogItems:o,returnGeometry:h,raster:this.raster,maxItemCount:s?1:null});delete g.f;const R=new ue(g);try{var v,x;await this.generateRasterInfo(this.renderingRule);const r=await $(this.url,R,{signal:null==t?void 0:t.signal,query:{...this.customParameters}}),s=e.outFields,a=r.value.toLowerCase().indexOf("nodata")>-1;if(!(o&&!h&&(null==r||null==(v=r.catalogItems)?void 0:v.features.length)&&(n||!a)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=r.catalogItems.features,m=c.map((e=>{var t;return null==(t=e.attributes)?void 0:t[l]})),d=new ie({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),f=await this.queryRasters(d);return null!=f&&null!=(x=f.features)&&x.length&&f.features.forEach((t=>{c.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new re(t.geometry),p(e.outSpatialReference)&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new a("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(this.parsedUrl.path+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.statistics})),i=n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createStreamlinesMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createStreamlinesMesh(e,t):me(e.rendererSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}async _fetchService(e){await this._fetchServiceInfo(e),p(this.serviceRasterInfo)&&!this.rasterInfo&&(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):this._fetchAuxiliaryRasterInfo({serviceInfo:t,signal:e}).then((e=>(this._set("serviceRasterInfo",e),e))),i=this.renderingRule&&"none"!==this.renderingRule.functionName.toLowerCase()?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this.renderer=null,he.warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._configDefaultRenderer(),this.watch("renderer",(()=>this._configDefaultRenderer())),this.watch("renderingRule",(e=>{(this.renderer||this._symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}));const t=p(this.serviceRasterInfo)&&this.serviceRasterInfo.multidimensionalInfo;t&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo;if(c(e)||c(this.multidimensionalInfo)||c(t)||c(null==r?void 0:r.startField))return e;const{startField:i}=r;var s;if(e=e.clone(),"mosaic-dataset"===this._serviceSourceType)return e.multidimensionalDefinition=null==(s=e.multidimensionalDefinition)?void 0:s.filter((e=>e.dimensionName!==i)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const n=e.multidimensionalDefinition.filter((e=>e.dimensionName===i)),a=p(t.start)?t.start.getTime():null,o=p(t.end)?t.end.getTime():null,l=null==a||null==o||a===o,u=l?[a||o]:[[a,o]],m=this.version>=10.8;if(n.length)n.forEach((e=>{e.dimensionName===i&&(m?(e.dimensionName=null,e.isSlice=null,e.values=null):(e.isSlice=l,e.values=u))}));else if(!m){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=i,e.isSlice=l,e.values=u})):e.multidimensionalDefinition.push(new F({variableName:"",dimensionName:i,isSlice:l,values:u}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this._serviceSourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){var r;if(await this._fetchCapabilities(null==(r=t)?void 0:r.signal),!this.capabilities.operations.supportsQuery)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?y(ie,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new V;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>null)),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&r&&"none"!==r.functionName.toLowerCase()&&1===t.bandCount&&["u8","s8"].includes(t.pixelType)||E(this.rasterInfo).includes(this.renderer.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){var t;let r=this.sourceJSON;if(!r){const{data:t,ssl:i}=await n(this.parsedUrl.path,{query:this._getQueryParams(),signal:e});r=t,this.sourceJSON=r,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if((null==(t=r.capabilities)?void 0:t.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly"))>-1)throw new a("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(r,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){var t;return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:(null==(t=e.fields)?void 0:t.length)>0}_isMosaicRuleSupported(e){var t;if(!e)return!1;const r=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&e.timeInfo&&!(e.objectIdField&&(null==(t=e.fields)?void 0:t.length)>1);return r||i}_isVectorFieldResampleFunction(e){if(!p(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t.toLowerCase(),s=(null==r?void 0:r.ResampleType)||(null==r?void 0:r.resampleType);return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.indexOf("jpg")>-1||this.format.indexOf("png")>-1}_configDefaultRenderer(){if(!this._isPicture()&&!this.pixelFilter){if(!this.bandIds&&this.rasterInfo.bandCount>=3){const e=U(this.rasterInfo);!e||3===this.rasterInfo.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}var e,t;if(!this.renderer)this.renderer=H(this.rasterInfo,{bandIds:this.bandIds,variableName:this.renderingRule?null:null==(e=this.mosaicRule)||null==(t=e.multidimensionalDefinition)?void 0:t[0].variableName});this._symbolizer?(this._symbolizer.rendererJSON=L(this.renderer.toJSON()),this._symbolizer.rasterInfo=this.rasterInfo):this._symbolizer=new k({rendererJSON:this.renderer.toJSON(),rasterInfo:this.rasterInfo}),this._symbolizer.bind().success||(this._symbolizer=null)}}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:p(e.pixelBlock)&&e.pixelBlock.clone()}}_getQueryParams(e){const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...null==e?void 0:e.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):A(e,t,r)}async _fetchMultidimensionalInfo(e){var t;const r=await n(this.parsedUrl.path+"/multidimensionalInfo",{query:this._getQueryParams(),signal:e}).then((e=>{var t;return null==(t=e.data)?void 0:t.multidimensionalInfo}));return null!=(t=r.variables)&&t.length&&r.variables.forEach((e=>{var t;null!=(t=e.statistics)&&t.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation}))})),r}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.serviceRasterInfo)return t;if(t&&this.version>=10.3){var r;if(1===t.length&&"none"===t[0].name.toLowerCase())return t;return null==(r=(await n(this.parsedUrl.path+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data)?void 0:r.rasterFunctionInfos}return null}async _fetchAuxiliaryRasterInfo(e){const t=e&&e.serviceInfo;if(!t)return Promise.reject(new a("imagery-layer:fetch-metadata","valid serviceInfo is required"));const r=e.renderingRule?JSON.stringify(e.renderingRule.toJSON()):null,i=e.signal,s=!!(t.hasRasterAttributeTable&&this.version>=10.1)&&n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.1?r:null}),signal:i}).then((e=>ae.fromJSON(e.data))).catch((()=>null)),o=!!(t.hasColormap&&this.version>=10.1)&&n(this.parsedUrl.path+"/colormap",{query:this._getQueryParams({renderingRule:this.version>=10.6?r:null}),signal:i}).then((e=>{var t;return null==(t=e.data)?void 0:t.colormap})),l=!!(t.hasHistograms&&this.version>=10.1)&&n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({renderingRule:this.version>=10.1?r:null}),signal:i}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),u=this.version>=10.3&&n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:r}),signal:i}).then((e=>e.data)).catch((()=>{})),p=!!(t.hasMultidimensions&&this.version>=10.3)&&this._fetchMultidimensionalInfo(),c=await Promise.all([s,o,l,u,p]);let m=null;if(t.minValues&&t.minValues.length===t.bandCount){m=[];for(let e=0;e<t.minValues.length;e++)m.push({min:t.minValues[e],max:t.maxValues[e],avg:t.meanValues[e],stddev:t.stdvValues[e]})}const d=Math.ceil((t.extent.xmax-t.extent.xmin)/t.pixelSizeX-.1),h=Math.ceil((t.extent.ymax-t.extent.ymin)/t.pixelSizeY-.1),f=de.fromJSON(t.spatialReference||t.extent.spatialReference);return new q({width:d,height:h,bandCount:t.bandCount,extent:ee.fromJSON(t.extent),spatialReference:f,pixelSize:new te({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:f}),pixelType:t.pixelType.toLowerCase(),statistics:m,attributeTable:c[0]||null,colormap:c[1]||null,histograms:c[2]||null,keyProperties:c[3]||{},multidimensionalInfo:c[4]||null})}async _requestArrayBuffer(e){var t;const{imageProps:r,requestAsImageElement:i,signal:s}=e;if(i&&!this.pixelFilter&&(null==(t=r.format)?void 0:t.indexOf("png"))>-1){return{imageElement:(await n(this.parsedUrl.path+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s})).data,params:r}}const o=this._initJobHandler(),l=n(this.parsedUrl.path+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,o]))[0].data,p=r.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=z(u)),!c)throw new a("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const m={signal:s},d="gif"===p||"bmp"===p||p.indexOf("png")>-1&&("png"===c||"jpg"===c)?A(u,{useCanvas:!0,...r},m):this._decodePixelBlock(u,{width:r.width,height:r.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:r.extent},params:r}}async _generateRasterInfo(e,t){const{data:r}=await n(this.parsedUrl.path,{query:this._getQueryParams({renderingRule:e}),...t});return await this._fetchAuxiliaryRasterInfo({serviceInfo:r,renderingRule:e,...t})}_isValidCustomizedMosaicRule(e){var t;return e&&JSON.stringify(e.toJSON())!==JSON.stringify(null==(t=this._defaultServiceMosaicRule)?void 0:t.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;const t=e.variables[0].dimensions,r="",i=[];for(const s in t)if(t.hasOwnProperty(s)){const e=t[s],n=e.extent;let a=!0,o=[n[0]];e.hasRanges&&!0===e.hasRanges?(a=!1,o=[e.values[0]]):"stdz"===e.name.toLowerCase()&&Math.abs(n[1])<=Math.abs(n[0])&&(o=[n[1]]),i.push(new F({variableName:r,dimensionName:t[s].name,isSlice:a,values:o}))}if(i.length>0){this.mosaicRule=this.mosaicRule||new N;const e=this.mosaicRule.multidimensionalDefinition;(!e||e&&e.length<=0)&&(this.mosaicRule.multidimensionalDefinition=i)}}_formatAttributeValue(e,t){if("string"==typeof e){const r=this.popupTemplate&&this.popupTemplate.fieldInfos,i=this._getFieldInfo(r,t),s=i&&i.format;if(s){let t,r;return e.trim().indexOf(",")>-1?(t=",",r=t+" ",this._formatDelimitedString(e,t,r,s)):e.trim().indexOf(" ")>-1?(t=r=" ",this._formatDelimitedString(e,t,r,s)):this._formatNumberFromString(e,s)}}return e}_getFieldInfo(e,t){if(!e||!e.length||!t)return;const r=t.toLowerCase();let i;return e.some((e=>!(!e.fieldName||e.fieldName.toLowerCase()!==r&&e.fieldName.toLowerCase()!==r.replace(/ /g,"_"))&&(i=e,!0))),i}_formatDelimitedString(e,t,r,i){return e&&t&&r&&i?e.trim().split(t).map((e=>this._formatNumberFromString(e,i))).join(r):e}_formatNumberFromString(e,t){if(!e||!t)return e;const r=Number(e);return isNaN(r)?e:t.format(r)}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof i&&i.toLowerCase().indexOf("nodata")>-1,h=[];if(i&&!u&&!d){const e={};e[m]=0;c=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let f,y,g;this._updateResponseFieldNames(u,o),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=i){if(y=c[t],g=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.indexOf(this.renderingRule.functionName)>-1?l[s.indexOf(this.renderingRule.functionName)]:i,"nodata"===y.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";f.attributes[e]=this._formatAttributeValue(y,e),f.attributes[r]=this._formatAttributeValue(g,r),this._updateFeatureWithMagDirValues(f,y);const a=this.fields&&this.fields.length>0;let o=this.renderingRule&&p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable?a?y:i:g;this.renderingRule||(o=a?y:i),this._updateFeatureWithRasterAttributeTableValues(f,o)}if(f.sourceLayer=this,a&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=this._formatAttributeValue(l[e],t)}h.push(u[t])}return h}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo&&this.rasterInfo.attributeTable||p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable,i=r&&r.features;if(!i)return;const s=r.fields,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),a=n&&n[0];if(!a)return;const o=i.filter((e=>e.attributes[a]===(null!=t?parseInt(t,10):null)));o&&o[0]&&s.forEach((t=>{const r=this.rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=this._formatAttributeValue(o[0].attributes[t.name],r)}))}_updateFeatureWithMagDirValues(e,t){if("esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType)return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new j({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new ee(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:Q([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=a[0],e.attributes["Raster.Direction"]=a[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.filter((e=>e.code===r))[0];i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;p(r)&&e.forEach((e=>{if(e&&e.attributes)for(const i of t)if(r.has(i)){const t=r.get(i).name;t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.indexOf("image")>-1,a="esriImageServiceDataTypeElevation"===e.serviceDataType,o=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:t.indexOf("mensuration")>-1&&o,supportsDownload:t.indexOf("download")>-1,supportsQuery:t.indexOf("catalog")>-1&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&a,supportsComputePixelLocation:r>=10.7&&t.indexOf("catalog")>-1,supportsComputeAngles:r>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!(null==i||!i.supportsStatistics),supportsOrderBy:!(null==i||!i.supportsOrderBy),supportsDistinct:!(null==i||!i.supportsDistinct),supportsPagination:!(null==i||!i.supportsPagination),supportsStandardizedQueriesOnly:!(null==i||!i.useStandardizedQueries),supportsPercentileStatistics:!(null==i||!i.supportsPercentileStatistics),supportsCentroid:!(null==i||!i.supportsReturningGeometryCentroid),supportsDistance:!(null==i||!i.supportsQueryWithDistance),supportsExtent:!(null==i||!i.supportsReturningQueryExtent),supportsGeometryProperties:!(null==i||!i.supportsReturningGeometryProperties),supportsHavingClause:!(null==i||!i.supportsHavingClause),supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}}}};return e([v()],u.prototype,"_functionRasterInfos",void 0),e([v()],u.prototype,"_rasterJobHandler",void 0),e([v()],u.prototype,"_symbolizer",void 0),e([v({dependsOn:["_serviceSupportsMosaicRule"]})],u.prototype,"_defaultServiceMosaicRule",void 0),e([b("_defaultServiceMosaicRule",["defaultMosaicMethod"])],u.prototype,"readDefaultServiceMosaicRule",null),e([v()],u.prototype,"_cachedRendererJson",void 0),e([v({readOnly:!0})],u.prototype,"_serviceSourceType",void 0),e([b("_serviceSourceType",["serviceSourceType","fields"])],u.prototype,"readServiceSourceType",null),e([v({readOnly:!0})],u.prototype,"_serviceSupportsMosaicRule",void 0),e([b("_serviceSupportsMosaicRule",["currentVersion","fields"])],u.prototype,"readServiceSupportsMosaicRule",null),e([v()],u.prototype,"rasterAttributeTableFieldPrefix",void 0),e([v({readOnly:!0})],u.prototype,"rasterFunctionNamesIndex",null),e([v()],u.prototype,"adjustAspectRatio",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.bandCount")],u.prototype,"bandCount",void 0),e([v({type:[g],json:{write:!0}})],u.prototype,"bandIds",void 0),e([b("bandIds")],u.prototype,"readBandIds",null),e([v({readOnly:!0,json:{read:!1}})],u.prototype,"capabilities",void 0),e([b("service","capabilities",["capabilities","currentVersion","serviceDataType"])],u.prototype,"readCapabilities",null),e([v({type:Number})],u.prototype,"compressionQuality",void 0),e([I("compressionQuality")],u.prototype,"writeCompressionQuality",null),e([v({type:Number})],u.prototype,"compressionTolerance",void 0),e([I("compressionTolerance")],u.prototype,"writeCompressionTolerance",null),e([v({json:{read:{source:"copyrightText"}}})],u.prototype,"copyright",void 0),e([v({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],u.prototype,"definitionExpression",void 0),e([v({readOnly:!0,constructOnly:!0})],u.prototype,"exportImageServiceParameters",void 0),e([v()],u.prototype,"rasterInfo",void 0),e([v({readOnly:!0,type:[P]})],u.prototype,"fields",void 0),e([v({readOnly:!0})],u.prototype,"fieldsIndex",null),e([v({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],u.prototype,"format",null),e([b("service","format",["serviceDataType"])],u.prototype,"readFormat",null),e([v({type:ee})],u.prototype,"fullExtent",void 0),e([v({readOnly:!0})],u.prototype,"hasMultidimensions",void 0),e([v({json:{read:{source:"maxImageHeight"}}})],u.prototype,"imageMaxHeight",void 0),e([v({json:{read:{source:"maxImageWidth"}}})],u.prototype,"imageMaxWidth",void 0),e([v({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],u.prototype,"interpolation",void 0),e([v()],u.prototype,"minScale",void 0),e([b("service","minScale")],u.prototype,"readMinScale",null),e([v()],u.prototype,"maxScale",void 0),e([b("service","maxScale")],u.prototype,"readMaxScale",null),e([v({type:N})],u.prototype,"mosaicRule",null),e([b("mosaicRule",["mosaicRule","defaultMosaicMethod"])],u.prototype,"readMosaicRule",null),e([I("mosaicRule")],u.prototype,"writeMosaicRule",null),e([v({readOnly:!0}),f("serviceRasterInfo.multidimensionalInfo")],u.prototype,"multidimensionalInfo",void 0),e([v({json:{type:g}})],u.prototype,"noData",void 0),e([I("noData")],u.prototype,"writeNoData",null),e([v({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],u.prototype,"noDataInterpretation",void 0),e([v({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],u.prototype,"objectIdField",void 0),e([b("objectIdField")],u.prototype,"readObjectIdField",null),e([v({})],u.prototype,"geometryType",void 0),e([v({})],u.prototype,"typeIdField",void 0),e([v({})],u.prototype,"types",void 0),e([v({readOnly:!0})],u.prototype,"parsedUrl",null),e([v({readOnly:!0}),f("serviceRasterInfo.pixelSize.x")],u.prototype,"pixelSizeX",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.pixelSize.y")],u.prototype,"pixelSizeY",void 0),e([v({type:Function})],u.prototype,"pixelFilter",void 0),e([v()],u.prototype,"raster",void 0),e([v()],u.prototype,"viewId",void 0),e([v({types:i,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:s,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"animated-flow"!==e.type})}}}}})],u.prototype,"renderer",void 0),e([b("renderer")],u.prototype,"readRenderer",null),e([I("renderer")],u.prototype,"writeRenderer",null),e([v(w)],u.prototype,"opacity",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.attributeTable")],u.prototype,"rasterAttributeTable",void 0),e([v({readOnly:!0})],u.prototype,"rasterFields",null),e([v({constructOnly:!0})],u.prototype,"rasterFunctionInfos",void 0),e([v({type:J})],u.prototype,"renderingRule",null),e([b("renderingRule",["renderingRule","rasterFunctionInfos"])],u.prototype,"readRenderingRule",null),e([I("renderingRule")],u.prototype,"writeRenderingRule",null),e([v()],u.prototype,"serviceDataType",void 0),e([v({readOnly:!0,type:de})],u.prototype,"spatialReference",void 0),e([b("spatialReference",["spatialReference","extent"])],u.prototype,"readSpatialReference",null),e([v({json:{type:fe.jsonValues}})],u.prototype,"pixelType",void 0),e([b("pixelType")],u.prototype,"readPixelType",null),e([I("pixelType")],u.prototype,"writePixelType",null),e([v({constructOnly:!0,type:q})],u.prototype,"serviceRasterInfo",void 0),e([v()],u.prototype,"sourceJSON",void 0),e([v(_)],u.prototype,"url",void 0),e([v({readOnly:!0})],u.prototype,"version",void 0),e([b("version",["currentVersion","fields","timeInfo"])],u.prototype,"readVersion",null),u=e([S("esri.layers.mixins.ArcGISImageService")],u),u};export{ve as ArcGISImageService};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{read as r,rasterRendererTypes as i,websceneRasterRendererTypes as s}from"../../rasterRenderers.js";import n from"../../request.js";import a from"../../core/Error.js";import{strict as o}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{when as d}from"../../core/promiseUtils.js";import{urlToObject as h}from"../../core/urlUtils.js";import{aliasOf as f}from"../../core/accessorSupport/decorators/aliasOf.js";import{ensureClass as y,Integer as g,ensureNumber as R}from"../../core/accessorSupport/ensureType.js";import{property as v,ensureRange as x}from"../../core/accessorSupport/decorators/property.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as S}from"../../core/accessorSupport/decorators/subclass.js";import{writer as I}from"../../core/accessorSupport/decorators/writer.js";import{opacity as w,url as _}from"../support/commonProperties.js";import F from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as O}from"../support/ExportImageServiceParameters.js";import P from"../support/Field.js";import T from"../support/FieldsIndex.js";import{isSupportedRendererType as D}from"../support/imageryRendererUtils.js";import N from"../support/MosaicRule.js";import j from"../support/PixelBlock.js";import{interpolationKebab as C,noDataInterpretationKebab as M}from"../support/rasterEnums.js";import J from"../support/RasterFunction.js";import q from"../support/RasterInfo.js";import V from"../support/RasterJobHandler.js";import{decode as A,getFormat as z}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as Q}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as E,getDefaultBandCombination as U,createDefaultRenderer as H,normalizeRendererJSON as L}from"../../renderers/support/rasterRendererHelper.js";import k from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as B,computePixelSpaceLocations as G,computeHistograms as W,computeStatisticsHistograms as X,getImageSpatialReferenceQueryParameter as Y,getSamples as K,identify as $}from"../../rest/imageService.js";import"../../core/unitUtils.js";import"../../kernel.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as Z}from"../../rest/query/executeForCount.js";import ee from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import te from"../../geometry/Point.js";import re from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../support/arcgisLayerUrl.js";import"../../core/pbf.js";import"../../geometry/support/spatialReferenceUtils.js";import ie from"../../rest/support/Query.js";import{executeForIds as se}from"../../rest/query/executeForIds.js";import{executeQueryJSON as ne}from"../../rest/query/executeQueryJSON.js";import"../../core/has.js";import"../graphics/featureConversionUtils.js";import ae from"../../rest/support/FeatureSet.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import oe from"../../rest/support/ImageAngleParameters.js";import le from"../../rest/support/ImageHistogramParameters.js";import ue from"../../rest/support/ImageIdentifyParameters.js";import pe from"../../rest/support/ImagePixelLocationParameters.js";import ce from"../../rest/support/ImageSampleParameters.js";import{createStreamlinesMesh as me}from"../../views/2d/engine/flow/dataUtils.js";import de from"../../geometry/SpatialReference.js";const he=u.getLogger("esri.layers.mixins.ArcGISImageService"),fe=o()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),ye=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),ge=x(R,{min:0,max:255});function Re(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),r=null==t?void 0:t.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return r?r.join("/"):null}const ve=o=>{let u=class extends o{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._symbolizer=null,this._defaultServiceMosaicRule=null,this._serviceSourceType=null,this._serviceSupportsMosaicRule=null,this.rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandCount=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelSizeX=null,this.pixelSizeY=null,this.pixelFilter=null,this.raster=void 0,this.viewId=void 0,this.renderer=null,this.rasterAttributeTable=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=null}initialize(){this._set("exportImageServiceParameters",new O({layer:this}))}readDefaultServiceMosaicRule(e,t){return this._serviceSupportsMosaicRule?N.fromJSON(t):null}readServiceSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get fieldsIndex(){return this.fields?new T(this.fields):null}set format(e){e&&ye.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=N.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?N.fromJSON(r):this._isMosaicRuleSupported(t)?N.fromJSON(t):null}writeMosaicRule(e,t,r){let i=this.mosaicRule;const s=this.definitionExpression;i?s&&s!==i.where&&(i=i.clone(),i.where=s):s&&(i=new N({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=ge(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return this.url?h(this.url):null}readRenderer(e,t,i){var s,n;const a=null==t||null==(s=t.layerDefinition)||null==(n=s.drawingInfo)?void 0:n.renderer,o=r(a,i);return null==o?null:("vector-field"===o.type&&t.symbolTileSize&&!a.symbolTileSize&&(o.symbolTileSize=t.symbolTileSize),D(o)||he.warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),o)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this.rasterAttributeTableFieldPrefix||"Raster.",t=new P({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new P({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new P({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(r),this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new P({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),null==this.pixelFilter||"esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType||(s.push(new P({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new P({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const n=this.rasterInfo.attributeTable&&this.rasterInfo.attributeTable.fields||null;if(n&&n.length>0){const t=n.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=J.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?J.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){this._isRFTJson(e)||(t[r]=e.toJSON())}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?de.fromJSON(r):null}readPixelType(e){return fe.fromJSON(e)||e}writePixelType(e,t,r){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=fe.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;if(!this._isPicture()&&this.renderer&&this._symbolizer&&!this.pixelFilter){const i=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(this.renderer.toJSON()),s=this._rasterJobHandler.instance,{bandIds:n}=this;if(s){i&&(this._symbolizer.bind(),await s.updateSymbolizer(this._symbolizer,t),this._cachedRendererJson=this.renderer.toJSON());const a=await s.symbolize({bandIds:n,...e},t);r={extent:e.extent,pixelBlock:a}}else r={extent:e.extent,pixelBlock:this._symbolizer.symbolize({bandIds:n,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeAngles)throw new a("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=y(oe,e).clone(),B(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputePixelLocation)throw new a("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=y(pe,e).clone(),G(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeHistograms)throw new a("imagery-layer:compute-histograms","this operation is not supported on the input image service");e=y(le,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),W(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeStatisticsHistograms)throw new a("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");e=y(le,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),X(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)return Promise.reject(new a("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required."));const s=this.renderer||this._symbolizer?this.generateRasterInfo(this.renderingRule,{signal:i.signal}):null;return d(s).then((s=>{s&&(this.rasterInfo=s);const n={imageServiceParameters:this.getExportImageServiceParameters(e,t,r,i.timeExtent),imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}))}fetchKeyProperties(e){const t=e&&e.renderingRule&&e.renderingRule.toJSON();return n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3&&t?JSON.stringify(t):null})}).then((e=>e.data))}fetchRasterAttributeTable(e){const t=e&&e.renderingRule&&e.renderingRule.toJSON();return this.version<10.1?Promise.reject(new a("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3&&t?JSON.stringify(t):null})}).then((e=>ae.fromJSON(e.data)))}async getCatalogItemRasterInfo(e,t){const r=n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t}).then((e=>e.data)),i=n(this.parsedUrl.path+"/"+e+"/info/keyProperties",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>{})),s=await Promise.all([r,i]);if(!s[0])return;const a=ee.fromJSON(s[0].extent),o=s[0].statistics?s[0].statistics.map((e=>({min:e[0],max:e[1],avg:e[2],stddev:e[3]}))):null;return new q({bandCount:s[0].bandCount,extent:a,spatialReference:a.sr,pixelSize:new te({x:s[0].pixelSizeX,y:s[0].pixelSizeY,spatialReference:a.sr}),pixelType:s[0].pixelType.toLowerCase(),statistics:o,histograms:s[0].histograms,keyProperties:s[1]||{}})}async getCatalogItemICSInfo(e,t){const{data:r}=await n(this.parsedUrl.path+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?n(this.parsedUrl.path+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},o=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},u=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},y=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),g=await Promise.all([a,u,y]);let R=g[0].ipxf;if(null==R){var v,x,b;const e=null==(v=i.geodataXform)?void 0:v.xf_0;"topup"===(null==e||null==(x=e.name)?void 0:x.toLowerCase())&&6===(null==e||null==(b=e.coefficients)?void 0:b.length)&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const S=ee.fromJSON(g[1]&&g[1].geometries&&g[1].geometries[0]);S&&(S.spatialReference=new de({wkid:0,imageCoordinateSystem:i}));const I=g[2].geometries?g[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],w=I.length;if(w<3)return{ics:i,icsToPixelTransform:R,icsExtent:S,northDirection:null};let _=0,F=0,O=0,P=0;for(let n=0;n<w;n++)_+=I[n].x,F+=I[n].y,O+=I[n].x*I[n].x,P+=I[n].x*I[n].y;const T=(w*P-_*F)/(w*O-_*_);let D=0;const N=I[p-1].x>I[0].x,j=I[p-1].y>I[0].y;return T===1/0?D=j?90:270:0===T?D=N?0:180:T>0?D=N?180*Math.atan(T)/Math.PI:180*Math.atan(T)/Math.PI+180:T<0&&(D=j?180+180*Math.atan(T)/Math.PI:360+180*Math.atan(T)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:S,northDirection:D}}async generateRasterInfo(e,t){if((!e||"none"===e.functionName.toLowerCase()||this._isVectorFieldResampleFunction(e))&&p(this.serviceRasterInfo))return this.serviceRasterInfo;const r=Re(e);if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i=this._generateRasterInfo(e,t);this._functionRasterInfos[r]=i;try{return await i}catch{return this._functionRasterInfos[r]=null,null}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=Y(e.spatialReference,this.parsedUrl.path);p(this.serviceRasterInfo)&&this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:a,noData:o}=n;let{renderingRule:l}=n;const u=this.renderingRule&&"none"!==this.renderingRule.functionName.toLowerCase(),c=!this.renderer||"raster-stretch"===this.renderer.type;if(null!=a&&a.length&&u&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:a}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===(null==t?void 0:t.rasterFunction)?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=null==a?void 0:a.join(",");o instanceof Array&&o.length>0&&(n.noData=o.join(","));const m=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i):null;n.mosaicRule=m&&JSON.stringify(m),n.renderingRule=l&&JSON.stringify(l);const d={};if(i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${null==e?"null":e},${null==t?"null":t}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+r,...n,...d}}async getSamples(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsGetSamples)throw new a("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=y(ce,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),K(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsIdentify)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");e=y(ue,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=m(t)}return r&&null==e.raster&&(e.raster=r),$(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new ie;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ne(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),se(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Z(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new a("imagery-layer: query-visible-rasters","missing query parameter");const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const m="raster.servicepixelvalue",d=this.rasterFunctionNamesIndex;if(p(e.outFields)&&(o=e.outFields.some((e=>-1===e.toLowerCase().indexOf(m))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().indexOf(m)>-1&&e.length>m.length)).map((e=>{const t=e.slice(m.length+1);return[this._updateRenderingRulesFunctionName(t,d),t]}));l=t.map((e=>new J({functionName:e[0]}))),u=t.map((e=>e[1])),0===l.length?this.renderingRule?(l.push(this.renderingRule),u.push(this.renderingRule.functionName)):l=null:this.renderingRule&&!l.some((e=>e.functionName===this.renderingRule.functionName))&&(l.push(this.renderingRule),u.push(this.renderingRule.functionName))}const h=c(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),f=e.timeExtent||this.timeExtent,y=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,f),g=this._getQueryParams({geometry:e.geometry,timeExtent:f,mosaicRule:y,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:r,returnCatalogItems:o,returnGeometry:h,raster:this.raster,maxItemCount:s?1:null});delete g.f;const R=new ue(g);try{var v,x;await this.generateRasterInfo(this.renderingRule);const r=await $(this.url,R,{signal:null==t?void 0:t.signal,query:{...this.customParameters}}),s=e.outFields,a=r.value.toLowerCase().indexOf("nodata")>-1;if(!(o&&!h&&(null==r||null==(v=r.catalogItems)?void 0:v.features.length)&&(n||!a)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=r.catalogItems.features,m=c.map((e=>{var t;return null==(t=e.attributes)?void 0:t[l]})),d=new ie({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),f=await this.queryRasters(d);return null!=f&&null!=(x=f.features)&&x.length&&f.features.forEach((t=>{c.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new re(t.geometry),p(e.outSpatialReference)&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new a("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(this.parsedUrl.path+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.statistics})),i=n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createStreamlinesMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createStreamlinesMesh(e,t):me(e.rendererSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}async _fetchService(e){await this._fetchServiceInfo(e),p(this.serviceRasterInfo)&&!this.rasterInfo&&(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):this._fetchAuxiliaryRasterInfo({serviceInfo:t,signal:e}).then((e=>(this._set("serviceRasterInfo",e),e))),i=this.renderingRule&&"none"!==this.renderingRule.functionName.toLowerCase()?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this.renderer=null,he.warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._configDefaultRenderer(),this.watch("renderer",(()=>this._configDefaultRenderer())),this.watch("renderingRule",(e=>{(this.renderer||this._symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}));const t=p(this.serviceRasterInfo)&&this.serviceRasterInfo.multidimensionalInfo;t&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo;if(c(e)||c(this.multidimensionalInfo)||c(t)||c(null==r?void 0:r.startField))return e;const{startField:i}=r;var s;if(e=e.clone(),"mosaic-dataset"===this._serviceSourceType)return e.multidimensionalDefinition=null==(s=e.multidimensionalDefinition)?void 0:s.filter((e=>e.dimensionName!==i)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const n=e.multidimensionalDefinition.filter((e=>e.dimensionName===i)),a=p(t.start)?t.start.getTime():null,o=p(t.end)?t.end.getTime():null,l=null==a||null==o||a===o,u=l?[a||o]:[[a,o]],m=this.version>=10.8;if(n.length)n.forEach((e=>{e.dimensionName===i&&(m?(e.dimensionName=null,e.isSlice=null,e.values=null):(e.isSlice=l,e.values=u))}));else if(!m){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=i,e.isSlice=l,e.values=u})):e.multidimensionalDefinition.push(new F({variableName:"",dimensionName:i,isSlice:l,values:u}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this._serviceSourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){var r;if(await this._fetchCapabilities(null==(r=t)?void 0:r.signal),!this.capabilities.operations.supportsQuery)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?y(ie,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new V;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>null)),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&r&&"none"!==r.functionName.toLowerCase()&&1===t.bandCount&&["u8","s8"].includes(t.pixelType)||E(this.rasterInfo).includes(this.renderer.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){var t;let r=this.sourceJSON;if(!r){const{data:t,ssl:i}=await n(this.parsedUrl.path,{query:this._getQueryParams(),signal:e});r=t,this.sourceJSON=r,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if((null==(t=r.capabilities)?void 0:t.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly"))>-1)throw new a("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(r,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){var t;return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:(null==(t=e.fields)?void 0:t.length)>0}_isMosaicRuleSupported(e){var t;if(!e)return!1;const r=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&e.timeInfo&&!(e.objectIdField&&(null==(t=e.fields)?void 0:t.length)>1);return r||i}_isVectorFieldResampleFunction(e){if(!p(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t.toLowerCase(),s=(null==r?void 0:r.ResampleType)||(null==r?void 0:r.resampleType);return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.indexOf("jpg")>-1||this.format.indexOf("png")>-1}_configDefaultRenderer(){if(!this._isPicture()&&!this.pixelFilter){if(!this.bandIds&&this.rasterInfo.bandCount>=3){const e=U(this.rasterInfo);!e||3===this.rasterInfo.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}var e,t;if(!this.renderer)this.renderer=H(this.rasterInfo,{bandIds:this.bandIds,variableName:this.renderingRule?null:null==(e=this.mosaicRule)||null==(t=e.multidimensionalDefinition)?void 0:t[0].variableName});this._symbolizer?(this._symbolizer.rendererJSON=L(this.renderer.toJSON()),this._symbolizer.rasterInfo=this.rasterInfo):this._symbolizer=new k({rendererJSON:this.renderer.toJSON(),rasterInfo:this.rasterInfo}),this._symbolizer.bind().success||(this._symbolizer=null)}}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:p(e.pixelBlock)&&e.pixelBlock.clone()}}_getQueryParams(e){const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...null==e?void 0:e.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):A(e,t,r)}async _fetchMultidimensionalInfo(e){var t;const r=await n(this.parsedUrl.path+"/multidimensionalInfo",{query:this._getQueryParams(),signal:e}).then((e=>{var t;return null==(t=e.data)?void 0:t.multidimensionalInfo}));return null!=(t=r.variables)&&t.length&&r.variables.forEach((e=>{var t;null!=(t=e.statistics)&&t.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation}))})),r}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.serviceRasterInfo)return t;if(t&&this.version>=10.3){var r;if(1===t.length&&"none"===t[0].name.toLowerCase())return t;return null==(r=(await n(this.parsedUrl.path+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data)?void 0:r.rasterFunctionInfos}return null}async _fetchAuxiliaryRasterInfo(e){const t=e&&e.serviceInfo;if(!t)return Promise.reject(new a("imagery-layer:fetch-metadata","valid serviceInfo is required"));const r=e.renderingRule?JSON.stringify(e.renderingRule.toJSON()):null,i=e.signal,s=!!(t.hasRasterAttributeTable&&this.version>=10.1)&&n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.1?r:null}),signal:i}).then((e=>ae.fromJSON(e.data))).catch((()=>null)),o=!!(t.hasColormap&&this.version>=10.1)&&n(this.parsedUrl.path+"/colormap",{query:this._getQueryParams({renderingRule:this.version>=10.6?r:null}),signal:i}).then((e=>{var t;return null==(t=e.data)?void 0:t.colormap})),l=!!(t.hasHistograms&&this.version>=10.1)&&n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({renderingRule:this.version>=10.1?r:null}),signal:i}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),u=this.version>=10.3&&n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:r}),signal:i}).then((e=>e.data)).catch((()=>{})),p=!!(t.hasMultidimensions&&this.version>=10.3)&&this._fetchMultidimensionalInfo(),c=await Promise.all([s,o,l,u,p]);let m=null;if(t.minValues&&t.minValues.length===t.bandCount){m=[];for(let e=0;e<t.minValues.length;e++)m.push({min:t.minValues[e],max:t.maxValues[e],avg:t.meanValues[e],stddev:t.stdvValues[e]})}const d=Math.ceil((t.extent.xmax-t.extent.xmin)/t.pixelSizeX-.1),h=Math.ceil((t.extent.ymax-t.extent.ymin)/t.pixelSizeY-.1),f=de.fromJSON(t.spatialReference||t.extent.spatialReference);return new q({width:d,height:h,bandCount:t.bandCount,extent:ee.fromJSON(t.extent),spatialReference:f,pixelSize:new te({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:f}),pixelType:t.pixelType.toLowerCase(),statistics:m,attributeTable:c[0]||null,colormap:c[1]||null,histograms:c[2]||null,keyProperties:c[3]||{},multidimensionalInfo:c[4]||null})}async _requestArrayBuffer(e){var t;const{imageProps:r,requestAsImageElement:i,signal:s}=e;if(i&&!this.pixelFilter&&(null==(t=r.format)?void 0:t.indexOf("png"))>-1){return{imageElement:(await n(this.parsedUrl.path+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s})).data,params:r}}const o=this._initJobHandler(),l=n(this.parsedUrl.path+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,o]))[0].data,p=r.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=z(u)),!c)throw new a("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const m={signal:s},d="gif"===p||"bmp"===p||p.indexOf("png")>-1&&("png"===c||"jpg"===c)?A(u,{useCanvas:!0,...r},m):this._decodePixelBlock(u,{width:r.width,height:r.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:r.extent},params:r}}async _generateRasterInfo(e,t){const{data:r}=await n(this.parsedUrl.path,{query:this._getQueryParams({renderingRule:e}),...t});return await this._fetchAuxiliaryRasterInfo({serviceInfo:r,renderingRule:e,...t})}_isValidCustomizedMosaicRule(e){var t;return e&&JSON.stringify(e.toJSON())!==JSON.stringify(null==(t=this._defaultServiceMosaicRule)?void 0:t.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;const t=e.variables[0].dimensions,r="",i=[];for(const s in t)if(t.hasOwnProperty(s)){const e=t[s],n=e.extent;let a=!0,o=[n[0]];e.hasRanges&&!0===e.hasRanges?(a=!1,o=[e.values[0]]):"stdz"===e.name.toLowerCase()&&Math.abs(n[1])<=Math.abs(n[0])&&(o=[n[1]]),i.push(new F({variableName:r,dimensionName:t[s].name,isSlice:a,values:o}))}if(i.length>0){this.mosaicRule=this.mosaicRule||new N;const e=this.mosaicRule.multidimensionalDefinition;(!e||e&&e.length<=0)&&(this.mosaicRule.multidimensionalDefinition=i)}}_formatAttributeValue(e,t){if("string"==typeof e){const r=this.popupTemplate&&this.popupTemplate.fieldInfos,i=this._getFieldInfo(r,t),s=i&&i.format;if(s){let t,r;return e.trim().indexOf(",")>-1?(t=",",r=t+" ",this._formatDelimitedString(e,t,r,s)):e.trim().indexOf(" ")>-1?(t=r=" ",this._formatDelimitedString(e,t,r,s)):this._formatNumberFromString(e,s)}}return e}_getFieldInfo(e,t){if(!e||!e.length||!t)return;const r=t.toLowerCase();let i;return e.some((e=>!(!e.fieldName||e.fieldName.toLowerCase()!==r&&e.fieldName.toLowerCase()!==r.replace(/ /g,"_"))&&(i=e,!0))),i}_formatDelimitedString(e,t,r,i){return e&&t&&r&&i?e.trim().split(t).map((e=>this._formatNumberFromString(e,i))).join(r):e}_formatNumberFromString(e,t){if(!e||!t)return e;const r=Number(e);return isNaN(r)?e:t.format(r)}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof i&&i.toLowerCase().indexOf("nodata")>-1,h=[];if(i&&!u&&!d){const e={};e[m]=0;c=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let f,y,g;this._updateResponseFieldNames(u,o),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=i){if(y=c[t],g=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.indexOf(this.renderingRule.functionName)>-1?l[s.indexOf(this.renderingRule.functionName)]:i,"nodata"===y.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";f.attributes[e]=this._formatAttributeValue(y,e),f.attributes[r]=this._formatAttributeValue(g,r),this._updateFeatureWithMagDirValues(f,y);const a=this.fields&&this.fields.length>0;let o=this.renderingRule&&p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable?a?y:i:g;this.renderingRule||(o=a?y:i),this._updateFeatureWithRasterAttributeTableValues(f,o)}if(f.sourceLayer=f.layer=this,a&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=this._formatAttributeValue(l[e],t)}h.push(u[t])}return h}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo&&this.rasterInfo.attributeTable||p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable,i=r&&r.features;if(!i)return;const s=r.fields,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),a=n&&n[0];if(!a)return;const o=i.filter((e=>e.attributes[a]===(null!=t?parseInt(t,10):null)));o&&o[0]&&s.forEach((t=>{const r=this.rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=this._formatAttributeValue(o[0].attributes[t.name],r)}))}_updateFeatureWithMagDirValues(e,t){if("esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType)return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new j({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new ee(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:Q([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=a[0],e.attributes["Raster.Direction"]=a[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.filter((e=>e.code===r))[0];i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;p(r)&&e.forEach((e=>{if(e&&e.attributes)for(const i of t)if(r.has(i)){const t=r.get(i).name;t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.indexOf("image")>-1,a="esriImageServiceDataTypeElevation"===e.serviceDataType,o=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:t.indexOf("mensuration")>-1&&o,supportsDownload:t.indexOf("download")>-1,supportsQuery:t.indexOf("catalog")>-1&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&a,supportsComputePixelLocation:r>=10.7&&t.indexOf("catalog")>-1,supportsComputeAngles:r>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!(null==i||!i.supportsStatistics),supportsOrderBy:!(null==i||!i.supportsOrderBy),supportsDistinct:!(null==i||!i.supportsDistinct),supportsPagination:!(null==i||!i.supportsPagination),supportsStandardizedQueriesOnly:!(null==i||!i.useStandardizedQueries),supportsPercentileStatistics:!(null==i||!i.supportsPercentileStatistics),supportsCentroid:!(null==i||!i.supportsReturningGeometryCentroid),supportsDistance:!(null==i||!i.supportsQueryWithDistance),supportsExtent:!(null==i||!i.supportsReturningQueryExtent),supportsGeometryProperties:!(null==i||!i.supportsReturningGeometryProperties),supportsHavingClause:!(null==i||!i.supportsHavingClause),supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}}}};return e([v()],u.prototype,"_functionRasterInfos",void 0),e([v()],u.prototype,"_rasterJobHandler",void 0),e([v()],u.prototype,"_symbolizer",void 0),e([v({dependsOn:["_serviceSupportsMosaicRule"]})],u.prototype,"_defaultServiceMosaicRule",void 0),e([b("_defaultServiceMosaicRule",["defaultMosaicMethod"])],u.prototype,"readDefaultServiceMosaicRule",null),e([v()],u.prototype,"_cachedRendererJson",void 0),e([v({readOnly:!0})],u.prototype,"_serviceSourceType",void 0),e([b("_serviceSourceType",["serviceSourceType","fields"])],u.prototype,"readServiceSourceType",null),e([v({readOnly:!0})],u.prototype,"_serviceSupportsMosaicRule",void 0),e([b("_serviceSupportsMosaicRule",["currentVersion","fields"])],u.prototype,"readServiceSupportsMosaicRule",null),e([v()],u.prototype,"rasterAttributeTableFieldPrefix",void 0),e([v({readOnly:!0})],u.prototype,"rasterFunctionNamesIndex",null),e([v()],u.prototype,"adjustAspectRatio",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.bandCount")],u.prototype,"bandCount",void 0),e([v({type:[g],json:{write:!0}})],u.prototype,"bandIds",void 0),e([b("bandIds")],u.prototype,"readBandIds",null),e([v({readOnly:!0,json:{read:!1}})],u.prototype,"capabilities",void 0),e([b("service","capabilities",["capabilities","currentVersion","serviceDataType"])],u.prototype,"readCapabilities",null),e([v({type:Number})],u.prototype,"compressionQuality",void 0),e([I("compressionQuality")],u.prototype,"writeCompressionQuality",null),e([v({type:Number})],u.prototype,"compressionTolerance",void 0),e([I("compressionTolerance")],u.prototype,"writeCompressionTolerance",null),e([v({json:{read:{source:"copyrightText"}}})],u.prototype,"copyright",void 0),e([v({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],u.prototype,"definitionExpression",void 0),e([v({readOnly:!0,constructOnly:!0})],u.prototype,"exportImageServiceParameters",void 0),e([v()],u.prototype,"rasterInfo",void 0),e([v({readOnly:!0,type:[P]})],u.prototype,"fields",void 0),e([v({readOnly:!0})],u.prototype,"fieldsIndex",null),e([v({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],u.prototype,"format",null),e([b("service","format",["serviceDataType"])],u.prototype,"readFormat",null),e([v({type:ee})],u.prototype,"fullExtent",void 0),e([v({readOnly:!0})],u.prototype,"hasMultidimensions",void 0),e([v({json:{read:{source:"maxImageHeight"}}})],u.prototype,"imageMaxHeight",void 0),e([v({json:{read:{source:"maxImageWidth"}}})],u.prototype,"imageMaxWidth",void 0),e([v({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],u.prototype,"interpolation",void 0),e([v()],u.prototype,"minScale",void 0),e([b("service","minScale")],u.prototype,"readMinScale",null),e([v()],u.prototype,"maxScale",void 0),e([b("service","maxScale")],u.prototype,"readMaxScale",null),e([v({type:N})],u.prototype,"mosaicRule",null),e([b("mosaicRule",["mosaicRule","defaultMosaicMethod"])],u.prototype,"readMosaicRule",null),e([I("mosaicRule")],u.prototype,"writeMosaicRule",null),e([v({readOnly:!0}),f("serviceRasterInfo.multidimensionalInfo")],u.prototype,"multidimensionalInfo",void 0),e([v({json:{type:g}})],u.prototype,"noData",void 0),e([I("noData")],u.prototype,"writeNoData",null),e([v({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],u.prototype,"noDataInterpretation",void 0),e([v({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],u.prototype,"objectIdField",void 0),e([b("objectIdField")],u.prototype,"readObjectIdField",null),e([v({})],u.prototype,"geometryType",void 0),e([v({})],u.prototype,"typeIdField",void 0),e([v({})],u.prototype,"types",void 0),e([v({readOnly:!0})],u.prototype,"parsedUrl",null),e([v({readOnly:!0}),f("serviceRasterInfo.pixelSize.x")],u.prototype,"pixelSizeX",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.pixelSize.y")],u.prototype,"pixelSizeY",void 0),e([v({type:Function})],u.prototype,"pixelFilter",void 0),e([v()],u.prototype,"raster",void 0),e([v()],u.prototype,"viewId",void 0),e([v({types:i,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:s,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"animated-flow"!==e.type})}}}}})],u.prototype,"renderer",void 0),e([b("renderer")],u.prototype,"readRenderer",null),e([I("renderer")],u.prototype,"writeRenderer",null),e([v(w)],u.prototype,"opacity",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.attributeTable")],u.prototype,"rasterAttributeTable",void 0),e([v({readOnly:!0})],u.prototype,"rasterFields",null),e([v({constructOnly:!0})],u.prototype,"rasterFunctionInfos",void 0),e([v({type:J})],u.prototype,"renderingRule",null),e([b("renderingRule",["renderingRule","rasterFunctionInfos"])],u.prototype,"readRenderingRule",null),e([I("renderingRule")],u.prototype,"writeRenderingRule",null),e([v()],u.prototype,"serviceDataType",void 0),e([v({readOnly:!0,type:de})],u.prototype,"spatialReference",void 0),e([b("spatialReference",["spatialReference","extent"])],u.prototype,"readSpatialReference",null),e([v({json:{type:fe.jsonValues}})],u.prototype,"pixelType",void 0),e([b("pixelType")],u.prototype,"readPixelType",null),e([I("pixelType")],u.prototype,"writePixelType",null),e([v({constructOnly:!0,type:q})],u.prototype,"serviceRasterInfo",void 0),e([v()],u.prototype,"sourceJSON",void 0),e([v(_)],u.prototype,"url",void 0),e([v({readOnly:!0})],u.prototype,"version",void 0),e([b("version",["currentVersion","fields","timeInfo"])],u.prototype,"readVersion",null),u=e([S("esri.layers.mixins.ArcGISImageService")],u),u};export{ve as ArcGISImageService};
|
package/package.json
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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../Color.js";import"../../rasterRenderers.js";import{isSome as t,unwrap as n}from"../../core/maybe.js";import{getMetersPerUnitForSR as r}from"../../core/unitUtils.js";import l from"../../layers/support/Field.js";import a from"../../layers/support/RasterInfo.js";import o from"./AuthoringInfo.js";import s from"./ClassBreakInfo.js";import{PREDEFINED_JSON_COLOR_RAMPS as i,convertColorRampToColormap as u}from"./colorRampUtils.js";import m from"./UniqueValueInfo.js";import c from"../../rest/support/AlgorithmicColorRamp.js";import f from"../../rest/support/ClassBreaksDefinition.js";import{createGenerateRendererClassBreaks as p}from"../../rest/support/generateRendererUtils.js";import d from"../../rest/support/MultipartColorRamp.js";import h from"../RasterStretchRenderer.js";import b from"../UniqueValueRenderer.js";import v from"../RasterColormapRenderer.js";import y from"../RasterShadedReliefRenderer.js";import g from"../ClassBreaksRenderer.js";import C from"../VectorFieldRenderer.js";const w=.25,x=d.fromJSON({type:"multipart",colorRamps:[{fromColor:[0,0,255],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]}]}),M=d.fromJSON(i[0]),R=new Set(["scientific","standard-time","vector-uv","vector-magdir","vector-u","vector-v","vector-magnitude","vector-direction"]);function j(e,n){const{attributeTable:r,colormap:l}=e;if(H(e)){const n=X(e);if(t(n))return n}if(t(l)){const n=F(e);if(t(n))return n}if(t(r)){const n=q(e);if(t(n))return n}return V(e,n)}function k(e){const t=["raster-stretch"];return W(e)&&t.push("raster-colormap"),z(e)&&t.push("unique-value"),D(e)&&t.push("class-breaks"),U(e)&&t.push("raster-shaded-relief"),H(e)&&t.push("vector-field"),K(e)&&t.push("animated-flow"),t}function T(e,t,n){const r=["nearest","bilinear","cubic","majority"].find((e=>e===(null==n?void 0:n.toLowerCase())));if("Map"===t)return null!=r?r:"bilinear";if("standard-time"===e.dataType)return null!=r?r:"nearest";return"thematic"===e.dataType||e.attributeTable||e.colormap?"nearest"===r||"majority"===r?r:"nearest":null!=r?r:"bilinear"}function V(e,r){var l,a,o,s;e=I(e,null==r?void 0:r.variableName);const{bandCount:i}=e;let{bandIds:u,stretchType:m}=r||{};null!=(l=u)&&l.some((e=>e>=i))&&(u=null);let c=n(e.statistics),f=n(e.histograms);var p;i>1?(u=null!=(p=u)&&p.length?u:S(e),c=null==c?null:u.map((e=>c[e])),f=null==f?null:u.map((e=>f[e]))):u=[0];null==m&&(m=O(e));let d=!1;switch(m){case"none":d=!1;break;case"percent-clip":d=!(null!=(a=f)&&a.length);break;default:d=!(null!=(o=c)&&o.length)}const{dataType:b}=e,v=1===(null==(s=u)?void 0:s.length)&&R.has(b)?x:null,y=new h({stretchType:m,dynamicRangeAdjustment:d,colorRamp:v,outputMin:0,outputMax:255,gamma:1===u.length?[1]:[1,1,1],useGamma:!1});return"percent-clip"===m?y.maxPercent=y.minPercent=w:"standard-deviation"===m&&(y.numberOfStandardDeviations=2),!d&&(t(e.multidimensionalInfo)||null!=r&&r.includeStatisticsInStretch)&&("percent-clip"===m?y.histograms=f:"min-max"!==m&&"standard-deviation"!==m||(y.statistics=c)),y}function I(e,r){if(null==r)return e;let l=n(e.statistics),o=n(e.histograms);const{multidimensionalInfo:s}=e;if(r&&t(s)){const{statistics:e,histograms:t}=s.variables.find((e=>e.name===r));null!=e&&e.length&&(l=e),null!=t&&t.length&&(o=t)}return a.fromJSON({...e.toJSON(),statistics:l,histograms:o})}function S(e){const t=e.bandCount;if(1===t)return null;if(2===t)return[0];const n=e.keyProperties&&e.keyProperties.BandProperties;let r;if(n&&n.length===t){const{red:e,green:t,blue:l,nir:a}=B(n);null!=e&&null!=t&&null!=l?r=[e,t,l]:null!=a&&null!=e&&null!=t&&(r=[a,e,t])}return!r&&t>=3&&(r=[0,1,2]),r}function L(e,t){var n;const r=e.keyProperties&&e.keyProperties.BandProperties;return(t=null!=(n=t)&&n.length?t:Array.from(Array(e.bandCount).keys())).map((t=>r&&r.length===e.bandCount&&r[t]&&r[t].BandName||"band_"+(t+1)))}function B(e){const t={};for(let r=0;r<e.length;r++){var n;const l=e[r],a=null==(n=l.BandName)?void 0:n.toLowerCase();if("red"===a)t.red=r;else if("green"===a)t.green=r;else if("blue"===a)t.blue=r;else if("nearinfrared"===a||"nearinfrared_1"===a||"nir"===a)t.nir=r;else if(l.WavelengthMax&&l.WavelengthMin){const e=l.WavelengthMin,n=l.WavelengthMax;null==t.blue&&e>=410&&e<=480&&n>=480&&n<=540?t.blue=r:null==t.green&&e>=490&&e<=560&&n>=560&&n<=610?t.green=r:null==t.red&&e>=595&&e<=670&&n>=660&&n<=730?t.red=r:null==t.nir&&e>=700&&e<=860&&n>=800&&n<=950&&(t.nir=r)}}return t}function O(e){let n="percent-clip";const{pixelType:r,dataType:l,histograms:a,statistics:o}=e;return"u8"!==r||"processed"!==l&&t(a)&&t(o)?"u8"===r||"elevation"===l||R.has(l)?n="min-max":t(a)?n="percent-clip":t(o)&&(n="min-max",n="min-max"):n="none",n}function q(n,r,l,a){if(!z(n,r))return null;const{attributeTable:s,statistics:i}=n,c=E(s,r),f=P(s,"red"),p=P(s,"green"),d=P(s,"blue"),h=new o,v=[],y=new Set,g=!!(f&&p&&d);if(t(s))s.features.forEach((t=>{const n=t.attributes[c.name];if(!y.has(t.attributes[c.name])&&null!=n){y.add(n);const r=g&&("single"===f.type||"double"===f.type)&&("single"===p.type||"double"===p.type)&&("single"===d.type||"double"===d.type)&&!s.features.some((e=>e.attributes[f.name]>1||e.attributes[p.name]>1||e.attributes[d.name]>1)),l=r?255:1;v.push(new m({value:t.attributes[c.name],label:t.attributes[c.name]+"",symbol:{type:"simple-fill",style:"solid",outline:null,color:new e(g?[t.attributes[f.name]*l,t.attributes[p.name]*l,t.attributes[d.name]*l,1]:[0,0,0,0])}}))}}));else if(null!=i&&i[0])for(let t=i[0].min;t<=i[0].max;t++)v.push(new m({value:t,label:t.toString(),symbol:{type:"simple-fill",style:"solid",outline:null,color:new e([0,0,0,0])}}));if(v.sort(((e,t)=>e.value&&"string"==typeof e.value.valueOf()?0:e.value>t.value?1:-1)),!g){const t=u(M,v.length);v.forEach(((n,r)=>n.symbol.color=new e(t[r].slice(1,4)))),h.colorRamp=M}if(l||a){const t=l||u(a,v.length).map((e=>e.slice(1)));v.forEach(((n,r)=>n.symbol.color=new e(t[r]))),h.colorRamp=a}return new b({field:c.name,uniqueValueInfos:v,authoringInfo:h})}function E(e,n,r){let a;return t(e)?(a=n?e.fields.find((e=>n.toLowerCase()===e.name.toLowerCase())):N(e.fields),a||(r||(a=e.fields.find((e=>"string"===e.type))),a||(a=P(e,"value")))):a=new l({name:"value"}),a}function N(e){let t;for(let n=0;n<e.length;n++){const r=e[n].name.toLowerCase();if("string"===e[n].type){if(r.startsWith("class")){t=e[n];break}null==t&&(r.endsWith("name")||r.endsWith("type"))&&(t=e[n])}}return t}function P(e,n){return t(e)?e.fields.find((e=>e.name.toLowerCase()===n)):null}function z(e,n){const{attributeTable:r,bandCount:l}=e;if(!t(r)&&_(e))return!0;if(!t(r)||l>1)return!1;if(n){if(null==r.fields.find((e=>e.name.toLowerCase()===n.toLowerCase())))return!1}return!0}function W(e){const{bandCount:n,colormap:r}=e;return t(r)&&r.length&&1===n}function F(e){if(!W(e))return null;let r;const{attributeTable:l,colormap:a}=e;if(t(l)){const e=P(l,"value"),t=E(l,null,!0);"string"===t.type&&(r={},l.features.forEach((n=>{const l=n.attributes;r[l[e.name]]=t?l[t.name]:l[e.name]})))}return v.createFromColormap(n(a),r)}function U(e){return"elevation"===e.dataType}function A(e,t){var n;if(!U(e))return null;const{extent:l}=e,a=l.width*r(l.spatialReference);return t=null!=(n=t)?n:"multi-directional",new y({hillshadeType:t,scalingType:a>5e6?"adjusted":"none"})}function D(e){const{attributeTable:n,bandCount:r}=e;return 1===r&&(t(n)||t(e.histograms))}function J(e,n){e=I(e,null==n?void 0:n.variableName);const{attributeTable:r}=e;if(!D(e))return null;const l=t(e.histograms)?e.histograms[0]:null,a=(null==n?void 0:n.numClasses)||5,i=new o({classificationMethod:null==n?void 0:n.classificationMethod,colorRamp:null==n?void 0:n.colorRamp});let m=(null==n?void 0:n.field)||"value";const c=[],d=[],h=1e3,b=t(r),v=b&&r.fields.find((e=>"count"===e.name.toLowerCase())),y=b&&r.fields.find((e=>e.name.toLowerCase()===m.toLowerCase()));if(y&&v){m=y.name;const e=r.features.length;let t=0;r.features.forEach((n=>t+=n.attributes[v.name]/e)),r.features.forEach((n=>{const r=n.attributes[y.name],l=n.attributes[v.name];if(l>0){d.push(l);const n=Math.max(1,Math.round(l/e/t*h));for(let e=0;e<n;e++)c.push(r)}}))}else{const{pixelType:t}=e,n=(l.max-l.min)/l.size,r=t.indexOf("s")>-1||t.indexOf("u")>-1,a=r&&1===n?Math.floor(l.min+.5):l.min,o=r&&1===n?Math.floor(l.max-.5):l.max,s=l.size;let i=0;l.counts.forEach((e=>i+=e/s)),l.counts.forEach(((e,t)=>{if(e>0){d.push(e);const r=Math.max(1,Math.round(e/s/i*h)),u=0===t?a:t===s-1?o:l.min+n*(t+.5);for(let e=0;e<r;e++)c.push(u)}}))}const C=(null==n?void 0:n.classificationMethod)||"natural-breaks",w=p({values:c,valueFrequency:d,normalizationTotal:null,definition:new f({classificationMethod:C,breakCount:a,definedInterval:null==n?void 0:n.definedInterval})});let M=null==n?void 0:n.colors;if(!M){const e=(null==n?void 0:n.colorRamp)||x;i.colorRamp=e;const t=u(e,w.classBreaks.length,!0);M=t.map((e=>e.slice(1)))}const R=w.classBreaks.map(((e,t)=>new s({minValue:e.minValue,maxValue:e.maxValue,label:e.label,symbol:{type:"simple-fill",color:M[t]}})));return new g({field:m,classBreakInfos:R,authoringInfo:i})}function _(e){var t,n,r;return["u8","s8"].indexOf(e.pixelType)>-1&&null!=(null==(t=e.statistics)||null==(n=t[0])?void 0:n.min)&&null!=(null==(r=e.statistics[0])?void 0:r.max)&&1===e.bandCount}function G(t){const n=[];for(let r=0;r<t.length-1;r++)n[r]=new c({algorithm:"hsv",fromColor:t[r],toColor:t[r+1]||new e({r:255,g:255,b:255,a:1})});if(t.length>2){return new d({colorRamps:n})}return n[0]}function H(e){const{dataType:t}=e;return"vector-uv"===t||"vector-magdir"===t}function K(e){const{dataType:t}=e;return"vector-uv"===t||"vector-magdir"===t}const Q=new Map([["m/s","meter-per-second"],["km/h","kilometer-per-hour"],["knots","knots"],["ft/s","feet-per-second"],["mph","mile-per-hour"]]);function X(e){if(!H(e))return null;let n;if(t(e.statistics)&&e.statistics.length){const t="vector-uv"===e.dataType,{min:r,max:l}=e.statistics[0];n=[{type:"size",field:"Magnitude",minSize:10,maxSize:40,minDataValue:t?Math.min(Math.abs(r),Math.abs(l)):r,maxDataValue:t?Math.max(Math.abs(r),Math.abs(l)):l}]}const r=t(e.multidimensionalInfo)?Q.get(e.multidimensionalInfo.variables[0].unit):null,l=new C({visualVariables:n,inputUnit:r,rotationType:"geographic"});return l.visualVariables=[...l.sizeVariables,...l.rotationVariables],l}function Y(e){var t;return{color:null==(t=e.symbolLayers[0].material)?void 0:t.color,type:"esriSFS",style:"esriSFSSolid"}}function Z(e){if("uniqueValue"===e.type){var t;const n=e.uniqueValueInfos,r=n[0].symbol;return null!=r&&null!=(t=r.symbolLayers)&&t.length&&(e.uniqueValueInfos=n.map((e=>({value:e.value,label:e.label,symbol:e.symbol?Y(e.symbol):null})))),e}if("classBreaks"===e.type){var n;const t=e.classBreakInfos,r=t[0].symbol;return null!=r&&null!=(n=r.symbolLayers)&&n.length&&(e.classBreakInfos=t.map((e=>({classMinValue:e.classMinValue,classMaxValue:e.classMaxValue,label:e.label,symbol:e.symbol?Y(e.symbol):null})))),e}return e}export{J as createClassBreaksRenderer,G as createColorRamp,F as createColormapRenderer,j as createDefaultRenderer,A as createShadedReliefRenderer,V as createStretchRenderer,q as createUVRenderer,X as createVectorFieldRenderer,L as getBandNames,E as getClassField,S as getDefaultBandCombination,T as getDefaultInterpolation,P as getField,k as getSupportedRendererTypes,B as getWellKnownBandIndexes,K as isAnimatedFlowRendererSupported,D as isClassBreaksSupported,W as isColormapRendererSupported,U as isShadedReliefRendererSupported,_ as isSingleBand8BitRasterWithStats,z as isUVRendererSupported,H as isVectorFieldRendererSupported,Z as normalizeRendererJSON};
|
|
5
|
+
import e from"../../Color.js";import"../../rasterRenderers.js";import{isSome as t,unwrap as n}from"../../core/maybe.js";import{getMetersPerUnitForSR as r}from"../../core/unitUtils.js";import l from"../../layers/support/Field.js";import a from"../../layers/support/RasterInfo.js";import o from"./AuthoringInfo.js";import s from"./ClassBreakInfo.js";import{PREDEFINED_JSON_COLOR_RAMPS as i,convertColorRampToColormap as u}from"./colorRampUtils.js";import m from"./UniqueValueInfo.js";import c from"../../rest/support/AlgorithmicColorRamp.js";import f from"../../rest/support/ClassBreaksDefinition.js";import{createGenerateRendererClassBreaks as p}from"../../rest/support/generateRendererUtils.js";import d from"../../rest/support/MultipartColorRamp.js";import b from"../RasterStretchRenderer.js";import h from"../UniqueValueRenderer.js";import v from"../RasterColormapRenderer.js";import y from"../RasterShadedReliefRenderer.js";import g from"../ClassBreaksRenderer.js";import C from"../VectorFieldRenderer.js";const w=.25,x=d.fromJSON({type:"multipart",colorRamps:[{fromColor:[0,0,255],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]}]}),M=d.fromJSON(i[0]),R=new Set(["scientific","standard-time","vector-uv","vector-magdir","vector-u","vector-v","vector-magnitude","vector-direction"]);function T(e,n){const{attributeTable:r,colormap:l}=e;if(K(e)){const n=Y(e);if(t(n))return n}if(t(l)){const n=W(e);if(t(n))return n}if(t(r)){const n=O(e);if(t(n))return n}return V(e,n)}function j(e){const t=["raster-stretch"];return F(e)&&t.push("raster-colormap"),z(e)&&t.push("unique-value"),D(e)&&t.push("class-breaks"),U(e)&&t.push("raster-shaded-relief"),K(e)&&t.push("vector-field"),Q(e)&&t.push("animated-flow"),t}function k(e,t,n){const r=["nearest","bilinear","cubic","majority"].find((e=>e===(null==n?void 0:n.toLowerCase())));if("Map"===t)return null!=r?r:"bilinear";if("standard-time"===e.dataType)return null!=r?r:"nearest";return"thematic"===e.dataType||e.attributeTable||e.colormap?"nearest"===r||"majority"===r?r:"nearest":null!=r?r:"bilinear"}function V(e,r){var l,a,o,s;e=I(e,null==r?void 0:r.variableName);const{bandCount:i}=e;let{bandIds:u,stretchType:m}=r||{};null!=(l=u)&&l.some((e=>e>=i))&&(u=null);let c=n(e.statistics),f=n(e.histograms);var p;i>1?(u=null!=(p=u)&&p.length?u:S(e),c=null==c?null:u.map((e=>c[e])),f=null==f?null:u.map((e=>f[e]))):u=[0];null==m&&(m=E(e));let d=!1;switch(m){case"none":d=!1;break;case"percent-clip":d=!(null!=(a=f)&&a.length);break;default:d=!(null!=(o=c)&&o.length)}const{dataType:h}=e,v=1===(null==(s=u)?void 0:s.length)&&R.has(h)?x:null,y=new b({stretchType:m,dynamicRangeAdjustment:d,colorRamp:v,outputMin:0,outputMax:255,gamma:1===u.length?[1]:[1,1,1],useGamma:!1});return"percent-clip"===m?y.maxPercent=y.minPercent=w:"standard-deviation"===m&&(y.numberOfStandardDeviations=2),!d&&(t(e.multidimensionalInfo)||null!=r&&r.includeStatisticsInStretch)&&("percent-clip"===m?y.histograms=f:"min-max"!==m&&"standard-deviation"!==m||(y.statistics=c)),y}function I(e,r){if(null==r)return e;let l=n(e.statistics),o=n(e.histograms);const{multidimensionalInfo:s}=e;if(r&&t(s)){const{statistics:e,histograms:t}=s.variables.find((e=>e.name===r));null!=e&&e.length&&(l=e),null!=t&&t.length&&(o=t)}return a.fromJSON({...e.toJSON(),statistics:l,histograms:o})}function S(e){const t=e.bandCount;if(1===t)return null;if(2===t)return[0];const n=e.keyProperties&&e.keyProperties.BandProperties;let r;if(n&&n.length===t){const{red:e,green:t,blue:l,nir:a}=B(n);null!=e&&null!=t&&null!=l?r=[e,t,l]:null!=a&&null!=e&&null!=t&&(r=[a,e,t])}return!r&&t>=3&&(r=[0,1,2]),r}function L(e,t){var n;const r=e.keyProperties&&e.keyProperties.BandProperties;return(t=null!=(n=t)&&n.length?t:Array.from(Array(e.bandCount).keys())).map((t=>r&&r.length===e.bandCount&&r[t]&&r[t].BandName||"band_"+(t+1)))}function B(e){const t={};for(let r=0;r<e.length;r++){var n;const l=e[r],a=null==(n=l.BandName)?void 0:n.toLowerCase();if("red"===a)t.red=r;else if("green"===a)t.green=r;else if("blue"===a)t.blue=r;else if("nearinfrared"===a||"nearinfrared_1"===a||"nir"===a)t.nir=r;else if(l.WavelengthMax&&l.WavelengthMin){const e=l.WavelengthMin,n=l.WavelengthMax;null==t.blue&&e>=410&&e<=480&&n>=480&&n<=540?t.blue=r:null==t.green&&e>=490&&e<=560&&n>=560&&n<=610?t.green=r:null==t.red&&e>=595&&e<=670&&n>=660&&n<=730?t.red=r:null==t.nir&&e>=700&&e<=860&&n>=800&&n<=950&&(t.nir=r)}}return t}function E(e){let n="percent-clip";const{pixelType:r,dataType:l,histograms:a,statistics:o}=e;return"u8"!==r||"processed"!==l&&t(a)&&t(o)?"u8"===r||"elevation"===l||R.has(l)?n="min-max":t(a)?n="percent-clip":t(o)&&(n="min-max",n="min-max"):n="none",n}function O(n,r,l,a){if(!z(n,r))return null;const{attributeTable:s,statistics:i}=n,c=q(s,r),f=P(s,"red"),p=P(s,"green"),d=P(s,"blue"),b=new o,v=[],y=new Set,g=!!(f&&p&&d);if(t(s))s.features.forEach((t=>{const n=t.attributes[c.name];if(!y.has(t.attributes[c.name])&&null!=n){y.add(n);const r=g&&("single"===f.type||"double"===f.type)&&("single"===p.type||"double"===p.type)&&("single"===d.type||"double"===d.type)&&!s.features.some((e=>e.attributes[f.name]>1||e.attributes[p.name]>1||e.attributes[d.name]>1)),l=r?255:1;v.push(new m({value:t.attributes[c.name],label:t.attributes[c.name]+"",symbol:{type:"simple-fill",style:"solid",outline:null,color:new e(g?[t.attributes[f.name]*l,t.attributes[p.name]*l,t.attributes[d.name]*l,1]:[0,0,0,0])}}))}}));else if(null!=i&&i[0])for(let t=i[0].min;t<=i[0].max;t++)v.push(new m({value:t,label:t.toString(),symbol:{type:"simple-fill",style:"solid",outline:null,color:new e([0,0,0,0])}}));if(v.sort(((e,t)=>e.value&&"string"==typeof e.value.valueOf()?0:e.value>t.value?1:-1)),!g){const t=u(M,v.length);v.forEach(((n,r)=>n.symbol.color=new e(t[r].slice(1,4)))),b.colorRamp=M}if(l||a){const t=l||u(a,v.length).map((e=>e.slice(1)));v.forEach(((n,r)=>n.symbol.color=new e(t[r]))),b.colorRamp=a}return new h({field:c.name,uniqueValueInfos:v,authoringInfo:b})}function q(e,n,r){let a;return t(e)?(a=n?e.fields.find((e=>n.toLowerCase()===e.name.toLowerCase())):N(e.fields),a||(r||(a=e.fields.find((e=>"string"===e.type))),a||(a=P(e,"value")))):a=new l({name:"value"}),a}function N(e){let t;for(let n=0;n<e.length;n++){const r=e[n].name.toLowerCase();if("string"===e[n].type){if(r.startsWith("class")){t=e[n];break}null==t&&(r.endsWith("name")||r.endsWith("type"))&&(t=e[n])}}return t}function P(e,n){return t(e)?e.fields.find((e=>e.name.toLowerCase()===n)):null}function z(e,n){const{attributeTable:r,bandCount:l}=e;if(!t(r)&&G(e))return!0;if(!t(r)||l>1)return!1;if(n){if(null==r.fields.find((e=>e.name.toLowerCase()===n.toLowerCase())))return!1}return!0}function F(e){const{bandCount:n,colormap:r}=e;return t(r)&&r.length&&1===n}function W(e){if(!F(e))return null;let r;const{attributeTable:l,colormap:a}=e;if(t(l)){const e=P(l,"value"),t=q(l,null,!0);"string"===t.type&&(r={},l.features.forEach((n=>{const l=n.attributes;r[l[e.name]]=t?l[t.name]:l[e.name]})))}return v.createFromColormap(n(a),r)}function U(e){return"elevation"===e.dataType}function A(e,t){var n;if(!U(e))return null;const{extent:l}=e,a=l.width*r(l.spatialReference);return t=null!=(n=t)?n:"multi-directional",new y({hillshadeType:t,scalingType:a>5e6?"adjusted":"none"})}function D(e){const{attributeTable:n,bandCount:r}=e;return 1===r&&(t(n)||t(e.histograms))}function J(e,n){e=I(e,null==n?void 0:n.variableName);const{attributeTable:r}=e;if(!D(e))return null;const l=t(e.histograms)?e.histograms[0]:null,a=isFinite(null==n?void 0:n.numClasses)?n.numClasses:5,i=new o({classificationMethod:null==n?void 0:n.classificationMethod,colorRamp:null==n?void 0:n.colorRamp});let m=(null==n?void 0:n.field)||"value";const c=[],d=[],b=1e3,h=t(r),v=h&&r.fields.find((e=>"count"===e.name.toLowerCase())),y=h&&r.fields.find((e=>e.name.toLowerCase()===m.toLowerCase()));if(y){m=y.name;const e=r.features.length;let t=0;r.features.forEach((n=>t+=(v?n.attributes[v.name]:50)/e)),r.features.forEach((n=>{const r=n.attributes[y.name],l=v?n.attributes[v.name]:50;if(l>0){d.push(l);const n=Math.max(1,Math.round(l/e/t*b));for(let e=0;e<n;e++)c.push(r)}}))}else{const{pixelType:t}=e,n=(l.max-l.min)/l.size,a=t.indexOf("s")>-1||t.indexOf("u")>-1,o=a&&1===n?Math.floor(l.min+.5):l.min,s=a&&1===n?Math.floor(l.max-.5):l.max,i=l.size;let u,m=0;l.counts.forEach((e=>m+=e/i)),l.counts.forEach(((e,t)=>{if(e>0){d.push(e);const a=Math.max(1,Math.round(e/i/m*b));u=h?r.features[t].attributes[y.name]:0===t?o:t===i-1?s:l.min+n*(t+.5);for(let e=0;e<a;e++)c.push(u)}}))}const C=(null==n?void 0:n.classificationMethod)||"natural-breaks";let w=null==n?void 0:n.definedInterval;"defined-interval"!==C||w||(w=_(e,y,a));const M=p({values:c,valueFrequency:d,normalizationTotal:null,definition:new f({classificationMethod:C,breakCount:a,definedInterval:w})});let R=null==n?void 0:n.colors;if(!R){const e=(null==n?void 0:n.colorRamp)||x;i.colorRamp=e;const t=u(e,M.classBreaks.length,!0);R=t.map((e=>e.slice(1)))}const T=M.classBreaks.map(((e,t)=>new s({minValue:e.minValue,maxValue:e.maxValue,label:e.label,symbol:{type:"simple-fill",color:R[t]}})));return new g({field:m,classBreakInfos:T,authoringInfo:i})}function _(e,n,r){let l=0,a=0;if(t(e.attributeTable)){const t=e.attributeTable;l=a=t.features[0].attributes[n.name],t.features.forEach((e=>{const t=e.attributes[n.name];t<l&&(l=t),t>a&&(a=t)}))}else if(t(e.histograms)){const t=e.histograms;l=t[0].min,a=t[0].max}return(a-l)/r}function G(e){var t,n,r;return["u8","s8"].indexOf(e.pixelType)>-1&&null!=(null==(t=e.statistics)||null==(n=t[0])?void 0:n.min)&&null!=(null==(r=e.statistics[0])?void 0:r.max)&&1===e.bandCount}function H(t){const n=[];for(let r=0;r<t.length-1;r++)n[r]=new c({algorithm:"hsv",fromColor:t[r],toColor:t[r+1]||new e({r:255,g:255,b:255,a:1})});if(t.length>2){return new d({colorRamps:n})}return n[0]}function K(e){const{dataType:t}=e;return"vector-uv"===t||"vector-magdir"===t}function Q(e){const{dataType:t}=e;return"vector-uv"===t||"vector-magdir"===t}const X=new Map([["m/s","meter-per-second"],["km/h","kilometer-per-hour"],["knots","knots"],["ft/s","feet-per-second"],["mph","mile-per-hour"]]);function Y(e){if(!K(e))return null;let n;if(t(e.statistics)&&e.statistics.length){const t="vector-uv"===e.dataType,{min:r,max:l}=e.statistics[0];n=[{type:"size",field:"Magnitude",minSize:10,maxSize:40,minDataValue:t?Math.min(Math.abs(r),Math.abs(l)):r,maxDataValue:t?Math.max(Math.abs(r),Math.abs(l)):l}]}const r=t(e.multidimensionalInfo)?X.get(e.multidimensionalInfo.variables[0].unit):null,l=new C({visualVariables:n,inputUnit:r,rotationType:"geographic"});return l.visualVariables=[...l.sizeVariables,...l.rotationVariables],l}function Z(e){var t;return{color:null==(t=e.symbolLayers[0].material)?void 0:t.color,type:"esriSFS",style:"esriSFSSolid"}}function $(e){if("uniqueValue"===e.type){var t;const n=e.uniqueValueInfos,r=n[0].symbol;return null!=r&&null!=(t=r.symbolLayers)&&t.length&&(e.uniqueValueInfos=n.map((e=>({value:e.value,label:e.label,symbol:e.symbol?Z(e.symbol):null})))),e}if("classBreaks"===e.type){var n;const t=e.classBreakInfos,r=t[0].symbol;return null!=r&&null!=(n=r.symbolLayers)&&n.length&&(e.classBreakInfos=t.map((e=>({classMinValue:e.classMinValue,classMaxValue:e.classMaxValue,label:e.label,symbol:e.symbol?Z(e.symbol):null})))),e}return e}export{J as createClassBreaksRenderer,H as createColorRamp,W as createColormapRenderer,T as createDefaultRenderer,A as createShadedReliefRenderer,V as createStretchRenderer,O as createUVRenderer,Y as createVectorFieldRenderer,L as getBandNames,q as getClassField,S as getDefaultBandCombination,k as getDefaultInterpolation,_ as getDefinedInterval,P as getField,j as getSupportedRendererTypes,B as getWellKnownBandIndexes,Q as isAnimatedFlowRendererSupported,D as isClassBreaksSupported,F as isColormapRendererSupported,U as isShadedReliefRendererSupported,G as isSingleBand8BitRasterWithStats,z as isUVRendererSupported,K as isVectorFieldRendererSupported,$ as normalizeRendererJSON};
|
package/rest/utils.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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e}from"../core/maybe.js";import{urlToObject as
|
|
5
|
+
import{isSome as e}from"../core/maybe.js";import{urlToObject as n}from"../core/urlUtils.js";import{getScale as t}from"../geometry/support/scaleUtils.js";import{getLayerFloorFilterClause as i,combineFloorsDefinitionExpression as r}from"../views/support/floorFilterUtils.js";function s(e,n){return n?{...n,query:{...e,...n.query}}:{query:e}}function o(e){return"string"==typeof e?n(e):e}function l(e,n,t){const i={};for(const r in e){if("declaredClass"===r)continue;const s=e[r];if(null!=s&&"function"!=typeof s)if(Array.isArray(s)){i[r]=[];for(let e=0;e<s.length;e++)i[r][e]=l(s[e])}else if("object"==typeof s)if(s.toJSON){const e=s.toJSON(t&&t[r]);i[r]=n?e:JSON.stringify(e)}else i[r]=n?s:JSON.stringify(s);else i[r]=s}return i}function f({mapExtent:e,floors:n,width:r,sublayers:s,layerIds:o}){const l={},f={extent:e,width:r,spatialReference:null==e?void 0:e.spatialReference};let u=s;null!=o&&o.length&&s&&(u=s.filter((e=>o.includes(e.id))));const c=t(f),y=[],p=e=>{const n=0===c,t=0===e.minScale||c<=e.minScale,i=0===e.maxScale||c>=e.maxScale;e.visible&&(n||t&&i)&&(e.sublayers?e.sublayers.forEach(p):y.unshift(e))};if(u&&u.forEach(p),u&&u.length){const e=y.map((e=>{const t=i(n,e);return e.toExportImageJSON(t)})),t=e.some((e=>"mapLayer"===e.source.type?e.source.mapLayerId!==e.id:"dataLayer"===e.source.type));if(t){let n=JSON.stringify(e);"[]"===n&&(n="[{}]"),l.dynamicLayers=n}else if(!t){if(null!=o&&o.length)l.layerIds=o;else{const e=u.map((({id:e})=>e));e.length&&(l.layerIds=e)}const e=a({floors:n,visibleSublayers:y});if(e&&e.length){const n=e.reduce(((e,n)=>(n.definitionExpression&&(e[n.id]=n.definitionExpression),e)),{});Object.keys(n).length&&(l.layerDefs=JSON.stringify(n))}}}else null!=o&&o.length&&(l.layerIds=o);return l}function a({floors:n,visibleSublayers:t}){const s=!(null==n||!n.length),o=t.filter((e=>null!=e.definitionExpression||s&&null!=e.floorInfo));if(!o.length)return null;return o.map((t=>{const s=i(n,t),o=e(s)?r(s,t):t.definitionExpression,l={id:t.id,definitionExpression:null};return o&&(l.definitionExpression=o),l}))}export{s as asValidOptions,l as encode,o as parseUrl,f as toDynamicLayersJSON};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Error.js";import{isSome as r}from"../../../core/maybe.js";import{formatNumber as a}from"../../../intl/number.js";import{createClassBreaksRenderer as t,getField as s}from"../../../renderers/support/rasterRendererHelper.js";import{processRasterRendererParameters as n}from"../support/utils.js";async function o(a){const t=(a=await n(a)).layer,{rasterInfo:o}=t;if(o.bandCount>1)throw new e("raster-class-breaks-renderer:not-supported","Multiband raster is not supported");a.field||(a.field=r(o.attributeTable)?s(o.attributeTable,"value").name:"value");
|
|
5
|
+
import e from"../../../core/Error.js";import{isSome as r}from"../../../core/maybe.js";import{formatNumber as a}from"../../../intl/number.js";import{createClassBreaksRenderer as t,getField as s}from"../../../renderers/support/rasterRendererHelper.js";import{processRasterRendererParameters as n}from"../support/utils.js";async function o(a){const t=(a=await n(a)).layer,{rasterInfo:o}=t;if(o.bandCount>1)throw new e("raster-class-breaks-renderer:not-supported","Multiband raster is not supported");a.field||(a.field=r(o.attributeTable)?s(o.attributeTable,"value").name:"value");if(!(r(o.attributeTable)&&o.attributeTable.fields.find((e=>e.name.toLowerCase()===a.field.toLowerCase())))&&!r(o.histograms)&&(await t.updateRasterInfoWithEstimatedStats({renderingRule:a.renderingRule,signal:a.signal}),!r(o.histograms)))throw new e("raster-class-breaks-renderer:not-supported","Histograms or raster attribute table is required on the source raster. Unable to estimate histograms");const{colors:i,numClasses:l}=a;if(i&&l&&i.length!==l)throw new e("raster-class-breaks-renderer:not-supported","The size of the `colors` parameter does not match 'numClasses'");return a.classificationMethod||(a.classificationMethod="natural-breaks"),a}async function i(a){a=await o(a);const s=t(a.layer.rasterInfo,a);if(!r(s))throw new e("raster-class-breaks-renderer:not-supported","Class breaks renderer is not supported on this data");const n={minValue:s.minValue,maxValue:s.classBreakInfos[s.classBreakInfos.length-1].maxValue,normalizationTotal:null,classBreakInfos:s.classBreakInfos.map((e=>{const r=l(e.minValue,e.maxValue);return e.label=r,{minValue:e.minValue,maxValue:e.maxValue,label:r}}))};return{renderer:s,classBreaksResult:n}}function l(e,r){return a(e,{maximumFractionDigits:3})+" - "+a(r,{maximumFractionDigits:3})}export{i as createRenderer};
|
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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const e="20220105",b="0ee8e43ad8942a4c23c64beb62b54839d7e3b01c";export{e as buildDate,b 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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{property as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import r from"../../../../core/Accessor.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{loadImagery as i}from"./dataUtils.js";import a from"./FlowContainer.js";import n from"./FlowStrategy.js";import l from"./FlowStyle.js";let p=class extends r{constructor(){super(...arguments),this._loadImagery=(e,t,r,s)=>i(this.layer,e,t,r,s),this._createStreamlinesMesh=(e,t,r)=>this.layer.createStreamlinesMesh({flowData:t,rendererSettings:e},{signal:r}),this.container=null,this.layer=null,this.type="rasterAnimatedFlow",this.redrawOrRefetch=async()=>{this._rendererChanged()}}get updating(){return!this._strategy||this._strategy.updating}update(e){e.stationary?this._strategy.update(e):this.layerView.requestUpdate()}hitTest(e){return new t({attributes:{},geometry:e.clone(),layer:this.layer})}install(e){this.container=new a,e.addChild(this.container),this._strategy=new n({flowContainer:this.container}),this._rendererChanged()}uninstall(){this._strategy.destroy(),this.container.removeAllChildren(),this.container.remove()}moveEnd(){}async doRefresh(){}attach(){}_rendererChanged(){if("animated-flow"!==this.layer.renderer.type)return;const e=new l(this._loadImagery,this._createStreamlinesMesh,this.layer.renderer);this.container.flowStyle=e,this.layerView.requestUpdate()}};e([s()],p.prototype,"_strategy",void 0),e([s()],p.prototype,"container",void 0),e([s()],p.prototype,"layer",void 0),e([s()],p.prototype,"layerView",void 0),e([s()],p.prototype,"type",void 0),e([s()],p.prototype,"updating",null),p=e([o("esri.views.2d.engine.flow.AnimatedFlowView2D")],p);const h=p;export{h as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{init as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import i from"../../../Graphic.js";import t from"../../../core/Collection.js";import{init as s,watch as r}from"../../../core/watchUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{GraphicsCollection as o}from"../../../support/GraphicsCollection.js";import n from"../engine/flow/AnimatedFlowView2D.js";import{LayerView2DMixin as l}from"./LayerView2D.js";import p from"./graphics/GraphicsView2D.js";import u from"./graphics/HighlightGraphicContainer.js";import c from"./imagery/ImageryGraphicsView2D.js";import w from"./imagery/ImageryView2D.js";import{ImageryLayerView as d}from"../../layers/ImageryLayerView.js";import m from"../../layers/LayerView.js";import{RefreshableLayerView as y}from"../../layers/RefreshableLayerView.js";let g=class extends(d(y(l(m)))){constructor(){super(...arguments),this._exportImageVersion=-1}initialize(){this.handles.add([s(this,["layer.blendMode","layer.effects"],(e=>{this.subview&&(this.subview.container.blendMode=e)}),!0),s(this,"layer.effect",(e=>{this.subview&&(this.subview.container.effect=e)}),!0)])}get pixelData(){return this.updating?null:"getPixelData"in this.subview?this.subview.getPixelData():null}get updating(){return!!(!this.subview||"updating"in this.subview&&this.subview.updating)}async hitTest(e,i){return this.subview?[this.subview.hitTest(e)]:null}update(e){var i;null==(i=this.subview)||i.update(e)}attach(){this.layer.increaseRasterJobHandlerUsage(),this._setSubView(),this.handles.add([s(this,"layer.exportImageServiceParameters.version",(e=>{this._exportImageVersion!==e&&(this._exportImageVersion=e,this.requestUpdate())})),this.watch("timeExtent",(()=>{"timeExtent"in this.subview&&(this.subview.timeExtent=this.timeExtent),this.requestUpdate()})),this.layer.on("redraw",(()=>{"redraw"in this.subview?this.subview.redraw():this.subview.redrawOrRefetch()})),r(this.layer,"renderer",(()=>this._setSubView()))],"imagerylayerview-update")}detach(){var e,i;this.layer.decreaseRasterJobHandlerUsage(),this.subview.destroy(),null==(e=this._highlightGraphics)||e.destroy(),null==(i=this._highlightView)||i.destroy(),this.handles.remove("imagerylayerview-update"),this._exportImageVersion=-1}moveStart(){}viewChange(){}moveEnd(){this.requestUpdate()}highlight(e,s){if(!((Array.isArray(e)?e[0]:t.isCollection(e)?e.getItemAt(0):e)instanceof i))return{remove:()=>{}};let r=[];return Array.isArray(e)||t.isCollection(e)?r=e.map((e=>e.clone())):e instanceof i&&(r=[e.clone()]),this._highlightGraphics.addMany(r),{remove:()=>{this._highlightGraphics.removeMany(r)}}}async doRefresh(){this.requestUpdate()}isUpdating(){return!this.subview||!this.suspended&&this.subview.updating}_setSubView(){var e,i;let t="Imagery";"vector-field"===(null==(e=this.layer.renderer)?void 0:e.type)&&"lerc"===this.layer.format&&(t="Graphics");var s,r,a;("animated-flow"===(null==(i=this.layer.renderer)?void 0:i.type)&&(t="Flow"),this.subview&&this.subview.type===t)||(null==(s=this.subview)||s.uninstall(this.container),null==(r=this.subview)||r.destroy(),null==(a=this._highlightGraphics)||a.destroy(),this._highlightView&&(this._highlightView.destroy(),this.container.removeChild(this._highlightView.container)),this.subview="Imagery"===t?new w({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):"Graphics"===t?new c({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):new n({layer:this.layer,layerView:this}),this.subview.attach(),this.subview.install(this.container),this.subview.container.blendMode=this.layer.blendMode,this.subview.container.effect=this.layer.effect);this._highlightGraphics=new o,this._highlightView=new p({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new u(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container),this.requestUpdate()}};e([a()],g.prototype,"pixelData",null),e([a({readOnly:!0})],g.prototype,"updating",null),e([a()],g.prototype,"subview",void 0),g=e([h("esri.views.2d.layers.ImageryLayerView2D")],g);const v=g;export{v as default};
|