@arcgis/core 4.26.2 → 4.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/1693ccb22ddb0e075cb7.js +1 -0
- package/assets/esri/core/workers/chunks/18feb69bb066f529f4a5.js +1 -0
- package/assets/esri/core/workers/chunks/413046749019790fd00f.js +1 -0
- package/assets/esri/core/workers/chunks/{1fcc385a9a8904354a67.js → 61cdba0e7382d176510b.js} +1 -1
- package/assets/esri/core/workers/chunks/{3cc8526d3c0bb08be773.js → 8440b51d07263ad5bd50.js} +1 -1
- package/assets/esri/core/workers/chunks/{8111fc49f8e8f260981d.js → c24df96ab71c44dac45c.js} +1 -1
- package/assets/esri/core/workers/chunks/cb80cf1c614ae3b2f5d6.js +1 -0
- package/assets/esri/core/workers/chunks/d363d6dda0043430bc69.js +1 -0
- package/chunks/ComponentShader.glsl.js +16 -12
- package/chunks/Terrain.glsl.js +39 -42
- package/config.js +1 -1
- package/layers/graphics/editingSupport.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/rasterFunctions/ConvolutionFunction.js +1 -1
- package/package.json +1 -1
- package/rest/imageService.js +1 -1
- package/support/revision.js +1 -1
- package/views/3d/environment/CloudsCompositionTechnique.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +17 -5
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Terrain.glsl.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/CreateWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/assets/esri/core/workers/chunks/186f2d0c94fa1eca4959.js +0 -1
- package/assets/esri/core/workers/chunks/4cb41045be4ee7ac0455.js +0 -1
- package/assets/esri/core/workers/chunks/843a8b87ebecc246598a.js +0 -1
- package/assets/esri/core/workers/chunks/9dd3522e39e522158049.js +0 -1
- package/assets/esri/core/workers/chunks/cb177fb86cf8cec95e87.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{rasterRendererTypes as i,websceneRasterRendererTypes as r,read as s}from"../../rasterRenderers.js";import n from"../../request.js";import o from"../../core/Error.js";import{strict as a}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{watch as d}from"../../core/reactiveUtils.js";import{urlToObject as h}from"../../core/urlUtils.js";import{property as f,ensureRange as g}from"../../core/accessorSupport/decorators/property.js";import{Integer as y,ensureClass as R,ensureNumber as b}from"../../core/accessorSupport/ensureType.js";import{reader as S}from"../../core/accessorSupport/decorators/reader.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{writer as x}from"../../core/accessorSupport/decorators/writer.js";import{opacity as I,url as w}from"../support/commonProperties.js";import _ from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as F}from"../support/ExportImageServiceParameters.js";import D from"../support/Field.js";import j from"../support/FieldsIndex.js";import{createBitmap as P}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as T}from"../support/imageryRendererUtils.js";import O from"../support/MosaicRule.js";import N from"../support/MultidimensionalSubset.js";import C from"../support/PixelBlock.js";import{interpolationKebab as M,noDataInterpretationKebab as A}from"../support/rasterEnums.js";import J from"../support/RasterFunction.js";import q from"../support/RasterInfo.js";import E from"../support/RasterJobHandler.js";import{intersectMultimensionalSubset as V,getSubsetVariablesFromMdInfo as H,getDefaultMultidimensionalDefinition as Q}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as U,getFormat as L}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as z}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as B,getDefaultBandCombination as k,createDefaultRenderer as G,normalizeRendererJSON as W}from"../../renderers/support/rasterRendererHelper.js";import $ from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as K,computePixelSpaceLocations as X,computeHistograms as Y,computeStatisticsHistograms as Z,measureHeight as ee,measureAreaAndPerimeter as te,measureDistanceAndAngle as ie,measurePointOrCentroid as re,getImageSpatialReferenceQueryParameter as se,getSamples as ne,identify as oe}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as ae}from"../../rest/query/executeQueryJSON.js";import"../../config.js";import"../../kernel.js";import"../../core/unitUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import le from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import ue from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import pe from"../../rest/support/FeatureSet.js";import ce from"../../rest/support/Query.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as me}from"../../rest/query/executeForCount.js";import{executeForIds as de}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{fetchServiceRasterInfo as he,generateRasterInfo as fe}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as ge}from"../../rest/imageService/getCatalogItemRasterInfo.js";import ye from"../../rest/support/ImageAngleParameters.js";import Re from"../../rest/support/ImageAreaParameters.js";import be from"../../rest/support/ImageDistanceParameters.js";import Se from"../../rest/support/ImageHeightParameters.js";import ve from"../../rest/support/ImageHistogramParameters.js";import xe from"../../rest/support/ImageIdentifyParameters.js";import Ie from"../../rest/support/ImagePixelLocationParameters.js";import we from"../../rest/support/ImagePointParameters.js";import _e from"../../rest/support/ImageSampleParameters.js";import{createFlowMesh as Fe}from"../../views/2d/engine/flow/dataUtils.js";import De from"../../geometry/SpatialReference.js";const je=a()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),Pe=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Te=g(b,{min:0,max:255});function Oe(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi)?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return t?t.join("/"):null}const Ne=a=>{let g=class extends a{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",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 F({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,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?O.fromJSON(t):null}get fieldsIndex(){return this.fields?new j(this.fields):null}set format(e){e&&Pe.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=O.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?O.fromJSON(i):this._isMosaicRuleSupported(t)?O.fromJSON(t):null}writeMosaicRule(e,t,i){let r=this.mosaicRule;const s=this.definitionExpression;r?s&&s!==r.where&&(r=r.clone(),r.where=s):s&&(r=new O({where:s})),this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=Te(e))}readObjectIdField(e,t){if(!e){const i=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=i&&i[0]&&i[0].name}return e}get parsedUrl(){return h(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer,n=s(r,i);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!r.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),T(n)||u.getLogger(this.declaredClass).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}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._rasterAttributeTableFieldPrefix||"Raster.",t=new D({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new D({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new D({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(i),this.capabilities?.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(r),p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new D({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new D({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new D({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo??{};if(p(n)){const t=n.fields.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const i=l(t);return i.name=e+t.name,i}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=J.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i&&i.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?J.fromJSON({rasterFunctionDefinition:t.renderingRule}):J.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,i){const r=e.toJSON();r.rasterFunctionDefinition?t[i]=r.rasterFunctionDefinition:t[i]=r}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?De.fromJSON(i):null}readPixelType(e){return je.fromJSON(e)||e}writePixelType(e,t,i){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[i]=je.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;const{renderer:r,symbolizer:s,pixelFilter:n,bandIds:o}=this;if(!this._isPicture()&&r&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(r.toJSON()),a=this._rasterJobHandler.instance;if(a){n&&(s.bind(),await a.updateSymbolizer(s,t),this._cachedRendererJson=r.toJSON());const l=await a.symbolize({bandIds:o,...e},t);i={extent:e.extent,pixelBlock:l}}else i={extent:e.extent,pixelBlock:s.symbolize({bandIds:o,...e})}}return i}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new o("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=R(ye,e).clone(),K(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new o("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=R(Ie,e).clone(),X(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new o("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=R(ve,e).clone(),this._applyMosaicAndRenderingRules(e),Y(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new o("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=R(ve,e).clone(),this._applyMosaicAndRenderingRules(e),Z(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 o("imagery-layer:measure-height","this operation is not supported on the input image service");return e=R(Se,e).clone(),this._applyMosaicAndRenderingRules(e),ee(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 o("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=R(Re,e).clone(),this._applyMosaicAndRenderingRules(e),te(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 o("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=R(be,e).clone(),this._applyMosaicAndRenderingRules(e),ie(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 o("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=R(we,e).clone(),this._applyMosaicAndRenderingRules(e),re(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}async fetchImage(e,t,i,r={}){if(null==e||null==t||null==i)throw new o("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const e=await this.generateRasterInfo(this.renderingRule,{signal:r.signal});e&&(this.rasterInfo=e)}const s=this.getExportImageServiceParameters(e,t,i,r.timeExtent);if(null==s){if(r.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=i,r.returnImageBitmap){return{imageBitmap:await P(e,`${b(this.parsedUrl)}/exportImage`)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,o=(s?.length||n.bandCount)??0,a=t*i,l=n.pixelType,u=[];for(let e=0;e<o;e++)u.push(C.createEmptyBand(l,a));return{pixelData:{pixelBlock:new C({width:t,height:i,pixels:u,mask:new Uint8Array(a),pixelType:l}),extent:e}}}const n=!!r.requestAsImageElement&&!this.pixelFilter,a=n&&!!r.returnImageBitmap,l={imageServiceParameters:s,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:n,returnImageBitmap:a,signal:r.signal};return this._requestArrayBuffer(l)}fetchKeyProperties(e){return n(b(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new o("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(b(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>pe.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return ge(b(this.parsedUrl),e,i)}async getCatalogItemICSInfo(e,t){const{data:i}=await n(b(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),r=i&&i.ics;if(!r)return;let s=null;try{s=(await n(b(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:r,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(b(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},u=n(b(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},g=n(b(this.parsedUrl)+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),y=await Promise.all([o,u,g]);let R=y[0].ipxf;if(null==R){const e=r.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const S=le.fromJSON(y[1]&&y[1].geometries&&y[1].geometries[0]);S&&(S.spatialReference=new De({wkid:0,imageCoordinateSystem:r}));const v=y[2].geometries?y[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],x=v.length;if(x<3)return{ics:r,icsToPixelTransform:R,icsExtent:S,northDirection:null};let I=0,w=0,_=0,F=0;for(let n=0;n<x;n++)I+=v[n].x,w+=v[n].y,_+=v[n].x*v[n].x,F+=v[n].x*v[n].y;const D=(x*F-I*w)/(x*_-I*I);let j=0;const P=v[p-1].x>v[0].x,T=v[p-1].y>v[0].y;return D===1/0?j=T?90:270:0===D?j=P?0:180:D>0?j=P?180*Math.atan(D)/Math.PI:180*Math.atan(D)/Math.PI+180:D<0&&(j=T?180+180*Math.atan(D)/Math.PI:360+180*Math.atan(D)/Math.PI),{ics:r,icsToPixelTransform:R,icsExtent:S,northDirection:j}}async generateRasterInfo(e,t){if(e=R(J,e),this.serviceRasterInfo&&(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const i=Oe(e);if(!i)return null;if(this._functionRasterInfos[i])return this._functionRasterInfos[i];const r=this._generateRasterInfo(e,t);this._functionRasterInfos[i]=r;try{return await r}catch{return this._functionRasterInfos[i]=null,null}}getExportImageServiceParameters(e,t,i,r){e=e.clone().shiftCentralMeridian();const s=se(e.spatialReference,b(this.parsedUrl));this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.renderingRule?.rasterFunctionDefinition,c=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRenderingRule(this.renderingRule)&&!u&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const m=this._processMultidimensionalIntersection(null,r,this.exportImageServiceParameters.mosaicRule);if(m.isOutSide)return null;n.mosaicRule=p(m.mosaicRule)?JSON.stringify(m.mosaicRule):null,r=m.timeExtent,n.renderingRule=this._getRenderingRuleString(J.fromJSON(l));const d={};if(p(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:s,imageSR:s,size:t+","+i,...n,...d}}async getSamples(e,t){if(!(await this._fetchCapabilities(t?.signal))?.operations.supportsGetSamples)throw new o("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=R(_e,e).clone();const{raster:i}=this;return i&&null==e.raster&&(e.raster=i),ne(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new o("imagery-layer:identify","identify operation is not supported on the input image service");e=R(xe,e).clone();const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new o("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=m(i.timeExtent),e.mosaicRule=m(i.mosaicRule);const{raster:r,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),r&&null==e.raster&&(e.raster=r),oe(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new ce;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ae(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),de(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),me(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new o("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:r,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let a=!1,l=null,u=null;const d="raster.servicepixelvalue",h=this._rasterFunctionNamesIndex;if(p(e.outFields)&&(a=e.outFields.some((e=>!e.toLowerCase().includes(d))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(d)&&e.length>d.length)).map((e=>{const t=e.slice(d.length+1);return[this._updateRenderingRulesFunctionName(t,h),t]}));l=t.map((e=>new J({functionName:e[0]}))),u=t.map((e=>e[1]));const{renderingRule: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 f=c(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:g}=this;let y=e.timeExtent||this.timeExtent;if(g){const{isOutside:t,intersection:i}=V(g,{geometry:m(e.geometry),timeExtent:m(e.timeExtent),multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new o("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");i&&p(i.timeExtent)&&(y=i.timeExtent)}const R=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,y),b=this._getQueryParams({geometry:e.geometry,timeExtent:y,mosaicRule:R,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:i,returnCatalogItems:a,returnGeometry:f,raster:this.raster,maxItemCount:s?1:null});delete b.f;const S=new xe(b);try{await this.generateRasterInfo(this.renderingRule);const i=await oe(this.url,S,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,o=null!=i.value&&i.value.toLowerCase().includes("nodata");if(!(a&&!f&&i?.catalogItems?.features.length&&(n||!o)))return this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=i.catalogItems?.features??[],m=c.map((e=>e.attributes?.[l])),d=new ce({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),h=await this.queryRasters(d);return h?.features?.length&&h.features.forEach((t=>{c.forEach((i=>{i.attributes[l]===t.attributes[l]&&(i.geometry=new ue(t.geometry),p(e.outSpatialReference)&&(i.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new o("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const i=n(b(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),r=n(b(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([i,r]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):Fe(e.meshType,e.simulationSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return H(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,i=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):he(b(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),e))),r=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{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.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),u.getLogger(this.declaredClass).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles([d((()=>this.renderingRule),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}))]);const{serviceRasterInfo:t}=this;p(t.multidimensionalInfo)&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(c(e)||c(r)||c(t)||c(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 o=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),a=p(t.start)?t.start.getTime():null,l=p(t.end)?t.end.getTime():null,u=null==a||null==l||a===l,m=u?[a||l]:[[a,l]],d=this.version>=10.8;if(o.length)o.forEach((e=>{e.dimensionName===n&&(d?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=m))}));else if(!d){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=m})):e.multidimensionalDefinition.push(new _({variableName:"",dimensionName:n,isSlice:u,values:m}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?R(ce,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new E;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>{})),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:i}=this;return"unique-value"===e.type&&this._hasRenderingRule(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&B(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:i,ssl:r}=await n(b(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=i,this.sourceJSON=t,r&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new o("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(c(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()){if(!this.bandIds&&i.bandCount>=3){const e=k(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=G(i,{bandIds:this.bandIds,variableName:this.renderingRule?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=W(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=i):this.symbolizer=new $({rendererJSON:t,rasterInfo:i}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:p(e.pixelBlock)?e.pixelBlock.clone():null}}_getQueryParams(e){e&&p(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.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):U(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;return(await n(b(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:i,returnImageBitmap:r,signal:s}=e;if(i&&this._canRequestImageElement(t.format)){const i=`${b(this.parsedUrl)}/exportImage`,{data:o}=await n(i,{responseType:r?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:s});if(o instanceof Blob){return{imageBitmap:await P(o,i),params:t}}return{imageOrCanvasElement:o,params:t}}const a=this._initJobHandler(),l=n(b(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,a]))[0].data,p=t.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=L(u)),!c)throw new o("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const m={signal:s},d="gif"===p||"bmp"===p||p.includes("png")&&("png"===c||"jpg"===c)?U(u,{useCanvas:!0,...t},m):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:t.extent},params:t}}_generateRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return fe(b(this.parsedUrl),e,i)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=Q(e,{multidimensionalSubset:this.multidimensionalSubset});if(p(t)&&t.length>0){this.mosaicRule=this.mosaicRule||new O;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.renderingRule&&"none"!==this.renderingRule.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:o,templateFields:a}=i,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof r&&r.toLowerCase().includes("nodata"),h=[];if(r&&!u&&!d){const e={};e[m]=0;c=[r],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let f,g,y;this._updateResponseFieldNames(u,a),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=r){if(g=c[t],y=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.includes(this.renderingRule.functionName)?l[s.indexOf(this.renderingRule.functionName)]:r,"nodata"===g.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",i="Raster.ServicePixelValue";f.attributes[e]=g,f.attributes[i]=y,this._updateFeatureWithMagDirValues(f,g);const o=this.fields&&this.fields.length>0;let a=this.renderingRule&&p(this.serviceRasterInfo.attributeTable)?o?g:r:y;this.renderingRule||(a=o?g:r),this._updateFeatureWithRasterAttributeTableValues(f,a)}if(f.sourceLayer=f.layer=this,o&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=l[e]}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}=V(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};s&&p(s.timeExtent)&&(t=s.timeExtent)}if(i=this._combineMosaicRuleWithTimeExtent(i,t),p(i)&&i.multidimensionalDefinition){const{isOutside:e}=V(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(c(i))return;const{features:r,fields:s}=i,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),o=n&&n[0];if(!o)return;const a=r.filter((e=>e.attributes[o]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const i=this._rasterAttributeTableFieldPrefix+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 C({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new le(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:z([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"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;c(i)||e.forEach((e=>{if(e&&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(this._hasRenderingRule(e)){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRenderingRule(e){return null!=e&&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().replace(/ /gi,"_");return t.has(i)?t.get(i):e}_isRFTJson(e){return e&&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,renderingRule:r}=this;r&&null==e.renderingRule&&(e.renderingRule=r),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,advancedQueryCapabilities:r,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit"),u=t.includes("mensuration")&&a,p=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map((e=>e.trim())),c=u&&p.includes("basic");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:u,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:i>=10.2&&n,supportsProject:i>=10.3&&n,supportsComputeStatisticsHistograms:i>=10.4&&n,supportsQueryBoundary:i>=10.6&&n,supportsCalculateVolume:i>=10.7&&o,supportsComputePixelLocation:i>=10.7&&t.includes("catalog"),supportsComputeAngles:i>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!r?.supportsStatistics,supportsOrderBy:!!r?.supportsOrderBy,supportsDistinct:!!r?.supportsDistinct,supportsPagination:!!r?.supportsPagination,supportsStandardizedQueriesOnly:!!r?.useStandardizedQueries,supportsPercentileStatistics:!!r?.supportsPercentileStatistics,supportsCentroid:!!r?.supportsReturningGeometryCentroid,supportsDistance:!!r?.supportsQueryWithDistance,supportsExtent:!!r?.supportsReturningQueryExtent,supportsGeometryProperties:!!r?.supportsReturningGeometryProperties,supportsHavingClause:!!r?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!r?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:c,supportsAreaAndPerimeter:c,supportsPointOrCentroid:c,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function b(e){return e?.path??""}return e([f()],g.prototype,"_functionRasterInfos",void 0),e([f()],g.prototype,"_rasterJobHandler",void 0),e([f()],g.prototype,"_cachedRendererJson",void 0),e([f({readOnly:!0})],g.prototype,"_serviceSupportsMosaicRule",void 0),e([S("_serviceSupportsMosaicRule",["currentVersion","fields"])],g.prototype,"readServiceSupportsMosaicRule",null),e([f()],g.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([f({readOnly:!0})],g.prototype,"_rasterFunctionNamesIndex",null),e([f()],g.prototype,"adjustAspectRatio",void 0),e([f({type:[y],json:{write:!0}})],g.prototype,"bandIds",void 0),e([S("bandIds")],g.prototype,"readBandIds",null),e([f({readOnly:!0,json:{read:!1}})],g.prototype,"capabilities",void 0),e([S("service","capabilities",["capabilities","currentVersion","serviceDataType"])],g.prototype,"readCapabilities",null),e([f({type:Number})],g.prototype,"compressionQuality",void 0),e([x("compressionQuality")],g.prototype,"writeCompressionQuality",null),e([f({type:Number})],g.prototype,"compressionTolerance",void 0),e([x("compressionTolerance")],g.prototype,"writeCompressionTolerance",null),e([f({json:{read:{source:"copyrightText"}}})],g.prototype,"copyright",void 0),e([f({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],g.prototype,"defaultMosaicRule",void 0),e([S("defaultMosaicRule",["defaultMosaicMethod"])],g.prototype,"readDefaultMosaicRule",null),e([f({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],g.prototype,"definitionExpression",void 0),e([f({readOnly:!0,constructOnly:!0})],g.prototype,"exportImageServiceParameters",void 0),e([f()],g.prototype,"rasterInfo",void 0),e([f({readOnly:!0,type:[D]})],g.prototype,"fields",void 0),e([f({readOnly:!0})],g.prototype,"fieldsIndex",null),e([f({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],g.prototype,"format",null),e([S("service","format",["serviceDataType"])],g.prototype,"readFormat",null),e([f({type:le})],g.prototype,"fullExtent",void 0),e([f({readOnly:!0})],g.prototype,"hasMultidimensions",void 0),e([f({json:{read:{source:"maxImageHeight"}}})],g.prototype,"imageMaxHeight",void 0),e([f({json:{read:{source:"maxImageWidth"}}})],g.prototype,"imageMaxWidth",void 0),e([f({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],g.prototype,"interpolation",void 0),e([f()],g.prototype,"minScale",void 0),e([S("service","minScale")],g.prototype,"readMinScale",null),e([f()],g.prototype,"maxScale",void 0),e([S("service","maxScale")],g.prototype,"readMaxScale",null),e([f({type:O})],g.prototype,"mosaicRule",null),e([S("mosaicRule",["mosaicRule","defaultMosaicMethod"])],g.prototype,"readMosaicRule",null),e([x("mosaicRule")],g.prototype,"writeMosaicRule",null),e([f()],g.prototype,"multidimensionalInfo",void 0),e([f({type:N,json:{write:!0}})],g.prototype,"multidimensionalSubset",void 0),e([f({json:{type:y}})],g.prototype,"noData",void 0),e([x("noData")],g.prototype,"writeNoData",null),e([f({type:String,json:{type:A.jsonValues,read:A.read,write:A.write}})],g.prototype,"noDataInterpretation",void 0),e([f({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],g.prototype,"objectIdField",void 0),e([S("objectIdField")],g.prototype,"readObjectIdField",null),e([f({})],g.prototype,"geometryType",void 0),e([f({})],g.prototype,"typeIdField",void 0),e([f({})],g.prototype,"types",void 0),e([f({readOnly:!0})],g.prototype,"parsedUrl",null),e([f({type:Function})],g.prototype,"pixelFilter",void 0),e([f()],g.prototype,"raster",void 0),e([f({readOnly:!0})],g.prototype,"sourceType",void 0),e([S("sourceType",["serviceSourceType","fields"])],g.prototype,"readSourceType",null),e([f()],g.prototype,"viewId",void 0),e([f({types:i,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:r,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],g.prototype,"renderer",null),e([S("renderer")],g.prototype,"readRenderer",null),e([x("renderer")],g.prototype,"writeRenderer",null),e([f()],g.prototype,"symbolizer",void 0),e([f(I)],g.prototype,"opacity",void 0),e([f({readOnly:!0})],g.prototype,"rasterFields",null),e([f({constructOnly:!0})],g.prototype,"rasterFunctionInfos",void 0),e([f({type:J})],g.prototype,"renderingRule",null),e([S("renderingRule",["renderingRule","rasterFunctionInfos"])],g.prototype,"readRenderingRule",null),e([x("renderingRule")],g.prototype,"writeRenderingRule",null),e([f()],g.prototype,"serviceDataType",void 0),e([f({readOnly:!0,type:De})],g.prototype,"spatialReference",void 0),e([S("spatialReference",["spatialReference","extent"])],g.prototype,"readSpatialReference",null),e([f({json:{type:je.jsonValues}})],g.prototype,"pixelType",void 0),e([S("pixelType")],g.prototype,"readPixelType",null),e([x("pixelType")],g.prototype,"writePixelType",null),e([f({constructOnly:!0,type:q})],g.prototype,"serviceRasterInfo",void 0),e([f()],g.prototype,"sourceJSON",void 0),e([f(w)],g.prototype,"url",void 0),e([f({readOnly:!0})],g.prototype,"version",void 0),e([S("version",["currentVersion","fields","timeInfo"])],g.prototype,"readVersion",null),g=e([v("esri.layers.mixins.ArcGISImageService")],g),g};export{Ne as ArcGISImageService};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{rasterRendererTypes as i,websceneRasterRendererTypes as r,read as s}from"../../rasterRenderers.js";import n from"../../request.js";import o from"../../core/Error.js";import{strict as a}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{watch as d}from"../../core/reactiveUtils.js";import{urlToObject as h}from"../../core/urlUtils.js";import{property as f,ensureRange as g}from"../../core/accessorSupport/decorators/property.js";import{Integer as y,ensureClass as R,ensureNumber as b}from"../../core/accessorSupport/ensureType.js";import{reader as S}from"../../core/accessorSupport/decorators/reader.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{writer as x}from"../../core/accessorSupport/decorators/writer.js";import{opacity as I,url as w}from"../support/commonProperties.js";import _ from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as F}from"../support/ExportImageServiceParameters.js";import D from"../support/Field.js";import j from"../support/FieldsIndex.js";import{createBitmap as P}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as T}from"../support/imageryRendererUtils.js";import O from"../support/MosaicRule.js";import N from"../support/MultidimensionalSubset.js";import C from"../support/PixelBlock.js";import{interpolationKebab as M,noDataInterpretationKebab as A}from"../support/rasterEnums.js";import J from"../support/RasterFunction.js";import q from"../support/RasterInfo.js";import E from"../support/RasterJobHandler.js";import{intersectMultimensionalSubset as V,getSubsetVariablesFromMdInfo as H,getDefaultMultidimensionalDefinition as Q}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as U,getFormat as L}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as z}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as B,getDefaultBandCombination as k,createDefaultRenderer as G,normalizeRendererJSON as W}from"../../renderers/support/rasterRendererHelper.js";import $ from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as K,computePixelSpaceLocations as X,computeHistograms as Y,computeStatisticsHistograms as Z,measureHeight as ee,measureAreaAndPerimeter as te,measureDistanceAndAngle as ie,measurePointOrCentroid as re,getImageSpatialReferenceQueryParameter as se,getSamples as ne,identify as oe}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as ae}from"../../rest/query/executeQueryJSON.js";import"../../config.js";import"../../kernel.js";import"../../core/unitUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import le from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import ue from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import pe from"../../rest/support/FeatureSet.js";import ce from"../../rest/support/Query.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as me}from"../../rest/query/executeForCount.js";import{executeForIds as de}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{fetchServiceRasterInfo as he,generateRasterInfo as fe}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as ge}from"../../rest/imageService/getCatalogItemRasterInfo.js";import ye from"../../rest/support/ImageAngleParameters.js";import Re from"../../rest/support/ImageAreaParameters.js";import be from"../../rest/support/ImageDistanceParameters.js";import Se from"../../rest/support/ImageHeightParameters.js";import ve from"../../rest/support/ImageHistogramParameters.js";import xe from"../../rest/support/ImageIdentifyParameters.js";import Ie from"../../rest/support/ImagePixelLocationParameters.js";import we from"../../rest/support/ImagePointParameters.js";import _e from"../../rest/support/ImageSampleParameters.js";import{createFlowMesh as Fe}from"../../views/2d/engine/flow/dataUtils.js";import De from"../../geometry/SpatialReference.js";const je=a()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),Pe=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Te=g(b,{min:0,max:255});function Oe(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi)?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return t?t.join("/"):null}const Ne=a=>{let g=class extends a{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",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 F({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,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?O.fromJSON(t):null}get fieldsIndex(){return this.fields?new j(this.fields):null}set format(e){e&&Pe.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=O.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?O.fromJSON(i):this._isMosaicRuleSupported(t)?O.fromJSON(t):null}writeMosaicRule(e,t,i){let r=this.mosaicRule;const s=this.definitionExpression;r?s&&s!==r.where&&(r=r.clone(),r.where=s):s&&(r=new O({where:s})),this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=Te(e))}readObjectIdField(e,t){if(!e){const i=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=i&&i[0]&&i[0].name}return e}get parsedUrl(){return h(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer,n=s(r,i);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!r.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),T(n)||u.getLogger(this.declaredClass).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}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._rasterAttributeTableFieldPrefix||"Raster.",t=new D({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new D({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new D({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(i),this.capabilities?.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(r),p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new D({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new D({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new D({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo??{};if(p(n)){const t=n.fields.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const i=l(t);return i.name=e+t.name,i}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=J.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i&&i.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?J.fromJSON({rasterFunctionDefinition:t.renderingRule}):J.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,i){const r=e.toJSON();r.rasterFunctionDefinition?t[i]=r.rasterFunctionDefinition:t[i]=r}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?De.fromJSON(i):null}readPixelType(e){return je.fromJSON(e)||e}writePixelType(e,t,i){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[i]=je.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;const{renderer:r,symbolizer:s,pixelFilter:n,bandIds:o}=this;if(!this._isPicture()&&r&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(r.toJSON()),a=this._rasterJobHandler.instance;if(a){n&&(s.bind(),await a.updateSymbolizer(s,t),this._cachedRendererJson=r.toJSON());const l=await a.symbolize({bandIds:o,...e},t);i={extent:e.extent,pixelBlock:l}}else i={extent:e.extent,pixelBlock:s.symbolize({bandIds:o,...e})}}return i}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new o("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=R(ye,e).clone(),K(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new o("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=R(Ie,e).clone(),X(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new o("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=R(ve,e).clone(),this._applyMosaicAndRenderingRules(e),Y(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new o("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=R(ve,e).clone(),this._applyMosaicAndRenderingRules(e),Z(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 o("imagery-layer:measure-height","this operation is not supported on the input image service");return e=R(Se,e).clone(),this._applyMosaicAndRenderingRules(e),ee(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 o("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=R(Re,e).clone(),this._applyMosaicAndRenderingRules(e),te(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 o("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=R(be,e).clone(),this._applyMosaicAndRenderingRules(e),ie(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 o("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=R(we,e).clone(),this._applyMosaicAndRenderingRules(e),re(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}async fetchImage(e,t,i,r={}){if(null==e||null==t||null==i)throw new o("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const e=await this.generateRasterInfo(this.renderingRule,{signal:r.signal});e&&(this.rasterInfo=e)}const s=this.getExportImageServiceParameters(e,t,i,r.timeExtent);if(null==s){if(r.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=i,r.returnImageBitmap){return{imageBitmap:await P(e,`${b(this.parsedUrl)}/exportImage`)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,o=(s?.length||n.bandCount)??0,a=t*i,l=n.pixelType,u=[];for(let e=0;e<o;e++)u.push(C.createEmptyBand(l,a));return{pixelData:{pixelBlock:new C({width:t,height:i,pixels:u,mask:new Uint8Array(a),pixelType:l}),extent:e}}}const n=!!r.requestAsImageElement&&!this.pixelFilter,a=n&&!!r.returnImageBitmap,l={imageServiceParameters:s,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:n,returnImageBitmap:a,signal:r.signal};return this._requestArrayBuffer(l)}fetchKeyProperties(e){return n(b(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new o("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(b(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>pe.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return ge(b(this.parsedUrl),e,i)}async getCatalogItemICSInfo(e,t){const{data:i}=await n(b(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),r=i&&i.ics;if(!r)return;let s=null;try{s=(await n(b(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:r,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(b(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},u=n(b(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},g=n(b(this.parsedUrl)+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),y=await Promise.all([o,u,g]);let R=y[0].ipxf;if(null==R){const e=r.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const S=le.fromJSON(y[1]&&y[1].geometries&&y[1].geometries[0]);S&&(S.spatialReference=new De({wkid:0,imageCoordinateSystem:r}));const v=y[2].geometries?y[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],x=v.length;if(x<3)return{ics:r,icsToPixelTransform:R,icsExtent:S,northDirection:null};let I=0,w=0,_=0,F=0;for(let n=0;n<x;n++)I+=v[n].x,w+=v[n].y,_+=v[n].x*v[n].x,F+=v[n].x*v[n].y;const D=(x*F-I*w)/(x*_-I*I);let j=0;const P=v[p-1].x>v[0].x,T=v[p-1].y>v[0].y;return D===1/0?j=T?90:270:0===D?j=P?0:180:D>0?j=P?180*Math.atan(D)/Math.PI:180*Math.atan(D)/Math.PI+180:D<0&&(j=T?180+180*Math.atan(D)/Math.PI:360+180*Math.atan(D)/Math.PI),{ics:r,icsToPixelTransform:R,icsExtent:S,northDirection:j}}async generateRasterInfo(e,t){if(e=R(J,e),this.serviceRasterInfo&&(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const i=Oe(e);if(!i)return null;if(this._functionRasterInfos[i])return this._functionRasterInfos[i];const r=this._generateRasterInfo(e,t);this._functionRasterInfos[i]=r;try{return await r}catch{return this._functionRasterInfos[i]=null,null}}getExportImageServiceParameters(e,t,i,r){e=e.clone().shiftCentralMeridian();const s=se(e.spatialReference,b(this.parsedUrl));this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.renderingRule?.rasterFunctionDefinition,c=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRenderingRule(this.renderingRule)&&!u&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const m=this._processMultidimensionalIntersection(null,r,this.exportImageServiceParameters.mosaicRule);if(m.isOutSide)return null;n.mosaicRule=p(m.mosaicRule)?JSON.stringify(m.mosaicRule):null,r=m.timeExtent,n.renderingRule=this._getRenderingRuleString(J.fromJSON(l));const d={};if(p(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:s,imageSR:s,size:t+","+i,...n,...d}}async getSamples(e,t){if(!(await this._fetchCapabilities(t?.signal))?.operations.supportsGetSamples)throw new o("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=R(_e,e).clone();const{raster:i}=this;return i&&null==e.raster&&(e.raster=i),ne(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new o("imagery-layer:identify","identify operation is not supported on the input image service");e=R(xe,e).clone();const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new o("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=m(i.timeExtent),e.mosaicRule=m(i.mosaicRule);const{raster:r,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),r&&null==e.raster&&(e.raster=r),oe(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new ce;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ae(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),de(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),me(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new o("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:r,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let a=!1,l=null,u=null;const d="raster.servicepixelvalue",h=this._rasterFunctionNamesIndex;if(p(e.outFields)&&(a=e.outFields.some((e=>!e.toLowerCase().includes(d))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(d)&&e.length>d.length)).map((e=>{const t=e.slice(d.length+1);return[this._updateRenderingRulesFunctionName(t,h),t]}));l=t.map((e=>new J({functionName:e[0]}))),u=t.map((e=>e[1]));const{renderingRule: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 f=c(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:g}=this;let y=e.timeExtent||this.timeExtent;if(g){const{isOutside:t,intersection:i}=V(g,{geometry:m(e.geometry),timeExtent:m(e.timeExtent),multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new o("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");i&&p(i.timeExtent)&&(y=i.timeExtent)}const R=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,y),b=this._getQueryParams({geometry:e.geometry,timeExtent:y,mosaicRule:R,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:i,returnCatalogItems:a,returnGeometry:f,raster:this.raster,maxItemCount:s?1:null});delete b.f;const S=new xe(b);try{await this.generateRasterInfo(this.renderingRule);const i=await oe(this.url,S,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,o=null!=i.value&&i.value.toLowerCase().includes("nodata");if(!(a&&!f&&i?.catalogItems?.features.length&&(n||!o)))return this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=i.catalogItems?.features??[],m=c.map((e=>e.attributes?.[l])),d=new ce({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),h=await this.queryRasters(d);return h?.features?.length&&h.features.forEach((t=>{c.forEach((i=>{i.attributes[l]===t.attributes[l]&&(i.geometry=new ue(t.geometry),p(e.outSpatialReference)&&(i.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new o("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const i=n(b(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),r=n(b(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([i,r]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):Fe(e.meshType,e.simulationSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return H(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,i=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):he(b(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),e))),r=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{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.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),u.getLogger(this.declaredClass).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles([d((()=>this.renderingRule),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}))]);const{serviceRasterInfo:t}=this;p(t.multidimensionalInfo)&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(c(e)||c(r)||c(t)||c(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 o=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),a=p(t.start)?t.start.getTime():null,l=p(t.end)?t.end.getTime():null,u=null==a||null==l||a===l,m=u?[a||l]:[[a,l]],d=this.version>=10.8;if(o.length)o.forEach((e=>{e.dimensionName===n&&(d?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=m))}));else if(!d){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=m})):e.multidimensionalDefinition.push(new _({variableName:"",dimensionName:n,isSlice:u,values:m}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?R(ce,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new E;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>{})),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:i}=this;return"unique-value"===e.type&&this._hasRenderingRule(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&B(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:i,ssl:r}=await n(b(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=i,this.sourceJSON=t,r&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new o("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(c(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()){if(!this.bandIds&&i.bandCount>=3){const e=k(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=G(i,{bandIds:this.bandIds,variableName:this.renderingRule?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=W(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=i):this.symbolizer=new $({rendererJSON:t,rasterInfo:i}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:p(e.pixelBlock)?e.pixelBlock.clone():null}}_getQueryParams(e){e&&p(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.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):U(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;return(await n(b(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:i,returnImageBitmap:r,signal:s}=e;if(i&&this._canRequestImageElement(t.format)){const i=`${b(this.parsedUrl)}/exportImage`,{data:o}=await n(i,{responseType:r?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:s});if(o instanceof Blob){return{imageBitmap:await P(o,i),params:t}}return{imageOrCanvasElement:o,params:t}}const a=this._initJobHandler(),l=n(b(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,a]))[0].data,p=t.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=L(u)),!c)throw new o("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const m={signal:s},d="gif"===p||"bmp"===p||p.includes("png")&&("png"===c||"jpg"===c)?U(u,{useCanvas:!0,...t},m):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:t.extent},params:t}}_generateRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return fe(b(this.parsedUrl),e,i)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=Q(e,{multidimensionalSubset:this.multidimensionalSubset});if(p(t)&&t.length>0){this.mosaicRule=this.mosaicRule||new O;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.renderingRule&&"none"!==this.renderingRule.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:o,templateFields:a}=i,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof r&&r.toLowerCase().includes("nodata"),h=[];if(r&&!u&&!d){const e={};e[m]=0;c=[r],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let f,g,y;this._updateResponseFieldNames(u,a),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=r){if(g=c[t],y=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.includes(this.renderingRule.functionName)?l[s.indexOf(this.renderingRule.functionName)]:r,"nodata"===g.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",i="Raster.ServicePixelValue";f.attributes[e]=g,f.attributes[i]=y,this._updateFeatureWithMagDirValues(f,g);const o=this.fields&&this.fields.length>0;let a=this.renderingRule&&p(this.serviceRasterInfo.attributeTable)?o?g:r:y;this.renderingRule||(a=o?g:r),this._updateFeatureWithRasterAttributeTableValues(f,a)}if(f.sourceLayer=f.layer=this,o&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=l[e]}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}=V(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};s&&p(s.timeExtent)&&(t=s.timeExtent)}if(i=this._combineMosaicRuleWithTimeExtent(i,t),p(i)&&i.multidimensionalDefinition){const{isOutside:e}=V(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(c(i))return;const{features:r,fields:s}=i,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),o=n&&n[0];if(!o)return;const a=r.filter((e=>e.attributes[o]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const i=this._rasterAttributeTableFieldPrefix+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 C({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new le(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:z([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"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;c(i)||e.forEach((e=>{if(e&&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}_hasRenderingRule(e){return null!=e&&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().replace(/ /gi,"_");return t.has(i)?t.get(i):e}_isRFTJson(e){return e&&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,renderingRule:r}=this;r&&null==e.renderingRule&&(e.renderingRule=r),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,advancedQueryCapabilities:r,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit"),u=t.includes("mensuration")&&a,p=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map((e=>e.trim())),c=u&&p.includes("basic");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:u,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:i>=10.2&&n,supportsProject:i>=10.3&&n,supportsComputeStatisticsHistograms:i>=10.4&&n,supportsQueryBoundary:i>=10.6&&n,supportsCalculateVolume:i>=10.7&&o,supportsComputePixelLocation:i>=10.7&&t.includes("catalog"),supportsComputeAngles:i>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!r?.supportsStatistics,supportsOrderBy:!!r?.supportsOrderBy,supportsDistinct:!!r?.supportsDistinct,supportsPagination:!!r?.supportsPagination,supportsStandardizedQueriesOnly:!!r?.useStandardizedQueries,supportsPercentileStatistics:!!r?.supportsPercentileStatistics,supportsCentroid:!!r?.supportsReturningGeometryCentroid,supportsDistance:!!r?.supportsQueryWithDistance,supportsExtent:!!r?.supportsReturningQueryExtent,supportsGeometryProperties:!!r?.supportsReturningGeometryProperties,supportsHavingClause:!!r?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!r?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:c,supportsAreaAndPerimeter:c,supportsPointOrCentroid:c,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function b(e){return e?.path??""}return e([f()],g.prototype,"_functionRasterInfos",void 0),e([f()],g.prototype,"_rasterJobHandler",void 0),e([f()],g.prototype,"_cachedRendererJson",void 0),e([f({readOnly:!0})],g.prototype,"_serviceSupportsMosaicRule",void 0),e([S("_serviceSupportsMosaicRule",["currentVersion","fields"])],g.prototype,"readServiceSupportsMosaicRule",null),e([f()],g.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([f({readOnly:!0})],g.prototype,"_rasterFunctionNamesIndex",null),e([f()],g.prototype,"adjustAspectRatio",void 0),e([f({type:[y],json:{write:!0}})],g.prototype,"bandIds",void 0),e([S("bandIds")],g.prototype,"readBandIds",null),e([f({readOnly:!0,json:{read:!1}})],g.prototype,"capabilities",void 0),e([S("service","capabilities",["capabilities","currentVersion","serviceDataType"])],g.prototype,"readCapabilities",null),e([f({type:Number})],g.prototype,"compressionQuality",void 0),e([x("compressionQuality")],g.prototype,"writeCompressionQuality",null),e([f({type:Number})],g.prototype,"compressionTolerance",void 0),e([x("compressionTolerance")],g.prototype,"writeCompressionTolerance",null),e([f({json:{read:{source:"copyrightText"}}})],g.prototype,"copyright",void 0),e([f({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],g.prototype,"defaultMosaicRule",void 0),e([S("defaultMosaicRule",["defaultMosaicMethod"])],g.prototype,"readDefaultMosaicRule",null),e([f({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],g.prototype,"definitionExpression",void 0),e([f({readOnly:!0,constructOnly:!0})],g.prototype,"exportImageServiceParameters",void 0),e([f()],g.prototype,"rasterInfo",void 0),e([f({readOnly:!0,type:[D]})],g.prototype,"fields",void 0),e([f({readOnly:!0})],g.prototype,"fieldsIndex",null),e([f({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],g.prototype,"format",null),e([S("service","format",["serviceDataType"])],g.prototype,"readFormat",null),e([f({type:le})],g.prototype,"fullExtent",void 0),e([f({readOnly:!0})],g.prototype,"hasMultidimensions",void 0),e([f({json:{read:{source:"maxImageHeight"}}})],g.prototype,"imageMaxHeight",void 0),e([f({json:{read:{source:"maxImageWidth"}}})],g.prototype,"imageMaxWidth",void 0),e([f({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],g.prototype,"interpolation",void 0),e([f()],g.prototype,"minScale",void 0),e([S("service","minScale")],g.prototype,"readMinScale",null),e([f()],g.prototype,"maxScale",void 0),e([S("service","maxScale")],g.prototype,"readMaxScale",null),e([f({type:O})],g.prototype,"mosaicRule",null),e([S("mosaicRule",["mosaicRule","defaultMosaicMethod"])],g.prototype,"readMosaicRule",null),e([x("mosaicRule")],g.prototype,"writeMosaicRule",null),e([f()],g.prototype,"multidimensionalInfo",void 0),e([f({type:N,json:{write:!0}})],g.prototype,"multidimensionalSubset",void 0),e([f({json:{type:y}})],g.prototype,"noData",void 0),e([x("noData")],g.prototype,"writeNoData",null),e([f({type:String,json:{type:A.jsonValues,read:A.read,write:A.write}})],g.prototype,"noDataInterpretation",void 0),e([f({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],g.prototype,"objectIdField",void 0),e([S("objectIdField")],g.prototype,"readObjectIdField",null),e([f({})],g.prototype,"geometryType",void 0),e([f({})],g.prototype,"typeIdField",void 0),e([f({})],g.prototype,"types",void 0),e([f({readOnly:!0})],g.prototype,"parsedUrl",null),e([f({type:Function})],g.prototype,"pixelFilter",void 0),e([f()],g.prototype,"raster",void 0),e([f({readOnly:!0})],g.prototype,"sourceType",void 0),e([S("sourceType",["serviceSourceType","fields"])],g.prototype,"readSourceType",null),e([f()],g.prototype,"viewId",void 0),e([f({types:i,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:r,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],g.prototype,"renderer",null),e([S("renderer")],g.prototype,"readRenderer",null),e([x("renderer")],g.prototype,"writeRenderer",null),e([f()],g.prototype,"symbolizer",void 0),e([f(I)],g.prototype,"opacity",void 0),e([f({readOnly:!0})],g.prototype,"rasterFields",null),e([f({constructOnly:!0})],g.prototype,"rasterFunctionInfos",void 0),e([f({type:J})],g.prototype,"renderingRule",null),e([S("renderingRule",["renderingRule","rasterFunctionInfos"])],g.prototype,"readRenderingRule",null),e([x("renderingRule")],g.prototype,"writeRenderingRule",null),e([f()],g.prototype,"serviceDataType",void 0),e([f({readOnly:!0,type:De})],g.prototype,"spatialReference",void 0),e([S("spatialReference",["spatialReference","extent"])],g.prototype,"readSpatialReference",null),e([f({json:{type:je.jsonValues}})],g.prototype,"pixelType",void 0),e([S("pixelType")],g.prototype,"readPixelType",null),e([x("pixelType")],g.prototype,"writePixelType",null),e([f({constructOnly:!0,type:q})],g.prototype,"serviceRasterInfo",void 0),e([f()],g.prototype,"sourceJSON",void 0),e([f(w)],g.prototype,"url",void 0),e([f({readOnly:!0})],g.prototype,"version",void 0),e([S("version",["currentVersion","fields","timeInfo"])],g.prototype,"readVersion",null),g=e([v("esri.layers.mixins.ArcGISImageService")],g),g};export{Ne 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/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import i from"../../renderers/Renderer.js";import o from"../../renderers/SimpleRenderer.js";import n from"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import"../../core/has.js";import s from"../../core/Error.js";import{HandleOwnerMixin as l}from"../../core/HandleOwner.js";import{IdentifiableMixin as a}from"../../core/Identifiable.js";import{clone as p}from"../../core/lang.js";import d from"../../core/Loadable.js";import u from"../../core/Logger.js";import{isSome as y,unwrapOr as c}from"../../core/maybe.js";import{MultiOriginJSONMixin as m}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as f}from"../../core/object.js";import{sqlAnd as b}from"../../core/sql.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{reader as g}from"../../core/accessorSupport/decorators/reader.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{writer as j}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as w}from"../../core/accessorSupport/PropertyOrigin.js";import{createTypeReader as O}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import S from"../../form/FormTemplate.js";import{labelsVisible as F,legendEnabled as I,minScale as T,maxScale as E,popupEnabled as C}from"./commonProperties.js";import{createQuery as A}from"./featureLayerUtils.js";import x from"./FeatureTemplate.js";import{defineFieldProperties as R}from"./fieldProperties.js";import{fixRendererFields as P}from"./fieldUtils.js";import D from"./LabelClass.js";import{reader as L}from"./labelingInfo.js";import q from"../../rest/support/Query.js";import{createPopupTemplate as U}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as V,defaultPolylineSymbol2D as G,defaultPointSymbol2D as N}from"../../symbols/support/defaults.js";const $=["charts","editingEnabled","formTemplate","labelsVisible","labelingInfo","legendEnabled","minScale","maxScale","opacity","popupEnabled","popupTemplate","renderer","subtypeCode","templates","title","visible"],k={key:"type",base:i,errorContext:"renderer",typeMap:{simple:o,"unique-value":n,"class-breaks":r}},M=R(),_=O({types:k});let H=0;function B(e){const t=e.json.write;return"object"==typeof t?t.ignoreOrigin=!0:e.json.write={ignoreOrigin:!0},e}function Q(e){return new o({symbol:z(e)})}function z(e){switch(e){case"point":case"multipoint":return N.clone();case"polyline":return G.clone();case"polygon":case"multipatch":return V.clone();default:return null}}function J(e,t){return!!t&&("unique-value"===e?.type&&"string"==typeof e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function K(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function W(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=K(e,t);if(y(o)){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new x({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}const X="esri.layers.support.SubtypeSublayer";let Y=class extends(l(m(a(d)))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${H++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let n;if(i){n=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:s})=>{if(!s)return;const l=o?.fields?.find((e=>e.name===t));if(!l)return;const a={name:t};let p=!1;r!==l.alias&&(a.alias=r,p=!0),i!==l.editable&&(a.editable=i,p=!0),n.push(a),p&&e++})),0===e&&n.length===i.length&&(n=null)}else n=p(e);n?.length&&f(r,n,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,s=o?.find((e=>e.code===r)),l=s?.defaultValues,a=s?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find((e=>e.name===i));if(e.visible=!t||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const s=l?.[i]??null;e.defaultValue=i===n?r:s;const u=a?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get geometryType(){return this.parent?.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||u.getLogger(X).error(ee("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){P(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?Q(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,n=_(i,t,r);let s;const{subtypeCode:l}=this;if(null!=l&&J(n,t.subtypeField)){const e=n.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(l)));e&&(s=new o({symbol:e.symbol}))}else"simple"!==n?.type||n.visualVariables?.length||(s=n);return s}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:_(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference}readTemplatesFromService(e,t){return[W(this.subtypeCode,t)]}readTitleFromService(e,t){const r=K(this.subtypeCode,t);return y(r)?r.name:null}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw ee("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new s("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:i}=this;if(!i)throw ee("updateAttachment");if(e.getAttribute(i.subtypeField)!==this.subtypeCode)throw new s("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return i.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw ee("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new s("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw ee("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:s}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:s,title:o}}return U(t,e)}createQuery(){if(!this.parent)throw ee("createQuery");const e=A(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=b(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e){return this._getLayerDomain(e)}hasUserOverrides(){return $.some((e=>this.originIdOf(e)===w.USER))}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw ee("queryAttachments");const i=e.clone();return i.where=Z(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw ee("queryFeatures");const i=q.from(e)??r.createQuery();return y(e)&&(i.where=Z(i.where,r.parent.subtypeField,r.subtypeCode)),r.parent.queryFeatures(i,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"capabilities",null),e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"effectiveCapabilities",null),e([h({json:{write:{ignoreOrigin:!0}}})],Y.prototype,"charts",void 0),e([h({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:{ignoreOrigin:!0}}})],Y.prototype,"editingEnabled",void 0),e([h({type:Boolean,readOnly:!0})],Y.prototype,"effectiveEditingEnabled",null),e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"elevationInfo",null),e([h({readOnly:!0,json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],Y.prototype,"fieldOverrides",void 0),e([j("fieldOverrides")],Y.prototype,"writeFieldOverrides",null),e([h({...M.fields,readOnly:!0,json:{read:!1}})],Y.prototype,"fields",null),e([h(M.fieldsIndex)],Y.prototype,"fieldsIndex",void 0),e([h({type:S,json:{name:"formInfo",write:{ignoreOrigin:!0}}})],Y.prototype,"formTemplate",void 0),e([h({type:String,readOnly:!0,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],Y.prototype,"id",void 0),e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"geometryType",null),e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"type",void 0),e([h(B(p(F)))],Y.prototype,"labelsVisible",void 0),e([h({type:[D],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:L},write:{ignoreOrigin:!0}}})],Y.prototype,"labelingInfo",void 0),e([h({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],Y.prototype,"layerType",void 0),e([h(B(p(I)))],Y.prototype,"legendEnabled",void 0),e([h({type:["show","hide"]})],Y.prototype,"listMode",void 0),e([h((()=>{const e=p(T);return e.json.origins.service.read=!1,B(e)})())],Y.prototype,"minScale",void 0),e([h((()=>{const e=p(E);return e.json.origins.service.read=!1,B(e)})())],Y.prototype,"maxScale",void 0),e([h({readOnly:!0})],Y.prototype,"effectiveScaleRange",null),e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"objectIdField",null),e([h({type:Number,range:{min:0,max:1},nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],Y.prototype,"opacity",void 0),e([h()],Y.prototype,"parent",void 0),e([h(B(p(C)))],Y.prototype,"popupEnabled",void 0),e([h({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],Y.prototype,"popupTemplate",void 0),e([h({readOnly:!0})],Y.prototype,"defaultPopupTemplate",null),e([h({types:k,json:{write:{target:"layerDefinition.drawingInfo.renderer",ignoreOrigin:!0}}})],Y.prototype,"renderer",null),e([g("service","renderer",["drawingInfo.renderer","subtypeField","type"])],Y.prototype,"readRendererFromService",null),e([g("renderer",["layerDefinition.drawingInfo.renderer"])],Y.prototype,"readRenderer",null),e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"spatialReference",null),e([h({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],Y.prototype,"subtypeCode",void 0),e([h({type:[x],json:{name:"layerDefinition.templates",write:{ignoreOrigin:!0}}})],Y.prototype,"templates",void 0),e([g("service","templates",["geometryType","subtypeField","subtypes","type"])],Y.prototype,"readTemplatesFromService",null),e([h({type:String,json:{write:{ignoreOrigin:!0}}})],Y.prototype,"title",void 0),e([g("service","title",["subtypes"])],Y.prototype,"readTitleFromService",null),e([h({readOnly:!0})],Y.prototype,"userHasUpdateItemPrivileges",null),e([h({type:Boolean,nonNullable:!0,json:{name:"visibility",write:{ignoreOrigin:!0}}})],Y.prototype,"visible",void 0),Y=e([v(X)],Y);const Z=(e,t,r)=>{const i=new RegExp(`${t}=[0-9]`),o=`${t}=${r}`,n=c(e,"");return i.test(n)?n.replace(i,o):b(o,n)},ee=e=>new s(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),te=Y;export{te as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import i from"../../renderers/Renderer.js";import o from"../../renderers/SimpleRenderer.js";import n from"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import"../../core/has.js";import s from"../../core/Error.js";import{HandleOwnerMixin as l}from"../../core/HandleOwner.js";import{IdentifiableMixin as a}from"../../core/Identifiable.js";import{clone as p}from"../../core/lang.js";import d from"../../core/Loadable.js";import u from"../../core/Logger.js";import{isSome as y,unwrapOr as c}from"../../core/maybe.js";import{MultiOriginJSONMixin as m}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as f}from"../../core/object.js";import{sqlAnd as b}from"../../core/sql.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{reader as g}from"../../core/accessorSupport/decorators/reader.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{writer as j}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as w}from"../../core/accessorSupport/PropertyOrigin.js";import{createTypeReader as O}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import S from"../../form/FormTemplate.js";import{labelsVisible as F,legendEnabled as I,minScale as T,maxScale as E,popupEnabled as C}from"./commonProperties.js";import{createQuery as A}from"./featureLayerUtils.js";import x from"./FeatureTemplate.js";import{defineFieldProperties as R}from"./fieldProperties.js";import{fixRendererFields as P}from"./fieldUtils.js";import D from"./LabelClass.js";import{reader as L}from"./labelingInfo.js";import q from"../../rest/support/Query.js";import{createPopupTemplate as U}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as V,defaultPolylineSymbol2D as G,defaultPointSymbol2D as N}from"../../symbols/support/defaults.js";const $=["charts","editingEnabled","formTemplate","labelsVisible","labelingInfo","legendEnabled","minScale","maxScale","opacity","popupEnabled","popupTemplate","renderer","subtypeCode","templates","title","visible"],k={key:"type",base:i,errorContext:"renderer",typeMap:{simple:o,"unique-value":n,"class-breaks":r}},M=R(),_=O({types:k});let H=0;function B(e){const t=e.json.write;return"object"==typeof t?t.ignoreOrigin=!0:e.json.write={ignoreOrigin:!0},e}function Q(e){return new o({symbol:z(e)})}function z(e){switch(e){case"point":case"multipoint":return N.clone();case"polyline":return G.clone();case"polygon":case"multipatch":return V.clone();default:return null}}function J(e,t){return!!t&&("unique-value"===e?.type&&"string"==typeof e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function K(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function W(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=K(e,t);if(y(o)){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new x({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}const X="esri.layers.support.SubtypeSublayer";let Y=class extends(l(m(a(d)))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${H++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let n;if(i){n=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:s})=>{if(!s)return;const l=o?.fields?.find((e=>e.name===t));if(!l)return;const a={name:t};let p=!1;r!==l.alias&&(a.alias=r,p=!0),i!==l.editable&&(a.editable=i,p=!0),n.push(a),p&&e++})),0===e&&n.length===i.length&&(n=null)}else n=p(e);n?.length&&f(r,n,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,s=o?.find((e=>e.code===r)),l=s?.defaultValues,a=s?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find((e=>e.name===i));if(e.visible=!t||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const s=l?.[i]??null;e.defaultValue=i===n?r:s;const u=a?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get geometryType(){return this.parent?.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||u.getLogger(X).error(ee("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){P(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?Q(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,n=_(i,t,r);let s;const{subtypeCode:l}=this;if(null!=l&&J(n,t.subtypeField)){const e=n.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(l)));e&&(s=new o({symbol:e.symbol}))}else"simple"!==n?.type||n.visualVariables?.length||(s=n);return s}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:_(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference}readTemplatesFromService(e,t){return[W(this.subtypeCode,t)]}readTitleFromService(e,t){const r=K(this.subtypeCode,t);return y(r)?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw ee("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new s("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:i}=this;if(!i)throw ee("updateAttachment");if(e.getAttribute(i.subtypeField)!==this.subtypeCode)throw new s("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return i.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw ee("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new s("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw ee("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:s}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:s,title:o}}return U(t,e)}createQuery(){if(!this.parent)throw ee("createQuery");const e=A(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=b(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e){return this._getLayerDomain(e)}hasUserOverrides(){return $.some((e=>this.originIdOf(e)===w.USER))}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw ee("queryAttachments");const i=e.clone();return i.where=Z(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw ee("queryFeatures");const i=q.from(e)??r.createQuery();return y(e)&&(i.where=Z(i.where,r.parent.subtypeField,r.subtypeCode)),r.parent.queryFeatures(i,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"capabilities",null),e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"effectiveCapabilities",null),e([h({json:{write:{ignoreOrigin:!0}}})],Y.prototype,"charts",void 0),e([h({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:{ignoreOrigin:!0}}})],Y.prototype,"editingEnabled",void 0),e([h({type:Boolean,readOnly:!0})],Y.prototype,"effectiveEditingEnabled",null),e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"elevationInfo",null),e([h({readOnly:!0,json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],Y.prototype,"fieldOverrides",void 0),e([j("fieldOverrides")],Y.prototype,"writeFieldOverrides",null),e([h({...M.fields,readOnly:!0,json:{read:!1}})],Y.prototype,"fields",null),e([h(M.fieldsIndex)],Y.prototype,"fieldsIndex",void 0),e([h({type:S,json:{name:"formInfo",write:{ignoreOrigin:!0}}})],Y.prototype,"formTemplate",void 0),e([h({type:String,readOnly:!0,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],Y.prototype,"id",void 0),e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"geometryType",null),e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"type",void 0),e([h(B(p(F)))],Y.prototype,"labelsVisible",void 0),e([h({type:[D],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:L},write:{ignoreOrigin:!0}}})],Y.prototype,"labelingInfo",void 0),e([h({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],Y.prototype,"layerType",void 0),e([h(B(p(I)))],Y.prototype,"legendEnabled",void 0),e([h({type:["show","hide"]})],Y.prototype,"listMode",void 0),e([h((()=>{const e=p(T);return e.json.origins.service.read=!1,B(e)})())],Y.prototype,"minScale",void 0),e([h((()=>{const e=p(E);return e.json.origins.service.read=!1,B(e)})())],Y.prototype,"maxScale",void 0),e([h({readOnly:!0})],Y.prototype,"effectiveScaleRange",null),e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"objectIdField",null),e([h({type:Number,range:{min:0,max:1},nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],Y.prototype,"opacity",void 0),e([h()],Y.prototype,"parent",void 0),e([h(B(p(C)))],Y.prototype,"popupEnabled",void 0),e([h({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],Y.prototype,"popupTemplate",void 0),e([h({readOnly:!0})],Y.prototype,"defaultPopupTemplate",null),e([h({types:k,json:{write:{target:"layerDefinition.drawingInfo.renderer",ignoreOrigin:!0}}})],Y.prototype,"renderer",null),e([g("service","renderer",["drawingInfo.renderer","subtypeField","type"])],Y.prototype,"readRendererFromService",null),e([g("renderer",["layerDefinition.drawingInfo.renderer"])],Y.prototype,"readRenderer",null),e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"spatialReference",null),e([h({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],Y.prototype,"subtypeCode",void 0),e([h({type:[x],json:{name:"layerDefinition.templates",write:{ignoreOrigin:!0}}})],Y.prototype,"templates",void 0),e([g("service","templates",["geometryType","subtypeField","subtypes","type"])],Y.prototype,"readTemplatesFromService",null),e([h({type:String,json:{write:{ignoreOrigin:!0}}})],Y.prototype,"title",void 0),e([g("service","title",["subtypes"])],Y.prototype,"readTitleFromService",null),e([h({readOnly:!0,json:{read:!1}})],Y.prototype,"url",null),e([h({readOnly:!0})],Y.prototype,"userHasUpdateItemPrivileges",null),e([h({type:Boolean,nonNullable:!0,json:{name:"visibility",write:{ignoreOrigin:!0}}})],Y.prototype,"visible",void 0),Y=e([v(X)],Y);const Z=(e,t,r)=>{const i=new RegExp(`${t}=[0-9]`),o=`${t}=${r}`,n=c(e,"");return i.test(n)?n.replace(i,o):b(o,n)},ee=e=>new s(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),te=Y;export{te as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import{isNone as e}from"../../../core/maybe.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{convolutionKernel as r}from"../rasterFunctionConstants.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";import i from"./BaseRasterFunction.js";import u from"./ConvolutionFunctionArguments.js";import{convolute as c}from"./convolutionUtils.js";const p=25;let l=class extends i{constructor(){super(...arguments),this.functionName="Convolution",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{convolutionType:t,rows:e,cols:o,kernel:s}=this.functionArguments;if(!Object.values(r).includes
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import{isNone as e}from"../../../core/maybe.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{convolutionKernel as r}from"../rasterFunctionConstants.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";import i from"./BaseRasterFunction.js";import u from"./ConvolutionFunctionArguments.js";import{convolute as c}from"./convolutionUtils.js";const p=25;let l=class extends i{constructor(){super(...arguments),this.functionName="Convolution",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{convolutionType:t,rows:e,cols:o,kernel:s}=this.functionArguments;if(!Object.values(r).includes(t))return{success:!1,supportsGPU:!1,error:`convolution-function: the specified kernel type is not supported ${t}`};if(t!==r.none&&e*o!==s.length)return{success:!1,supportsGPU:!1,error:"convolution-function: the specified rows and cols do not match the length of the kernel"};const n=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(n.pixelType);const i=n.clone();i.pixelType=this.outputPixelType;const u=[r.none,r.sharpen,r.sharpen2,r.sharpening3x3,r.sharpening5x5];"u8"===this.outputPixelType||u.includes(t)||(i.statistics=null,i.histograms=null),i.colormap=null,i.attributeTable=null,this.rasterInfo=i;return{success:!0,supportsGPU:s.length<=p}}_processPixels(t){const o=t.pixelBlocks?.[0];if(e(o)||this.functionArguments.convolutionType===r.none)return o;let{kernel:s,rows:n,cols:i}=this.functionArguments;const u=s.reduce(((t,e)=>t+e));return 0!==u&&1!==u&&(s=s.map((t=>t/u))),c(o,{kernel:s,rows:n,cols:i,outputPixelType:this.outputPixelType})}_getWebGLParameters(){let{kernel:t}=this.functionArguments;const e=t.reduce(((t,e)=>t+e));0!==e&&1!==e&&(t=t.map((t=>t/e)));const o=new Float32Array(p);return o.set(t),{kernelRows:this.functionArguments.rows,kernelCols:this.functionArguments.cols,kernel:o,clampRange:n(this.outputPixelType)}}};t([o({json:{write:!0,name:"rasterFunction"}})],l.prototype,"functionName",void 0),t([o({type:u,json:{write:!0,name:"rasterFunctionArguments"}})],l.prototype,"functionArguments",void 0),t([o()],l.prototype,"rasterArgumentNames",void 0),l=t([s("esri.layers.support.rasterFunctions.ConvolutionFunction")],l);const a=l;export{a as default};
|
package/package.json
CHANGED
package/rest/imageService.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../geometry.js";import t from"../request.js";import{isSome as e}from"../core/maybe.js";import{normalizeCentralMeridian as o}from"../geometry/support/normalizeUtils.js";import{parseUrl as n,encode as
|
|
5
|
+
import"../geometry.js";import t from"../request.js";import{isSome as e}from"../core/maybe.js";import{normalizeCentralMeridian as o}from"../geometry/support/normalizeUtils.js";import{parseUrl as n,encode as a,asValidOptions as r}from"./utils.js";import s from"./support/ImageAngleResult.js";import i from"./support/ImageAreaResult.js";import m from"./support/ImageDistanceResult.js";import c from"./support/ImageHeightResult.js";import u from"./support/ImageIdentifyResult.js";import l from"./support/ImagePixelLocationResult.js";import f from"./support/ImagePointResult.js";import p from"./support/ImageSampleResult.js";import g from"../geometry/SpatialReference.js";function y(t){const e=t?.time;if(e&&(null!=e.start||null!=e.end)){const o=[];null!=e.start&&o.push(e.start),null==e.end||o.includes(e.end)||o.push(e.end),t.time=o.join(",")}}async function S(t,s,i){const m=n(t),c=s.geometry?[s.geometry]:[],u=await o(c),l=s.toJSON();y(l);const f=u&&u[0];e(f)&&(l.geometry=f.toJSON());const p=a({...m.query,f:"json",...l});return r(p,i)}async function d(o,i,m){const c=i.toJSON();e(c.angleName)&&(c.angleName=c.angleName.join(",")),e(i.point)&&i.point.spatialReference?.imageCoordinateSystem&&(c.point.spatialReference=G(i.point.spatialReference)),e(i.spatialReference)&&i.spatialReference.imageCoordinateSystem&&(c.spatialReference=$(i.spatialReference));const u=n(o),l=a({...u.query,f:"json",...c}),f=r(l,m),{data:p}=await t(`${u.path}/computeAngles`,f);return p.spatialReference=p.spatialReference?null!=p.spatialReference.geodataXform?new g({wkid:0,imageCoordinateSystem:p.spatialReference}):g.fromJSON(p.spatialReference):null,"NaN"===p.north&&(p.north=null),"NaN"===p.up&&(p.up=null),new s(p)}async function N(e,o,s){const i=o.toJSON(),{geometries:m}=o;if(m)for(let t=0;t<m.length;t++)m[t].spatialReference?.imageCoordinateSystem&&(i.geometries.geometries[t].spatialReference=G(m[t].spatialReference));const c=n(e),u=a({...c.query,f:"json",...i}),f=r(u,s),{data:p}=await t(`${c.path}/computePixelLocation`,f);return l.fromJSON(p)}async function R(e,o,a){const r=await S(e,o,a),s=n(e),{data:i}=await t(`${s.path}/computeStatisticsHistograms`,r),{statistics:m}=i;return m?.length&&m.forEach((t=>{t.avg=t.mean,t.stddev=t.standardDeviation})),{statistics:m,histograms:i.histograms}}async function J(e,o,a){const r=await S(e,o,a),s=n(e),{data:i}=await t(`${s.path}/computeHistograms`,r);return{histograms:i.histograms}}async function O(s,i,m){const c=i.toJSON();y(c),c.outFields?.length&&(c.outFields=c.outFields.join(","));const u=(await o(i.geometry))?.[0];e(u)&&(c.geometry=u.toJSON());const l=n(s),f=a({...l.query,f:"json",...c}),g=r(f,m),{data:S}=await t(`${l.path}/getSamples`,g),d=S?.samples?.map((t=>{const e="NaN"===t.value||""===t.value?null:t.value.split(" ").map((t=>Number(t)));return{...t,pixelValue:e}}));return p.fromJSON({samples:d})}async function j(s,i,m){const c=n(s),l=i.geometry?[i.geometry]:[];return o(l).then((o=>{const n=i.toJSON(),s=o&&o[0];e(s)&&(n.geometry=JSON.stringify(s.toJSON()));const u=a({...c.query,f:"json",...n}),l=r(u,m);return t(c.path+"/identify",l)})).then((t=>u.fromJSON(t.data)))}async function h(t,e,o){const n=await q(t,e,[e.fromGeometry,e.toGeometry],o);return c.fromJSON(n)}async function w(t,e,o){const n=await q(t,e,[e.geometry],o);return i.fromJSON(n)}async function I(t,e,o){const n=await q(t,e,[e.geometry],o);return f.fromJSON(n)}async function C(t,e,o){const n=await q(t,e,[e.fromGeometry,e.toGeometry],o);return m.fromJSON(n)}async function q(s,i,m,c){const u=n(s),l=await o(m),f=i.toJSON();e(l[0])&&(f.fromGeometry=JSON.stringify(v(l[0]))),e(l[1])&&(f.toGeometry=JSON.stringify(v(l[1])));const p=a({...u.query,f:"json",...f}),g=r(p,c),{data:y}=await t(u.path+"/measure",g);return y}function v(t){const e=t.toJSON();return t.spatialReference?.imageCoordinateSystem&&(e.spatialReference=G(t.spatialReference)),e}function G(t){const{imageCoordinateSystem:e}=t;if(e){const{id:t,referenceServiceName:o}=e;return null!=t?o?{icsid:t,icsns:o}:{icsid:t}:{ics:e}}return t.toJSON()}function $(t,e){const o=G(t),{icsid:n,icsns:a,wkid:r}=o;return null!=n?null==a||e?.toLowerCase().includes("/"+a.toLowerCase()+"/")?`0:${n}`:JSON.stringify(o):r?r.toString():JSON.stringify(o)}export{d as computeAngles,J as computeHistograms,N as computePixelSpaceLocations,R as computeStatisticsHistograms,G as getImageSpatialReferenceJSON,$ as getImageSpatialReferenceQueryParameter,O as getSamples,j as identify,w as measureAreaAndPerimeter,C as measureDistanceAndAngle,h as measureHeight,I as measurePointOrCentroid};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const c="20230228",d="82c504e7a258618693fa8f46717811c9d421bd0d";export{c as buildDate,d as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{C as e}from"../../../chunks/CloudsComposition.glsl.js";import{ReloadableShaderModule as r}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as i}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{ShaderTechniqueConfiguration as o}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";import{Default3D as n}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{Program as t}from"../webgl-engine/lib/Program.js";import{BlendFactor as s,CompareFunction as l}from"../../webgl/enums.js";import{makePipelineState as m,
|
|
5
|
+
import{C as e}from"../../../chunks/CloudsComposition.glsl.js";import{ReloadableShaderModule as r}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as i}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{ShaderTechniqueConfiguration as o}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";import{Default3D as n}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{Program as t}from"../webgl-engine/lib/Program.js";import{BlendFactor as s,CompareFunction as l}from"../../webgl/enums.js";import{makePipelineState as m,separateBlendingParams as a,defaultColorWriteParams as g}from"../../webgl/renderState.js";class u extends i{constructor(e){super(e,new o,(()=>this.destroy()))}initializeProgram(e){return new t(e.rctx,u.shader.get().build(),n)}initializePipeline(){return m({blending:a(s.ONE,s.ZERO,s.SRC_ALPHA,s.ONE),depthTest:{func:l.LEQUAL},colorWrite:g})}}u.shader=new r(e,(()=>import("./CloudsComposition.glsl.js")));export{u as CloudsCompositionTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{isSome as r,unwrap as i,isNone as s}from"../../../core/maybe.js";import{whenOnce as a}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView3D as o}from"./LayerView3D.js";import{TiledLayerView3D as m}from"./TiledLayerView3D.js";import{RasterTile as p}from"../terrain/RasterTile.js";import h from"../../layers/ImageryTileLayerView.js";import c from"../../layers/LayerView.js";import y from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as d}from"../../support/drapedUtils.js";import{getWebGLCapabilities as f}from"../../webgl/capabilities.js";let u=class extends(h(y(m(o(c))))){constructor(){super(...arguments),this.type="imagery-tile-3d",this.isAlignedMapTile=!0}initialize(){this.layer.increaseRasterJobHandlerUsage(),null==this.fullExtent&&this.addResolvingPromise(Promise.reject(new t("layerview:spatial-reference-incompatible","The layer extent cannot be projected to the view's spatial reference",{layer:this.layer})));const e=a((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const e=this.view.basemapTerrain.tilingScheme,t=this.layer.tileInfo,r=["png","png24","png32","jpg","mixed"].includes(t.format)&&e.compatibleWith(t);this.isAlignedMapTile=r;const i=r?t:e.toTileInfo();this.tileInfo=i,this.updatingHandles.add((()=>[this.layer.renderer,this.layer.interpolation,this.layer.bandIds,this.layer.multidimensionalDefinition,this.layer.multidimensionalSubset,this.layer.rasterFunction,this.timeExtent]),(()=>this.refresh()))}));this.addResolvingPromise(e)}destroy(){this.layer.decreaseRasterJobHandlerUsage(),this.view=null}get _blankTile(){const e=document.createElement("canvas"),t=e.getContext("2d"),[r,i]=this.tileInfo.size;return e.width=r,e.height=i,t.clearRect(0,0,r,i),t.getImageData(0,0,r,i)}get imageFormatIsOpaque(){return"jpg"===this.layer.tileInfo.format}get hasMixedImageFormats(){return"mixed"===this.layer.tileInfo.format}get dataLevelRange(){const e=this.tileInfo.lods,t=this.layer.tileInfo.lods,r=e[0].scale,i=t[t.length-1].scale;return this.levelRangeFromScaleRange(r,i)}_getfullExtent(){return this.projectFullExtent(this.view.basemapTerrain&&r(this.view.basemapTerrain.spatialReference)?this.view.basemapTerrain.spatialReference:this.view.spatialReference)}async fetchTile(e,t,r,a){const l=this.tileInfo,n=this._canSymbolizeInWebGL(),o={tileInfo:l,requestRawData:n,signal:i(a.signal),timeExtent:this.timeExtent,requestAsImageElement:this.isAlignedMapTile},m=await this.layer.fetchTile(e,t,r,o);if(m instanceof HTMLImageElement)return m;let h=m&&m.pixelBlock;if(s(h))return this._blankTile;if(!n&&(h=await this.layer.applyRenderer(m),s(h)))return this._blankTile;const c=new p([e,t,r],h,l.size[0],l.size[1]);return n?(c.symbolizerRenderer=this.layer.symbolizer.rendererJSON,c.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e)),c.transformGrid=m.transformGrid):c.isRendereredSource=!0,c.interpolation=this.layer.interpolation,c.bandIds=this.layer.bandIds,c}_getSymbolizerOptions(e){const t=this.tileInfo.lodAt(e).resolution;return{pixelBlock:null,isGCS:this.view.basemapTerrain&&r(this.view.basemapTerrain.spatialReference)?this.view.basemapTerrain.spatialReference.isGeographic:this.view.spatialReference.isGeographic,resolution:{x:t,y:t},bandIds:this.layer.bandIds}}ensureSymbolizerParameters(e){this._canSymbolizeInWebGL()&&JSON.stringify(e.symbolizerRenderer)!==JSON.stringify(this.layer.symbolizer.rendererJSON)&&(e.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e.lij[0])))}createFetchPopupFeaturesQueryGeometry(e,t){return d(e,t,this.view)}refresh(){this.emit("data-changed")}async doRefresh(){this.suspended||this.emit("data-changed")}_canSymbolizeInWebGL(){return f("3d").supportsTextureFloat&&this.layer.symbolizer.canRenderInWebGL}};e([l({readOnly:!0})],u.prototype,"_blankTile",null),e([l({readOnly:!0})],u.prototype,"imageFormatIsOpaque",null),e([l({readOnly:!0})],u.prototype,"hasMixedImageFormats",null),e([l({readOnly:!0})],u.prototype,"dataLevelRange",null),u=e([n("esri.views.3d.layers.ImageryTileLayerView3D")],u);const g=u;export{g as default};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{c as e}from"../../../../../../chunks/vec4f64.js";import{area as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{OverlayIndex as a,RenderTargetType as i}from"../../../../terrain/interfaces.js";import{RenderPassIdentifier as
|
|
5
|
+
import{c as e}from"../../../../../../chunks/vec4f64.js";import{area as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{OverlayIndex as a,RenderTargetType as i}from"../../../../terrain/interfaces.js";import{OverlaySource as l}from"../../../../terrain/Overlay.js";import{RenderPassIdentifier as d}from"../../renderPasses/AllRenderPasses.js";import{ShaderOutput as s}from"../ShaderOutput.js";import{addMainLightDirection as n,addMainLightIntensity as c}from"../shading/MainLighting.glsl.js";import{PBRMode as v}from"../shading/PhysicallyBasedRenderingParameters.glsl.js";import{Water as x}from"../shading/Water.glsl.js";import{textureSize as u,texelFetch as p}from"../util/WebGL2Utils.js";import{Float4DrawUniform as f}from"../../shaderModules/Float4DrawUniform.js";import{glsl as m}from"../../shaderModules/interfaces.js";import{Texture2DPassUniform as y}from"../../shaderModules/Texture2DPassUniform.js";var C;function g(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add([new f("overlayTexOffset",((e,o)=>O(e,o))),new f("overlayTexScale",((e,o)=>T(e,o)))]),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new y("ovColorTex",((e,o)=>b(e,o)))),h(e,o)}function h(e,o){e.extensions.add("GL_OES_standard_derivatives"),o.pbrMode!==v.Water&&o.pbrMode!==v.WaterOnIntegratedMesh&&o.pbrMode!==v.TerrainWithWater||e.include(x,o);const{vertex:r,fragment:t}=e;e.varyings.add("vtcOverlay","vec4"),r.code.add(m`void setOverlayVTC(in vec2 uv) {
|
|
6
6
|
vtcOverlay = vec4(uv, uv) * overlayTexScale + overlayTexOffset;
|
|
7
|
-
}`),t.code.add(
|
|
7
|
+
}`),t.code.add(m`bool isValid(vec2 uv, vec2 dxdy) {
|
|
8
8
|
return (uv.x >= 0.0 + dxdy.x) && (uv.x <= 1.0 - dxdy.x) && (uv.y >= 0.0 + dxdy.y) && (uv.y <= 1.0 - dxdy.y);
|
|
9
9
|
}
|
|
10
10
|
vec4 getOverlayColor(sampler2D ov0Tex, vec4 texCoords) {
|
|
@@ -13,12 +13,24 @@ vec4 color1 = texture2D(ov0Tex, vec2(texCoords.z * 0.5 + 0.5, texCoords.w));
|
|
|
13
13
|
bool isValid0 = isValid(texCoords.xy, fwidth(texCoords.xy));
|
|
14
14
|
bool isValid1 = isValid(texCoords.zw, vec2(0.0, 0.0));
|
|
15
15
|
return mix(color1 * float(isValid1), color0, float(isValid0));
|
|
16
|
-
}`),t.code.add(
|
|
16
|
+
}`),t.code.add(m`vec4 getCombinedOverlayColor() {
|
|
17
17
|
return overlayOpacity * getOverlayColor(ovColorTex, vtcOverlay);
|
|
18
|
-
}`),
|
|
18
|
+
}`),t.code.add(m`
|
|
19
|
+
vec4 getOverlayColorTexel(vec4 texCoords) {
|
|
20
|
+
vec2 texDim = ${u(o,"ovColorTex")};
|
|
21
|
+
|
|
22
|
+
vec4 color0 = ${p(o,"ovColorTex","vec2(texCoords.x * 0.5, texCoords.y)*texDim")};
|
|
23
|
+
vec4 color1 = ${p(o,"ovColorTex","vec2(texCoords.z * 0.5 + 0.5, texCoords.w)*texDim")};
|
|
24
|
+
|
|
25
|
+
bool isValid0 = isValid(texCoords.xy, fwidth(texCoords.xy));
|
|
26
|
+
bool isValid1 = isValid(texCoords.zw, vec2(0.0, 0.0));
|
|
27
|
+
|
|
28
|
+
return mix(color1 * float(isValid1), color0, float(isValid0));
|
|
29
|
+
}
|
|
30
|
+
`),o.pbrMode!==v.Water&&o.pbrMode!==v.WaterOnIntegratedMesh&&o.pbrMode!==v.TerrainWithWater||(n(t),c(t),t.code.add(m`vec4 getOverlayWaterColor(vec4 maskInput, vec4 colorInput, vec3 vposEyeDir,
|
|
19
31
|
float shadow, vec3 localUp, mat3 tbn, vec3 position, vec3 positionWorld) {
|
|
20
32
|
vec3 n = normalize(tbn * (2.0 * maskInput.rgb - vec3(1.0)));
|
|
21
33
|
vec3 v = vposEyeDir;
|
|
22
34
|
vec3 final = getSeaColor(n, v, mainLightDirection, colorInput.rgb, mainLightIntensity, localUp, 1.0 - shadow, maskInput.w, position, positionWorld);
|
|
23
35
|
return vec4(final, colorInput.w);
|
|
24
|
-
}`))}function
|
|
36
|
+
}`))}function b(e,o){return 0===o.overlays.length?null:e.identifier===d.Material&&e.output===s.Color?o.overlays[a.INNER].getColorTextureNoRasterImage():e.identifier===d.Material&&e.output===s.ObjectAndLayerIdColor?o.overlays[a.INNER].getColorTexture(l.ObjectAndLayerIdColor):e.identifier===d.Highlight?o.overlays[a.INNER].getValidTexture(i.Highlight):null}function O(e,a){for(const i of a.overlays){const{index:a,extent:l}=i;o(l)>0&&(M[2*a]=e.toMapSpace[0]/r(l)-l[0]/r(l),M[2*a+1]=e.toMapSpace[1]/t(l)-l[1]/t(l))}return M}function T(e,a){for(const i of a.overlays){const{index:a,extent:l}=i;o(l)>0&&(M[2*a]=e.toMapSpace[2]/r(l),M[2*a+1]=e.toMapSpace[3]/t(l))}return M}!function(e){e[e.Disabled=0]="Disabled",e[e.Enabled=1]="Enabled",e[e.EnabledWithWater=2]="EnabledWithWater",e[e.COUNT=3]="COUNT"}(C||(C={}));const M=e();export{g as OverlayIM,C as OverlayMode,b as getColorTexture,h as overlay};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../../chunks/mat4.js";import"../../../../../../chunks/mat4f64.js";import"../../../../../../chunks/vec3.js";import"../../../../../../chunks/vec3f64.js";import"../../../../terrain/interfaces.js";import"../ForwardLinearDepth.glsl.js";import"../ShaderOutput.js";import"../Slice.glsl.js";import"../Transform.glsl.js";import"../attributes/NormalAttribute.glsl.js";import"../attributes/PositionAttribute.glsl.js";import"../attributes/TextureCoordinateAttribute.glsl.js";import"../attributes/VertexTangent.glsl.js";import"../output/OutputDepth.glsl.js";import"../output/OutputHighlight.glsl.js";import"../shading/EvaluateAmbientOcclusion.glsl.js";import"../shading/EvaluateSceneLighting.glsl.js";import"../shading/MainLighting.glsl.js";import"../shading/NormalUtils.glsl.js";import"../shading/PhysicallyBasedRenderingParameters.glsl.js";import"../shading/ReadShadowMap.glsl.js";import"./Overlay.glsl.js";import"./TerrainTexture.glsl.js";import"../util/View.glsl.js";import"
|
|
5
|
+
import"../../../../../../chunks/mat4.js";import"../../../../../../chunks/mat4f64.js";import"../../../../../../chunks/vec3.js";import"../../../../../../chunks/vec3f64.js";import"../../../../terrain/interfaces.js";import"../ForwardLinearDepth.glsl.js";import"../ShaderOutput.js";import"../Slice.glsl.js";import"../Transform.glsl.js";import"../attributes/NormalAttribute.glsl.js";import"../attributes/PositionAttribute.glsl.js";import"../attributes/TextureCoordinateAttribute.glsl.js";import"../attributes/VertexTangent.glsl.js";import"../output/OutputDepth.glsl.js";import"../output/OutputHighlight.glsl.js";import"../shading/EvaluateAmbientOcclusion.glsl.js";import"../shading/EvaluateSceneLighting.glsl.js";import"../shading/MainLighting.glsl.js";import"../shading/NormalUtils.glsl.js";import"../shading/PhysicallyBasedRenderingParameters.glsl.js";import"../shading/ReadShadowMap.glsl.js";import"./Overlay.glsl.js";import"./TerrainTexture.glsl.js";import"../util/View.glsl.js";import"../../shaderModules/Float3PassUniform.js";import"../../shaderModules/interfaces.js";import"../../shaderModules/Matrix4DrawUniform.js";import"../../shaderModules/ShaderBuilder.js";import"../../shaderModules/Texture2DPassUniform.js";export{T as TerrainPassParameters,b as build}from"../../../../../../chunks/Terrain.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{remove as t}from"../../core/arrayUtils.js";import{makeHandle as a,handlesGroup as i}from"../../core/handleUtils.js";import{unwrap as r,removeMaybe as o,isSome as s,isNone as n,destroyMaybe as l}from"../../core/maybe.js";import{whenOnce as c,watch as d,syncAndInitial as u}from"../../core/reactiveUtils.js";import{generateUUID as h}from"../../core/uuid.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveLayerCapabilities as m}from"../../layers/support/layerUtils.js";import{getDrawHelpMessage as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{remove as t}from"../../core/arrayUtils.js";import{makeHandle as a,handlesGroup as i}from"../../core/handleUtils.js";import{unwrap as r,removeMaybe as o,isSome as s,isNone as n,destroyMaybe as l}from"../../core/maybe.js";import{whenOnce as c,watch as d,syncAndInitial as u}from"../../core/reactiveUtils.js";import{generateUUID as h}from"../../core/uuid.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveLayerCapabilities as m,getEffectiveEditingEnabled as w}from"../../layers/support/layerUtils.js";import{getDrawHelpMessage as g}from"../../views/draw/support/helpMessageUtils.js";import v from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{CreateFeaturesWorkflowData as y}from"./CreateFeaturesWorkflowData.js";import M from"./Workflow.js";import{shouldShowAttachmentsForCreateWorkflow as _,startCreatingNewFeature as A,findLayerInfo as b,updateGraphicSymbolWhenRequired as F,isTerminalUpdateEventType as V,getVisualVariableAttributes as I,startUpdatingFeature as k,createWorkflowSteps as S,avoidFeatureTemplateSelectionWithOnlyOneItem as j,prepareAttachmentsForCreateWorkflow as C,visualVariableInteractiveUpdate as E}from"./workflowUtils.js";var G;const O=Symbol();let U=G=class extends M{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._attachmentFileInfos=new Map,this._highlightHandles=new Map,this._preventDefaultActionOnCancel=!1,this._lastActiveGraphics=[]}get numPendingFeatures(){return this.data.viewModel.sketchViewModel.layer.graphics.length}get pendingFeatures(){return this.data.viewModel.sketchViewModel.layer.graphics}get reliesOnOwnerAdminPrivileges(){const{layer:e}=this.data.creationInfo,t=e.capabilities?.operations.supportsAdd,a=m(e)?.operations.supportsAdd;return w(e)&&!e.editingEnabled||!!a&&!t}get shouldShowAttachments(){return!!(this.data&&this.data.creationInfo&&this.data.viewModel)&&_(this.data)}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get helpMessage(){if("creating-features"!==this.stepId)return;const{creationInfo:e,viewModel:t}=this.data;return g(e.layer.geometryType,t.sketchViewModel.createGraphic?.geometry)}async updatePendingFeature(e,a){return this._preventDefaultActionOnCancel=!0,this.data.viewModel.sketchViewModel.cancel(),t(this._lastActiveGraphics,e),this._startUpdating(e,a)}static create(e,t,a,i,o){const s=new G({data:new y({creationInfo:r(t),viewModel:e}),onCommit:async e=>{const t=e.viewModel.sketchViewModel.layer.graphics.toArray(),a=e.creationInfo.layer,r=a.capabilities.editing.supportsGlobalId&&"globalIdField"in a,n=s._attachmentFileInfos;if(0===n.size)return void await i(a,{addFeatures:t});if(r){const e=s._getAttachmentEditsWithGlobalIds(t,a,n),r="addAttachments"in e?{globalIdUsed:!0}:void 0;return void await i(a,e,r)}const{addFeatureResults:l}=await i(a,{addFeatures:t}),c=s._getAddAttachmentsData(t,l,a,n);await o(a,c)}});return s._set("steps",this._createWorkflowSteps(s,a)),s}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",a((()=>e.effect=t))}const t=e.opacity;return e.opacity=.7,a((()=>e.opacity=t))}_highlight(e){const t=this.data.viewModel.view;"3d"===t?.type&&this._highlightHandles.set(e,t.highlight(e))}_removeHighlight(e){o(this._highlightHandles.get(e)),this._highlightHandles.delete(e)}async _startCreating(e){return this.createFeatureState="create-new",A(this.data.viewModel.sketchViewModel,this.data.creationInfo,e)}async _startUpdating(e,t){const{featureFormViewModel:a,layerInfos:r,sketchViewModel:n,view:l}=this.data.viewModel;if(!l)return;const c=this.data.creationInfo.layer,d=b(r,c)?.formTemplate,u=l.spatialReference;return a.set({arcadeEditType:"INSERT",feature:e,formTemplate:d,spatialReference:u,view:l}),o(this._featureFormHandle),this._featureFormHandle=i([a.on("value-change",(async()=>{e.attributes=a.getValues(),await F(e,t)})),n.on(["update","undo","redo"],(e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&s(e.toolEventInfo)&&V(e.toolEventInfo.type))&&a.notifyFeatureGeometryChanged()}))]),this._removeHighlight(e),this.createFeatureState="update-pending",this._visualVariableAttributes=I(e),k(n,e,c,this._visualVariableAttributes,t)}static _createWorkflowSteps(e,i="awaiting-feature-creation-info"){const{data:r,handles:h}=e;let p=null,f=!0;const m=new Map,w=S(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],i,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){r.creationInfo=null,h.add(r.viewModel.featureTemplatesViewModel.on("select",(({item:e})=>{e&&(r.creationInfo=e,r.viewModel.activeWorkflow?.next())})),this.id)},async tearDown(){h.remove(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){if(h.has(this.id))return;const i=r.viewModel.view;if(!i)return;const w=r.viewModel.sketchViewModel;f=w.updateOnGraphicClick,w.updateOnGraphicClick=!1,e._lastActiveGraphics=[],e._featureFormHandle=o(e._featureFormHandle),e._visualVariableAttributes={rotation:null,size:null},C(r.viewModel.attachmentsViewModel);const g="2d"===i.type?e._fadeExistingFeatures(r.creationInfo.layer):null,y=w.on("create",(async t=>{if("cancel"===t.state){if(e._preventDefaultActionOnCancel)return void(e._preventDefaultActionOnCancel=!1);if(e._lastActiveGraphics.length<1)return e._startCreating(m);const t=e._lastActiveGraphics.pop();return e._startUpdating(t,m)}if("complete"===t.state&&t.graphic)return e._startUpdating(t.graphic,m)})),M=w.on("update",(async t=>{const o=t.graphics[0];if("complete"===t.state){if(o!==p&&(e._lastActiveGraphics.push(o),e._highlight(o)),p=null,"add"!==r.viewModel.attachmentsViewModel.mode&&"edit"!==r.viewModel.attachmentsViewModel.mode||r.viewModel.activeWorkflow?.previous(),t.aborted&&e._preventDefaultActionOnCancel)return void(e._preventDefaultActionOnCancel=!1);const s=i.cursor;return i.cursor="progress",h.add([a((()=>i.cursor=s)),i.on("click",(e=>e.preventDefault()))],O),c((()=>!r.viewModel.featureFormViewModel.updating)).then((()=>{h.remove(O),e._startCreating(m)}))}if("start"===t.state){e._removeHighlight(o);const t=r.viewModel.attachmentsViewModel;"add"!==t.mode&&"edit"!==t.mode||r.viewModel.activeWorkflow?.previous(),t.fileInfos.removeAll(),t.graphic=o,t.mode="view";(e._attachmentFileInfos.get(o)||[]).forEach((({file:e,form:a})=>t.addFile(e,a)))}await E(i,o,t,e._visualVariableAttributes,m);const n=o.attributes;if(s(e._visualVariableAttributes.rotation)){const{field:t}=e._visualVariableAttributes.rotation;r.viewModel.featureFormViewModel.setValue(t,n[t])}if(s(e._visualVariableAttributes.size)){const{field:t}=e._visualVariableAttributes.size;r.viewModel.featureFormViewModel.setValue(t,n[t])}})),_=w.on("delete",(async a=>{const i=a.graphics[0];t(e._lastActiveGraphics,i),p=i}));let A=null;const b=d((()=>{const e=w.snappingOptions.featureSources.find((e=>e.layer===r.creationInfo.layer));return{hasFeatureLayerSource:!!e,enabled:e?.enabled??!1}}),(({hasFeatureLayerSource:e,enabled:t})=>{const a=w.snappingOptions.featureSources;e?(n(A)&&(A=new v({layer:w.layer,enabled:t}),a.add(A)),A.enabled=t):(s(A)&&a.remove(A),A=l(A))}),u),F=i.on("immediate-click",(async t=>{const{results:a}=await i.hitTest(t,{include:w.layer}),r=a.find((e=>"graphic"===e.type));if(r){const t=r.graphic;if("transform"===w.activeTool||"reshape"===w.activeTool){if(w.updateGraphics.getItemAt(0)===t)return;await e.updatePendingFeature(t,m)}}})),V=d((()=>r.viewModel.attachmentsViewModel.mode),(e=>{"add"===e&&r.viewModel.activeWorkflow.go("adding-attachment"),"edit"===e&&r.viewModel.activeWorkflow.go("editing-attachment")}));await e._startCreating(m);const I={remove:()=>{o(e._featureFormHandle),y.remove(),M.remove(),_.remove(),b.remove(),s(A)&&w.snappingOptions.featureSources.remove(A),A=l(A),w.cancel(),F.remove(),V.remove(),o(g)}};h.add(I,this.id)},async tearDown(t){t.cancelled&&(r.viewModel.sketchViewModel.layer.removeAll(),h.remove([this.id,O]),r.viewModel.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear(),r.viewModel.sketchViewModel.updateOnGraphicClick=f)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{graphic:t,fileInfos:a}=r.viewModel.attachmentsViewModel;e._attachmentFileInfos.set(t,a.toArray()),r.viewModel.attachmentsViewModel.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{graphic:t,fileInfos:a}=r.viewModel.attachmentsViewModel;e._attachmentFileInfos.set(t,a.toArray()),r.viewModel.attachmentsViewModel.mode="view"}})});return j(r,w)}_getAddAttachmentsData(e,t,a,i){const r=[];return t.forEach(((t,o)=>{if(!t.error){const s=e[o],n=i.get(s)||[];s.attributes[a.objectIdField]=t.objectId,n.forEach((({form:e})=>r.push({feature:s,attachment:e})))}})),r}_getAttachmentEditsWithGlobalIds(e,t,a){const i=[],r=t.globalIdField;return e.forEach(((t,o)=>{const s=a.get(t)||[];let l=t.attributes[r];n(l)&&(l=h(),e[o].attributes[r]=l),s.forEach((({file:e})=>i.push({feature:t,attachment:{globalId:h(),data:e}})))})),i.length?{addFeatures:e,addAttachments:i}:{addFeatures:e}}};e([p()],U.prototype,"reliesOnOwnerAdminPrivileges",null),e([p()],U.prototype,"shouldShowAttachments",null),e([p()],U.prototype,"shouldAllowAttachmentEditing",null),e([p()],U.prototype,"helpMessage",null),U=G=e([f("esri.widgets.Editor.CreateFeaturesWorkflow")],U);const D=U;export{D as default};
|