@arcgis/core 5.0.0-next.39 → 5.0.0-next.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Basemap.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/02d1c48e874dfd985bc4.js +1 -0
- package/assets/esri/core/workers/chunks/0429ca6ba562ae29897e.js +1 -0
- package/assets/esri/core/workers/chunks/{a6324f5f560ffadc6e5d.js → 061def9163a09c804b5c.js} +1 -1
- package/assets/esri/core/workers/chunks/0e4d0213d568f50c231f.js +1 -0
- package/assets/esri/core/workers/chunks/{1de216d9850c39c1735d.js → 1357cc637524cd254974.js} +1 -1
- package/assets/esri/core/workers/chunks/13839d220e5c62404923.js +1 -0
- package/assets/esri/core/workers/chunks/1c0fb4795a52204882a8.js +1 -0
- package/assets/esri/core/workers/chunks/1e286fb7bb833f00dd88.js +1 -0
- package/assets/esri/core/workers/chunks/{52ecbaa2d32692d6d8df.js → 1f6ead46b723630db897.js} +1 -1
- package/assets/esri/core/workers/chunks/218b2b767b40d85fb713.js +1 -0
- package/assets/esri/core/workers/chunks/2c9865e34f32fb5683e5.js +1 -0
- package/assets/esri/core/workers/chunks/{48d1a443b324753921de.js → 2db7a7607657f1d669f7.js} +1 -1
- package/assets/esri/core/workers/chunks/2f8cf7d9ff1f4de19a4c.js +1 -0
- package/assets/esri/core/workers/chunks/{6330d8767ba1d5329daa.js → 31b074ae2162a3508d2a.js} +1 -1
- package/assets/esri/core/workers/chunks/338570424337be05cef5.js +1 -0
- package/assets/esri/core/workers/chunks/{a59433c78ed01febca6d.js → 3767617c0dfc7d801441.js} +1 -1
- package/assets/esri/core/workers/chunks/3a16347e17312556e02c.js +1 -0
- package/assets/esri/core/workers/chunks/3ac8de121a07c70bae0f.js +1 -0
- package/assets/esri/core/workers/chunks/3f33708eb39c7169a226.js +1 -0
- package/assets/esri/core/workers/chunks/4278b35fb6fd578c403e.js +1 -0
- package/assets/esri/core/workers/chunks/{3f8849c49f0e3ce7eb6b.js → 44f036cc21e3a2308f69.js} +1 -1
- package/assets/esri/core/workers/chunks/46daa1ff5b412a97edc9.js +1 -0
- package/assets/esri/core/workers/chunks/{a5d25c71aa4dfaa878cf.js → 4c4a55be41ba105c091c.js} +1 -1
- package/assets/esri/core/workers/chunks/537de53ef1e9101468f5.js +1 -0
- package/assets/esri/core/workers/chunks/679088064420a906aa7f.js +1 -0
- package/assets/esri/core/workers/chunks/6e8c20ff1d28ef2fe72c.js +1 -0
- package/assets/esri/core/workers/chunks/75643711d9585ee26a15.js +1 -0
- package/assets/esri/core/workers/chunks/7ba13b52fce1060fbb2a.js +1 -0
- package/assets/esri/core/workers/chunks/800c91302eaad7f00877.js +1 -0
- package/assets/esri/core/workers/chunks/804958f3f4ff47a4eff5.js +1 -0
- package/assets/esri/core/workers/chunks/816227de5bd42b437df4.js +1 -0
- package/assets/esri/core/workers/chunks/926c2a0e21b7aa1a86e4.js +1 -0
- package/assets/esri/core/workers/chunks/933dce4d4ff8b90219c8.js +1 -0
- package/assets/esri/core/workers/chunks/93d11075f65a5b6625ea.js +1 -0
- package/assets/esri/core/workers/chunks/9c0efd06c9000ccbd62d.js +1 -0
- package/assets/esri/core/workers/chunks/9f1d3c0b53bef07e39bf.js +1 -0
- package/assets/esri/core/workers/chunks/9f2a8445a5848502c7e7.js +1 -0
- package/assets/esri/core/workers/chunks/9f6c63a580b28ab715bd.js +1 -0
- package/assets/esri/core/workers/chunks/a96742e678a506c461ab.js +1 -0
- package/assets/esri/core/workers/chunks/b7bcff9a64f41a0a0b6a.js +1 -0
- package/assets/esri/core/workers/chunks/c0b15510a8cab98df77f.js +1 -0
- package/assets/esri/core/workers/chunks/c367c7e553be3682f2db.js +1 -0
- package/assets/esri/core/workers/chunks/cfd2839e218610a222e5.js +1 -0
- package/assets/esri/core/workers/chunks/{014dbe6fa93a277b08f7.js → d0014b4a8c013f59b113.js} +1 -1
- package/assets/esri/core/workers/chunks/d08ee45c501102deea20.js +1 -0
- package/assets/esri/core/workers/chunks/d42273394f575e71dd55.js +1 -0
- package/assets/esri/core/workers/chunks/d723619579cc8f5ef2cd.js +1 -0
- package/assets/esri/core/workers/chunks/da1e61f355fb943085dc.js +1 -0
- package/assets/esri/core/workers/chunks/dddb6cb44cbe4dc1af97.js +1 -0
- package/assets/esri/core/workers/chunks/efc293c8bbc12156096d.js +1 -0
- package/assets/esri/core/workers/chunks/f65f1798f398bc549463.js +1 -0
- package/assets/esri/core/workers/chunks/f93f0586ce10cb5d98b3.js +1 -0
- package/assets/esri/core/workers/chunks/{06462b267ff8d5984882.js → fb9643b74cf35221ff98.js} +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/GaussianSplat.glsl.js +2 -2
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/UnitFactory.js +1 -1
- package/config.js +1 -1
- package/core/has.js +1 -1
- package/form/FormTemplate.js +1 -1
- package/form/elements/GroupElement.js +1 -1
- package/form/elements/inputs/attachments/AttachmentInput.js +1 -1
- package/geometry/FlatGeometry.js +5 -0
- package/geometry/operators/gx/operatorShapePreservingProject.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/aaBoundingBox.js +1 -1
- package/geometry/support/aaBoundingRect.js +1 -1
- package/geometry/support/boundsUtils.js +1 -1
- package/interfaces.d.ts +259 -7
- package/kernel.js +1 -1
- package/layers/BaseElevationLayer.js +1 -1
- package/layers/BaseTileLayer.js +1 -1
- package/layers/CSVLayer.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/GeoJSONLayer.js +1 -1
- package/layers/GroupLayer.js +1 -1
- package/layers/MapImageLayer.js +1 -1
- package/layers/MediaLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/VideoLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/mixins/PortalLayer.js +1 -1
- package/layers/mixins/TemporalLayer.js +1 -1
- package/layers/mixins/operationalLayerModuleMap.js +1 -1
- package/layers/mixins/operationalLayers.js +1 -1
- package/layers/support/LocalMediaElementSource.js +1 -1
- package/layers/support/ParquetEncodingBase.js +1 -1
- package/layers/support/ParquetEncodingLocation.js +1 -1
- package/layers/support/ParquetEncodingWkb.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/WMSSublayer.js +1 -1
- package/layers/support/layersCreator.js +1 -1
- package/layers/support/lazyLayerLoader.js +1 -1
- package/layers/support/parquetUtils.js +1 -1
- package/libs/parquet/parquet.js +1 -1
- package/package.json +2 -2
- package/renderers/FlowRenderer.js +1 -1
- package/renderers/VectorFieldRenderer.js +1 -1
- package/renderers/visualVariables/support/ColorSizeStop.js +1 -1
- package/renderers/visualVariables/support/SizeStop.js +1 -1
- package/support/LayersMixin.js +1 -1
- package/support/TablesMixin.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/edges/Edges3D.js +1 -1
- package/versionManagement/VersionManager.d.ts +4 -0
- package/versionManagement/VersionManager.js +5 -0
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatAtlasPages.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
- package/views/input/gamepad/GamepadInputDevice.js +1 -1
- package/views/layers/support/{Geometry.js → GeometryClipArea.js} +1 -1
- package/views/webgl/capabilities/Capabilities.js +1 -1
- package/views/webgl/capabilities/load.js +1 -1
- package/webdoc/support/writeUtils.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/09ac2bbc7327e6e6b5a2.js +0 -1
- package/assets/esri/core/workers/chunks/1432e789aa4cba627337.js +0 -1
- package/assets/esri/core/workers/chunks/1a9ed3c59a9a8bafb251.js +0 -1
- package/assets/esri/core/workers/chunks/1c857191e5898aba50fe.js +0 -1
- package/assets/esri/core/workers/chunks/234ffd08c2be03a0b9fe.js +0 -1
- package/assets/esri/core/workers/chunks/2d0d8243ed0c21f8a498.js +0 -1
- package/assets/esri/core/workers/chunks/31675811cacdb6fd96cf.js +0 -1
- package/assets/esri/core/workers/chunks/39d2b540738431adec98.js +0 -1
- package/assets/esri/core/workers/chunks/48820e12d94eb49c0a65.js +0 -1
- package/assets/esri/core/workers/chunks/4c278fb2d51ca6226050.js +0 -1
- package/assets/esri/core/workers/chunks/4d6706d6dbe578653c28.js +0 -1
- package/assets/esri/core/workers/chunks/4ff40eea70d19c934504.js +0 -1
- package/assets/esri/core/workers/chunks/59ce992d3a5e7c32b9fb.js +0 -1
- package/assets/esri/core/workers/chunks/5e30acfda04f7fc2b676.js +0 -1
- package/assets/esri/core/workers/chunks/6052eccb9395c8efb295.js +0 -1
- package/assets/esri/core/workers/chunks/61369838aa337d0156c5.js +0 -1
- package/assets/esri/core/workers/chunks/690a40d2eef52bfc149f.js +0 -1
- package/assets/esri/core/workers/chunks/6b820f14c110d9da118e.js +0 -1
- package/assets/esri/core/workers/chunks/7fd2366ee1fc81fa8c56.js +0 -1
- package/assets/esri/core/workers/chunks/8d9e622cec13f5cea726.js +0 -1
- package/assets/esri/core/workers/chunks/9110287f272141f60c35.js +0 -1
- package/assets/esri/core/workers/chunks/98997841ec3955287ba2.js +0 -1
- package/assets/esri/core/workers/chunks/a716b8fdeda4e16f03ab.js +0 -1
- package/assets/esri/core/workers/chunks/a9577a700b6a7b69d6aa.js +0 -1
- package/assets/esri/core/workers/chunks/ad4fcb73cfe9a1e4b710.js +0 -1
- package/assets/esri/core/workers/chunks/aead7c9830fa310e5b53.js +0 -1
- package/assets/esri/core/workers/chunks/b48aceaeefa07214e430.js +0 -1
- package/assets/esri/core/workers/chunks/bcfa98b6866a96c194cb.js +0 -1
- package/assets/esri/core/workers/chunks/c052fb8c952cda0b5d13.js +0 -1
- package/assets/esri/core/workers/chunks/c0d6f8e55349f4f5cd58.js +0 -1
- package/assets/esri/core/workers/chunks/c1a4d1ec0125617374b4.js +0 -1
- package/assets/esri/core/workers/chunks/c582fb447c89d732cfff.js +0 -1
- package/assets/esri/core/workers/chunks/cb500d673ca7ec1ef945.js +0 -1
- package/assets/esri/core/workers/chunks/ce99abfdcd71ff9e4e36.js +0 -1
- package/assets/esri/core/workers/chunks/cf0e2c91b330b1d0ef77.js +0 -1
- package/assets/esri/core/workers/chunks/d764b6273974f4bca31b.js +0 -1
- package/assets/esri/core/workers/chunks/d87dc2eeffabd3507143.js +0 -1
- package/assets/esri/core/workers/chunks/dca6a61fd239cf1ff90c.js +0 -1
- package/assets/esri/core/workers/chunks/edc3d98f33d7bf959154.js +0 -1
- package/assets/esri/core/workers/chunks/f1381c5a2a1de1ef9139.js +0 -1
- package/assets/esri/core/workers/chunks/f6148611d883a59f8fb8.js +0 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../PopupTemplate.js";import r from"../../core/Error.js";import{clone as i}from"../../core/lang.js";import o from"../../core/Logger.js";import{MultiOriginJSONMixin as s}from"../../core/MultiOriginJSONSupport.js";import{property as n,subclass as a}from"../../core/accessorSupport/decorators.js";import"../../core/workers/workers.js";import p from"../../geometry/Extent.js";import l from"../../geometry/Point.js";import y from"../../geometry/Polygon.js";import d from"../../geometry/Polyline.js";import{initializeProjection as u,project as m}from"../../geometry/projectionUtils.js";import h from"../../geometry/SpatialReference.js";import{wgs84 as c}from"../../geometry/support/spatialReferenceUtils.js";import{featureGeometryTypeKebabDictionary as g}from"../../geometry/support/typeUtils.js";import f from"../../graphic/KnowledgeGraphGraphicOrigin.js";import b from"../../graphic/LinkChartGraphicOrigin.js";import j from"../Layer.js";import w from"../graphics/data/FeatureStore.js";import{QueryEngine as T}from"../graphics/data/QueryEngine.js";import{createDrawingInfo as v}from"../graphics/sources/support/clientSideDefaults.js";import{systemOidFieldName as I,systemAggregationCountFieldName as O,systemIsSpatialFieldName as E,systemLayoutGeometryFieldName as S,systemOriginIdFieldName as x,systemDestinationIdFieldName as L}from"./constants.js";import{KnowledgeGraphSublayerBase as N}from"./KnowledgeGraphSublayerBase.js";import{createCapabilitiesFromKnowledgeGraph as _,createDefaultKGSLFormTemplate as F,getDisplayLabelProperty as R,getLinkChartDefaultLabelingInfo as C,getMapDefaultLabelingInfo as k,getKGSublayerSymbolColor as Q,getDefaultLCRelationshipSublayerSymbol as M,createDefaultKGSLFeatureTemplates as P,convertLayerEditsToGraphEdits as G,convertGraphEditsResultToFeatureEdits as D}from"./layerUtils.js";import{BlendLayer as J,blendModeProperty as q,effectProperty as U}from"../mixins/BlendLayer.js";import{DisplayFilteredLayer as A,displayFilterEnabledProperty as B,displayFilterInfoProperty as Z}from"../mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as K,featureEffectProperty as V}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as H}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as W,orderByProperty as Y}from"../mixins/OrderedLayer.js";import{RefreshableLayer as z}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as X}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as $,useViewTimeProperty as ee}from"../mixins/TemporalLayer.js";import{legendEnabled as te,maxScale as re,minScale as ie,opacity as oe,popupEnabled as se}from"../support/commonProperties.js";import{featureReductionProperty as ne}from"../support/featureReductionUtils.js";import ae from"../support/Field.js";import{fixRendererFields as pe,fixTimeInfoFields as le}from"../support/fieldUtils.js";import ye from"../support/LabelClass.js";import{reader as de}from"../support/labelingInfo.js";import ue from"../support/TimeInfo.js";import me from"../../renderers/SimpleRenderer.js";import{fromJSON as he}from"../../renderers/support/jsonUtils.js";import{rendererTypes as ce}from"../../renderers/support/typeUtils.js";import{executeApplyEdits as ge}from"../../rest/knowledgeGraphService.js";import fe from"../../rest/support/FeatureSet.js";import be from"../../rest/support/Query.js";import{createPopupTemplate as je}from"../../support/popupUtils.js";import{applyColorToSymbol as we}from"../../symbols/support/utils.js";import Te from"../../core/workers/RemoteClient.js";import{writer as ve}from"../../core/accessorSupport/decorators/writer.js";function Ie(e){if(!e.json)return e;e.json.write=Oe(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=Oe(e.write))}return e}function Oe(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=Ee(e)),e):!0===e?Se():e}function Ee(e){const{target:t,writer:r,overridePolicy:i,...o}=e;return function(e,t){const r=xe.call(this,e,t);return r.enabled?{...o,...r}:r}}function Se(){return{overridePolicy:xe}}function xe(e,t){const r=!!this.geometryType;let i={enabled:r};return r&&(i={...i,...Le.call(this,e,t)}),i}function Le(e,t){return{ignoreOrigin:this.originIdOf(t)>0}}let Ne=class extends(N(A(H(K(J(W($(X(z(s(j))))))))))){constructor(e){super(e),this.blendMode="normal",this.charts=null,this.definitionExpression=null,this.displayFilterEnabled=!0,this.displayFilterInfo=null,this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=I,this.objectType=null,this.opacity=1,this.orderBy=null,this.parent=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then(()=>{const e=new MessageChannel;return new Te(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=be.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]})},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get capabilities(){return this.parent?this.parent.sublayerCapabilities:_(null)}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.capabilities.operations.supportsEditing}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get isTable(){return"link-chart"!==this.parentCompositeLayer?.type&&null==this.geometryFieldName}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach(t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(ae.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))}),e.push(ae.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),ae.fromJSON({name:O,type:"esriFieldTypeInteger",alias:O,editable:!1}),ae.fromJSON({name:E,type:"esriFieldTypeInteger",alias:E,editable:!1})),e}get formTemplate(){return this._isOverridden("formTemplate")?this._get("formTemplate"):F(this)}set formTemplate(e){this._overrideIfSome("formTemplate",e)}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?g.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return S;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphicOrigin(){if(!this.parent)return null;switch(this.parent.type){case"knowledge-graph":return new f(this.parent,this);case"link-chart":return new b(this.parent,this)}}get graphTypeName(){return this.objectType?.name}set graphTypeName(e){this._set("graphTypeName",e)}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set labelingInfo(e){this._set("labelingInfo",e)}get labelingInfo(){if(this._isOverridden("labelingInfo"))return this._get("labelingInfo");if(!this.objectType||!this.parentCompositeLayer||!this.graphTypeName)return null;const e=this.objectType.properties?R(this.objectType.properties):"ESRI__ID";return"link-chart"===this.parentCompositeLayer.type?C(this.graphType,this.graphTypeName,e):k(this.graphTypeName,this.geometryType,e)}set renderer(e){pe(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const e=this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel,t=[...e?.entityTypes??[],...e?.relationshipTypes??[]].map(e=>e.name).indexOf(this.graphTypeName),r=Q(t);if("link-chart"===this.parentCompositeLayer?.type){if("relationship"===this.graphType)return new me({type:"simple",symbol:M(r)});const e=he(v(g.toJSON("point")).renderer);return we(e.symbol,r),e}const i=he(v(g.toJSON(this.geometryType)).renderer);return we(i.symbol,r),i}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??h.WGS84}get templates(){return this._isOverridden("templates")?this._get("templates"):P(this)}set templates(e){this._overrideIfSome("templates",e)}set timeInfo(e){this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return je(this,e)}createQuery(){return new be({where:"1=1",outFields:["*"]})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return null}async queryFeatures(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e),o=this.graphicOrigin,s=fe.fromJSON(await i.executeQuery(r.toJSON(),t?.signal));return s.features.forEach(e=>{e.sourceLayer=this,e.origin=o}),s}async queryFeaturesJSON(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return await i.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return i.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){await this.load();const r={...e,returnGeometry:!0},{resolvedQuery:i,queryEngine:o}=await this._setupQueryObjects(r),s=await o.executeQueryForExtent(i.toJSON(),t?.signal);let n;return n=null!=s.extent?.xmin&&null!=s.extent?.xmax&&null!=s.extent?.ymin&&null!=s.extent?.ymax?new p(s.extent):new p,{count:s.count,extent:n}}async queryObjectIds(e,t){await this.load();const r=be.from(e);let i;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)i=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);i=this.loadQueryEngine(e)}return await i.executeQueryForIds(r.toJSON(),t?.signal)}async applyEdits(e){if(!this.parentCompositeLayer.dataManager.knowledgeGraph)throw new r("knowledge-graph-sublayer:no-knowledge-graph","ApplyEdits cannot be executed because the parent does not have a Knowledge Graph model. This is usually caused by the layer not yet being loaded");const t=await G(e,this);t.options={cascadeDelete:!0,cascadeProvenanceDelete:!!this.parent?.knowledgeGraph.serviceDefinition.supportsProvenance||void 0};const i=await ge(this.parentCompositeLayer.dataManager.knowledgeGraph,t),o=D(i,this.graphTypeName),s={addedFeatures:o.addFeatureResults,updatedFeatures:o.updateFeatureResults,deletedFeatures:o.deleteFeatureResults,addedAttachments:o.addAttachmentResults,deletedAttachments:o.deleteAttachmentResults,updatedAttachments:o.updateAttachmentResults,exceededTransferLimit:!1,historicMoment:new Date,edits:void 0};return this.emit("edits",s),this.emit("apply-edits",{result:Promise.resolve(s)}),"link-chart"===this.parentCompositeLayer.type&&await this.parentCompositeLayer.refreshLinkChartCache([...s.addedFeatures.map(e=>e.globalId),...s.updatedFeatures.map(e=>e.globalId),...s.deletedFeatures.map(e=>e.globalId)]),o}loadQueryEngine(e){const t=new w({geometryType:g.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new T({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:g.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,featureIdInfo:{type:"object-id",fieldName:this.objectIdField},spatialReference:this.spatialReference.toJSON(),timeInfo:this.timeInfo?.toJSON(),featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new be({where:"1=1",outFields:[I]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}load(e){return this.addResolvingPromise(this.parent.load(e).then(()=>le(this.timeInfo,this.fieldsIndex))),Promise.resolve(this)}async _setupQueryObjects(e,t){const r=be.from(e),i=r.geometry;if(i&&!i.spatialReference?.isWGS84&&(await u(i.spatialReference,c),r.geometry=m(i instanceof y||i instanceof d||i instanceof l?i:i.extent,c)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)return{resolvedQuery:r,queryEngine:this._cachedQueryEngine};const o=await this.parentCompositeLayer.dataManager.getData(r,this,t);return{resolvedQuery:r,queryEngine:this.loadQueryEngine(o)}}};function _e(e,t,r){const i=[["ESRI__AGGREGATION_COUNT",O],["ESRI__ORIGIN_ID",x],["ESRI__DESTINATION_ID",L],["ESRI__LAYOUT_GEOMETRY",S]];try{for(const t of e)for(const[e,r]of i)t.labelExpression=t.labelExpression?.replaceAll(e,r),t.labelExpressionInfo?.expression&&(t.labelExpressionInfo.expression=t.labelExpressionInfo.expression.replaceAll(e,r))}catch(s){o.getLogger(this).warn("Error updating labelingInfo",s)}return de(e,t,r)}e([n(Ie(i(q)))],Ne.prototype,"blendMode",void 0),e([n({readOnly:!0})],Ne.prototype,"capabilities",null),e([n({readOnly:!0})],Ne.prototype,"userHasUpdateItemPrivileges",null),e([n({type:Boolean})],Ne.prototype,"editingEnabled",null),e([n()],Ne.prototype,"isTable",null),e([n({json:{origins:{"web-scene":{write:!1}},write:Se()}})],Ne.prototype,"charts",void 0),e([n({readOnly:!0})],Ne.prototype,"defaultPopupTemplate",null),e([n({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],Ne.prototype,"definitionExpression",void 0),e([n(Ie(i(B)))],Ne.prototype,"displayFilterEnabled",void 0),e([n(Ie(i(Z)))],Ne.prototype,"displayFilterInfo",void 0),e([n(Ie(i(U)))],Ne.prototype,"effect",void 0),e([n()],Ne.prototype,"elevationInfo",void 0),e([n(Ie(i(V)))],Ne.prototype,"featureEffect",void 0),e([n(Ie(i(ne)))],Ne.prototype,"featureReduction",null),e([n()],Ne.prototype,"fields",null),e([n()],Ne.prototype,"formTemplate",null),e([n()],Ne.prototype,"geometryType",null),e([n()],Ne.prototype,"geometryFieldName",null),e([n({readOnly:!0})],Ne.prototype,"graphicOrigin",null),e([n({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ne.prototype,"graphType",void 0),e([n({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ne.prototype,"graphTypeName",null),e([n()],Ne.prototype,"hasM",null),e([n()],Ne.prototype,"hasZ",null),e([n({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Ne.prototype,"id",void 0),e([n({type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",default:!1,write:{overridePolicy(){return{enabled:!!this.geometryType,alwaysWriteDefaults:!0,ignoreOrigin:!0}}}}})],Ne.prototype,"labelsVisible",void 0),e([n({type:[ye],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:_e,write:Se()}})],Ne.prototype,"labelingInfo",null),e([n({readOnly:!0,json:{read:!1,write:{writer(e,t){switch(this.parentCompositeLayer?.type){case"link-chart":t.layerType="LinkChartSubLayer";break;case"knowledge-graph":t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"}},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ne.prototype,"layerType",void 0),e([n(Ie(i(te)))],Ne.prototype,"legendEnabled",void 0),e([n(Ie(i(re)))],Ne.prototype,"maxScale",void 0),e([n(Ie(i(ie)))],Ne.prototype,"minScale",void 0),e([n()],Ne.prototype,"objectIdField",void 0),e([n()],Ne.prototype,"objectType",void 0),e([n(Ie(i(oe)))],Ne.prototype,"opacity",void 0),e([n(Ie(i(Y)))],Ne.prototype,"orderBy",void 0),e([n({clonable:!1})],Ne.prototype,"parent",void 0),e([n()],Ne.prototype,"parentCompositeLayer",void 0),e([n(Ie(i(se)))],Ne.prototype,"popupEnabled",void 0),e([n({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],Ne.prototype,"popupTemplate",void 0),e([n({type:Number,json:{write:{overridePolicy:Le}}})],Ne.prototype,"refreshInterval",void 0),e([n({types:ce,json:{name:"layerDefinition.drawingInfo.renderer",write:Se()}})],Ne.prototype,"renderer",null),e([n()],Ne.prototype,"source",void 0),e([n()],Ne.prototype,"spatialReference",null),e([n()],Ne.prototype,"templates",null),e([n({type:ue,json:{name:"layerDefinition.timeInfo",write:{overridePolicy:Le},origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:{overridePolicy:Le}},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:{overridePolicy:Le}}}}})],Ne.prototype,"timeInfo",null),e([n({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ne.prototype,"title",null),e([ve("title")],Ne.prototype,"writeTitle",null),e([n({json:{read:!1}})],Ne.prototype,"type",void 0),e([n(Ie(i(ee)))],Ne.prototype,"useViewTime",void 0),e([n({type:Boolean,json:{name:"visibility",write:Se()}})],Ne.prototype,"visible",void 0),Ne=e([a("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],Ne);export{Ne as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../PopupTemplate.js";import r from"../../core/Error.js";import{clone as i}from"../../core/lang.js";import o from"../../core/Logger.js";import{MultiOriginJSONMixin as s}from"../../core/MultiOriginJSONSupport.js";import{property as n,subclass as a}from"../../core/accessorSupport/decorators.js";import"../../core/workers/workers.js";import p from"../../form/FormTemplate.js";import l from"../../geometry/Extent.js";import d from"../../geometry/Point.js";import y from"../../geometry/Polygon.js";import u from"../../geometry/Polyline.js";import{initializeProjection as m,project as h}from"../../geometry/projectionUtils.js";import c from"../../geometry/SpatialReference.js";import{wgs84 as g}from"../../geometry/support/spatialReferenceUtils.js";import{featureGeometryTypeKebabDictionary as f}from"../../geometry/support/typeUtils.js";import b from"../../graphic/KnowledgeGraphGraphicOrigin.js";import j from"../../graphic/LinkChartGraphicOrigin.js";import w from"../Layer.js";import T from"../graphics/data/FeatureStore.js";import{QueryEngine as v}from"../graphics/data/QueryEngine.js";import{createDrawingInfo as I}from"../graphics/sources/support/clientSideDefaults.js";import{systemOidFieldName as O,systemAggregationCountFieldName as E,systemIsSpatialFieldName as S,systemLayoutGeometryFieldName as N,systemOriginIdFieldName as x,systemDestinationIdFieldName as L}from"./constants.js";import{KnowledgeGraphSublayerBase as F}from"./KnowledgeGraphSublayerBase.js";import{createCapabilitiesFromKnowledgeGraph as _,createDefaultKGSLFormTemplate as R,getDisplayLabelProperty as C,getLinkChartDefaultLabelingInfo as k,getMapDefaultLabelingInfo as M,getKGSublayerSymbolColor as Q,getDefaultLCRelationshipSublayerSymbol as P,createDefaultKGSLFeatureTemplates as G,convertLayerEditsToGraphEdits as J,convertGraphEditsResultToFeatureEdits as D}from"./layerUtils.js";import{BlendLayer as q,blendModeProperty as U,effectProperty as A}from"../mixins/BlendLayer.js";import{DisplayFilteredLayer as B,displayFilterEnabledProperty as Z,displayFilterInfoProperty as K}from"../mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as V,featureEffectProperty as H}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as W}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as Y,orderByProperty as z}from"../mixins/OrderedLayer.js";import{RefreshableLayer as X}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as $}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as ee,useViewTimeProperty as te}from"../mixins/TemporalLayer.js";import{legendEnabled as re,maxScale as ie,minScale as oe,opacity as se,popupEnabled as ne}from"../support/commonProperties.js";import{featureReductionProperty as ae}from"../support/featureReductionUtils.js";import pe from"../support/FeatureTemplate.js";import le from"../support/Field.js";import{fixRendererFields as de,fixTimeInfoFields as ye}from"../support/fieldUtils.js";import ue from"../support/LabelClass.js";import{reader as me}from"../support/labelingInfo.js";import he from"../support/TimeInfo.js";import ce from"../../renderers/SimpleRenderer.js";import{fromJSON as ge}from"../../renderers/support/jsonUtils.js";import{rendererTypes as fe}from"../../renderers/support/typeUtils.js";import{executeApplyEdits as be}from"../../rest/knowledgeGraphService.js";import je from"../../rest/support/FeatureSet.js";import we from"../../rest/support/Query.js";import{createPopupTemplate as Te}from"../../support/popupUtils.js";import ve from"../../symbols/support/ElevationInfo.js";import{applyColorToSymbol as Ie}from"../../symbols/support/utils.js";import Oe from"../../core/workers/RemoteClient.js";import{writer as Ee}from"../../core/accessorSupport/decorators/writer.js";function Se(e){if(!e.json)return e;e.json.write=Ne(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=Ne(e.write))}return e}function Ne(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=xe(e)),e):!0===e?Le():e}function xe(e){const{target:t,writer:r,overridePolicy:i,...o}=e;return function(e,t){const r=Fe.call(this,e,t);return r.enabled?{...o,...r}:r}}function Le(){return{overridePolicy:Fe}}function Fe(e,t){const r=!!this.geometryType;let i={enabled:r};return r&&(i={...i,..._e.call(this,e,t)}),i}function _e(e,t){return{ignoreOrigin:this.originIdOf(t)>0}}let Re=class extends(F(B(W(V(q(Y(ee($(X(s(w))))))))))){constructor(e){super(e),this.blendMode="normal",this.charts=null,this.definitionExpression=null,this.displayFilterEnabled=!0,this.displayFilterInfo=null,this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=O,this.objectType=null,this.opacity=1,this.orderBy=null,this.parent=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then(()=>{const e=new MessageChannel;return new Oe(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=we.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]})},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get capabilities(){return this.parent?this.parent.sublayerCapabilities:_(null)}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.capabilities.operations.supportsEditing}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get isTable(){return"link-chart"!==this.parentCompositeLayer?.type&&null==this.geometryFieldName}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[],t=new Map;for(const r of this.parent?.knowledgeGraph.dataModel.domains??[])t.set(r.name,r);return this.objectType?.properties?.forEach(r=>{const i="esriFieldTypeOID"===r.fieldType?"esriFieldTypeInteger":r.fieldType,o=le.fromJSON({name:r.name,type:i,alias:r.alias,defaultValue:r.defaultValue,editable:r.editable,nullable:r.nullable,domain:r.domain&&t.has(r.domain)?t.get(r.domain).toJSON():void 0});e.push(o)}),e.push(le.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),le.fromJSON({name:E,type:"esriFieldTypeInteger",alias:E,editable:!1}),le.fromJSON({name:S,type:"esriFieldTypeInteger",alias:S,editable:!1})),e}get formTemplate(){return this._isOverridden("formTemplate")?this._get("formTemplate"):R(this)}set formTemplate(e){this._overrideIfSome("formTemplate",e)}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?f.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return N;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphicOrigin(){if(!this.parent)return null;switch(this.parent.type){case"knowledge-graph":return new b(this.parent,this);case"link-chart":return new j(this.parent,this)}}get graphTypeName(){return this.objectType?.name}set graphTypeName(e){this._set("graphTypeName",e)}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set labelingInfo(e){this._set("labelingInfo",e)}get labelingInfo(){if(this._isOverridden("labelingInfo"))return this._get("labelingInfo");if(!this.objectType||!this.parentCompositeLayer||!this.graphTypeName)return null;const e=this.objectType.properties?C(this.objectType.properties):"ESRI__ID";return"link-chart"===this.parentCompositeLayer.type?k(this.graphType,this.graphTypeName,e):M(this.graphTypeName,this.geometryType,e)}set renderer(e){de(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const e=this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel,t=[...e?.entityTypes??[],...e?.relationshipTypes??[]].map(e=>e.name).indexOf(this.graphTypeName),r=Q(t);if("link-chart"===this.parentCompositeLayer?.type){if("relationship"===this.graphType)return new ce({type:"simple",symbol:P(r)});const e=ge(I(f.toJSON("point")).renderer);return Ie(e.symbol,r),e}const i=ge(I(f.toJSON(this.geometryType)).renderer);return Ie(i.symbol,r),i}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??c.WGS84}get templates(){return this._isOverridden("templates")?this._get("templates"):G(this)}set templates(e){this._overrideIfSome("templates",e)}set timeInfo(e){this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return Te(this,e)}createQuery(){return new we({where:"1=1",outFields:["*"]})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return this.fields.find(t=>t.name===e)?.domain||null}async queryFeatures(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e),o=this.graphicOrigin,s=je.fromJSON(await i.executeQuery(r.toJSON(),t?.signal));return s.features.forEach(e=>{e.sourceLayer=this,e.origin=o}),s}async queryFeaturesJSON(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return await i.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return i.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){await this.load();const r={...e,returnGeometry:!0},{resolvedQuery:i,queryEngine:o}=await this._setupQueryObjects(r),s=await o.executeQueryForExtent(i.toJSON(),t?.signal);let n;return n=null!=s.extent?.xmin&&null!=s.extent?.xmax&&null!=s.extent?.ymin&&null!=s.extent?.ymax?new l(s.extent):new l,{count:s.count,extent:n}}async queryObjectIds(e,t){await this.load();const r=we.from(e);let i;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)i=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);i=this.loadQueryEngine(e)}return await i.executeQueryForIds(r.toJSON(),t?.signal)}async applyEdits(e){if(!this.parentCompositeLayer.dataManager.knowledgeGraph)throw new r("knowledge-graph-sublayer:no-knowledge-graph","ApplyEdits cannot be executed because the parent does not have a Knowledge Graph model. This is usually caused by the layer not yet being loaded");const t=await J(e,this);t.options={cascadeDelete:!0,cascadeProvenanceDelete:!!this.parent?.knowledgeGraph.serviceDefinition.supportsProvenance||void 0};const i=await be(this.parentCompositeLayer.dataManager.knowledgeGraph,t),o=D(i,this.graphTypeName),s={addedFeatures:o.addFeatureResults,updatedFeatures:o.updateFeatureResults,deletedFeatures:o.deleteFeatureResults,addedAttachments:o.addAttachmentResults,deletedAttachments:o.deleteAttachmentResults,updatedAttachments:o.updateAttachmentResults,exceededTransferLimit:!1,historicMoment:new Date,edits:void 0};return this.emit("edits",s),this.emit("apply-edits",{result:Promise.resolve(s)}),"link-chart"===this.parentCompositeLayer.type&&await this.parentCompositeLayer.refreshLinkChartCache([...s.addedFeatures.map(e=>e.globalId),...s.updatedFeatures.map(e=>e.globalId),...s.deletedFeatures.map(e=>e.globalId)]),o}loadQueryEngine(e){const t=new T({geometryType:f.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new v({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:f.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,featureIdInfo:{type:"object-id",fieldName:this.objectIdField},spatialReference:this.spatialReference.toJSON(),timeInfo:this.timeInfo?.toJSON(),featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new we({where:"1=1",outFields:[O]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}load(e){return this.addResolvingPromise(this.parent.load(e).then(()=>ye(this.timeInfo,this.fieldsIndex))),Promise.resolve(this)}async _setupQueryObjects(e,t){const r=we.from(e),i=r.geometry;if(i&&!i.spatialReference?.isWGS84&&(await m(i.spatialReference,g),r.geometry=h(i instanceof y||i instanceof u||i instanceof d?i:i.extent,g)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)return{resolvedQuery:r,queryEngine:this._cachedQueryEngine};const o=await this.parentCompositeLayer.dataManager.getData(r,this,t);return{resolvedQuery:r,queryEngine:this.loadQueryEngine(o)}}};function Ce(e,t,r){const i=[["ESRI__AGGREGATION_COUNT",E],["ESRI__ORIGIN_ID",x],["ESRI__DESTINATION_ID",L],["ESRI__LAYOUT_GEOMETRY",N]];try{for(const t of e)for(const[e,r]of i)t.labelExpression=t.labelExpression?.replaceAll(e,r),t.labelExpressionInfo?.expression&&(t.labelExpressionInfo.expression=t.labelExpressionInfo.expression.replaceAll(e,r))}catch(s){o.getLogger(this).warn("Error updating labelingInfo",s)}return me(e,t,r)}e([n(Se(i(U)))],Re.prototype,"blendMode",void 0),e([n({readOnly:!0})],Re.prototype,"capabilities",null),e([n({readOnly:!0})],Re.prototype,"userHasUpdateItemPrivileges",null),e([n({type:Boolean})],Re.prototype,"editingEnabled",null),e([n()],Re.prototype,"isTable",null),e([n({json:{origins:{"web-scene":{write:!1}},write:Le()}})],Re.prototype,"charts",void 0),e([n({readOnly:!0})],Re.prototype,"defaultPopupTemplate",null),e([n({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],Re.prototype,"definitionExpression",void 0),e([n(Se(i(Z)))],Re.prototype,"displayFilterEnabled",void 0),e([n(Se(i(K)))],Re.prototype,"displayFilterInfo",void 0),e([n(Se(i(A)))],Re.prototype,"effect",void 0),e([n({type:ve})],Re.prototype,"elevationInfo",void 0),e([n(Se(i(H)))],Re.prototype,"featureEffect",void 0),e([n(Se(i(ae)))],Re.prototype,"featureReduction",null),e([n()],Re.prototype,"fields",null),e([n({type:p})],Re.prototype,"formTemplate",null),e([n()],Re.prototype,"geometryType",null),e([n()],Re.prototype,"geometryFieldName",null),e([n({readOnly:!0})],Re.prototype,"graphicOrigin",null),e([n({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Re.prototype,"graphType",void 0),e([n({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Re.prototype,"graphTypeName",null),e([n()],Re.prototype,"hasM",null),e([n()],Re.prototype,"hasZ",null),e([n({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Re.prototype,"id",void 0),e([n({type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",default:!1,write:{overridePolicy(){return{enabled:!!this.geometryType,alwaysWriteDefaults:!0,ignoreOrigin:!0}}}}})],Re.prototype,"labelsVisible",void 0),e([n({type:[ue],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:Ce,write:Le()}})],Re.prototype,"labelingInfo",null),e([n({readOnly:!0,json:{read:!1,write:{writer(e,t){switch(this.parentCompositeLayer?.type){case"link-chart":t.layerType="LinkChartSubLayer";break;case"knowledge-graph":t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"}},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Re.prototype,"layerType",void 0),e([n(Se(i(re)))],Re.prototype,"legendEnabled",void 0),e([n(Se(i(ie)))],Re.prototype,"maxScale",void 0),e([n(Se(i(oe)))],Re.prototype,"minScale",void 0),e([n()],Re.prototype,"objectIdField",void 0),e([n()],Re.prototype,"objectType",void 0),e([n(Se(i(se)))],Re.prototype,"opacity",void 0),e([n(Se(i(z)))],Re.prototype,"orderBy",void 0),e([n({clonable:!1})],Re.prototype,"parent",void 0),e([n()],Re.prototype,"parentCompositeLayer",void 0),e([n(Se(i(ne)))],Re.prototype,"popupEnabled",void 0),e([n({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],Re.prototype,"popupTemplate",void 0),e([n({type:Number,json:{write:{overridePolicy:_e}}})],Re.prototype,"refreshInterval",void 0),e([n({types:fe,json:{name:"layerDefinition.drawingInfo.renderer",write:Le()}})],Re.prototype,"renderer",null),e([n()],Re.prototype,"source",void 0),e([n()],Re.prototype,"spatialReference",null),e([n({type:pe})],Re.prototype,"templates",null),e([n({type:he,json:{name:"layerDefinition.timeInfo",write:{overridePolicy:_e},origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:{overridePolicy:_e}},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:{overridePolicy:_e}}}}})],Re.prototype,"timeInfo",null),e([n({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Re.prototype,"title",null),e([Ee("title")],Re.prototype,"writeTitle",null),e([n({json:{read:!1}})],Re.prototype,"type",void 0),e([n(Se(i(te)))],Re.prototype,"useViewTime",void 0),e([n({type:Boolean,json:{name:"visibility",write:Le()}})],Re.prototype,"visible",void 0),Re=e([a("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],Re);export{Re 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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import i from"../../request.js";import r from"../../core/Error.js";import{clone as s}from"../../core/lang.js";import n from"../../core/Logger.js";import{watch as a}from"../../core/reactiveUtils.js";import{urlToObject as o}from"../../core/urlUtils.js";import{property as l,subclass as u}from"../../core/accessorSupport/decorators.js";import{Integer as p,ensureRange as m,ensureClass as c,ensureNumber as h}from"../../core/accessorSupport/ensureType.js";import d from"../../geometry/Extent.js";import f from"../../geometry/Polygon.js";import g from"../../geometry/SpatialReference.js";import{srToRESTValue as y}from"../../geometry/support/spatialReferenceUtils.js";import{opacity as R,url as I}from"../support/commonProperties.js";import v from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as w}from"../support/ExportImageServiceParameters.js";import b from"../support/Field.js";import x from"../support/FieldsIndex.js";import{createBitmap as S}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as _}from"../support/imageryRendererUtils.js";import F from"../support/MosaicRule.js";import D from"../support/MultidimensionalSubset.js";import O from"../support/PixelBlock.js";import{interpolationKebab as T,noDataInterpretationKebab as C,pixelTypeKebabDict as M}from"../support/rasterEnums.js";import{getServicePixelValueField as N,getItemPixelValueField as P,getRawServicePixelValueField as q,getProcessedServicePixelValueField as j,getMagnitudeField as E,getDirectionField as A,getMultidimensionalFields as V,getRasterAttributeTableFields as Q,commonRasterFieldNames as J,addMultidimensionalFieldValues as U,rasterFieldPrefix as B}from"../support/rasterFieldUtils.js";import z from"../support/RasterFunction.js";import L from"../support/RasterInfo.js";import{intersectMultimensionalSubset as H,getEffectiveMultidimensionalDefinition as G,getSubsetVariablesFromMdInfo as k,getDefaultMultidimensionalDefinition as W}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as $,getFormat as X}from"../support/rasterFormats/RasterCodec.js";import{highlightPixels as K}from"../support/rasterFunctions/pixelUtils.js";import{uvComponentToVector as Y}from"../support/rasterFunctions/vectorFieldUtils.js";import{createDefaultRenderer as Z,getSupportedRendererTypes as ee,matchPresetRenderer as te,getDefaultBandCombination as ie,normalizeRendererJSON as re}from"../../renderers/support/rasterRendererHelper.js";import se from"../../renderers/support/RasterSymbolizer.js";import{websceneRasterRendererTypes as ne,rasterRendererTypes as ae,read as oe}from"../../renderers/support/rasterTypeUtils.js";import{calculateVolume as le,computeAngles as ue,computePixelSpaceLocations as pe,computeHistograms as me,computeStatisticsHistograms as ce,measureHeight as he,measureAreaAndPerimeter as de,measureDistanceAndAngle as fe,measurePointOrCentroid as ge,measureLengthFromImage as ye,measureAreaFromImage as Re,getImageSpatialReferenceQueryParameter as Ie,getSamples as ve,identify as we,imageToMap as be,imageToMapMultiray as xe,mapToImage as Se,findImages as _e,getImageUrl as Fe,queryBoundary as De,queryGPSInfo as Oe}from"../../rest/imageService.js";import{fetchServiceRasterInfo as Te,generateRasterInfo as Ce,patchServiceInfo as Me}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as Ne}from"../../rest/imageService/getCatalogItemRasterInfo.js";import{executeForCount as Pe}from"../../rest/query/executeForCount.js";import{executeForExtent as qe}from"../../rest/query/executeForExtent.js";import{executeForIds as je}from"../../rest/query/executeForIds.js";import{executeQueryJSON as Ee}from"../../rest/query/executeQueryJSON.js";import Ae from"../../rest/support/FeatureSet.js";import Ve from"../../rest/support/ImageIdentifyParameters.js";import Qe from"../../rest/support/Query.js";import{reader as Je}from"../../core/accessorSupport/decorators/reader.js";import{writer as Ue}from"../../core/accessorSupport/decorators/writer.js";const Be=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),ze=m(h,{min:0,max:255});function Le(e){const t=JSON.stringify(e),i=t.includes('"rasterFunctionDefinition":{'),r=i?t.match(/"type":"(.*?FunctionArguments")/gi):t.match(/"rasterFunction":"(.*?")/gi),s=r?.map(e=>i?e.slice(8,-18):e.slice(18,-1));return s?s.join("/"):null}const He=m=>{const h=m;let He=class extends h{constructor(){super(...arguments),this._functionRasterInfos={},this._serviceSupportsMosaicRule=null,this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=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.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new w({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach(t=>{e.set(t.name.toLowerCase().replaceAll(/ /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,i){null!=e&&"lerc"!==this.format&&(t[i]=e)}writeCompressionTolerance(e,t,i){"lerc"===this.format&&null!=e&&(t[i]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?F.fromJSON(t):null}get fieldsIndex(){return this.fields?new x(this.fields):null}set format(e){e&&Be.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?.mosaicMethod&&(t=F.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?F.fromJSON(i):this._isMosaicRuleSupported(t)?F.fromJSON(t):null}writeMosaicRule(e,t,i){const{mosaicRule:r}=this;this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=ze(e))}readObjectIdField(e,t){if(!e){const i=t.fields.find(e=>"esriFieldTypeOID"===e.type||"oid"===e.type);e=i?.name}return e}get parsedUrl(){return o(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}get renderer(){const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const i=t?.find(({name:t})=>t===e);return i?.renderer.clone()}return this.internalRenderer}set renderer(e){this.activePresetRendererName=null,this.internalRenderer=e}set internalRenderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("internalRenderer",e)}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer,s=oe(r,i);return null==s?null:("vector-field"===s.type&&t.symbolTileSize&&!r.symbolTileSize&&(s.symbolTileSize=t.symbolTileSize),_(s)||n.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),s)}writeRenderer(e,t,i){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.fields?.map(e=>e.clone())??[];e.push(N()),"mosaic-dataset"===this.sourceType&&this.fields?.length&&e.push(P()),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some(({name:e})=>"none"===e.toLowerCase())&&e.push(q()),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter(({name:e})=>"none"!==e.toLowerCase()).forEach(({name:t})=>e.push(j(t)));const{rasterInfo:t}=this;if(this._isVectorDataSet()){const i=t?.multidimensionalInfo?.variables[0].unit?.trim(),r=E(i),s=A();e.push(r,s)}if(t?.multidimensionalInfo&&"raster-dataset"===this.sourceType){const i=V(t.multidimensionalInfo);e.push(...i)}const i=t?.attributeTable;if(null!=i){const t=Q(i);e.push(...t)}return e}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=z.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i?.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?z.fromJSON({rasterFunctionDefinition:t.renderingRule}):z.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?g.fromJSON(i):null}writePixelType(e,t,i){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[i]=M.toJSON(e))}readVersion(e,t){let i=t.currentVersion;return i||(i=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),i}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let i=e,{renderer:r,symbolizer:s,pixelFilter:n}=this;const{isRawData:a}=e;if(a&&"lerc"!==this.format&&(r??=Z(this.rasterInfo,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}),s||(this.symbolizer=new se({rendererJSON:r.toJSON(),rasterInfo:this.rasterInfo}),s=this.symbolizer)),(a||!this._isPicture())&&r&&s&&!n){await this._updateSymbolizer(s,r);const{bandIds:n}=this;i=await this._symbolize({pixelData:e,bandIds:n,symbolizer:s},t)}return i}async highlightPixels(e,t){const i=e.highlightOptions.map(e=>{const t={...e},i="bandId"in t?[t.bandId??0]:[t.xBandId,t.yBandId];for(let r=0;r<i.length;r++){const e=i[r];if(null==e)return;const t=this.bandIds?.length?this.bandIds.indexOf(e):e;if(t<0||t>2)return;i[r]=t}return"bandId"in t?t.bandId=i[0]:(t.xBandId=i[0],t.yBandId=i[1]),t}).filter(e=>null!=e);if(0===i.length)return;const r=this._rasterJobHandler;r?await r.highlightPixels({...e,highlightOptions:i},t):K({...e,highlightOptions:i})}destroy(){this._shutdownJobHandler()}async calculateVolume(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsCalculateVolume)throw new r("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=s(e),this.mosaicRule&&null==e.mosaicRule&&(e.mosaicRule=this.mosaicRule),le(this.url,e,this._getRequestOptions(t))}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new r("imagery-layer:compute-angles","this operation is not supported on the input image service");return ue(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new r("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return pe(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new r("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=s(e),this._applyMosaicAndRenderingRules(e),me(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new r("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=s(e),this._applyMosaicAndRenderingRules(e),ce(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const i=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?i.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?i.mensuration.supportsHeightFromBaseAndTopShadow:i.mensuration.supportsHeightFromTopAndTopShadow))throw new r("imagery-layer:measure-height","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),he(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsAreaAndPerimeter&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),de(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsDistanceAndAngle&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),fe(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsPointOrCentroid&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),ge(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new r("imagery-layer:measure-length-from-image","this operation is not supported on the input image service");if("polyline"!==e.geometry.type)throw new r("imagery-layer:measure-length-from-image","this input geometry must be a polyline");return ye(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new r("imagery-layer:measure-area-from-image","this operation is not supported on the input image service");if("polygon"!==e.geometry.type)throw new r("imagery-layer:measure-area-from-image","this input geometry must be a polygon");return Re(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}async internalFetchImage(e,t,i,r={}){await this._updateCurrentRasterInfo();const{exportImageServiceParameters:s}=this;let n=!1;r.requestRawData&&(await this._initJobHandler(),s.requestRawData||"lerc"===this.format||(n=!0,s.requestRawData=!0));const a=this.getExportImageServiceParameters(e,t,i,r.timeExtent);if(n&&(s.requestRawData=!1),null==a){if(r.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=i,r.returnImageBitmap){return{imageBitmap:await S(e,`${Ge(this.parsedUrl)}/exportImage`,r.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,a=(s?.length||n.bandCount)??0,o=t*i,l=n.pixelType,u=[];for(let e=0;e<a;e++)u.push(O.createEmptyBand(l,o));return{pixelData:{pixelBlock:new O({width:t,height:i,pixels:u,mask:new Uint8Array(o),pixelType:l}),extent:e}}}const o=!!r.requestAsImageElement&&!this.pixelFilter,l=o&&!!r.returnImageBitmap,u={imageServiceParameters:a,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:o,returnImageBitmap:l,signal:r.signal};return this._requestArrayBuffer(u)}async fetchPixels(e,t,i,r={}){await this._initJobHandler(),r.applyRendering&&this._updateCurrentRasterInfo();const s=r.applyRendering?void 0:new w({layer:this,requestRawData:!0,interpolation:r.interpolation??"nearest",bandIds:r.bandIds??[]}),n=this.getExportImageServiceParameters(e,t,i,r.timeExtent,s);if(null==n)return{extent:e,pixelBlock:null};delete n.pixelType,r.bandIds||delete n.bandIds,delete n.compressionQuality;const a={imageServiceParameters:n,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:!1,returnImageBitmap:!1,signal:r.signal},{pixelData:o}=await this._requestArrayBuffer(a);return o??{extent:e,pixelBlock:null}}fetchKeyProperties(e){return i(Ge(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>e.data)}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new r("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):i(Ge(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>Ae.fromJSON(e.data))}getCatalogItemRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return Ne(Ge(this.parsedUrl),e,i)}async getCatalogItemICSInfo(e,t){const{data:r}=await i(Ge(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),s=r?.ics;if(!s)return;let n=null;try{n=(await i(Ge(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!n?.spatialReference)return{ics:s,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?i(Ge(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then(e=>e.data).catch(()=>({})):{},o=n.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[n]}),inSR:y(o),outSR:"0:"+e},u=i(Ge(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then(e=>e.data).catch(()=>({})),p=5,m=(n.xmin+n.xmax)/2,c=(n.ymax-n.ymin)/(p+1),h=n.ymin+c,f=[];for(let i=0;i<p;i++)f.push({x:m,y:h+c*i});const R={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:f}),inSR:y(o),outSR:"0:"+e},I=i(Ge(this.parsedUrl)+"/project",{query:this._getQueryParams(R),...t}).then(e=>e.data).catch(()=>({})),v=await Promise.all([a,u,I]);let w=v[0].ipxf;if(null==w){const e=s.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(w={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const b=d.fromJSON(v[1]?.geometries?.[0]);b&&(b.spatialReference=new g({wkid:0,imageCoordinateSystem:s}));const x=v[2].geometries?v[2].geometries.filter(e=>null!=e?.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y):[],S=x.length;if(S<3)return{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:null};let _=0,F=0,D=0,O=0;for(let i=0;i<S;i++)_+=x[i].x,F+=x[i].y,D+=x[i].x*x[i].x,O+=x[i].x*x[i].y;const T=(S*O-_*F)/(S*D-_*_);let C=0;const M=x[p-1].x>x[0].x,N=x[p-1].y>x[0].y;return T===1/0?C=N?90:270:0===T?C=M?0:180:T>0?C=M?180*Math.atan(T)/Math.PI:180*Math.atan(T)/Math.PI+180:T<0&&(C=N?180+180*Math.atan(T)/Math.PI:360+180*Math.atan(T)/Math.PI),{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:C}}async generateRasterInfo(e,t){e=c(z,e);const i={...t,query:this._getQueryParams()};if(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))return this.serviceRasterInfo??Te(Ge(this.parsedUrl),this.sourceJSON,i);const s=Le(e);if(!s)throw new r("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[s])return this._functionRasterInfos[s];const n=Ce(Ge(this.parsedUrl),e,i);this._functionRasterInfos[s]=n;try{return await n}catch(a){throw this._functionRasterInfos[s]=null,a}}getExportImageServiceParameters(e,t,i,r,s){e=e.clone().shiftCentralMeridian();const n=Ie(e.spatialReference,Ge(this.parsedUrl));s??=this.exportImageServiceParameters;const a=s.toJSON(),{bandIds:o,noData:l}=a;let{renderingRule:u}=a;const p=this.rasterFunction?.rasterFunctionDefinition,m=this.renderer?.type,c=!m||"raster-stretch"===m||"raster-colormap"===m||"unique-value"===m||"class-breaks"===m||"raster-shaded-relief"===m;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!p&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===u.rasterFunction)e.rasterFunctionArguments.Raster=u.rasterFunctionArguments.Raster,u.rasterFunctionArguments.Raster=e;else if("Colormap"===u.rasterFunction){const t=u.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,u.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=u,u=e;a.bandIds=void 0}else a.bandIds=o?.join(",");Array.isArray(l)&&l.length>0&&(a.noData=l.join(","));const h=this._processMultidimensionalIntersection(null,r,s.mosaicRule);if(h.isOutSide)return null;a.mosaicRule=null!=h.mosaicRule?JSON.stringify(h.mosaicRule):null,r=h.timeExtent,a.renderingRule=this._getRenderingRuleString(z.fromJSON(u));const d={};if(null!=r){const{start:e,end:t}=r.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+i,...a,...d}}async getSamples(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i?.operations.supportsGetSamples)throw new r("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=s(e);const{raster:n}=this;return n&&null==e.raster&&(e.raster=n),ve(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new r("imagery-layer:identify","identify operation is not supported on the input image service");e=s(e),this.version<10.91&&"extent"===e.geometry?.type&&(e.geometry=f.fromExtent(e.geometry));const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new r("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=i.timeExtent,e.mosaicRule=i.mosaicRule;const{raster:n,rasterFunction:a}=this;return a&&null==e.rasterFunction&&(e.rasterFunction=a),n&&null==e.raster&&(e.raster=n),we(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new r("imagery-layer:image-to-map","imageToMap operation is not supported on the input image service");return be(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new r("imagery-layer:image-to-map-multiray","imageToMapMultiray operation is not supported on the input image service");return xe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new r("imagery-layer:map-to-image","mapToImage operation is not supported on the input image service");return Se(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new r("imagery-layer:find-images","findImages operation is not supported on the input image service");return _e(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new r("imagery-layer:get-image-url","getImageUrl operation is not supported on the input image service");return Fe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){return new Qe({outFields:["*"],returnGeometry:!0,where:this.definitionExpression||"1=1"})}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new r("imagery-layer:query-boundary","queryBoundary operation is not supported on the input image service");return e=e??{outSpatialReference:this.spatialReference},De(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async queryExtent(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),qe(this.url,e,t)}async queryRasters(e,t){({query:e,requestOptions:t}=await this._prepareForQuery(e,t));const i=await Ee(this.url,e,t),r=this.graphicOrigin;return i.features.forEach(e=>{e.layer=this,e.origin=r}),i}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),je(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new r("imagery-layer:query-gps-info","queryGPSInfo operation is not supported on the input image service");return e=e??{where:"1=1"},Oe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Pe(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new r("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:s,returnTopmostRaster:n,showNoDataRecords:a}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const p=J.servicePixelValue.toLowerCase(),m=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some(e=>!e.toLowerCase().startsWith(p)),this.version>=10.4)){const t=e.outFields.filter(e=>e.toLowerCase().startsWith(p)&&e.length>p.length).map(e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,m),t]});l=t.map(e=>new z({functionName:e[0]})),u=t.map(e=>e[1]);const{rasterFunction:i}=this;0===l.length?i?.functionName?(l.push(i),u.push(i.functionName)):l=null:i?.functionName&&!l.some(e=>e.functionName===i.functionName)&&(l.push(i),u.push(i.functionName))}const c=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:h}=this;let d=e.timeExtent||this.timeExtent;if(h){const{isOutside:t,intersection:i}=H(h,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new r("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");null!=i?.timeExtent&&(d=i.timeExtent)}const g=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,d);let y=e.geometry;this.version<10.91&&"extent"===y?.type&&(y=f.fromExtent(y));const R=this._getQueryParams({geometry:y,timeExtent:d,mosaicRule:g,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:i,returnCatalogItems:o,returnGeometry:c,raster:this.raster,maxItemCount:n?1:null});delete R.f;const I=new Ve(R);try{await this._generateRasterInfo(this.rasterFunction);const i=await we(this.url,I,{signal:t?.signal,query:{...this.customParameters}}),r=e.outFields,n=null!=i.value&&i.value.toLowerCase().includes("nodata"),l=o&&!c&&i?.catalogItems?.features.length&&(a||!n),p=this.multidimensionalInfo&&"raster-dataset"===this.sourceType?G({rasterInfo:this.rasterInfo,multidimensionalDefinition:g?.multidimensionalDefinition,timeExtent:d,multidimensionalSubset:this.multidimensionalSubset}):null;if(!l)return this._processVisibleRastersResponse(i,{returnDomainValues:s,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:r,effectiveMultidimensionalDefinition:p});const m=this.objectIdField||"ObjectId",h=i.catalogItems?.features??[],f=h.map(e=>e.attributes?.[m]),y=new Qe({objectIds:f,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[m]}),R=await this.queryRasters(y);return R?.features?.length&&R.features.forEach(t=>{h.forEach(i=>{i.attributes[m]===t.attributes[m]&&t.geometry&&(i.geometry=t.geometry.clone(),null!=e.outSpatialReference&&(i.geometry.spatialReference=e.outSpatialReference))})}),this._processVisibleRastersResponse(i,{returnDomainValues:s,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:r,effectiveMultidimensionalDefinition:p})}catch{throw new r("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=i(Ge(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.statistics),s=i(Ge(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.histograms),n=await Promise.all([r,s]);return n[0]&&n[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),{statistics:n[0]||null,histograms:n[1]||null}}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return k(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,i=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):Te(Ge(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then(e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),Me(e,t),e)),r=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([i,r,s]).then(e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.internalRenderer&&!this._isSupportedRenderer(this.internalRenderer)&&(this._set("internalRenderer",null),n.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("internalRenderer",this._configRenderer(this.renderer)),this.addHandles([a(()=>this.rasterFunction,e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then(e=>{e&&(this.rasterInfo=e)})})]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)})}_combineMosaicRuleWithTimeExtent(e,t){const i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(null==e||null==r||null==t||null==i?.startField)return e;const{startField:s}=i,n=r.variables.some(e=>e.dimensions.some(e=>e.name===s))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter(e=>e.dimensionName!==n),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const a=e.multidimensionalDefinition.filter(e=>e.dimensionName===n),o=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==o||null==l||o===l,p=u?[o||l]:[[o,l]],m=this.version>=10.8;if(a.length)a.forEach(e=>{e.dimensionName===n&&(m?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))});else if(!m){const t=e.multidimensionalDefinition.filter(e=>null!=e.variableName&&null==e.dimensionName);t.length?t.forEach(e=>{e.dimensionName=n,e.isSlice=u,e.values=p}):e.multidimensionalDefinition.push(new v({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter(e=>!(!e.variableName&&!e.dimensionName)),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new r("imagery-layer:query-rasters","query operation is not supported on the input image service");const i=null!=e?c(Qe,e):this.createQuery();return t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:i,requestOptions:t}}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:i}=this;return"unique-value"===e.type&&this._hasRasterFunction(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&ee(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:s}=await i(Ge(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,s&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map(e=>e.trim()).indexOf("tilesonly")>-1)throw new r("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||i}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:i}=e,r="resample"===t?.toLowerCase(),s=i?.ResampleType||i?.resampleType;return r&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:i}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){const t=this.mosaicRule?.multidimensionalDefinition?.[0].variableName,r=te({variableName:t,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&i.bandCount>=3){const e=r?.bandIds??ie(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=r?.renderer??Z(i,{bandIds:this.bandIds,variableName:this.rasterFunction?null:t}));const s=re(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=i):this.symbolizer=new se({rendererJSON:s,rasterInfo:i}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){null!=e?.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:i}=this;return{raster:t,viewId:i,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,i){return this._rasterJobHandler?this._rasterJobHandler.decode({data:e,options:t}):$(e,t,i)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const r=await i(Ge(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:s,returnImageBitmap:n,signal:a}=e;if(s&&this._canRequestImageElement(t.format)){const r=`${Ge(this.parsedUrl)}/exportImage`,{data:s}=await i(r,{responseType:n?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:a});if(s instanceof Blob){return{imageBitmap:await S(s,r,a),params:t}}return{imageOrCanvasElement:s,params:t}}const o=this._initJobHandler(),l=i(Ge(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:a}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let m=p;if("bsq"!==m&&"bip"!==m&&(m=X(u)),!m)throw new r("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const c={signal:a},h="gif"===p||"bmp"===p||p.includes("png")&&("png"===m||"jpg"===m)?$(u,{useCanvas:!0,...t},c):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},c);return{pixelData:{pixelBlock:await h,extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch(()=>null)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=W(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new F;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&t.forEach(e=>e.variableName=""),t=t.filter(({variableName:e,dimensionName:t})=>e&&"*"!==e||t),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,i){i=i||{};const r=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=i,l=e.processedValues;let u=e.catalogItems?.features,p=e.properties?.Values?.map(e=>e.replaceAll(/ /gi,", "))||[];const m=this.objectIdField||"ObjectId",c="string"==typeof r&&r.toLowerCase().includes("nodata"),h=[];if(r&&!u&&(!c||n)){const e={};e[m]=0;p=[r],u=[new t({geometry:this.fullExtent,attributes:e})],this.multidimensionalInfo&&"raster-dataset"===this.sourceType&&U(this.rasterFields,e,i.effectiveMultidimensionalDefinition)}if(!u)return[];this._updateResponseFieldNames(u,o),c&&!n&&(u=[]);const{itemPixelValue:d,servicePixelValue:f}=J,g=this.rasterFields.some(e=>e.name===d),y=this.graphicOrigin;for(let t=0;t<u.length;t++){const e=u[t];if(null!=r){const i=p[t],a=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:r;if("nodata"===i.toLowerCase()&&!n)continue;g&&(e.attributes[d]=i),e.attributes[f]=a,this._updateFeatureWithMagDirValues(e,i);const o=this.fields&&this.fields.length>0;let u=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?i:r:a;this.rasterFunction||(u=o?i:r),this._updateFeatureWithRasterAttributeTableValues(e,u)}if(e.sourceLayer=e.layer=this,e.origin=y,a&&this._updateFeatureWithDomainValues(e),s&&l&&s.length===l.length)for(let t=0;t<s.length;t++){const i=`${J.servicePixelValue}.${s[t]}`;e.attributes[i]=l[t]}h.push(u[t])}return h}_processMultidimensionalIntersection(e,t,i){const{multidimensionalSubset:r}=this;if(!r)return{isOutSide:!1,timeExtent:t,mosaicRule:i=this._combineMosaicRuleWithTimeExtent(i,t)};if(r){const{isOutside:i,intersection:s}=H(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};null!=s?.timeExtent&&(t=s.timeExtent)}if(i=this._combineMosaicRuleWithTimeExtent(i,t),i?.multidimensionalDefinition){const{isOutside:e}=H(r,{multidimensionalDefinition:i.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:i}}_updateFeatureWithRasterAttributeTableValues(e,t){const i=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==i)return;const{features:r,fields:s}=i,n=s.map(e=>e.name).find(e=>"value"===e.toLowerCase());if(!n)return;const a=r.filter(e=>e.attributes[n]===(null!=t?parseInt(t,10):null));a&&a[0]&&s.forEach(t=>{const i=B+t.name;e.attributes[i]=a[0].attributes[t.name]})}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const i=t.split(/,\s*/).map(e=>parseFloat(e)),r=i.map(e=>[e]),s=i.map(e=>({minValue:e,maxValue:e,noDataValue:null})),n=new O({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new d(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:Y([n.pixels[0][0],n.pixels[1][0]]);e.attributes[J.magnitude]=a[0],e.attributes[J.direction]=a[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter(e=>"coded-value"===e.domain?.type);null!=t&&t.forEach(t=>{const i=e.attributes[t.name];if(null!=i){const r=t.domain.codedValues.find(e=>e.code===i);r&&(e.attributes[t.name]=r.name)}})}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const i=this.fieldsIndex;null!=i&&e.forEach(e=>{if(e?.attributes)for(const r of t){const t=i.get(r)?.name;t&&t!==r&&(e.attributes[r]=e.attributes[t],delete e.attributes[t])}})}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return null!=e?.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const i=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(i)?t.get(i):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:i,rasterFunction:r}=this;r&&null==e.rasterFunction&&(e.rasterFunction=r),i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}async _updateCurrentRasterInfo(e){if(this.renderer||this.symbolizer){const t=await this._generateRasterInfo(this.rasterFunction,{signal:e});t&&(this.rasterInfo=t)}}_applyMosaicRule(e){const{raster:t,mosaicRule:i}=this;i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map(e=>e.trim()):["image","catalog"],{currentVersion:i,maxRecordCount:r}=e,s=t.includes("image"),n="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!(!e.spatialReference&&!e.extent?.spatialReference),o=t.includes("edit"),l=t.includes("mensuration")&&a,u=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map(e=>e.trim()),p=l&&u.includes("basic"),m=this._isMosaicDataset(e)&&t.includes("catalog"),c=t.includes("download"),h=i>=10.7&&n||i>=11.4&&(n||l&&u.includes("3d")),d=m&&e.fields&&e.fields.length>0,f=d&&e.supportsAdvancedQueries?e.advancedQueryCapabilities:void 0;return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:s,supportsExportImage:s,supportsIdentify:s,supportsImageToMap:i>=11.2&&m,supportsImageToMapMultiray:i>=11.2&&m,supportsMapToImage:i>=11.2&&m,supportsFindImages:i>=11.2&&m,supportsGetImageUrl:i>=11.3&&c,supportsMeasure:l,supportsMeasureFromImage:i>=11.2,supportsDownload:c,supportsQuery:d,supportsGetSamples:i>=10.2&&s,supportsProject:i>=10.3&&s,supportsComputeStatisticsHistograms:i>=10.4&&s,supportsQueryBoundary:i>=10.6&&s,supportsCalculateVolume:h,supportsComputePixelLocation:i>=10.7&&m,supportsComputeAngles:i>=10.91,supportsQueryGPSInfo:i>=11.2&&m,supportsAdd:o,supportsDelete:o,supportsEditing:o,supportsUpdate:o,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:r,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,supportsStatistics:!!f?.supportsStatistics,supportsOrderBy:!!f?.supportsOrderBy,supportsDistinct:!!f?.supportsDistinct,supportsPagination:!!f?.supportsPagination,supportsPaginationOnAggregatedQueries:!!f?.supportsPaginationOnAggregatedQueries,supportsStandardizedQueriesOnly:!!f?.useStandardizedQueries,supportsPercentileStatistics:!!f?.supportsPercentileStatistics,supportsCentroid:!!f?.supportsReturningGeometryCentroid,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!!f?.supportsQueryWithDistance,supportsExtent:!!f?.supportsReturningQueryExtent,supportsGeometryProperties:!!f?.supportsReturningGeometryProperties,supportsHavingClause:!!f?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:f?.supportsSqlExpression??!!f,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!f?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},mensuration:{supportsDistanceAndAngle:p,supportsAreaAndPerimeter:p,supportsPointOrCentroid:p,supportsHeightFromBaseAndTop:l&&u.includes("base-top height"),supportsHeightFromBaseAndTopShadow:l&&u.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:l&&u.includes("top-top shadow height"),supports3D:l&&u.includes("3d")}}}};function Ge(e){return e?.path??""}return e([l({clonable:!1})],He.prototype,"_functionRasterInfos",void 0),e([l({readOnly:!0})],He.prototype,"_serviceSupportsMosaicRule",void 0),e([Je("_serviceSupportsMosaicRule",["currentVersion","fields"])],He.prototype,"readServiceSupportsMosaicRule",null),e([l({readOnly:!0})],He.prototype,"_rasterFunctionNamesIndex",null),e([l()],He.prototype,"adjustAspectRatio",void 0),e([l({type:[p],json:{write:!0}})],He.prototype,"bandIds",void 0),e([Je("bandIds")],He.prototype,"readBandIds",null),e([l({readOnly:!0,json:{read:!1}})],He.prototype,"capabilities",void 0),e([Je("service","capabilities",["capabilities","currentVersion","serviceDataType"])],He.prototype,"readCapabilities",null),e([l({type:Number})],He.prototype,"compressionQuality",void 0),e([Ue("compressionQuality")],He.prototype,"writeCompressionQuality",null),e([l({type:Number})],He.prototype,"compressionTolerance",void 0),e([Ue("compressionTolerance")],He.prototype,"writeCompressionTolerance",null),e([l({json:{read:{source:"copyrightText"}}})],He.prototype,"copyright",void 0),e([l({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],He.prototype,"defaultMosaicRule",void 0),e([Je("defaultMosaicRule",["defaultMosaicMethod"])],He.prototype,"readDefaultMosaicRule",null),e([l({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],He.prototype,"definitionExpression",void 0),e([l({readOnly:!0,constructOnly:!0})],He.prototype,"exportImageServiceParameters",void 0),e([l()],He.prototype,"rasterInfo",void 0),e([l({readOnly:!0,type:[b]})],He.prototype,"fields",void 0),e([l({readOnly:!0})],He.prototype,"fieldsIndex",null),e([l({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff","bip","bsq"],json:{write:!0}})],He.prototype,"format",null),e([Je("service","format",["serviceDataType"])],He.prototype,"readFormat",null),e([l({type:d})],He.prototype,"fullExtent",void 0),e([l({readOnly:!0})],He.prototype,"hasMultidimensions",void 0),e([l({json:{read:{source:"maxImageHeight"}}})],He.prototype,"imageMaxHeight",void 0),e([l({json:{read:{source:"maxImageWidth"}}})],He.prototype,"imageMaxWidth",void 0),e([l({type:String,json:{type:T.jsonValues,read:T.read,write:T.write}})],He.prototype,"interpolation",void 0),e([l()],He.prototype,"minScale",void 0),e([Je("service","minScale")],He.prototype,"readMinScale",null),e([l()],He.prototype,"maxScale",void 0),e([Je("service","maxScale")],He.prototype,"readMaxScale",null),e([l({type:F})],He.prototype,"mosaicRule",null),e([Je("mosaicRule",["mosaicRule","defaultMosaicMethod"])],He.prototype,"readMosaicRule",null),e([Ue("mosaicRule")],He.prototype,"writeMosaicRule",null),e([l()],He.prototype,"multidimensionalInfo",void 0),e([l({type:D,json:{write:!0}})],He.prototype,"multidimensionalSubset",void 0),e([l({json:{type:p}})],He.prototype,"noData",void 0),e([Ue("noData")],He.prototype,"writeNoData",null),e([l({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],He.prototype,"noDataInterpretation",void 0),e([l({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],He.prototype,"objectIdField",void 0),e([Je("objectIdField")],He.prototype,"readObjectIdField",null),e([l({readOnly:!0})],He.prototype,"geometryType",void 0),e([l({})],He.prototype,"typeIdField",void 0),e([l({})],He.prototype,"types",void 0),e([l({readOnly:!0})],He.prototype,"parsedUrl",null),e([l({type:Function})],He.prototype,"pixelFilter",void 0),e([l()],He.prototype,"raster",void 0),e([l({readOnly:!0})],He.prototype,"sourceType",void 0),e([Je("sourceType",["serviceSourceType","fields"])],He.prototype,"readSourceType",null),e([l()],He.prototype,"viewId",void 0),e([l()],He.prototype,"renderer",null),e([l({types:ae,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:ne,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],He.prototype,"internalRenderer",null),e([Je("internalRenderer")],He.prototype,"readRenderer",null),e([Ue("internalRenderer")],He.prototype,"writeRenderer",null),e([l({clonable:!1})],He.prototype,"symbolizer",void 0),e([l(R)],He.prototype,"opacity",void 0),e([l({readOnly:!0})],He.prototype,"rasterFields",null),e([l({constructOnly:!0})],He.prototype,"rasterFunctionInfos",void 0),e([l({type:z,json:{name:"renderingRule"}})],He.prototype,"rasterFunction",null),e([Je("rasterFunction",["renderingRule","rasterFunctionInfos"])],He.prototype,"readRasterFunction",null),e([l({readOnly:!0})],He.prototype,"serviceDataType",void 0),e([l({readOnly:!0,type:g})],He.prototype,"spatialReference",void 0),e([Je("spatialReference",["spatialReference","extent"])],He.prototype,"readSpatialReference",null),e([l({type:M.apiValues,json:{read:M.read,type:M.jsonValues}})],He.prototype,"pixelType",void 0),e([Ue("pixelType")],He.prototype,"writePixelType",null),e([l({constructOnly:!0,type:L})],He.prototype,"serviceRasterInfo",void 0),e([l()],He.prototype,"sourceJSON",void 0),e([l(I)],He.prototype,"url",void 0),e([l({readOnly:!0})],He.prototype,"version",void 0),e([Je("version",["currentVersion","fields","timeInfo"])],He.prototype,"readVersion",null),He=e([u("esri.layers.mixins.ArcGISImageService")],He),He};export{He as ArcGISImageService};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import i from"../../request.js";import r from"../../core/Error.js";import{clone as s}from"../../core/lang.js";import n from"../../core/Logger.js";import{watch as a}from"../../core/reactiveUtils.js";import{urlToObject as o}from"../../core/urlUtils.js";import{property as l,subclass as u}from"../../core/accessorSupport/decorators.js";import{Integer as p,ensureRange as m,ensureClass as c,ensureNumber as h}from"../../core/accessorSupport/ensureType.js";import d from"../../geometry/Extent.js";import f from"../../geometry/Polygon.js";import g from"../../geometry/SpatialReference.js";import{srToRESTValue as y}from"../../geometry/support/spatialReferenceUtils.js";import{opacity as R,url as I}from"../support/commonProperties.js";import v from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as w}from"../support/ExportImageServiceParameters.js";import b from"../support/Field.js";import x from"../support/FieldsIndex.js";import{createBitmap as S}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as _}from"../support/imageryRendererUtils.js";import F from"../support/MosaicRule.js";import D from"../support/MultidimensionalSubset.js";import O from"../support/PixelBlock.js";import{interpolationKebab as T,noDataInterpretationKebab as C,pixelTypeKebabDict as M}from"../support/rasterEnums.js";import{getServicePixelValueField as N,getItemPixelValueField as P,getRawServicePixelValueField as q,getProcessedServicePixelValueField as j,getMagnitudeField as E,getDirectionField as A,getMultidimensionalFields as V,getRasterAttributeTableFields as Q,commonRasterFieldNames as J,addMultidimensionalFieldValues as U,rasterFieldPrefix as B}from"../support/rasterFieldUtils.js";import z from"../support/RasterFunction.js";import L from"../support/RasterInfo.js";import{intersectMultimensionalSubset as H,getEffectiveMultidimensionalDefinition as G,getSubsetVariablesFromMdInfo as k,getDefaultMultidimensionalDefinition as W}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as $,getFormat as X}from"../support/rasterFormats/RasterCodec.js";import{highlightPixels as K}from"../support/rasterFunctions/pixelUtils.js";import{uvComponentToVector as Y}from"../support/rasterFunctions/vectorFieldUtils.js";import{createDefaultRenderer as Z,getSupportedRendererTypes as ee,matchPresetRenderer as te,getDefaultBandCombination as ie,normalizeRendererJSON as re}from"../../renderers/support/rasterRendererHelper.js";import se from"../../renderers/support/RasterSymbolizer.js";import{rasterRendererTypes as ne,websceneRasterRendererTypes as ae,read as oe}from"../../renderers/support/rasterTypeUtils.js";import{calculateVolume as le,computeAngles as ue,computePixelSpaceLocations as pe,computeHistograms as me,computeStatisticsHistograms as ce,measureHeight as he,measureAreaAndPerimeter as de,measureDistanceAndAngle as fe,measurePointOrCentroid as ge,measureLengthFromImage as ye,measureAreaFromImage as Re,getImageSpatialReferenceQueryParameter as Ie,getSamples as ve,identify as we,imageToMap as be,imageToMapMultiray as xe,mapToImage as Se,findImages as _e,getImageUrl as Fe,queryBoundary as De,queryGPSInfo as Oe}from"../../rest/imageService.js";import{fetchServiceRasterInfo as Te,generateRasterInfo as Ce,patchServiceInfo as Me}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as Ne}from"../../rest/imageService/getCatalogItemRasterInfo.js";import{executeForCount as Pe}from"../../rest/query/executeForCount.js";import{executeForExtent as qe}from"../../rest/query/executeForExtent.js";import{executeForIds as je}from"../../rest/query/executeForIds.js";import{executeQueryJSON as Ee}from"../../rest/query/executeQueryJSON.js";import Ae from"../../rest/support/FeatureSet.js";import Ve from"../../rest/support/ImageIdentifyParameters.js";import Qe from"../../rest/support/Query.js";import{reader as Je}from"../../core/accessorSupport/decorators/reader.js";import{writer as Ue}from"../../core/accessorSupport/decorators/writer.js";const Be=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),ze=m(h,{min:0,max:255});function Le(e){const t=JSON.stringify(e),i=t.includes('"rasterFunctionDefinition":{'),r=i?t.match(/"type":"(.*?FunctionArguments")/gi):t.match(/"rasterFunction":"(.*?")/gi),s=r?.map(e=>i?e.slice(8,-18):e.slice(18,-1));return s?s.join("/"):null}const He=m=>{const h=m;let He=class extends h{constructor(){super(...arguments),this._functionRasterInfos={},this._serviceSupportsMosaicRule=null,this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=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.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new w({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach(t=>{e.set(t.name.toLowerCase().replaceAll(/ /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,i){null!=e&&"lerc"!==this.format&&(t[i]=e)}writeCompressionTolerance(e,t,i){"lerc"===this.format&&null!=e&&(t[i]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?F.fromJSON(t):null}get fieldsIndex(){return this.fields?new x(this.fields):null}set format(e){e&&Be.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?.mosaicMethod&&(t=F.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?F.fromJSON(i):this._isMosaicRuleSupported(t)?F.fromJSON(t):null}writeMosaicRule(e,t,i){const{mosaicRule:r}=this;this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=ze(e))}readObjectIdField(e,t){if(!e){const i=t.fields.find(e=>"esriFieldTypeOID"===e.type||"oid"===e.type);e=i?.name}return e}get parsedUrl(){return o(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}get renderer(){const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const i=t?.find(({name:t})=>t===e);return i?.renderer.clone()}return this.internalRenderer}set renderer(e){this.activePresetRendererName=null,this.internalRenderer=e}set internalRenderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("internalRenderer",e)}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer,s=oe(r,i);return null==s?null:("vector-field"===s.type&&t.symbolTileSize&&!r.symbolTileSize&&(s.symbolTileSize=t.symbolTileSize),_(s)||n.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),s)}writeRenderer(e,t,i){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.fields?.map(e=>e.clone())??[];e.push(N()),"mosaic-dataset"===this.sourceType&&this.fields?.length&&e.push(P()),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some(({name:e})=>"none"===e.toLowerCase())&&e.push(q()),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter(({name:e})=>"none"!==e.toLowerCase()).forEach(({name:t})=>e.push(j(t)));const{rasterInfo:t}=this;if(this._isVectorDataSet()){const i=t?.multidimensionalInfo?.variables[0].unit?.trim(),r=E(i),s=A();e.push(r,s)}if(t?.multidimensionalInfo&&"raster-dataset"===this.sourceType){const i=V(t.multidimensionalInfo);e.push(...i)}const i=t?.attributeTable;if(null!=i){const t=Q(i);e.push(...t)}return e}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=z.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i?.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?z.fromJSON({rasterFunctionDefinition:t.renderingRule}):z.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?g.fromJSON(i):null}writePixelType(e,t,i){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[i]=M.toJSON(e))}readVersion(e,t){let i=t.currentVersion;return i||(i=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),i}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let i=e,{renderer:r,symbolizer:s,pixelFilter:n}=this;const{isRawData:a}=e;if(a&&"lerc"!==this.format&&(r??=Z(this.rasterInfo,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}),s||(this.symbolizer=new se({rendererJSON:r.toJSON(),rasterInfo:this.rasterInfo}),s=this.symbolizer)),(a||!this._isPicture())&&r&&s&&!n){await this._updateSymbolizer(s,r);const{bandIds:n}=this;i=await this._symbolize({pixelData:e,bandIds:n,symbolizer:s},t)}return i}async highlightPixels(e,t){const i=e.highlightOptions.map(e=>{const t={...e},i="bandId"in t?[t.bandId??0]:[t.xBandId,t.yBandId];for(let r=0;r<i.length;r++){const e=i[r];if(null==e)return;const t=this.bandIds?.length?this.bandIds.indexOf(e):e;if(t<0||t>2)return;i[r]=t}return"bandId"in t?t.bandId=i[0]:(t.xBandId=i[0],t.yBandId=i[1]),t}).filter(e=>null!=e);if(0===i.length)return;const r=this._rasterJobHandler;r?await r.highlightPixels({...e,highlightOptions:i},t):K({...e,highlightOptions:i})}destroy(){this._shutdownJobHandler()}async calculateVolume(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsCalculateVolume)throw new r("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=s(e),this.mosaicRule&&null==e.mosaicRule&&(e.mosaicRule=this.mosaicRule),le(this.url,e,this._getRequestOptions(t))}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new r("imagery-layer:compute-angles","this operation is not supported on the input image service");return ue(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new r("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return pe(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new r("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=s(e),this._applyMosaicAndRenderingRules(e),me(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new r("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=s(e),this._applyMosaicAndRenderingRules(e),ce(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const i=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?i.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?i.mensuration.supportsHeightFromBaseAndTopShadow:i.mensuration.supportsHeightFromTopAndTopShadow))throw new r("imagery-layer:measure-height","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),he(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsAreaAndPerimeter&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),de(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsDistanceAndAngle&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),fe(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsPointOrCentroid&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),ge(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new r("imagery-layer:measure-length-from-image","this operation is not supported on the input image service");if("polyline"!==e.geometry.type)throw new r("imagery-layer:measure-length-from-image","this input geometry must be a polyline");return ye(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new r("imagery-layer:measure-area-from-image","this operation is not supported on the input image service");if("polygon"!==e.geometry.type)throw new r("imagery-layer:measure-area-from-image","this input geometry must be a polygon");return Re(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}async internalFetchImage(e,t,i,r={}){await this._updateCurrentRasterInfo();const{exportImageServiceParameters:s}=this;let n=!1;r.requestRawData&&(await this._initJobHandler(),s.requestRawData||"lerc"===this.format||(n=!0,s.requestRawData=!0));const a=this.getExportImageServiceParameters(e,t,i,r.timeExtent);if(n&&(s.requestRawData=!1),null==a){if(r.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=i,r.returnImageBitmap){return{imageBitmap:await S(e,`${Ge(this.parsedUrl)}/exportImage`,r.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,a=(s?.length||n.bandCount)??0,o=t*i,l=n.pixelType,u=[];for(let e=0;e<a;e++)u.push(O.createEmptyBand(l,o));return{pixelData:{pixelBlock:new O({width:t,height:i,pixels:u,mask:new Uint8Array(o),pixelType:l}),extent:e}}}const o=!!r.requestAsImageElement&&!this.pixelFilter,l=o&&!!r.returnImageBitmap,u={imageServiceParameters:a,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:o,returnImageBitmap:l,signal:r.signal};return this._requestArrayBuffer(u)}async fetchPixels(e,t,i,r={}){await this._initJobHandler(),r.applyRendering&&this._updateCurrentRasterInfo();const s=r.applyRendering?void 0:new w({layer:this,requestRawData:!0,interpolation:r.interpolation??"nearest",bandIds:r.bandIds??[]}),n=this.getExportImageServiceParameters(e,t,i,r.timeExtent,s);if(null==n)return{extent:e,pixelBlock:null};delete n.pixelType,r.bandIds||delete n.bandIds,delete n.compressionQuality;const a={imageServiceParameters:n,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:!1,returnImageBitmap:!1,signal:r.signal},{pixelData:o}=await this._requestArrayBuffer(a);return o??{extent:e,pixelBlock:null}}fetchKeyProperties(e){return i(Ge(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>e.data)}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new r("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):i(Ge(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>Ae.fromJSON(e.data))}getCatalogItemRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return Ne(Ge(this.parsedUrl),e,i)}async getCatalogItemICSInfo(e,t){const{data:r}=await i(Ge(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),s=r?.ics;if(!s)return;let n=null;try{n=(await i(Ge(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!n?.spatialReference)return{ics:s,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?i(Ge(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then(e=>e.data).catch(()=>({})):{},o=n.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[n]}),inSR:y(o),outSR:"0:"+e},u=i(Ge(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then(e=>e.data).catch(()=>({})),p=5,m=(n.xmin+n.xmax)/2,c=(n.ymax-n.ymin)/(p+1),h=n.ymin+c,f=[];for(let i=0;i<p;i++)f.push({x:m,y:h+c*i});const R={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:f}),inSR:y(o),outSR:"0:"+e},I=i(Ge(this.parsedUrl)+"/project",{query:this._getQueryParams(R),...t}).then(e=>e.data).catch(()=>({})),v=await Promise.all([a,u,I]);let w=v[0].ipxf;if(null==w){const e=s.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(w={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const b=d.fromJSON(v[1]?.geometries?.[0]);b&&(b.spatialReference=new g({wkid:0,imageCoordinateSystem:s}));const x=v[2].geometries?v[2].geometries.filter(e=>null!=e?.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y):[],S=x.length;if(S<3)return{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:null};let _=0,F=0,D=0,O=0;for(let i=0;i<S;i++)_+=x[i].x,F+=x[i].y,D+=x[i].x*x[i].x,O+=x[i].x*x[i].y;const T=(S*O-_*F)/(S*D-_*_);let C=0;const M=x[p-1].x>x[0].x,N=x[p-1].y>x[0].y;return T===1/0?C=N?90:270:0===T?C=M?0:180:T>0?C=M?180*Math.atan(T)/Math.PI:180*Math.atan(T)/Math.PI+180:T<0&&(C=N?180+180*Math.atan(T)/Math.PI:360+180*Math.atan(T)/Math.PI),{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:C}}async generateRasterInfo(e,t){e=c(z,e);const i={...t,query:this._getQueryParams()};if(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))return this.serviceRasterInfo??Te(Ge(this.parsedUrl),this.sourceJSON,i);const s=Le(e);if(!s)throw new r("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[s])return this._functionRasterInfos[s];const n=Ce(Ge(this.parsedUrl),e,i);this._functionRasterInfos[s]=n;try{return await n}catch(a){throw this._functionRasterInfos[s]=null,a}}getExportImageServiceParameters(e,t,i,r,s){e=e.clone().shiftCentralMeridian();const n=Ie(e.spatialReference,Ge(this.parsedUrl));s??=this.exportImageServiceParameters;const a=s.toJSON(),{bandIds:o,noData:l}=a;let{renderingRule:u}=a;const p=this.rasterFunction?.rasterFunctionDefinition,m=this.renderer?.type,c=!m||"raster-stretch"===m||"raster-colormap"===m||"unique-value"===m||"class-breaks"===m||"raster-shaded-relief"===m;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!p&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===u.rasterFunction)e.rasterFunctionArguments.Raster=u.rasterFunctionArguments.Raster,u.rasterFunctionArguments.Raster=e;else if("Colormap"===u.rasterFunction){const t=u.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,u.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=u,u=e;a.bandIds=void 0}else a.bandIds=o?.join(",");Array.isArray(l)&&l.length>0&&(a.noData=l.join(","));const h=this._processMultidimensionalIntersection(null,r,s.mosaicRule);if(h.isOutSide)return null;a.mosaicRule=null!=h.mosaicRule?JSON.stringify(h.mosaicRule):null,r=h.timeExtent,a.renderingRule=this._getRenderingRuleString(z.fromJSON(u));const d={};if(null!=r){const{start:e,end:t}=r.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+i,...a,...d}}async getSamples(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i?.operations.supportsGetSamples)throw new r("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=s(e);const{raster:n}=this;return n&&null==e.raster&&(e.raster=n),ve(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new r("imagery-layer:identify","identify operation is not supported on the input image service");e=s(e),this.version<10.91&&"extent"===e.geometry?.type&&(e.geometry=f.fromExtent(e.geometry));const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new r("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=i.timeExtent,e.mosaicRule=i.mosaicRule;const{raster:n,rasterFunction:a}=this;return a&&null==e.rasterFunction&&(e.rasterFunction=a),n&&null==e.raster&&(e.raster=n),we(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new r("imagery-layer:image-to-map","imageToMap operation is not supported on the input image service");return be(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new r("imagery-layer:image-to-map-multiray","imageToMapMultiray operation is not supported on the input image service");return xe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new r("imagery-layer:map-to-image","mapToImage operation is not supported on the input image service");return Se(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new r("imagery-layer:find-images","findImages operation is not supported on the input image service");return _e(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new r("imagery-layer:get-image-url","getImageUrl operation is not supported on the input image service");return Fe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){return new Qe({outFields:["*"],returnGeometry:!0,where:this.definitionExpression||"1=1"})}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new r("imagery-layer:query-boundary","queryBoundary operation is not supported on the input image service");return e=e??{outSpatialReference:this.spatialReference},De(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async queryExtent(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),qe(this.url,e,t)}async queryRasters(e,t){({query:e,requestOptions:t}=await this._prepareForQuery(e,t));const i=await Ee(this.url,e,t),r=this.graphicOrigin;return i.features.forEach(e=>{e.layer=this,e.origin=r}),i}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),je(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new r("imagery-layer:query-gps-info","queryGPSInfo operation is not supported on the input image service");return e=e??{where:"1=1"},Oe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Pe(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new r("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:s,returnTopmostRaster:n,showNoDataRecords:a}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const p=J.servicePixelValue.toLowerCase(),m=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some(e=>!e.toLowerCase().startsWith(p)),this.version>=10.4)){const t=e.outFields.filter(e=>e.toLowerCase().startsWith(p)&&e.length>p.length).map(e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,m),t]});l=t.map(e=>new z({functionName:e[0]})),u=t.map(e=>e[1]);const{rasterFunction:i}=this;0===l.length?i?.functionName?(l.push(i),u.push(i.functionName)):l=null:i?.functionName&&!l.some(e=>e.functionName===i.functionName)&&(l.push(i),u.push(i.functionName))}const c=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:h}=this;let d=e.timeExtent||this.timeExtent;if(h){const{isOutside:t,intersection:i}=H(h,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new r("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");null!=i?.timeExtent&&(d=i.timeExtent)}const g=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,d);let y=e.geometry;this.version<10.91&&"extent"===y?.type&&(y=f.fromExtent(y));const R=this._getQueryParams({geometry:y,timeExtent:d,mosaicRule:g,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:i,returnCatalogItems:o,returnGeometry:c,raster:this.raster,maxItemCount:n?1:null});delete R.f;const I=new Ve(R);try{await this._generateRasterInfo(this.rasterFunction);const i=await we(this.url,I,{signal:t?.signal,query:{...this.customParameters}}),r=e.outFields,n=null!=i.value&&i.value.toLowerCase().includes("nodata"),l=o&&!c&&i?.catalogItems?.features.length&&(a||!n),p=this.multidimensionalInfo&&"raster-dataset"===this.sourceType?G({rasterInfo:this.rasterInfo,multidimensionalDefinition:g?.multidimensionalDefinition,timeExtent:d,multidimensionalSubset:this.multidimensionalSubset}):null;if(!l)return this._processVisibleRastersResponse(i,{returnDomainValues:s,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:r,effectiveMultidimensionalDefinition:p});const m=this.objectIdField||"ObjectId",h=i.catalogItems?.features??[],f=h.map(e=>e.attributes?.[m]),y=new Qe({objectIds:f,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[m]}),R=await this.queryRasters(y);return R?.features?.length&&R.features.forEach(t=>{h.forEach(i=>{i.attributes[m]===t.attributes[m]&&t.geometry&&(i.geometry=t.geometry.clone(),null!=e.outSpatialReference&&(i.geometry.spatialReference=e.outSpatialReference))})}),this._processVisibleRastersResponse(i,{returnDomainValues:s,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:r,effectiveMultidimensionalDefinition:p})}catch{throw new r("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=i(Ge(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.statistics),s=i(Ge(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.histograms),n=await Promise.all([r,s]);return n[0]&&n[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),{statistics:n[0]||null,histograms:n[1]||null}}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return k(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,i=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):Te(Ge(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then(e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),Me(e,t),e)),r=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([i,r,s]).then(e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.internalRenderer&&!this._isSupportedRenderer(this.internalRenderer)&&(this._set("internalRenderer",null),n.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("internalRenderer",this._configRenderer(this.renderer)),this.addHandles([a(()=>this.rasterFunction,e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then(e=>{e&&(this.rasterInfo=e)})})]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)})}_combineMosaicRuleWithTimeExtent(e,t){const i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(null==e||null==r||null==t||null==i?.startField)return e;const{startField:s}=i,n=r.variables.some(e=>e.dimensions.some(e=>e.name===s))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter(e=>e.dimensionName!==n),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const a=e.multidimensionalDefinition.filter(e=>e.dimensionName===n),o=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==o||null==l||o===l,p=u?[o||l]:[[o,l]],m=this.version>=10.8;if(a.length)a.forEach(e=>{e.dimensionName===n&&(m?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))});else if(!m){const t=e.multidimensionalDefinition.filter(e=>null!=e.variableName&&null==e.dimensionName);t.length?t.forEach(e=>{e.dimensionName=n,e.isSlice=u,e.values=p}):e.multidimensionalDefinition.push(new v({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter(e=>!(!e.variableName&&!e.dimensionName)),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new r("imagery-layer:query-rasters","query operation is not supported on the input image service");const i=null!=e?c(Qe,e):this.createQuery();return t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:i,requestOptions:t}}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:i}=this;return"unique-value"===e.type&&this._hasRasterFunction(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&ee(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:s}=await i(Ge(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,s&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map(e=>e.trim()).indexOf("tilesonly")>-1)throw new r("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||i}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:i}=e,r="resample"===t?.toLowerCase(),s=i?.ResampleType||i?.resampleType;return r&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:i}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){const t=this.mosaicRule?.multidimensionalDefinition?.[0].variableName,r=te({variableName:t,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&i.bandCount>=3){const e=r?.bandIds??ie(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=r?.renderer??Z(i,{bandIds:this.bandIds,variableName:this.rasterFunction?null:t}));const s=re(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=i):this.symbolizer=new se({rendererJSON:s,rasterInfo:i}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){null!=e?.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:i}=this;return{raster:t,viewId:i,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,i){return this._rasterJobHandler?this._rasterJobHandler.decode({data:e,options:t}):$(e,t,i)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const r=await i(Ge(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:s,returnImageBitmap:n,signal:a}=e;if(s&&this._canRequestImageElement(t.format)){const r=`${Ge(this.parsedUrl)}/exportImage`,{data:s}=await i(r,{responseType:n?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:a});if(s instanceof Blob){return{imageBitmap:await S(s,r,a),params:t}}return{imageOrCanvasElement:s,params:t}}const o=this._initJobHandler(),l=i(Ge(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:a}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let m=p;if("bsq"!==m&&"bip"!==m&&(m=X(u)),!m)throw new r("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const c={signal:a},h="gif"===p||"bmp"===p||p.includes("png")&&("png"===m||"jpg"===m)?$(u,{useCanvas:!0,...t},c):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},c);return{pixelData:{pixelBlock:await h,extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch(()=>null)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=W(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new F;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&t.forEach(e=>e.variableName=""),t=t.filter(({variableName:e,dimensionName:t})=>e&&"*"!==e||t),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,i){i=i||{};const r=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=i,l=e.processedValues;let u=e.catalogItems?.features,p=e.properties?.Values?.map(e=>e.replaceAll(/ /gi,", "))||[];const m=this.objectIdField||"ObjectId",c="string"==typeof r&&r.toLowerCase().includes("nodata"),h=[];if(r&&!u&&(!c||n)){const e={};e[m]=0;p=[r],u=[new t({geometry:this.fullExtent,attributes:e})],this.multidimensionalInfo&&"raster-dataset"===this.sourceType&&U(this.rasterFields,e,i.effectiveMultidimensionalDefinition)}if(!u)return[];this._updateResponseFieldNames(u,o),c&&!n&&(u=[]);const{itemPixelValue:d,servicePixelValue:f}=J,g=this.rasterFields.some(e=>e.name===d),y=this.graphicOrigin;for(let t=0;t<u.length;t++){const e=u[t];if(null!=r){const i=p[t],a=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:r;if("nodata"===i.toLowerCase()&&!n)continue;g&&(e.attributes[d]=i),e.attributes[f]=a,this._updateFeatureWithMagDirValues(e,i);const o=this.fields&&this.fields.length>0;let u=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?i:r:a;this.rasterFunction||(u=o?i:r),this._updateFeatureWithRasterAttributeTableValues(e,u)}if(e.sourceLayer=e.layer=this,e.origin=y,a&&this._updateFeatureWithDomainValues(e),s&&l&&s.length===l.length)for(let t=0;t<s.length;t++){const i=`${J.servicePixelValue}.${s[t]}`;e.attributes[i]=l[t]}h.push(u[t])}return h}_processMultidimensionalIntersection(e,t,i){const{multidimensionalSubset:r}=this;if(!r)return{isOutSide:!1,timeExtent:t,mosaicRule:i=this._combineMosaicRuleWithTimeExtent(i,t)};if(r){const{isOutside:i,intersection:s}=H(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};null!=s?.timeExtent&&(t=s.timeExtent)}if(i=this._combineMosaicRuleWithTimeExtent(i,t),i?.multidimensionalDefinition){const{isOutside:e}=H(r,{multidimensionalDefinition:i.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:i}}_updateFeatureWithRasterAttributeTableValues(e,t){const i=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==i)return;const{features:r,fields:s}=i,n=s.map(e=>e.name).find(e=>"value"===e.toLowerCase());if(!n)return;const a=r.filter(e=>e.attributes[n]===(null!=t?parseInt(t,10):null));a&&a[0]&&s.forEach(t=>{const i=B+t.name;e.attributes[i]=a[0].attributes[t.name]})}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const i=t.split(/,\s*/).map(e=>parseFloat(e)),r=i.map(e=>[e]),s=i.map(e=>({minValue:e,maxValue:e,noDataValue:null})),n=new O({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new d(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:Y([n.pixels[0][0],n.pixels[1][0]]);e.attributes[J.magnitude]=a[0],e.attributes[J.direction]=a[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter(e=>"coded-value"===e.domain?.type);null!=t&&t.forEach(t=>{const i=e.attributes[t.name];if(null!=i){const r=t.domain.codedValues.find(e=>e.code===i);r&&(e.attributes[t.name]=r.name)}})}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const i=this.fieldsIndex;null!=i&&e.forEach(e=>{if(e?.attributes)for(const r of t){const t=i.get(r)?.name;t&&t!==r&&(e.attributes[r]=e.attributes[t],delete e.attributes[t])}})}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return null!=e?.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const i=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(i)?t.get(i):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:i,rasterFunction:r}=this;r&&null==e.rasterFunction&&(e.rasterFunction=r),i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}async _updateCurrentRasterInfo(e){if(this.renderer||this.symbolizer){const t=await this._generateRasterInfo(this.rasterFunction,{signal:e});t&&(this.rasterInfo=t)}}_applyMosaicRule(e){const{raster:t,mosaicRule:i}=this;i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map(e=>e.trim()):["image","catalog"],{currentVersion:i,maxRecordCount:r}=e,s=t.includes("image"),n="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!(!e.spatialReference&&!e.extent?.spatialReference),o=t.includes("edit"),l=t.includes("mensuration")&&a,u=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map(e=>e.trim()),p=l&&u.includes("basic"),m=this._isMosaicDataset(e)&&t.includes("catalog"),c=t.includes("download"),h=i>=10.7&&n||i>=11.4&&(n||l&&u.includes("3d")),d=m&&e.fields&&e.fields.length>0,f=d&&e.supportsAdvancedQueries?e.advancedQueryCapabilities:void 0;return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:s,supportsExportImage:s,supportsIdentify:s,supportsImageToMap:i>=11.2&&m,supportsImageToMapMultiray:i>=11.2&&m,supportsMapToImage:i>=11.2&&m,supportsFindImages:i>=11.2&&m,supportsGetImageUrl:i>=11.3&&c,supportsMeasure:l,supportsMeasureFromImage:i>=11.2,supportsDownload:c,supportsQuery:d,supportsGetSamples:i>=10.2&&s,supportsProject:i>=10.3&&s,supportsComputeStatisticsHistograms:i>=10.4&&s,supportsQueryBoundary:i>=10.6&&s,supportsCalculateVolume:h,supportsComputePixelLocation:i>=10.7&&m,supportsComputeAngles:i>=10.91,supportsQueryGPSInfo:i>=11.2&&m,supportsAdd:o,supportsDelete:o,supportsEditing:o,supportsUpdate:o,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:r,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,supportsStatistics:!!f?.supportsStatistics,supportsOrderBy:!!f?.supportsOrderBy,supportsDistinct:!!f?.supportsDistinct,supportsPagination:!!f?.supportsPagination,supportsPaginationOnAggregatedQueries:!!f?.supportsPaginationOnAggregatedQueries,supportsStandardizedQueriesOnly:!!f?.useStandardizedQueries,supportsPercentileStatistics:!!f?.supportsPercentileStatistics,supportsCentroid:!!f?.supportsReturningGeometryCentroid,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!!f?.supportsQueryWithDistance,supportsExtent:!!f?.supportsReturningQueryExtent,supportsGeometryProperties:!!f?.supportsReturningGeometryProperties,supportsHavingClause:!!f?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:f?.supportsSqlExpression??!!f,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!f?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},mensuration:{supportsDistanceAndAngle:p,supportsAreaAndPerimeter:p,supportsPointOrCentroid:p,supportsHeightFromBaseAndTop:l&&u.includes("base-top height"),supportsHeightFromBaseAndTopShadow:l&&u.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:l&&u.includes("top-top shadow height"),supports3D:l&&u.includes("3d")}}}};function Ge(e){return e?.path??""}return e([l({clonable:!1})],He.prototype,"_functionRasterInfos",void 0),e([l({readOnly:!0})],He.prototype,"_serviceSupportsMosaicRule",void 0),e([Je("_serviceSupportsMosaicRule",["currentVersion","fields"])],He.prototype,"readServiceSupportsMosaicRule",null),e([l({readOnly:!0})],He.prototype,"_rasterFunctionNamesIndex",null),e([l()],He.prototype,"adjustAspectRatio",void 0),e([l({type:[p],json:{write:!0}})],He.prototype,"bandIds",void 0),e([Je("bandIds")],He.prototype,"readBandIds",null),e([l({readOnly:!0,json:{read:!1}})],He.prototype,"capabilities",void 0),e([Je("service","capabilities",["capabilities","currentVersion","serviceDataType"])],He.prototype,"readCapabilities",null),e([l({type:Number})],He.prototype,"compressionQuality",void 0),e([Ue("compressionQuality")],He.prototype,"writeCompressionQuality",null),e([l({type:Number})],He.prototype,"compressionTolerance",void 0),e([Ue("compressionTolerance")],He.prototype,"writeCompressionTolerance",null),e([l({json:{read:{source:"copyrightText"}}})],He.prototype,"copyright",void 0),e([l({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],He.prototype,"defaultMosaicRule",void 0),e([Je("defaultMosaicRule",["defaultMosaicMethod"])],He.prototype,"readDefaultMosaicRule",null),e([l({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],He.prototype,"definitionExpression",void 0),e([l({readOnly:!0,constructOnly:!0})],He.prototype,"exportImageServiceParameters",void 0),e([l()],He.prototype,"rasterInfo",void 0),e([l({readOnly:!0,type:[b]})],He.prototype,"fields",void 0),e([l({readOnly:!0})],He.prototype,"fieldsIndex",null),e([l({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff","bip","bsq"],json:{write:!0}})],He.prototype,"format",null),e([Je("service","format",["serviceDataType"])],He.prototype,"readFormat",null),e([l({type:d})],He.prototype,"fullExtent",void 0),e([l({readOnly:!0})],He.prototype,"hasMultidimensions",void 0),e([l({json:{read:{source:"maxImageHeight"}}})],He.prototype,"imageMaxHeight",void 0),e([l({json:{read:{source:"maxImageWidth"}}})],He.prototype,"imageMaxWidth",void 0),e([l({type:String,json:{type:T.jsonValues,read:T.read,write:T.write}})],He.prototype,"interpolation",void 0),e([l()],He.prototype,"minScale",void 0),e([Je("service","minScale")],He.prototype,"readMinScale",null),e([l()],He.prototype,"maxScale",void 0),e([Je("service","maxScale")],He.prototype,"readMaxScale",null),e([l({type:F})],He.prototype,"mosaicRule",null),e([Je("mosaicRule",["mosaicRule","defaultMosaicMethod"])],He.prototype,"readMosaicRule",null),e([Ue("mosaicRule")],He.prototype,"writeMosaicRule",null),e([l()],He.prototype,"multidimensionalInfo",void 0),e([l({type:D,json:{write:!0}})],He.prototype,"multidimensionalSubset",void 0),e([l({json:{type:p}})],He.prototype,"noData",void 0),e([Ue("noData")],He.prototype,"writeNoData",null),e([l({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],He.prototype,"noDataInterpretation",void 0),e([l({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],He.prototype,"objectIdField",void 0),e([Je("objectIdField")],He.prototype,"readObjectIdField",null),e([l({readOnly:!0})],He.prototype,"geometryType",void 0),e([l({})],He.prototype,"typeIdField",void 0),e([l({})],He.prototype,"types",void 0),e([l({readOnly:!0})],He.prototype,"parsedUrl",null),e([l({type:Function})],He.prototype,"pixelFilter",void 0),e([l()],He.prototype,"raster",void 0),e([l({readOnly:!0})],He.prototype,"sourceType",void 0),e([Je("sourceType",["serviceSourceType","fields"])],He.prototype,"readSourceType",null),e([l()],He.prototype,"viewId",void 0),e([l({types:ne})],He.prototype,"renderer",null),e([l({types:ne,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:ae,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],He.prototype,"internalRenderer",null),e([Je("internalRenderer")],He.prototype,"readRenderer",null),e([Ue("internalRenderer")],He.prototype,"writeRenderer",null),e([l({clonable:!1})],He.prototype,"symbolizer",void 0),e([l(R)],He.prototype,"opacity",void 0),e([l({readOnly:!0})],He.prototype,"rasterFields",null),e([l({constructOnly:!0})],He.prototype,"rasterFunctionInfos",void 0),e([l({type:z,json:{name:"renderingRule"}})],He.prototype,"rasterFunction",null),e([Je("rasterFunction",["renderingRule","rasterFunctionInfos"])],He.prototype,"readRasterFunction",null),e([l({readOnly:!0})],He.prototype,"serviceDataType",void 0),e([l({readOnly:!0,type:g})],He.prototype,"spatialReference",void 0),e([Je("spatialReference",["spatialReference","extent"])],He.prototype,"readSpatialReference",null),e([l({type:M.apiValues,json:{read:M.read,type:M.jsonValues}})],He.prototype,"pixelType",void 0),e([Ue("pixelType")],He.prototype,"writePixelType",null),e([l({constructOnly:!0,type:L})],He.prototype,"serviceRasterInfo",void 0),e([l()],He.prototype,"sourceJSON",void 0),e([l(I)],He.prototype,"url",void 0),e([l({readOnly:!0})],He.prototype,"version",void 0),e([Je("version",["currentVersion","fields","timeInfo"])],He.prototype,"readVersion",null),He=e([u("esri.layers.mixins.ArcGISImageService")],He),He};export{He as ArcGISImageService};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../request.js";import i from"../../core/Error.js";import r from"../../core/Logger.js";import{property as s,subclass as n}from"../../core/accessorSupport/decorators.js";import{Integer as o,ensureClass as a}from"../../core/accessorSupport/ensureType.js";import l from"../../geometry/Point.js";import u from"../../geometry/SpatialReference.js";import{getInfo as m}from"../../geometry/support/spatialReferenceUtils.js";import{sanitizeUrl as c}from"../support/arcgisLayerUrl.js";import{url as p}from"../support/commonProperties.js";import d from"../support/DimensionalDefinition.js";import h from"../support/MultidimensionalSubset.js";import{interpolationKebab as f}from"../support/rasterEnums.js";import y from"../support/RasterFunction.js";import g from"../support/TileInfo.js";import{isFunctionRaster as b}from"../support/rasterDatasets/datasetUtils.js";import R from"../support/rasterDatasets/FunctionRaster.js";import{getEffectiveMultidimensionalDefinition as I,getDefaultVariableInfo as x,isMultiSliceOrRangeDefinition as w,convertOleDateTimeToEpoch as S,getSubsetVariablesFromMdInfo as v,getDefaultMultidimensionalDefinition as F}from"../support/rasterDatasets/multidimensionalUtils.js";import{snapToRaster as _,clip as j}from"../support/rasterFunctions/clipUtils.js";import{create as D}from"../support/rasterFunctions/rasterFunctionHelper.js";import{load as J,projectExtent as T,projectPolygon as N}from"../support/rasterFunctions/rasterProjectionHelper.js";import{computeStatisticsHistograms as O}from"../support/rasterFunctions/stretchUtils.js";import{getVariableRasterInfo as z,getDefaultInterpolation as H,matchPresetRenderer as P,getDefaultBandCombination as E,getFunctionColorRamp as C,createDefaultRenderer as B,normalizeRendererJSON as M}from"../../renderers/support/rasterRendererHelper.js";import U from"../../renderers/support/RasterSymbolizer.js";import{websceneRasterRendererTypes as q,rasterRendererTypes as k,read as L}from"../../renderers/support/rasterTypeUtils.js";import A from"../../rest/support/ImageHistogramParameters.js";import V from"../../rest/support/ImageSample.js";import $ from"../../rest/support/ImageSampleParameters.js";import G from"../../rest/support/ImageSampleResult.js";import{enumeration as W}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as K}from"../../core/accessorSupport/decorators/reader.js";const Q=1e3,X=X=>{const Y=X;let Z=class extends Y{constructor(...e){super(...e),this._isConstructedFromFunctionRaster=!1,this.bandIds=null,this.copyright=null,this.interpolation=null,this.multidimensionalSubset=null,this.raster=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster=b(e[0]?.raster)}destroy(){this._shutdownJobHandler()}get fullExtent(){return this.serviceRasterInfo?.extent}set multidimensionalDefinition(e){this._set("multidimensionalDefinition",e),this.updateRenderer()}set rasterFunction(e){"none"===e?.functionName?.toLowerCase()&&(e=void 0),this._set("rasterFunction",e),this.updateRasterFunction()}set url(e){this._set("url",c(e,r.getLogger(this)))}get renderer(){if("imagery-tile"!==this.type)return this.internalRenderer;const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const i=t?.find(({name:t})=>t===e);return i?.renderer.clone()}return this.internalRenderer}set renderer(e){"imagery-tile"===this.type&&(this.activePresetRendererName=null),this.internalRenderer=e}set internalRenderer(e){null==e&&null==this.rasterFunction?this._configDefaultRenderer("override"):(this._set("internalRenderer",e),this.updateRenderer())}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer;return L(r,i)||void 0}async computeStatisticsHistograms(e,t){await this.load(t),e=a(A,e).clone();const{serviceRasterInfo:r}=this;if(null==r)throw new i("imagery-tile-mixin:compute-statistics-histograms","serviceRasterInfo must be specified");const{geometry:s}=e;if(null==s)throw new i("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let n=s;const{spatialReference:o}=r;if(!s.spatialReference.equals(o)){await J();const e="extent"===s.type?T(s,o):N(s,o);if(null==e)throw new i("imagery-tile-mixin:compute-statistics-histograms","geometry cannot be projected to the data source");n=e}const u=e.pixelSize??new l({x:r.pixelSize.x,y:r.pixelSize.y,spatialReference:o}),{extent:m,width:c,height:p}=_(r,n,u),d=await this.fetchPixels(m,c,p,{...t,interpolation:"nearest"});if(null==d.pixelBlock)throw new i("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const h=await j(d.pixelBlock,m,n),f=this._rasterJobHandler;return f?f.computeStatisticsHistograms({pixelBlock:h},t):O(h)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.serviceRasterInfo??{};if(null==t)return e;const i=I({rasterInfo:this.raster.rasterInfo,multidimensionalDefinition:e.multidimensionalDefinition||this.multidimensionalDefinition,timeExtent:e.timeExtent??this.timeExtent,multidimensionalSubset:this.multidimensionalSubset});return{...e,multidimensionalDefinition:i,timeExtent:void 0}}async updateRasterFunction(){return this.loaded&&"imagery-tile"===this.type&&(this.rasterFunction||this._cachedRasterFunctionJson)&&JSON.stringify(this.rasterFunction)!==JSON.stringify(this._cachedRasterFunctionJson)?(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this._rasterFunctionUpdatePromise=this._updateRasterFunction(),this._rasterFunctionUpdatePromise):this._rasterFunctionUpdatePromise}async updateRenderer(){const{loaded:e,symbolizer:t,renderer:i}=this;if(!e||!t||!i)return;const{rasterInfo:r}=this.raster,s=x(r,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=s?.name,o=z(r,n);return this._updateSymbolizer(t,i,n,o)}async applyRenderer(e,t,i){const r=e?.pixelBlock;if(!(null!=r&&r.pixels&&r.pixels.length>0))return null;await this.updateRenderer();const s=this.bandIds??[],{pixelBlock:n}=await this._symbolize({pixelData:e,simpleStretchParams:t,bandIds:s,symbolizer:this.symbolizer},i);return n}getRawDisplayBandIds(){let{bandIds:e,raster:t}=this;if(this.rasterFunction&&b(t)){const i=t.rasterFunction.rawInputBandIds;e=e?.length&&i?.length&&1!==t.rasterInfo.bandCount?e.map(e=>i[Math.min(e,i.length-1)]):i}return e&&e.length>3&&e.every((e,t)=>e===t)?null:e}getTileUrl(e,t,i){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${i}`:""}getCompatibleTileInfo(e,t,i=!1){if(!this.loaded||null==t)return null;if(i&&e.equals(this.spatialReference))return this.tileInfo;const r=m(e);return g.create({size:256,spatialReference:e,origin:r?{x:r.origin[0],y:r.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent?.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,i,r,s={}){if(ee(this),s.requestAsImageElement){const n=this.getTileUrl(e,i,r);return t(n,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:s.signal}).then(e=>e.data)}const{serviceRasterInfo:n}=this;if(null!=n.multidimensionalInfo&&null==(s=this.normalizeRasterFetchOptions(s)).multidimensionalDefinition){const t=s.tileInfo||n.storageInfo.tileInfo,o=this.raster.getTileExtentFromTileInfo(e,i,r,t);if(o)return{extent:o,pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer?.type&&(s={...s,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,i,r,s)}async fetchPixels(e,t,i,r={}){if(null!=this.serviceRasterInfo.multidimensionalInfo&&null==(r=this.normalizeRasterFetchOptions(r)).multidimensionalDefinition)return{extent:e,pixelBlock:null};await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),i=Math.round(i);const s=await this.raster.fetchPixels(e,t,i,r);return r.bandIds?.length&&!this.raster.rasterInfo.storageInfo.isBsqTile&&(s.pixelBlock=s.pixelBlock?.extractBands(r.bandIds)),s}async getSamples(e,t){if(await this.load(),(e=a($,e).clone()).interpolation&&"nearest"!==e.interpolation)throw new i("imagery-tile-mixin:get-samples","only nearest interpolation is currently supported");const r=e.mosaicRule?.multidimensionalDefinition,s={...t,multidimensionalDefinition:r},n=(await this._getSampleLocations(e)).map(e=>this.identify(e,s).then(t=>(t.location=e,t))),o=(await Promise.all(n)).flatMap((e,t)=>this._convertRasterIdentifyResultToSample(e,t));return new G({samples:o})}async identify(e,t={}){await this.load(),e=a(l,e).clone().normalize();const{raster:r,serviceRasterInfo:s}=this;if(null!=s?.multidimensionalInfo){if(!(s.hasMultidimensionalTranspose&&!(!w(t.multidimensionalDefinition)&&!t.transposedVariableName))&&null==(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition)return{location:e,value:null}}const n=this.multidimensionalSubset?.areaOfInterest;if(n&&!n.contains(e))throw new i("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");let o;if(this.serviceRasterInfo?.storageInfo.isBsqTile){const e=b(r)?this.getRawDisplayBandIds():this.bandIds;o=e?.length?e:void 0}return r.identify(e,{...t,bandIds:o})}hasStandardTime(){const e=this.serviceRasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.serviceRasterInfo?.dataType)return!1;const t=this.multidimensionalDefinition,i=t?.[0]?.variableName;return e.variables.some(e=>e.name===i&&(!t?.[0].dimensionName||e.dimensions.some(e=>"StdTime"===e.name)))}getStandardTimeValue(e){return new Date(S(e)).toISOString()}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo?.multidimensionalInfo;return v(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=F(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&b(this.raster)&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}async _initJobHandler(){if(!this._rasterJobHandler)return super._initJobHandler().then(async()=>{if(!this._rasterJobHandler)return;ee(this);const{raster:e}=this;e.rasterJobHandler=this._rasterJobHandler,b(e)&&e.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch(()=>{}),this.renderer&&this.updateRenderer()}).catch(()=>{})}_shutdownJobHandler(){super._shutdownJobHandler(),this.raster&&(this.raster.rasterJobHandler=null)}async _getSampleLocations(e){const{geometry:t}=e;if("point"===t.type)return[t];const{spatialReference:i,type:r}=t;if("multipoint"===r)return t.points.map(e=>new l({x:e[0],y:e[1],spatialReference:i}));if("polyline"===r){let r=t;if(e.sampleCount||e.sampleDistance){const i=await import("../../geometry/operators/densifyOperator.js"),s=(await import("../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"}),n=Math.min(e.sampleCount||100,Q);let o=e.sampleDistance;if(!o){o=s/(n+(2===r.paths[0].length?1:0))}r=i.execute(t,o,{unit:"meters"})}return r.paths.flatMap(e=>e.map(e=>new l({x:e[0],y:e[1],spatialReference:i})))}const s=Math.min(e.sampleCount||100,Q),n="extent"===t.type,o=n?t:t.extent,a=Math.sqrt(o.width*o.height/s),u=o.height/a,m=o.width/a,{xmin:c,ymax:p}=o,d=[];for(let h=0;h<u;h++)for(let e=0;e<m;e++){const r=new l({x:c+(e+.5)*a,y:p-(h+.5)*a,spatialReference:i});(n||t.contains(r))&&d.push(r)}return d}_configDefaultInterpolation(){if(null==this.interpolation){ee(this);const{raster:e}=this,t=H(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){ee(this);const{rasterInfo:t}=this.raster,i=x(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=i?.name,n=P({variableName:s,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&t.bandCount>1&&(this.bandIds=n?.bandIds??E(t)),!this.renderer||"override"===e){const e=C(this.raster),i=n?.renderer??B(t,{bandIds:this.bandIds,variableName:s,rasterFunctionColorRamp:e}),r=t.statistics,o=r&&r.length>0?r[0]:null,a=o?.max??0,l=o?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===i.type&&(a>1e24||l<-1e24)&&(i.dynamicRangeAdjustment=!0,i.customStatistics=null,"none"===i.stretchType&&(i.stretchType="min-max")),this.renderer=i}const o=M({...this.renderer.toJSON(),variableName:s}),a=z(t,s);this.symbolizer?(this.symbolizer.rendererJSON=o,this.symbolizer.rasterInfo=a):this.symbolizer=new U({rendererJSON:o,rasterInfo:a});const l=this.symbolizer.bind();if(l.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e&&"raster-colormap"===t.type){const e=B(this.raster.rasterInfo);JSON.stringify(e)!==JSON.stringify(t)&&this._configDefaultRenderer("override")}else if("raster-stretch"===t.type){const e=this.bandIds?.length,i=t.customStatistics?.length;!t.dynamicRangeAdjustment&&i&&e&&i!==e&&this._configDefaultRenderer("override")}}}else r.getLogger(this).warn("imagery-tile-mixin",l.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}async _updateRasterFunction(){if(this._isConstructedFromFunctionRaster&&b(this.raster)){const e=this.raster.rasterFunction.toJSON();return void(!this.rasterFunction&&e&&this._set("rasterFunction",y.fromJSON(e)))}let e,t=this.raster,i=!1;b(t)?(e=t.primaryRasters.rasters,t=e[0],i=!0):e=[t];const{rasterFunction:r}=this;if(r){const i={raster:t};e.length>1&&e.forEach(e=>i[e.url]=e);const s=D(r.functionDefinition?.toJSON()??r.toJSON(),i),n=new R({rasterFunction:s});n.rasterJobHandler=this._rasterJobHandler,await n.open(),this.raster=n}else this.raster=t,await t.open();if(this._cachedRendererJson=void 0,!i&&!r)return;const{bandIds:s}=this,{bandCount:n}=this.raster.rasterInfo,o=s?.length?s.some(e=>e>=n):n>=3;s&&(o||this.renderer&&"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}_convertRasterIdentifyResultToSample(e,t){const{rasterInfo:i}=this.raster,r=i.storageInfo.pyramidScalingFactor**(e.pyramidLevel??0),s=(i.pixelSize.x+i.pixelSize.y)/2*r;if(!e.dataSeries?.length)return[new V({location:e.location,pixelValue:e.value,locationId:t,resolution:s})];const n=[];return e.dataSeries.forEach(({value:i,multidimensionalDefinition:r},o)=>{const a={Variables:r[0].variableName,Dimensions:r.flatMap(({dimensionName:e})=>e).join(",")};for(const{dimensionName:e,values:t}of r){a[e]=Array.isArray(t[0])?t[0][0]:t[0];const i=t[t.length-1];a[`${e}_Max`]=Array.isArray(i)?i[i.length-1]:i}const l=new V({location:e.location,pixelValue:i,rasterId:o,locationId:t,resolution:s,attributes:a});n.push(l)}),n}};function ee(e){if(!e.raster||!e.serviceRasterInfo)throw new i("imagery-tile","no raster")}return e([s({clonable:!1})],Z.prototype,"_cachedRasterFunctionJson",void 0),e([s({clonable:!1})],Z.prototype,"_compatibleFullExtent",void 0),e([s({clonable:!1})],Z.prototype,"_isConstructedFromFunctionRaster",void 0),e([s({clonable:!1})],Z.prototype,"_rasterFunctionUpdatePromise",void 0),e([s({type:[o],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],Z.prototype,"bandIds",void 0),e([s({json:{origins:{service:{read:{source:"copyrightText"}}}}})],Z.prototype,"copyright",void 0),e([s({json:{read:!1}})],Z.prototype,"fullExtent",null),e([s({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),W(f)],Z.prototype,"interpolation",void 0),e([s()],Z.prototype,"ioConfig",void 0),e([s({type:[d],json:{write:!0}})],Z.prototype,"multidimensionalDefinition",null),e([s({type:h,json:{write:!0}})],Z.prototype,"multidimensionalSubset",void 0),e([s()],Z.prototype,"raster",void 0),e([s({type:y})],Z.prototype,"rasterFunction",null),e([s()],Z.prototype,"serviceRasterInfo",void 0),e([s()],Z.prototype,"sourceJSON",void 0),e([s({readOnly:!0,type:u,json:{read:!1}})],Z.prototype,"spatialReference",void 0),e([s({type:g})],Z.prototype,"tileInfo",void 0),e([s(p)],Z.prototype,"url",null),e([s()],Z.prototype,"renderer",null),e([s({types:k,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const e="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!e}}},origins:{"web-scene":{types:q,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],Z.prototype,"internalRenderer",null),e([K("internalRenderer")],Z.prototype,"readRenderer",null),e([s({clonable:!1})],Z.prototype,"symbolizer",void 0),Z=e([n("esri.layers.mixins.ImageryTileMixin")],Z),Z};export{X as ImageryTileMixin};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../request.js";import i from"../../core/Error.js";import r from"../../core/Logger.js";import{property as s,subclass as n}from"../../core/accessorSupport/decorators.js";import{Integer as o,ensureClass as a}from"../../core/accessorSupport/ensureType.js";import l from"../../geometry/Point.js";import u from"../../geometry/SpatialReference.js";import{getInfo as m}from"../../geometry/support/spatialReferenceUtils.js";import{sanitizeUrl as c}from"../support/arcgisLayerUrl.js";import{url as p}from"../support/commonProperties.js";import d from"../support/DimensionalDefinition.js";import h from"../support/MultidimensionalSubset.js";import{interpolationKebab as f}from"../support/rasterEnums.js";import y from"../support/RasterFunction.js";import g from"../support/TileInfo.js";import{isFunctionRaster as b}from"../support/rasterDatasets/datasetUtils.js";import R from"../support/rasterDatasets/FunctionRaster.js";import{getEffectiveMultidimensionalDefinition as I,getDefaultVariableInfo as x,isMultiSliceOrRangeDefinition as w,convertOleDateTimeToEpoch as S,getSubsetVariablesFromMdInfo as v,getDefaultMultidimensionalDefinition as F}from"../support/rasterDatasets/multidimensionalUtils.js";import{snapToRaster as _,clip as j}from"../support/rasterFunctions/clipUtils.js";import{create as D}from"../support/rasterFunctions/rasterFunctionHelper.js";import{load as J,projectExtent as T,projectPolygon as N}from"../support/rasterFunctions/rasterProjectionHelper.js";import{computeStatisticsHistograms as O}from"../support/rasterFunctions/stretchUtils.js";import{getVariableRasterInfo as z,getDefaultInterpolation as H,matchPresetRenderer as P,getDefaultBandCombination as E,getFunctionColorRamp as C,createDefaultRenderer as B,normalizeRendererJSON as M}from"../../renderers/support/rasterRendererHelper.js";import U from"../../renderers/support/RasterSymbolizer.js";import{rasterRendererTypes as q,websceneRasterRendererTypes as k,read as L}from"../../renderers/support/rasterTypeUtils.js";import A from"../../rest/support/ImageHistogramParameters.js";import V from"../../rest/support/ImageSample.js";import $ from"../../rest/support/ImageSampleParameters.js";import G from"../../rest/support/ImageSampleResult.js";import{enumeration as W}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as K}from"../../core/accessorSupport/decorators/reader.js";const Q=1e3,X=X=>{const Y=X;let Z=class extends Y{constructor(...e){super(...e),this._isConstructedFromFunctionRaster=!1,this.bandIds=null,this.copyright=null,this.interpolation=null,this.multidimensionalSubset=null,this.raster=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster=b(e[0]?.raster)}destroy(){this._shutdownJobHandler()}get fullExtent(){return this.serviceRasterInfo?.extent}set multidimensionalDefinition(e){this._set("multidimensionalDefinition",e),this.updateRenderer()}set rasterFunction(e){"none"===e?.functionName?.toLowerCase()&&(e=void 0),this._set("rasterFunction",e),this.updateRasterFunction()}set url(e){this._set("url",c(e,r.getLogger(this)))}get renderer(){if("imagery-tile"!==this.type)return this.internalRenderer;const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const i=t?.find(({name:t})=>t===e);return i?.renderer.clone()}return this.internalRenderer}set renderer(e){"imagery-tile"===this.type&&(this.activePresetRendererName=null),this.internalRenderer=e}set internalRenderer(e){null==e&&null==this.rasterFunction?this._configDefaultRenderer("override"):(this._set("internalRenderer",e),this.updateRenderer())}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer;return L(r,i)||void 0}async computeStatisticsHistograms(e,t){await this.load(t),e=a(A,e).clone();const{serviceRasterInfo:r}=this;if(null==r)throw new i("imagery-tile-mixin:compute-statistics-histograms","serviceRasterInfo must be specified");const{geometry:s}=e;if(null==s)throw new i("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let n=s;const{spatialReference:o}=r;if(!s.spatialReference.equals(o)){await J();const e="extent"===s.type?T(s,o):N(s,o);if(null==e)throw new i("imagery-tile-mixin:compute-statistics-histograms","geometry cannot be projected to the data source");n=e}const u=e.pixelSize??new l({x:r.pixelSize.x,y:r.pixelSize.y,spatialReference:o}),{extent:m,width:c,height:p}=_(r,n,u),d=await this.fetchPixels(m,c,p,{...t,interpolation:"nearest"});if(null==d.pixelBlock)throw new i("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const h=await j(d.pixelBlock,m,n),f=this._rasterJobHandler;return f?f.computeStatisticsHistograms({pixelBlock:h},t):O(h)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.serviceRasterInfo??{};if(null==t)return e;const i=I({rasterInfo:this.raster.rasterInfo,multidimensionalDefinition:e.multidimensionalDefinition||this.multidimensionalDefinition,timeExtent:e.timeExtent??this.timeExtent,multidimensionalSubset:this.multidimensionalSubset});return{...e,multidimensionalDefinition:i,timeExtent:void 0}}async updateRasterFunction(){return this.loaded&&"imagery-tile"===this.type&&(this.rasterFunction||this._cachedRasterFunctionJson)&&JSON.stringify(this.rasterFunction)!==JSON.stringify(this._cachedRasterFunctionJson)?(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this._rasterFunctionUpdatePromise=this._updateRasterFunction(),this._rasterFunctionUpdatePromise):this._rasterFunctionUpdatePromise}async updateRenderer(){const{loaded:e,symbolizer:t,renderer:i}=this;if(!e||!t||!i)return;const{rasterInfo:r}=this.raster,s=x(r,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=s?.name,o=z(r,n);return this._updateSymbolizer(t,i,n,o)}async applyRenderer(e,t,i){const r=e?.pixelBlock;if(!(null!=r&&r.pixels&&r.pixels.length>0))return null;await this.updateRenderer();const s=this.bandIds??[],{pixelBlock:n}=await this._symbolize({pixelData:e,simpleStretchParams:t,bandIds:s,symbolizer:this.symbolizer},i);return n}getRawDisplayBandIds(){let{bandIds:e,raster:t}=this;if(this.rasterFunction&&b(t)){const i=t.rasterFunction.rawInputBandIds;e=e?.length&&i?.length&&1!==t.rasterInfo.bandCount?e.map(e=>i[Math.min(e,i.length-1)]):i}return e&&e.length>3&&e.every((e,t)=>e===t)?null:e}getTileUrl(e,t,i){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${i}`:""}getCompatibleTileInfo(e,t,i=!1){if(!this.loaded||null==t)return null;if(i&&e.equals(this.spatialReference))return this.tileInfo;const r=m(e);return g.create({size:256,spatialReference:e,origin:r?{x:r.origin[0],y:r.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent?.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,i,r,s={}){if(ee(this),s.requestAsImageElement){const n=this.getTileUrl(e,i,r);return t(n,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:s.signal}).then(e=>e.data)}const{serviceRasterInfo:n}=this;if(null!=n.multidimensionalInfo&&null==(s=this.normalizeRasterFetchOptions(s)).multidimensionalDefinition){const t=s.tileInfo||n.storageInfo.tileInfo,o=this.raster.getTileExtentFromTileInfo(e,i,r,t);if(o)return{extent:o,pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer?.type&&(s={...s,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,i,r,s)}async fetchPixels(e,t,i,r={}){if(null!=this.serviceRasterInfo.multidimensionalInfo&&null==(r=this.normalizeRasterFetchOptions(r)).multidimensionalDefinition)return{extent:e,pixelBlock:null};await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),i=Math.round(i);const s=await this.raster.fetchPixels(e,t,i,r);return r.bandIds?.length&&!this.raster.rasterInfo.storageInfo.isBsqTile&&(s.pixelBlock=s.pixelBlock?.extractBands(r.bandIds)),s}async getSamples(e,t){if(await this.load(),(e=a($,e).clone()).interpolation&&"nearest"!==e.interpolation)throw new i("imagery-tile-mixin:get-samples","only nearest interpolation is currently supported");const r=e.mosaicRule?.multidimensionalDefinition,s={...t,multidimensionalDefinition:r},n=(await this._getSampleLocations(e)).map(e=>this.identify(e,s).then(t=>(t.location=e,t))),o=(await Promise.all(n)).flatMap((e,t)=>this._convertRasterIdentifyResultToSample(e,t));return new G({samples:o})}async identify(e,t={}){await this.load(),e=a(l,e).clone().normalize();const{raster:r,serviceRasterInfo:s}=this;if(null!=s?.multidimensionalInfo){if(!(s.hasMultidimensionalTranspose&&!(!w(t.multidimensionalDefinition)&&!t.transposedVariableName))&&null==(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition)return{location:e,value:null}}const n=this.multidimensionalSubset?.areaOfInterest;if(n&&!n.contains(e))throw new i("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");let o;if(this.serviceRasterInfo?.storageInfo.isBsqTile){const e=b(r)?this.getRawDisplayBandIds():this.bandIds;o=e?.length?e:void 0}return r.identify(e,{...t,bandIds:o})}hasStandardTime(){const e=this.serviceRasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.serviceRasterInfo?.dataType)return!1;const t=this.multidimensionalDefinition,i=t?.[0]?.variableName;return e.variables.some(e=>e.name===i&&(!t?.[0].dimensionName||e.dimensions.some(e=>"StdTime"===e.name)))}getStandardTimeValue(e){return new Date(S(e)).toISOString()}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo?.multidimensionalInfo;return v(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=F(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&b(this.raster)&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}async _initJobHandler(){if(!this._rasterJobHandler)return super._initJobHandler().then(async()=>{if(!this._rasterJobHandler)return;ee(this);const{raster:e}=this;e.rasterJobHandler=this._rasterJobHandler,b(e)&&e.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch(()=>{}),this.renderer&&this.updateRenderer()}).catch(()=>{})}_shutdownJobHandler(){super._shutdownJobHandler(),this.raster&&(this.raster.rasterJobHandler=null)}async _getSampleLocations(e){const{geometry:t}=e;if("point"===t.type)return[t];const{spatialReference:i,type:r}=t;if("multipoint"===r)return t.points.map(e=>new l({x:e[0],y:e[1],spatialReference:i}));if("polyline"===r){let r=t;if(e.sampleCount||e.sampleDistance){const i=await import("../../geometry/operators/densifyOperator.js"),s=(await import("../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"}),n=Math.min(e.sampleCount||100,Q);let o=e.sampleDistance;if(!o){o=s/(n+(2===r.paths[0].length?1:0))}r=i.execute(t,o,{unit:"meters"})}return r.paths.flatMap(e=>e.map(e=>new l({x:e[0],y:e[1],spatialReference:i})))}const s=Math.min(e.sampleCount||100,Q),n="extent"===t.type,o=n?t:t.extent,a=Math.sqrt(o.width*o.height/s),u=o.height/a,m=o.width/a,{xmin:c,ymax:p}=o,d=[];for(let h=0;h<u;h++)for(let e=0;e<m;e++){const r=new l({x:c+(e+.5)*a,y:p-(h+.5)*a,spatialReference:i});(n||t.contains(r))&&d.push(r)}return d}_configDefaultInterpolation(){if(null==this.interpolation){ee(this);const{raster:e}=this,t=H(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){ee(this);const{rasterInfo:t}=this.raster,i=x(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=i?.name,n=P({variableName:s,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&t.bandCount>1&&(this.bandIds=n?.bandIds??E(t)),!this.renderer||"override"===e){const e=C(this.raster),i=n?.renderer??B(t,{bandIds:this.bandIds,variableName:s,rasterFunctionColorRamp:e}),r=t.statistics,o=r&&r.length>0?r[0]:null,a=o?.max??0,l=o?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===i.type&&(a>1e24||l<-1e24)&&(i.dynamicRangeAdjustment=!0,i.customStatistics=null,"none"===i.stretchType&&(i.stretchType="min-max")),this.renderer=i}const o=M({...this.renderer.toJSON(),variableName:s}),a=z(t,s);this.symbolizer?(this.symbolizer.rendererJSON=o,this.symbolizer.rasterInfo=a):this.symbolizer=new U({rendererJSON:o,rasterInfo:a});const l=this.symbolizer.bind();if(l.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e&&"raster-colormap"===t.type){const e=B(this.raster.rasterInfo);JSON.stringify(e)!==JSON.stringify(t)&&this._configDefaultRenderer("override")}else if("raster-stretch"===t.type){const e=this.bandIds?.length,i=t.customStatistics?.length;!t.dynamicRangeAdjustment&&i&&e&&i!==e&&this._configDefaultRenderer("override")}}}else r.getLogger(this).warn("imagery-tile-mixin",l.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}async _updateRasterFunction(){if(this._isConstructedFromFunctionRaster&&b(this.raster)){const e=this.raster.rasterFunction.toJSON();return void(!this.rasterFunction&&e&&this._set("rasterFunction",y.fromJSON(e)))}let e,t=this.raster,i=!1;b(t)?(e=t.primaryRasters.rasters,t=e[0],i=!0):e=[t];const{rasterFunction:r}=this;if(r){const i={raster:t};e.length>1&&e.forEach(e=>i[e.url]=e);const s=D(r.functionDefinition?.toJSON()??r.toJSON(),i),n=new R({rasterFunction:s});n.rasterJobHandler=this._rasterJobHandler,await n.open(),this.raster=n}else this.raster=t,await t.open();if(this._cachedRendererJson=void 0,!i&&!r)return;const{bandIds:s}=this,{bandCount:n}=this.raster.rasterInfo,o=s?.length?s.some(e=>e>=n):n>=3;s&&(o||this.renderer&&"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}_convertRasterIdentifyResultToSample(e,t){const{rasterInfo:i}=this.raster,r=i.storageInfo.pyramidScalingFactor**(e.pyramidLevel??0),s=(i.pixelSize.x+i.pixelSize.y)/2*r;if(!e.dataSeries?.length)return[new V({location:e.location,pixelValue:e.value,locationId:t,resolution:s})];const n=[];return e.dataSeries.forEach(({value:i,multidimensionalDefinition:r},o)=>{const a={Variables:r[0].variableName,Dimensions:r.flatMap(({dimensionName:e})=>e).join(",")};for(const{dimensionName:e,values:t}of r){a[e]=Array.isArray(t[0])?t[0][0]:t[0];const i=t[t.length-1];a[`${e}_Max`]=Array.isArray(i)?i[i.length-1]:i}const l=new V({location:e.location,pixelValue:i,rasterId:o,locationId:t,resolution:s,attributes:a});n.push(l)}),n}};function ee(e){if(!e.raster||!e.serviceRasterInfo)throw new i("imagery-tile","no raster")}return e([s({clonable:!1})],Z.prototype,"_cachedRasterFunctionJson",void 0),e([s({clonable:!1})],Z.prototype,"_compatibleFullExtent",void 0),e([s({clonable:!1})],Z.prototype,"_isConstructedFromFunctionRaster",void 0),e([s({clonable:!1})],Z.prototype,"_rasterFunctionUpdatePromise",void 0),e([s({type:[o],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],Z.prototype,"bandIds",void 0),e([s({json:{origins:{service:{read:{source:"copyrightText"}}}}})],Z.prototype,"copyright",void 0),e([s({json:{read:!1}})],Z.prototype,"fullExtent",null),e([s({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),W(f)],Z.prototype,"interpolation",void 0),e([s()],Z.prototype,"ioConfig",void 0),e([s({type:[d],json:{write:!0}})],Z.prototype,"multidimensionalDefinition",null),e([s({type:h,json:{write:!0}})],Z.prototype,"multidimensionalSubset",void 0),e([s()],Z.prototype,"raster",void 0),e([s({type:y})],Z.prototype,"rasterFunction",null),e([s()],Z.prototype,"serviceRasterInfo",void 0),e([s()],Z.prototype,"sourceJSON",void 0),e([s({readOnly:!0,type:u,json:{read:!1}})],Z.prototype,"spatialReference",void 0),e([s({type:g})],Z.prototype,"tileInfo",void 0),e([s(p)],Z.prototype,"url",null),e([s({types:q})],Z.prototype,"renderer",null),e([s({types:q,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const e="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!e}}},origins:{"web-scene":{types:k,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],Z.prototype,"internalRenderer",null),e([K("internalRenderer")],Z.prototype,"readRenderer",null),e([s({clonable:!1})],Z.prototype,"symbolizer",void 0),Z=e([n("esri.layers.mixins.ImageryTileMixin")],Z),Z};export{X as ImageryTileMixin};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../config.js";import{id as r}from"../../kernel.js";import s from"../../request.js";import{result as i}from"../../core/asyncUtils.js";import a from"../../core/Error.js";import o from"../../core/Logger.js";import{destroyMaybe as l}from"../../core/maybe.js";import{throwIfAborted as n,isAbortError as p,throwIfAbortError as u}from"../../core/promiseUtils.js";import{hasSameCanonicalPortal as d,hasSamePortal as c,normalize as m}from"../../core/urlUtils.js";import{property as h,subclass as f}from"../../core/accessorSupport/decorators.js";import{getOwningPortalUrl as g}from"../support/layerUtils.js";import y from"../../portal/Portal.js";import I from"../../portal/PortalItem.js";import v from"../../portal/PortalUser.js";import{getUserPrivileges as P}from"../../portal/support/portalItemUtils.js";import{reader as U}from"../../core/accessorSupport/decorators/reader.js";import{writer as w}from"../../core/accessorSupport/decorators/writer.js";const
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../config.js";import{id as r}from"../../kernel.js";import s from"../../request.js";import{result as i}from"../../core/asyncUtils.js";import a from"../../core/Error.js";import o from"../../core/Logger.js";import{destroyMaybe as l}from"../../core/maybe.js";import{throwIfAborted as n,isAbortError as p,throwIfAbortError as u}from"../../core/promiseUtils.js";import{hasSameCanonicalPortal as d,hasSamePortal as c,normalize as m}from"../../core/urlUtils.js";import{property as h,subclass as f}from"../../core/accessorSupport/decorators.js";import{getOwningPortalUrl as g}from"../support/layerUtils.js";import y from"../../portal/Portal.js";import I from"../../portal/PortalItem.js";import v from"../../portal/PortalUser.js";import{getUserPrivileges as P}from"../../portal/support/portalItemUtils.js";import{reader as U}from"../../core/accessorSupport/decorators/reader.js";import{writer as w}from"../../core/accessorSupport/decorators/writer.js";const _=_=>{const E=_;let b=class extends E{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1}destroy(){this.portalItem=l(this.portalItem),this.resourceReferences.portalItem=null,this.resourceReferences.paths.length=0}get portalItem(){return this._get("portalItem")}set portalItem(e){e!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",e))}readPortalItem(e,t,r){if(t.itemId)return new I({id:t.itemId,portal:r?.portal})}writePortalItem(e,t){e?.id&&(t.itemId=e.id)}async loadFromPortal(e,t){if(this.portalItem?.id)try{const{load:r}=await import("../../portal/support/layersLoader.js");return n(t),await r({instance:this,supportedTypes:e.supportedTypes,validateItem:e.validateItem,supportsData:e.supportsData,layerModuleTypeMap:e.layerModuleTypeMap,populateGroupLayer:e.populateGroupLayer},t)}catch(r){throw p(r)||o.getLogger(this).warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${r}`),r}}async finishLoadEditablePortalLayer(e){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(e).catch(e=>(u(e),!0)))}async setUserPrivileges(e,r){if(!t.userPrivilegesApplied)return this.finishLoadEditablePortalLayer(r);if(this.url)try{const{features:{edit:t,fullEdit:s},content:{updateItem:i}}=await this._fetchUserPrivileges(e,r);this._set("userHasEditingPrivileges",t),this._set("userHasFullEditingPrivileges",s),this._set("userHasUpdateItemPrivileges",i)}catch(s){u(s)}}async _fetchUserPrivileges(e,t){let s=this.portalItem;if(!e||!s||!s.loaded||s.sourceUrl)return this._fetchFallbackUserPrivileges(t);const i=!r?.findCredential(this.url),a=e===s.id;if(a&&s.portal.user)return this._getUserPrivileges(s,i);let o,l;if(a)o=s.portal.url;else try{o=await g(this.url,t)}catch(m){u(m)}if(!o||!d(o,s.portal.url))return this._fetchFallbackUserPrivileges(t);try{const e=null!=t?t.signal:null;l=await(r?.getCredential(`${o}/sharing`,{prompt:!1,signal:e}))}catch(m){u(m)}const n=!0,p=!1,c=!1;if(!l)return{features:{edit:n,fullEdit:p},content:{updateItem:c}};try{if(a?await s.reload():(s=new I({id:e,portal:{url:o}}),await s.load(t)),s.portal.user)return this._getUserPrivileges(s,i)}catch(m){u(m)}return{features:{edit:n,fullEdit:p},content:{updateItem:c}}}_getUserPrivileges(e,t){const r=P(e);return t&&(r.features.edit=!0),r}async _fetchFallbackUserPrivileges(e){let t=!0;try{t=await this._fetchUserHasEditingPrivileges(e)}catch(r){u(r)}return{features:{edit:t,fullEdit:!1},content:{updateItem:!1}}}async _fetchUserHasEditingPrivileges(e){const t=this.url?r?.findCredential(this.url):null;if(!t)return!0;const s=j.credential===t?j.user:await this._fetchEditingUser(e);return j.credential=t,j.user=s,null==s?.privileges||s.privileges.includes("features:user:edit")}async _fetchEditingUser(e){const t=this.portalItem?.portal?.user;if(t)return t;const a=r?.findServerInfo(this.url??"");if(!a?.owningSystemUrl)return null;const o=`${a.owningSystemUrl}/sharing/rest`,l=y.getDefault();if(l&&l.loaded&&m(l.restUrl)===m(o))return l.user;const n=`${o}/community/self`,p=null!=e?e.signal:null,u=await i(s(n,{authMode:"no-prompt",query:{f:"json"},signal:p}));return u.ok?v.fromJSON(u.value.data):null}read(e,t){t&&(t.layer=this),super.read(e,t)}write(e,t){const r=t?.portal,s=this.portalItem?.id&&(this.portalItem.portal||y.getDefault());return r&&s&&!c(s.restUrl,r.restUrl)?(t.messages&&t.messages.push(new a("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(e,{...t,layer:this})}};return e([h({type:I})],b.prototype,"portalItem",null),e([U("web-document","portalItem",["itemId"])],b.prototype,"readPortalItem",null),e([w("web-document","portalItem",{itemId:{type:String}})],b.prototype,"writePortalItem",null),e([h({clonable:!1})],b.prototype,"resourceReferences",void 0),e([h({type:Boolean,readOnly:!0})],b.prototype,"userHasEditingPrivileges",void 0),e([h({type:Boolean,readOnly:!0})],b.prototype,"userHasFullEditingPrivileges",void 0),e([h({type:Boolean,readOnly:!0})],b.prototype,"userHasUpdateItemPrivileges",void 0),b=e([f("esri.layers.mixins.PortalLayer")],b),b},j={credential:null,user:null};export{_ as PortalLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as e,subclass as o}from"../../core/accessorSupport/decorators.js";import{excludeTables as r}from"../../core/accessorSupport/layerContainerType.js";import{fixTimeInfoFields as i}from"../support/fieldUtils.js";import s from"../support/TimeInfo.js";import{timeUnitKebabDictionary as n}from"../../portal/timeUnitKebabDictionary.js";import m from"../../time/TimeExtent.js";import p from"../../time/TimeInterval.js";import{reader as f}from"../../core/accessorSupport/decorators/reader.js";const a={type:Boolean,json:{read:{source:"timeAnimation"},write:{target:"timeAnimation",layerContainerTypes:r}}},l=r=>{const l=r;let u=class extends l{constructor(){super(...arguments),this.timeExtent=null,this.timeOffset=null,this.useViewTime=!0}readOffset(t,e){const o=e.timeInfo.exportOptions;if(!o)return null;const r=o.timeOffset,i=n.fromJSON(o.timeOffsetUnits);return r&&i?new p({value:r,unit:i}):null}set timeInfo(t){i(t,this.fieldsIndex),this._set("timeInfo",t)}};return t([e({type:m,json:{write:!1}})],u.prototype,"timeExtent",void 0),t([e({type:p})],u.prototype,"timeOffset",void 0),t([f("service","timeOffset",["timeInfo.exportOptions"])],u.prototype,"readOffset",null),t([e({value:null,type:s,json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],u.prototype,"timeInfo",null),t([e(a)],u.prototype,"useViewTime",void 0),u=t([o("esri.layers.mixins.TemporalLayer")],u),u};export{l as TemporalLayer,a as useViewTimeProperty};
|
|
5
|
+
import{__decorate as t}from"tslib";import{property as e,subclass as o}from"../../core/accessorSupport/decorators.js";import{excludeTables as r}from"../../core/accessorSupport/layerContainerType.js";import{fixTimeInfoFields as i}from"../support/fieldUtils.js";import s from"../support/TimeInfo.js";import{timeUnitKebabDictionary as n}from"../../portal/timeUnitKebabDictionary.js";import m from"../../time/TimeExtent.js";import p from"../../time/TimeInterval.js";import{reader as f}from"../../core/accessorSupport/decorators/reader.js";const a={type:Boolean,json:{read:{source:"timeAnimation"},write:{target:"timeAnimation",layerContainerTypes:r}}},l=r=>{const l=r;let u=class extends l{constructor(){super(...arguments),this.timeExtent=null,this.timeOffset=null,this.useViewTime=!0}readOffset(t,e){const o=e.timeInfo.exportOptions;if(!o)return null;const r=o.timeOffset,i=n.fromJSON(o.timeOffsetUnits);return r&&i?new p({value:r,unit:i}):null}get timeInfo(){return this._get("timeInfo")}set timeInfo(t){i(t,this.fieldsIndex),this._set("timeInfo",t)}};return t([e({type:m,json:{write:!1}})],u.prototype,"timeExtent",void 0),t([e({type:p})],u.prototype,"timeOffset",void 0),t([f("service","timeOffset",["timeInfo.exportOptions"])],u.prototype,"readOffset",null),t([e({value:null,type:s,json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],u.prototype,"timeInfo",null),t([e(a)],u.prototype,"useViewTime",void 0),u=t([o("esri.layers.mixins.TemporalLayer")],u),u};export{l as TemporalLayer,a as useViewTimeProperty};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const a={ArcGISAnnotationLayer:()=>Promise.resolve(null),ArcGISDimensionLayer:async()=>(await import("../DimensionLayer.js")).default,ArcGISFeatureLayer:async()=>(await import("../FeatureLayer.js")).default,ArcGISImageServiceLayer:async()=>(await import("../ImageryLayer.js")).default,ArcGISImageServiceVectorLayer:()=>Promise.resolve(null),ArcGISMapServiceLayer:async()=>(await import("../MapImageLayer.js")).default,ArcGISSceneServiceLayer:async()=>(await import("../SceneLayer.js")).default,ArcGISStreamLayer:async()=>(await import("../StreamLayer.js")).default,ArcGISTiledElevationServiceLayer:async()=>(await import("../ElevationLayer.js")).default,ArcGISTiledImageServiceLayer:async()=>(await import("../ImageryTileLayer.js")).default,ArcGISTiledMapServiceLayer:async()=>(await import("../TileLayer.js")).default,ArcGISVideoLayer:async()=>(await import("../VideoLayer.js")).default,BingMapsAerial:async()=>(await import("../BingMapsLayer.js")).default,BingMapsRoad:async()=>(await import("../BingMapsLayer.js")).default,BingMapsHybrid:async()=>(await import("../BingMapsLayer.js")).default,BuildingSceneLayer:async()=>(await import("../BuildingSceneLayer.js")).default,CatalogLayer:async()=>(await import("../CatalogLayer.js")).default,CSV:async()=>(await import("../CSVLayer.js")).default,GaussianSplatLayer:async()=>(await import("../GaussianSplatLayer.js")).default,GeoRSS:async()=>(await import("../GeoRSSLayer.js")).default,GeoJSON:async()=>(await import("../GeoJSONLayer.js")).default,GroupLayer:async()=>(await import("../GroupLayer.js")).default,IntegratedMeshLayer:async()=>(await import("../IntegratedMeshLayer.js")).default,KML:async()=>(await import("../KMLLayer.js")).default,KnowledgeGraphLayer:async()=>(await import("../KnowledgeGraphLayer.js")).default,MediaLayer:async()=>(await import("../MediaLayer.js")).default,LineOfSightLayer:async()=>(await import("../LineOfSightLayer.js")).default,OGCFeatureLayer:async()=>(await import("../OGCFeatureLayer.js")).default,OpenStreetMap:async()=>(await import("../OpenStreetMapLayer.js")).default,OrientedImageryLayer:async()=>(await import("../OrientedImageryLayer.js")).default,PointCloudLayer:async()=>(await import("../PointCloudLayer.js")).default,VectorTileLayer:async()=>(await import("../VectorTileLayer.js")).default,ViewshedLayer:async()=>(await import("../ViewshedLayer.js")).default,Voxel:async()=>(await import("../VoxelLayer.js")).default,WCS:async()=>(await import("../WCSLayer.js")).default,WebTiledLayer:async()=>(await import("../WebTileLayer.js")).default,WFS:async()=>(await import("../WFSLayer.js")).default,SubtypeGroupLayer:async()=>(await import("../SubtypeGroupLayer.js")).default,SubtypeGroupTable:async()=>(await import("../SubtypeGroupLayer.js")).default,WMS:async()=>(await import("../WMSLayer.js")).default,RasterDataLayer:()=>Promise.resolve(null),RasterDataElevationLayer:()=>Promise.resolve(null),IntegratedMesh3DTilesLayer:async()=>(await import("../IntegratedMesh3DTilesLayer.js")).default,Object3DTilesLayer:()=>Promise.resolve(null)};export{a as typeModuleMap};
|
|
5
|
+
const a={ArcGISAnnotationLayer:()=>Promise.resolve(null),ArcGISDimensionLayer:async()=>(await import("../DimensionLayer.js")).default,ArcGISFeatureLayer:async()=>(await import("../FeatureLayer.js")).default,ArcGISImageServiceLayer:async()=>(await import("../ImageryLayer.js")).default,ArcGISImageServiceVectorLayer:()=>Promise.resolve(null),ArcGISMapServiceLayer:async()=>(await import("../MapImageLayer.js")).default,ArcGISSceneServiceLayer:async()=>(await import("../SceneLayer.js")).default,ArcGISStreamLayer:async()=>(await import("../StreamLayer.js")).default,ArcGISTiledElevationServiceLayer:async()=>(await import("../ElevationLayer.js")).default,ArcGISTiledImageServiceLayer:async()=>(await import("../ImageryTileLayer.js")).default,ArcGISTiledMapServiceLayer:async()=>(await import("../TileLayer.js")).default,ArcGISVideoLayer:async()=>(await import("../VideoLayer.js")).default,BingMapsAerial:async()=>(await import("../BingMapsLayer.js")).default,BingMapsRoad:async()=>(await import("../BingMapsLayer.js")).default,BingMapsHybrid:async()=>(await import("../BingMapsLayer.js")).default,BuildingSceneLayer:async()=>(await import("../BuildingSceneLayer.js")).default,CatalogLayer:async()=>(await import("../CatalogLayer.js")).default,CSV:async()=>(await import("../CSVLayer.js")).default,GaussianSplatLayer:async()=>(await import("../GaussianSplatLayer.js")).default,GeoRSS:async()=>(await import("../GeoRSSLayer.js")).default,GeoJSON:async()=>(await import("../GeoJSONLayer.js")).default,GroupLayer:async()=>(await import("../GroupLayer.js")).default,IntegratedMeshLayer:async()=>(await import("../IntegratedMeshLayer.js")).default,KML:async()=>(await import("../KMLLayer.js")).default,KnowledgeGraphLayer:async()=>(await import("../KnowledgeGraphLayer.js")).default,MediaLayer:async()=>(await import("../MediaLayer.js")).default,LineOfSightLayer:async()=>(await import("../LineOfSightLayer.js")).default,OGCFeatureLayer:async()=>(await import("../OGCFeatureLayer.js")).default,OpenStreetMap:async()=>(await import("../OpenStreetMapLayer.js")).default,OrientedImageryLayer:async()=>(await import("../OrientedImageryLayer.js")).default,ParquetLayer:async()=>(await import("../ParquetLayer.js")).default,PointCloudLayer:async()=>(await import("../PointCloudLayer.js")).default,VectorTileLayer:async()=>(await import("../VectorTileLayer.js")).default,ViewshedLayer:async()=>(await import("../ViewshedLayer.js")).default,Voxel:async()=>(await import("../VoxelLayer.js")).default,WCS:async()=>(await import("../WCSLayer.js")).default,WebTiledLayer:async()=>(await import("../WebTileLayer.js")).default,WFS:async()=>(await import("../WFSLayer.js")).default,SubtypeGroupLayer:async()=>(await import("../SubtypeGroupLayer.js")).default,SubtypeGroupTable:async()=>(await import("../SubtypeGroupLayer.js")).default,WMS:async()=>(await import("../WMSLayer.js")).default,RasterDataLayer:()=>Promise.resolve(null),RasterDataElevationLayer:()=>Promise.resolve(null),IntegratedMesh3DTilesLayer:async()=>(await import("../IntegratedMesh3DTilesLayer.js")).default,Object3DTilesLayer:()=>Promise.resolve(null)};export{a as typeModuleMap};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const e={ArcGISAnnotationLayer:!0,ArcGISDimensionLayer:!0,ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISImageServiceVectorLayer:!0,ArcGISMapServiceLayer:!0,ArcGISStreamLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,ArcGISVideoLayer:!0,BingMapsAerial:!0,BingMapsHybrid:!0,BingMapsRoad:!0,CatalogLayer:!0,CSV:!0,GeoJSON:!0,GeoRSS:!0,GroupLayer:!0,KML:!0,KnowledgeGraphLayer:!0,MediaLayer:!0,OGCFeatureLayer:!0,OrientedImageryLayer:!0,SubtypeGroupLayer:!0,VectorTileLayer:!0,WCS:!0,WFS:!0,WMS:!0,WebTiledLayer:!0},r={ArcGISImageServiceLayer:!0,ArcGISImageServiceVectorLayer:!0,ArcGISMapServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,BingMapsAerial:!0,BingMapsHybrid:!0,BingMapsRoad:!0,OpenStreetMap:!0,VectorTileLayer:!0,WCS:!0,WMS:!0,WebTiledLayer:!0},a={ArcGISFeatureLayer:!0,SubtypeGroupTable:!0},S={"web-scene/operational-layers":{ArcGISDimensionLayer:!0,ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISMapServiceLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISTiledElevationServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,BuildingSceneLayer:!0,CatalogLayer:!0,CSV:!0,GaussianSplatLayer:!0,GeoJSON:!0,GroupLayer:!0,IntegratedMesh3DTilesLayer:!0,Object3DTilesLayer:!0,IntegratedMeshLayer:!0,KML:!0,LineOfSightLayer:!0,MediaLayer:!0,OGCFeatureLayer:!0,OrientedImageryLayer:!0,PointCloudLayer:!0,RasterDataLayer:!0,VectorTileLayer:!0,ViewshedLayer:!0,Voxel:!0,WCS:!0,WFS:!0,WMS:!0,WebTiledLayer:!0},"web-scene/basemap-base-layers":{ArcGISImageServiceLayer:!0,ArcGISMapServiceLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,OpenStreetMap:!0,VectorTileLayer:!0,WCS:!0,WMS:!0,WebTiledLayer:!0},"web-scene/basemap-ground-layers":{IntegratedMesh3DTilesLayer:!0},"web-scene/ground":{ArcGISTiledElevationServiceLayer:!0,RasterDataElevationLayer:!0},"web-scene/tables":{ArcGISFeatureLayer:!0},"web-map/operational-layers":e,"web-map/basemap-base-layers":r,"web-map/tables":a,"link-chart/operational-layers":{...e,LinkChartLayer:!0},"link-chart/basemap-base-layers":r,"link-chart/tables":a,"portal-item/operational-layers":{ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISMapServiceLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISStreamLayer:!0,ArcGISTiledImageServiceLayer:!0,BuildingSceneLayer:!0,IntegratedMesh3DTilesLayer:!0,IntegratedMeshLayer:!0,MediaLayer:!0,OrientedImageryLayer:!0,PointCloudLayer:!0,SubtypeGroupLayer:!0,WCS:!0},"portal-item/tables":{ArcGISFeatureLayer:!0,SubtypeGroupTable:!0}};export{S as supportedTypes};
|
|
5
|
+
const e={ArcGISAnnotationLayer:!0,ArcGISDimensionLayer:!0,ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISImageServiceVectorLayer:!0,ArcGISMapServiceLayer:!0,ArcGISStreamLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,ArcGISVideoLayer:!0,BingMapsAerial:!0,BingMapsHybrid:!0,BingMapsRoad:!0,CatalogLayer:!0,CSV:!0,GeoJSON:!0,GeoRSS:!0,GroupLayer:!0,KML:!0,KnowledgeGraphLayer:!0,MediaLayer:!0,OGCFeatureLayer:!0,OrientedImageryLayer:!0,ParquetLayer:!0,SubtypeGroupLayer:!0,VectorTileLayer:!0,WCS:!0,WFS:!0,WMS:!0,WebTiledLayer:!0},r={ArcGISImageServiceLayer:!0,ArcGISImageServiceVectorLayer:!0,ArcGISMapServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,BingMapsAerial:!0,BingMapsHybrid:!0,BingMapsRoad:!0,OpenStreetMap:!0,VectorTileLayer:!0,WCS:!0,WMS:!0,WebTiledLayer:!0},a={ArcGISFeatureLayer:!0,SubtypeGroupTable:!0},S={"web-scene/operational-layers":{ArcGISDimensionLayer:!0,ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISMapServiceLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISTiledElevationServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,BuildingSceneLayer:!0,CatalogLayer:!0,CSV:!0,GaussianSplatLayer:!0,GeoJSON:!0,GroupLayer:!0,IntegratedMesh3DTilesLayer:!0,Object3DTilesLayer:!0,IntegratedMeshLayer:!0,KML:!0,LineOfSightLayer:!0,MediaLayer:!0,OGCFeatureLayer:!0,OrientedImageryLayer:!0,PointCloudLayer:!0,RasterDataLayer:!0,VectorTileLayer:!0,ViewshedLayer:!0,Voxel:!0,WCS:!0,WFS:!0,WMS:!0,WebTiledLayer:!0},"web-scene/basemap-base-layers":{ArcGISImageServiceLayer:!0,ArcGISMapServiceLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,OpenStreetMap:!0,VectorTileLayer:!0,WCS:!0,WMS:!0,WebTiledLayer:!0},"web-scene/basemap-ground-layers":{IntegratedMesh3DTilesLayer:!0},"web-scene/ground":{ArcGISTiledElevationServiceLayer:!0,RasterDataElevationLayer:!0},"web-scene/tables":{ArcGISFeatureLayer:!0},"web-map/operational-layers":e,"web-map/basemap-base-layers":r,"web-map/tables":a,"link-chart/operational-layers":{...e,LinkChartLayer:!0},"link-chart/basemap-base-layers":r,"link-chart/tables":a,"portal-item/operational-layers":{ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISMapServiceLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISStreamLayer:!0,ArcGISTiledImageServiceLayer:!0,BuildingSceneLayer:!0,IntegratedMesh3DTilesLayer:!0,IntegratedMeshLayer:!0,MediaLayer:!0,OrientedImageryLayer:!0,PointCloudLayer:!0,SubtypeGroupLayer:!0,WCS:!0},"portal-item/tables":{ArcGISFeatureLayer:!0,SubtypeGroupTable:!0}};export{S as supportedTypes};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{referenceSetter as s}from"../../core/collectionUtils.js";import{EventedAccessor as n}from"../../core/Evented.js";import{LoadableMixin as r}from"../../core/Loadable.js";import o from"../../core/Logger.js";import{EsriPromiseMixin as i}from"../../core/Promise.js";import{throwIfAborted as l}from"../../core/promiseUtils.js";import{watch as a}from"../../core/reactiveUtils.js";import{property as m,subclass as d}from"../../core/accessorSupport/decorators.js";import c from"../../geometry/Extent.js";import{initializeProjection as p,project as h}from"../../geometry/projectionUtils.js";import f from"../../geometry/SpatialReference.js";import{fromExtent as u}from"../../geometry/support/aaBoundingRect.js";import{extentIntersectsPolygon as g}from"../../geometry/support/intersectsBase.js";import{equals as _}from"../../geometry/support/spatialReferenceUtils.js";import{BoundsStore as x}from"../graphics/data/BoundsStore.js";import y from"./ImageElement.js";import j from"./MediaElementBase.js";import{MediaElementView as R}from"./MediaElementView.js";import E from"./VideoElement.js";const w={key:"type",defaultKeyValue:"image",base:j,typeMap:{image:y,video:E}},M=t.ofType(w);let I=class extends(r(i(n))){constructor(e){super(e),this._index=new x,this._elementViewsMap=new Map,this._elementsIndexes=new Map,this._elementsChangedHandler=e=>{for(const s of e.removed){const e=this._elementViewsMap.get(s);this._elementViewsMap.delete(s),this._index.delete(e),this.removeHandles(e),e.destroy(),this.notifyChange("fullExtent")}const{spatialReference:t}=this;for(const s of e.added){if(this._elementViewsMap.get(s))continue;const e=new R({spatialReference:t,element:s});this._elementViewsMap.set(s,e);const n=a(()=>e.coords,()=>this._updateIndexForElement(e,!1));this._updateIndexForElement(e,!0),this.addHandles(n,e)}this._elementsIndexes.clear(),this.elements.forEach((e,t)=>this._elementsIndexes.set(e,t)),this.emit("refresh")},this.elements=new M}async load(e){if(l(e),!this.spatialReference){const e=this.elements.find(e=>null!=e.georeference?.coords);this._set("spatialReference",e?e.georeference.coords.spatialReference:f.WGS84)}return this._elementsChangedHandler({added:this.elements.items,removed:[]}),this.addHandles(this.elements.on("change",this._elementsChangedHandler)),this}destroy(){this._index.clear(),this._elementViewsMap.clear(),this._elementsIndexes.clear()}set elements(e){this._set("elements",s(e,this._get("elements"),M))}get fullExtent(){if("not-loaded"===this.loadStatus)return null;const e=this._index.fullBounds;return null==e?null:new c({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:this.spatialReference})}set spatialReference(e){"not-loaded"===this.loadStatus?this._set("spatialReference",e):o.getLogger(this).error("#spatialReference","spatialReference cannot be changed after the source is loaded.")}async queryElements(e,t){await this.load(),await p(e.spatialReference,this.spatialReference,null,t);const s=_(e.spatialReference,this.spatialReference)?e:h(e,this.spatialReference);if(!s)return[];const n=s.normalize(),r=[];for(const o of n)this._index.forEachInBounds(u(o),({normalizedCoords:e,element:t})=>{null!=e&&g(o,e)&&r.push(t)});return r.sort((e,t)=>this._elementsIndexes.get(e)-this._elementsIndexes.get(t)),r}hasElement(e){return this.elements.includes(e)}_updateIndexForElement(e,t){const s=e.normalizedBounds,n=this._index.has(e),r=null!=s;this._index.delete(e),r&&this._index.set(e,s),this.notifyChange("fullExtent"),t||(n!==r?this.emit("refresh"):this.emit("change",{element:e.element}))}};e([m()],I.prototype,"elements",null),e([m({readOnly:!0})],I.prototype,"fullExtent",null),e([m()],I.prototype,"spatialReference",null),I=e([d("esri.layers.support.LocalMediaElementSource")],I);export{I as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{referenceSetter as s}from"../../core/collectionUtils.js";import{EventedAccessor as n}from"../../core/Evented.js";import{LoadableMixin as r}from"../../core/Loadable.js";import o from"../../core/Logger.js";import{EsriPromiseMixin as i}from"../../core/Promise.js";import{throwIfAborted as l}from"../../core/promiseUtils.js";import{watch as a}from"../../core/reactiveUtils.js";import{property as m,subclass as d}from"../../core/accessorSupport/decorators.js";import c from"../../geometry/Extent.js";import{initializeProjection as p,project as h}from"../../geometry/projectionUtils.js";import f from"../../geometry/SpatialReference.js";import{fromExtent as u}from"../../geometry/support/aaBoundingRect.js";import{extentIntersectsPolygon as g}from"../../geometry/support/intersectsBase.js";import{equals as _}from"../../geometry/support/spatialReferenceUtils.js";import{BoundsStore as x}from"../graphics/data/BoundsStore.js";import y from"./ImageElement.js";import j from"./MediaElementBase.js";import{MediaElementView as R}from"./MediaElementView.js";import E from"./VideoElement.js";const w={key:"type",defaultKeyValue:"image",base:j,typeMap:{image:y,video:E}},M=t.ofType(w);let I=class extends(r(i(n))){constructor(e){super(e),this._index=new x,this._elementViewsMap=new Map,this._elementsIndexes=new Map,this._elementsChangedHandler=e=>{for(const s of e.removed){const e=this._elementViewsMap.get(s);this._elementViewsMap.delete(s),this._index.delete(e),this.removeHandles(e),e.destroy(),this.notifyChange("fullExtent")}const{spatialReference:t}=this;for(const s of e.added){if(this._elementViewsMap.get(s))continue;const e=new R({spatialReference:t,element:s});this._elementViewsMap.set(s,e);const n=a(()=>e.coords,()=>this._updateIndexForElement(e,!1));this._updateIndexForElement(e,!0),this.addHandles(n,e)}this._elementsIndexes.clear(),this.elements.forEach((e,t)=>this._elementsIndexes.set(e,t)),this.emit("refresh")},this.elements=new M}async load(e){if(l(e),!this.spatialReference){const e=this.elements.find(e=>null!=e.georeference?.coords);this._set("spatialReference",e?e.georeference.coords.spatialReference:f.WGS84)}return this._elementsChangedHandler({added:this.elements.items,removed:[]}),this.addHandles(this.elements.on("change",this._elementsChangedHandler)),this}destroy(){this._index.clear(),this._elementViewsMap.clear(),this._elementsIndexes.clear()}get elements(){return this._get("elements")}set elements(e){this._set("elements",s(e,this._get("elements"),M))}get fullExtent(){if("not-loaded"===this.loadStatus)return null;const e=this._index.fullBounds;return null==e?null:new c({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:this.spatialReference})}set spatialReference(e){"not-loaded"===this.loadStatus?this._set("spatialReference",e):o.getLogger(this).error("#spatialReference","spatialReference cannot be changed after the source is loaded.")}async queryElements(e,t){await this.load(),await p(e.spatialReference,this.spatialReference,null,t);const s=_(e.spatialReference,this.spatialReference)?e:h(e,this.spatialReference);if(!s)return[];const n=s.normalize(),r=[];for(const o of n)this._index.forEachInBounds(u(o),({normalizedCoords:e,element:t})=>{null!=e&&g(o,e)&&r.push(t)});return r.sort((e,t)=>this._elementsIndexes.get(e)-this._elementsIndexes.get(t)),r}hasElement(e){return this.elements.includes(e)}_updateIndexForElement(e,t){const s=e.normalizedBounds,n=this._index.has(e),r=null!=s;this._index.delete(e),r&&this._index.set(e,s),this.notifyChange("fullExtent"),t||(n!==r?this.emit("refresh"):this.emit("change",{element:e.element}))}};e([m()],I.prototype,"elements",null),e([m({readOnly:!0})],I.prototype,"fullExtent",null),e([m()],I.prototype,"spatialReference",null),I=e([d("esri.layers.support.LocalMediaElementSource")],I);export{I as default};
|