UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 5.44 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/JSONSupport.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{writer as i}from"../../core/accessorSupport/decorators/writer.js";import{isSupportedRendererType as n,combineRenderingRules as s,convertRendererToRenderingRule as a,convertRenderingRuleToRFT as p}from"./imageryRendererUtils.js";import l from"./MosaicRule.js";import{interpolationKebab as c,noDataInterpretationKebab as m,pixelTypeKebabDict as u}from"./rasterEnums.js";import y from"./RasterFunction.js";let d=class extends t{constructor(){super(...arguments),this.layer=null,this.requestRawData=!1,this.compression=void 0,this.lercVersion=2}get adjustAspectRatio(){return this.layer.adjustAspectRatio}writeAdjustAspectRatio(e,t,r){this.layer.version<10.3||(t[r]=e)}get bandIds(){return this.layer.bandIds}get compressionQuality(){return this.layer.compressionQuality}writeCompressionQuality(e,t,r){this.format&&this.format.toLowerCase().includes("jpg")&&null!=e&&(t[r]=e)}get compressionTolerance(){return this.layer.compressionTolerance}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get format(){return this.requestRawData||"vector-field"===this.layer.renderer?.type?"lerc":this.layer.format}get interpolation(){return this.layer.interpolation}get noData(){return this.layer.noData}get noDataInterpretation(){return this.layer.noDataInterpretation}get pixelType(){const{layer:e}=this;return e.pixelType!==e.serviceRasterInfo.pixelType?e.pixelType:void 0}writeLercVersion(e,t,r){"lerc"===this.format&&this.layer.version>=10.5&&(t[r]=e)}get version(){const e=this.layer;return e.commitProperty("bandIds"),e.commitProperty("format"),e.commitProperty("compressionQuality"),e.commitProperty("compressionTolerance"),e.commitProperty("interpolation"),e.commitProperty("noData"),e.commitProperty("noDataInterpretation"),e.commitProperty("mosaicRule"),e.commitProperty("rasterFunction"),e.commitProperty("adjustAspectRatio"),e.commitProperty("pixelFilter"),e.commitProperty("pixelType"),e.commitProperty("definitionExpression"),e.commitProperty("multidimensionalSubset"),(this._get("version")||0)+1}set version(e){this._set("version",e)}get mosaicRule(){const e=this.layer;let t=e.mosaicRule;const r=e.definitionExpression;return t?r&&r!==t.where&&(t=t.clone(),t.where=r):r&&(t=new l({where:r})),t}get rasterFunction(){const e=this.layer;let{rasterFunction:t}=e;const r=e.pixelFilter,o=!e.format||e.format.includes("jpg")||e.format.includes("png");this.requestRawData||(t=this._addResampleRasterFunction(t));const i=e.multidimensionalSubset?.areaOfInterest;return i&&(t=f(t,i)),this.requestRawData||!o||r||"vector-field"===e.renderer?.type||(t=this.combineRendererWithRenderingRule(t)),t}combineRendererWithRenderingRule(e){const t=this.layer,{rasterInfo:r,renderer:o}=t;if(e=e||t.rasterFunction,!o||!n(o))return e;return s(a(o,{rasterAttributeTable:r.attributeTable,pixelType:r.pixelType,dataType:r.dataType,bandNames:r.bandInfos.map((({name:e})=>e)),convertColorRampToColormap:t.version<10.6,convertToRFT:!!e?.rasterFunctionDefinition,bandCount:r.bandCount}),e)}_addResampleRasterFunction(e){if(!("vector-field"===this.layer.renderer?.type)||"Resample"===e?.functionName)return e;const t="esriImageServiceDataTypeVector-UV"===this.layer.serviceDataType?7:10,r=this.layer.serviceRasterInfo.pixelSize;let o=new y({functionName:"Resample",functionArguments:{ResamplingType:t,InputCellSize:r}});return o=e?.rasterFunctionDefinition?new y({rasterFunctionDefinition:p(o)}):o,s(o,e)}};function f(e,t){const r=new y({functionName:"Clip",functionArguments:{ClippingGeometry:t.toJSON(),ClippingType:1}});return s(r,e)}e([r()],d.prototype,"layer",void 0),e([r()],d.prototype,"requestRawData",void 0),e([r({json:{write:!0}})],d.prototype,"adjustAspectRatio",null),e([i("adjustAspectRatio")],d.prototype,"writeAdjustAspectRatio",null),e([r({json:{write:!0}})],d.prototype,"bandIds",null),e([r({json:{write:!0}})],d.prototype,"compression",void 0),e([r({json:{write:!0}})],d.prototype,"compressionQuality",null),e([i("compressionQuality")],d.prototype,"writeCompressionQuality",null),e([r({json:{write:!0}})],d.prototype,"compressionTolerance",null),e([i("compressionTolerance")],d.prototype,"writeCompressionTolerance",null),e([r({json:{write:!0}})],d.prototype,"format",null),e([r({type:String,json:{read:{reader:c.read},write:{writer:c.write}}})],d.prototype,"interpolation",null),e([r({json:{write:!0}})],d.prototype,"noData",null),e([r({type:String,json:{read:{reader:m.read},write:{writer:m.write}}})],d.prototype,"noDataInterpretation",null),e([r({type:u.apiValues,json:{read:u.read,write:u.write}})],d.prototype,"pixelType",null),e([r({json:{write:!0}})],d.prototype,"lercVersion",void 0),e([i("lercVersion")],d.prototype,"writeLercVersion",null),e([r({type:Number})],d.prototype,"version",null),e([r({json:{write:!0}})],d.prototype,"mosaicRule",null),e([r({json:{write:!0,name:"renderingRule"}})],d.prototype,"rasterFunction",null),d=e([o("esri.layers.support.ExportImageServiceParameters")],d);export{d as ExportImageServiceParameters};