@arcgis/core 4.26.0-next.20230213 → 4.26.0-next.20230215
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{4b41a08d603e846306da.js → 1faf0e2aeabe003e2f64.js} +1 -1
- package/assets/esri/core/workers/chunks/{1770729d33e57bb2919a.js → 674d4a032e6db9a86f74.js} +1 -1
- package/assets/esri/core/workers/chunks/8111fc49f8e8f260981d.js +1 -0
- package/assets/esri/core/workers/chunks/979d5e22dbdcec90029f.js +1 -0
- package/assets/esri/core/workers/chunks/9f8aad19c5973e201604.js +1 -0
- package/assets/esri/core/workers/chunks/{21f1d91121d95ef21604.js → bb6e4affafef9855b8fd.js} +1 -1
- package/assets/esri/core/workers/chunks/{accb787c5c8ee7bfe35b.js → caa8768192cecad99776.js} +1 -1
- package/interfaces.d.ts +2 -2
- package/layers/graphics/sources/support/QueryTask.js +1 -1
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/LocalFunction.js +1 -1
- package/layers/support/rasterFunctions/LocalFunctionArguments.js +1 -1
- package/layers/support/rasterFunctions/localUtils.js +1 -1
- package/package.json +1 -1
- package/portal/PortalItem.js +1 -1
- package/renderers/visualVariables/SizeVariable.js +1 -1
- package/rest/query/executeQuery.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMImageColorSubstitutionHelper.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveXYAxisManipulation.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
- package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
- package/views/interactive/snapping/Settings.js +1 -1
- package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
- package/widgets/FeatureForm/InputField.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/Slice.js +1 -1
- package/assets/esri/core/workers/chunks/52e40e348c27a0e66f9a.js +0 -1
- package/assets/esri/core/workers/chunks/8be68f08c270c62e38bb.js +0 -1
- package/assets/esri/core/workers/chunks/978220022a8c9a3e9261.js +0 -1
package/interfaces.d.ts
CHANGED
|
@@ -74125,7 +74125,7 @@ declare namespace __esri {
|
|
|
74125
74125
|
/**
|
|
74126
74126
|
* Snapping distance for snapping in pixels.
|
|
74127
74127
|
*
|
|
74128
|
-
* @default
|
|
74128
|
+
* @default 5
|
|
74129
74129
|
*
|
|
74130
74130
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-SnappingOptions.html#distance)
|
|
74131
74131
|
*/
|
|
@@ -74175,7 +74175,7 @@ declare namespace __esri {
|
|
|
74175
74175
|
/**
|
|
74176
74176
|
* Snapping distance for snapping in pixels.
|
|
74177
74177
|
*
|
|
74178
|
-
* @default
|
|
74178
|
+
* @default 5
|
|
74179
74179
|
*
|
|
74180
74180
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-SnappingOptions.html#distance)
|
|
74181
74181
|
*/
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Error.js";import has from"../../../../core/has.js";import{isNone as o,isSome as s}from"../../../../core/maybe.js";import{whenOrAbort as i}from"../../../../core/promiseUtils.js";import{urlToObject as u}from"../../../../core/urlUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{DataLayerSource as c}from"../../../support/source/DataLayerSource.js";import{parseUrl as p}from"../../../../rest/utils.js";import{executeForCount as l}from"../../../../rest/query/executeForCount.js";import{executeForExtent as m}from"../../../../rest/query/executeForExtent.js";import{executeForIds as y}from"../../../../rest/query/executeForIds.js";import{executeRawQueryJSON as d}from"../../../../rest/query/executeQueryJSON.js";import{executeRawQueryPBF as f}from"../../../../rest/query/executeQueryPBF.js";import h from"../../../../rest/support/FeatureSet.js";import S from"../../../../rest/support/Query.js";let F=class extends t{constructor(e){super(e),this.dynamicDataSource=null,this.fieldsIndex=null,this.gdbVersion=null,this.infoFor3D=null,this.pbfSupported=!1,this.queryAttachmentsSupported=!1,this.sourceSpatialReference=null,this.url=null}get parsedUrl(){return u(this.url)}async execute(e,t){const r=await this.executeJSON(e,t);return this.featureSetFromJSON(e,r,t)}async executeJSON(e,t){const r=this._normalizeQuery(e),o=null!=e.outStatistics?.[0],s=has("featurelayer-pbf-statistics"),i=!o||s;let u;if(this.pbfSupported&&i)try{u=await f(this.url,r,t)}catch(a){if("query:parsing-pbf"!==a.name)throw a;this.pbfSupported=!1}return this.pbfSupported&&i||(u=await d(this.url,r,t)),this._normalizeFields(u.fields),u}async featureSetFromJSON(e,t,r){if(!this._queryIs3DObjectFormat(e)||o(this.infoFor3D)||!t.assetMaps||!t.features||!t.features.length)return h.fromJSON(t);const{meshFeatureSetFromJSON:s}=await i(import("../../../../rest/support/meshFeatureSet.js"),r);return s(e,this.infoFor3D,t)}executeForCount(e,t){return l(this.url,this._normalizeQuery(e),t)}executeForExtent(e,t){return m(this.url,this._normalizeQuery(e),t)}executeForIds(e,t){return y(this.url,this._normalizeQuery(e),t)}async executeRelationshipQuery(e,t){const[{default:r},{executeRelationshipQuery:o}]=await i(Promise.all([import("../../../../rest/support/RelationshipQuery.js"),import("../../../../rest/query/executeRelationshipQuery.js")]),t);return e=r.from(e),(this.gdbVersion||this.dynamicDataSource)&&((e=e.clone()).gdbVersion=e.gdbVersion||this.gdbVersion,e.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource),o(this.url,e,t)}async executeRelationshipQueryForCount(e,t){const[{default:r},{executeRelationshipQueryForCount:o}]=await i(Promise.all([import("../../../../rest/support/RelationshipQuery.js"),import("../../../../rest/query/executeRelationshipQuery.js")]),t);return e=r.from(e),(this.gdbVersion||this.dynamicDataSource)&&((e=e.clone()).gdbVersion=e.gdbVersion||this.gdbVersion,e.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource),o(this.url,e,t)}async executeAttachmentQuery(e,t){const{executeAttachmentQuery:r,fetchAttachments:o,processAttachmentQueryResult:s}=await i(import("../../../../rest/query/operations/queryAttachments.js"),t),u=p(this.url);return s(u,await(this.queryAttachmentsSupported?r(u,e,t):o(u,e,t)))}async executeTopFeaturesQuery(e,t){const{executeTopFeaturesQuery:r}=await i(import("../../../../rest/query/executeTopFeaturesQuery.js"),t);return r(this.parsedUrl,e,this.sourceSpatialReference,t)}async executeForTopIds(e,t){const{executeForTopIds:r}=await i(import("../../../../rest/query/executeForTopIds.js"),t);return r(this.parsedUrl,e,t)}async executeForTopExtents(e,t){const{executeForTopExtents:r}=await i(import("../../../../rest/query/executeForTopExtents.js"),t);return r(this.parsedUrl,e,t)}async executeForTopCount(e,t){const{executeForTopCount:r}=await i(import("../../../../rest/query/executeForTopCount.js"),t);return r(this.parsedUrl,e,t)}_normalizeQuery(e){let t=S.from(e);if(t.sourceSpatialReference=t.sourceSpatialReference||this.sourceSpatialReference,(this.gdbVersion||this.dynamicDataSource)&&(t=t===e?t.clone():t,t.gdbVersion=e.gdbVersion||this.gdbVersion,t.dynamicDataSource=e.dynamicDataSource?c.from(e.dynamicDataSource):this.dynamicDataSource),s(this.infoFor3D)&&this._queryIs3DObjectFormat(e)){t=t===e?t.clone():t,t.formatOf3DObjects=null;for(const e of this.infoFor3D.queryFormats){if("3D_glb"===e){t.formatOf3DObjects=e;break}"3D_gltf"!==e||t.formatOf3DObjects||(t.formatOf3DObjects=e)}if(!t.formatOf3DObjects)throw new r("query:unsupported-3d-query-formats","Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf");if(o(t.outFields)||!t.outFields.includes("*")){t=t===e?t.clone():t,o(t.outFields)&&(t.outFields=[]);const{originX:r,originY:s,originZ:i,translationX:u,translationY:a,translationZ:n,scaleX:c,scaleY:p,scaleZ:l,rotationX:m,rotationY:y,rotationZ:d,rotationDeg:f}=this.infoFor3D.transformFieldRoles;t.outFields.push(r,s,i,u,a,n,c,p,l,m,y,d,f)}}return t}_normalizeFields(e){if(s(this.fieldsIndex)&&s(e))for(const t of e){const e=this.fieldsIndex.get(t.name);e&&Object.assign(t,e.toJSON())}}_queryIs3DObjectFormat(e){return s(this.infoFor3D)
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Error.js";import has from"../../../../core/has.js";import{isNone as o,isSome as s}from"../../../../core/maybe.js";import{whenOrAbort as i}from"../../../../core/promiseUtils.js";import{urlToObject as u}from"../../../../core/urlUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{DataLayerSource as c}from"../../../support/source/DataLayerSource.js";import{parseUrl as p}from"../../../../rest/utils.js";import{executeForCount as l}from"../../../../rest/query/executeForCount.js";import{executeForExtent as m}from"../../../../rest/query/executeForExtent.js";import{executeForIds as y}from"../../../../rest/query/executeForIds.js";import{executeRawQueryJSON as d}from"../../../../rest/query/executeQueryJSON.js";import{executeRawQueryPBF as f}from"../../../../rest/query/executeQueryPBF.js";import h from"../../../../rest/support/FeatureSet.js";import S from"../../../../rest/support/Query.js";let F=class extends t{constructor(e){super(e),this.dynamicDataSource=null,this.fieldsIndex=null,this.gdbVersion=null,this.infoFor3D=null,this.pbfSupported=!1,this.queryAttachmentsSupported=!1,this.sourceSpatialReference=null,this.url=null}get parsedUrl(){return u(this.url)}async execute(e,t){const r=await this.executeJSON(e,t);return this.featureSetFromJSON(e,r,t)}async executeJSON(e,t){const r=this._normalizeQuery(e),o=null!=e.outStatistics?.[0],s=has("featurelayer-pbf-statistics"),i=!o||s;let u;if(this.pbfSupported&&i)try{u=await f(this.url,r,t)}catch(a){if("query:parsing-pbf"!==a.name)throw a;this.pbfSupported=!1}return this.pbfSupported&&i||(u=await d(this.url,r,t)),this._normalizeFields(u.fields),u}async featureSetFromJSON(e,t,r){if(!this._queryIs3DObjectFormat(e)||o(this.infoFor3D)||!t.assetMaps||!t.features||!t.features.length)return h.fromJSON(t);const{meshFeatureSetFromJSON:s}=await i(import("../../../../rest/support/meshFeatureSet.js"),r);return s(e,this.infoFor3D,t)}executeForCount(e,t){return l(this.url,this._normalizeQuery(e),t)}executeForExtent(e,t){return m(this.url,this._normalizeQuery(e),t)}executeForIds(e,t){return y(this.url,this._normalizeQuery(e),t)}async executeRelationshipQuery(e,t){const[{default:r},{executeRelationshipQuery:o}]=await i(Promise.all([import("../../../../rest/support/RelationshipQuery.js"),import("../../../../rest/query/executeRelationshipQuery.js")]),t);return e=r.from(e),(this.gdbVersion||this.dynamicDataSource)&&((e=e.clone()).gdbVersion=e.gdbVersion||this.gdbVersion,e.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource),o(this.url,e,t)}async executeRelationshipQueryForCount(e,t){const[{default:r},{executeRelationshipQueryForCount:o}]=await i(Promise.all([import("../../../../rest/support/RelationshipQuery.js"),import("../../../../rest/query/executeRelationshipQuery.js")]),t);return e=r.from(e),(this.gdbVersion||this.dynamicDataSource)&&((e=e.clone()).gdbVersion=e.gdbVersion||this.gdbVersion,e.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource),o(this.url,e,t)}async executeAttachmentQuery(e,t){const{executeAttachmentQuery:r,fetchAttachments:o,processAttachmentQueryResult:s}=await i(import("../../../../rest/query/operations/queryAttachments.js"),t),u=p(this.url);return s(u,await(this.queryAttachmentsSupported?r(u,e,t):o(u,e,t)))}async executeTopFeaturesQuery(e,t){const{executeTopFeaturesQuery:r}=await i(import("../../../../rest/query/executeTopFeaturesQuery.js"),t);return r(this.parsedUrl,e,this.sourceSpatialReference,t)}async executeForTopIds(e,t){const{executeForTopIds:r}=await i(import("../../../../rest/query/executeForTopIds.js"),t);return r(this.parsedUrl,e,t)}async executeForTopExtents(e,t){const{executeForTopExtents:r}=await i(import("../../../../rest/query/executeForTopExtents.js"),t);return r(this.parsedUrl,e,t)}async executeForTopCount(e,t){const{executeForTopCount:r}=await i(import("../../../../rest/query/executeForTopCount.js"),t);return r(this.parsedUrl,e,t)}_normalizeQuery(e){let t=S.from(e);if(t.sourceSpatialReference=t.sourceSpatialReference||this.sourceSpatialReference,(this.gdbVersion||this.dynamicDataSource)&&(t=t===e?t.clone():t,t.gdbVersion=e.gdbVersion||this.gdbVersion,t.dynamicDataSource=e.dynamicDataSource?c.from(e.dynamicDataSource):this.dynamicDataSource),s(this.infoFor3D)&&this._queryIs3DObjectFormat(e)){t=t===e?t.clone():t,t.formatOf3DObjects=null;for(const e of this.infoFor3D.queryFormats){if("3D_glb"===e){t.formatOf3DObjects=e;break}"3D_gltf"!==e||t.formatOf3DObjects||(t.formatOf3DObjects=e)}if(!t.formatOf3DObjects)throw new r("query:unsupported-3d-query-formats","Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf");if(o(t.outFields)||!t.outFields.includes("*")){t=t===e?t.clone():t,o(t.outFields)&&(t.outFields=[]);const{originX:r,originY:s,originZ:i,translationX:u,translationY:a,translationZ:n,scaleX:c,scaleY:p,scaleZ:l,rotationX:m,rotationY:y,rotationZ:d,rotationDeg:f}=this.infoFor3D.transformFieldRoles;t.outFields.push(r,s,i,u,a,n,c,p,l,m,y,d,f)}}return t}_normalizeFields(e){if(s(this.fieldsIndex)&&s(e))for(const t of e){const e=this.fieldsIndex.get(t.name);e&&Object.assign(t,e.toJSON())}}_queryIs3DObjectFormat(e){return s(this.infoFor3D)&&!0===e.returnGeometry&&"xyFootprint"!==e.multipatchOption&&!e.outStatistics}};e([a({type:c})],F.prototype,"dynamicDataSource",void 0),e([a()],F.prototype,"fieldsIndex",void 0),e([a()],F.prototype,"gdbVersion",void 0),e([a()],F.prototype,"infoFor3D",void 0),e([a({readOnly:!0})],F.prototype,"parsedUrl",null),e([a()],F.prototype,"pbfSupported",void 0),e([a()],F.prototype,"queryAttachmentsSupported",void 0),e([a()],F.prototype,"sourceSpatialReference",void 0),e([a({type:String})],F.prototype,"url",void 0),F=e([n("esri.tasks.QueryTask")],F);const x=F;export{x as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import{JSONSupport as s}from"../../../core/JSONSupport.js";import{isSome as e,isNone as r}from"../../../core/maybe.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../../core/accessorSupport/decorators/cast.js";import"../../../core/arrayUtils.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";let
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import{JSONSupport as s}from"../../../core/JSONSupport.js";import{isSome as e,isNone as r}from"../../../core/maybe.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../../core/accessorSupport/decorators/cast.js";import"../../../core/arrayUtils.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../PixelBlock.js";import u from"../RasterInfo.js";let p=class extends s{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],this.isInputBandIdsSwizzled=!1,this.swizzledBandSelection=[],this.isBranch=!1,this._bindingResult=null}get supportsGPU(){return this._bindingResult.supportsGPU}bind(t,s=!1,r=-1){this.id=r+1;const i=this._getRasterValues();let n=!0;for(let o=0;o<i.length;o++){const r=i[o];if(e(r)&&this._isRasterFunctionValue(r)){const e=r.bind(t,s,this.id+o);if(!e.success)return this._bindingResult=e,e;n=n&&e.supportsGPU}}return!this.rasterInfo||s?(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindingResult=this._bindSourceRasters(),this._bindingResult.supportsGPU=n&&this._bindingResult.supportsGPU,this.processInputBandIds(),this._bindingResult):(this._bindingResult={success:!0,supportsGPU:!0},this.processInputBandIds(),this._bindingResult)}process(t){const s=this._getRasterValues(),e=0===s.length?t.pixelBlocks??t.primaryPixelBlocks:s.map((s=>this._readRasterValue(s,t)));return this._processPixels({...t,pixelBlocks:e})}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);let s;if(t.length>1){const s=t.map((t=>t.processInputBandIds()[0]));this.rawInputBandIds=s,this.isInputBandIdsSwizzled=this.rawInputBandIds.some(((t,s)=>t!==s));const e=t.filter((t=>"ExtractBand"===t.functionName));return e.length&&e.forEach(((t,s)=>{t.isInputBandIdsSwizzled=!0,t.swizzledBandSelection=[s,s,s]})),this.rawInputBandIds}const e=t[0];if(e){if(s=e.processInputBandIds(),e.isInputBandIdsSwizzled)return this.rawInputBandIds=s,s}else{s=[];const{bandCount:t}=this.sourceRasterInfos[0];for(let e=0;e<t;e++)s.push(e)}const r=this._getInputBandIds(s);return this.isInputBandIdsSwizzled=r.some(((t,s)=>t!==s)),this.rawInputBandIds=r,this.rawInputBandIds}getPrimaryRasters(){const t=[],s=[];return this._getPrimaryRasters(this,t,s),{rasters:t,rasterIds:s}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:s,rasters:e}=this.functionArguments;return e&&Array.isArray(e)&&e.length?(t.rasters=e.map((t=>this._isRasterFunctionValue(t)?t.getWebGLProcessorDefinition():"number"==typeof t?{name:"Constant",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1})),t.rasters.some((t=>null!=t))||(t.rasters=null)):this._isRasterFunctionValue(s)&&(t.raster=s.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}getFlatWebGLFunctionChain(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const s=[t],{parameters:e}=t;let r=e.rasters||e.raster&&[e.raster];for(;r?.length;){s.unshift(...r);const t=[];for(let s=0;s<r.length;s++){const{parameters:e}=r[s],i=e.rasters||e.raster&&[e.raster];i?.length&&t.push(...i)}r=t}for(let n=s.length-1;n>=0;n--)s[n].isNoopProcess&&s.splice(n,1);let i=!1;for(let n=0;n<s.length;n++){const t=s[n];t.id=s.length-n-1;const{rasters:e}=t.parameters;i=i||null!=e&&e.length>1}return{hasBranches:i,functions:s}}_getOutputPixelType(t){return"unknown"===this.outputPixelType?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_isOutputRoundingNeeded(){const{outputPixelType:t}=this;return(t?.startsWith("u")||t?.startsWith("s"))??!1}_getRasterValues(){const{rasterArgumentNames:t}=this;return"rasters"===t[0]?this.functionArguments.rasters??[]:t.map((t=>this.functionArguments[t]))}_getSourceRasterInfos(t){const s=this._getRasterValues(),{rasterInfos:e,rasterIds:r}=t;if(0===s.length)return e;const i=s.map((t=>t&&"object"==typeof t&&"bind"in t&&t.rasterInfo?t.rasterInfo:"string"==typeof t&&r.includes(t)?e[r.indexOf(t)]:"number"!=typeof t?e[0]:void 0)),n=i.find((t=>t))??e[0];return i.forEach(((t,s)=>{void 0===t&&(i[s]=n)})),i}_getPrimaryRasterId(t){return t?.url}_getPrimaryRasters(t,s=[],e=[]){for(let r=0;r<t.sourceRasters.length;r++){const i=t.sourceRasters[r];if("number"!=typeof i)if("bind"in i)this._getPrimaryRasters(i,s,e);else{const t=i,r=this._getPrimaryRasterId(t);if(null==r)continue;e.includes(r)||(this.mainPrimaryRasterId===r?(s.unshift(t),e.unshift(r)):(s.push(t),e.push(r)))}}}_isRasterFunctionValue(t){return null!=t&&"object"==typeof t&&"getWebGLProcessorDefinition"in t}_readRasterValue(t,s){const{primaryPixelBlocks:e}=s;if(r(t)||"$$"===t){const t=e[0];return r(t)?null:t.clone()}if("string"==typeof t){const r=s.primaryRasterIds.indexOf(t);return-1===r?null:e[r]}if("number"==typeof t){const s=e[0];if(r(s))return null;const{width:i,height:n,pixelType:o,mask:u}=s,p=u?new Uint8Array(u):null,l=new Float32Array(i*n);l.fill(t);const d=this.sourceRasterInfos[0].bandCount,c=new Array(d).fill(l);return new a({width:i,height:n,pixelType:o,pixels:c,mask:p})}return t.process(s)}};t([i({json:{write:!0}})],p.prototype,"functionName",void 0),t([i({json:{write:!0}})],p.prototype,"functionArguments",void 0),t([i()],p.prototype,"rasterArgumentNames",void 0),t([i({json:{write:!0}}),n((t=>t?.toLowerCase()))],p.prototype,"outputPixelType",void 0),t([i({json:{write:!0}})],p.prototype,"mainPrimaryRasterId",void 0),t([i()],p.prototype,"sourceRasters",void 0),t([i({type:[u],json:{write:!0}})],p.prototype,"sourceRasterInfos",void 0),t([i({json:{write:!0}})],p.prototype,"rasterInfo",void 0),t([i({json:{write:!0}})],p.prototype,"readingBufferSize",void 0),t([i({json:{write:!0}})],p.prototype,"id",void 0),t([i()],p.prototype,"isNoopProcess",void 0),t([i()],p.prototype,"supportsGPU",null),t([i()],p.prototype,"rawInputBandIds",void 0),t([i()],p.prototype,"isInputBandIdsSwizzled",void 0),t([i()],p.prototype,"swizzledBandSelection",void 0),t([i()],p.prototype,"isBranch",void 0),t([i()],p.prototype,"_bindingResult",void 0),p=t([o("esri.layers.support.rasterFunctions.BaseRasterFunction")],p);const l=p;export{l as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import{isNone as s}from"../../../core/maybe.js";import{property as
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import{isNone as s}from"../../../core/maybe.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import{localOperators as r}from"../rasterFunctionConstants.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";import i from"./BaseRasterFunction.js";import u from"./LocalFunctionArguments.js";import{operandsCount as a,getOutputDomain as c,local as p}from"./localUtils.js";let m=class extends i{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,s=t[0],{bandCount:o}=s,{processAsMultiband:e}=this.functionArguments;if(t.some((t=>t.bandCount!==o)))return{success:!1,supportsGPU:!1,error:"local-function: input rasters do not have same band count"};const{operation:r,rasters:n}=this.functionArguments,i=a[r];if(!(999===i||n.length===i||n.length<=1&&1===i))return{success:!1,supportsGPU:!1,error:`local-function: the length of functionArguments.rasters does not match operation's requirement: ${i}`};this.outputPixelType=this._getOutputPixelType("f32");const u=s.clone();u.pixelType=this.outputPixelType,u.statistics=null,u.histograms=null,u.colormap=null,u.attributeTable=null,u.bandCount=999!==i||e?o:1;const p=c(r);if(p){u.statistics=[];for(let t=0;t<u.bandCount;t++)u.statistics[t]={min:p[0],max:p[1],avg:(p[0]+p[1])/2,stddev:(p[0]+p[1])/10}}this.rasterInfo=u;return{success:!0,supportsGPU:1===u.bandCount&&i<=3&&(r<11||r>16)}}_processPixels(t){const{pixelBlocks:o}=t;return s(o)||o.some((t=>s(t)))?null:p(o,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:this.outputPixelType??void 0})}_getWebGLParameters(){const{operation:t}=this.functionArguments,s=a[t],o=Object.keys(r).find((s=>r[s]===t))?.toLowerCase()??"undefined",e=this.outputPixelType??"f32";let[i,u]=n(e);const c=e.startsWith("u")||e.startsWith("s");return c&&(i-=1e-4,u+=1e-4),{imageCount:s,operationName:o,domainRange:[i,u],isOutputRounded:c}}};t([o({json:{write:!0,name:"rasterFunction"}})],m.prototype,"functionName",void 0),t([o({type:u,json:{write:!0,name:"rasterFunctionArguments"}})],m.prototype,"functionArguments",void 0),t([o()],m.prototype,"rasterArgumentNames",void 0),m=t([e("esri.layers.support.rasterFunctions.LocalFunction")],m);const l=m;export{l as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../../chunks/tslib.es6.js";import{clone as s}from"../../../core/lang.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as e}from"../../../core/accessorSupport/decorators/writer.js";import p from"./BaseFunctionArguments.js";var a;let i=a=class extends p{constructor(){super(...arguments),this.rasters=[],this.processAsMultiband=!
|
|
5
|
+
import{_ as r}from"../../../chunks/tslib.es6.js";import{clone as s}from"../../../core/lang.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as e}from"../../../core/accessorSupport/decorators/writer.js";import p from"./BaseFunctionArguments.js";var a;let i=a=class extends p{constructor(){super(...arguments),this.rasters=[],this.processAsMultiband=!0}writeRasters(r,s){s.rasters=r.map((r=>"number"==typeof r||"string"==typeof r?r:r.toJSON()))}clone(){return new a({operation:this.operation,processAsMultiband:this.processAsMultiband,rasters:s(this.rasters)})}};r([o({json:{write:!0}})],i.prototype,"operation",void 0),r([o({json:{write:!0}})],i.prototype,"rasters",void 0),r([e("rasters")],i.prototype,"writeRasters",null),r([o({json:{write:!0}})],i.prototype,"processAsMultiband",void 0),i=a=r([t("esri.layers.support.rasterFunctions.LocalFunctionArguments")],i);const c=i;export{c as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as t}from"../../../core/maybe.js";import e from"../PixelBlock.js";import{localTrigonometricOperation as n,localLogicalOperation as r,localConditionalOperation as o}from"../rasterFunctionConstants.js";import{getPixelValueRange as s}from"../rasterFormats/pixelRangeUtils.js";const a=new Map;function l(t){return a.get(t)}a.set(n.acos,[0,Math.PI]),a.set(n.asin,[-Math.PI/2,Math.PI/2]),a.set(n.atan,[-Math.PI/2,Math.PI/2]),a.set(n.cos,[-1,1]),a.set(n.sin,[-1,1]),a.set(r.booleanAnd,[0,1]),a.set(r.booleanNot,[0,1]),a.set(r.booleanOr,[0,1]),a.set(r.booleanXOr,[0,1]),a.set(r.equalTo,[0,1]),a.set(r.notEqual,[0,1]),a.set(r.greaterThan,[0,1]),a.set(r.greaterThanEqual,[0,1]),a.set(r.lessThan,[0,1]),a.set(r.lessThanEqual,[0,1]),a.set(r.isNull,[0,1]);const c=[0,2,2,2,1,2,1,1,1,1,1,2,2,1,2,2,2,2,1,2,2,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,999,999,999,999,999,999,2,1,2,999,1,1,2,1,1,1,999,999,1,1,999,1,1,2,999,999,2,2,999,999,999,999,999,999,999,999,999,999,3,999,3];function f(e,n=!1){const r=e.map((t=>t.mask)),o=r.filter((e=>t(e))),s=e[0].pixels[0].length;if(0===o.length)return new Uint8Array(s).fill(255);const a=o[0],l=new Uint8Array(a);if(1===o.length)return l;if(!n){for(let t=1;t<o.length;t++){const e=o[t];for(let t=0;t<l.length;t++)l[t]&&(l[t]=e[t]?255:0)}return l}if(o.length!==r.length)return new Uint8Array(s).fill(255);for(let t=1;t<o.length;t++){const e=o[t];for(let t=0;t<l.length;t++)0===l[t]&&(l[t]=e[t]?255:0)}return l}function u(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]+s[e]);return l}function h(t,n,r){const[o]=t,s=o.length,a=e.createEmptyBand("f32",s);return a.set(o),a}function i(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]-s[e]);return l}function g(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]*s[e]);return l}function p(t,n,r){const[o]=t,s=o.length,a=e.createEmptyBand(r,s);for(let e=0;e<s;e++)n&&!n[e]||(a[e]=Math.sign(o[e])*Math.floor(Math.abs(o[e])));return a}function m(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]/s[e]);return l}function y(t,e,n){return m(t,e,"f32")}function d(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=Math.floor(o[e]/s[e]));return l}function M(t,r,o,s){const a=t[0],l=a.length,c=e.createEmptyBand(o,l);if(s===n.atanh){for(let t=0;t<l;t++)if(r[t]){const e=a[t];Math.abs(e)>=1?r[t]=0:c[t]=Math.atanh(e)}return c}const f=s===n.asin?Math.asin:Math.acos;for(let e=0;e<l;e++)if(r[e]){const t=a[e];Math.abs(t)>1?r[e]=0:c[e]=f(t)}return c}function E(t,n,r,o){const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o(s[e]));return l}function B(t,n,r,o){const[s,a]=t,l=s.length,c=e.createEmptyBand(r,l);for(let e=0;e<l;e++)n&&!n[e]||(c[e]=o(s[e],a[e]));return c}function w(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]&s[e]);return l}function b(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]<<s[e]);return l}function x(t,n,r){const[o]=t,s=o.length,a=e.createEmptyBand(r,s);for(let e=0;e<s;e++)n&&!n[e]||(a[e]=~o[e]);return a}function A(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]|s[e]);return l}function k(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]>>s[e]);return l}function N(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]^s[e]);return l}function P(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]&&s[e]?1:0);return l}function T(t,n,r){const[o]=t,s=o.length,a=e.createEmptyBand(r,s);for(let e=0;e<s;e++)n&&!n[e]||(a[e]=o[e]?0:1);return a}function q(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]||s[e]?1:0);return l}function U(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=(o[e]?1:0)^(s[e]?1:0));return l}function I(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]===s[e]?1:0);return l}function j(t,n,r,o){const[s]=t,a=s.length,l=e.createEmptyBand(r,a),c=o===Math.E;for(let e=0;e<a;e++)n&&!n[e]||(l[e]=c?Math.exp(s[e]):o**s[e]);return l}function F(t,e,n){return j(t,e,n,10)}function z(t,e,n){return j(t,e,n,2)}function O(t,e,n){return j(t,e,n,Math.E)}function W(t,n,r,o){const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(s[e]<=0?n[e]=0:l[e]=o(s[e]));return l}function C(t,e,n){return W(t,e,n,Math.log10)}function R(t,e,n){return W(t,e,n,Math.log2)}function S(t,e,n){return W(t,e,n,Math.log)}function X(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]>s[e]?1:0);return l}function v(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]>=s[e]?1:0);return l}function D(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]<s[e]?1:0);return l}function G(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]<=s[e]?1:0);return l}function H(t,n,r){const[o]=t,s=o.length,a=e.createEmptyBand(r,s);if(!n)return a;for(let e=0;e<s;e++)a[e]=n[e]?0:1;return a}function J(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]%s[e]);return l}function K(t,n,r){const[o]=t,s=o.length,a=e.createEmptyBand(r,s);for(let e=0;e<s;e++)n&&!n[e]||(a[e]=-o[e]);return a}function L(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]===s[e]?0:1);return l}function Q(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a),c=new Uint8Array(a);for(let e=0;e<a;e++)null!=n&&!n[e]||0!==o[e]||(l[e]=s[e],c[e]=255);return{band:l,mask:c}}function V(t,n,r){const[o,s,a]=t,l=o.length,c=e.createEmptyBand(r,l);for(let e=0;e<l;e++)n&&!n[e]||(c[e]=o[e]?s[e]:a[e]);return c}function Y(t,n,r){const o=t.length;if(o<2)return t[0];const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)if(!n||n[e]){let n=s[e];for(let r=1;r<o;r++){const o=t[r][e];n<o&&(n=o)}l[e]=n}return l}function Z(t,n,r){const o=t.length;if(o<2)return t[0];const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)if(!n||n[e]){let n=s[e];for(let r=1;r<o;r++){const o=t[r][e];n>o&&(n=o)}l[e]=n}return l}function $(t,n,r){const o=t.length;if(o<2)return t[0];const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)if(!n||n[e]){let n=s[e],r=n;for(let s=1;s<o;s++){const o=t[s][e];r<o?r=o:n>o&&(n=o)}l[e]=r-n}return l}function _(t,n,r){const o=t.length;if(o<2)return t[0];const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)if(!n||n[e]){let n=0;for(let r=0;r<o;r++)n+=t[r][e];l[e]=n/o}return l}function tt(t,n,r){const o=t.length;if(o<2)return t[0];const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)if(!n||n[e])for(let n=0;n<o;n++){const r=t[n];l[e]+=r[e]}return l}function et(t,n,r){const o=t.length;if(o<2)return t[0];const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)if(!n||n[e]){const n=new Float32Array(o);let r=0;for(let a=0;a<o;a++){const o=t[a];r+=o[e],n[a]=o[e]}r/=o;let s=0;for(let t=0;t<o;t++)s+=(n[t]-r)**2;l[e]=Math.sqrt(s/o)}return l}function nt(t,n,r){const o=t.length;if(o<2)return t[0];const s=Math.floor(o/2),[a]=t,l=a.length,c=e.createEmptyBand(r,l),f=new Float32Array(o),u=o%2==1;for(let e=0;e<l;e++)if(!n||n[e]){for(let n=0;n<o;n++)f[n]=t[n][e];f.sort(),c[e]=u?f[s]:(f[s]+f[s-1])/2}return c}function rt(t,n,r){const[o,s]=t;if(null==s)return o;const a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n[e]&&(o[e]===s[e]?l[e]=o[e]:n[e]=0);return l}function ot(t,n,r){const o=t.length;if(o<=2)return rt(t,n,r);const s=t[0].length,a=e.createEmptyBand(r,s),l=new Map;for(let e=0;e<s;e++)if(!n||n[e]){let n;l.clear();for(let a=0;a<o;a++)n=t[a][e],l.set(n,l.has(n)?l.get(n)+1:1);let r=0,s=0;for(const t of l.keys())r=l.get(t),r>s&&(s=r,n=t);a[e]=n}return a}function st(t,n,r){const o=t.length;if(o<=2)return rt(t,n,r);const s=t[0].length,a=e.createEmptyBand(r,s),l=new Map;for(let e=0;e<s;e++)if(!n||n[e]){let n;l.clear();for(let a=0;a<o;a++)n=t[a][e],l.set(n,l.has(n)?l.get(n)+1:1);let r=0,s=t.length;for(const t of l.keys())r=l.get(t),r<s&&(s=r,n=t);a[e]=n}return a}function at(t,n,r){const o=t.length;if(o<2)return t[0];const[s]=t,a=s.length,l=e.createEmptyBand(r,a),c=new Set;for(let e=0;e<a;e++)if(!n||n[e]){let n;c.clear();for(let r=0;r<o;r++)n=t[r][e],c.add(n);l[e]=c.size}return l}const lt=new Map,ct=new Map,ft=new Map,ut=new Map;function ht(){lt.size||(lt.set(4,Math.sqrt),lt.set(6,Math.acos),lt.set(7,Math.asin),lt.set(8,Math.atan),lt.set(9,Math.atanh),lt.set(10,Math.abs),lt.set(21,Math.cos),lt.set(22,Math.cosh),lt.set(48,Math.floor),lt.set(49,Math.ceil),lt.set(51,Math.sin),lt.set(52,Math.sinh),lt.set(56,Math.tan),lt.set(57,Math.tanh),lt.set(59,Math.acosh),lt.set(60,Math.asinh),lt.set(65,Math.floor),ct.set(5,Math.pow),ct.set(61,Math.atan2),ft.set(1,u),ft.set(2,i),ft.set(3,g),ft.set(11,w),ft.set(12,b),ft.set(12,b),ft.set(13,x),ft.set(14,A),ft.set(15,k),ft.set(16,N),ft.set(17,P),ft.set(18,T),ft.set(19,q),ft.set(20,U),ft.set(23,m),ft.set(24,I),ft.set(25,O),ft.set(26,F),ft.set(27,z),ft.set(28,X),ft.set(29,v),ft.set(30,p),ft.set(31,H),ft.set(32,h),ft.set(33,D),ft.set(34,G),ft.set(35,S),ft.set(36,C),ft.set(37,R),ft.set(44,J),ft.set(45,K),ft.set(46,L),ft.set(64,y),ft.set(65,d),ft.set(76,V),ft.set(78,V),ut.set(38,ot),ut.set(39,Y),ut.set(40,_),ut.set(41,nt),ut.set(42,Z),ut.set(43,st),ut.set(47,$),ut.set(54,et),ut.set(55,tt),ut.set(58,at),ut.set(66,ot),ut.set(67,Y),ut.set(68,_),ut.set(69,nt),ut.set(70,Z),ut.set(71,st),ut.set(72,$),ut.set(73,et),ut.set(74,tt),ut.set(75,at))}function it(t,e,n,r){let[o,a]=s(n);const l=n.startsWith("u")||n.startsWith("s");l&&(o-=1e-5,a+=1e-5);for(let s=0;s<e.length;s++)if(e[s]){const n=t[s];isNaN(n)||n<o||n>a?e[s]=0:r[s]=l?Math.round(n):n}}function gt(t,s,l={}){ht();let c=f(t,s>=66&&s<=75);const{processAsMultiband:u,outputPixelType:h="f32"}=l,i=u?t[0].pixels.length:1,g=[];for(let f=0;f<i;f++){const l=ut.has(s)&&!u?t.flatMap((t=>t.pixels)):t.map((t=>t.pixels[f]));let i,p=!0;if(s===o.setNull){const t=Q(l,c,h);i=t.band,c=t.mask,p=!1}else if(ft.has(s)){i=ft.get(s)(l,c,"f64")}else if(lt.has(s))i=s===n.asin||s===n.acos||s===n.atanh?M(l,c,"f64",s):E(l,c,"f64",lt.get(s));else if(ct.has(s))i=B(l,c,"f64",ct.get(s));else if(ut.has(s)){i=ut.get(s)(l,c,"f64")}else i=l[0],p=!1;if(p&&s!==r.isNull&&!a.has(s)){const t=e.createEmptyBand(h,i.length);c||(c=new Uint8Array(i.length).fill(255)),it(i,c,h,t),i=t}g.push(i)}const p=t[0];return new e({width:p.width,height:p.height,pixelType:h,mask:s===r.isNull?null:c,pixels:g})}export{l as getOutputDomain,gt as local,c as operandsCount};
|
|
5
|
+
import{isSome as t}from"../../../core/maybe.js";import e from"../PixelBlock.js";import{localTrigonometricOperation as n,localLogicalOperation as r,localConditionalOperation as o}from"../rasterFunctionConstants.js";import{getPixelValueRange as s}from"../rasterFormats/pixelRangeUtils.js";const a=new Map;function l(t){return a.get(t)}a.set(n.acos,[0,Math.PI]),a.set(n.asin,[-Math.PI/2,Math.PI/2]),a.set(n.atan,[-Math.PI/2,Math.PI/2]),a.set(n.cos,[-1,1]),a.set(n.sin,[-1,1]),a.set(r.booleanAnd,[0,1]),a.set(r.booleanNot,[0,1]),a.set(r.booleanOr,[0,1]),a.set(r.booleanXOr,[0,1]),a.set(r.equalTo,[0,1]),a.set(r.notEqual,[0,1]),a.set(r.greaterThan,[0,1]),a.set(r.greaterThanEqual,[0,1]),a.set(r.lessThan,[0,1]),a.set(r.lessThanEqual,[0,1]),a.set(r.isNull,[0,1]);const c=[0,2,2,2,1,2,1,1,1,1,1,2,2,1,2,2,2,2,1,2,2,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,999,999,999,999,999,999,2,1,2,999,1,1,2,1,1,1,999,999,1,1,999,1,1,2,999,999,2,2,999,999,999,999,999,999,999,999,999,999,3,999,3];function f(e,n=!1){const r=e.map((t=>t.mask)),o=r.filter((e=>t(e))),s=e[0].pixels[0].length;if(0===o.length)return new Uint8Array(s).fill(255);const a=o[0],l=new Uint8Array(a);if(1===o.length)return l;if(!n){for(let t=1;t<o.length;t++){const e=o[t];for(let t=0;t<l.length;t++)l[t]&&(l[t]=e[t]?255:0)}return l}if(o.length!==r.length)return new Uint8Array(s).fill(255);for(let t=1;t<o.length;t++){const e=o[t];for(let t=0;t<l.length;t++)0===l[t]&&(l[t]=e[t]?255:0)}return l}function u(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]+s[e]);return l}function h(t,n,r){const[o]=t,s=o.length,a=e.createEmptyBand("f32",s);return a.set(o),a}function i(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]-s[e]);return l}function g(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]*s[e]);return l}function p(t,n,r){const[o]=t,s=o.length,a=e.createEmptyBand(r,s);for(let e=0;e<s;e++)n&&!n[e]||(a[e]=Math.sign(o[e])*Math.floor(Math.abs(o[e])));return a}function m(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]/s[e]);return l}function y(t,e,n){return m(t,e,"f32")}function d(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=Math.floor(o[e]/s[e]));return l}function M(t,r,o,s){const a=t[0],l=a.length,c=e.createEmptyBand(o,l);if(s===n.atanh){for(let t=0;t<l;t++)if(r[t]){const e=a[t];Math.abs(e)>=1?r[t]=0:c[t]=Math.atanh(e)}return c}const f=s===n.asin?Math.asin:Math.acos;for(let e=0;e<l;e++)if(r[e]){const t=a[e];Math.abs(t)>1?r[e]=0:c[e]=f(t)}return c}function E(t,n,r,o){const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o(s[e]));return l}function B(t,n,r,o){const[s,a]=t,l=s.length,c=e.createEmptyBand(r,l);for(let e=0;e<l;e++)n&&!n[e]||(c[e]=o(s[e],a[e]));return c}function w(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]&s[e]);return l}function b(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]<<s[e]);return l}function x(t,n,r){const[o]=t,s=o.length,a=e.createEmptyBand(r,s);for(let e=0;e<s;e++)n&&!n[e]||(a[e]=~o[e]);return a}function A(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]|s[e]);return l}function k(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]>>s[e]);return l}function N(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]^s[e]);return l}function P(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]&&s[e]?1:0);return l}function T(t,n,r){const[o]=t,s=o.length,a=e.createEmptyBand(r,s);for(let e=0;e<s;e++)n&&!n[e]||(a[e]=o[e]?0:1);return a}function q(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]||s[e]?1:0);return l}function U(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=(o[e]?1:0)^(s[e]?1:0));return l}function I(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]===s[e]?1:0);return l}function j(t,n,r,o){const[s]=t,a=s.length,l=e.createEmptyBand(r,a),c=o===Math.E;for(let e=0;e<a;e++)n&&!n[e]||(l[e]=c?Math.exp(s[e]):o**s[e]);return l}function F(t,e,n){return j(t,e,n,10)}function z(t,e,n){return j(t,e,n,2)}function O(t,e,n){return j(t,e,n,Math.E)}function W(t,n,r,o){const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(s[e]<=0?n[e]=0:l[e]=o(s[e]));return l}function C(t,e,n){return W(t,e,n,Math.log10)}function R(t,e,n){return W(t,e,n,Math.log2)}function S(t,e,n){return W(t,e,n,Math.log)}function X(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]>s[e]?1:0);return l}function v(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]>=s[e]?1:0);return l}function D(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]<s[e]?1:0);return l}function G(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]<=s[e]?1:0);return l}function H(t,n,r){const[o]=t,s=o.length,a=e.createEmptyBand(r,s);if(!n)return a;for(let e=0;e<s;e++)a[e]=n[e]?0:1;return a}function J(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]%s[e]);return l}function K(t,n,r){const[o]=t,s=o.length,a=e.createEmptyBand(r,s);for(let e=0;e<s;e++)n&&!n[e]||(a[e]=-o[e]);return a}function L(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n&&!n[e]||(l[e]=o[e]===s[e]?0:1);return l}function Q(t,n,r){const[o,s]=t,a=o.length,l=e.createEmptyBand(r,a),c=new Uint8Array(a);for(let e=0;e<a;e++)null!=n&&!n[e]||0!==o[e]||(l[e]=s[e],c[e]=255);return{band:l,mask:c}}function V(t,n,r){const[o,s,a]=t,l=o.length,c=e.createEmptyBand(r,l);for(let e=0;e<l;e++)n&&!n[e]||(c[e]=o[e]?s[e]:a[e]);return c}function Y(t,n,r){const o=t.length;if(o<2)return t[0];const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)if(!n||n[e]){let n=s[e];for(let r=1;r<o;r++){const o=t[r][e];n<o&&(n=o)}l[e]=n}return l}function Z(t,n,r){const o=t.length;if(o<2)return t[0];const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)if(!n||n[e]){let n=s[e];for(let r=1;r<o;r++){const o=t[r][e];n>o&&(n=o)}l[e]=n}return l}function $(t,n,r){const o=t.length;if(o<2)return t[0];const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)if(!n||n[e]){let n=s[e],r=n;for(let s=1;s<o;s++){const o=t[s][e];r<o?r=o:n>o&&(n=o)}l[e]=r-n}return l}function _(t,n,r){const o=t.length;if(o<2)return t[0];const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)if(!n||n[e]){let n=0;for(let r=0;r<o;r++)n+=t[r][e];l[e]=n/o}return l}function tt(t,n,r){const o=t.length;if(o<2)return t[0];const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)if(!n||n[e])for(let n=0;n<o;n++){const r=t[n];l[e]+=r[e]}return l}function et(t,n,r){const o=t.length;if(o<2)return t[0];const[s]=t,a=s.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)if(!n||n[e]){const n=new Float32Array(o);let r=0;for(let a=0;a<o;a++){const o=t[a];r+=o[e],n[a]=o[e]}r/=o;let s=0;for(let t=0;t<o;t++)s+=(n[t]-r)**2;l[e]=Math.sqrt(s/o)}return l}function nt(t,n,r){const o=t.length;if(o<2)return t[0];const s=Math.floor(o/2),[a]=t,l=a.length,c=e.createEmptyBand(r,l),f=new Float32Array(o),u=o%2==1;for(let e=0;e<l;e++)if(!n||n[e]){for(let n=0;n<o;n++)f[n]=t[n][e];f.sort(),c[e]=u?f[s]:(f[s]+f[s-1])/2}return c}function rt(t,n,r){const[o,s]=t;if(null==s)return o;const a=o.length,l=e.createEmptyBand(r,a);for(let e=0;e<a;e++)n[e]&&(o[e]===s[e]?l[e]=o[e]:n[e]=0);return l}function ot(t,n,r){const o=t.length;if(o<=2)return rt(t,n,r);const s=t[0].length,a=e.createEmptyBand(r,s),l=new Map;for(let e=0;e<s;e++)if(!n||n[e]){let n;l.clear();for(let a=0;a<o;a++)n=t[a][e],l.set(n,l.has(n)?l.get(n)+1:1);let r=0,s=0;for(const t of l.keys())r=l.get(t),r>s&&(s=r,n=t);a[e]=n}return a}function st(t,n,r){const o=t.length;if(o<=2)return rt(t,n,r);const s=t[0].length,a=e.createEmptyBand(r,s),l=new Map;for(let e=0;e<s;e++)if(!n||n[e]){let n;l.clear();for(let a=0;a<o;a++)n=t[a][e],l.set(n,l.has(n)?l.get(n)+1:1);let r=0,s=t.length;for(const t of l.keys())r=l.get(t),r<s&&(s=r,n=t);a[e]=n}return a}function at(t,n,r){const o=t.length;if(o<2)return t[0];const[s]=t,a=s.length,l=e.createEmptyBand(r,a),c=new Set;for(let e=0;e<a;e++)if(!n||n[e]){let n;c.clear();for(let r=0;r<o;r++)n=t[r][e],c.add(n);l[e]=c.size}return l}const lt=new Map,ct=new Map,ft=new Map,ut=new Map;function ht(){lt.size||(lt.set(4,Math.sqrt),lt.set(6,Math.acos),lt.set(7,Math.asin),lt.set(8,Math.atan),lt.set(9,Math.atanh),lt.set(10,Math.abs),lt.set(21,Math.cos),lt.set(22,Math.cosh),lt.set(48,Math.floor),lt.set(49,Math.ceil),lt.set(51,Math.sin),lt.set(52,Math.sinh),lt.set(56,Math.tan),lt.set(57,Math.tanh),lt.set(59,Math.acosh),lt.set(60,Math.asinh),lt.set(65,Math.floor),ct.set(5,Math.pow),ct.set(61,Math.atan2),ft.set(1,u),ft.set(2,i),ft.set(3,g),ft.set(11,w),ft.set(12,b),ft.set(12,b),ft.set(13,x),ft.set(14,A),ft.set(15,k),ft.set(16,N),ft.set(17,P),ft.set(18,T),ft.set(19,q),ft.set(20,U),ft.set(23,m),ft.set(24,I),ft.set(25,O),ft.set(26,F),ft.set(27,z),ft.set(28,X),ft.set(29,v),ft.set(30,p),ft.set(31,H),ft.set(32,h),ft.set(33,D),ft.set(34,G),ft.set(35,S),ft.set(36,C),ft.set(37,R),ft.set(44,J),ft.set(45,K),ft.set(46,L),ft.set(64,y),ft.set(65,d),ft.set(76,V),ft.set(78,V),ut.set(38,ot),ut.set(39,Y),ut.set(40,_),ut.set(41,nt),ut.set(42,Z),ut.set(43,st),ut.set(47,$),ut.set(54,et),ut.set(55,tt),ut.set(58,at),ut.set(66,ot),ut.set(67,Y),ut.set(68,_),ut.set(69,nt),ut.set(70,Z),ut.set(71,st),ut.set(72,$),ut.set(73,et),ut.set(74,tt),ut.set(75,at))}function it(t,e,n,r){let[o,a]=s(n);const l=n.startsWith("u")||n.startsWith("s");l&&(o-=1e-5,a+=1e-5);for(let s=0;s<e.length;s++)if(e[s]){const n=t[s];isNaN(n)||n<o||n>a?e[s]=0:r[s]=l?Math.round(n):n}}function gt(t,s,l={}){ht();let c=f(t,s>=66&&s<=75);const{outputPixelType:u="f32"}=l,h=!ut.has(s)||l.processAsMultiband,i=h?t[0].pixels.length:1,g=[];for(let f=0;f<i;f++){const l=ut.has(s)&&!h?t.flatMap((t=>t.pixels)):t.map((t=>t.pixels[f]));let i,p=!0;if(s===o.setNull){const t=Q(l,c,u);i=t.band,c=t.mask,p=!1}else if(ft.has(s)){i=ft.get(s)(l,c,"f64")}else if(lt.has(s))i=s===n.asin||s===n.acos||s===n.atanh?M(l,c,"f64",s):E(l,c,"f64",lt.get(s));else if(ct.has(s))i=B(l,c,"f64",ct.get(s));else if(ut.has(s)){i=ut.get(s)(l,c,"f64")}else i=l[0],p=!1;if(p&&s!==r.isNull&&!a.has(s)){const t=e.createEmptyBand(u,i.length);c||(c=new Uint8Array(i.length).fill(255)),it(i,c,u,t),i=t}g.push(i)}const p=t[0];return new e({width:p.width,height:p.height,pixelType:u,mask:s===r.isNull?null:c,pixels:g})}export{l as getOutputDomain,gt as local,c as operandsCount};
|
package/package.json
CHANGED
package/portal/PortalItem.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import i from"../core/Error.js";import{JSONSupportMixin as r}from"../core/JSONSupport.js";import{clone as o,fixJson as s}from"../core/lang.js";import a from"../core/Loadable.js";import{isSome as n,unwrapOrThrow as l}from"../core/maybe.js";import{isDataProtocol as p,makeAbsolute as c}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import{ensureClass as u}from"../core/accessorSupport/ensureType.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import g from"../geometry/Extent.js";import y from"./Portal.js";import w from"./PortalItemResource.js";import v from"./PortalRating.js";var f;const b=new Set(["Map Service","Feature Service","Feature Collection","Scene Service","Image Service","Stream Service","Vector Tile Service","GeoJson","CSV","KML","WFS","WMTS","WMS","Feed"]),k=new Set(["KML","GeoJson","CSV"]);let S=f=class extends(r(a)){static from(e){return u(f,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e&&this.portal&&this.portal.isPortal?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geocoding Service"===e?i="Locator":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e&&e.toLowerCase().includes("add in")?i=e.replace(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")&&(i="Instant App"),i}readExtent(e){return e&&e.length?new g(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type&&this.type.toLowerCase()||"",i=this.typeKeywords||[],r="esri/images/portal/",o="16";let s,a=!1,n=!1,l=!1,p=!1,c=!1,d=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(a=i.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=i.includes("Table"),l=i.includes("Route Layer"),p=i.includes("Markup"),c=i.includes("Spatiotemporal"),d=i.includes("UtilityNetwork"),s=c&&n?"spatiotemporaltable":n?"table":l?"routelayer":p?"markup":c?"spatiotemporal":a?"featureshosted":d?"utilitynetwork":"features"):s="map service"===e||"wms"===e||"wmts"===e?a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages":"scene service"===e?i.includes("Line")?"sceneweblayerline":i.includes("3DObject")?"sceneweblayermultipatch":i.includes("Point")?"sceneweblayerpoint":i.includes("IntegratedMesh")?"sceneweblayermesh":i.includes("PointCloud")?"sceneweblayerpointcloud":i.includes("Polygon")?"sceneweblayerpolygon":i.includes("Building")?"sceneweblayerbuilding":i.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?i.includes("Elevation 3D Layer")?"elevationlayer":i.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"video service"===e?"mediaservice":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"geoprocessing service"===e?i.includes("Web Tool")&&this.portal&&this.portal.isPortal?"tool":"layers":"geodata service"===e?"geodataservice":"layers"):s="web map"===e||"cityengine web scene"===e?"maps":"web scene"===e?i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?"instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?"apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&i.includes("ArcGIS Pro")||"explorer map"===e&&i.indexOf("Explorer Document")?"mapsgray":"service definition"===e||"csv"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"360 vr experience"===e||"netcdf"===e||"administrative report"===e?"datafiles":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?"appsgray":"arcgis pro add in"===e||"arcgis pro configuration"===e?"addindesktop":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"form"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"image"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?"datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?"toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?"layersgray":"scene package"===e?"scenepackage":"mobile scene package"===e?"mobilescenepackage":"tile package"===e||"compact tile package"===e?"tilepackage":"task file"===e?"taskfile":"report template"===e?"report-template":"statistical data collection"===e?"statisticaldatacollection":"insights workbook"===e?"workbook":"insights model"===e?"insightsmodel":"insights page"===e?"insightspage":"insights theme"===e?"insightstheme":"hub initiative"===e?"hubinitiative":"hubpage"===e?"hubpage":"hub event"===e?"hubevent":"hub site application"===e?"hubsite":"hub project"===e?"hubproject":"relational database connection"===e?"relationaldatabaseconnection":"big data file share"===e?"datastorecollection":"image collection"===e?"imagecollection":"style"===e?"style":"desktop style"===e?"desktopstyle":"dashboard"===e?"dashboard":"raster function template"===e?"rasterprocessingtemplate":"vector tile package"===e?"vectortilepackage":"ortho mapping project"===e?"orthomappingproject":"ortho mapping template"===e?"orthomappingtemplate":"solution"===e?"solutions":"geopackage"===e?"geopackage":"deep learning package"===e?"deeplearningpackage":"real time analytic"===e?"realtimeanalytics":"big data analytic"===e?"bigdataanalytics":"feed"===e?"feed":"excalibur imagery project"===e?"excaliburimageryproject":"notebook"===e?"notebook":"storymap"===e?"storymap":"survey123 add in"===e?"survey123addin":"mission"===e?"mission":"mission report"===e?"missionreport":"quickcapture project"===e?"quickcaptureproject":"pro report"===e?"proreport":"pro report template"===e?"proreporttemplate":"urban model"===e?"urbanmodel":"web experience"===e?"experiencebuilder":"web experience template"===e?"webexperiencetemplate":"experience builder widget"===e?"experiencebuilderwidget":"experience builder widget package"===e?"experiencebuilderwidgetpackage":"workflow"===e?"workflow":"insights script"===e?"insightsscript":"kernel gateway connection"===e?"kernelgatewayconnection":"hub initiative template"===e?"hubinitiativetemplate":"storymap theme"===e?"storymaptheme":"knowledge graph"===e?"knowledgegraph":"native application"===e?"nativeapp":"native application installer"===e?"nativeappinstaller":"link chart"===e?"linkchart":"investigation"===e?"investigation":"ogcfeatureserver"===e?"features":"pro project"===e?"proproject":"insights workbook package"===e?"insightsworkbookpackage":"apache parquet"===e?"apacheparquet":"notebook code snippets"===e||"notebook code snippet library"===e?"notebookcodesnippets":"suitability model"===e?"suitabilitymodel":"esri classifier definition"===e?"classifierdefinition":"esri classification schema"===e?"classificationschema":"insights data engineering workbook"===e?"dataengineeringworkbook":"insights data engineering model"===e?"dataengineeringmodel":"deep learning studio project"===e?"deeplearningproject":"discussion"===e?"discussion":"allsource project"===e?"allsourceproject":"api key"===e?"apikey":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&b.has(this.type)}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.get("portal.restUrl");if(!e)return null;const t=this.owner||this.get("portal.user.username");if(!t)return null;return`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`}load(e){const t=this.portal??(this.portal=y.getDefault()),i=t.load(e).then((()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:n(e)?e.signal:null,query:{token:this.apiKey}}):{})).then((e=>{this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}};return e instanceof v&&(e=e.rating),null==e||isNaN(e)||"number"!=typeof e||(t.query.rating=e),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new v({rating:e,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:o(this.applicationProxies),avgRating:this.avgRating,categories:o(this.categories),created:o(this.created),culture:this.culture,description:this.description,extent:o(this.extent),groupCategories:o(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:o(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:o(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new f({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const i of["tags","typeKeywords","categories"])e[i]&&(e[i]=e[i].join(", "));const{extent:t}=e;return t&&(e.extent=JSON.stringify(t)),e}async deleteRating(){await l(this.portal).request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return l(this.portal).request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await l(this.portal).request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new v(t)):null}fetchRelatedItems(e,t){return l(this.portal).requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},f)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return l(this.portal).request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then((e=>(this.sourceJSON=e,this.read(e),this)))}update(e){return this.id?this.load().then((()=>l(this.portal).signIn())).then((()=>{const t=e&&e.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then((()=>this.reload()))})):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new i("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:r}=this;await l(t).signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},p={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:c}=await t.request(`${r}/copy`,p);return new f({id:c,portal:t})}updateThumbnail(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)p(t)?r.query={data:t}:r.query={url:c(t)},n(i)&&(r.query.filename=i);else{const e=new FormData;n(i)?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then((()=>this.reload()))})):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){return(await import("./support/resourceUtils.js")).fetchResources(this,e,t)}async addResource(e,t,i){const r=await import("./support/resourceUtils.js");return e.portalItem=this,r.addOrUpdateResource(e,"add",t,i)}async removeResource(e,t){const r=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new i("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return r.removeResource(this,e,t)}async removeAllResources(e){return(await import("./support/resourceUtils.js")).removeAllResources(this,e)}resourceFromPath(e){return new w({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:o(this.categories),created:this.created&&this.created.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified&&this.modified.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};return s(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new f({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};e([d({type:["private","shared","org","public"]})],S.prototype,"access",void 0),e([d()],S.prototype,"accessInformation",void 0),e([d({type:String})],S.prototype,"apiKey",void 0),e([d({json:{read:{source:"appProxies"}}})],S.prototype,"applicationProxies",void 0),e([d()],S.prototype,"avgRating",void 0),e([d()],S.prototype,"categories",void 0),e([d({type:Date})],S.prototype,"created",void 0),e([d()],S.prototype,"culture",void 0),e([d()],S.prototype,"description",void 0),e([d({readOnly:!0})],S.prototype,"displayName",null),e([d({type:g})],S.prototype,"extent",void 0),e([m("extent")],S.prototype,"readExtent",null),e([d()],S.prototype,"groupCategories",void 0),e([d({readOnly:!0})],S.prototype,"iconUrl",null),e([d()],S.prototype,"id",void 0),e([d({readOnly:!0})],S.prototype,"isLayer",null),e([d({type:Boolean,readOnly:!0})],S.prototype,"isOrgItem",void 0),e([d()],S.prototype,"itemControl",void 0),e([d({readOnly:!0})],S.prototype,"itemPageUrl",null),e([d({readOnly:!0})],S.prototype,"itemUrl",null),e([d()],S.prototype,"licenseInfo",void 0),e([d({type:Date})],S.prototype,"modified",void 0),e([d()],S.prototype,"name",void 0),e([d()],S.prototype,"numComments",void 0),e([d()],S.prototype,"numRatings",void 0),e([d()],S.prototype,"numViews",void 0),e([d()],S.prototype,"owner",void 0),e([d()],S.prototype,"ownerFolder",void 0),e([d({type:y})],S.prototype,"portal",void 0),e([d()],S.prototype,"screenshots",void 0),e([d()],S.prototype,"size",void 0),e([d()],S.prototype,"snippet",void 0),e([d()],S.prototype,"sourceJSON",void 0),e([d({type:String})],S.prototype,"sourceUrl",void 0),e([d({type:String})],S.prototype,"spatialReference",void 0),e([d()],S.prototype,"tags",void 0),e([d()],S.prototype,"thumbnail",void 0),e([d({readOnly:!0})],S.prototype,"thumbnailUrl",null),e([d()],S.prototype,"title",void 0),e([d()],S.prototype,"type",void 0),e([d()],S.prototype,"typeKeywords",void 0),e([d({type:String,json:{read(e,t){if(k.has(t.type)){const t=this.portal?.restUrl;e||(e=t&&this.id?`${t}/content/items/${this.id}/data`:null)}return e}}})],S.prototype,"url",void 0),e([d({readOnly:!0})],S.prototype,"userItemUrl",null),S=f=e([h("esri.portal.PortalItem")],S);const x=S;export{x as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import i from"../core/Error.js";import{JSONSupportMixin as r}from"../core/JSONSupport.js";import{clone as o,fixJson as s}from"../core/lang.js";import a from"../core/Loadable.js";import{isSome as n,unwrapOrThrow as l}from"../core/maybe.js";import{isDataProtocol as p,makeAbsolute as c}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import{ensureClass as u}from"../core/accessorSupport/ensureType.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import g from"../geometry/Extent.js";import y from"./Portal.js";import w from"./PortalItemResource.js";import v from"./PortalRating.js";var f;const b=new Set(["Map Service","Feature Service","Feature Collection","Scene Service","Image Service","Stream Service","Vector Tile Service","GeoJson","CSV","KML","WFS","WMTS","WMS","Feed"]),k=new Set(["KML","GeoJson","CSV"]);let S=f=class extends(r(a)){static from(e){return u(f,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e&&this.portal&&this.portal.isPortal?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geocoding Service"===e?i="Locator":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e&&e.toLowerCase().includes("add in")?i=e.replace(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e&&(i="Insights Report"),i}readExtent(e){return e&&e.length?new g(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type&&this.type.toLowerCase()||"",i=this.typeKeywords||[],r="esri/images/portal/",o="16";let s,a=!1,n=!1,l=!1,p=!1,c=!1,d=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(a=i.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=i.includes("Table"),l=i.includes("Route Layer"),p=i.includes("Markup"),c=i.includes("Spatiotemporal"),d=i.includes("UtilityNetwork"),s=c&&n?"spatiotemporaltable":n?"table":l?"routelayer":p?"markup":c?"spatiotemporal":a?"featureshosted":d?"utilitynetwork":"features"):s="map service"===e||"wms"===e||"wmts"===e?a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages":"scene service"===e?i.includes("Line")?"sceneweblayerline":i.includes("3DObject")?"sceneweblayermultipatch":i.includes("Point")?"sceneweblayerpoint":i.includes("IntegratedMesh")?"sceneweblayermesh":i.includes("PointCloud")?"sceneweblayerpointcloud":i.includes("Polygon")?"sceneweblayerpolygon":i.includes("Building")?"sceneweblayerbuilding":i.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?i.includes("Elevation 3D Layer")?"elevationlayer":i.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"video service"===e?"mediaservice":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"geoprocessing service"===e?i.includes("Web Tool")&&this.portal&&this.portal.isPortal?"tool":"layers":"geodata service"===e?"geodataservice":"layers"):s="web map"===e||"cityengine web scene"===e?"maps":"web scene"===e?i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?"instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?"apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&i.includes("ArcGIS Pro")||"explorer map"===e&&i.indexOf("Explorer Document")?"mapsgray":"service definition"===e||"csv"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"360 vr experience"===e||"netcdf"===e||"administrative report"===e?"datafiles":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?"appsgray":"arcgis pro add in"===e||"arcgis pro configuration"===e?"addindesktop":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"form"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"image"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?"datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?"toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?"layersgray":"scene package"===e?"scenepackage":"mobile scene package"===e?"mobilescenepackage":"tile package"===e||"compact tile package"===e?"tilepackage":"task file"===e?"taskfile":"report template"===e?"report-template":"statistical data collection"===e?"statisticaldatacollection":"insights workbook"===e?"workbook":"insights model"===e?"insightsmodel":"insights page"===e?"insightspage":"insights theme"===e?"insightstheme":"hub initiative"===e?"hubinitiative":"hubpage"===e?"hubpage":"hub event"===e?"hubevent":"hub site application"===e?"hubsite":"hub project"===e?"hubproject":"relational database connection"===e?"relationaldatabaseconnection":"big data file share"===e?"datastorecollection":"image collection"===e?"imagecollection":"style"===e?"style":"desktop style"===e?"desktopstyle":"dashboard"===e?"dashboard":"raster function template"===e?"rasterprocessingtemplate":"vector tile package"===e?"vectortilepackage":"ortho mapping project"===e?"orthomappingproject":"ortho mapping template"===e?"orthomappingtemplate":"solution"===e?"solutions":"geopackage"===e?"geopackage":"deep learning package"===e?"deeplearningpackage":"real time analytic"===e?"realtimeanalytics":"big data analytic"===e?"bigdataanalytics":"feed"===e?"feed":"excalibur imagery project"===e?"excaliburimageryproject":"notebook"===e?"notebook":"storymap"===e?"storymap":"survey123 add in"===e?"survey123addin":"mission"===e?"mission":"mission report"===e?"missionreport":"quickcapture project"===e?"quickcaptureproject":"pro report"===e?"proreport":"pro report template"===e?"proreporttemplate":"urban model"===e?"urbanmodel":"web experience"===e?"experiencebuilder":"web experience template"===e?"webexperiencetemplate":"experience builder widget"===e?"experiencebuilderwidget":"experience builder widget package"===e?"experiencebuilderwidgetpackage":"workflow"===e?"workflow":"insights script"===e?"insightsscript":"kernel gateway connection"===e?"kernelgatewayconnection":"hub initiative template"===e?"hubinitiativetemplate":"storymap theme"===e?"storymaptheme":"knowledge graph"===e?"knowledgegraph":"native application"===e?"nativeapp":"native application installer"===e?"nativeappinstaller":"link chart"===e?"linkchart":"investigation"===e?"investigation":"ogcfeatureserver"===e?"features":"pro project"===e?"proproject":"insights workbook package"===e?"insightsworkbookpackage":"apache parquet"===e?"apacheparquet":"notebook code snippets"===e||"notebook code snippet library"===e?"notebookcodesnippets":"suitability model"===e?"suitabilitymodel":"esri classifier definition"===e?"classifierdefinition":"esri classification schema"===e?"classificationschema":"insights data engineering workbook"===e?"dataengineeringworkbook":"insights data engineering model"===e?"dataengineeringmodel":"deep learning studio project"===e?"deeplearningproject":"discussion"===e?"discussion":"allsource project"===e?"allsourceproject":"api key"===e?"apikey":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&b.has(this.type)}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.get("portal.restUrl");if(!e)return null;const t=this.owner||this.get("portal.user.username");if(!t)return null;return`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`}load(e){const t=this.portal??(this.portal=y.getDefault()),i=t.load(e).then((()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:n(e)?e.signal:null,query:{token:this.apiKey}}):{})).then((e=>{this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}};return e instanceof v&&(e=e.rating),null==e||isNaN(e)||"number"!=typeof e||(t.query.rating=e),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new v({rating:e,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:o(this.applicationProxies),avgRating:this.avgRating,categories:o(this.categories),created:o(this.created),culture:this.culture,description:this.description,extent:o(this.extent),groupCategories:o(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:o(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:o(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new f({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const i of["tags","typeKeywords","categories"])e[i]&&(e[i]=e[i].join(", "));const{extent:t}=e;return t&&(e.extent=JSON.stringify(t)),e}async deleteRating(){await l(this.portal).request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return l(this.portal).request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await l(this.portal).request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new v(t)):null}fetchRelatedItems(e,t){return l(this.portal).requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},f)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return l(this.portal).request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then((e=>(this.sourceJSON=e,this.read(e),this)))}update(e){return this.id?this.load().then((()=>l(this.portal).signIn())).then((()=>{const t=e&&e.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then((()=>this.reload()))})):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new i("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:r}=this;await l(t).signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},p={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:c}=await t.request(`${r}/copy`,p);return new f({id:c,portal:t})}updateThumbnail(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)p(t)?r.query={data:t}:r.query={url:c(t)},n(i)&&(r.query.filename=i);else{const e=new FormData;n(i)?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then((()=>this.reload()))})):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){return(await import("./support/resourceUtils.js")).fetchResources(this,e,t)}async addResource(e,t,i){const r=await import("./support/resourceUtils.js");return e.portalItem=this,r.addOrUpdateResource(e,"add",t,i)}async removeResource(e,t){const r=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new i("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return r.removeResource(this,e,t)}async removeAllResources(e){return(await import("./support/resourceUtils.js")).removeAllResources(this,e)}resourceFromPath(e){return new w({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:o(this.categories),created:this.created&&this.created.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified&&this.modified.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};return s(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new f({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};e([d({type:["private","shared","org","public"]})],S.prototype,"access",void 0),e([d()],S.prototype,"accessInformation",void 0),e([d({type:String})],S.prototype,"apiKey",void 0),e([d({json:{read:{source:"appProxies"}}})],S.prototype,"applicationProxies",void 0),e([d()],S.prototype,"avgRating",void 0),e([d()],S.prototype,"categories",void 0),e([d({type:Date})],S.prototype,"created",void 0),e([d()],S.prototype,"culture",void 0),e([d()],S.prototype,"description",void 0),e([d({readOnly:!0})],S.prototype,"displayName",null),e([d({type:g})],S.prototype,"extent",void 0),e([m("extent")],S.prototype,"readExtent",null),e([d()],S.prototype,"groupCategories",void 0),e([d({readOnly:!0})],S.prototype,"iconUrl",null),e([d()],S.prototype,"id",void 0),e([d({readOnly:!0})],S.prototype,"isLayer",null),e([d({type:Boolean,readOnly:!0})],S.prototype,"isOrgItem",void 0),e([d()],S.prototype,"itemControl",void 0),e([d({readOnly:!0})],S.prototype,"itemPageUrl",null),e([d({readOnly:!0})],S.prototype,"itemUrl",null),e([d()],S.prototype,"licenseInfo",void 0),e([d({type:Date})],S.prototype,"modified",void 0),e([d()],S.prototype,"name",void 0),e([d()],S.prototype,"numComments",void 0),e([d()],S.prototype,"numRatings",void 0),e([d()],S.prototype,"numViews",void 0),e([d()],S.prototype,"owner",void 0),e([d()],S.prototype,"ownerFolder",void 0),e([d({type:y})],S.prototype,"portal",void 0),e([d()],S.prototype,"screenshots",void 0),e([d()],S.prototype,"size",void 0),e([d()],S.prototype,"snippet",void 0),e([d()],S.prototype,"sourceJSON",void 0),e([d({type:String})],S.prototype,"sourceUrl",void 0),e([d({type:String})],S.prototype,"spatialReference",void 0),e([d()],S.prototype,"tags",void 0),e([d()],S.prototype,"thumbnail",void 0),e([d({readOnly:!0})],S.prototype,"thumbnailUrl",null),e([d()],S.prototype,"title",void 0),e([d()],S.prototype,"type",void 0),e([d()],S.prototype,"typeKeywords",void 0),e([d({type:String,json:{read(e,t){if(k.has(t.type)){const t=this.portal?.restUrl;e||(e=t&&this.id?`${t}/content/items/${this.id}/data`:null)}return e}}})],S.prototype,"url",void 0),e([d({readOnly:!0})],S.prototype,"userItemUrl",null),S=f=e([h("esri.portal.PortalItem")],S);const x=S;export{x as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import s from"../../core/Logger.js";import{toPt as r}from"../../core/screenUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../core/accessorSupport/decorators/cast.js";import{reader as o}from"../../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import u from"./VisualVariable.js";import m from"./support/SizeStop.js";import h from"./support/SizeVariableLegendOptions.js";import{isSizeVariable as d,getInputValueType as c,getTransformationType as y,TransformationType as x}from"./support/sizeVariableUtils.js";import{viewScaleRE as S}from"./support/visualVariableUtils.js";var z;const v=new i({width:"width",depth:"depth",height:"height",widthAndDepth:"width-and-depth",all:"all"}),g=new i({unknown:"unknown",inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers","decimal-degree":"decimal-degrees"});function w(e){if(null!=e)return"string"==typeof e||"number"==typeof e?r(e):"size"===e.type?d(e)?e:(delete(e={...e}).type,new V(e)):void 0}function f(e,t,i){if("object"!=typeof e)return e;const s=new V;return s.read(e,i),s}let V=z=class extends u{constructor(e){super(e),this.axis=null,this.legendOptions=null,this.normalizationField=null,this.scaleBy=null,this.target=null,this.type="size",this.useSymbolValue=null,this.valueExpression=null,this.valueRepresentation=null,this.valueUnit=null}get cache(){return{ipData:this._interpolateData(),hasExpression:!!this.valueExpression,compiledFunc:null,isScaleDriven:null!=this.valueExpression&&S.test(this.valueExpression)}}set expression(e){s.getLogger(this.declaredClass).warn("'expression' is deprecated since version 4.2. Use 'valueExpression' instead. The only supported expression is 'view.scale'."),"view.scale"===e?(this.valueExpression="$view.scale",this._set("expression",e)):this._set("expression",null)}set index(e){d(this.maxSize)&&(this.maxSize.index=`visualVariables[${e}].maxSize`),d(this.minSize)&&(this.minSize.index=`visualVariables[${e}].minSize`),this._set("index",e)}get inputValueType(){return c(this)}set maxDataValue(e){e&&this.stops&&(s.getLogger(this.declaredClass).warn("cannot set maxDataValue when stops is not null."),e=null),this._set("maxDataValue",e)}set maxSize(e){e&&this.stops&&(s.getLogger(this.declaredClass).warn("cannot set maxSize when stops is not null."),e=null),this._set("maxSize",e)}castMaxSize(e){return w(e)}readMaxSize(e,t,i){return f(e,t,i)}set minDataValue(e){e&&this.stops&&(s.getLogger(this.declaredClass).warn("cannot set minDataValue when stops is not null."),e=null),this._set("minDataValue",e)}set minSize(e){e&&this.stops&&(s.getLogger(this.declaredClass).warn("cannot set minSize when stops is not null."),e=null),this._set("minSize",e)}castMinSize(e){return w(e)}readMinSize(e,t,i){return f(e,t,i)}get arcadeRequired(){return!!this.valueExpression||(null!=this.minSize&&"object"==typeof this.minSize&&this.minSize.arcadeRequired||null!=this.maxSize&&"object"==typeof this.maxSize&&this.maxSize.arcadeRequired)}set stops(e){null==this.minDataValue&&null==this.maxDataValue&&null==this.minSize&&null==this.maxSize?e&&Array.isArray(e)&&(e=e.filter((e=>!!e))).sort(((e,t)=>e.value-t.value)):e&&(s.getLogger(this.declaredClass).warn("cannot set stops when one of minDataValue, maxDataValue, minSize or maxSize is not null."),e=null),this._set("stops",e)}get transformationType(){return y(this,this.inputValueType)}readValueExpression(e,t){return e||t.expression&&"$view.scale"}writeValueExpressionWebScene(e,i,s,r){if("$view.scale"===e){if(r&&r.messages){const e=this.index,i="string"==typeof e?e:`visualVariables[${e}]`;r.messages.push(new t("property:unsupported",this.type+"VisualVariable.valueExpression = '$view.scale' is not supported in Web Scene. Please remove this property to save the Web Scene.",{instance:this,propertyName:i+".valueExpression",context:r}))}}else i[s]=e}readValueUnit(e){return e?g.read(e):null}clone(){return new z({axis:this.axis,field:this.field,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,maxDataValue:this.maxDataValue,maxSize:d(this.maxSize)?this.maxSize.clone():this.maxSize,minDataValue:this.minDataValue,minSize:d(this.minSize)?this.minSize.clone():this.minSize,normalizationField:this.normalizationField,stops:this.stops&&this.stops.map((e=>e.clone())),target:this.target,useSymbolValue:this.useSymbolValue,valueRepresentation:this.valueRepresentation,valueUnit:this.valueUnit,legendOptions:this.legendOptions&&this.legendOptions.clone()})}flipSizes(){if(this.transformationType===x.ClampedLinear){const{minSize:e,maxSize:t}=this;return this.minSize=t,this.maxSize=e,this}if(this.transformationType===x.Stops){const e=this.stops;if(!e)return this;const t=e.map((e=>e.size)).reverse(),i=e.length;for(let s=0;s<i;s++)e[s].size=t[s];return this}return this}getAttributeHash(){return`${super.getAttributeHash()}-${this.target}-${this.normalizationField}`}_interpolateData(){return this.stops&&this.stops.map((e=>e.value||0))}};e([a({readOnly:!0})],V.prototype,"cache",null),e([a({type:v.apiValues,json:{type:v.jsonValues,origins:{"web-map":{read:!1}},read:v.read,write:v.write}})],V.prototype,"axis",void 0),e([a({type:String,value:null,json:{read:!1}})],V.prototype,"expression",null),e([a()],V.prototype,"index",null),e([a({type:String,readOnly:!0})],V.prototype,"inputValueType",null),e([a({type:h,json:{write:!0}})],V.prototype,"legendOptions",void 0),e([a({type:Number,value:null,json:{write:!0}})],V.prototype,"maxDataValue",null),e([a({type:Number,value:null,json:{write:!0}})],V.prototype,"maxSize",null),e([n("maxSize")],V.prototype,"castMaxSize",null),e([o("maxSize")],V.prototype,"readMaxSize",null),e([a({type:Number,value:null,json:{write:!0}})],V.prototype,"minDataValue",null),e([a({type:Number,value:null,json:{write:!0}})],V.prototype,"minSize",null),e([n("minSize")],V.prototype,"castMinSize",null),e([o("minSize")],V.prototype,"readMinSize",null),e([a({type:String,json:{write:!0}})],V.prototype,"normalizationField",void 0),e([a({readOnly:!0})],V.prototype,"arcadeRequired",null),e([a({type:String})],V.prototype,"scaleBy",void 0),e([a({type:[m],value:null,json:{write:!0}})],V.prototype,"stops",null),e([a({type:["outline"],json:{write:!0}})],V.prototype,"target",void 0),e([a({type:String,readOnly:!0})],V.prototype,"transformationType",null),e([a({type:["size"],json:{type:["sizeInfo"]}})],V.prototype,"type",void 0),e([a({type:Boolean,json:{write:!0,origins:{"web-map":{read:!1}}}})],V.prototype,"useSymbolValue",void 0),e([a({type:String,json:{write:!0}})],V.prototype,"valueExpression",void 0),e([o("valueExpression",["valueExpression","expression"])],V.prototype,"readValueExpression",null),e([p("web-scene","valueExpression")],V.prototype,"writeValueExpressionWebScene",null),e([a({type:["radius","diameter","area","width","distance"],json:{write:!0}})],V.prototype,"valueRepresentation",void 0),e([a({type:g.apiValues,json:{write:g.write,origins:{"web-map":{read:!1},"web-scene":{write:!0}}}})],V.prototype,"valueUnit",void 0),e([o("valueUnit")],V.prototype,"readValueUnit",null),V=z=e([l("esri.renderers.visualVariables.SizeVariable")],V);const b=V;export{b as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import s from"../../core/Logger.js";import{toPt as r}from"../../core/screenUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../core/accessorSupport/decorators/cast.js";import{reader as o}from"../../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import u from"./VisualVariable.js";import m from"./support/SizeStop.js";import h from"./support/SizeVariableLegendOptions.js";import{isSizeVariable as d,getInputValueType as c,getTransformationType as y,TransformationType as x}from"./support/sizeVariableUtils.js";import{viewScaleRE as S}from"./support/visualVariableUtils.js";var z;const v=new i({width:"width",depth:"depth",height:"height",widthAndDepth:"width-and-depth",all:"all"}),g=new i({unknown:"unknown",inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers","decimal-degree":"decimal-degrees"});function w(e){if(null!=e)return"string"==typeof e||"number"==typeof e?r(e):"size"===e.type?d(e)?e:(delete(e={...e}).type,new V(e)):void 0}function f(e,t,i){if("object"!=typeof e)return e;const s=new V;return s.read(e,i),s}let V=z=class extends u{constructor(e){super(e),this.axis=null,this.legendOptions=null,this.normalizationField=null,this.scaleBy=null,this.target=null,this.type="size",this.useSymbolValue=null,this.valueExpression=null,this.valueRepresentation=null,this.valueUnit=null}get cache(){return{ipData:this._interpolateData(),hasExpression:!!this.valueExpression,compiledFunc:null,isScaleDriven:null!=this.valueExpression&&S.test(this.valueExpression)}}set expression(e){s.getLogger(this.declaredClass).warn("'expression' is deprecated since version 4.2. Use 'valueExpression' instead. The only supported expression is 'view.scale'."),"view.scale"===e?(this.valueExpression="$view.scale",this._set("expression",e)):this._set("expression",null)}set index(e){d(this.maxSize)&&(this.maxSize.index=`visualVariables[${e}].maxSize`),d(this.minSize)&&(this.minSize.index=`visualVariables[${e}].minSize`),this._set("index",e)}get inputValueType(){return c(this)}set maxDataValue(e){e&&this.stops&&(s.getLogger(this.declaredClass).warn("cannot set maxDataValue when stops is not null."),e=null),this._set("maxDataValue",e)}set maxSize(e){e&&this.stops&&(s.getLogger(this.declaredClass).warn("cannot set maxSize when stops is not null."),e=null),this._set("maxSize",e)}castMaxSize(e){return w(e)}readMaxSize(e,t,i){return f(e,t,i)}set minDataValue(e){e&&this.stops&&(s.getLogger(this.declaredClass).warn("cannot set minDataValue when stops is not null."),e=null),this._set("minDataValue",e)}set minSize(e){e&&this.stops&&(s.getLogger(this.declaredClass).warn("cannot set minSize when stops is not null."),e=null),this._set("minSize",e)}castMinSize(e){return w(e)}readMinSize(e,t,i){return f(e,t,i)}get arcadeRequired(){return!!this.valueExpression||(null!=this.minSize&&"object"==typeof this.minSize&&this.minSize.arcadeRequired||null!=this.maxSize&&"object"==typeof this.maxSize&&this.maxSize.arcadeRequired)}set stops(e){null==this.minDataValue&&null==this.maxDataValue&&null==this.minSize&&null==this.maxSize?e&&Array.isArray(e)&&(e=e.filter((e=>!!e))).sort(((e,t)=>e.value-t.value)):e&&(s.getLogger(this.declaredClass).warn("cannot set stops when one of minDataValue, maxDataValue, minSize or maxSize is not null."),e=null),this._set("stops",e)}get transformationType(){return y(this,this.inputValueType)}readValueExpression(e,t){return e||t.expression&&"$view.scale"}writeValueExpressionWebScene(e,i,s,r){if("$view.scale"===e){if(r&&r.messages){const e=this.index,i="string"==typeof e?e:`visualVariables[${e}]`;r.messages.push(new t("property:unsupported",this.type+"VisualVariable.valueExpression = '$view.scale' is not supported in Web Scene. Please remove this property to save the Web Scene.",{instance:this,propertyName:i+".valueExpression",context:r}))}}else i[s]=e}readValueUnit(e){return e?g.read(e):null}clone(){return new z({axis:this.axis,field:this.field,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,maxDataValue:this.maxDataValue,maxSize:d(this.maxSize)?this.maxSize.clone():this.maxSize,minDataValue:this.minDataValue,minSize:d(this.minSize)?this.minSize.clone():this.minSize,normalizationField:this.normalizationField,stops:this.stops&&this.stops.map((e=>e.clone())),target:this.target,useSymbolValue:this.useSymbolValue,valueRepresentation:this.valueRepresentation,valueUnit:this.valueUnit,legendOptions:this.legendOptions&&this.legendOptions.clone()})}flipSizes(){if(this.transformationType===x.ClampedLinear){const{minSize:e,maxSize:t}=this;return this.minSize=t,this.maxSize=e,this}if(this.transformationType===x.Stops){const e=this.stops;if(!e)return this;const t=e.map((e=>e.size)).reverse(),i=e.length;for(let s=0;s<i;s++)e[s].size=t[s];return this}return this}getAttributeHash(){return`${super.getAttributeHash()}-${this.target}-${this.normalizationField}`}_interpolateData(){return this.stops&&this.stops.map((e=>e.value||0))}};e([a({readOnly:!0})],V.prototype,"cache",null),e([a({type:v.apiValues,json:{type:v.jsonValues,origins:{"web-map":{read:!1}},read:v.read,write:v.write}})],V.prototype,"axis",void 0),e([a({type:String,value:null,json:{read:!1}})],V.prototype,"expression",null),e([a()],V.prototype,"index",null),e([a({type:String,readOnly:!0})],V.prototype,"inputValueType",null),e([a({type:h,json:{write:!0}})],V.prototype,"legendOptions",void 0),e([a({type:Number,value:null,json:{write:!0}})],V.prototype,"maxDataValue",null),e([a({type:Number,value:null,json:{write:!0}})],V.prototype,"maxSize",null),e([n("maxSize")],V.prototype,"castMaxSize",null),e([o("maxSize")],V.prototype,"readMaxSize",null),e([a({type:Number,value:null,json:{write:!0}})],V.prototype,"minDataValue",null),e([a({type:Number,value:null,json:{write:!0}})],V.prototype,"minSize",null),e([n("minSize")],V.prototype,"castMinSize",null),e([o("minSize")],V.prototype,"readMinSize",null),e([a({type:String,json:{write:!0}})],V.prototype,"normalizationField",void 0),e([a({readOnly:!0})],V.prototype,"arcadeRequired",null),e([a({type:String})],V.prototype,"scaleBy",void 0),e([a({type:[m],value:null,json:{write:!0}})],V.prototype,"stops",null),e([a({type:["outline"],json:{write:!0}})],V.prototype,"target",void 0),e([a({type:String,readOnly:!0})],V.prototype,"transformationType",null),e([a({type:["size"],json:{type:["sizeInfo"]}})],V.prototype,"type",void 0),e([a({type:Boolean,json:{write:!0,origins:{"web-map":{read:!1}}}})],V.prototype,"useSymbolValue",void 0),e([a({type:String,json:{write:!0}})],V.prototype,"valueExpression",void 0),e([o("valueExpression",["valueExpression","expression"])],V.prototype,"readValueExpression",null),e([p("web-scene","valueExpression")],V.prototype,"writeValueExpressionWebScene",null),e([a({type:["radius","diameter","area","width","distance"],json:{write:!0}})],V.prototype,"valueRepresentation",void 0),e([a({type:g.apiValues,json:{write:g.write,origins:{"web-map":{read:!1},"web-scene":{write:!0},"portal-item":{write:!0}}}})],V.prototype,"valueUnit",void 0),e([o("valueUnit")],V.prototype,"readValueUnit",null),V=z=e([l("esri.renderers.visualVariables.SizeVariable")],V);const b=V;export{b as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../core/Error.js";import has from"../../core/has.js";import{isSome as o,isNone as r}from"../../core/maybe.js";import{whenOrAbort as e}from"../../core/promiseUtils.js";import{DataLayerSource as a}from"../../layers/support/source/DataLayerSource.js";import{executeRawQueryJSON as s}from"./executeQueryJSON.js";import{executeRawQueryPBF as n}from"./executeQueryPBF.js";import i from"../support/FeatureSet.js";import f from"../support/Query.js";async function c(t,o,r,e){return u(t,o,r,e).then((t=>l(o,t,r,e)))}async function u(t,o,r,e){const a={...e},i=p(o,r),f=null!=o.outStatistics?.[0],c=has("featurelayer-pbf-statistics"),u=!f||c;let l;if("pbf"===r?.format&&u)try{l=await n(t,i,a)}catch(d){if("query:parsing-pbf"!==d.name)throw d;r.format="json"}return"json"!==r?.format&&u||(l=await s(t,i,a)),m(r?.fieldsIndex,l.fields),l}function m(t,r){if(o(t)&&o(r))for(const o of r){const r=t.get(o.name);r&&Object.assign(o,r.toJSON())}}async function l(t,o,a,s){const n=a?.infoFor3D;if(!d(t,n)||r(n)||!o.assetMaps||!o.features||!o.features.length)return i.fromJSON(o);const{meshFeatureSetFromJSON:f}=await e(import("../support/meshFeatureSet.js"),s);return f(t,n,o)}function p(e,s){let n=f.from(e);n.sourceSpatialReference=n.sourceSpatialReference??s?.sourceSpatialReference??null,(s?.gdbVersion||s?.dynamicDataSource)&&(n=n===e?n.clone():n,n.gdbVersion=e.gdbVersion||s.gdbVersion,n.dynamicDataSource=e.dynamicDataSource?a.from(e.dynamicDataSource):s.dynamicDataSource);const i=s?.infoFor3D;if(o(i)&&d(e,i)){n=n===e?n.clone():n,n.formatOf3DObjects=null;for(const t of i.queryFormats){if("3D_glb"===t){n.formatOf3DObjects=t;break}"3D_gltf"!==t||n.formatOf3DObjects||(n.formatOf3DObjects=t)}if(!n.formatOf3DObjects)throw new t("query:unsupported-3d-query-formats","Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf");if(r(n.outFields)||!n.outFields.includes("*")){n=n===e?n.clone():n,r(n.outFields)&&(n.outFields=[]);const{originX:t,originY:o,originZ:a,translationX:s,translationY:f,translationZ:c,scaleX:u,scaleY:m,scaleZ:l,rotationX:p,rotationY:d,rotationZ:y,rotationDeg:j}=i.transformFieldRoles;n.outFields.push(t,o,a,s,f,c,u,m,l,p,d,y,j)}}return n}function d(t,r){return o(r)
|
|
5
|
+
import t from"../../core/Error.js";import has from"../../core/has.js";import{isSome as o,isNone as r}from"../../core/maybe.js";import{whenOrAbort as e}from"../../core/promiseUtils.js";import{DataLayerSource as a}from"../../layers/support/source/DataLayerSource.js";import{executeRawQueryJSON as s}from"./executeQueryJSON.js";import{executeRawQueryPBF as n}from"./executeQueryPBF.js";import i from"../support/FeatureSet.js";import f from"../support/Query.js";async function c(t,o,r,e){return u(t,o,r,e).then((t=>l(o,t,r,e)))}async function u(t,o,r,e){const a={...e},i=p(o,r),f=null!=o.outStatistics?.[0],c=has("featurelayer-pbf-statistics"),u=!f||c;let l;if("pbf"===r?.format&&u)try{l=await n(t,i,a)}catch(d){if("query:parsing-pbf"!==d.name)throw d;r.format="json"}return"json"!==r?.format&&u||(l=await s(t,i,a)),m(r?.fieldsIndex,l.fields),l}function m(t,r){if(o(t)&&o(r))for(const o of r){const r=t.get(o.name);r&&Object.assign(o,r.toJSON())}}async function l(t,o,a,s){const n=a?.infoFor3D;if(!d(t,n)||r(n)||!o.assetMaps||!o.features||!o.features.length)return i.fromJSON(o);const{meshFeatureSetFromJSON:f}=await e(import("../support/meshFeatureSet.js"),s);return f(t,n,o)}function p(e,s){let n=f.from(e);n.sourceSpatialReference=n.sourceSpatialReference??s?.sourceSpatialReference??null,(s?.gdbVersion||s?.dynamicDataSource)&&(n=n===e?n.clone():n,n.gdbVersion=e.gdbVersion||s.gdbVersion,n.dynamicDataSource=e.dynamicDataSource?a.from(e.dynamicDataSource):s.dynamicDataSource);const i=s?.infoFor3D;if(o(i)&&d(e,i)){n=n===e?n.clone():n,n.formatOf3DObjects=null;for(const t of i.queryFormats){if("3D_glb"===t){n.formatOf3DObjects=t;break}"3D_gltf"!==t||n.formatOf3DObjects||(n.formatOf3DObjects=t)}if(!n.formatOf3DObjects)throw new t("query:unsupported-3d-query-formats","Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf");if(r(n.outFields)||!n.outFields.includes("*")){n=n===e?n.clone():n,r(n.outFields)&&(n.outFields=[]);const{originX:t,originY:o,originZ:a,translationX:s,translationY:f,translationZ:c,scaleX:u,scaleY:m,scaleZ:l,rotationX:p,rotationY:d,rotationZ:y,rotationDeg:j}=i.transformFieldRoles;n.outFields.push(t,o,a,s,f,c,u,m,l,p,d,y,j)}}return n}function d(t,r){return o(r)&&!0===t.returnGeometry&&"xyFootprint"!==t.multipatchOption&&!t.outStatistics}export{c as executeQuery,u as executeRawQuery,m as normalizeFields};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const b="
|
|
5
|
+
const b="20230215",c="7f5664be78bd8c36fb00b87260226de27cafa24d";export{b as buildDate,c as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
class t{applyColorSubstituition(t,a){if(!a)return t;this._rasterizationCanvas||(this._rasterizationCanvas=document.createElement("canvas"));const{width:e,height:n}=t,o=this._rasterizationCanvas,r=o.getContext("2d");t!==o&&(o.width=e,o.height=n,r.drawImage(t,0,0,e,n));const i=r.getImageData(0,0,e,n).data;if(a)for(const h of a)if(h&&h.oldColor&&4===h.oldColor.length&&h.newColor&&4===h.newColor.length){const[t,a,e,n]=h.oldColor,[o,r,s,l]=h.newColor;if(t===o&&a===r&&e===s&&n===l)continue;for(let h=0;h<i.length;h+=4)t===i[h]&&a===i[h+1]&&e===i[h+2]&&n===i[h+3]&&(i[h]=o,i[h+1]=r,i[h+2]=s,i[h+3]=l)}const s=new ImageData(i,e,n);return r.putImageData(s,0,0),o}tintImageData(t,a){if(!a||a.length<4)return t;this._rasterizationCanvas||(this._rasterizationCanvas=document.createElement("canvas"));const{width:e,height:n}=t,o=this._rasterizationCanvas,r=o.getContext("2d");t!==o&&(o.width=e,o.height=n,r.drawImage(t,0,0,e,n));const i=r.getImageData(0,0,e,n),s=new Uint8Array(i.data),h=[a[0]/255,a[1]/255,a[2]/255,a[3]/255];for(let g=0;g<s.length;g+=4)s[g+0]*=h[0],s[g+1]*=h[1],s[g+2]*=h[2],s[g+3]*=h[3];const l=new ImageData(new Uint8ClampedArray(s.buffer),e,n);return r.putImageData(l,0,0),o}}export{t as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{unwrapOr as t}from"../../../../../../core/maybe.js";import{pt2px as e}from"../../../../../../core/screenUtils.js";import{c as o}from"../../../../../../chunks/mat2df32.js";import{c as s}from"../../../../../../chunks/vec2f32.js";import{Alignment as i,ExtremityPlacement as r}from"../../../../../../symbols/cim/enums.js";import{premultiplyAlphaRGBA as a,premultiplyAlphaRGBAArray as n}from"../../color.js";import{BITSET_MARKER_ALIGNMENT_MAP as h,BITSET_MARKER_ALIGNMENT_SCREEN as
|
|
5
|
+
import{unwrapOr as t}from"../../../../../../core/maybe.js";import{pt2px as e}from"../../../../../../core/screenUtils.js";import{c as o}from"../../../../../../chunks/mat2df32.js";import{c as s}from"../../../../../../chunks/vec2f32.js";import{Alignment as i,ExtremityPlacement as r}from"../../../../../../symbols/cim/enums.js";import{premultiplyAlphaRGBA as a,premultiplyAlphaRGBAArray as n}from"../../color.js";import{BITSET_MARKER_ALIGNMENT_MAP as h,BITSET_MARKER_ALIGNMENT_SCREEN as m,BITSET_GENERIC_LOCK_COLOR as l,BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE as f,BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY as c,SPRITE_PADDING as u,MIN_MAX_ZOOM_PRECISION_FACTOR as d,PICTURE_FILL_COLOR as p}from"../../definitions.js";import{WGLSymbologyType as x}from"../../enums.js";import{i1616to32 as M,i8888to32 as y}from"../../number.js";import{MarkerMaterialKey as _}from"../../materialKey/MaterialKey.js";import{getMinMaxZoom as S,DEFAULT_MIN_ZOOM as g,DEFAULT_MAX_ZOOM as V}from"./util.js";import z from"./WGLBaseMarkerTemplate.js";import B from"./WGLMeshTemplate.js";class b extends(z(B)){constructor(t,e,r,a,n,p,S,g,V,z,B,b,k,L,R,j,w,C,P,E,U,A,T){super(),this.angle=a,this.height=S,this.width=p,this.xOffset=e*P,this.yOffset=r*P,this._markerPlacement=E,this._effects=U,this._anchorX=j,this._anchorY=w,this._minMaxZoom=M(Math.round(A*d),Math.round(T*d));const v=(L===i.MAP?h:m)|(B?l:0)|(k?f:0)|(b?c:0),K=R&&R.sdf,W=_.load(t);W.sdf=K,W.pattern=!0,W.textureBinding=R.textureBinding,this._materialKey=W.data,this._fillColor=n,this._outlineColor=V,this._sizeOutlineWidth=y(Math.round(Math.min(Math.sqrt(128*p),255)),Math.round(Math.min(Math.sqrt(128*S),255)),Math.round(Math.min(Math.sqrt(128*z),255)),Math.round(Math.min(Math.sqrt(128*g),255)));const X=R.rect.x+u,q=R.rect.y+u,Y=X+R.width,H=q+R.height;this._offsets.xUpperLeft=X,this._offsets.yUpperLeft=q,this._offsets.xUpperRight=Y,this._offsets.yUpperRight=q,this._offsets.xBottomLeft=X,this._offsets.yBottomLeft=H,this._offsets.xBottomRight=Y,this._offsets.yBottomRight=H,W.symbologyType===x.PIE_CHART?(this._texUpperLeft=M(0,1),this._texUpperRight=M(1,1),this._texBottomLeft=M(0,0),this._texBottomRight=M(1,0)):(this._texUpperLeft=M(X,q),this._texUpperRight=M(Y,q),this._texBottomLeft=M(X,H),this._texBottomRight=M(Y,H)),p*=C,S*=C,p*=P,S*=P;const I=Math.round(64*C);this._bitestAndDistRatio=M(v,I),this._computedWidth=p,this._computedHeight=S;const N=s(),O=o();this._applyTransformation(O,N)}static fromCIMMarker(o,s,r){const n=s&&s.width||1,h=s&&s.height||1,m=o.size,l=n/h*o.scaleX,f=o.scaleSymbolsProportionally&&o.frameHeight?m/o.frameHeight:1,c=a(o.color),u=a(o.outlineColor),d=e(m),p=d*l,x=e(o.offsetX||0),M=e(o.offsetY||0),y=e(o.outlineWidth||0)*f,_=o.alignment||i.SCREEN,g=e(o.referenceSize),[V,z]=S(o.scaleInfo,r);let B=o.rotation||0;o.rotateClockwise||(B=-B);let k=0,L=0;const R=o.anchorPoint;R&&(o.isAbsoluteAnchorPoint?m&&(k=R.x/(m*l),L=R.y/m):(k=R.x,L=R.y));const j=new b(o.materialKey,x,M,B,c,p,d,g,u,y,o.colorLocked,o.scaleSymbolsProportionally,!1,_,s,k,L,o.sizeRatio,t(o.scaleFactor,1),o.markerPlacement,o.effects,V,z);return j._vertexBoundsScaleX=o.maxVVSize?o.maxVVSize/p:1,j._vertexBoundsScaleY=o.maxVVSize?o.maxVVSize/d:1,j}static fromPictureMarker(t,o){const s=Math.round(e(t.width)),r=Math.round(e(t.height)),a=p,n=Math.round(e(t.xoffset||0)),h=Math.round(e(t.yoffset||0)),m=new b(t.materialKey,n,h,t.angle,a,s,r,r,0,0,!1,!1,!1,i.SCREEN,o,0,0,1,1,null,null,g,V);return m._vertexBoundsScaleX=t.maxVVSize?t.maxVVSize/t.width:1,m._vertexBoundsScaleY=t.maxVVSize?t.maxVVSize/t.height:1,m}static fromSimpleMarker(t,o){const s=n(t.color),r=Math.round(e(t.size)),a=r,h=Math.round(e(t.xoffset||0)),m=Math.round(e(t.yoffset||0)),l=t.style,f=t.outline,c=0|(f?.color&&n(f.color)),u=0|(f?.width&&Math.round(e(f.width))),d=new b(t.materialKey,h,m,t.angle,s,r,a,a,c,u,!1,!1,"esriSMSCross"===l||"esriSMSX"===l,i.SCREEN,o,0,0,126/64,1,null,null,g,V);return d.boundsType="esriSMSCircle"===l?"circle":"square",d._vertexBoundsScaleX=t.maxVVSize?t.maxVVSize/t.size:1,d._vertexBoundsScaleY=t.maxVVSize?t.maxVVSize/t.size:1,d}static fromLineSymbolMarker(t,o){const s=n(t.color),a=6,h=Math.round(e(a*t.lineWidth)),m=h,l="cross"===t.style||"x"===t.style;let f;switch(t.placement){case"begin-end":f=r.Both;break;case"begin":f=r.JustBegin;break;case"end":f=r.JustEnd;break;default:f=r.None}const c={type:"CIMMarkerPlacementAtExtremities",angleToLine:!0,offset:0,extremityPlacement:f,offsetAlongLine:0},u=new b(t.materialKey,0,0,0,s,h,m,m/a,s,l?Math.round(e(t.lineWidth)):0,!1,!1,l,i.MAP,o,0,0,126/64,1,c,null,g,V);return u.boundsType="circle"===t.style?"circle":"square",u}}export{b as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Collection.js";import r from"../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import{isSome as i,isNone as n}from"../../../core/maybe.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import{on as l}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{create as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import"../../../Graphic.js";import"../../../renderers/ClassBreaksRenderer.js";import"../../../renderers/DictionaryRenderer.js";import"../../../renderers/DotDensityRenderer.js";import"../../../renderers/HeatmapRenderer.js";import"../../../renderers/PieChartRenderer.js";import"../../../renderers/Renderer.js";import"../../../renderers/SimpleRenderer.js";import"../../../renderers/UniqueValueRenderer.js";import"../../../renderers/support/jsonUtils.js";import"../../../symbols.js";import t from"../../../core/Collection.js";import"../../../core/has.js";import r from"../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import{isSome as i,isNone as n}from"../../../core/maybe.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import{on as l}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{create as p}from"../../../geometry/support/aaBoundingRect.js";import{ringsContainsCoords as c}from"../../../geometry/support/contains.js";import{extentIntersectsPolygon as h}from"../../../geometry/support/intersectsBase.js";import{MediaElementView as u}from"../../../layers/support/MediaElementView.js";import"../../../core/Error.js";import"../../../core/scheduling.js";import"../../../request.js";import"../../../chunks/index2.js";import"../../../core/urlUtils.js";import"../../../chunks/index3.js";import"../../../layers/effects/EffectView.js";import"../engine/DisplayObject.js";import"../engine/webgl/effects/highlight/HighlightGradient.js";import"../engine/webgl/BufferPool.js";import"../engine/webgl/enums.js";import"../engine/webgl/brushes/BrushBitmap.js";import"../../../chunks/vec4f32.js";import"../engine/webgl/Utils.js";import"../engine/webgl/shaders/BackgroundPrograms.js";import"../../webgl/enums.js";import"../../webgl/checkWebGLError.js";import"../../webgl/context-util.js";import"../../../chunks/builtins.js";import"../../../core/RandomLCG.js";import"../engine/webgl/materialKey/MaterialKey.js";import"../engine/webgl/techniques/Technique.js";import"../engine/webgl/techniques/dotDensity/TechniqueDotDensity.js";import"../engine/webgl/techniques/heatmap/TechniqueHeatmap.js";import"../engine/webgl/techniques/pieChart/TechniquePieChart.js";import"../../webgl/BufferObject.js";import"../../webgl/FramebufferObject.js";import"../../webgl/Texture.js";import"../../webgl/VertexArrayObject.js";import"../engine/webgl/brushes/WGLBrushHeatmap.js";import"../engine/webgl/DefaultVertexAttributeLayouts.js";import"../engine/webgl/shaders/TileInfoPrograms.js";import"../engine/webgl/brushes/WGLGeometryBrushMarker.js";import"../../../core/mathUtils.js";import"../engine/webgl/number.js";import"../engine/vectorTiles/style/StyleDefinition.js";import"../../../chunks/vec2f32.js";import"../engine/vectorTiles/enums.js";import"../engine/vectorTiles/shaders/sources/resolver.js";import"../engine/webgl/shaders/BitBlitPrograms.js";import"../engine/webgl/shaders/sources/resolver.js";import"../engine/webgl/TextureManager.js";import"../engine/webgl/shaders/StencilPrograms.js";import"../engine/webgl/effects/BlendEffect.js";import"../engine/webgl/shaders/HighlightPrograms.js";import"../engine/webgl/Profiler.js";import"../../webgl/renderState.js";import"../../3d/webgl-engine/core/shaderModules/interfaces.js";import"../../../core/floatRGBA.js";import"../../3d/webgl-engine/lib/OrderIndependentTransparency.js";import"../../../chunks/webgl-debug.js";import"../LabelManager.js";import"./graphics/GraphicsView2D.js";import"../engine/webgl/AttributeStoreView.js";import"../../../chunks/earcut.js";import"../../../layers/graphics/featureConversionUtils.js";import"../../../core/unitUtils.js";import"../../../renderers/support/lengthUtils.js";import"../../../chunks/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"../navigation/MapViewNavigation.js";import"../../../core/asyncUtils.js";import"../engine/webgl/shaders/MagnifierPrograms.js";import"../tiling/PagedTileQueue.js";import"../tiling/TileInfoView.js";import"../tiling/TileKey.js";import d from"../tiling/TileQueue.js";import g from"../tiling/TileStrategy.js";import f from"../engine/webgl/Overlay.js";import j from"../engine/webgl/OverlayContainer.js";import{LayerView2DMixin as y}from"./LayerView2D.js";import w from"../../layers/LayerView.js";import b from"../../../geometry/Extent.js";let _=class extends(y(w)){constructor(){super(...arguments),this._overlayContainer=null,this._fetchQueue=null,this._tileStrategy=null,this._elementReferences=new Map,this._debugGraphicsView=null,this.layer=null,this.elements=new t}attach(){this.addAttachHandles([l((()=>this.layer.effectiveSource),"refresh",(()=>{for(const e of this._tileStrategy.tiles)this._updateTile(e);this.requestUpdate()})),l((()=>this.layer.effectiveSource),"change",(({element:e})=>this._elementUpdateHandler(e)))]),this._overlayContainer=new j,this.container.addChild(this._overlayContainer),this._fetchQueue=new d({tileInfoView:this.view.featuresTilingScheme,concurrency:10,process:(e,t)=>this._queryElements(e,t)}),this._tileStrategy=new g({cachePolicy:"purge",resampling:!0,acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme}),this.requestUpdate()}detach(){this.elements.removeAll(),this._tileStrategy.destroy(),this._fetchQueue.destroy(),this._overlayContainer.removeAllChildren(),this.container.removeAllChildren(),this._elementReferences.clear(),this._debugGraphicsView?.destroy()}supportsSpatialReference(e){return!0}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}update(e){this._tileStrategy.update(e),this._debugGraphicsView?.update(e)}async hitTest(e,t){const r=[],s=e.normalize(),n=[s.x,s.y];for(const{projectedElement:{normalizedCoords:o,element:l}}of this._elementReferences.values())i(o)&&c(o.rings,n)&&r.push({type:"media",element:l,layer:this.layer,mapPoint:e});return r.reverse()}canResume(){return null!=this.layer.source&&super.canResume()}async doRefresh(){this._fetchQueue.reset(),this._tileStrategy.tiles.forEach((e=>this._updateTile(e)))}_acquireTile(e){const t=new E(e.clone());return this._updateTile(t),t}_updateTile(e){this.updatingHandles.addPromise(this._fetchQueue.push(e.key).then((t=>{const[r,s]=e.setElements(t);this._referenceElements(e,r),this._dereferenceElements(e,s),this.requestUpdate()}),(e=>{o(e)||r.getLogger(this.declaredClass).error(e)})))}_releaseTile(e){this._fetchQueue.abort(e.key.id),e.elements&&this._dereferenceElements(e,e.elements),this.requestUpdate()}async _queryElements(e,t){const r=this.layer.effectiveSource;if(n(r))return[];this.view.featuresTilingScheme.getTileBounds(v,e,!0);const s=new b({xmin:v[0],ymin:v[1],xmax:v[2],ymax:v[3],spatialReference:this.view.spatialReference});return r.queryElements(s,t)}_referenceElements(e,t){const r=this.layer.source;if(!n(r))for(const s of t)this._referenceElement(e,s)}_referenceElement(e,t){s(this._elementReferences,t.uid,(()=>{const e=new u({element:t,spatialReference:this.view.spatialReference}),r=new f(e);this._overlayContainer.addChild(r),this.elements.add(t);let s=null;return{tiles:new Set,projectedElement:e,overlay:r,debugGraphic:s}})).tiles.add(e)}_dereferenceElements(e,t){for(const r of t)this._dereferenceElement(e,r)}_dereferenceElement(e,t){const r=this._elementReferences.get(t.uid);r.tiles.delete(e),r.tiles.size||(this._overlayContainer.removeChild(r.overlay),r.overlay.destroy(),r.projectedElement.destroy(),this._elementReferences.delete(t.uid),this.elements.remove(t),this._debugGraphicsView?.graphics.remove(r.debugGraphic))}_elementUpdateHandler(e){let t=this._elementReferences.get(e.uid);if(t){const r=t.projectedElement.normalizedCoords;if(n(r))return this._overlayContainer.removeChild(t.overlay),t.overlay.destroy(),t.projectedElement.destroy(),this._elementReferences.delete(e.uid),this.elements.remove(e),void this._debugGraphicsView?.graphics.remove(t.debugGraphic);const s=[],i=[];for(const e of this._tileStrategy.tiles){const n=R(this.view.featuresTilingScheme,e,r);t.tiles.has(e)?n||i.push(e):n&&s.push(e)}for(const t of s)this._referenceElement(t,e);for(const t of i)this._dereferenceElement(t,e);return t=this._elementReferences.get(e.uid),void(t?.debugGraphic&&(t.debugGraphic.geometry=t.projectedElement.normalizedCoords,this._debugGraphicsView.graphicUpdateHandler({graphic:t.debugGraphic,property:"geometry"})))}const r=new u({element:e,spatialReference:this.view.spatialReference}).normalizedCoords;if(i(r))for(const s of this._tileStrategy.tiles){R(this.view.featuresTilingScheme,s,r)&&this._referenceElement(s,e)}}};e([a()],_.prototype,"_fetchQueue",void 0),e([a()],_.prototype,"layer",void 0),e([a({readOnly:!0})],_.prototype,"elements",void 0),_=e([m("esri.views.2d.layers.MediaLayerView2D")],_);const v=p(),T={xmin:0,ymin:0,xmax:0,ymax:0};function R(e,t,r){return e.getTileBounds(v,t.key,!0),T.xmin=v[0],T.ymin=v[1],T.xmax=v[2],T.ymax=v[3],h(T,r)}class E{constructor(e){this.key=e,this.elements=null,this.isReady=!1,this.visible=!0}setElements(e){const t=[],r=new Set(this.elements);this.elements=e;for(const s of e)r.has(s)?r.delete(s):t.push(s);return this.isReady=!0,[t,Array.from(r)]}destroy(){}}const S=_;export{S as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{lerp as s}from"../../../core/mathUtils.js";import{isSome as r,isNone as i,destroyMaybe as a}from"../../../core/maybe.js";import{when as o,syncAndInitial as n,watch as h,initial as p,sync as m}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{l as _,c,h as u}from"../../../chunks/vec3.js";import{f as g}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as w}from"../../../geometry/ellipsoidUtils.js";import{isMoon as f,isEarth as y}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as v}from"../../ViewingMode.js";import{AtmosphereType as P}from"./AtmosphereType.js";import{ChapmanAtmosphere as b}from"./ChapmanAtmosphere.js";import{CloudsComposition as R}from"./CloudsComposition.js";import{FadeInStages as x,FadeInOutStages as A}from"./CloudsCompositionParameters.js";import{isReadyCloudsData as W,CloudsRenderingStages as z}from"./CloudsData.js";import{CloudsGenerator as N}from"./CloudsGenerator.js";import{cloudPresets as j}from"./CloudsPresets.js";import{Fog as E,FogParameters as C}from"./Fog.js";import{PanoramicAtmosphere as T}from"./PanoramicAtmosphere.js";import{Precipitation as O}from"./Precipitation.js";import S from"./SimpleAtmosphere.js";import{SimpleHaze as F,HazeParameters as q}from"./SimpleHaze.js";import{Stars as H}from"./Stars.js";import{weatherHeightLimit as I}from"./weather.js";import{updateWeatherFading as M,weatherFadingNeedsRender as L}from"./weatherUtils.js";import{ShaderOutput as U}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderFeature as V}from"../webgl-engine/lib/RenderFeature.js";import{RenderSlot as k}from"../webgl-engine/lib/RenderSlot.js";import{Update as G}from"../webgl-engine/lib/Update.js";var B;const D=[k.POSTPROCESSING_ENVIRONMENT_OPAQUE,k.POSTPROCESSING_ENVIRONMENT_TRANSPARENT];let Q=B=class extends t{constructor(e){super(e),this._context=null,this._atmosphere=null,this._hqAtmosphere=null,this._oldWeatherParameters=new J,this._newWeatherParameters=new J,this._fadedWeatherParameters=new J,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(D,this)}destroy(){this.removeHandles(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return r(this._hqAtmosphere)&&this.view._stage.renderer.isFeatureEnabled(V.RealisticAtmosphere)?this._hqAtmosphere:this._atmosphere}get _atmosphereType(){return r(this.atmosphere)?this.atmosphere.type:P.None}get canRender(){return!!this.view.basemapTerrain?.renderer.canRender||"global"!==this.view.viewingMode}get needsLinearDepth(){return this._atmosphereType===P.Realistic}updateAnimation(e){return!!r(this._precipitation)&&this._precipitation.update(e)}get updating(){return r(this._stars)&&this._stars.updating||r(this._clouds)&&this._clouds.running}get weatherVisible(){return _(this.view.state.camera.eye)-w(this.view.spatialReference).radius<=I}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return!t||i(this._context)?(a(s),null):r(s)?s:new H({view:e,requestRender:()=>this._setNeedsRender()})}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||i(this._context))return a(e),null;const t=this.view,s=this._context;return r(e)&&e.context===s?e:(a(e),new O({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||i(this._context))return a(e),null;if(r(e))return e;const t=this.view,s=this._context;return a(e),new N({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||i(this._context))return a(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,o=w(this.view.spatialReference).radius;return r(e)&&e.viewingMode===t&&e.planetRadius===o?e:(a(e),new R({rctx:s,viewingMode:t,planetRadius:o,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||i(this._context))return a(e),null;if(r(e))return e;const t=this.view,s=this._context;return new E({context:s,view:t})}get _simpleHaze(){const e=this._get("_simpleHaze");if(!this.weatherEnabled||i(this._context))return a(e),null;if(r(e))return e;const t=this.view,s=this._context;return new F({context:s,view:t})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([o((()=>this.view?.basemapTerrain),(()=>this._updateBasemapTerrain()),n),h((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled,quality:this.view.environment.atmosphere.quality})),(e=>this._updateAtmosphere(e)),n),h((()=>this._stars),t),h((()=>this._precipitation),t),h((()=>this._clouds),(()=>this._updateWeather()),p),h((()=>this._fog),(()=>this._updateFogHaze()),p),h((()=>this._simpleHaze),(()=>this._updateFogHaze()),p),h((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),m),h((()=>this._atmosphereType),(()=>this._updateBasemapTerrain()),n),h((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),n)])}uninitializeRenderContext(){this._context=null,this._atmosphere=a(this._atmosphere),this._hqAtmosphere=a(this._hqAtmosphere),this._set("_stars",a(this._stars)),this._set("_precipitation",a(this._precipitation)),this._set("_clouds",a(this._clouds)),this._set("_cloudsComposition",a(this._cloudsComposition)),this._set("_fog",a(this._fog)),this._set("_simpleHaze",a(this._simpleHaze))}prepareRender(e){e.bindParameters.cloudsFade.data=W(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&(M(e.bindParameters.cloudsFade,e.bindParameters.camera,this.view.state.mode,e.time,this.view.qualitySettings.fadeDuration),this._updateWeatherFading(e.bindParameters),e.bindParameters.cloudsFade.renderingStage===z.FINISHED&&r(this._clouds)&&0===this._clouds.coverage&&!1===this._clouds.running&&this._clouds.destroyFrameBufferCube())}render(e){if(e.output===U.Color)switch(e.bindParameters.slot){case k.POSTPROCESSING_ENVIRONMENT_OPAQUE:r(this._stars)&&this._stars.render(e),r(this.atmosphere)&&(this.atmosphere.render(e),r(this._cloudsComposition)&&r(e.bindParameters.cloudsFade.data)&&(this.weatherVisible&&r(this._clouds)&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),L(e.bindParameters.cloudsFade)&&r(this._context)&&this._context.requestRender());break;case k.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(r(this.atmosphere)&&(this.atmosphere.renderHaze(e,this._weatherParameters.haze.amount),this._weatherParameters.haze.amount>0&&this._atmosphereType!==P.Realistic&&r(this._simpleHaze)&&this._simpleHaze.render(e,this._weatherParameters.haze),this._weatherParameters.fog.amount>0&&r(this._fog)&&this._fog.render(e,this._weatherParameters.fog),r(this._precipitation))){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,i){if(r(this._context)){const r=this._context.renderContext;r.bindParameters.oldLighting.copyFrom(r.bindParameters.lighting),r.bindParameters.newLighting.noonFactor=t,r.bindParameters.newLighting.globalFactor=s,r.bindParameters.newLighting.set(e);i===G.Faded||r.bindParameters.weatherFading?r.bindParameters.fadeLighting(0):r.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return i(e)?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e){if(!e.weatherFading)return;const t=e.cloudsFade;return t.fadeIn.stage===x.FADE_IN?(e.fadeLighting(t.fadeIn.factor),void this._fadeWeather(t.fadeIn.factor)):t.fadeInOut.stage===A.FADE_IN?(e.fadeLighting(t.fadeInOut.factor),void this._fadeWeather(t.fadeInOut.factor)):t.crossFade.enabled?(e.fadeLighting(t.crossFade.factor),void this._fadeWeather(t.crossFade.factor)):(e.fadeLighting(0),void this._fadeWeather(0))}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;i(e)||i(this._clouds)||(this._clouds.applyPreset(j[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){r(this._context)&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(i(this._fog)||i(this._simpleHaze)||i(e)||i(this._context))return;const t=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=s(3e-5,.005,e.weatherAdjustment**3),c(this._newWeatherParameters.fog.color,X),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=this._atmosphereType===P.Realistic?1:0,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),c(this._newWeatherParameters.fog.color,K),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),c(this._newWeatherParameters.fog.color,X),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=this._atmosphereType===P.Realistic?1:0,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.haze.strength=4e-6,this._newWeatherParameters.haze.amount=1,this._setNeedsRender()}t.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(r(this._atmosphere)?this._atmosphere.type===t:t===P.None)return;this._atmosphere=a(this._atmosphere),this._hqAtmosphere=a(this._hqAtmosphere);const s=this._getAtmosphereClass(t);s&&r(this._context)&&(this._atmosphere=new s(this.view,this._context),t===P.Simple&&(this._hqAtmosphere=new b(this.view,this._context))),this._setNeedsRender(),this._updateBasemapTerrain()}_getAtmosphereClass(e){switch(e){case P.Realistic:return b;case P.Panoramic:return T;case P.Simple:return S;default:case P.None:return null}}_selectAtmosphereType(e){const{enabled:t,quality:s,viewingMode:i}=e;return!t||f(this.view.spatialReference)?P.None:i===v.Local?P.Panoramic:r(this._context)&&"high"===s&&b.isSupported(this._context)&&y(this.view.spatialReference)?P.Realistic:P.Simple}_updateBasemapTerrain(){this.view.basemapTerrain&&(this.view.basemapTerrain.velvetOverground=this._atmosphereType===P.Simple)}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled,quality:this.view.environment.atmosphere.quality}),stubGetAtmosphereClass:e=>{Y=B.prototype._getAtmosphereClass,B.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{B.prototype._getAtmosphereClass=Y}}}};e([d({constructOnly:!0})],Q.prototype,"view",void 0),e([d({readOnly:!0})],Q.prototype,"atmosphere",null),e([d({readOnly:!0})],Q.prototype,"_atmosphereType",null),e([d({type:Boolean,readOnly:!0})],Q.prototype,"updating",null),e([d({readOnly:!0})],Q.prototype,"weatherVisible",null),e([d()],Q.prototype,"_context",void 0),e([d()],Q.prototype,"_atmosphere",void 0),e([d()],Q.prototype,"_hqAtmosphere",void 0),e([d({readOnly:!0})],Q.prototype,"_stars",null),e([d({readOnly:!0})],Q.prototype,"_precipitation",null),e([d({readOnly:!0})],Q.prototype,"_clouds",null),e([d({readOnly:!0})],Q.prototype,"_cloudsComposition",null),e([d({readOnly:!0})],Q.prototype,"_fog",null),e([d({readOnly:!0})],Q.prototype,"_simpleHaze",null),e([d({readOnly:!0})],Q.prototype,"weatherEnabled",null),e([d({readOnly:!0})],Q.prototype,"_precipitationEnabled",null),e([d({readOnly:!0})],Q.prototype,"_weatherUpdateParameters",null),Q=B=e([l("esri.views.3d.environment.EnvironmentRenderer")],Q);class J{constructor(){this.fog=new C,this.haze=new q}copyFrom(e){this.fog.amount=e.fog.amount,this.haze.amount=e.haze.amount,this.fog.strength=e.fog.strength,this.haze.strength=e.haze.strength,c(this.fog.color,e.fog.color)}lerp(e,t,r){this.fog.amount=s(e.fog.amount,t.fog.amount,r),this.haze.amount=s(e.haze.amount,t.haze.amount,r),this.fog.strength=s(e.fog.strength,t.fog.strength,r),this.haze.strength=s(e.haze.strength,t.haze.strength,r),u(this.fog.color,e.fog.color,t.fog.color,r)}}const K=g(.5,.5,.5),X=g(1.5,1.5,1.5);let Y;export{Q as EnvironmentRenderer,J as WeatherParameters};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{lerp as s}from"../../../core/mathUtils.js";import{isSome as r,isNone as i,destroyMaybe as a}from"../../../core/maybe.js";import{when as o,syncAndInitial as n,watch as h,initial as p,sync as m}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{l as _,c,h as u}from"../../../chunks/vec3.js";import{f as g}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as w}from"../../../geometry/ellipsoidUtils.js";import{isMoon as f,isEarth as y}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as v}from"../../ViewingMode.js";import{AtmosphereType as P}from"./AtmosphereType.js";import{ChapmanAtmosphere as b}from"./ChapmanAtmosphere.js";import{CloudsComposition as R}from"./CloudsComposition.js";import{FadeInStages as x,FadeInOutStages as A}from"./CloudsCompositionParameters.js";import{isReadyCloudsData as W,CloudsRenderingStages as z}from"./CloudsData.js";import{CloudsGenerator as N}from"./CloudsGenerator.js";import{cloudPresets as j}from"./CloudsPresets.js";import{Fog as E,FogParameters as C}from"./Fog.js";import{PanoramicAtmosphere as T}from"./PanoramicAtmosphere.js";import{Precipitation as O}from"./Precipitation.js";import F from"./SimpleAtmosphere.js";import{SimpleHaze as S,HazeParameters as q}from"./SimpleHaze.js";import{Stars as H}from"./Stars.js";import{weatherHeightLimit as I}from"./weather.js";import{updateWeatherFading as M,weatherFadingNeedsRender as L}from"./weatherUtils.js";import{ShaderOutput as U}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderFeature as V}from"../webgl-engine/lib/RenderFeature.js";import{RenderSlot as k}from"../webgl-engine/lib/RenderSlot.js";import{Update as G}from"../webgl-engine/lib/Update.js";var B;const D=[k.POSTPROCESSING_ENVIRONMENT_OPAQUE,k.POSTPROCESSING_ENVIRONMENT_TRANSPARENT];let Q=B=class extends t{constructor(e){super(e),this._context=null,this._atmosphere=null,this._hqAtmosphere=null,this._oldWeatherParameters=new J,this._newWeatherParameters=new J,this._fadedWeatherParameters=new J,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(D,this)}destroy(){this.removeHandles(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return r(this._hqAtmosphere)&&this.view._stage.renderer.isFeatureEnabled(V.RealisticAtmosphere)?this._hqAtmosphere:this._atmosphere}get _atmosphereType(){return r(this.atmosphere)?this.atmosphere.type:P.None}get canRender(){return!!this.view.basemapTerrain?.renderer.canRender||"global"!==this.view.viewingMode}get needsLinearDepth(){return this._atmosphereType===P.Realistic}updateAnimation(e){return!!r(this._precipitation)&&this._precipitation.update(e)}get updating(){return r(this._stars)&&this._stars.updating||r(this._clouds)&&this._clouds.running}get weatherVisible(){return _(this.view.state.camera.eye)-w(this.view.spatialReference).radius<=I}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return!t||i(this._context)?(a(s),null):r(s)?s:new H({view:e,requestRender:()=>this._setNeedsRender()})}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||i(this._context))return a(e),null;const t=this.view,s=this._context;return r(e)&&e.context===s?e:(a(e),new O({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||i(this._context))return a(e),null;if(r(e))return e;const t=this.view,s=this._context;return a(e),new N({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||i(this._context))return a(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,o=w(this.view.spatialReference).radius;return r(e)&&e.viewingMode===t&&e.planetRadius===o?e:(a(e),new R({rctx:s,viewingMode:t,planetRadius:o,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||i(this._context))return a(e),null;if(r(e))return e;const t=this.view,s=this._context;return new E({context:s,view:t})}get _simpleHaze(){const e=this._get("_simpleHaze");if(!this.weatherEnabled||i(this._context))return a(e),null;if(r(e))return e;const t=this.view,s=this._context;return new S({context:s,view:t})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([o((()=>this.view?.basemapTerrain),(()=>this._updateBasemapTerrain()),n),h((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled,quality:this.view.environment.atmosphere.quality})),(e=>this._updateAtmosphere(e)),n),h((()=>this._stars),t),h((()=>this._precipitation),t),h((()=>this._clouds),(()=>this._updateWeather()),p),h((()=>this._fog),(()=>this._updateFogHaze()),p),h((()=>this._simpleHaze),(()=>this._updateFogHaze()),p),h((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),m),h((()=>this._atmosphereType),(()=>this._updateBasemapTerrain()),n),h((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),n)])}uninitializeRenderContext(){this._context=null,this._atmosphere=a(this._atmosphere),this._hqAtmosphere=a(this._hqAtmosphere),this._set("_stars",a(this._stars)),this._set("_precipitation",a(this._precipitation)),this._set("_clouds",a(this._clouds)),this._set("_cloudsComposition",a(this._cloudsComposition)),this._set("_fog",a(this._fog)),this._set("_simpleHaze",a(this._simpleHaze))}prepareRender(e){e.bindParameters.cloudsFade.data=W(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&(M(e.bindParameters.cloudsFade,e.bindParameters.camera,this.view.state.mode,e.time,this.view.qualitySettings.fadeDuration),this._updateWeatherFading(e.bindParameters),e.bindParameters.cloudsFade.renderingStage===z.FINISHED&&r(this._clouds)&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}render(e){if(e.output===U.Color)switch(e.bindParameters.slot){case k.POSTPROCESSING_ENVIRONMENT_OPAQUE:r(this._stars)&&this._stars.render(e),r(this.atmosphere)&&(this.atmosphere.render(e),r(this._cloudsComposition)&&r(e.bindParameters.cloudsFade.data)&&(this.weatherVisible&&r(this._clouds)&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),L(e.bindParameters.cloudsFade)&&r(this._context)&&this._context.requestRender());break;case k.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(r(this.atmosphere)&&(this.atmosphere.renderHaze(e,this._weatherParameters.haze.amount),this._weatherParameters.haze.amount>0&&this._atmosphereType!==P.Realistic&&r(this._simpleHaze)&&this._simpleHaze.render(e,this._weatherParameters.haze),this._weatherParameters.fog.amount>0&&r(this._fog)&&this._fog.render(e,this._weatherParameters.fog),r(this._precipitation))){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,i){if(r(this._context)){const r=this._context.renderContext;r.bindParameters.oldLighting.copyFrom(r.bindParameters.lighting),r.bindParameters.newLighting.noonFactor=t,r.bindParameters.newLighting.globalFactor=s,r.bindParameters.newLighting.set(e);i===G.Faded||r.bindParameters.weatherFading?r.bindParameters.fadeLighting(0):r.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return i(e)?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e){if(!e.weatherFading)return;const t=e.cloudsFade;return t.fadeIn.stage===x.FADE_IN?(e.fadeLighting(t.fadeIn.factor),void this._fadeWeather(t.fadeIn.factor)):t.fadeInOut.stage===A.FADE_IN?(e.fadeLighting(t.fadeInOut.factor),void this._fadeWeather(t.fadeInOut.factor)):t.crossFade.enabled?(e.fadeLighting(t.crossFade.factor),void this._fadeWeather(t.crossFade.factor)):(e.fadeLighting(0),void this._fadeWeather(0))}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;i(e)||i(this._clouds)||(this._clouds.applyPreset(j[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){r(this._context)&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(i(this._fog)||i(this._simpleHaze)||i(e)||i(this._context))return;const t=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=s(3e-5,.005,e.weatherAdjustment**3),c(this._newWeatherParameters.fog.color,X),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=this._atmosphereType===P.Realistic?1:0,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),c(this._newWeatherParameters.fog.color,K),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),c(this._newWeatherParameters.fog.color,X),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=this._atmosphereType===P.Realistic?1:0,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.haze.strength=4e-6,this._newWeatherParameters.haze.amount=1,this._setNeedsRender()}t.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(r(this._atmosphere)?this._atmosphere.type===t:t===P.None)return;this._atmosphere=a(this._atmosphere),this._hqAtmosphere=a(this._hqAtmosphere);const s=this._getAtmosphereClass(t);s&&r(this._context)&&(this._atmosphere=new s(this.view,this._context),t===P.Simple&&(this._hqAtmosphere=new b(this.view,this._context))),this._setNeedsRender(),this._updateBasemapTerrain()}_getAtmosphereClass(e){switch(e){case P.Realistic:return b;case P.Panoramic:return T;case P.Simple:return F;default:case P.None:return null}}_selectAtmosphereType(e){const{enabled:t,quality:s,viewingMode:i}=e;return!t||f(this.view.spatialReference)?P.None:i===v.Local?P.Panoramic:r(this._context)&&"high"===s&&b.isSupported(this._context)&&y(this.view.spatialReference)?P.Realistic:P.Simple}_updateBasemapTerrain(){this.view.basemapTerrain&&(this.view.basemapTerrain.velvetOverground=this._atmosphereType===P.Simple)}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled,quality:this.view.environment.atmosphere.quality}),stubGetAtmosphereClass:e=>{Y=B.prototype._getAtmosphereClass,B.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{B.prototype._getAtmosphereClass=Y}}}};e([d({constructOnly:!0})],Q.prototype,"view",void 0),e([d({readOnly:!0})],Q.prototype,"atmosphere",null),e([d({readOnly:!0})],Q.prototype,"_atmosphereType",null),e([d({type:Boolean,readOnly:!0})],Q.prototype,"updating",null),e([d({readOnly:!0})],Q.prototype,"weatherVisible",null),e([d()],Q.prototype,"_context",void 0),e([d()],Q.prototype,"_atmosphere",void 0),e([d()],Q.prototype,"_hqAtmosphere",void 0),e([d({readOnly:!0})],Q.prototype,"_stars",null),e([d({readOnly:!0})],Q.prototype,"_precipitation",null),e([d({readOnly:!0})],Q.prototype,"_clouds",null),e([d({readOnly:!0})],Q.prototype,"_cloudsComposition",null),e([d({readOnly:!0})],Q.prototype,"_fog",null),e([d({readOnly:!0})],Q.prototype,"_simpleHaze",null),e([d({readOnly:!0})],Q.prototype,"weatherEnabled",null),e([d({readOnly:!0})],Q.prototype,"_precipitationEnabled",null),e([d({readOnly:!0})],Q.prototype,"_weatherUpdateParameters",null),Q=B=e([l("esri.views.3d.environment.EnvironmentRenderer")],Q);class J{constructor(){this.fog=new C,this.haze=new q}copyFrom(e){this.fog.amount=e.fog.amount,this.haze.amount=e.haze.amount,this.fog.strength=e.fog.strength,this.haze.strength=e.haze.strength,c(this.fog.color,e.fog.color)}lerp(e,t,r){this.fog.amount=s(e.fog.amount,t.fog.amount,r),this.haze.amount=s(e.haze.amount,t.haze.amount,r),this.fog.strength=s(e.fog.strength,t.fog.strength,r),this.haze.strength=s(e.haze.strength,t.haze.strength,r),u(this.fog.color,e.fog.color,t.fog.color,r)}}const K=g(.5,.5,.5),X=g(1.5,1.5,1.5);let Y;export{Q as EnvironmentRenderer,J as WeatherParameters};
|