@arcgis/core 4.34.0-next.59 → 4.34.0-next.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/VolumeMeasurementAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/007721d1d99233046420.js +1 -0
- package/assets/esri/core/workers/chunks/{03fe4164abd12abc7921.js → 0468266dfe15ec41d60a.js} +1 -1
- package/assets/esri/core/workers/chunks/08d420cd7cfa19a10fa4.js +1 -0
- package/assets/esri/core/workers/chunks/{d91b80aa4f847c2e2a33.js → 0ff8b28a34b1825c227d.js} +1 -1
- package/assets/esri/core/workers/chunks/{b29144ee58b43f769d9a.js → 2d74af2b383187bd59c3.js} +1 -1
- package/assets/esri/core/workers/chunks/3124a8516e815efec973.js +1 -0
- package/assets/esri/core/workers/chunks/3461701a15be46603c56.js +1 -0
- package/assets/esri/core/workers/chunks/{1612d1c1d78c122dfef6.js → 36acf191a2d48560c796.js} +1 -1
- package/assets/esri/core/workers/chunks/{27334cda1b877abcba1b.js → 40e1fbfbf3f3979b3713.js} +1 -1
- package/assets/esri/core/workers/chunks/{4dee2f05508e90410f13.js → 4d8d942fbd6750bb7567.js} +1 -1
- package/assets/esri/core/workers/chunks/{94b9948ec628187c19fc.js → 4e21a1116be0d6340163.js} +1 -1
- package/assets/esri/core/workers/chunks/5915f5ba9064097aee79.js +1 -0
- package/assets/esri/core/workers/chunks/702d2c668dedf83421ca.js +1 -0
- package/assets/esri/core/workers/chunks/7b2ec80dca0fdb0442cf.js +1 -0
- package/assets/esri/core/workers/chunks/abededd48e0ea6cfec01.js +1 -0
- package/assets/esri/core/workers/chunks/c1c6202f7bef24b5db26.js +1 -0
- package/assets/esri/core/workers/chunks/{3f634580055b30dbfc8e.js → c77a97c723b8c17df186.js} +1 -1
- package/assets/esri/core/workers/chunks/{bf6b76027c60b4ffa507.js → d2bdd52d2291306a4e47.js} +1 -1
- package/assets/esri/core/workers/chunks/{81eb7785d626aa975033.js → d47c3431c501d77b1779.js} +1 -1
- package/assets/esri/core/workers/chunks/eccb4550edc4752cf41a.js +1 -0
- package/assets/esri/core/workers/chunks/{3e7c9a43e52ed6a1b018.js → f462a138912e5379b6a7.js} +1 -1
- package/chunks/GeodeticUtils.js +5 -0
- package/config.js +1 -1
- package/core/quantityUtils.js +1 -1
- package/core/unitUtils.js +1 -1
- package/core/units.d.ts +1 -0
- package/geometry/operators/geodeticUtilsOperator.js +5 -0
- package/geometry/operators/gx/geodeticUtils.js +5 -0
- package/graphic/CSVGraphicOrigin.js +1 -1
- package/graphic/CatalogGraphicOrigin.js +1 -1
- package/graphic/FeatureGraphicOrigin.js +1 -1
- package/graphic/GeoJSONGraphicOrigin.js +1 -1
- package/graphic/KnowledgeGraphGraphicOrigin.js +1 -1
- package/graphic/OGCFeatureGraphicOrigin.js +1 -1
- package/graphic/OrientedImageryGraphicOrigin.js +1 -1
- package/graphic/ParquetGraphicOrigin.js +1 -1
- package/graphic/StreamGraphicOrigin.js +1 -1
- package/graphic/SubtypeGroupGraphicOrigin.js +1 -1
- package/graphic/WCSGraphicOrigin.d.ts +4 -0
- package/graphic/WFSGraphicOrigin.js +1 -1
- package/graphic/isPopupProviderGraphicOrigin.js +5 -0
- package/interfaces.d.ts +128 -41
- package/kernel.js +1 -1
- package/layers/ImageryLayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/support/featurePopupQueryUtils.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementResult.d.ts +4 -0
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementResult.js +5 -0
- package/views/3d/analysis/VolumeMeasurement/volumeMeasurementUtils.js +5 -0
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutputConfiguration.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/1c61cf137a989bc52bb8.js +0 -1
- package/assets/esri/core/workers/chunks/462b30fc40a5f337ba10.js +0 -1
- package/assets/esri/core/workers/chunks/781e424a383c71ca904d.js +0 -1
- package/assets/esri/core/workers/chunks/83dfaa6e3bd58d544f35.js +0 -1
- package/assets/esri/core/workers/chunks/94f1005222bff1870ef1.js +0 -1
- package/assets/esri/core/workers/chunks/a16b471c3706ee37f9b6.js +0 -1
- package/assets/esri/core/workers/chunks/abe60d92e0219ee97036.js +0 -1
- package/assets/esri/core/workers/chunks/af5ae7c36e1178077cbc.js +0 -1
- package/assets/esri/core/workers/chunks/bb67d491f62a5cce96cd.js +0 -1
- package/assets/esri/core/workers/chunks/f718f630a8b81496c646.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import i from"../../request.js";import{deprecatedFunction as r}from"../../core/deprecate.js";import s from"../../core/Error.js";import{clone as n}from"../../core/lang.js";import a from"../../core/Logger.js";import{watch as o}from"../../core/reactiveUtils.js";import{urlToObject as l}from"../../core/urlUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import{Integer as p,ensureRange as m,ensureClass as c,ensureNumber as h}from"../../core/accessorSupport/ensureType.js";import{reader as d}from"../../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{writer as g}from"../../core/accessorSupport/decorators/writer.js";import y from"../../geometry/Extent.js";import R from"../../geometry/Polygon.js";import I from"../../geometry/SpatialReference.js";import{srToRESTValue as v}from"../../geometry/support/spatialReferenceUtils.js";import{opacity as w,url as b}from"../support/commonProperties.js";import S from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as x}from"../support/ExportImageServiceParameters.js";import _ from"../support/Field.js";import F from"../support/FieldsIndex.js";import{createBitmap as D}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as O}from"../support/imageryRendererUtils.js";import T from"../support/MosaicRule.js";import C from"../support/MultidimensionalSubset.js";import M from"../support/PixelBlock.js";import{interpolationKebab as P,noDataInterpretationKebab as N,pixelTypeKebabDict as q}from"../support/rasterEnums.js";import{getServicePixelValueField as j,getItemPixelValueField as A,getRawServicePixelValueField as E,getProcessedServicePixelValueField as V,getMagnitudeField as Q,getDirectionField as J,getMultidimensionalFields as U,getRasterAttributeTableFields as B,commonRasterFieldNames as L,addMultidimensionalFieldValues as z,rasterFieldPrefix as H}from"../support/rasterFieldUtils.js";import G from"../support/RasterFunction.js";import k from"../support/RasterInfo.js";import{intersectMultimensionalSubset as W,getEffectiveMultidimensionalDefinition as $,getSubsetVariablesFromMdInfo as X,getDefaultMultidimensionalDefinition as K}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as Y,getFormat as Z}from"../support/rasterFormats/RasterCodec.js";import{highlightPixels as ee}from"../support/rasterFunctions/pixelUtils.js";import{uvComponentToVector as te}from"../support/rasterFunctions/vectorFieldUtils.js";import{createDefaultRenderer as ie,getSupportedRendererTypes as re,matchPresetRenderer as se,getDefaultBandCombination as ne,normalizeRendererJSON as ae}from"../../renderers/support/rasterRendererHelper.js";import oe from"../../renderers/support/RasterSymbolizer.js";import{websceneRasterRendererTypes as le,rasterRendererTypes as ue,read as pe}from"../../renderers/support/rasterTypeUtils.js";import{calculateVolume as me,computeAngles as ce,computePixelSpaceLocations as he,computeHistograms as de,computeStatisticsHistograms as fe,measureHeight as ge,measureAreaAndPerimeter as ye,measureDistanceAndAngle as Re,measurePointOrCentroid as Ie,measureLengthFromImage as ve,measureAreaFromImage as we,getImageSpatialReferenceQueryParameter as be,getSamples as Se,identify as xe,imageToMap as _e,imageToMapMultiray as Fe,mapToImage as De,findImages as Oe,getImageUrl as Te,queryBoundary as Ce,queryGPSInfo as Me}from"../../rest/imageService.js";import{fetchServiceRasterInfo as Pe,generateRasterInfo as Ne,patchServiceInfo as qe}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as je}from"../../rest/imageService/getCatalogItemRasterInfo.js";import{executeForCount as Ae}from"../../rest/query/executeForCount.js";import{executeForIds as Ee}from"../../rest/query/executeForIds.js";import{executeQueryJSON as Ve}from"../../rest/query/executeQueryJSON.js";import Qe from"../../rest/support/FeatureSet.js";import Je from"../../rest/support/ImageIdentifyParameters.js";import Ue from"../../rest/support/Query.js";const Be=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Le=m(h,{min:0,max:255});function ze(e){const t=JSON.stringify(e),i=t.includes('"rasterFunctionDefinition":{'),r=i?t.match(/"type":"(.*?FunctionArguments")/gi):t.match(/"rasterFunction":"(.*?")/gi),s=r?.map(e=>i?e.slice(8,-18):e.slice(18,-1));return s?s.join("/"):null}const He=m=>{const h=m;let He=class extends h{constructor(){super(...arguments),this._functionRasterInfos={},this._serviceSupportsMosaicRule=null,this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new x({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach(t=>{e.set(t.name.toLowerCase().replaceAll(/ /gi,"_"),t.name)}),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every(e=>"number"==typeof e))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,i){null!=e&&"lerc"!==this.format&&(t[i]=e)}writeCompressionTolerance(e,t,i){"lerc"===this.format&&null!=e&&(t[i]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?T.fromJSON(t):null}get fieldsIndex(){return this.fields?new F(this.fields):null}set format(e){e&&Be.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t?.mosaicMethod&&(t=T.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?T.fromJSON(i):this._isMosaicRuleSupported(t)?T.fromJSON(t):null}writeMosaicRule(e,t,i){const{mosaicRule:r}=this;this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=Le(e))}readObjectIdField(e,t){if(!e){const i=t.fields.find(e=>"esriFieldTypeOID"===e.type||"oid"===e.type);e=i?.name}return e}get parsedUrl(){return l(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}get renderer(){const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const i=t?.find(({name:t})=>t===e);return i?.renderer.clone()}return this.internalRenderer}set renderer(e){this.activePresetRendererName=null,this.internalRenderer=e}set internalRenderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("internalRenderer",e)}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer,s=pe(r,i);return null==s?null:("vector-field"===s.type&&t.symbolTileSize&&!r.symbolTileSize&&(s.symbolTileSize=t.symbolTileSize),O(s)||a.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),s)}writeRenderer(e,t,i){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this.fields?.map(e=>e.clone())??[];e.push(j()),"mosaic-dataset"===this.sourceType&&this.fields?.length&&e.push(A()),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some(({name:e})=>"none"===e.toLowerCase())&&e.push(E()),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter(({name:e})=>"none"!==e.toLowerCase()).forEach(({name:t})=>e.push(V(t)));const{rasterInfo:t}=this;if(this._isVectorDataSet()){const i=t?.multidimensionalInfo?.variables[0].unit?.trim(),r=Q(i),s=J();e.push(r,s)}if(t?.multidimensionalInfo&&"raster-dataset"===this.sourceType){const i=U(t.multidimensionalInfo);e.push(...i)}const i=t?.attributeTable;if(null!=i){const t=B(i);e.push(...t)}return e}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=G.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i?.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?G.fromJSON({rasterFunctionDefinition:t.renderingRule}):G.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?I.fromJSON(i):null}writePixelType(e,t,i){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[i]=q.toJSON(e))}readVersion(e,t){let i=t.currentVersion;return i||(i=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),i}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let i=e,{renderer:r,symbolizer:s,pixelFilter:n}=this;const{isRawData:a}=e;if(a&&"lerc"!==this.format&&(r??=ie(this.rasterInfo,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}),s||(this.symbolizer=new oe({rendererJSON:r.toJSON(),rasterInfo:this.rasterInfo}),s=this.symbolizer)),(a||!this._isPicture())&&r&&s&&!n){await this._updateSymbolizer(s,r);const{bandIds:n}=this;i=await this._symbolize({pixelData:e,bandIds:n,symbolizer:s},t)}return i}async highlightPixels(e,t){const i=e.highlightOptions.map(e=>{const t={...e},{bandId:i}=t;if(null==i)t.bandId=0;else{const e=this.bandIds?.length?this.bandIds.indexOf(i):i;if(e<0||e>2)return;t.bandId=e}return t}).filter(e=>null!=e),r=this._rasterJobHandler;r?await r.highlightPixels({...e,highlightOptions:i},t):ee(e.pixelBlock,e.renderedPixelBlock,i)}destroy(){this._shutdownJobHandler()}async calculateVolume(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsCalculateVolume)throw new s("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=n(e),this.mosaicRule&&null==e.mosaicRule&&(e.mosaicRule=this.mosaicRule),me(this.url,e,this._getRequestOptions(t))}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new s("imagery-layer:compute-angles","this operation is not supported on the input image service");return ce(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new s("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return he(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new s("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=n(e),this._applyMosaicAndRenderingRules(e),de(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new s("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=n(e),this._applyMosaicAndRenderingRules(e),fe(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 s("imagery-layer:measure-height","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),ge(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 s("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),ye(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 s("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),Re(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 s("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),Ie(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new s("imagery-layer:measure-length-from-image","this operation is not supported on the input image service");if("polyline"!==e.geometry.type)throw new s("imagery-layer:measure-length-from-image","this input geometry must be a polyline");return ve(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new s("imagery-layer:measure-area-from-image","this operation is not supported on the input image service");if("polygon"!==e.geometry.type)throw new s("imagery-layer:measure-area-from-image","this input geometry must be a polygon");return we(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}fetchImage(e,t,i,n={}){if(r(a.getLogger(this),"`ImageryLayer.fetchImage` is deprecated in favor of 'ImageryLayer.fetchPixels'.",{replacement:"ImageryLayer.fetchPixels",version:"4.33",warnOnce:!0}),null==e||null==t||null==i)throw new s("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");return this.internalFetchImage(e,t,i,n)}async internalFetchImage(e,t,i,r={}){await this._updateCurrentRasterInfo();const{exportImageServiceParameters:s}=this;let n=!1;r.requestRawData&&(await this._initJobHandler(),s.requestRawData||"lerc"===this.format||(n=!0,s.requestRawData=!0));const a=this.getExportImageServiceParameters(e,t,i,r.timeExtent);if(n&&(s.requestRawData=!1),null==a){if(r.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=i,r.returnImageBitmap){return{imageBitmap:await D(e,`${Ge(this.parsedUrl)}/exportImage`,r.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,a=(s?.length||n.bandCount)??0,o=t*i,l=n.pixelType,u=[];for(let e=0;e<a;e++)u.push(M.createEmptyBand(l,o));return{pixelData:{pixelBlock:new M({width:t,height:i,pixels:u,mask:new Uint8Array(o),pixelType:l}),extent:e}}}const o=!!r.requestAsImageElement&&!this.pixelFilter,l=o&&!!r.returnImageBitmap,u={imageServiceParameters:a,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:o,returnImageBitmap:l,signal:r.signal};return this._requestArrayBuffer(u)}async fetchPixels(e,t,i,r={}){await this._initJobHandler(),r.applyRendering&&this._updateCurrentRasterInfo();const s=r.applyRendering?void 0:new x({layer:this,requestRawData:!0,interpolation:r.interpolation??"nearest",bandIds:r.bandIds??[]}),n=this.getExportImageServiceParameters(e,t,i,r.timeExtent,s);if(null==n)return{extent:e,pixelBlock:null};delete n.pixelType,delete n.bandIds,delete n.compressionQuality;const a={imageServiceParameters:n,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:!1,returnImageBitmap:!1,signal:r.signal},{pixelData:o}=await this._requestArrayBuffer(a);return o??{extent:e,pixelBlock:null}}fetchKeyProperties(e){return i(Ge(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>e.data)}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new s("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):i(Ge(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>Qe.fromJSON(e.data))}getCatalogItemRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return je(Ge(this.parsedUrl),e,i)}async getCatalogItemICSInfo(e,t){const{data:r}=await i(Ge(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),s=r?.ics;if(!s)return;let n=null;try{n=(await i(Ge(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!n?.spatialReference)return{ics:s,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?i(Ge(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then(e=>e.data).catch(()=>({})):{},o=n.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[n]}),inSR:v(o),outSR:"0:"+e},u=i(Ge(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then(e=>e.data).catch(()=>({})),p=5,m=(n.xmin+n.xmax)/2,c=(n.ymax-n.ymin)/(p+1),h=n.ymin+c,d=[];for(let i=0;i<p;i++)d.push({x:m,y:h+c*i});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:d}),inSR:v(o),outSR:"0:"+e},g=i(Ge(this.parsedUrl)+"/project",{query:this._getQueryParams(f),...t}).then(e=>e.data).catch(()=>({})),R=await Promise.all([a,u,g]);let w=R[0].ipxf;if(null==w){const e=s.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(w={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const b=y.fromJSON(R[1]?.geometries?.[0]);b&&(b.spatialReference=new I({wkid:0,imageCoordinateSystem:s}));const S=R[2].geometries?R[2].geometries.filter(e=>null!=e?.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y):[],x=S.length;if(x<3)return{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:null};let _=0,F=0,D=0,O=0;for(let i=0;i<x;i++)_+=S[i].x,F+=S[i].y,D+=S[i].x*S[i].x,O+=S[i].x*S[i].y;const T=(x*O-_*F)/(x*D-_*_);let C=0;const M=S[p-1].x>S[0].x,P=S[p-1].y>S[0].y;return T===1/0?C=P?90:270:0===T?C=M?0:180:T>0?C=M?180*Math.atan(T)/Math.PI:180*Math.atan(T)/Math.PI+180:T<0&&(C=P?180+180*Math.atan(T)/Math.PI:360+180*Math.atan(T)/Math.PI),{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:C}}async generateRasterInfo(e,t){e=c(G,e);const i={...t,query:this._getQueryParams()};if(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))return this.serviceRasterInfo??Pe(Ge(this.parsedUrl),this.sourceJSON,i);const r=ze(e);if(!r)throw new s("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const n=Ne(Ge(this.parsedUrl),e,i);this._functionRasterInfos[r]=n;try{return await n}catch(a){throw this._functionRasterInfos[r]=null,a}}getExportImageServiceParameters(e,t,i,r,s){e=e.clone().shiftCentralMeridian();const n=be(e.spatialReference,Ge(this.parsedUrl));s??=this.exportImageServiceParameters;const a=s.toJSON(),{bandIds:o,noData:l}=a;let{renderingRule:u}=a;const p=this.rasterFunction?.rasterFunctionDefinition,m=this.renderer?.type,c=!m||"raster-stretch"===m||"raster-colormap"===m||"unique-value"===m||"class-breaks"===m||"raster-shaded-relief"===m;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!p&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===u.rasterFunction)e.rasterFunctionArguments.Raster=u.rasterFunctionArguments.Raster,u.rasterFunctionArguments.Raster=e;else if("Colormap"===u.rasterFunction){const t=u.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,u.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=u,u=e;a.bandIds=void 0}else a.bandIds=o?.join(",");Array.isArray(l)&&l.length>0&&(a.noData=l.join(","));const h=this._processMultidimensionalIntersection(null,r,s.mosaicRule);if(h.isOutSide)return null;a.mosaicRule=null!=h.mosaicRule?JSON.stringify(h.mosaicRule):null,r=h.timeExtent,a.renderingRule=this._getRenderingRuleString(G.fromJSON(u));const d={};if(null!=r){const{start:e,end:t}=r.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+i,...a,...d}}async getSamples(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i?.operations.supportsGetSamples)throw new s("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=n(e);const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),Se(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new s("imagery-layer:identify","identify operation is not supported on the input image service");e=n(e),this.version<10.91&&"extent"===e.geometry?.type&&(e.geometry=R.fromExtent(e.geometry));const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new s("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=i.timeExtent,e.mosaicRule=i.mosaicRule;const{raster:r,rasterFunction:a}=this;return a&&null==e.rasterFunction&&(e.rasterFunction=a),r&&null==e.raster&&(e.raster=r),xe(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new s("imagery-layer:image-to-map","imageToMap operation is not supported on the input image service");return _e(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new s("imagery-layer:image-to-map-multiray","imageToMapMultiray operation is not supported on the input image service");return Fe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new s("imagery-layer:map-to-image","mapToImage operation is not supported on the input image service");return De(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new s("imagery-layer:find-images","findImages operation is not supported on the input image service");return Oe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new s("imagery-layer:get-image-url","getImageUrl operation is not supported on the input image service");return Te(Ge(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){return new Ue({outFields:["*"],returnGeometry:!0,where:this.definitionExpression||"1=1"})}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new s("imagery-layer:query-boundary","queryBoundary operation is not supported on the input image service");return e=e??{outSpatialReference:this.spatialReference},Ce(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Ve(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Ee(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new s("imagery-layer:query-gps-info","queryGPSInfo operation is not supported on the input image service");return e=e??{where:"1=1"},Me(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Ae(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new s("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:r,returnTopmostRaster:n,showNoDataRecords:a}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const p=L.servicePixelValue.toLowerCase(),m=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some(e=>!e.toLowerCase().startsWith(p)),this.version>=10.4)){const t=e.outFields.filter(e=>e.toLowerCase().startsWith(p)&&e.length>p.length).map(e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,m),t]});l=t.map(e=>new G({functionName:e[0]})),u=t.map(e=>e[1]);const{rasterFunction:i}=this;0===l.length?i?.functionName?(l.push(i),u.push(i.functionName)):l=null:i?.functionName&&!l.some(e=>e.functionName===i.functionName)&&(l.push(i),u.push(i.functionName))}const c=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:h}=this;let d=e.timeExtent||this.timeExtent;if(h){const{isOutside:t,intersection:i}=W(h,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new s("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");null!=i?.timeExtent&&(d=i.timeExtent)}const f=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,d);let g=e.geometry;this.version<10.91&&"extent"===g?.type&&(g=R.fromExtent(g));const y=this._getQueryParams({geometry:g,timeExtent:d,mosaicRule:f,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:i,returnCatalogItems:o,returnGeometry:c,raster:this.raster,maxItemCount:n?1:null});delete y.f;const I=new Je(y);try{await this._generateRasterInfo(this.rasterFunction);const i=await xe(this.url,I,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,n=null!=i.value&&i.value.toLowerCase().includes("nodata"),l=o&&!c&&i?.catalogItems?.features.length&&(a||!n),p=this.multidimensionalInfo&&"raster-dataset"===this.sourceType?$({rasterInfo:this.rasterInfo,multidimensionalDefinition:f?.multidimensionalDefinition,timeExtent:d,multidimensionalSubset:this.multidimensionalSubset}):null;if(!l)return this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:s,effectiveMultidimensionalDefinition:p});const m=this.objectIdField||"ObjectId",h=i.catalogItems?.features??[],g=h.map(e=>e.attributes?.[m]),y=new Ue({objectIds:g,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[m]}),R=await this.queryRasters(y);return R?.features?.length&&R.features.forEach(t=>{h.forEach(i=>{i.attributes[m]===t.attributes[m]&&t.geometry&&(i.geometry=t.geometry.clone(),null!=e.outSpatialReference&&(i.geometry.spatialReference=e.outSpatialReference))})}),this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:s,effectiveMultidimensionalDefinition:p})}catch{throw new s("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=i(Ge(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.statistics),s=i(Ge(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.histograms),n=await Promise.all([r,s]);return n[0]&&n[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),{statistics:n[0]||null,histograms:n[1]||null}}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return X(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,i=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):Pe(Ge(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then(e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),qe(e,t),e)),r=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([i,r,s]).then(e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.internalRenderer&&!this._isSupportedRenderer(this.internalRenderer)&&(this._set("internalRenderer",null),a.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("internalRenderer",this._configRenderer(this.renderer)),this.addHandles([o(()=>this.rasterFunction,e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then(e=>{e&&(this.rasterInfo=e)})})]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)})}_combineMosaicRuleWithTimeExtent(e,t){const i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(null==e||null==r||null==t||null==i?.startField)return e;const{startField:s}=i,n=r.variables.some(e=>e.dimensions.some(e=>e.name===s))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter(e=>e.dimensionName!==n),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const a=e.multidimensionalDefinition.filter(e=>e.dimensionName===n),o=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==o||null==l||o===l,p=u?[o||l]:[[o,l]],m=this.version>=10.8;if(a.length)a.forEach(e=>{e.dimensionName===n&&(m?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))});else if(!m){const t=e.multidimensionalDefinition.filter(e=>null!=e.variableName&&null==e.dimensionName);t.length?t.forEach(e=>{e.dimensionName=n,e.isSlice=u,e.values=p}):e.multidimensionalDefinition.push(new S({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter(e=>!(!e.variableName&&!e.dimensionName)),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new s("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?c(Ue,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:i}=this;return"unique-value"===e.type&&this._hasRasterFunction(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&re(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:s}=await i(Ge(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,s&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map(e=>e.trim()).indexOf("tilesonly")>-1)throw new s("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||i}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:i}=e,r="resample"===t?.toLowerCase(),s=i?.ResampleType||i?.resampleType;return r&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:i}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){const t=this.mosaicRule?.multidimensionalDefinition?.[0].variableName,r=se({variableName:t,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&i.bandCount>=3){const e=r?.bandIds??ne(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=r?.renderer??ie(i,{bandIds:this.bandIds,variableName:this.rasterFunction?null:t}));const s=ae(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=i):this.symbolizer=new oe({rendererJSON:s,rasterInfo:i}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){null!=e?.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:i}=this;return{raster:t,viewId:i,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,i){return this._rasterJobHandler?this._rasterJobHandler.decode({data:e,options:t}):Y(e,t,i)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const r=await i(Ge(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,returnImageBitmap:n,signal:a}=e;if(r&&this._canRequestImageElement(t.format)){const r=`${Ge(this.parsedUrl)}/exportImage`,{data:s}=await i(r,{responseType:n?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:a});if(s instanceof Blob){return{imageBitmap:await D(s,r,a),params:t}}return{imageOrCanvasElement:s,params:t}}const o=this._initJobHandler(),l=i(Ge(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:a}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let m=p;if("bsq"!==m&&"bip"!==m&&(m=Z(u)),!m)throw new s("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const c={signal:a},h="gif"===p||"bmp"===p||p.includes("png")&&("png"===m||"jpg"===m)?Y(u,{useCanvas:!0,...t},c):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},c);return{pixelData:{pixelBlock:await h,extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch(()=>null)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=K(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new T;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&t.forEach(e=>e.variableName=""),t=t.filter(({variableName:e,dimensionName:t})=>e&&"*"!==e||t),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,i){i=i||{};const r=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=i,l=e.processedValues;let u=e.catalogItems?.features,p=e.properties?.Values?.map(e=>e.replaceAll(/ /gi,", "))||[];const m=this.objectIdField||"ObjectId",c="string"==typeof r&&r.toLowerCase().includes("nodata"),h=[];if(r&&!u&&(!c||n)){const e={};e[m]=0;p=[r],u=[new t({geometry:this.fullExtent,attributes:e})],this.multidimensionalInfo&&"raster-dataset"===this.sourceType&&z(this.rasterFields,e,i.effectiveMultidimensionalDefinition)}if(!u)return[];this._updateResponseFieldNames(u,o),c&&!n&&(u=[]);const{itemPixelValue:d,servicePixelValue:f}=L,g=this.rasterFields.some(e=>e.name===d),y=this.graphicOrigin;for(let t=0;t<u.length;t++){const e=u[t];if(null!=r){const i=p[t],a=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:r;if("nodata"===i.toLowerCase()&&!n)continue;g&&(e.attributes[d]=i),e.attributes[f]=a,this._updateFeatureWithMagDirValues(e,i);const o=this.fields&&this.fields.length>0;let u=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?i:r:a;this.rasterFunction||(u=o?i:r),this._updateFeatureWithRasterAttributeTableValues(e,u)}if(e.sourceLayer=e.layer=this,e.origin=y,a&&this._updateFeatureWithDomainValues(e),s&&l&&s.length===l.length)for(let t=0;t<s.length;t++){const i=`${L.servicePixelValue}.${s[t]}`;e.attributes[i]=l[t]}h.push(u[t])}return h}_processMultidimensionalIntersection(e,t,i){const{multidimensionalSubset:r}=this;if(!r)return{isOutSide:!1,timeExtent:t,mosaicRule:i=this._combineMosaicRuleWithTimeExtent(i,t)};if(r){const{isOutside:i,intersection:s}=W(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};null!=s?.timeExtent&&(t=s.timeExtent)}if(i=this._combineMosaicRuleWithTimeExtent(i,t),i?.multidimensionalDefinition){const{isOutside:e}=W(r,{multidimensionalDefinition:i.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:i}}_updateFeatureWithRasterAttributeTableValues(e,t){const i=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==i)return;const{features:r,fields:s}=i,n=s.map(e=>e.name).find(e=>"value"===e.toLowerCase());if(!n)return;const a=r.filter(e=>e.attributes[n]===(null!=t?parseInt(t,10):null));a&&a[0]&&s.forEach(t=>{const i=H+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 M({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new y(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:te([n.pixels[0][0],n.pixels[1][0]]);e.attributes[L.magnitude]=a[0],e.attributes[L.direction]=a[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter(e=>e.domain&&"coded-value"===e.domain.type);null!=t&&t.forEach(t=>{const i=e.attributes[t.name];if(null!=i){const r=t.domain.codedValues.find(e=>e.code===i);r&&(e.attributes[t.name]=r.name)}})}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const i=this.fieldsIndex;null!=i&&e.forEach(e=>{if(e?.attributes)for(const r of t){const t=i.get(r)?.name;t&&t!==r&&(e.attributes[r]=e.attributes[t],delete e.attributes[t])}})}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return null!=e?.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const i=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(i)?t.get(i):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:i,rasterFunction:r}=this;r&&null==e.rasterFunction&&(e.rasterFunction=r),i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}async _updateCurrentRasterInfo(e){if(this.renderer||this.symbolizer){const t=await this._generateRasterInfo(this.rasterFunction,{signal:e});t&&(this.rasterInfo=t)}}_applyMosaicRule(e){const{raster:t,mosaicRule:i}=this;i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map(e=>e.trim()):["image","catalog"],{currentVersion:i,maxRecordCount:r}=e,s=t.includes("image"),n="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!(!e.spatialReference&&!e.extent?.spatialReference),o=t.includes("edit"),l=t.includes("mensuration")&&a,u=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map(e=>e.trim()),p=l&&u.includes("basic"),m=this._isMosaicDataset(e)&&t.includes("catalog"),c=t.includes("download"),h=i>=10.7&&n||i>=11.4&&(n||l&&u.includes("3d")),d=m&&e.fields&&e.fields.length>0,f=d&&e.supportsAdvancedQueries?e.advancedQueryCapabilities:void 0;return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:s,supportsExportImage:s,supportsIdentify:s,supportsImageToMap:i>=11.2&&m,supportsImageToMapMultiray:i>=11.2&&m,supportsMapToImage:i>=11.2&&m,supportsFindImages:i>=11.2&&m,supportsGetImageUrl:i>=11.3&&c,supportsMeasure:l,supportsMeasureFromImage:i>=11.2,supportsDownload:c,supportsQuery:d,supportsGetSamples:i>=10.2&&s,supportsProject:i>=10.3&&s,supportsComputeStatisticsHistograms:i>=10.4&&s,supportsQueryBoundary:i>=10.6&&s,supportsCalculateVolume:h,supportsComputePixelLocation:i>=10.7&&m,supportsComputeAngles:i>=10.91,supportsQueryGPSInfo:i>=11.2&&m,supportsAdd:o,supportsDelete:o,supportsEditing:o,supportsUpdate:o,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryBins:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:r,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,supportsStatistics:!!f?.supportsStatistics,supportsOrderBy:!!f?.supportsOrderBy,supportsDistinct:!!f?.supportsDistinct,supportsPagination:!!f?.supportsPagination,supportsPaginationOnAggregatedQueries:!!f?.supportsPaginationOnAggregatedQueries,supportsStandardizedQueriesOnly:!!f?.useStandardizedQueries,supportsPercentileStatistics:!!f?.supportsPercentileStatistics,supportsCentroid:!!f?.supportsReturningGeometryCentroid,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!!f?.supportsQueryWithDistance,supportsExtent:!!f?.supportsReturningQueryExtent,supportsGeometryProperties:!!f?.supportsReturningGeometryProperties,supportsHavingClause:!!f?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:f?.supportsSqlExpression??!!f,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!f?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},mensuration:{supportsDistanceAndAngle:p,supportsAreaAndPerimeter:p,supportsPointOrCentroid:p,supportsHeightFromBaseAndTop:l&&u.includes("base-top height"),supportsHeightFromBaseAndTopShadow:l&&u.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:l&&u.includes("top-top shadow height"),supports3D:l&&u.includes("3d")}}}};function Ge(e){return e?.path??""}return e([u({clonable:!1})],He.prototype,"_functionRasterInfos",void 0),e([u({readOnly:!0})],He.prototype,"_serviceSupportsMosaicRule",void 0),e([d("_serviceSupportsMosaicRule",["currentVersion","fields"])],He.prototype,"readServiceSupportsMosaicRule",null),e([u({readOnly:!0})],He.prototype,"_rasterFunctionNamesIndex",null),e([u()],He.prototype,"adjustAspectRatio",void 0),e([u({type:[p],json:{write:!0}})],He.prototype,"bandIds",void 0),e([d("bandIds")],He.prototype,"readBandIds",null),e([u({readOnly:!0,json:{read:!1}})],He.prototype,"capabilities",void 0),e([d("service","capabilities",["capabilities","currentVersion","serviceDataType"])],He.prototype,"readCapabilities",null),e([u({type:Number})],He.prototype,"compressionQuality",void 0),e([g("compressionQuality")],He.prototype,"writeCompressionQuality",null),e([u({type:Number})],He.prototype,"compressionTolerance",void 0),e([g("compressionTolerance")],He.prototype,"writeCompressionTolerance",null),e([u({json:{read:{source:"copyrightText"}}})],He.prototype,"copyright",void 0),e([u({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],He.prototype,"defaultMosaicRule",void 0),e([d("defaultMosaicRule",["defaultMosaicMethod"])],He.prototype,"readDefaultMosaicRule",null),e([u({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],He.prototype,"definitionExpression",void 0),e([u({readOnly:!0,constructOnly:!0})],He.prototype,"exportImageServiceParameters",void 0),e([u()],He.prototype,"rasterInfo",void 0),e([u({readOnly:!0,type:[_]})],He.prototype,"fields",void 0),e([u({readOnly:!0})],He.prototype,"fieldsIndex",null),e([u({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff","bip","bsq"],json:{write:!0}})],He.prototype,"format",null),e([d("service","format",["serviceDataType"])],He.prototype,"readFormat",null),e([u({type:y})],He.prototype,"fullExtent",void 0),e([u({readOnly:!0})],He.prototype,"hasMultidimensions",void 0),e([u({json:{read:{source:"maxImageHeight"}}})],He.prototype,"imageMaxHeight",void 0),e([u({json:{read:{source:"maxImageWidth"}}})],He.prototype,"imageMaxWidth",void 0),e([u({type:String,json:{type:P.jsonValues,read:P.read,write:P.write}})],He.prototype,"interpolation",void 0),e([u()],He.prototype,"minScale",void 0),e([d("service","minScale")],He.prototype,"readMinScale",null),e([u()],He.prototype,"maxScale",void 0),e([d("service","maxScale")],He.prototype,"readMaxScale",null),e([u({type:T})],He.prototype,"mosaicRule",null),e([d("mosaicRule",["mosaicRule","defaultMosaicMethod"])],He.prototype,"readMosaicRule",null),e([g("mosaicRule")],He.prototype,"writeMosaicRule",null),e([u()],He.prototype,"multidimensionalInfo",void 0),e([u({type:C,json:{write:!0}})],He.prototype,"multidimensionalSubset",void 0),e([u({json:{type:p}})],He.prototype,"noData",void 0),e([g("noData")],He.prototype,"writeNoData",null),e([u({type:String,json:{type:N.jsonValues,read:N.read,write:N.write}})],He.prototype,"noDataInterpretation",void 0),e([u({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],He.prototype,"objectIdField",void 0),e([d("objectIdField")],He.prototype,"readObjectIdField",null),e([u({readOnly:!0})],He.prototype,"geometryType",void 0),e([u({})],He.prototype,"typeIdField",void 0),e([u({})],He.prototype,"types",void 0),e([u({readOnly:!0})],He.prototype,"parsedUrl",null),e([u({type:Function})],He.prototype,"pixelFilter",void 0),e([u()],He.prototype,"raster",void 0),e([u({readOnly:!0})],He.prototype,"sourceType",void 0),e([d("sourceType",["serviceSourceType","fields"])],He.prototype,"readSourceType",null),e([u()],He.prototype,"viewId",void 0),e([u()],He.prototype,"renderer",null),e([u({types:ue,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:le,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],He.prototype,"internalRenderer",null),e([d("internalRenderer")],He.prototype,"readRenderer",null),e([g("internalRenderer")],He.prototype,"writeRenderer",null),e([u({clonable:!1})],He.prototype,"symbolizer",void 0),e([u(w)],He.prototype,"opacity",void 0),e([u({readOnly:!0})],He.prototype,"rasterFields",null),e([u({constructOnly:!0})],He.prototype,"rasterFunctionInfos",void 0),e([u({type:G,json:{name:"renderingRule"}})],He.prototype,"rasterFunction",null),e([d("rasterFunction",["renderingRule","rasterFunctionInfos"])],He.prototype,"readRasterFunction",null),e([u({readOnly:!0})],He.prototype,"serviceDataType",void 0),e([u({readOnly:!0,type:I})],He.prototype,"spatialReference",void 0),e([d("spatialReference",["spatialReference","extent"])],He.prototype,"readSpatialReference",null),e([u({type:q.apiValues,json:{read:q.read,type:q.jsonValues}})],He.prototype,"pixelType",void 0),e([g("pixelType")],He.prototype,"writePixelType",null),e([u({constructOnly:!0,type:k})],He.prototype,"serviceRasterInfo",void 0),e([u()],He.prototype,"sourceJSON",void 0),e([u(b)],He.prototype,"url",void 0),e([u({readOnly:!0})],He.prototype,"version",void 0),e([d("version",["currentVersion","fields","timeInfo"])],He.prototype,"readVersion",null),He=e([f("esri.layers.mixins.ArcGISImageService")],He),He};export{He as ArcGISImageService};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import i from"../../request.js";import{deprecatedFunction as r}from"../../core/deprecate.js";import s from"../../core/Error.js";import{clone as n}from"../../core/lang.js";import a from"../../core/Logger.js";import{watch as o}from"../../core/reactiveUtils.js";import{urlToObject as l}from"../../core/urlUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import{Integer as p,ensureRange as m,ensureClass as c,ensureNumber as h}from"../../core/accessorSupport/ensureType.js";import{reader as d}from"../../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{writer as g}from"../../core/accessorSupport/decorators/writer.js";import y from"../../geometry/Extent.js";import R from"../../geometry/Polygon.js";import I from"../../geometry/SpatialReference.js";import{srToRESTValue as v}from"../../geometry/support/spatialReferenceUtils.js";import{opacity as w,url as b}from"../support/commonProperties.js";import S from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as x}from"../support/ExportImageServiceParameters.js";import _ from"../support/Field.js";import F from"../support/FieldsIndex.js";import{createBitmap as D}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as O}from"../support/imageryRendererUtils.js";import T from"../support/MosaicRule.js";import C from"../support/MultidimensionalSubset.js";import M from"../support/PixelBlock.js";import{interpolationKebab as P,noDataInterpretationKebab as N,pixelTypeKebabDict as q}from"../support/rasterEnums.js";import{getServicePixelValueField as j,getItemPixelValueField as E,getRawServicePixelValueField as A,getProcessedServicePixelValueField as V,getMagnitudeField as Q,getDirectionField as J,getMultidimensionalFields as U,getRasterAttributeTableFields as B,commonRasterFieldNames as L,addMultidimensionalFieldValues as z,rasterFieldPrefix as H}from"../support/rasterFieldUtils.js";import G from"../support/RasterFunction.js";import k from"../support/RasterInfo.js";import{intersectMultimensionalSubset as W,getEffectiveMultidimensionalDefinition as $,getSubsetVariablesFromMdInfo as X,getDefaultMultidimensionalDefinition as K}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as Y,getFormat as Z}from"../support/rasterFormats/RasterCodec.js";import{highlightPixels as ee}from"../support/rasterFunctions/pixelUtils.js";import{uvComponentToVector as te}from"../support/rasterFunctions/vectorFieldUtils.js";import{createDefaultRenderer as ie,getSupportedRendererTypes as re,matchPresetRenderer as se,getDefaultBandCombination as ne,normalizeRendererJSON as ae}from"../../renderers/support/rasterRendererHelper.js";import oe from"../../renderers/support/RasterSymbolizer.js";import{websceneRasterRendererTypes as le,rasterRendererTypes as ue,read as pe}from"../../renderers/support/rasterTypeUtils.js";import{calculateVolume as me,computeAngles as ce,computePixelSpaceLocations as he,computeHistograms as de,computeStatisticsHistograms as fe,measureHeight as ge,measureAreaAndPerimeter as ye,measureDistanceAndAngle as Re,measurePointOrCentroid as Ie,measureLengthFromImage as ve,measureAreaFromImage as we,getImageSpatialReferenceQueryParameter as be,getSamples as Se,identify as xe,imageToMap as _e,imageToMapMultiray as Fe,mapToImage as De,findImages as Oe,getImageUrl as Te,queryBoundary as Ce,queryGPSInfo as Me}from"../../rest/imageService.js";import{fetchServiceRasterInfo as Pe,generateRasterInfo as Ne,patchServiceInfo as qe}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as je}from"../../rest/imageService/getCatalogItemRasterInfo.js";import{executeForCount as Ee}from"../../rest/query/executeForCount.js";import{executeForIds as Ae}from"../../rest/query/executeForIds.js";import{executeQueryJSON as Ve}from"../../rest/query/executeQueryJSON.js";import Qe from"../../rest/support/FeatureSet.js";import Je from"../../rest/support/ImageIdentifyParameters.js";import Ue from"../../rest/support/Query.js";const Be=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Le=m(h,{min:0,max:255});function ze(e){const t=JSON.stringify(e),i=t.includes('"rasterFunctionDefinition":{'),r=i?t.match(/"type":"(.*?FunctionArguments")/gi):t.match(/"rasterFunction":"(.*?")/gi),s=r?.map(e=>i?e.slice(8,-18):e.slice(18,-1));return s?s.join("/"):null}const He=m=>{const h=m;let He=class extends h{constructor(){super(...arguments),this._functionRasterInfos={},this._serviceSupportsMosaicRule=null,this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new x({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach(t=>{e.set(t.name.toLowerCase().replaceAll(/ /gi,"_"),t.name)}),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every(e=>"number"==typeof e))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,i){null!=e&&"lerc"!==this.format&&(t[i]=e)}writeCompressionTolerance(e,t,i){"lerc"===this.format&&null!=e&&(t[i]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?T.fromJSON(t):null}get fieldsIndex(){return this.fields?new F(this.fields):null}set format(e){e&&Be.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t?.mosaicMethod&&(t=T.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?T.fromJSON(i):this._isMosaicRuleSupported(t)?T.fromJSON(t):null}writeMosaicRule(e,t,i){const{mosaicRule:r}=this;this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=Le(e))}readObjectIdField(e,t){if(!e){const i=t.fields.find(e=>"esriFieldTypeOID"===e.type||"oid"===e.type);e=i?.name}return e}get parsedUrl(){return l(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}get renderer(){const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const i=t?.find(({name:t})=>t===e);return i?.renderer.clone()}return this.internalRenderer}set renderer(e){this.activePresetRendererName=null,this.internalRenderer=e}set internalRenderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("internalRenderer",e)}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer,s=pe(r,i);return null==s?null:("vector-field"===s.type&&t.symbolTileSize&&!r.symbolTileSize&&(s.symbolTileSize=t.symbolTileSize),O(s)||a.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),s)}writeRenderer(e,t,i){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this.fields?.map(e=>e.clone())??[];e.push(j()),"mosaic-dataset"===this.sourceType&&this.fields?.length&&e.push(E()),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some(({name:e})=>"none"===e.toLowerCase())&&e.push(A()),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter(({name:e})=>"none"!==e.toLowerCase()).forEach(({name:t})=>e.push(V(t)));const{rasterInfo:t}=this;if(this._isVectorDataSet()){const i=t?.multidimensionalInfo?.variables[0].unit?.trim(),r=Q(i),s=J();e.push(r,s)}if(t?.multidimensionalInfo&&"raster-dataset"===this.sourceType){const i=U(t.multidimensionalInfo);e.push(...i)}const i=t?.attributeTable;if(null!=i){const t=B(i);e.push(...t)}return e}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=G.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i?.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?G.fromJSON({rasterFunctionDefinition:t.renderingRule}):G.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?I.fromJSON(i):null}writePixelType(e,t,i){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[i]=q.toJSON(e))}readVersion(e,t){let i=t.currentVersion;return i||(i=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),i}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let i=e,{renderer:r,symbolizer:s,pixelFilter:n}=this;const{isRawData:a}=e;if(a&&"lerc"!==this.format&&(r??=ie(this.rasterInfo,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}),s||(this.symbolizer=new oe({rendererJSON:r.toJSON(),rasterInfo:this.rasterInfo}),s=this.symbolizer)),(a||!this._isPicture())&&r&&s&&!n){await this._updateSymbolizer(s,r);const{bandIds:n}=this;i=await this._symbolize({pixelData:e,bandIds:n,symbolizer:s},t)}return i}async highlightPixels(e,t){const i=e.highlightOptions.map(e=>{const t={...e},{bandId:i}=t;if(null==i)t.bandId=0;else{const e=this.bandIds?.length?this.bandIds.indexOf(i):i;if(e<0||e>2)return;t.bandId=e}return t}).filter(e=>null!=e),r=this._rasterJobHandler;r?await r.highlightPixels({...e,highlightOptions:i},t):ee(e.pixelBlock,e.renderedPixelBlock,i)}destroy(){this._shutdownJobHandler()}async calculateVolume(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsCalculateVolume)throw new s("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=n(e),this.mosaicRule&&null==e.mosaicRule&&(e.mosaicRule=this.mosaicRule),me(this.url,e,this._getRequestOptions(t))}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new s("imagery-layer:compute-angles","this operation is not supported on the input image service");return ce(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new s("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return he(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new s("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=n(e),this._applyMosaicAndRenderingRules(e),de(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new s("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=n(e),this._applyMosaicAndRenderingRules(e),fe(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 s("imagery-layer:measure-height","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),ge(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 s("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),ye(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 s("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),Re(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 s("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),Ie(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new s("imagery-layer:measure-length-from-image","this operation is not supported on the input image service");if("polyline"!==e.geometry.type)throw new s("imagery-layer:measure-length-from-image","this input geometry must be a polyline");return ve(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new s("imagery-layer:measure-area-from-image","this operation is not supported on the input image service");if("polygon"!==e.geometry.type)throw new s("imagery-layer:measure-area-from-image","this input geometry must be a polygon");return we(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}fetchImage(e,t,i,n={}){if(r(a.getLogger(this),"`ImageryLayer.fetchImage` is deprecated in favor of 'ImageryLayer.fetchPixels'.",{replacement:"ImageryLayer.fetchPixels",version:"4.33",warnOnce:!0}),null==e||null==t||null==i)throw new s("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");return this.internalFetchImage(e,t,i,n)}async internalFetchImage(e,t,i,r={}){await this._updateCurrentRasterInfo();const{exportImageServiceParameters:s}=this;let n=!1;r.requestRawData&&(await this._initJobHandler(),s.requestRawData||"lerc"===this.format||(n=!0,s.requestRawData=!0));const a=this.getExportImageServiceParameters(e,t,i,r.timeExtent);if(n&&(s.requestRawData=!1),null==a){if(r.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=i,r.returnImageBitmap){return{imageBitmap:await D(e,`${Ge(this.parsedUrl)}/exportImage`,r.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,a=(s?.length||n.bandCount)??0,o=t*i,l=n.pixelType,u=[];for(let e=0;e<a;e++)u.push(M.createEmptyBand(l,o));return{pixelData:{pixelBlock:new M({width:t,height:i,pixels:u,mask:new Uint8Array(o),pixelType:l}),extent:e}}}const o=!!r.requestAsImageElement&&!this.pixelFilter,l=o&&!!r.returnImageBitmap,u={imageServiceParameters:a,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:o,returnImageBitmap:l,signal:r.signal};return this._requestArrayBuffer(u)}async fetchPixels(e,t,i,r={}){await this._initJobHandler(),r.applyRendering&&this._updateCurrentRasterInfo();const s=r.applyRendering?void 0:new x({layer:this,requestRawData:!0,interpolation:r.interpolation??"nearest",bandIds:r.bandIds??[]}),n=this.getExportImageServiceParameters(e,t,i,r.timeExtent,s);if(null==n)return{extent:e,pixelBlock:null};delete n.pixelType,delete n.bandIds,delete n.compressionQuality;const a={imageServiceParameters:n,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:!1,returnImageBitmap:!1,signal:r.signal},{pixelData:o}=await this._requestArrayBuffer(a);return o??{extent:e,pixelBlock:null}}fetchKeyProperties(e){return i(Ge(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>e.data)}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new s("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):i(Ge(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>Qe.fromJSON(e.data))}getCatalogItemRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return je(Ge(this.parsedUrl),e,i)}async getCatalogItemICSInfo(e,t){const{data:r}=await i(Ge(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),s=r?.ics;if(!s)return;let n=null;try{n=(await i(Ge(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!n?.spatialReference)return{ics:s,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?i(Ge(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then(e=>e.data).catch(()=>({})):{},o=n.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[n]}),inSR:v(o),outSR:"0:"+e},u=i(Ge(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then(e=>e.data).catch(()=>({})),p=5,m=(n.xmin+n.xmax)/2,c=(n.ymax-n.ymin)/(p+1),h=n.ymin+c,d=[];for(let i=0;i<p;i++)d.push({x:m,y:h+c*i});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:d}),inSR:v(o),outSR:"0:"+e},g=i(Ge(this.parsedUrl)+"/project",{query:this._getQueryParams(f),...t}).then(e=>e.data).catch(()=>({})),R=await Promise.all([a,u,g]);let w=R[0].ipxf;if(null==w){const e=s.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(w={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const b=y.fromJSON(R[1]?.geometries?.[0]);b&&(b.spatialReference=new I({wkid:0,imageCoordinateSystem:s}));const S=R[2].geometries?R[2].geometries.filter(e=>null!=e?.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y):[],x=S.length;if(x<3)return{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:null};let _=0,F=0,D=0,O=0;for(let i=0;i<x;i++)_+=S[i].x,F+=S[i].y,D+=S[i].x*S[i].x,O+=S[i].x*S[i].y;const T=(x*O-_*F)/(x*D-_*_);let C=0;const M=S[p-1].x>S[0].x,P=S[p-1].y>S[0].y;return T===1/0?C=P?90:270:0===T?C=M?0:180:T>0?C=M?180*Math.atan(T)/Math.PI:180*Math.atan(T)/Math.PI+180:T<0&&(C=P?180+180*Math.atan(T)/Math.PI:360+180*Math.atan(T)/Math.PI),{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:C}}async generateRasterInfo(e,t){e=c(G,e);const i={...t,query:this._getQueryParams()};if(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))return this.serviceRasterInfo??Pe(Ge(this.parsedUrl),this.sourceJSON,i);const r=ze(e);if(!r)throw new s("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const n=Ne(Ge(this.parsedUrl),e,i);this._functionRasterInfos[r]=n;try{return await n}catch(a){throw this._functionRasterInfos[r]=null,a}}getExportImageServiceParameters(e,t,i,r,s){e=e.clone().shiftCentralMeridian();const n=be(e.spatialReference,Ge(this.parsedUrl));s??=this.exportImageServiceParameters;const a=s.toJSON(),{bandIds:o,noData:l}=a;let{renderingRule:u}=a;const p=this.rasterFunction?.rasterFunctionDefinition,m=this.renderer?.type,c=!m||"raster-stretch"===m||"raster-colormap"===m||"unique-value"===m||"class-breaks"===m||"raster-shaded-relief"===m;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!p&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===u.rasterFunction)e.rasterFunctionArguments.Raster=u.rasterFunctionArguments.Raster,u.rasterFunctionArguments.Raster=e;else if("Colormap"===u.rasterFunction){const t=u.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,u.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=u,u=e;a.bandIds=void 0}else a.bandIds=o?.join(",");Array.isArray(l)&&l.length>0&&(a.noData=l.join(","));const h=this._processMultidimensionalIntersection(null,r,s.mosaicRule);if(h.isOutSide)return null;a.mosaicRule=null!=h.mosaicRule?JSON.stringify(h.mosaicRule):null,r=h.timeExtent,a.renderingRule=this._getRenderingRuleString(G.fromJSON(u));const d={};if(null!=r){const{start:e,end:t}=r.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+i,...a,...d}}async getSamples(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i?.operations.supportsGetSamples)throw new s("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=n(e);const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),Se(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new s("imagery-layer:identify","identify operation is not supported on the input image service");e=n(e),this.version<10.91&&"extent"===e.geometry?.type&&(e.geometry=R.fromExtent(e.geometry));const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new s("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=i.timeExtent,e.mosaicRule=i.mosaicRule;const{raster:r,rasterFunction:a}=this;return a&&null==e.rasterFunction&&(e.rasterFunction=a),r&&null==e.raster&&(e.raster=r),xe(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new s("imagery-layer:image-to-map","imageToMap operation is not supported on the input image service");return _e(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new s("imagery-layer:image-to-map-multiray","imageToMapMultiray operation is not supported on the input image service");return Fe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new s("imagery-layer:map-to-image","mapToImage operation is not supported on the input image service");return De(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new s("imagery-layer:find-images","findImages operation is not supported on the input image service");return Oe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new s("imagery-layer:get-image-url","getImageUrl operation is not supported on the input image service");return Te(Ge(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){return new Ue({outFields:["*"],returnGeometry:!0,where:this.definitionExpression||"1=1"})}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new s("imagery-layer:query-boundary","queryBoundary operation is not supported on the input image service");return e=e??{outSpatialReference:this.spatialReference},Ce(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasters(e,t){({query:e,requestOptions:t}=await this._prepareForQuery(e,t));const i=await Ve(this.url,e,t),r=this.graphicOrigin;return i.features.forEach(e=>{e.layer=this,e.origin=r}),i}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Ae(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new s("imagery-layer:query-gps-info","queryGPSInfo operation is not supported on the input image service");return e=e??{where:"1=1"},Me(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Ee(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new s("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:r,returnTopmostRaster:n,showNoDataRecords:a}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const p=L.servicePixelValue.toLowerCase(),m=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some(e=>!e.toLowerCase().startsWith(p)),this.version>=10.4)){const t=e.outFields.filter(e=>e.toLowerCase().startsWith(p)&&e.length>p.length).map(e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,m),t]});l=t.map(e=>new G({functionName:e[0]})),u=t.map(e=>e[1]);const{rasterFunction:i}=this;0===l.length?i?.functionName?(l.push(i),u.push(i.functionName)):l=null:i?.functionName&&!l.some(e=>e.functionName===i.functionName)&&(l.push(i),u.push(i.functionName))}const c=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:h}=this;let d=e.timeExtent||this.timeExtent;if(h){const{isOutside:t,intersection:i}=W(h,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new s("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");null!=i?.timeExtent&&(d=i.timeExtent)}const f=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,d);let g=e.geometry;this.version<10.91&&"extent"===g?.type&&(g=R.fromExtent(g));const y=this._getQueryParams({geometry:g,timeExtent:d,mosaicRule:f,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:i,returnCatalogItems:o,returnGeometry:c,raster:this.raster,maxItemCount:n?1:null});delete y.f;const I=new Je(y);try{await this._generateRasterInfo(this.rasterFunction);const i=await xe(this.url,I,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,n=null!=i.value&&i.value.toLowerCase().includes("nodata"),l=o&&!c&&i?.catalogItems?.features.length&&(a||!n),p=this.multidimensionalInfo&&"raster-dataset"===this.sourceType?$({rasterInfo:this.rasterInfo,multidimensionalDefinition:f?.multidimensionalDefinition,timeExtent:d,multidimensionalSubset:this.multidimensionalSubset}):null;if(!l)return this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:s,effectiveMultidimensionalDefinition:p});const m=this.objectIdField||"ObjectId",h=i.catalogItems?.features??[],g=h.map(e=>e.attributes?.[m]),y=new Ue({objectIds:g,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[m]}),R=await this.queryRasters(y);return R?.features?.length&&R.features.forEach(t=>{h.forEach(i=>{i.attributes[m]===t.attributes[m]&&t.geometry&&(i.geometry=t.geometry.clone(),null!=e.outSpatialReference&&(i.geometry.spatialReference=e.outSpatialReference))})}),this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:s,effectiveMultidimensionalDefinition:p})}catch{throw new s("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=i(Ge(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.statistics),s=i(Ge(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.histograms),n=await Promise.all([r,s]);return n[0]&&n[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),{statistics:n[0]||null,histograms:n[1]||null}}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return X(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,i=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):Pe(Ge(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then(e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),qe(e,t),e)),r=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([i,r,s]).then(e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.internalRenderer&&!this._isSupportedRenderer(this.internalRenderer)&&(this._set("internalRenderer",null),a.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("internalRenderer",this._configRenderer(this.renderer)),this.addHandles([o(()=>this.rasterFunction,e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then(e=>{e&&(this.rasterInfo=e)})})]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)})}_combineMosaicRuleWithTimeExtent(e,t){const i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(null==e||null==r||null==t||null==i?.startField)return e;const{startField:s}=i,n=r.variables.some(e=>e.dimensions.some(e=>e.name===s))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter(e=>e.dimensionName!==n),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const a=e.multidimensionalDefinition.filter(e=>e.dimensionName===n),o=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==o||null==l||o===l,p=u?[o||l]:[[o,l]],m=this.version>=10.8;if(a.length)a.forEach(e=>{e.dimensionName===n&&(m?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))});else if(!m){const t=e.multidimensionalDefinition.filter(e=>null!=e.variableName&&null==e.dimensionName);t.length?t.forEach(e=>{e.dimensionName=n,e.isSlice=u,e.values=p}):e.multidimensionalDefinition.push(new S({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter(e=>!(!e.variableName&&!e.dimensionName)),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new s("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?c(Ue,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:i}=this;return"unique-value"===e.type&&this._hasRasterFunction(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&re(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:s}=await i(Ge(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,s&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map(e=>e.trim()).indexOf("tilesonly")>-1)throw new s("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||i}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:i}=e,r="resample"===t?.toLowerCase(),s=i?.ResampleType||i?.resampleType;return r&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:i}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){const t=this.mosaicRule?.multidimensionalDefinition?.[0].variableName,r=se({variableName:t,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&i.bandCount>=3){const e=r?.bandIds??ne(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=r?.renderer??ie(i,{bandIds:this.bandIds,variableName:this.rasterFunction?null:t}));const s=ae(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=i):this.symbolizer=new oe({rendererJSON:s,rasterInfo:i}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){null!=e?.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:i}=this;return{raster:t,viewId:i,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,i){return this._rasterJobHandler?this._rasterJobHandler.decode({data:e,options:t}):Y(e,t,i)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const r=await i(Ge(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,returnImageBitmap:n,signal:a}=e;if(r&&this._canRequestImageElement(t.format)){const r=`${Ge(this.parsedUrl)}/exportImage`,{data:s}=await i(r,{responseType:n?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:a});if(s instanceof Blob){return{imageBitmap:await D(s,r,a),params:t}}return{imageOrCanvasElement:s,params:t}}const o=this._initJobHandler(),l=i(Ge(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:a}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let m=p;if("bsq"!==m&&"bip"!==m&&(m=Z(u)),!m)throw new s("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const c={signal:a},h="gif"===p||"bmp"===p||p.includes("png")&&("png"===m||"jpg"===m)?Y(u,{useCanvas:!0,...t},c):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},c);return{pixelData:{pixelBlock:await h,extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch(()=>null)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=K(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new T;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&t.forEach(e=>e.variableName=""),t=t.filter(({variableName:e,dimensionName:t})=>e&&"*"!==e||t),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,i){i=i||{};const r=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=i,l=e.processedValues;let u=e.catalogItems?.features,p=e.properties?.Values?.map(e=>e.replaceAll(/ /gi,", "))||[];const m=this.objectIdField||"ObjectId",c="string"==typeof r&&r.toLowerCase().includes("nodata"),h=[];if(r&&!u&&(!c||n)){const e={};e[m]=0;p=[r],u=[new t({geometry:this.fullExtent,attributes:e})],this.multidimensionalInfo&&"raster-dataset"===this.sourceType&&z(this.rasterFields,e,i.effectiveMultidimensionalDefinition)}if(!u)return[];this._updateResponseFieldNames(u,o),c&&!n&&(u=[]);const{itemPixelValue:d,servicePixelValue:f}=L,g=this.rasterFields.some(e=>e.name===d),y=this.graphicOrigin;for(let t=0;t<u.length;t++){const e=u[t];if(null!=r){const i=p[t],a=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:r;if("nodata"===i.toLowerCase()&&!n)continue;g&&(e.attributes[d]=i),e.attributes[f]=a,this._updateFeatureWithMagDirValues(e,i);const o=this.fields&&this.fields.length>0;let u=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?i:r:a;this.rasterFunction||(u=o?i:r),this._updateFeatureWithRasterAttributeTableValues(e,u)}if(e.sourceLayer=e.layer=this,e.origin=y,a&&this._updateFeatureWithDomainValues(e),s&&l&&s.length===l.length)for(let t=0;t<s.length;t++){const i=`${L.servicePixelValue}.${s[t]}`;e.attributes[i]=l[t]}h.push(u[t])}return h}_processMultidimensionalIntersection(e,t,i){const{multidimensionalSubset:r}=this;if(!r)return{isOutSide:!1,timeExtent:t,mosaicRule:i=this._combineMosaicRuleWithTimeExtent(i,t)};if(r){const{isOutside:i,intersection:s}=W(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};null!=s?.timeExtent&&(t=s.timeExtent)}if(i=this._combineMosaicRuleWithTimeExtent(i,t),i?.multidimensionalDefinition){const{isOutside:e}=W(r,{multidimensionalDefinition:i.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:i}}_updateFeatureWithRasterAttributeTableValues(e,t){const i=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==i)return;const{features:r,fields:s}=i,n=s.map(e=>e.name).find(e=>"value"===e.toLowerCase());if(!n)return;const a=r.filter(e=>e.attributes[n]===(null!=t?parseInt(t,10):null));a&&a[0]&&s.forEach(t=>{const i=H+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 M({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new y(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:te([n.pixels[0][0],n.pixels[1][0]]);e.attributes[L.magnitude]=a[0],e.attributes[L.direction]=a[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter(e=>e.domain&&"coded-value"===e.domain.type);null!=t&&t.forEach(t=>{const i=e.attributes[t.name];if(null!=i){const r=t.domain.codedValues.find(e=>e.code===i);r&&(e.attributes[t.name]=r.name)}})}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const i=this.fieldsIndex;null!=i&&e.forEach(e=>{if(e?.attributes)for(const r of t){const t=i.get(r)?.name;t&&t!==r&&(e.attributes[r]=e.attributes[t],delete e.attributes[t])}})}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return null!=e?.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const i=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(i)?t.get(i):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:i,rasterFunction:r}=this;r&&null==e.rasterFunction&&(e.rasterFunction=r),i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}async _updateCurrentRasterInfo(e){if(this.renderer||this.symbolizer){const t=await this._generateRasterInfo(this.rasterFunction,{signal:e});t&&(this.rasterInfo=t)}}_applyMosaicRule(e){const{raster:t,mosaicRule:i}=this;i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map(e=>e.trim()):["image","catalog"],{currentVersion:i,maxRecordCount:r}=e,s=t.includes("image"),n="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!(!e.spatialReference&&!e.extent?.spatialReference),o=t.includes("edit"),l=t.includes("mensuration")&&a,u=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map(e=>e.trim()),p=l&&u.includes("basic"),m=this._isMosaicDataset(e)&&t.includes("catalog"),c=t.includes("download"),h=i>=10.7&&n||i>=11.4&&(n||l&&u.includes("3d")),d=m&&e.fields&&e.fields.length>0,f=d&&e.supportsAdvancedQueries?e.advancedQueryCapabilities:void 0;return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:s,supportsExportImage:s,supportsIdentify:s,supportsImageToMap:i>=11.2&&m,supportsImageToMapMultiray:i>=11.2&&m,supportsMapToImage:i>=11.2&&m,supportsFindImages:i>=11.2&&m,supportsGetImageUrl:i>=11.3&&c,supportsMeasure:l,supportsMeasureFromImage:i>=11.2,supportsDownload:c,supportsQuery:d,supportsGetSamples:i>=10.2&&s,supportsProject:i>=10.3&&s,supportsComputeStatisticsHistograms:i>=10.4&&s,supportsQueryBoundary:i>=10.6&&s,supportsCalculateVolume:h,supportsComputePixelLocation:i>=10.7&&m,supportsComputeAngles:i>=10.91,supportsQueryGPSInfo:i>=11.2&&m,supportsAdd:o,supportsDelete:o,supportsEditing:o,supportsUpdate:o,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryBins:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:r,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,supportsStatistics:!!f?.supportsStatistics,supportsOrderBy:!!f?.supportsOrderBy,supportsDistinct:!!f?.supportsDistinct,supportsPagination:!!f?.supportsPagination,supportsPaginationOnAggregatedQueries:!!f?.supportsPaginationOnAggregatedQueries,supportsStandardizedQueriesOnly:!!f?.useStandardizedQueries,supportsPercentileStatistics:!!f?.supportsPercentileStatistics,supportsCentroid:!!f?.supportsReturningGeometryCentroid,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!!f?.supportsQueryWithDistance,supportsExtent:!!f?.supportsReturningQueryExtent,supportsGeometryProperties:!!f?.supportsReturningGeometryProperties,supportsHavingClause:!!f?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:f?.supportsSqlExpression??!!f,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!f?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},mensuration:{supportsDistanceAndAngle:p,supportsAreaAndPerimeter:p,supportsPointOrCentroid:p,supportsHeightFromBaseAndTop:l&&u.includes("base-top height"),supportsHeightFromBaseAndTopShadow:l&&u.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:l&&u.includes("top-top shadow height"),supports3D:l&&u.includes("3d")}}}};function Ge(e){return e?.path??""}return e([u({clonable:!1})],He.prototype,"_functionRasterInfos",void 0),e([u({readOnly:!0})],He.prototype,"_serviceSupportsMosaicRule",void 0),e([d("_serviceSupportsMosaicRule",["currentVersion","fields"])],He.prototype,"readServiceSupportsMosaicRule",null),e([u({readOnly:!0})],He.prototype,"_rasterFunctionNamesIndex",null),e([u()],He.prototype,"adjustAspectRatio",void 0),e([u({type:[p],json:{write:!0}})],He.prototype,"bandIds",void 0),e([d("bandIds")],He.prototype,"readBandIds",null),e([u({readOnly:!0,json:{read:!1}})],He.prototype,"capabilities",void 0),e([d("service","capabilities",["capabilities","currentVersion","serviceDataType"])],He.prototype,"readCapabilities",null),e([u({type:Number})],He.prototype,"compressionQuality",void 0),e([g("compressionQuality")],He.prototype,"writeCompressionQuality",null),e([u({type:Number})],He.prototype,"compressionTolerance",void 0),e([g("compressionTolerance")],He.prototype,"writeCompressionTolerance",null),e([u({json:{read:{source:"copyrightText"}}})],He.prototype,"copyright",void 0),e([u({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],He.prototype,"defaultMosaicRule",void 0),e([d("defaultMosaicRule",["defaultMosaicMethod"])],He.prototype,"readDefaultMosaicRule",null),e([u({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],He.prototype,"definitionExpression",void 0),e([u({readOnly:!0,constructOnly:!0})],He.prototype,"exportImageServiceParameters",void 0),e([u()],He.prototype,"rasterInfo",void 0),e([u({readOnly:!0,type:[_]})],He.prototype,"fields",void 0),e([u({readOnly:!0})],He.prototype,"fieldsIndex",null),e([u({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff","bip","bsq"],json:{write:!0}})],He.prototype,"format",null),e([d("service","format",["serviceDataType"])],He.prototype,"readFormat",null),e([u({type:y})],He.prototype,"fullExtent",void 0),e([u({readOnly:!0})],He.prototype,"hasMultidimensions",void 0),e([u({json:{read:{source:"maxImageHeight"}}})],He.prototype,"imageMaxHeight",void 0),e([u({json:{read:{source:"maxImageWidth"}}})],He.prototype,"imageMaxWidth",void 0),e([u({type:String,json:{type:P.jsonValues,read:P.read,write:P.write}})],He.prototype,"interpolation",void 0),e([u()],He.prototype,"minScale",void 0),e([d("service","minScale")],He.prototype,"readMinScale",null),e([u()],He.prototype,"maxScale",void 0),e([d("service","maxScale")],He.prototype,"readMaxScale",null),e([u({type:T})],He.prototype,"mosaicRule",null),e([d("mosaicRule",["mosaicRule","defaultMosaicMethod"])],He.prototype,"readMosaicRule",null),e([g("mosaicRule")],He.prototype,"writeMosaicRule",null),e([u()],He.prototype,"multidimensionalInfo",void 0),e([u({type:C,json:{write:!0}})],He.prototype,"multidimensionalSubset",void 0),e([u({json:{type:p}})],He.prototype,"noData",void 0),e([g("noData")],He.prototype,"writeNoData",null),e([u({type:String,json:{type:N.jsonValues,read:N.read,write:N.write}})],He.prototype,"noDataInterpretation",void 0),e([u({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],He.prototype,"objectIdField",void 0),e([d("objectIdField")],He.prototype,"readObjectIdField",null),e([u({readOnly:!0})],He.prototype,"geometryType",void 0),e([u({})],He.prototype,"typeIdField",void 0),e([u({})],He.prototype,"types",void 0),e([u({readOnly:!0})],He.prototype,"parsedUrl",null),e([u({type:Function})],He.prototype,"pixelFilter",void 0),e([u()],He.prototype,"raster",void 0),e([u({readOnly:!0})],He.prototype,"sourceType",void 0),e([d("sourceType",["serviceSourceType","fields"])],He.prototype,"readSourceType",null),e([u()],He.prototype,"viewId",void 0),e([u()],He.prototype,"renderer",null),e([u({types:ue,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:le,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],He.prototype,"internalRenderer",null),e([d("internalRenderer")],He.prototype,"readRenderer",null),e([g("internalRenderer")],He.prototype,"writeRenderer",null),e([u({clonable:!1})],He.prototype,"symbolizer",void 0),e([u(w)],He.prototype,"opacity",void 0),e([u({readOnly:!0})],He.prototype,"rasterFields",null),e([u({constructOnly:!0})],He.prototype,"rasterFunctionInfos",void 0),e([u({type:G,json:{name:"renderingRule"}})],He.prototype,"rasterFunction",null),e([d("rasterFunction",["renderingRule","rasterFunctionInfos"])],He.prototype,"readRasterFunction",null),e([u({readOnly:!0})],He.prototype,"serviceDataType",void 0),e([u({readOnly:!0,type:I})],He.prototype,"spatialReference",void 0),e([d("spatialReference",["spatialReference","extent"])],He.prototype,"readSpatialReference",null),e([u({type:q.apiValues,json:{read:q.read,type:q.jsonValues}})],He.prototype,"pixelType",void 0),e([g("pixelType")],He.prototype,"writePixelType",null),e([u({constructOnly:!0,type:k})],He.prototype,"serviceRasterInfo",void 0),e([u()],He.prototype,"sourceJSON",void 0),e([u(b)],He.prototype,"url",void 0),e([u({readOnly:!0})],He.prototype,"version",void 0),e([d("version",["currentVersion","fields","timeInfo"])],He.prototype,"readVersion",null),He=e([f("esri.layers.mixins.ArcGISImageService")],He),He};export{He as ArcGISImageService};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{sqlAnd as e}from"../../core/sql.js";import{unpackFieldNames as t,featureHasFields as o}from"./fieldUtils.js";import{loadArcade as i}from"../../support/loadArcade.js";async function n(i,n,s,r){const l=new Array(n.length),u=new Map,c=new Map,a=t(i.fieldsIndex,s.outFields),d=r?.hasRequiredFields??o;for(let e=0;e<n.length;e++){const t=n[e];if(t.isAggregate)l[e]=t;else{if(s.returnGeometry||!d(t,a)){const o=t.getObjectId();if(null!=o){u.set(o,{graphic:t,index:e});continue}const i=t.getGlobalId();if(null!=i){c.set(i,{graphic:t,index:e});continue}}l[e]=t}}if(!i.queryFeatures||0===u.size&&0===c.size)return l.filter(Boolean);const f=[],p=(e,t)=>{t&&(e.outFields??=[],e.outFields.includes(t)||e.outFields.push(t))};if(u.size>0){const e=s.clone();p(e,i.objectIdField),"uniqueIdFields"in i&&i.uniqueIdFields?.length&&(e.outFields??=[],e.outFields.push(...i.uniqueIdFields)),e.objectIds=Array.from(u.keys()),f.push({type:"object-id",query:e,map:u})}const g="globalIdField"in i?i.globalIdField:null;if(null!=g&&c.size>0){const t=s.clone();p(t,g);const o=Array.from(c.keys());t.where=e(s.where,`${g} IN (${o.map(e=>`'${e}'`).join(",")})`),f.push({type:"global-id",query:t,map:c})}const y=r?.updateSourceAttributes??!1;for(const{type:e,query:t,map:o}of f)try{const n=await i.queryFeatures(t,r);for(const t of n.features){const i="object-id"===e?t.getObjectId():t.getGlobalId();if(null==i)continue;const n=o.get(i);if(!n)continue;const{graphic:s,index:r}=n;if(y&&t.attributes){s.attributes??={};for(const e of a)e in t.attributes&&(s.attributes[e]=t.attributes[e])}const{geometry:u,origin:c}=s;t.geometry||=u,t.origin=c,l[r]=t}}catch{}return l.filter(Boolean)}async function s(e){if(e.expressionInfos?.length||Array.isArray(e.content)&&e.content.some(e=>"expression"===e.type))return i()}export{n as fetchFeaturePopupFeatures,s as loadFeaturePopupArcadeModules};
|
package/package.json
CHANGED
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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const e="20250815",b="41491e6d6eb266ae1bb0081635ca844c57019776";export{e as buildDate,b as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import r from"../../../../core/Accessor.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{i as n}from"../../../../chunks/vec32.js";import{fromValues as s,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,width as c,height as p,expand as d}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as l}from"../../../../geometry/support/coordinateSystem.js";let m=class extends r{constructor(e){super(e)}get localOrigin(){const{extent:e}=this;return s(e.center.x,e.center.y,0)}get localOriginRenderSpace(){const{extent:e,localOrigin:r,renderCoordsHelper:t}=this,o=i();return t.toRenderCoords(r,e.spatialReference,o),o}get cameraPositionRenderSpace(){const{localOriginRenderSpace:e,renderCoordsHelper:r}=this,t=i();return r.setAltitude(t,
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../../../core/Accessor.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{i as n}from"../../../../chunks/vec32.js";import{fromValues as s,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,width as c,height as p,expand as d}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as l}from"../../../../geometry/support/coordinateSystem.js";let m=class extends r{constructor(e){super(e),this.rawResult=null}get localOrigin(){const{extent:e}=this;return s(e.center.x,e.center.y,0)}get localOriginRenderSpace(){const{extent:e,localOrigin:r,renderCoordsHelper:t}=this,o=i();return t.toRenderCoords(r,e.spatialReference,o),o}get cameraPositionRenderSpace(){const{localOriginRenderSpace:e,renderCoordsHelper:r}=this,t=i();return r.setAltitude(t,g,e),t}get cameraDimensions(){const{extent:e,renderCoordsHelper:r}=this;if(2===r.viewingMode)return{width:e.width,height:e.height};const t=a();this._expandBoundingRect(e.xmin,e.ymin,t),this._expandBoundingRect(e.xmax,e.ymin,t),this._expandBoundingRect(e.xmin,e.ymax,t),this._expandBoundingRect(e.xmax,e.ymax,t);return{width:c(t),height:p(t)}}get cameraNearFar(){return{near:x,far:R}}get upVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,2,i())}get northVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,1,i())}get eastVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,0,i())}_expandBoundingRect(e,r,t){const{extent:o,eastVector:s,northVector:i,upVector:a,renderCoordsHelper:c}=this,p=o.center.z??0;n(u,e,r,p),c.toRenderCoords(u,o.spatialReference,u),l(u,s,i,a,h),d(t,h,t)}};e([t()],m.prototype,"renderCoordsHelper",void 0),e([t()],m.prototype,"extent",void 0),e([t()],m.prototype,"localOrigin",null),e([t()],m.prototype,"localOriginRenderSpace",null),e([t()],m.prototype,"cameraPositionRenderSpace",null),e([t()],m.prototype,"cameraDimensions",null),e([t()],m.prototype,"upVector",null),e([t()],m.prototype,"northVector",null),e([t()],m.prototype,"eastVector",null),e([t()],m.prototype,"rawResult",void 0),m=e([o("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillComputation")],m);const u=i(),h=i(),g=9e3,x=0,R=2e4;export{m as VolumeMeasurementCutFillComputation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{syncAndInitial as i,watch as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{syncAndInitial as i,watch as r,when as s,initial as n}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as p}from"../../../../chunks/earcut.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{projectOrLoad as d}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as c}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as h}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as y,fromExtent as g,intersects as f}from"../../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as v}from"../../../../geometry/support/DoubleArray.js";import{t as _}from"../../../../chunks/vec3.js";import w from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as j}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as C}from"./VolumeMeasurementCutFillComputation.js";import G from"./VolumeMeasurementResult.js";import{getRawResult as R}from"./volumeMeasurementUtils.js";import{ElevationContext as D}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as V}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as H}from"../../support/renderInfoUtils/polygon.js";import{CutFillDepth as x,TargetGeometry as b}from"../../webgl-engine/lib/CutFillDepth.js";let A=class extends t{constructor(e){super(e),this._computation=null,this._updatingHandles=new u}initialize(){const e=this.view;this._renderer=new x({view:e}),this._updatingHandles.add(()=>({geometry:this.analysis.geometry,projectedGeometry:d(this.analysis.geometry,this.view.spatialReference)}),({geometry:e,projectedGeometry:t})=>{null==t.pending?this._onGeometryChange(e,t.geometry):this._updatingHandles.addPromise(t.pending)},i),this.addHandles([this._createElevationUpdateHandle(),r(()=>[this.analysis.measureType,this.analysisViewData.elevationAlignedGeometry,this.analysisViewData.effectiveTargetElevation],()=>this._updateTargetGeometry(),n),r(()=>this.analysisViewData.targetGeometry,e=>{if(!e||!this._computation)return;const t=this._getGeometryAttributes(e,this._computation.extent,this._computation.localOrigin);this._renderer.setup(this._computation,t),this._renderer.start()},n),s(()=>this._renderer.done,()=>this._updateResult())])}destroy(){this._updatingHandles.destroy(),this._renderer.destroy()}get updating(){return this._renderer.updating||this._updatingHandles.updating}get result(){const e=this._computation?.rawResult;return e?new G({measureType:this.analysis.measureType,rawResult:e,unit:this.analysisViewData.unit}):null}_createComputation(e){const{renderCoordsHelper:t}=this.view;this._computation=new C({extent:e,renderCoordsHelper:t})}_updateComputation(e){this._computation?this._computation.extent=e:this._createComputation(e)}_removeComputation(){this._computation=null}_createElevationUpdateHandle(){const e=t=>{const o=this.analysis.geometry;if(null==o||"ground"!==t.context)return;const i=d(o,this.view.spatialReference);if(null!=i.pending)return this._updatingHandles.addPromise(i.pending),void i.pending.finally(()=>e(t));const r=i.geometry;null!=r&&null!=r.extent&&(h(t.extent,t.spatialReference,T,this.view.spatialReference),g(r.extent,U),f(T,U)&&this._onGeometryChange(o,r))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_onGeometryChange(e,t){const{elevationProvider:i}=this.view,{valid:r}=this.analysis;if(null==e||!r)return this.analysisViewData.elevationAlignedGeometry=null,void this._removeComputation();if(null==t)return j(this.analysis,e.spatialReference,o.getLogger(this)),void(this.analysisViewData.elevationAlignedGeometry=null);this._updateComputation(t.extent);const s=t.clone();E(i,s),this.analysisViewData.elevationAlignedGeometry=s}_updateTargetGeometry(){const{measureType:e}=this.analysis,{elevationAlignedGeometry:t,effectiveTargetElevation:o}=this.analysisViewData;if(!t)return void(this.analysisViewData.targetGeometry=null);if("stockpile"===e||null==o)return void(this.analysisViewData.targetGeometry=t);const i=t.clone();i.rings[0].forEach(e=>{e[2]=o}),this.analysisViewData.targetGeometry=i}_updateResult(){if(!this._computation)return;const{cameraDimensions:e,cameraNearFar:{near:t,far:o}}=this._computation,{width:i,height:r}=this._renderer,s=e.width/i*(e.height/r),n=this._renderer.getDepth(),a=e=>e*(o-t)+t,l=a(n.cut)*s,p=a(n.fill)*s;this._computation.rawResult=R(Math.abs(l),p)}_getGeometryAttributes(e,t,o){const{elevationProvider:i,renderCoordsHelper:r}=this.view,s=H(e,i,r,D.fromElevationInfo(new w({mode:"absolute-height"}))),{polygons:n}=s,a=n[0],l=p(a.position,a.holeIndices,3),u=v(3*a.count),d=m(),h=m();return c(t.spatialReference,o,d,r.spatialReference),h[12]=-d[12],h[13]=-d[13],h[14]=-d[14],_(u,a.position,h),new b(u,l)}};function E(e,t){t.rings[0].forEach(t=>{t[2]=V(e,t,"ground")??0})}e([a({constructOnly:!0})],A.prototype,"analysis",void 0),e([a({constructOnly:!0})],A.prototype,"analysisViewData",void 0),e([a({constructOnly:!0})],A.prototype,"view",void 0),e([a()],A.prototype,"updating",null),e([a()],A.prototype,"result",null),e([a()],A.prototype,"_renderer",void 0),e([a()],A.prototype,"_computation",void 0),e([a({readOnly:!0})],A.prototype,"_updatingHandles",void 0),A=e([l("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],A);const T=y(),U=y();export{A as VolumeMeasurementCutFillController};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{toPreferredVolumeUnit as s}from"./volumeMeasurementUtils.js";let u=class extends e{constructor(t){super(t)}get cutVolume(){return s(this.rawResult.cutVolume,this.unit)}get fillVolume(){return s(this.rawResult.fillVolume,this.unit)}get netVolume(){return s(this.rawResult.netVolume,this.unit)}get totalVolume(){return s(this.rawResult.totalVolume,this.unit)}};t([o({constructOnly:!0})],u.prototype,"measureType",void 0),t([o()],u.prototype,"cutVolume",null),t([o()],u.prototype,"fillVolume",null),t([o()],u.prototype,"netVolume",null),t([o()],u.prototype,"totalVolume",null),t([o({constructOnly:!0})],u.prototype,"rawResult",void 0),t([o({constructOnly:!0})],u.prototype,"unit",void 0),u=t([r("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementResult")],u);export{u as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{createVolume as t,toUnit as o}from"../../../../core/quantityUtils.js";import{adaptiveVolumeUnit as u}from"../../../../core/unitUtils.js";function e(o,u,e="cubic-meters"){const l=o-u,n=o+u;return{cutVolume:t(o,e),fillVolume:t(u,e),netVolume:t(l,e),totalVolume:t(n,e)}}function l(t,e){return t?o(t,u(t.value,t.unit,e)):null}export{e as getRawResult,l as toPreferredVolumeUnit};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{property as
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{getDefaultUnitForView as r}from"../../../support/getDefaultUnitForView.js";import{AnalysisView3D as l}from"./AnalysisView3D.js";import{VolumeMeasurementCutFillController as n}from"./VolumeMeasurement/VolumeMeasurementCutFillController.js";import{VolumeMeasurementCutFillVisualization as a}from"./VolumeMeasurement/VolumeMeasurementCutFillVisualization.js";let u=class extends(l(e)){constructor(t){super(t),this.type="volume-measurement-view-3d",this.analysis=null,this.elevationAlignedGeometry=null,this.targetGeometry=null,this.tool=null}initialize(){const{analysis:t,view:e}=this;this._analysisController=new n({view:e,analysis:t,analysisViewData:this}),this._analysisVisualization=new a({view:e,analysisViewData:this})}destroy(){this._analysisController=s(this._analysisController),this._analysisVisualization=s(this._analysisVisualization)}get result(){return this._analysisController.result}get effectiveTargetElevation(){const{targetElevation:t}=this.analysis.cutFillOptions;if(null!=t)return t;const e=this.elevationAlignedGeometry?.extent;return e&&e.zmin&&e.zmax?(e.zmax+e.zmin)/2:null}get unit(){return this.analysis.unit??r(this.view)}get updating(){return null!=this._analysisController&&this._analysisController.updating}};t([i({readOnly:!0})],u.prototype,"type",void 0),t([i({constructOnly:!0,nonNullable:!0})],u.prototype,"analysis",void 0),t([i({readOnly:!0})],u.prototype,"result",null),t([i()],u.prototype,"elevationAlignedGeometry",void 0),t([i({type:Number})],u.prototype,"effectiveTargetElevation",null),t([i()],u.prototype,"targetGeometry",void 0),t([i()],u.prototype,"unit",null),t([i()],u.prototype,"updating",null),u=t([o("esri.views.3d.analysis.VolumeMeasurementAnalysisView3D")],u);const m=u;export{m 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{abortMaybe as r}from"../../../core/maybe.js";import{debounce as i,throwIfAborted as s,ignoreAbortErrors as o}from"../../../core/promiseUtils.js";import l from"../../../core/RandomLCG.js";import{watch as n,when as a,sync as u}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{projectOrLoad as h}from"../../../geometry/projectionUtils.js";import{fromExtent as c,toExtent as m,intersects as f}from"../../../geometry/support/aaBoundingRect.js";import g from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as _,getFlowSimulationSettings as y}from"../../2d/engine/flow/utils.js";import w from"./SubView3D.js";import{makeScheduleFunction as v}from"./support/makeScheduleFunction.js";import{FlowWorkerHandle as b}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as S,createStreamlineGeometry as j}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as T}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as R}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as x}from"../support/flow/StreamlineResources3DShape.js";import U from"../support/flow/VisualQuery3D.js";import{tilesAreRelated as P}from"../terrain/tileUtils.js";import{RibbonLineMaterial as L}from"../webgl-engine/materials/RibbonLineMaterial.js";import{TaskPriority as E}from"../../support/Scheduler.js";let k=class extends w{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this._abortController=null,this._frameTask=null,this.workerHandle=null,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._debouncedLoad=i(async e=>{const{view:t}=this;if(!this._visible)return void this.clear();if(0===e.size)return;const r=this._computeExtent(e);if(null==r)return;const i=new U(r,this.layer.timeExtent,this._viewSizeWithEqualRatio(r),t.state.contentPixelRatio);null==this._abortController&&(this._abortController=new AbortController);const o=this._abortController,l=await this._load(i,o.signal);s(o.signal),this.clear(),this._visible&&null!=l&&(l.attach(),this._resources=l)}),this._debouncedTileUpdate=i(async()=>{const{allTiles:e}=this.surface,{featureTiles:r}=this.view,{_dataBounds:i,_featureTilesBounds:s}=this,o=e=>e.rendered&&e.visible&&C(i,e.extent);if(null==r)return void(this.renderedTiles=new Set(e.filter(e=>o(e))));const l=r.tiles.filter(e=>e.measures.visible),n=new Set;function*a(r){for(let i=0;i<e.length;++i){const a=e.at(i);if(!o(a))continue;if(!C(s,a.extent))continue;l.some(({lij:e})=>t(e,a.lij)||P(e,a.lij))&&n.add(a),r.madeProgress(),r.done&&(r=yield)}}await this._frameTask.scheduleGenerator(a),this.renderedTiles=n}),this._debugStopLoading=!1}initialize(){const{surface:e,view:t}=this,{resourceController:r}=t;this.workerHandle=new b(v(r)),this._frameTask=r.scheduler.registerTask(E.FLOW_GENERATOR),this.addHandles([n(()=>this.simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&_(e,t)}),n(()=>{const{elevationInfo:e}=this;return[this._visible,this._draped,e?.mode,e?.offset,e?.unit]},()=>this.triggerLoad(),u),n(()=>this._materialParameters,e=>this._resources?.setMaterialParameters(e)),e.on("tiles-changed",()=>this._triggerTilesUpdate()),t.enableFeatureTiles(),n(()=>[this._dataBounds,this._featureTilesBounds],()=>this._triggerTilesUpdate()),a(()=>!t.featureTiles?.updating,()=>this._triggerTilesUpdate())]),this._triggerTilesUpdate()}destroy(){this.abort(),this.clear()}abort(){this._abortController=r(this._abortController)}get _dataBounds(){const e=h(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:c(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=h(e,this.surface.spatialReference).geometry;return null==t?null:c(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...S(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),...this._overrideMaterialParameters}}get _opacity(){return this.layerView.fullOpacity}get _visible(){const e=this._flowRenderer?.color;return this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get elevationInfo(){return this.layer.elevationInfo??B}get layer(){return this.layerView.layer}get simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let r=y(e);return null!=t&&(r={...r,...t}),r}get surface(){return this.view.basemapTerrain}doRefresh(){return this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null}async triggerLoad(){const{renderedTiles:e}=this;if(null==e||0===e.size||this._debugStopLoading)return;const t=this._debouncedLoad(e);return this.updatingHandles.addPromise(o(t))}async _load(e,t){const r=await this.fetchDataAndGenerateStreamlines(e,t);if(null==r||0===r.length)return null;const i=await this._createGeometry(e,r);return this._draped?new R(r,i,this.surface.overlayManager):new x(r,i,this.view.stage)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const r=new L(this._materialParameters),i=new Array,s=new l(1),{elevationInfo:o,_draped:n,view:a}=this;function*u(l){for(let u=0;u<t.length;++u)i.push(j(a,e,t[u],o,r,n,s)),l.madeProgress(),l.done&&(l=yield)}return await this._frameTask.scheduleGenerator(u),i}_computeExtent(e){const{spatialReference:t}=this.surface;if(null==t)return null;const r=T(e);return null==r?null:m(r,t)}async _triggerTilesUpdate(){const e=this._debouncedTileUpdate();return this.updatingHandles.addPromise(o(e))}_viewSizeWithEqualRatio(e){const t=(e.xmax-e.xmin)/(e.ymax-e.ymin),[r,i]=this.view.size;return r<i?[r,Math.floor(r/t)]:[Math.floor(i*t),i]}get test(){}};e([d()],k.prototype,"type",void 0),e([d()],k.prototype,"renderedTiles",void 0),e([d()],k.prototype,"emissiveStrength",void 0),e([d()],k.prototype,"_dataBounds",null),e([d()],k.prototype,"_draped",null),e([d()],k.prototype,"_featureTilesBounds",null),e([d()],k.prototype,"_flowRenderer",null),e([d()],k.prototype,"_materialParameters",null),e([d()],k.prototype,"_opacity",null),e([d()],k.prototype,"_visible",null),e([d()],k.prototype,"elevationInfo",null),e([d()],k.prototype,"layer",null),e([d()],k.prototype,"_overrideMaterialParameters",void 0),e([d()],k.prototype,"_overrideSimulationSettings",void 0),e([d()],k.prototype,"simulationSettings",null),e([d()],k.prototype,"surface",null),k=e([p("esri.views.3d.layers.FlowSubView3D")],k);const B=new g({mode:"
|
|
5
|
+
import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{abortMaybe as r}from"../../../core/maybe.js";import{debounce as i,throwIfAborted as s,ignoreAbortErrors as o}from"../../../core/promiseUtils.js";import l from"../../../core/RandomLCG.js";import{watch as n,when as a,sync as u}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{projectOrLoad as h}from"../../../geometry/projectionUtils.js";import{fromExtent as c,toExtent as m,intersects as f}from"../../../geometry/support/aaBoundingRect.js";import g from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as _,getFlowSimulationSettings as y}from"../../2d/engine/flow/utils.js";import w from"./SubView3D.js";import{makeScheduleFunction as v}from"./support/makeScheduleFunction.js";import{FlowWorkerHandle as b}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as S,createStreamlineGeometry as j}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as T}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as R}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as x}from"../support/flow/StreamlineResources3DShape.js";import U from"../support/flow/VisualQuery3D.js";import{tilesAreRelated as P}from"../terrain/tileUtils.js";import{RibbonLineMaterial as L}from"../webgl-engine/materials/RibbonLineMaterial.js";import{TaskPriority as E}from"../../support/Scheduler.js";let k=class extends w{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this._abortController=null,this._frameTask=null,this.workerHandle=null,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._debouncedLoad=i(async e=>{const{view:t}=this;if(!this._visible)return void this.clear();if(0===e.size)return;const r=this._computeExtent(e);if(null==r)return;const i=new U(r,this.layer.timeExtent,this._viewSizeWithEqualRatio(r),t.state.contentPixelRatio);null==this._abortController&&(this._abortController=new AbortController);const o=this._abortController,l=await this._load(i,o.signal);s(o.signal),this.clear(),this._visible&&null!=l&&(l.attach(),this._resources=l)}),this._debouncedTileUpdate=i(async()=>{const{allTiles:e}=this.surface,{featureTiles:r}=this.view,{_dataBounds:i,_featureTilesBounds:s}=this,o=e=>e.rendered&&e.visible&&C(i,e.extent);if(null==r)return void(this.renderedTiles=new Set(e.filter(e=>o(e))));const l=r.tiles.filter(e=>e.measures.visible),n=new Set;function*a(r){for(let i=0;i<e.length;++i){const a=e.at(i);if(!o(a))continue;if(!C(s,a.extent))continue;l.some(({lij:e})=>t(e,a.lij)||P(e,a.lij))&&n.add(a),r.madeProgress(),r.done&&(r=yield)}}await this._frameTask.scheduleGenerator(a),this.renderedTiles=n}),this._debugStopLoading=!1}initialize(){const{surface:e,view:t}=this,{resourceController:r}=t;this.workerHandle=new b(v(r)),this._frameTask=r.scheduler.registerTask(E.FLOW_GENERATOR),this.addHandles([n(()=>this.simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&_(e,t)}),n(()=>{const{elevationInfo:e}=this;return[this._visible,this._draped,e?.mode,e?.offset,e?.unit]},()=>this.triggerLoad(),u),n(()=>this._materialParameters,e=>this._resources?.setMaterialParameters(e)),e.on("tiles-changed",()=>this._triggerTilesUpdate()),t.enableFeatureTiles(),n(()=>[this._dataBounds,this._featureTilesBounds],()=>this._triggerTilesUpdate()),a(()=>!t.featureTiles?.updating,()=>this._triggerTilesUpdate())]),this._triggerTilesUpdate()}destroy(){this.abort(),this.clear()}abort(){this._abortController=r(this._abortController)}get _dataBounds(){const e=h(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:c(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=h(e,this.surface.spatialReference).geometry;return null==t?null:c(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...S(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),...this._overrideMaterialParameters}}get _opacity(){return this.layerView.fullOpacity}get _visible(){const e=this._flowRenderer?.color;return this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get elevationInfo(){return this.layer.elevationInfo??B}get layer(){return this.layerView.layer}get simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let r=y(e);return null!=t&&(r={...r,...t}),r}get surface(){return this.view.basemapTerrain}doRefresh(){return this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null}async triggerLoad(){const{renderedTiles:e}=this;if(null==e||0===e.size||this._debugStopLoading)return;const t=this._debouncedLoad(e);return this.updatingHandles.addPromise(o(t))}async _load(e,t){const r=await this.fetchDataAndGenerateStreamlines(e,t);if(null==r||0===r.length)return null;const i=await this._createGeometry(e,r);return this._draped?new R(r,i,this.surface.overlayManager):new x(r,i,this.view.stage)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const r=new L(this._materialParameters),i=new Array,s=new l(1),{elevationInfo:o,_draped:n,view:a}=this;function*u(l){for(let u=0;u<t.length;++u)i.push(j(a,e,t[u],o,r,n,s)),l.madeProgress(),l.done&&(l=yield)}return await this._frameTask.scheduleGenerator(u),i}_computeExtent(e){const{spatialReference:t}=this.surface;if(null==t)return null;const r=T(e);return null==r?null:m(r,t)}async _triggerTilesUpdate(){const e=this._debouncedTileUpdate();return this.updatingHandles.addPromise(o(e))}_viewSizeWithEqualRatio(e){const t=(e.xmax-e.xmin)/(e.ymax-e.ymin),[r,i]=this.view.size;return r<i?[r,Math.floor(r/t)]:[Math.floor(i*t),i]}get test(){}};e([d()],k.prototype,"type",void 0),e([d()],k.prototype,"renderedTiles",void 0),e([d()],k.prototype,"emissiveStrength",void 0),e([d()],k.prototype,"_dataBounds",null),e([d()],k.prototype,"_draped",null),e([d()],k.prototype,"_featureTilesBounds",null),e([d()],k.prototype,"_flowRenderer",null),e([d()],k.prototype,"_materialParameters",null),e([d()],k.prototype,"_opacity",null),e([d()],k.prototype,"_visible",null),e([d()],k.prototype,"elevationInfo",null),e([d()],k.prototype,"layer",null),e([d()],k.prototype,"_overrideMaterialParameters",void 0),e([d()],k.prototype,"_overrideSimulationSettings",void 0),e([d()],k.prototype,"simulationSettings",null),e([d()],k.prototype,"surface",null),k=e([p("esri.views.3d.layers.FlowSubView3D")],k);const B=new g({mode:"on-the-ground"});function C(e,t){return null==e||null==t||f(e,t)}export{k 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as i}from"tslib";import t from"../../../../core/Accessor.js";import{lerp as e}from"../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{transpose as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{t as l,g as h,i as u,c as d}from"../../../../chunks/vec32.js";import{ZEROS as p,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as _,t as y,c as m}from"../../../../chunks/vec42.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as b}from"../../../../geometry/ellipsoidUtils.js";import{create as O,empty as w,copy as D,offset as G,width as I,height as j,expand as k}from"../../../../geometry/support/aaBoundingRect.js";import{e as Q,c as C,a as P}from"../../../../chunks/boundedPlane.js";import{create as S}from"../../../../geometry/support/ray.js";import{c as x,q as A,r as V,a as T,i as U}from"../../../../chunks/sphere.js";import{DeconflictAABR as H}from"./DeconflictAABR.js";import{prepare as N,drawPoly as R}from"./deconflictorDebug.js";import M from"../../webgl/RenderCamera.js";import{GPUPointOcclusionQuery as F}from"../../webgl-engine/lib/GPUPointOcclusionQuery.js";import{applyPrecomputedScaleFactor as E}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{HUDMaterial as W}from"../../webgl-engine/materials/HUDMaterial.js";import{ScaleInfo as z}from"../../webgl-engine/materials/ScaleInfo.js";import{Yield as B}from"../../../support/Yield.js";const L=f(),q=f(),Y=g(),J=g(),K=f(),X=n(),Z=x(),$=S(),ii=f(),ti=O();class ei{constructor(i){this.id=i,this.aabr=O(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1,this.priority=0}}function si(i,t){const e=0!==i.distanceToOccluder&&i.distance>i.distanceToOccluder,s=0!==t.distanceToOccluder&&t.distance>t.distanceToOccluder;return e!==s?+e-+s:i.priority!==t.priority?t.priority-i.priority:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?+t.visible-+i.visible:i.id-t.id}class ri{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this._info=null,this._labelInfo=null}ensureInfo(i){let t=this.getInfo(i);return t||(t=new ei(this.graphics3DGraphic.graphic.uid),this._setInfo(i,t)),t}getInfo(i){return 16===i?this._labelInfo:this._info}removeInfo(i){this._setInfo(i,null)}_setInfo(i,t){16===i?this._labelInfo=t:this._info=t}}class oi{constructor(){this.camera=new M,this.slicePlane=C(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.equals(i.camera)||this.camera.copyFrom(i.camera),P(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let ci=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._viewState=new oi,this._state=0,this._checkOcclusion=new Map,this._active=new Map,this._checkOcclusionIterator=null,this._activeIterator=null,this._occlusionQueryUids=new Array,this._updatingHandles=new v,this._deconflictor=new H((i,t)=>{i.visible=t,this._setGraphicVisibility(this._active.get(i.id),t)},(i,t)=>i.id!==t.id,si),this._baseOccludedVisibility=10,this._altitudeFactor=2,this._minAltitudeDifference=100}initialize(){this._updatingHandles.add(()=>(this.view?.map?.ground?.opacity??0)>0,()=>this.setDirty()),this._updatingHandles.add(()=>this.view.ready,()=>this._occlusionQuery=null)}destroy(){this._occlusionQuery=null,this._updatingHandles.destroy(),this._deconflictor.destroy(),this._checkOcclusion.clear(),this._active.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._checkOcclusion.size>0)&&(this._dirty=!0,this.notifyChange("updating"))}setPriority(i,t){const e=this._active.get(i.graphic.uid)?.getInfo(this.visibilityGroup);e&&(e.priority=t)}get updating(){return 0!==this._state||this._dirty||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;const i=this._state/5;return this._dirty?.5*i:i}get readyToRun(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case 0:this._startUpdate(),i.madeProgress();case 1:if(this._state=1,!this._processCheckOcclusion(i))return;case 2:if(this._state=2,this._occlusionQuery&&!this._occlusionQuery.done)return B;this._readOcclusionQueryResult(),i.madeProgress();case 3:if(this._state=3,!this._collectActiveGraphics(i))return;case 4:if(this._state=4,this._deconflictor.run(i),!this._deconflictor.done)return;default:this._state=0,this.notifyChange("updating")}}setGraphicsActive(i,t){t?i.forEach(i=>this.addToActiveGraphics(i)):i.forEach(i=>this.removeFromActiveGraphics(i))}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const e=t?.geometries[0],s=e?.material;return s instanceof W}_startUpdate(){N(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._viewState.camera;this._deconflictor.reset(i,t),this._resetIterators(),this._occlusionQueryUids.length=0,this._checkOcclusion.size||(this._occlusionQuery=s(this._occlusionQuery))}addToActiveGraphics(i){i.ensureInfo(this.visibilityGroup),this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){ni(i,this.visibilityGroup),i.removeInfo(this.visibilityGroup),this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}addToCheckOcclusion(i){this._checkOcclusion.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromCheckOcclusion(i){this._checkOcclusion.delete(i.graphics3DGraphic.graphic.uid)}_processCheckOcclusion(i){if(0===this._checkOcclusion.size)return!0;const t=this._ensureCheckOcclusionIterator(),e=this._viewState.camera,r=c(X,e.viewInverseTransposeMatrix),o=this.view.map.ground.opacity>0,n="global"===this.view.viewingMode&&o&&e.relativeElevation>0?Z:null;let a=0;null!=n&&(A(n,p,e.viewMatrix),n[3]=b(this.view.spatialReference).radius,a=V(n,p));const h=O();for(;;){if(i.done)return!1;i.madeProgress();const s=t.next();if(!0===s.done)break;const o=s.value,c=o.graphics3DGraphic;if(c.destroyed)continue;if(!c.isVisible(1,8))continue;const u=ui(c,this.visibilityGroup);let d=null,p=!0;for(const i of u){if(!this.layerSupportsDeconfliction(i))continue;d=di,this._projectHudLayer(i,e,d),w(h);const t=i.stageObject.geometries[0].material;if(this._expandBoundingRect(h,e,i,t,d),d.isOutsideScreen){p=!1;break}if(this._isCulledBySlice(o,d.positionView)){p=!1;break}if(null!=n&&hi(d,n,a)){p=!1;break}l(q,d.positionView,r),d.altitude=this.view.renderCoordsHelper.getAltitude(q);const s=o.ensureInfo(this.visibilityGroup);if(s.altitude=d.altitude,s.distance=d.distance,s.distanceToOccluder=d.distanceToOccluder,s.culled=!1,D(s.aabr,h),t.parameters.occlusionTest)break;this._ensureOcclusionQuery().addPosition(q)===this._occlusionQueryUids.length&&this._occlusionQueryUids.push(c.graphic.uid);break}if(this._active.has(c.graphic.uid)&&(!p||!d)){const i=o.ensureInfo(this.visibilityGroup);i.visible=!d,i.culled=!0}}return this._checkOcclusionIterator=null,this._occlusionQueryUids.length||(this._occlusionQuery=s(this._occlusionQuery)),this._occlusionQuery?.start(),!0}_readOcclusionQueryResult(){if(!this._occlusionQuery||!this._occlusionQueryUids.length)return;const i=this._viewState.camera,t=this.view.renderCoordsHelper.getAltitude(i.eye);for(let e=0;e<this._occlusionQueryUids.length;e++){const i=this._occlusionQueryUids[e],s=this._checkOcclusion.get(i);if(!s)continue;const r=this._occlusionQuery.getOcclusion(e)??-1,o=s.getInfo(this.visibilityGroup);o&&(o.distanceToOccluder=r>0?o.distance-r:0);const c=r<=0||this._occludedVisibility(o?.distanceToOccluder??0,o?.distance??r,o?.altitude??0,t);this._active.has(i)?o&&(o.culled=!c,o.visible=c):this._setGraphicVisibility(s,c)}this._occlusionQueryUids.length=0}_collectActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),e=16===this.visibilityGroup;for(;!i.done;){i.madeProgress();const s=t.next();if(!0===s.done)return this._activeIterator=null,!0;const r=s.value,o=r.getInfo(this.visibilityGroup);if(!o)continue;!(!e||r.graphics3DGraphic.isVisible())||o.culled?(R(o.aabr,!1,!0),this._setGraphicVisibility(r,o.visible)):this._deconflictor.add(o)}return!1}_occludedVisibility(i,t,e,s){const r=Math.max(this._minAltitudeDifference,Math.abs(e-s))-this._minAltitudeDifference;return 0===i||t-i<=this._baseOccludedVisibility+this._altitudeFactor*r}_resetIterators(){this._checkOcclusionIterator=null,this._activeIterator=null}_ensureCheckOcclusionIterator(){return this._checkOcclusionIterator??=this._checkOcclusion.values(),this._checkOcclusionIterator}_ensureActiveGraphicsIterator(){return this._activeIterator??=this._active.values(),this._activeIterator}_ensureOcclusionQuery(){return this._occlusionQuery??=new F({view:this.view}),this._occlusionQueryUids.length||this._occlusionQuery.init(this._checkOcclusion.size,this._viewState.camera.eye),this._occlusionQuery}_projectHudLayer(i,t,e){const s=i.stageObject,r=s.geometries[0],o=r.material;l(L,T(s.boundingVolumeWorldSpace.bounds),t.viewMatrix);const c=r.attributes,n=c.get("normal").data,a=c.get("centerOffsetAndDistance").data;o.applyShaderOffsetsView(L,n,s.transformation,a,t,e.scaleInfo,L),_(Y,L[0],L[1],L[2],1),y(J,Y,t.projectionMatrix),h(e.positionNDC,J,1/J[3]),o.applyShaderOffsetsNDC(e.positionNDC,a,t,e.positionNDC,K),e.distanceWithoutPolygonOffset=t.depthNDCToWorld(K[2]),e.distance=K[2]===e.positionNDC[2]?e.distanceWithoutPolygonOffset:t.depthNDCToWorld(e.positionNDC[2]),_(J,e.positionNDC[0],e.positionNDC[1],e.positionNDC[2],1),y(Y,J,t.inverseProjectionMatrix),m(Y,Y,1/Y[3]),u(e.positionView,L[0],L[1],L[2])}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&Q(this._viewState.slicePlane,t)}_expandBoundingRect(i,t,s,r,{positionNDC:o,scaleInfo:c}){const n=s.getScreenSize(ai);E(n,c.factor,n),n[0]*=t.pixelRatio,n[1]*=t.pixelRatio;const a=G(r.calculateRelativeScreenBounds(n,c.factorAlignment.scale*t.pixelRatio,ti),e(0,t.fullWidth,.5+.5*o[0]),e(0,t.fullHeight,.5+.5*o[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(I(a),j(a));a[0]-=i,a[1]-=i,a[2]+=i,a[3]+=i}k(i,a,i)}_setGraphicVisibility(i,t){const e=i?.graphics3DGraphic;e&&!e.destroyed&&(e.setVisibilityFlag(this.visibilityGroup,8,t),16===this.visibilityGroup&&this.view.labeler.setLabelGraphicVisibility(e,t))}};function ni(i,t){const e=i.graphics3DGraphic;e.destroyed||e.setVisibilityFlag(t,8,!0)}i([r({constructOnly:!0})],ci.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],ci.prototype,"updating",null),i([r({readOnly:!0})],ci.prototype,"_updatingHandles",void 0),ci=i([o("esri.views.3d.layers.graphics.Deconflictor")],ci);const ai=a();class li{constructor(){this.positionView=f(),this.positionNDC=f(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new z}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1||i[2]>=1}}function hi(i,t,e){return d($.direction,i.positionView),u($.origin,0,0,0),!!U(t,$,ii)&&i.distanceWithoutPolygonOffset>e}function ui(i,t){return 16===t?i.labelLayers:i.layers}const di=new li;export{ci as Deconflictor,ri as DeconflictorGraphic,oi as DeconflictorViewState};
|
|
5
|
+
import{__decorate as i}from"tslib";import t from"../../../../core/Accessor.js";import{lerp as e}from"../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{transpose as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{t as l,g as h,i as u,c as d}from"../../../../chunks/vec32.js";import{ZEROS as p,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as f,t as y,c as m}from"../../../../chunks/vec42.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as b}from"../../../../geometry/ellipsoidUtils.js";import{create as O,empty as w,copy as D,offset as G,width as I,height as j,expand as k}from"../../../../geometry/support/aaBoundingRect.js";import{e as Q,c as C,a as P}from"../../../../chunks/boundedPlane.js";import{create as S}from"../../../../geometry/support/ray.js";import{c as T,q as x,r as A,a as R,i as V}from"../../../../chunks/sphere.js";import{DeconflictAABR as U}from"./DeconflictAABR.js";import{prepare as H,drawPoly as N}from"./deconflictorDebug.js";import M from"../../webgl/RenderCamera.js";import{GPUPointOcclusionQuery as F}from"../../webgl-engine/lib/GPUPointOcclusionQuery.js";import{applyPrecomputedScaleFactor as B}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{HUDMaterial as E}from"../../webgl-engine/materials/HUDMaterial.js";import{ScaleInfo as W}from"../../webgl-engine/materials/ScaleInfo.js";import{Yield as z}from"../../../support/Yield.js";const L=_(),q=_(),Y=g(),J=g(),K=_(),X=n(),Z=T(),$=S(),ii=_(),ti=O();class ei{constructor(i){this.id=i,this.aabr=O(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1,this.priority=0}}function si(i,t){const e=0!==i.distanceToOccluder&&i.distance>i.distanceToOccluder,s=0!==t.distanceToOccluder&&t.distance>t.distanceToOccluder;return e!==s?+e-+s:i.priority!==t.priority?t.priority-i.priority:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?+t.visible-+i.visible:i.id-t.id}class ri{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this._info=null,this._labelInfo=null}ensureInfo(i){let t=this.getInfo(i);return t||(t=new ei(this.graphics3DGraphic.graphic.uid),this._setInfo(i,t)),t}getInfo(i){return 16===i?this._labelInfo:this._info}removeInfo(i){this._setInfo(i,null)}_setInfo(i,t){16===i?this._labelInfo=t:this._info=t}}class oi{constructor(){this.camera=new M,this.slicePlane=C(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.equals(i.camera)||this.camera.copyFrom(i.camera),P(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let ci=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._viewState=new oi,this._state=0,this._checkOcclusion=new Map,this._active=new Map,this._checkOcclusionIterator=null,this._activeIterator=null,this._occlusionQueryUids=new Array,this._updatingHandles=new v,this._deconflictor=new U((i,t)=>{i.visible=t,this._setGraphicVisibility(this._active.get(i.id),t)},(i,t)=>i.id!==t.id,si),this._baseOccludedVisibility=10,this._altitudeFactor=2,this._minAltitudeDifference=100}initialize(){this._updatingHandles.add(()=>(this.view?.map?.ground?.opacity??0)>0,()=>this.setDirty()),this._updatingHandles.add(()=>this.view.ready,()=>{this._occlusionQuery=null,this.setDirty()})}destroy(){this._occlusionQuery=null,this._updatingHandles.destroy(),this._deconflictor.destroy(),this._checkOcclusion.clear(),this._active.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._checkOcclusion.size>0)&&(this._dirty=!0,this.notifyChange("_readyToRun"))}setPriority(i,t){const e=this._active.get(i.graphic.uid)?.getInfo(this.visibilityGroup);e&&(e.priority=t)}get _readyToRun(){return 0!==this._state||this._dirty}get updating(){return this._readyToRun||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;const i=this._state/5;return this._dirty?.5*i:i}get readyToRun(){return this.view.ready&&null!=this.view.state&&this._readyToRun}runTask(i){switch(this._state){case 0:this._startUpdate(),i.madeProgress();case 1:if(this._state=1,!this._processCheckOcclusion(i))return;case 2:if(this._state=2,this._occlusionQuery&&!this._occlusionQuery.done)return z;this._readOcclusionQueryResult(),i.madeProgress();case 3:if(this._state=3,!this._collectActiveGraphics(i))return;case 4:if(this._state=4,this._deconflictor.run(i),!this._deconflictor.done)return;default:this._state=0,this.notifyChange("_readyToRun")}}setGraphicsActive(i,t){t?i.forEach(i=>this.addToActiveGraphics(i)):i.forEach(i=>this.removeFromActiveGraphics(i))}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const e=t?.geometries[0],s=e?.material;return s instanceof E}_startUpdate(){H(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._viewState.camera;this._deconflictor.reset(i,t),this._resetIterators(),this._occlusionQueryUids.length=0,this._checkOcclusion.size||(this._occlusionQuery=s(this._occlusionQuery))}addToActiveGraphics(i){i.ensureInfo(this.visibilityGroup),this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){ni(i,this.visibilityGroup),i.removeInfo(this.visibilityGroup),this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}addToCheckOcclusion(i){this._checkOcclusion.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromCheckOcclusion(i){this._checkOcclusion.delete(i.graphics3DGraphic.graphic.uid)}_processCheckOcclusion(i){if(0===this._checkOcclusion.size)return!0;const t=this._ensureCheckOcclusionIterator(),e=this._viewState.camera,r=c(X,e.viewInverseTransposeMatrix),o=this.view.map.ground.opacity>0,n="global"===this.view.viewingMode&&o&&e.relativeElevation>0?Z:null;let a=0;null!=n&&(x(n,p,e.viewMatrix),n[3]=b(this.view.spatialReference).radius,a=A(n,p));const h=O();for(;;){if(i.done)return!1;i.madeProgress();const s=t.next();if(!0===s.done)break;const o=s.value,c=o.graphics3DGraphic;if(c.destroyed)continue;if(!c.isVisible(1,8))continue;const u=ui(c,this.visibilityGroup);let d=null,p=!0;for(const i of u){if(!this.layerSupportsDeconfliction(i))continue;d=di,this._projectHudLayer(i,e,d),w(h);const t=i.stageObject.geometries[0].material;if(this._expandBoundingRect(h,e,i,t,d),d.isOutsideScreen){p=!1;break}if(this._isCulledBySlice(o,d.positionView)){p=!1;break}if(null!=n&&hi(d,n,a)){p=!1;break}l(q,d.positionView,r),d.altitude=this.view.renderCoordsHelper.getAltitude(q);const s=o.ensureInfo(this.visibilityGroup);if(s.altitude=d.altitude,s.distance=d.distance,s.distanceToOccluder=d.distanceToOccluder,s.culled=!1,D(s.aabr,h),t.parameters.occlusionTest)break;this._ensureOcclusionQuery().addPosition(q)===this._occlusionQueryUids.length&&this._occlusionQueryUids.push(c.graphic.uid);break}if(this._active.has(c.graphic.uid)&&(!p||!d)){const i=o.ensureInfo(this.visibilityGroup);i.visible=!d,i.culled=!0}}return this._checkOcclusionIterator=null,this._occlusionQueryUids.length||(this._occlusionQuery=s(this._occlusionQuery)),this._occlusionQuery?.start(),!0}_readOcclusionQueryResult(){if(!this._occlusionQuery||!this._occlusionQueryUids.length)return;const i=this._viewState.camera,t=this.view.renderCoordsHelper.getAltitude(i.eye);for(let e=0;e<this._occlusionQueryUids.length;e++){const i=this._occlusionQueryUids[e],s=this._checkOcclusion.get(i);if(!s)continue;const r=this._occlusionQuery.getOcclusion(e)??-1,o=s.getInfo(this.visibilityGroup);o&&(o.distanceToOccluder=r>0?o.distance-r:0);const c=r<=0||this._occludedVisibility(o?.distanceToOccluder??0,o?.distance??r,o?.altitude??0,t);this._active.has(i)?o&&(o.culled=!c,o.visible=c):this._setGraphicVisibility(s,c)}this._occlusionQueryUids.length=0}_collectActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),e=16===this.visibilityGroup;for(;!i.done;){i.madeProgress();const s=t.next();if(!0===s.done)return this._activeIterator=null,!0;const r=s.value,o=r.getInfo(this.visibilityGroup);if(!o)continue;!(!e||r.graphics3DGraphic.isVisible())||o.culled?(N(o.aabr,!1,!0),this._setGraphicVisibility(r,o.visible)):this._deconflictor.add(o)}return!1}_occludedVisibility(i,t,e,s){const r=Math.max(this._minAltitudeDifference,Math.abs(e-s))-this._minAltitudeDifference;return 0===i||t-i<=this._baseOccludedVisibility+this._altitudeFactor*r}_resetIterators(){this._checkOcclusionIterator=null,this._activeIterator=null}_ensureCheckOcclusionIterator(){return this._checkOcclusionIterator??=this._checkOcclusion.values(),this._checkOcclusionIterator}_ensureActiveGraphicsIterator(){return this._activeIterator??=this._active.values(),this._activeIterator}_ensureOcclusionQuery(){return this._occlusionQuery??=new F({view:this.view}),this._occlusionQueryUids.length||this._occlusionQuery.init(this._checkOcclusion.size,this._viewState.camera.eye),this._occlusionQuery}_projectHudLayer(i,t,e){const s=i.stageObject,r=s.geometries[0],o=r.material;l(L,R(s.boundingVolumeWorldSpace.bounds),t.viewMatrix);const c=r.attributes,n=c.get("normal").data,a=c.get("centerOffsetAndDistance").data;o.applyShaderOffsetsView(L,n,s.transformation,a,t,e.scaleInfo,L),f(Y,L[0],L[1],L[2],1),y(J,Y,t.projectionMatrix),h(e.positionNDC,J,1/J[3]),o.applyShaderOffsetsNDC(e.positionNDC,a,t,e.positionNDC,K),e.distanceWithoutPolygonOffset=t.depthNDCToWorld(K[2]),e.distance=K[2]===e.positionNDC[2]?e.distanceWithoutPolygonOffset:t.depthNDCToWorld(e.positionNDC[2]),f(J,e.positionNDC[0],e.positionNDC[1],e.positionNDC[2],1),y(Y,J,t.inverseProjectionMatrix),m(Y,Y,1/Y[3]),u(e.positionView,L[0],L[1],L[2])}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&Q(this._viewState.slicePlane,t)}_expandBoundingRect(i,t,s,r,{positionNDC:o,scaleInfo:c}){const n=s.getScreenSize(ai);B(n,c.factor,n),n[0]*=t.pixelRatio,n[1]*=t.pixelRatio;const a=G(r.calculateRelativeScreenBounds(n,c.factorAlignment.scale*t.pixelRatio,ti),e(0,t.fullWidth,.5+.5*o[0]),e(0,t.fullHeight,.5+.5*o[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(I(a),j(a));a[0]-=i,a[1]-=i,a[2]+=i,a[3]+=i}k(i,a,i)}_setGraphicVisibility(i,t){const e=i?.graphics3DGraphic;e&&!e.destroyed&&(e.setVisibilityFlag(this.visibilityGroup,8,t),16===this.visibilityGroup&&this.view.labeler.setLabelGraphicVisibility(e,t))}};function ni(i,t){const e=i.graphics3DGraphic;e.destroyed||e.setVisibilityFlag(t,8,!0)}i([r({constructOnly:!0})],ci.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],ci.prototype,"_readyToRun",null),i([r({type:Boolean,readOnly:!0})],ci.prototype,"updating",null),i([r({readOnly:!0})],ci.prototype,"_updatingHandles",void 0),ci=i([o("esri.views.3d.layers.graphics.Deconflictor")],ci);const ai=a();class li{constructor(){this.positionView=_(),this.positionNDC=_(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new W}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1||i[2]>=1}}function hi(i,t,e){return d($.direction,i.positionView),u($.origin,0,0,0),!!V(t,$,ii)&&i.distanceWithoutPolygonOffset>e}function ui(i,t){return 16===t?i.labelLayers:i.layers}const di=new li;export{ci as Deconflictor,ri as DeconflictorGraphic,oi as DeconflictorViewState};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{destroyMaybe as t,removeMaybe as i}from"../../../../core/maybe.js";import{initial as s,watch as r,sync as a}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{t as c}from"../../../../chunks/boundedPlane.js";import{Deconflictor as h,DeconflictorGraphic as n}from"./Deconflictor.js";import{LabelDeconflictor as l}from"./LabelDeconflictor.js";import{TaskPriority as d}from"../../../support/Scheduler.js";let p=class extends h{constructor(){super(...arguments),this._contexts=new Map,this.visibilityGroup=1,this._marginFactor=-.1,this.test={overrideMarginFactor:e=>{this._marginFactor=e,this.setDirty()}}}get labels(){return this._labels}get viewState(){return this._viewState}initialize(){this._updatingHandles.add(()=>this.view?.state?.camera,()=>{this._updateViewState(),this.setDirty()}),this._updatingHandles.add(()=>this.view?.slice?.plane,()=>{this._updateSlicePlane(),this._slicePlaneChanged()},s),this.addHandles(r(()=>this.view.basemapTerrain?.updating||this.view.graphicsView?.updating||this.view.allLayerViews.some(e=>e.updating),(e,t)=>{!e&&t&&this.setDirty()},a)),this._frameTask=this.view.resourceController.scheduler.registerTask(d.GRAPHICS_DECONFLICTOR,this),this._labels=new l({view:this.view,parent:this})}destroy(){this._labels=t(this._labels),this._frameTask=i(this._frameTask)}get marginFactor(){return this._marginFactor}setDirty(){this._contexts.size>0&&(super.setDirty(),this._labels.setDirty())}runTask(e){const t=super.runTask(e);return this.readyToRun||this._labels.setDirty(),t}_updateViewState(){this.view?.state&&(this._viewState.camera.copyFrom(this.view.state.camera),this._updateSlicePlane())}_updateSlicePlane(){const e=this.view?.slice?.plane;null!=e&&c(e,this._viewState.camera.viewMatrix,this._viewState.slicePlane),this._viewState.slicePlaneEnabled=null!=e}_slicePlaneChanged(){for(const e of this._contexts.keys())if(e.symbolCreationContext.slicePlaneEnabled)return void this.setDirty()}addGraphicsOwner(e){const t=this._getGraphicsContext(e);return{addGraphic:i=>this._addGraphic(e,t,i),removeGraphic:e=>this._removeGraphic(t,e),labelingInfoChange:()=>this._labelsEnabledChanged(e,t),featureReductionChange:()=>this._enabledChanged(e,t),slicePlaneEnabledChange:()=>this._slicePlaneEnabledChanged(e,t),clear:()=>t.forEach(e=>this._removeGraphic(t,e.graphics3DGraphic)),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._contexts.get(e);t&&(t.forEach(e=>this._removeGraphic(t,e.graphics3DGraphic)),this._contexts.delete(e),this.setDirty())}_addGraphic(e,t,i){const s=i.graphic.uid,r=new n(i,e.symbolCreationContext.slicePlaneEnabled);t.set(s,r),this.addToCheckOcclusion(r),m(e)&&this.addToActiveGraphics(r),e.labelsEnabled&&(this._labels.addToCheckOcclusion(r),this._labels.addToActiveGraphics(r));const a=!this._graphicSupportsDeconfliction(i)||!m(e);i.setVisibilityFlag(1,8,a)}_removeGraphic(e,t){const i=t.graphic.uid,s=e.get(i);s&&(this.removeFromActiveGraphics(s),this.removeFromCheckOcclusion(s),this._labels.removeFromActiveGraphics(s),this._labels.removeFromCheckOcclusion(s),e.delete(i),this.setDirty())}_enabledChanged(e,t){m(e)?t.forEach(e=>this.addToActiveGraphics(e)):(t.forEach(e=>this.removeFromActiveGraphics(e)),u(e))}_labelsEnabledChanged(e,t){e.labelsEnabled?(t.forEach(e=>this._labels.addToCheckOcclusion(e)),t.forEach(e=>this._labels.addToActiveGraphics(e))):(t.forEach(e=>this._labels.removeFromCheckOcclusion(e)),t.forEach(e=>this._labels.removeFromActiveGraphics(e)))}_slicePlaneEnabledChanged(e,t){const i=e.symbolCreationContext.slicePlaneEnabled;t.forEach(e=>e.slicePlaneEnabled=i),this.setDirty()}_graphicSupportsDeconfliction(e){if(e.isDraped)return!1;const t=e.layers;if(!t?.length)return!1;for(const i of t)if(this.layerSupportsDeconfliction(i))return!0;return!1}_getGraphicsContext(e){const t=this._contexts.get(e);if(t)return t;const i=new Map;return this._contexts.set(e,i),this.setDirty(),i}};function m(e){const t=e.layer;return!(!t?.featureReduction||"selection"!==t.featureReduction.type)}function u(e){const t=e.graphics3DGraphics;t&&t.forEach(e=>e.setVisibilityFlag(1,8,!0))}p=e([o("esri.views.3d.layers.graphics.GraphicsDeconflictor")],p);export{p as GraphicsDeconflictor};
|
|
5
|
+
import{__decorate as e}from"tslib";import{destroyMaybe as t,removeMaybe as i}from"../../../../core/maybe.js";import{initial as s,watch as r,sync as a}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{t as c}from"../../../../chunks/boundedPlane.js";import{Deconflictor as h,DeconflictorGraphic as n}from"./Deconflictor.js";import{LabelDeconflictor as l}from"./LabelDeconflictor.js";import{TaskPriority as d}from"../../../support/Scheduler.js";let p=class extends h{constructor(){super(...arguments),this._contexts=new Map,this.visibilityGroup=1,this._marginFactor=-.1,this.test={overrideMarginFactor:e=>{this._marginFactor=e,this.setDirty()}}}get labels(){return this._labels}get viewState(){return this._viewState}initialize(){this._updatingHandles.add(()=>this.view?.state?.camera,()=>{this._updateViewState(),this.setDirty()}),this._updatingHandles.add(()=>this.view?.slice?.plane,()=>{this._updateSlicePlane(),this._slicePlaneChanged(),this.setDirty()},s),this.addHandles(r(()=>this.view.basemapTerrain?.updating||this.view.graphicsView?.updating||this.view.allLayerViews.some(e=>e.updating),(e,t)=>{!e&&t&&this.setDirty()},a)),this._frameTask=this.view.resourceController.scheduler.registerTask(d.GRAPHICS_DECONFLICTOR,this),this._labels=new l({view:this.view,parent:this})}destroy(){this._labels=t(this._labels),this._frameTask=i(this._frameTask)}get marginFactor(){return this._marginFactor}setDirty(){this._contexts.size>0&&(super.setDirty(),this._labels.setDirty())}runTask(e){const t=super.runTask(e);return this.readyToRun||this._labels.setDirty(),t}_updateViewState(){this.view?.state&&(this._viewState.camera.copyFrom(this.view.state.camera),this._updateSlicePlane())}_updateSlicePlane(){const e=this.view?.slice?.plane;null!=e&&c(e,this._viewState.camera.viewMatrix,this._viewState.slicePlane),this._viewState.slicePlaneEnabled=null!=e}_slicePlaneChanged(){for(const e of this._contexts.keys())if(e.symbolCreationContext.slicePlaneEnabled)return void this.setDirty()}addGraphicsOwner(e){const t=this._getGraphicsContext(e);return{addGraphic:i=>this._addGraphic(e,t,i),removeGraphic:e=>this._removeGraphic(t,e),labelingInfoChange:()=>this._labelsEnabledChanged(e,t),featureReductionChange:()=>this._enabledChanged(e,t),slicePlaneEnabledChange:()=>this._slicePlaneEnabledChanged(e,t),clear:()=>t.forEach(e=>this._removeGraphic(t,e.graphics3DGraphic)),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._contexts.get(e);t&&(t.forEach(e=>this._removeGraphic(t,e.graphics3DGraphic)),this._contexts.delete(e),this.setDirty())}_addGraphic(e,t,i){const s=i.graphic.uid,r=new n(i,e.symbolCreationContext.slicePlaneEnabled);t.set(s,r),this.addToCheckOcclusion(r),m(e)&&this.addToActiveGraphics(r),e.labelsEnabled&&(this._labels.addToCheckOcclusion(r),this._labels.addToActiveGraphics(r));const a=!this._graphicSupportsDeconfliction(i)||!m(e);i.setVisibilityFlag(1,8,a)}_removeGraphic(e,t){const i=t.graphic.uid,s=e.get(i);s&&(this.removeFromActiveGraphics(s),this.removeFromCheckOcclusion(s),this._labels.removeFromActiveGraphics(s),this._labels.removeFromCheckOcclusion(s),e.delete(i),this.setDirty())}_enabledChanged(e,t){m(e)?t.forEach(e=>this.addToActiveGraphics(e)):(t.forEach(e=>this.removeFromActiveGraphics(e)),u(e))}_labelsEnabledChanged(e,t){e.labelsEnabled?(t.forEach(e=>this._labels.addToCheckOcclusion(e)),t.forEach(e=>this._labels.addToActiveGraphics(e))):(t.forEach(e=>this._labels.removeFromCheckOcclusion(e)),t.forEach(e=>this._labels.removeFromActiveGraphics(e)))}_slicePlaneEnabledChanged(e,t){const i=e.symbolCreationContext.slicePlaneEnabled;t.forEach(e=>e.slicePlaneEnabled=i),this.setDirty()}_graphicSupportsDeconfliction(e){if(e.isDraped)return!1;const t=e.layers;if(!t?.length)return!1;for(const i of t)if(this.layerSupportsDeconfliction(i))return!0;return!1}_getGraphicsContext(e){const t=this._contexts.get(e);if(t)return t;const i=new Map;return this._contexts.set(e,i),this.setDirty(),i}};function m(e){const t=e.layer;return!(!t?.featureReduction||"selection"!==t.featureReduction.type)}function u(e){const t=e.graphics3DGraphics;t&&t.forEach(e=>e.setVisibilityFlag(1,8,!0))}p=e([o("esri.views.3d.layers.graphics.GraphicsDeconflictor")],p);export{p as GraphicsDeconflictor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{
|
|
5
|
+
import{__decorate as t}from"tslib";import{ShaderTechniqueConfiguration as o,parameter as r}from"../shaderTechnique/ShaderTechniqueConfiguration.js";class e extends o{constructor(){super(...arguments),this.output=0}}t([r({count:11})],e.prototype,"output",void 0);export{e as ShaderOutputConfiguration};
|