@arcgis/core 4.34.0-next.82 → 4.34.0-next.84
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/{9789f178ece126c4006d.js → 25ea02dd7d45a90cbb3b.js} +1 -1
- package/assets/esri/core/workers/chunks/{6271a706ac3fcba91432.js → 609abf071c4ea24955c2.js} +1 -1
- package/assets/esri/core/workers/chunks/{afb2770c4abbff9bab3d.js → 71c2a8e5a17803d3e949.js} +1 -1
- package/assets/esri/core/workers/chunks/77705d0c7c17bd46d81a.js +1 -0
- package/assets/esri/core/workers/chunks/{22f196d173711ebd64c7.js → 8513c9282c44bb0a736e.js} +1 -1
- package/assets/esri/core/workers/chunks/{b8810711d058300395cd.js → 8bdbd94a59269e216fba.js} +1 -1
- package/assets/esri/core/workers/chunks/{ecac5ca00c742bfb5898.js → 998d164b3e0b99a0ff1e.js} +1 -1
- package/assets/esri/core/workers/chunks/{96e483db7dd1f5dbb07a.js → 9a6fa91dd204f64d2590.js} +1 -1
- package/assets/esri/core/workers/chunks/{b6c4712e00fce87bd0f4.js → aa1eb7b4d9ccda725da5.js} +1 -1
- package/assets/esri/core/workers/chunks/{20ae2316d927415f3df9.js → b43473e84b3f7fa2634d.js} +1 -1
- package/assets/esri/core/workers/chunks/{b168b6ffc16cd509d316.js → bd028badc07270eda3d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{6593b419339e7598b760.js → d5363e5637d37e89a25f.js} +1 -1
- package/assets/esri/core/workers/chunks/{81a8addcb858086ff9ee.js → e17df11c98dbd869302b.js} +1 -1
- package/assets/esri/core/workers/chunks/{6e2a3abc3dbc342212c4.js → f35003a90163847fe1e2.js} +1 -1
- package/assets/esri/core/workers/chunks/{9c5dcef2a75d4bb9b3d6.js → fcac475e4e82911b3126.js} +1 -1
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/config.js +1 -1
- package/geometry/Extent.js +1 -1
- package/geometry/support/aaBoundingRect.js +1 -1
- package/interfaces.d.ts +22 -82
- package/kernel.js +1 -1
- package/layers/ImageryLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/support/tiles3DUtils.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/smartMapping/renderers/color.js +1 -1
- package/smartMapping/renderers/location.js +1 -1
- package/smartMapping/renderers/predominance.js +1 -1
- package/smartMapping/renderers/relationship.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/type.js +1 -1
- package/smartMapping/statistics/summaryStatistics.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/smartMapping/support/utils.js +1 -1
- package/support/elevationInfoUtils.js +1 -1
- package/support/revision.js +1 -1
- package/tables/elements.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/support/DisplayQualityProfile.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/support/flow/StreamlineResources3D.js +1 -1
- package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
- package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/Queue.js +5 -0
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/isTerrainSurfaceLayer.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/SplitFeatureWorkflow.js +5 -0
- package/widgets/Editor/SplitFeatureWorkflowData.js +5 -0
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/support/splitFeatureUtils.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/5f079be7f322768aef21.js +0 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatQualitySettings.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{pickRandom as r}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{isHostedAgolService as n}from"../../../layers/support/arcgisLayerUrl.js";import{isTimeOnlyField as l,isNumericField as u}from"../../../layers/support/fieldUtils.js";import{generateRenderer as m}from"../../../rest/generateRenderer.js";import c from"../../../rest/support/GenerateRendererParameters.js";import p from"../../../rest/support/StatisticDefinition.js";import h from"../../../rest/support/UniqueValueDefinition.js";import{getArcadeForPredominantCategory as d,getSQLForPredominantCategoryName as y}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as f,getRangeExpr as F,getSQLFilterForNormalization as S}from"../../statistics/support/utils.js";import{WorkerClient as g}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as w,fieldDelimiter as v}from"../utils.js";import x from"./InMemoryLayerAdapter.js";import{getQueryParamsForExpr as _,getDataRange as q,getAttributeBinsQuery as E,processQueryAttributeBinsResult as z,binParamsFromGenRend as V}from"./support/histogramUtils.js";import{ensureFeaturesJSON as L,getSummaryStatsQuery as T,getSummaryStatisticsFromFeatureSet as Q,getUVQuery as j,getUniqueValuesFromFeatureSet as b,defaultNumBins as N,updateQueryWithFeatureFilter as C,getHistogramFromFeatureSet as B,getFieldExpr as M,getDomainsForFields as R,getBins as I,getPredominantCategoriesFromUVInfos as $,getMissingFields as O}from"./support/utils.js";import{processSummaryStatisticsResult as A,createUVResult as k,getEqualIntervalBins as D,createClassBreaksDefinition as G,resolveCBResult as U}from"../../../statistics/utils.js";import{getScaleToResolutionFactor as P}from"../../../views/2d/viewpointUtils.js";const J=5,W=2e4,H=4e5;let Z=class extends x{constructor(){super(...arguments),this.adapterName="feature-layer-adapter"}_isStatsSupportedOnService(){const e=this.layer;if(!e.capabilities?.query?.supportsStatistics||"multipatch"===this.geometryType&&!n(e.url)&&e.version<10.5)throw new i(`${this.adapterName}:not-supported`,"Layer does not support statistics query");return Promise.resolve()}_fetchFeaturesFromService(e,t){return this.layer.queryFeatures(e,{signal:t}).then(e=>e.features)}_fetchFeaturesJSONFromService(e,t){return this._fetchFeaturesFromService(e,t).then(L)}_summaryStatsFromGenRend(e){const t=e.normalizationType,r=e.normalizationField;return this.classBreaks({field:e.field,numClasses:J,classificationMethod:"standard-deviation",standardDeviationInterval:.25,normalizationType:t,normalizationField:"field"===t?r:void 0,minValue:e.minValue,maxValue:e.maxValue,filter:e.filter,signal:e.signal}).then(t=>{let r,i,s;if(t.classBreakInfos?.some(e=>(e.hasAvg&&(r=e),!!r)),r){const e=r.maxValue-r.minValue;i=r.minValue+e/2,s=4*e}const a={min:t.minValue,max:t.maxValue,avg:i,stddev:s};return A(a,e.outStatisticTypes)})}async _summaryStatsFromServiceQuery(e,t){await this._isStatsSupportedOnService(),"percent-of-total"===e.normalizationType&&(e.normalizationTotal=await this._getNormalizationTotal(e.field,e.normalizationType,e.filter));const r=w(t)||l(t),i="capabilities"in this.layer?this.layer.capabilities:null,s=T(this,e,t,i?.query?.supportsPercentileStatistics??!1),a=await this.layer.queryFeatures(s,{signal:e.signal}),o=Q(a,r);return A(o,e.outStatisticTypes)}_uvFromGenRenderer(e,t){const r=e.field??void 0,i=new h({attributeField:r}),s=new c({classificationDefinition:i});return this.generateRenderer(s,e.signal).then(e=>{const t={},i=this.getField(r);return e.uniqueValues.forEach(e=>{let r=e.value;null!=r&&""!==r&&("string"!=typeof r||""!==r.trim()&&"<null>"!==r.toLowerCase())||(r=null),null==t[r]?t[r]={count:e.count,data:u(i)&&r?Number(r):r}:t[r].count=t[r].count+e.count}),{count:t}}).then(r=>k(r,[t],e.returnAllCodedValues))}async _uvFromServiceQuery(e,t){return this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(j(this,e),{signal:e.signal})).then(t=>b(t,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:v,view:e.view,signal:e.signal})).then(r=>k(r,t,e.returnAllCodedValues,v))}_getNormalizationTotal(e,t,r,i){return e&&"percent-of-total"===t?this.summaryStatistics({field:e,outStatisticTypes:{include:["sum"]},filter:r,signal:i}).then(e=>e.sum):Promise.resolve(null)}_histogramForExpr(e){return this._getNormalizationTotal(e.field,e.normalizationType,e.filter,e.signal).then(t=>{const r=_(e,this,t);return q(r,this,e.minValue,e.maxValue).then(i=>{const s=i.min,a=i.max;if(null==s||null==a)return{bins:[],minValue:s,maxValue:a,normalizationTotal:t};const o=e.numBins||N,n=D(s,a,o),l=K(r.sqlExpression,n,null!=e.minValue&&null!=e.maxValue),u=new p({statisticType:"count",outStatisticFieldName:"countOFExpr",onStatisticField:"1"}),m=this.layer.createQuery();return m.where=f(m.where,r.sqlWhere),m.sqlFormat="standard",m.outStatistics=[u],m.groupByFieldsForStatistics=[l],m.orderByFields=[l],C(m,e.filter),this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(m,{signal:r.signal})).then(e=>B(e,s,a,o,t))})})}async _histogramFromQueryAttributeBins(e){const{field:t,normalizationType:r,filter:i,signal:s}=e,a=await this._getNormalizationTotal(t,r,i,s),o=this.layer.createQuery(),{query:n,min:l,max:u}=await E(e,this,a,o?.where);if(!n)return{bins:[],minValue:l,maxValue:u,normalizationTotal:a};const m=await this.layer.queryAttributeBins(n,{signal:s});return z(m,t?this.getField(t):null,{minValue:l,maxValue:u,normalizationTotal:a})}_classBreaksFromGenRend(e){const{field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,signal:a}=e,o=S({field:t,normalizationType:r,normalizationField:i}),n=M({field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,layer:this}),l=F(n,e.minValue,e.maxValue),u=G({field:t,normalizationType:r,normalizationField:i,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numClasses||J}),m=new c({classificationDefinition:u});return m.where=f(o,l),this.generateRenderer(m,a).then(t=>U(t,e.classificationMethod))}async summaryStatistics(e){const{field:t,normalizationType:r,valueExpression:a,sqlExpression:o,view:n,features:u,useFeaturesInView:m}=e,c=t?this.getField(t):null,p=w(c)||l(c),h=a&&!(o&&this.supportsSQLExpression),d=this._hasLocalSource||u||m,y=n&&"3d"===n.type;if(d||h)return h||u||m||y?this._summaryStatsFromMemory(e,c):this._summaryStatsFromClientQuery(e,c);if(!this.supportsSQLExpression&&(p||o||"natural-log"===r||"square-root"===r))throw new i(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return(r&&!this.supportsSQLExpression?this._summaryStatsFromGenRend(e):this._summaryStatsFromServiceQuery(e,c)).catch(()=>(s(e.signal),this._summaryStatsFromMemory(e,c)))}async uniqueValues(e){const{valueExpression:t,sqlExpression:r,features:i,useFeaturesInView:a,signal:o}=e,n=t&&!(r&&this.supportsSQLExpression),l=this._hasLocalSource||i||a||n,u=e.view,m=u&&"3d"===u.type,c=await R(e,this);return l?n||i||a||m?this._uvFromMemory(e,c):this._uvFromClientQuery(e,c):this._uvFromServiceQuery(e,c).catch(t=>(s(o),!e.field||e.field2||e.field3||e.filter?t:this._uvFromGenRenderer(e,c[0]))).catch(()=>(s(o),m?this._uvFromMemory(e,c):this._uvFromClientQuery(e,c)))}async histogram(e){const{field:t,normalizationType:r,normalizationField:a,classificationMethod:o,view:n,filter:u,signal:m}=e,c=t?this.getField(t):null,p=w(c)||l(c),h=e.valueExpression||e.sqlExpression,d=e.valueExpression&&!(e.sqlExpression&&this.supportsSQLExpression),y=this._hasLocalSource||e.features||e.useFeaturesInView||d,f=this.supportsSQLExpression,S=!o||"equal-interval"===o,g=e.minValue,v=e.maxValue,x=null!=g&&null!=v,_=e.numBins||N;if(y)return this._histogramFromMemory(e);if(this.layer.capabilities?.operations?.supportsQueryBins&&e.useQueryAttributeBins)try{return await this._histogramFromQueryAttributeBins(e)}catch{return s(m),this._histogramFromQueryAttributeBinsFromMemory(e)}if((h||f)&&S){if(!f&&(h||"natural-log"===r||"square-root"===r))throw new i(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return this._histogramForExpr(e)}if(p&&S)throw new i(`${this.adapterName}:not-supported`,"Normalization and date field are not allowed when layer does not support standardized SQL expression for queries");return r||!S?V(e,this).then(s=>{if(!x)return I(this,s,t,_,n,u,m);if(g>s.max||v<s.min)throw new i(`${this.adapterName}:insufficient-data`,"Range defined by 'minValue' and 'maxValue' does not intersect available data range of the field");if(S)return I(this,{min:g,max:v,sqlExpr:s.sqlExpr,excludeZerosExpr:s.excludeZerosExpr},t,_,n,u,m);{const i={field:t,normalizationType:r,normalizationField:a,normalizationTotal:s.normTotal,layer:this},o=M(i),l=F(o,g,v);return V(e,this,l).then(e=>I(this,e,t,_,n,u,m))}}):this._histogramForField(e)}async classBreaks(e){const t=!1!==e.analyzeData,r=this._hasLocalSource||e.features||e.useFeaturesInView||e.valueExpression||e.filter;if(t&&r)return this._classBreaksFromMemory(e);return(t?this._classBreaksFromGenRend(e):this._classBreaksFromInterpolation(e)).catch(()=>(s(e.signal),this._classBreaksFromMemory(e)))}async queryFeatureCount(e){if(this._hasLocalSource)throw new i(`${this.adapterName}:not-supported`,"Layer does not support count query");const t=this.layer,r=t.createQuery();return r.where=f(r.where,e.whereClause),C(r,e.filter),t.queryFeatureCount(r,{signal:e.signal})}async generateRenderer(e,t){const r=this.layer;if(this._hasLocalSource||r.version<10.1)throw new i(`${this.adapterName}:not-supported`,"Layer does not support generateRenderer operation (requires ArcGIS Server version 10.1+)");const s=r.createQuery();return e.where=f(e.where,s.where),m(r.parsedUrl?.path??"",{source:r.dynamicDataSource??void 0,gdbVersion:r.gdbVersion??void 0},e,{signal:t})}async predominantCategories(e){if(!this._hasLocalSource&&!this.supportsSQLExpression)throw new i(`${this.adapterName}:not-supported`,"Layer does not support advanced SQL expressions and standardized queries");const{fields:t,view:r,signal:s,filter:a}=e,o=d(t),n=y(t),l=r&&this._hasLocalSource?await this._uvFromMemory({valueExpression:o,view:r,signal:s,filter:a}):await this._uvFromServiceQuery({sqlExpression:n.expression,valueExpression:o,signal:s,filter:a});return $(l.uniqueValueInfos,t)}async getSampleFeatures(e,i){const{view:a,requiredFields:o,returnGeometry:n,filter:l,signal:u}=e,m=e.sampleSize;if(null==m||0===m)return[];const c=this.layer.createQuery(),p=1,h="json"===i;c.outSpatialReference=a?.spatialReference,c.returnGeometry=!!n,c.outFields=o,C(c,l);let d=[],y=!1;if(a)try{const s=await a.whenLayerView(this.layer);if(y=!O(this,o,s).length,y){if(m>=1&&!e.filter&&"getSampleFeatures"in s){await this._waitForLayerViewUpdate(s);const e=await s.getSampleFeatures({minFeatureCount:m,sampleSize:m});if(null!=e)return h?e:e.map(e=>t.fromJSON(e))}if(d=await this._fetchFeaturesFromMemory(s,c,u,i),d.length>=m&&m>0)return r(d,m,p)}}catch(f){s(u)}try{if(this._hasLocalSource)return y?d:h?await this._fetchFeaturesJSONFromService(c,u):await this._fetchFeaturesFromService(c,u);const t=await this.queryFeatureCount({view:a,filter:l,signal:u}),i=this.layer.capabilities.query.maxRecordCount;let s=-1===m?t:m;if(s=i&&s>i?i:s,t<=d.length||d.length>=i)return d;if(c.maxAllowableOffset=e.resolution||(a?a.extent.width/a.width/a.scale:P(this.layer.spatialReference))*H,t<=s)return h?await this._fetchFeaturesJSONFromService(c,u):await this._fetchFeaturesFromService(c,u);if(t<=W){const e=this.layer.createQuery();C(e,l);const t=await this.layer.queryObjectIds();return c.objectIds=r(t,s,p),h?await this._fetchFeaturesJSONFromService(c,u):await this._fetchFeaturesFromService(c,u)}return this.layer.capabilities?.query?.supportsPagination&&(c.num=Math.min(s,W)),h?await this._fetchFeaturesJSONFromService(c,u):await this._fetchFeaturesFromService(c,u)}catch(f){return s(u),d}}load(e){const t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.capabilities?.query?.supportsSqlExpression,this._hasLocalSource=!t.url&&!!t.source,this.hasQueryEngine=this._hasLocalSource,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=t.fullExtent,this.workerClient=g.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};function K(e,t,r){const i=[],s=t.length;return t.forEach((t,a)=>{const[o,n]=t;let l=null;l=0!==a||r?a!==s-1||r?f(`${e} >= ${o}`,`${e} ${a===s-1?" <= ":" < "} ${n}`):`${e} >= ${o}`:`${e} < ${n}`,i.push("WHEN ("+l+") THEN "+(a+1))}),["CASE",i.join(" "),"ELSE 0","END"].join(" ")}e([a({readOnly:!0})],Z.prototype,"adapterName",void 0),e([a({constructOnly:!0})],Z.prototype,"layer",void 0),Z=e([o("esri.smartMapping.support.adapters.FeatureLayerAdapter")],Z);export{Z as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{pickRandom as r}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{isHostedAgolService as n}from"../../../layers/support/arcgisLayerUrl.js";import{isTimeOnlyField as l,isNumericField as u}from"../../../layers/support/fieldUtils.js";import{generateRenderer as c}from"../../../rest/generateRenderer.js";import m from"../../../rest/support/GenerateRendererParameters.js";import h from"../../../rest/support/StatisticDefinition.js";import p from"../../../rest/support/UniqueValueDefinition.js";import{getArcadeForPredominantCategory as d,getSQLForPredominantCategoryName as y}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as f,getRangeExpr as F,getSQLFilterForNormalization as S}from"../../statistics/support/utils.js";import{WorkerClient as g}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as v,isIntegerField as w,castIntegerFieldToFloat as _,fieldDelimiter as x}from"../utils.js";import q from"./InMemoryLayerAdapter.js";import{getQueryParamsForExpr as E,getDataRange as z,getAttributeBinsQuery as V,processQueryAttributeBinsResult as L,binParamsFromGenRend as T}from"./support/histogramUtils.js";import{ensureFeaturesJSON as b,getSummaryStatsQuery as j,getSummaryStatisticsFromFeatureSet as Q,getSummaryStatsQueryForFields as N,getUVQuery as M,getUniqueValuesFromFeatureSet as B,defaultNumBins as C,updateQueryWithFeatureFilter as $,getHistogramFromFeatureSet as O,getFieldExpr as R,getDomainsForFields as I,getBins as k,getPredominantCategoriesFromUVInfos as A,getMissingFields as D}from"./support/utils.js";import{processSummaryStatisticsResult as G,createUVResult as U,getEqualIntervalBins as P,createClassBreaksDefinition as J,resolveCBResult as W}from"../../../statistics/utils.js";import{getScaleToResolutionFactor as H}from"../../../views/2d/viewpointUtils.js";const Z=5,K=2e4,X=4e5;let Y=class extends q{constructor(){super(...arguments),this.adapterName="feature-layer-adapter"}_isStatsSupportedOnService(){const e=this.layer;if(!e.capabilities?.query?.supportsStatistics||"multipatch"===this.geometryType&&!n(e.url)&&e.version<10.5)throw new i(`${this.adapterName}:not-supported`,"Layer does not support statistics query");return Promise.resolve()}_fetchFeaturesFromService(e,t){return this.layer.queryFeatures(e,{signal:t}).then(e=>e.features)}_fetchFeaturesJSONFromService(e,t){return this._fetchFeaturesFromService(e,t).then(b)}_summaryStatsFromGenRend(e){const t=e.normalizationType,r=e.normalizationField;return this.classBreaks({field:e.field,numClasses:Z,classificationMethod:"standard-deviation",standardDeviationInterval:.25,normalizationType:t,normalizationField:"field"===t?r:void 0,minValue:e.minValue,maxValue:e.maxValue,filter:e.filter,signal:e.signal}).then(t=>{let r,i,s;if(t.classBreakInfos?.some(e=>(e.hasAvg&&(r=e),!!r)),r){const e=r.maxValue-r.minValue;i=r.minValue+e/2,s=4*e}const a={min:t.minValue,max:t.maxValue,avg:i,stddev:s};return G(a,e.outStatisticTypes)})}async _summaryStatsFromServiceQuery(e,t){await this._isStatsSupportedOnService(),"percent-of-total"===e.normalizationType&&(e.normalizationTotal=await this._getNormalizationTotal(e.field,e.normalizationType,e.filter));const r=v(t)||l(t),i="capabilities"in this.layer?this.layer.capabilities:null,s=j(this,e,t,i?.query?.supportsPercentileStatistics??!1),a=await this.layer.queryFeatures(s,{signal:e.signal}),o=Q(a,r);return G(o,e.outStatisticTypes)}async _summaryStatsForFieldsBasic(e){const{outStatisticTypes:t,fields:r}=e,i=50,s=[];for(let n=0;n<r.length;n+=i){const t=r.slice(n,n+i),a=N(this,e,t);s.push(this.layer.queryFeatures(a,{signal:e.signal}))}const a=(await Promise.all(s)).flatMap(e=>e.features).map(e=>e.attributes).reduce((e,t)=>Object.assign(e,t),{}),o={};for(const n in a){const e=n.match(/^(\w+)_value_/);if(null==a[n]||!e)continue;switch(e[1]){case"min":o.min=null==o.min?a[n]:Math.min(o.min,a[n]);break;case"max":o.max=null==o.max?a[n]:Math.max(o.max,a[n]);break;case"sum":o.sum=(o.sum||0)+a[n];break;case"count":o.count=(o.count||0)+a[n]}}return G(o,t)}async _summaryStatsForFieldsAdvanced(e,t){const{outStatisticTypes:r,fields:i}=e,s=r?.exclude?.includes("variance")||r?.include&&!r.include.includes("variance"),a=r?.exclude?.includes("stddev")||r?.include&&!r.include.includes("stddev");if(null==t.sum||!t.count||s&&a)return t;t.avg=t.sum/t.count;const o=50,n=[];for(let u=0;u<i.length;u+=o){const r=i.slice(u,u+o),s=N(this,e,r);s.outStatistics=[];for(const e of r){const r=`sumOfSquares_${e}`,i=`(power(${w(this.layer,e)?_(e):e} - ${t.avg}, 2))`,a=new h({statisticType:"sum",onStatisticField:i,outStatisticFieldName:r});s.outStatistics.push(a)}n.push(this.layer.queryFeatures(s,{signal:e.signal}))}const l=(await Promise.all(n)).reduce((e,t)=>e+Object.values(t.features[0].attributes).reduce((e,t)=>e+t,0),0);return t.variance=l/(t.count-1),t.stddev=Math.sqrt(t.variance),G(t,r)}async _summaryStatsForFields(e){const t=await this._summaryStatsForFieldsBasic(e);return this._summaryStatsForFieldsAdvanced(e,t)}_uvFromGenRenderer(e,t){const r=e.field??void 0,i=new p({attributeField:r}),s=new m({classificationDefinition:i});return this.generateRenderer(s,e.signal).then(e=>{const t={},i=this.getField(r);return e.uniqueValues.forEach(e=>{let r=e.value;null!=r&&""!==r&&("string"!=typeof r||""!==r.trim()&&"<null>"!==r.toLowerCase())||(r=null),null==t[r]?t[r]={count:e.count,data:u(i)&&r?Number(r):r}:t[r].count=t[r].count+e.count}),{count:t}}).then(r=>U(r,[t],e.returnAllCodedValues))}async _uvFromServiceQuery(e,t){return this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(M(this,e),{signal:e.signal})).then(t=>B(t,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:x,view:e.view,signal:e.signal})).then(r=>U(r,t,e.returnAllCodedValues,x))}_getNormalizationTotal(e,t,r,i){return e&&"percent-of-total"===t?this.summaryStatistics({field:e,outStatisticTypes:{include:["sum"]},filter:r,signal:i}).then(e=>e.sum):Promise.resolve(null)}_histogramForExpr(e){return this._getNormalizationTotal(e.field,e.normalizationType,e.filter,e.signal).then(t=>{const r=E(e,this,t);return z(r,this,e.minValue,e.maxValue).then(i=>{const s=i.min,a=i.max;if(null==s||null==a)return{bins:[],minValue:s,maxValue:a,normalizationTotal:t};const o=e.numBins||C,n=P(s,a,o),l=ee(r.sqlExpression,n,null!=e.minValue&&null!=e.maxValue),u=new h({statisticType:"count",outStatisticFieldName:"countOFExpr",onStatisticField:"1"}),c=this.layer.createQuery();return c.where=f(c.where,r.sqlWhere),c.sqlFormat="standard",c.outStatistics=[u],c.groupByFieldsForStatistics=[l],c.orderByFields=[l],$(c,e.filter),this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(c,{signal:r.signal})).then(e=>O(e,s,a,o,t))})})}async _histogramFromQueryAttributeBins(e){const{field:t,normalizationType:r,filter:i,signal:s}=e,a=await this._getNormalizationTotal(t,r,i,s),o=this.layer.createQuery(),{query:n,min:l,max:u}=await V(e,this,a,o?.where);if(!n)return{bins:[],minValue:l,maxValue:u,normalizationTotal:a};const c=await this.layer.queryAttributeBins(n,{signal:s});return L(c,t?this.getField(t):null,{minValue:l,maxValue:u,normalizationTotal:a})}_classBreaksFromGenRend(e){const{field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,signal:a}=e,o=S({field:t,normalizationType:r,normalizationField:i}),n=R({field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,layer:this}),l=F(n,e.minValue,e.maxValue),u=J({field:t,normalizationType:r,normalizationField:i,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numClasses||Z}),c=new m({classificationDefinition:u});return c.where=f(o,l),this.generateRenderer(c,a).then(t=>W(t,e.classificationMethod))}async summaryStatistics(e){const{field:t,fields:r,normalizationType:a,valueExpression:o,sqlExpression:n,view:u,features:c,useFeaturesInView:m}=e,h=t?this.getField(t):null,p=v(h)||l(h),d=o&&!(n&&this.supportsSQLExpression),y=this._hasLocalSource||c||m,f=u&&"3d"===u.type;if(r?.length)return this._summaryStatsForFields({...e,fields:r});if(y||d)return d||c||m||f?this._summaryStatsFromMemory(e,h):this._summaryStatsFromClientQuery(e,h);if(!this.supportsSQLExpression&&(p||n||"natural-log"===a||"square-root"===a))throw new i(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return(a&&!this.supportsSQLExpression?this._summaryStatsFromGenRend(e):this._summaryStatsFromServiceQuery(e,h)).catch(()=>(s(e.signal),this._summaryStatsFromMemory(e,h)))}async uniqueValues(e){const{valueExpression:t,sqlExpression:r,features:i,useFeaturesInView:a,signal:o}=e,n=t&&!(r&&this.supportsSQLExpression),l=this._hasLocalSource||i||a||n,u=e.view,c=u&&"3d"===u.type,m=await I(e,this);return l?n||i||a||c?this._uvFromMemory(e,m):this._uvFromClientQuery(e,m):this._uvFromServiceQuery(e,m).catch(t=>(s(o),!e.field||e.field2||e.field3||e.filter?t:this._uvFromGenRenderer(e,m[0]))).catch(()=>(s(o),c?this._uvFromMemory(e,m):this._uvFromClientQuery(e,m)))}async histogram(e){const{field:t,normalizationType:r,normalizationField:a,classificationMethod:o,view:n,filter:u,signal:c}=e,m=t?this.getField(t):null,h=v(m)||l(m),p=e.valueExpression||e.sqlExpression,d=e.valueExpression&&!(e.sqlExpression&&this.supportsSQLExpression),y=this._hasLocalSource||e.features||e.useFeaturesInView||d,f=this.supportsSQLExpression,S=!o||"equal-interval"===o,g=e.minValue,w=e.maxValue,_=null!=g&&null!=w,x=e.numBins||C;if(y)return this._histogramFromMemory(e);if(this.layer.capabilities?.operations?.supportsQueryBins&&e.useQueryAttributeBins)try{return await this._histogramFromQueryAttributeBins(e)}catch{return s(c),this._histogramFromQueryAttributeBinsFromMemory(e)}if((p||f)&&S){if(!f&&(p||"natural-log"===r||"square-root"===r))throw new i(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return this._histogramForExpr(e)}if(h&&S)throw new i(`${this.adapterName}:not-supported`,"Normalization and date field are not allowed when layer does not support standardized SQL expression for queries");return r||!S?T(e,this).then(s=>{if(!_)return k(this,s,t,x,n,u,c);if(g>s.max||w<s.min)throw new i(`${this.adapterName}:insufficient-data`,"Range defined by 'minValue' and 'maxValue' does not intersect available data range of the field");if(S)return k(this,{min:g,max:w,sqlExpr:s.sqlExpr,excludeZerosExpr:s.excludeZerosExpr},t,x,n,u,c);{const i={field:t,normalizationType:r,normalizationField:a,normalizationTotal:s.normTotal,layer:this},o=R(i),l=F(o,g,w);return T(e,this,l).then(e=>k(this,e,t,x,n,u,c))}}):this._histogramForField(e)}async classBreaks(e){const t=!1!==e.analyzeData,r=this._hasLocalSource||e.features||e.useFeaturesInView||e.valueExpression||e.filter;if(t&&r)return this._classBreaksFromMemory(e);return(t?this._classBreaksFromGenRend(e):this._classBreaksFromInterpolation(e)).catch(()=>(s(e.signal),this._classBreaksFromMemory(e)))}async queryFeatureCount(e){if(this._hasLocalSource)throw new i(`${this.adapterName}:not-supported`,"Layer does not support count query");const t=this.layer,r=t.createQuery();return r.where=f(r.where,e.whereClause),$(r,e.filter),t.queryFeatureCount(r,{signal:e.signal})}async generateRenderer(e,t){const r=this.layer;if(this._hasLocalSource||r.version<10.1)throw new i(`${this.adapterName}:not-supported`,"Layer does not support generateRenderer operation (requires ArcGIS Server version 10.1+)");const s=r.createQuery();return e.where=f(e.where,s.where),c(r.parsedUrl?.path??"",{source:r.dynamicDataSource??void 0,gdbVersion:r.gdbVersion??void 0},e,{signal:t})}async predominantCategories(e){if(!this._hasLocalSource&&!this.supportsSQLExpression)throw new i(`${this.adapterName}:not-supported`,"Layer does not support advanced SQL expressions and standardized queries");const{fields:t,view:r,signal:s,filter:a}=e,o=d(t),n=y(t),l=r&&this._hasLocalSource?await this._uvFromMemory({valueExpression:o,view:r,signal:s,filter:a}):await this._uvFromServiceQuery({sqlExpression:n.expression,valueExpression:o,signal:s,filter:a});return A(l.uniqueValueInfos,t)}async getSampleFeatures(e,i){const{view:a,requiredFields:o,returnGeometry:n,filter:l,signal:u}=e,c=e.sampleSize;if(null==c||0===c)return[];const m=this.layer.createQuery(),h=1,p="json"===i;m.outSpatialReference=a?.spatialReference,m.returnGeometry=!!n,m.outFields=o,$(m,l);let d=[],y=!1;if(a)try{const s=await a.whenLayerView(this.layer);if(y=!D(this,o,s).length,y){if(c>=1&&!e.filter&&"getSampleFeatures"in s){await this._waitForLayerViewUpdate(s);const e=await s.getSampleFeatures({minFeatureCount:c,sampleSize:c});if(null!=e)return p?e:e.map(e=>t.fromJSON(e))}if(d=await this._fetchFeaturesFromMemory(s,m,u,i),d.length>=c&&c>0)return r(d,c,h)}}catch(f){s(u)}try{if(this._hasLocalSource)return y?d:p?await this._fetchFeaturesJSONFromService(m,u):await this._fetchFeaturesFromService(m,u);const t=await this.queryFeatureCount({view:a,filter:l,signal:u}),i=this.layer.capabilities.query.maxRecordCount;let s=-1===c?t:c;if(s=i&&s>i?i:s,t<=d.length||d.length>=i)return d;if(m.maxAllowableOffset=e.resolution||(a?a.extent.width/a.width/a.scale:H(this.layer.spatialReference))*X,t<=s)return p?await this._fetchFeaturesJSONFromService(m,u):await this._fetchFeaturesFromService(m,u);if(t<=K){const e=this.layer.createQuery();$(e,l);const t=await this.layer.queryObjectIds();return m.objectIds=r(t,s,h),p?await this._fetchFeaturesJSONFromService(m,u):await this._fetchFeaturesFromService(m,u)}return this.layer.capabilities?.query?.supportsPagination&&(m.num=Math.min(s,K)),p?await this._fetchFeaturesJSONFromService(m,u):await this._fetchFeaturesFromService(m,u)}catch(f){return s(u),d}}load(e){const t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.capabilities?.query?.supportsSqlExpression,this._hasLocalSource=!t.url&&!!t.source,this.hasQueryEngine=this._hasLocalSource,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=t.fullExtent,this.workerClient=g.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};function ee(e,t,r){const i=[],s=t.length;return t.forEach((t,a)=>{const[o,n]=t;let l=null;l=0!==a||r?a!==s-1||r?f(`${e} >= ${o}`,`${e} ${a===s-1?" <= ":" < "} ${n}`):`${e} >= ${o}`:`${e} < ${n}`,i.push("WHEN ("+l+") THEN "+(a+1))}),["CASE",i.join(" "),"ELSE 0","END"].join(" ")}e([a({readOnly:!0})],Y.prototype,"adapterName",void 0),e([a({constructOnly:!0})],Y.prototype,"layer",void 0),Y=e([o("esri.smartMapping.support.adapters.FeatureLayerAdapter")],Y);export{Y as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as
|
|
5
|
+
import{isSome as t}from"../../../../core/arrayUtils.js";import{throwIfAborted as e}from"../../../../core/promiseUtils.js";import{CodedValue as n}from"../../../../layers/support/CodedValue.js";import"../../../../core/has.js";import i from"../../../../layers/support/CodedValueDomain.js";import"../../../../layers/support/Domain.js";import"../../../../layers/support/InheritedDomain.js";import"../../../../layers/support/RangeDomain.js";import l from"../../../../layers/support/Field.js";import{isStringField as o,isTimeOnlyField as a}from"../../../../layers/support/fieldUtils.js";import r from"../../../../rest/support/StatisticDefinition.js";import{noDominantCategoryField as s}from"../../../statistics/support/predominanceUtils.js";import{getRangeExpr as u,getSQLFilterForNormalization as c,mergeWhereClauses as m}from"../../../statistics/support/utils.js";import{isIntegerField as f,isAnyDateField as p,getDateDiffSQL as d,castIntegerFieldToFloat as y}from"../../utils.js";import{isNullCountSupported as g,statisticTypes as x,getEqualIntervalBins as h,processNullValue as v}from"../../../../statistics/utils.js";const F=/_value$/i,w=Math.LOG10E,S={SECOND:1e3,MINUTE:6e4,HOUR:36e5},E=10;function T(t){return t.map(t=>t.toJSON())}function V(t,e){const n=[],i=t.layer,l="featureReduction"in i?i.featureReduction:null,o="binning"===l?.type,a=null!=l&&"fields"in l?l.fields?.map(t=>t.name?.toLowerCase()).filter(Boolean):[];if(!o||!e)return n;for(const r of e)a.includes(r.toLowerCase())||n.push(r);return n}function $(t,e,n){const i=[];if(e)for(const l of e){const e=t.getField(l);e&&n&&"availableFields"in n&&!n.availableFields?.includes(e.name)&&i.push(e.name)}return i}function z(t,e){const n=t&&t.features;if(0===n?.length)return{avg:null,count:0,max:null,median:null,min:null,nullcount:0,stddev:null,sum:null,variance:null};const i=n?.[0]?.attributes,l={};for(const o in i)l[o.replace(F,"").toLowerCase()]=i[o];return null!=l.totalcount&&l.totalcount>=l.count&&(l.nullcount=l.totalcount-l.count),delete l.totalcount,l.min===l.max&&null!=l.min&&null==l.stddev&&(l.stddev=l.variance=0),e&&(["min","max","avg","stddev","sum","variance"].forEach(t=>{null!=l[t]&&(l[t]=Math.ceil(l[t]))}),l.min===l.max&&null!=l.min&&(l.avg=l.min,l.stddev=l.variance=0)),l}function C(t){const e=[],n=t.classBreaks,i=n[0].minValue,l=n[n.length-1].maxValue;n.forEach(t=>{e.push([t.minValue,t.maxValue])});const o={field:t.field,normalizationType:t.normalizationType,normalizationField:t.normalizationField,normalizationTotal:t.normalizationTotal,layer:t.layer};return{min:i,max:l,intervals:e,sqlExpr:j(o),excludeZerosExpr:t.where,normTotal:t.normalizationTotal}}function j(t){const{field:e,normalizationType:n,normalizationField:i,normalizationTotal:l,layer:o}=t,a=f(o,e);let r=e;return"percent-of-total"===n?r=`((${a?y(e):e} / ${l}) * 100)`:"log"===n?r=`(log(${e}) * ${w})`:"field"===n?r=`(${a?y(e):e} / ${i})`:"natural-log"===n?r=`(log(${a?y(e):e}))`:"square-root"===n&&(r=`(power(${a?y(e):e}, 0.5))`),r}function q(t,e){let n;if(e=e.toLowerCase(),t)for(const i in t)if(i.toLowerCase()!==e){n=t[i];break}return n}function b(t,e){let n;if(e=e.toLowerCase(),t)for(const i in t)if(i.toLowerCase()===e){n=t[i];break}return n}function O(t,e,n,i,l){const o={},a="countOFExpr";t&&t.features&&t.features.forEach(t=>{const e=t.attributes,n=q(e,a),i=b(e,a);null!=n&&null!=i&&0!==n&&(o[n]=i)});const r=[];return h(e,n,i).forEach((t,e)=>{const n=(e+1).toString();r.push({minValue:t[0],maxValue:t[1],count:o.hasOwnProperty(n)?o[n]:0})}),{bins:r,minValue:e,maxValue:n,normalizationTotal:l}}async function L(t,n){const i=t&&t.features,{field:l,field2:o,field3:a,fieldDelimiter:r,layer:s,view:u,signal:c,labels:m}=n,f=`countOF${!(!l||!o)?"Expr":l||"Expr"}`,p={};let d=!1;for(const e of i){const t=e.attributes,n=b(t,f);let i=l?b(t,l):q(t,f),s=o?b(t,o):null,u=a?b(t,a):null;null===i&&0===n&&(d=!0),(null==i||"string"==typeof i&&""===i.trim())&&(i=null),o&&(null==s||"string"==typeof s&&""===s.trim())&&(s=null),a&&(null==u||"string"==typeof u&&""===u.trim())&&(u=null);let c=i;o&&(c=`${v(c)}${r}${v(s)}`,a&&(c=`${c}${r}${v(u)}`)),null==p[c]?p[c]={count:n,data:c}:p[c].count=p[c].count+n}if(l&&d){const t=l+" is NULL";try{const e=await s.queryFeatureCount({whereClause:t,view:u,signal:c});return p.null.count=p.null.count+e,R(p,m)}catch{return e(c),R(p,m)}}return R(p,m)}function R(t,e){if(e)for(const n in t)t[n].label=e[n];return{count:t}}async function D(t,e,l){const o=t?l.getField(t):null,a=o?l.getFieldDomain(o.name):null;if(a)return a;const{uniqueValueInfos:r}=await l.uniqueValues({field:t,sqlWhere:e.sqlWhere,features:e.features,useFeaturesInView:e.useFeaturesInView,view:e.view,signal:e.signal}),s=r.map(t=>new n({code:t.value}));return new i({codedValues:s})}async function I(t,e){if(!t.returnAllCodedValues)return[];const{field:n,field2:i,field3:l}=t;if(n&&!i){const t=n?e.getField(n):null,i=t?e.getFieldDomain(t.name):null;return i?[i]:[]}const o=[];return n&&(o.push(D(n,t,e)),i&&(o.push(D(i,t,e)),l&&o.push(D(l,t,e)))),Promise.all(o)}function N(t,e){return d(t,new Date(0),e,"milliseconds").sqlExpression}function U(t,e){return`EXTRACT(${e} FROM ${t}) * ${S[e]}`}function M(t){if(!t)return null;return y(["HOUR","MINUTE","SECOND"].map(e=>`(${U(t,e)})`).join(" + "))}function Q(t){return{viewingMode:"2d"===t.type?"map":t.viewingMode,scale:t.scale,spatialReference:t.spatialReference?.toJSON()}}function B(t,e){const n=new Set(t.map(t=>t.value)),i=e.filter(t=>!n.has(t));for(const l of i)t.push({value:l,count:0});t.sort((t,n)=>e.indexOf(t.value)-e.indexOf(n.value));for(const l of t)l.value===s&&(l.value=null);return{predominantCategoryInfos:t}}function _(e){const n="featureReduction"in e?e.featureReduction:null;return((null!=n&&"fields"in n?n.fields:null)??[]).map(t=>{const n=P(t,e.fieldsIndex);return n?new l({type:n,name:t.name,alias:t.alias}):null}).filter(t)}function P(t,e){switch(t.statisticType){case"avg":case"avg_angle":return"double";case"count":return"integer";case"min":case"max":case"sum":return t.onStatisticField?e.get(t.onStatisticField)?.type??null:t.onStatisticExpression?"string"===t.onStatisticExpression.returnType?null:"double":null;case"mode":return t.onStatisticField?e.get(t.onStatisticField)?.type??null:t.onStatisticExpression?"string"===t.onStatisticExpression.returnType?"string":"double":null;default:return null}}function W(t,e){return p(e)?N(t,e?.name):a(e)?M(e?.name):null}function k(t,e,n){let i=null;for(const l of n){const n=l?t.getField(l):null,o=A(t,{...e,field:l,outStatisticTypes:{include:["min","max","sum","count"]}},n,!0,!0);i?i.outStatistics=i.outStatistics.concat(o.outStatistics):i=o}return i.where=t.createQuery()?.where,i}function A(t,e,n,i=!0,l=!1){const{field:a,normalizationType:s,normalizationField:f,normalizationTotal:p,minValue:d,maxValue:y,filter:h}=e,v=t.supportsSQLExpression?W(t,n)||e.sqlExpression:null,F=j({field:a,normalizationType:s,normalizationField:f,normalizationTotal:p,layer:t}),w=v||F,S=w?u(w,d,y):null,E=c({field:a,normalizationField:f,normalizationType:s}),T=m(e.sqlWhere,E),V=m(T,S),$=g({normalizationField:f,normalizationType:s,sqlExpression:v,supportsSQLExpression:t.supportsSQLExpression,minValue:d,maxValue:y}),z=o(t.getField(a??void 0)),{include:C,exclude:q}=e.outStatisticTypes||{},b=x.filter(t=>(!C||C.includes(t))&&(!q||!q.includes(t))&&("nullcount"===t?$:!z||"count"===t)&&("median"!==t||i)),O=t.createQuery();return O.where=m(O.where,V),O.sqlFormat=v?"standard":null,O.outStatistics=b.map(e=>{const n=new r;let i=null,o=null,s=`${e}_value${l?`_${a}`:""}`;if("variance"===e)i="var",o=w;else if("nullcount"===e){const e=t.objectIdField;i="count",o=e&&t.getField(e)?e:"1",s="totalcount_value"}else"median"===e?(i="percentile-continuous",o=w,n.statisticParameters={value:.5}):(i=e,o=w);return n.statisticType=i,n.onStatisticField=o,n.outStatisticFieldName=s,n}),H(O,h),O}function H(t,e){e&&(t.geometry=e.geometry,t.spatialRelationship=e.spatialRelationship)}function J(t,e){const{field:n,field2:i,field3:l,sqlExpression:o}=e,a=!(!n||!i),r=t.createQuery();return r.where=m(r.where,e.sqlWhere),r.sqlFormat=o?"standard":null,r.outStatistics=[Z(a?null:n,a?"1":o)].filter(Boolean),r.groupByFieldsForStatistics=[n||o,i,l].filter(Boolean),H(r,e.filter),r}function Z(t,e){const n="countOF"+(t||"Expr"),i=new r;return i.statisticType="count",i.onStatisticField=e?"1":t,i.outStatisticFieldName=n,i}function G(t,e,n,i=E,l,o,a){const{min:r,max:s,normTotal:u,excludeZerosExpr:c}=e,m=e.intervals||h(r,s,i),f=e.sqlExpr||n;return X(t,m,f,c,l,o,a).then(t=>({bins:t.map((t,e)=>({minValue:m[e][0],maxValue:m[e][1],count:"fulfilled"===t.status?t.value:0})),minValue:r,maxValue:s,normalizationTotal:u}))}function X(t,e,n,i,l,o,a){const r=[],s=e.length;for(let u=0;u<s;u++){const t=m(i,m(n+" >= "+e[u][0],null!==e[u][1]?n+(u===s-1?" <= ":" < ")+e[u][1]:""));r.push(t)}return Promise.allSettled(r.map(e=>t.queryFeatureCount({whereClause:e,view:l,filter:o,signal:a})))}export{E as defaultNumBins,T as ensureFeaturesJSON,C as generateBinParams,P as getAggregateFieldType,G as getBins,I as getDomainsForFields,_ as getFeatureReductionFields,j as getFieldExpr,O as getHistogramFromFeatureSet,$ as getMissingFields,V as getMissingFieldsForBinning,B as getPredominantCategoriesFromUVInfos,W as getSQLExpressionForDateOrTimeField,z as getSummaryStatisticsFromFeatureSet,A as getSummaryStatsQuery,k as getSummaryStatsQueryForFields,J as getUVQuery,L as getUniqueValuesFromFeatureSet,Q as getViewInfoParams,M as msForTimeOnlyFieldSQL,N as msSinceUnixEpochSQL,H as updateQueryWithFeatureFilter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{formatDate as t,convertDateFormatToIntlOptions as e,formatTimestamp as n,formatTimeOnly as o,formatDateOnly as r}from"../../intl/date.js";import{isDateField as i,isDateOnlyField as s,isTimestampOffsetField as a}from"../../layers/support/fieldUtils.js";import{getWellKnownBasemapId as l}from"../../support/basemapUtils.js";import{loadArcade as u}from"../../support/loadArcade.js";import{utc as
|
|
5
|
+
import{formatDate as t,convertDateFormatToIntlOptions as e,formatTimestamp as n,formatTimeOnly as o,formatDateOnly as r}from"../../intl/date.js";import{isDateField as i,isDateOnlyField as s,isTimestampOffsetField as a}from"../../layers/support/fieldUtils.js";import{getWellKnownBasemapId as l}from"../../support/basemapUtils.js";import{loadArcade as u}from"../../support/loadArcade.js";import{utc as d}from"../../time/constants.js";import{getTimeZoneFormattingOptions as m}from"../../time/timeZoneUtils.js";const f=",",c={light:["streets","gray","topo","terrain","oceans","osm","gray-vector","streets-vector","topo-vector","streets-relief-vector","streets-navigation-vector","topo-3d","navigation-3d","streets-3d","osm-3d","gray-3d"],dark:["satellite","hybrid","dark-gray","dark-gray-vector","streets-night-vector","navigation-dark-3d","streets-dark-3d","dark-gray-3d"]},p="percent-of-total",g="field",y={exclude:["median"]},h={years:365,months:30,days:1,hours:1/24,minutes:1/1440,seconds:1/86400,milliseconds:1/864e5},v=new Set(["integer","small-integer"]);let T=null;const Z=["date","date-only","timestamp-offset"];function $(t){return i(t)||s(t)||a(t)}async function U(t){const{field:e,field2:n,field3:o,normalizationField:r,valueExpression:i,fields:s}=t;let a=[];if(i){if(!T){const{arcadeUtils:t}=await u();T=t}a=T.extractFieldNames(i)}return e&&a.push(e),n&&a.push(n),o&&a.push(o),r&&a.push(r),s&&a.push(...s),a}function w(t){let e=t.normalizationType;return e||(t.normalizationField?e=g:null!=t.normalizationTotal&&(e=p)),e??void 0}function S(t){return String(t).padStart(2,"0")}function k(t,e,n){let o;if("date"===e||"number"===e){"number"===e&&(t=new Date(t));o=`TIMESTAMP'${n?t.getFullYear():t.getUTCFullYear()}-${S((n?t.getMonth():t.getUTCMonth())+1)}-${S(n?t.getDate():t.getUTCDate())} ${S(n?t.getHours():t.getUTCHours())}:${S(n?t.getMinutes():t.getUTCMinutes())}:${S(n?t.getSeconds():t.getUTCSeconds())}'`}else o=t;return o}function C(t,e,n,o){const{hasQueryEngine:r}=t,i=`(${k(n,D(t,n),r)} - ${k(e,D(t,e),r)})`;let s=h[o],a="/";s<1&&(s=1/s,a="*");return{sqlExpression:1===s?i:`(${i} ${a} ${s})`,sqlWhere:null}}function D(t,e){if(e instanceof Date)return"date";if("number"==typeof e)return"number";if("string"==typeof e){const n=t.getField(e);if("<now>"===e.toLowerCase())return;if(i(n))return"field"}}function F(t,e=c){for(const n in e)if(e[n].includes(t))return n}function b(t,e,n=!0){let o=null;return t&&("string"==typeof t?e.includes(t)&&(o=t):o=l(t)),n?o||"gray":o}function j(t,e){const n=e&&t.getField(e);return!!n&&v.has(n.type)}function M(t){return`cast(${t} as float)`}function N(i,s){const{format:a,timeZoneOptions:l,fieldType:u}=s??{};let f,c;if(l&&({timeZone:f,timeZoneName:c}=m(l.layerTimeZone,l.datesInUnknownTimezone,l.viewTimeZone,e(a||"short-date-short-time"),u)),"string"==typeof i&&isNaN(Date.parse("time-only"===u?`1970-01-01T${i}Z`:i)))return i;switch(u){case"date-only":{const n=e(a||"short-date");return"string"==typeof i?r(i,{...n}):t(i,{...n,timeZone:d})}case"time-only":{const n=e(a||"short-time");return"string"==typeof i?o(i,n):t(i,{...n,timeZone:d})}case"timestamp-offset":{if(!f&&"string"==typeof i&&new Date(i).toISOString()!==i)return i;const o=a||l?e(a||"short-date-short-time"):void 0,r=o?{...o,timeZone:f,timeZoneName:c}:void 0;return"string"==typeof i?n(i,r):t(i,r)}default:{const n=a||l?e(a||"short-date-short-time"):void 0;return t("string"==typeof i?new Date(i):i,n?{...n,timeZone:f,timeZoneName:c}:void 0)}}}export{M as castIntegerFieldToFloat,Z as dateTypes,c as defaultBasemapGroups,y as defaultStatisticTypes,f as fieldDelimiter,N as formatAnyDate,F as getBasemapGroup,b as getBasemapId,C as getDateDiffSQL,D as getDateType,U as getFieldsList,w as getNormalizationType,$ as isAnyDateField,j as isIntegerField,h as unitValueInDays};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{verticalLengthUnitFromSpatialReference as
|
|
5
|
+
import{memoize as e}from"../core/memoize.js";import{verticalLengthUnitFromSpatialReference as n,convertUnit as t}from"../core/unitUtils.js";import{getMetersPerUnit as o}from"../symbols/support/unitConversionUtils.js";function r(e){return e?z:U}function u(e,n){return n?.mode?n.mode:r(e).mode}function i(e,n){return null!=n?n:r(e)}function s(e,n){return u(null==e||(e.hasZ??!1),n)}function l(e,n){return i(null==e||(e.hasZ??!1),n)}function a(e){const n=m(e);return s(e.geometry,n)}function f(e){const n=m(e),t=s(e.geometry,n),o=null!=n&&"on-the-ground"!==t?j(n):0,r=n?.featureExpressionInfo;return{mode:t,offset:o,featureExpressionInfo:r}}function c(e){return g(f(e))}function d(e){return g(e)||v(e)}function v(e){return"0"===e?.featureExpressionInfo?.expression}function g(e){if(!e)return!1;if("on-the-ground"===e.mode)return!1;const n=e?.featureExpressionInfo?e.featureExpressionInfo.expression:null;return!(!n||"0"===n)}function m(e){return e.layer&&"elevationInfo"in e.layer?e.layer.elevationInfo:null}const p=e((e,o)=>{if(!e?.offset)return 0;const{offset:r,unit:u}=e;if("decimal-degrees"===u)return 0;const i="unknown"!==u&&u?u:"meters",s=n(o);return s?t(r,i,s):0});function h(e,n,t){if(!t?.mode)return;const o=e.hasZ?e.z:0,r=p(t,e.spatialReference);switch(t.mode){case"absolute-height":return o-r;case"on-the-ground":return 0;case"relative-to-ground":return o-((n.elevationProvider.getElevation(e.x,e.y,o,e.spatialReference,"ground")??0)+r);case"relative-to-scene":return o-((n.elevationProvider.getElevation(e.x,e.y,o,e.spatialReference,"scene")??0)+r)}}function x(e,n,t,o=null){return b(e,n.x,n.y,n.hasZ?n.z:0,n.spatialReference,t,o)}function E(e,n,t,o,r=null){return b(e,n[0],n[1],n.length>2?n[2]:0,t,o,r)}function b(e,n,t,o,r,u,i=null){if(null==u)return;const s=null!=i?i.mode:"absolute-height";if("on-the-ground"===s)return 0;const{absoluteZ:l}=I(n,t,o,r,e,u);return y(l,n,t,o,r,e,i,s)}function I(e,n,t,o,r,u){const i=p(u,o);switch(u.mode){case"absolute-height":return{absoluteZ:t+i,elevation:0};case"on-the-ground":{const t=r.elevationProvider.getElevation(e,n,0,o,"ground")??0;return{absoluteZ:t,elevation:t}}case"relative-to-ground":{const u=r.elevationProvider.getElevation(e,n,t,o,"ground")??0;return{absoluteZ:t+u+i,elevation:u}}case"relative-to-scene":{const u=r.elevationProvider.getElevation(e,n,t,o,"scene")??0;return{absoluteZ:t+u+i,elevation:u}}}}function y(e,n,t,o,r,u,i,s){const l=p(i,r);switch(s){case"absolute-height":return e-l;case"relative-to-ground":return e-((u.elevationProvider.getElevation(n,t,o,r,"ground")??0)+l);case"relative-to-scene":return e-((u.elevationProvider.getElevation(n,t,o,r,"scene")??0)+l)}}function Z(e,n){if(null==n)return!1;const{mode:t}=n;return null!=t&&("scene"===e&&"relative-to-scene"===t||"ground"===e&&"absolute-height"!==t)}function P(e,n,t){return t&&t.mode!==n?`${e} only support ${n} elevation mode`:null}function w(e,n,t){return t?.mode===n?`${e} do not support ${n} elevation mode`:null}function $(e,n){return null!=n?.featureExpressionInfo&&"0"!==n.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function R(e,n){n&&e.warn(".elevationInfo=",n)}function j(e){return(e?.offset??0)*o(e?.unit)}const z={mode:"absolute-height",offset:0},U={mode:"on-the-ground",offset:null};export{z as absoluteHeightElevationInfo,Z as elevationContextAffectsAlignment,P as elevationModeRequiredMessage,w as elevationModeUnsupportedMessage,v as featureExpressionInfoIsZero,$ as featureExpressionUnsupportedMessage,x as getConvertedElevation,E as getConvertedElevationFromVector,b as getConvertedElevationFromXYZ,i as getEffectiveElevationInfo,u as getEffectiveElevationMode,p as getElevationOffset,j as getElevationOffsetInMeters,l as getGeometryEffectiveElevationInfo,s as getGeometryEffectiveElevationMode,f as getGraphicEffectiveElevationInfo,a as getGraphicEffectiveElevationMode,h as getZForElevationMode,d as hasFeatureExpressionInfo,c as hasGraphicFeatureExpressionInfo,R as logInvalidElevationInfoWarning,U as onTheGroundElevationInfo,I as zValueInAbsoluteHeightMode};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const c="20250914",d="2a6d110cd31c12b4d41a5960cb61cef7d46af893";export{c as buildDate,d as commitHash};
|
package/tables/elements.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
export{default as AttributeTableAttachmentElement}from"./elements/AttributeTableAttachmentElement.js";export{default as AttributeTableFieldElement}from"./elements/AttributeTableFieldElement.js";export{default as AttributeTableGroupElement}from"./elements/AttributeTableGroupElement.js";export{default as AttributeTableRelationshipElement}from"./elements/AttributeTableRelationshipElement.js";
|
|
5
|
+
import{deprecatedModule as e}from"../core/deprecate.js";import t from"../core/Logger.js";export{default as AttributeTableAttachmentElement}from"./elements/AttributeTableAttachmentElement.js";export{default as AttributeTableFieldElement}from"./elements/AttributeTableFieldElement.js";export{default as AttributeTableGroupElement}from"./elements/AttributeTableGroupElement.js";export{default as AttributeTableRelationshipElement}from"./elements/AttributeTableRelationshipElement.js";e(t.getLogger("esri.tables.elements"),"esri.tables.elements",{replacement:"Individual element module imports",version:"4.34",warnOnce:!0});
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../Color.js";import i from"../../../../core/Accessor.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as s}from"../../../../core/reactiveUtils.js";import{property as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../Color.js";import i from"../../../../core/Accessor.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as s,initial as r}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as a}from"../../../../chunks/earcut.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as c}from"../../../../chunks/vec32.js";import{create as p,fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as h}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as d}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as y}from"../../../../geometry/support/Indices.js";import{t as g}from"../../../../chunks/vec3.js";import f from"../../../../symbols/support/ElevationInfo.js";import{cutFillConfiguration as v}from"./VolumeMeasurementConfiguration.js";import{LineVisualElement as j}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as _}from"../../interactive/visualElements/OutlineVisualElement.js";import{GeodesicSegment as G}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as w}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as b}from"../../layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{geometryToRenderInfo as C}from"../../support/renderInfoUtils/polygon.js";import{CutFillColor as V,VolumeGeometry as L}from"../../webgl-engine/lib/CutFillColor.js";import{createStipplePatternSimple as R}from"../../webgl-engine/materials/lineStippleUtils.js";let A=class extends i{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}constructor(e){super(e),this._elevationContext=w.fromElevationInfo(new f({mode:"absolute-height"})),this._extrusionHeight=1e4}initialize(){const{view:e}=this,{accentColor:i}=e.effectiveTheme,o={view:e,isDecoration:!0},n=v,l={...o,width:n.geometryOutlineWidth},a=t.toUnitRGBA(i),m=t.toUnitRGBA(n.targetGeometryOutlineColor);this._elevationAlignedGeometry=new _({...l,isDraped:!0,color:a}),this._targetGeometry=new _({...l,color:m});const c={...o,attached:!0,width:n.projectionLineWidth,stipplePattern:R(n.projectionLineStippleSize),renderOccluded:4},p=t.toUnitRGBA(n.cutProjectionLineColor),u=t.toUnitRGBA(n.fillProjectionLineColor);this._cutProjectionLines=new j({...c,color:p}),this._fillProjectionLines=new j({...c,color:u}),this._cutFillRenderNode=new V({view:e,cutColor:n.cutColor,fillColor:n.fillColor}),this.addHandles([s(()=>[this.analysisViewData.elevationAlignedGeometry,this.analysisViewData.targetGeometry,this.visible],()=>this._updateVisualElements()),s(()=>this.view.effectiveTheme.accentColor,e=>{this._elevationAlignedGeometry.color=t.toUnitRGBA(e)}),s(()=>this.analysisViewData.targetGeometry,()=>this._updateCutFillGeometry(),r),s(()=>this.visible,()=>this._updateCutFillVisibility())])}destroy(){this._elevationAlignedGeometry=o(this._elevationAlignedGeometry),this._targetGeometry=o(this._targetGeometry),this._cutProjectionLines=o(this._cutProjectionLines),this._fillProjectionLines=o(this._fillProjectionLines),this._cutFillRenderNode.destroy()}_updateVisualElements(){this._updateGeometries(),this._updateProjectionLines()}_updateGeometries(){const e=this.visible,{elevationAlignedGeometry:t,targetGeometry:i}=this.analysisViewData;this._elevationAlignedGeometry.geometry=t,this._elevationAlignedGeometry.visible=e,this._targetGeometry.geometry=i,this._targetGeometry.visible=e}_updateProjectionLines(){const e=this.visible,{elevationAlignedGeometry:t,targetGeometry:i}=this.analysisViewData;if(this._cutProjectionLines.visible=e,this._fillProjectionLines.visible=e,!t||!i)return;const{renderCoordsHelper:o}=this.view,s=o.spatialReference,r=[],n=[],l=t.spatialReference;for(let a=0;a<t.rings[0].length;++a){const e=t.rings[0][a],m=c(P,e[0],e[1],e[2]);o.toRenderCoords(m,l,m);const p=i.rings[0][a],u=c(x,p[0],p[1],p[2]);o.toRenderCoords(u,l,u);const h=new G(m,u,s);m[2]>u[2]?r.push(h):n.push(h)}this._cutProjectionLines.setGeometryFromSegments(r),this._fillProjectionLines.setGeometryFromSegments(n)}_updateCutFillVisibility(){this.visible?this._cutFillRenderNode.enable():this._cutFillRenderNode.disable()}_updateCutFillGeometry(){const{renderCoordsHelper:e}=this.view,{targetGeometry:t}=this.analysisViewData;if(!t?.extent)return;const{center:i}=t.extent,o=u(i.x,i.y,0),s=p();e.toRenderCoords(o,t.spatialReference,s);const r=this._getExtrudedVolumes(t,this._extrusionHeight,o),n=this._getExtrudedVolumes(t,-this._extrusionHeight,o);this._cutFillRenderNode.updateGeometries(r,n,s)}_getExtrudedVolumes(e,t,i){const{renderCoordsHelper:o,spatialReference:s,elevationProvider:r}=this.view,n=p(),l=1===o.viewingMode;l||o.worldUpAtPosition([0,0,0],n);const c=C(e,r,o,this._elevationContext),{polygons:u,mapPositions:f,position:v}=c,j=u[0],_=j.count,G=a(j.mapPositions,j.holeIndices,3),w=G.length,V=6*_,R=y(V+w),A=y(w),P=d(3*V),x=d(3*V);b(v,f,G,j,P,null,x,null,R,A,t,n,l);const D=m(),E=m();return h(s,i,D,o.spatialReference),E[12]=-D[12],E[13]=-D[13],E[14]=-D[14],g(P,P,E),new L(P,A,R,x)}};e([n({constructOnly:!0})],A.prototype,"view",void 0),e([n({constructOnly:!0})],A.prototype,"analysisViewData",void 0),e([n({readOnly:!0})],A.prototype,"visible",null),A=e([l("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],A);const P=p(),x=p();export{A as VolumeMeasurementCutFillVisualization};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as i,abortMaybe as r}from"../../../core/maybe.js";import{debounce as s,ignoreAbortErrors as o,throwIfAborted as l}from"../../../core/promiseUtils.js";import{watch as a,when as n,sync as u,whenOnce as d}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{Seconds as h,secondsFromMilliseconds as c}from"../../../core/time.js";import{getMetersPerVerticalUnitForSR as m}from"../../../core/unitUtils.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{projectOrLoad as y}from"../../../geometry/projectionUtils.js";import{fromExtent as v,intersection as w,toExtent as T,intersects as b}from"../../../geometry/support/aaBoundingRect.js";import R from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as S,getPositions as j,getFlowSimulationSettings as L}from"../../2d/engine/flow/utils.js";import A from"./SubView3D.js";import{makeScheduleFunction as U}from"./support/makeScheduleFunction.js";import{thresholdForLoadingAllTiles as P,fadeOutTime as E,fadeInTime as x,defaultTransitionDuration as I,transitionDurationFactor as k,averageLoadingTimeSmoothingFactor as V}from"../support/flow/constants.js";import{FlowWorkerHandle as C}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as q,createStreamlineGeometry as z}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as M}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as D}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as F}from"../support/flow/StreamlineResources3DShape.js";import B from"../support/flow/VisualQuery3D.js";import{tilesAreRelated as W}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as G}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as H}from"../webgl-engine/materials/RibbonLineMaterial.js";import{isInEffectiveScaleRange as O,hasLayerBasedScaleVisibility as N}from"../../support/layerViewUtils.js";import{TaskPriority as Q}from"../../support/Scheduler.js";let J=class extends A{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this.requireLoad=!1,this.workerHandle=null,this._averageLoadingTime=h(0),this._abortController=null,this._frameTask=null,this._tilesUpdateIsWaiting=!1,this._transitionEnabled=!0,this._debugAllowAutoLoading=!0,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._updateTask=null,this._debouncedTileUpdate=s(async()=>{const{allTiles:e}=this.surface,t=this._getTileFilterFunction(),i=new Set;function*r(r){for(let s=0;s<e.length;++s){const o=e.at(s);t(o)&&i.add(o),r.madeProgress(),r.done&&(r=yield)}}await this._frameTask.scheduleGenerator(r),this.renderedTiles=i}),this._transitionEnabled=!0}initialize(){const{surface:e,view:t}=this,{resourceController:i}=t;this.workerHandle=new C(U(i)),this._frameTask=i.scheduler.registerTask(Q.FLOW_GENERATOR),this._updateTask=p({update:this._update.bind(this)}),this.addHandles([a(()=>this.simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&S(e,t)}),a(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this._visible,this._draped,this.view.state.contentPixelRatio,e?.mode,e?.offset,e?.unit]},()=>this.triggerLoad(),u),a(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),e.on("tiles-changed",()=>this._triggerTilesUpdate()),t.enableFeatureTiles(),a(()=>[this._dataBounds,this._featureTilesBounds,this._loadAllTiles],()=>this._triggerTilesUpdate()),a(()=>this._flowRenderer,(e,t)=>{const i=t?.visualVariables??[],r=e?.visualVariables??[];r.length===i.length&&r.every((e,t)=>e.type===i[t].type)||this.clear()}),n(()=>!t.featureTiles?.updating,()=>this._triggerTilesUpdate())]),this._triggerTilesUpdate()}destroy(){this._updateTask=i(this._updateTask),this.abort(),this.clear()}abort(){this._abortController=r(this._abortController),this.requireLoad=!1}get _clippingArea(){const e=y(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:v(e)}get _dataBounds(){const e=y(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:v(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _ellipsoidRadius(){return g(this.view.spatialReference).radius}get _loadAllTiles(){const{position:e}=this.view.camera,t=e.z;if(null==t)return!1;return t*m(e.spatialReference)/this._ellipsoidRadius>=P}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=y(e,this.surface.spatialReference).geometry;return null==t?null:v(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...q(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),fadeInTime:x,fadeOutTime:E,...this._overrideMaterialParameters,screenSizePerspective:!this._draped&&G(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _transitionDuration(){const{_averageLoadingTime:e}=this;return h(0===e?I:this._averageLoadingTime*k)}get _visible(){const e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get elevationInfo(){return this.layer.elevationInfo??K}startPositions(e){if(!this._transitionEnabled)return[];const{_flowRenderer:t,_resources:i}=this;return null==t||null==i?[]:j(i.streamlines,i.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get layer(){return this.layerView.layer}get updating(){return this.updatingHandles.updating||this.requireLoad}get visibleAtCurrentScale(){return!N()||O(this.layer.effectiveScaleRange,this.view.scale)}get simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let i=L(e);return i.segmentLength=i.lineCollisionWidth/2,i.onlyForwardTracing=!1,null!=t&&(i={...i,...t}),i}get surface(){return this.view.basemapTerrain}doRefresh(){this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null}_update(e){if(!this.requireLoad||this.updatingHandles.updating)return;const t=c(e.time);if(this._transitionEnabled&&!this._lastResourceIsTransitioned(t))return;const{renderedTiles:i}=this;if(null==i||0===i.size)return;const r=async()=>{const e=performance.now();await this._load(i,t,this._transitionDuration);const r=h((performance.now()-e)/1e3);this._updateAverageLoadingTime(r)};this.updatingHandles.addPromise(o(r())),this.requireLoad=!1}_updateAverageLoadingTime(e){const t=V;this._averageLoadingTime=h(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){this._debugAllowAutoLoading&&(this.requireLoad=!0)}async _load(e,t,i){const{view:r}=this;if(!this._visible)return void this.clear();if(0===e.size)return;const s=this._computeExtent(e);if(null==s)return;const o=this._transitionEnabled&&null!=this._resources?h(t+i):t,a=new B(s,this.layerView.timeExtent,this._viewSizeWithEqualRatio(s),r.state.contentPixelRatio,o);null==this._abortController&&(this._abortController=new AbortController);const n=this._abortController,u=await this._loadStreamlines(a,n.signal);if(l(n.signal),this._visible&&null!=u){u.attach(),this._lastResources?.detach(),this._transitionEnabled?this._lastResources=this._resources:this._resources?.detach(),this._resources=u;const e=performance.now()/1e3,t=this._transitionEnabled&&e>o?e:o;null!=this._lastResources&&(this._lastResources.endTime=t),this._resources.startTime=t}}async _loadStreamlines(e,t){const i=await this.fetchDataAndGenerateStreamlines(e,t);if(null==i||0===i.length)return null;const r=await this._createGeometry(e,i);return this._draped?new D(e,i,r,this.surface.overlayManager):new F(e,i,r,this.view.stage)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const i=new H(this._materialParameters,this.view.state.isGlobal),r=new Array,{elevationInfo:s,_draped:o,view:l}=this;function*a(a){for(let n=0;n<t.length;++n)r.push(z(l,e,t[n],s,i,o)),a.madeProgress(),a.done&&(a=yield)}return await this._frameTask.scheduleGenerator(a),r}_computeExtent(e){const{spatialReference:t}=this.surface;if(null==t)return null;const i=M(e);return null==i?null:(w(i,this._clippingArea,i),T(i,t))}_triggerTilesUpdate(){if(this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;const e=async()=>{await d(()=>this.view.stationary),this._tilesUpdateIsWaiting=!1,await this._debouncedTileUpdate()};this.updatingHandles.addPromise(o(e()))}_getTileFilterFunction(){const{_dataBounds:e,view:i,_featureTilesBounds:r}=this;if(this._loadAllTiles)return t=>t.leaf&&X(e,t.extent);const s=t=>t.rendered&&t.visible&&X(e,t.extent),{featureTiles:o}=i;if(!o)return s;const l=o.tiles.filter(e=>e.measures.visible);return e=>s(e)&&X(r,e.extent)&&l.some(({lij:i})=>t(i,e.lij)||W(i,e.lij))}_viewSizeWithEqualRatio(e){const t=(e.xmax-e.xmin)/(e.ymax-e.ymin),[i,r]=this.view.size;return i<r?[i,Math.floor(i/t)]:[Math.floor(r*t),r]}_lastResourceIsTransitioned(e){const{_lastResources:t,_resources:i,_flowRenderer:r}=this;if(null==t||null==i||null==r)return!0;return i.startTime+E<e}get test(){}};e([_()],J.prototype,"type",void 0),e([_()],J.prototype,"renderedTiles",void 0),e([_()],J.prototype,"_resources",void 0),e([_()],J.prototype,"_lastResources",void 0),e([_()],J.prototype,"requireLoad",void 0),e([_()],J.prototype,"_averageLoadingTime",void 0),e([_()],J.prototype,"emissiveStrength",void 0),e([_()],J.prototype,"_clippingArea",null),e([_()],J.prototype,"_dataBounds",null),e([_()],J.prototype,"_draped",null),e([_()],J.prototype,"_ellipsoidRadius",null),e([_()],J.prototype,"_loadAllTiles",null),e([_()],J.prototype,"_featureTilesBounds",null),e([_()],J.prototype,"_flowRenderer",null),e([_()],J.prototype,"_materialParameters",null),e([_()],J.prototype,"_opacity",null),e([_()],J.prototype,"_transitionDuration",null),e([_()],J.prototype,"_visible",null),e([_()],J.prototype,"elevationInfo",null),e([_()],J.prototype,"needsMagnitude",null),e([_()],J.prototype,"layer",null),e([_()],J.prototype,"updating",null),e([_()],J.prototype,"visibleAtCurrentScale",null),e([_()],J.prototype,"_overrideMaterialParameters",void 0),e([_()],J.prototype,"_overrideSimulationSettings",void 0),e([_()],J.prototype,"simulationSettings",null),e([_()],J.prototype,"surface",null),J=e([f("esri.views.3d.layers.FlowSubView3D")],J);const K=new R({mode:"on-the-ground"});function X(e,t){return null==e||null==t||b(e,t)}export{J as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as i,abortMaybe as r}from"../../../core/maybe.js";import{debounce as s,ignoreAbortErrors as o,throwIfAborted as l}from"../../../core/promiseUtils.js";import{watch as a,when as n,sync as u,whenOnce as d}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{Seconds as h,secondsFromMilliseconds as c}from"../../../core/time.js";import{getMetersPerVerticalUnitForSR as m}from"../../../core/unitUtils.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{projectOrLoad as y}from"../../../geometry/projectionUtils.js";import{fromExtent as w,intersection as v,toExtent as T,intersects as b}from"../../../geometry/support/aaBoundingRect.js";import R from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as S,getPositions as j,getFlowSimulationSettings as L}from"../../2d/engine/flow/utils.js";import A from"./SubView3D.js";import{makeScheduleFunction as P}from"./support/makeScheduleFunction.js";import{thresholdForLoadingAllTiles as U,fadeOutTime as E,fadeInTime as x,defaultTransitionDuration as I,transitionDurationFactor as V,averageLoadingTimeSmoothingFactor as k}from"../support/flow/constants.js";import{FlowWorkerHandle as C}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as q,createStreamlineGeometry as z}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as M}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as D}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as F}from"../support/flow/StreamlineResources3DShape.js";import B from"../support/flow/VisualQuery3D.js";import{tilesAreRelated as W}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as G}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as H}from"../webgl-engine/materials/RibbonLineMaterial.js";import{isInEffectiveScaleRange as O,hasLayerBasedScaleVisibility as N}from"../../support/layerViewUtils.js";import{TaskPriority as Q}from"../../support/Scheduler.js";let J=class extends A{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this.requireLoad=!1,this.workerHandle=null,this._averageLoadingTime=h(0),this._abortController=null,this._frameTask=null,this._tilesUpdateIsWaiting=!1,this._transitionEnabled=!0,this._debugAllowAutoLoading=!0,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._updateTask=null,this._debouncedTileUpdate=s(async()=>{const{allTiles:e}=this.surface,t=this._getTileFilterFunction(),i=new Set;function*r(r){for(let s=0;s<e.length;++s){const o=e.at(s);t(o)&&i.add(o),r.madeProgress(),r.done&&(r=yield)}}await this._frameTask.scheduleGenerator(r),this.renderedTiles=i}),this._transitionEnabled=!0}initialize(){const{surface:e,view:t}=this,{resourceController:i}=t;this.workerHandle=new C(P(i)),this._frameTask=i.scheduler.registerTask(Q.FLOW_GENERATOR),this._updateTask=p({update:this._update.bind(this)}),this.addHandles([a(()=>this.simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&S(e,t)}),a(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this._visible,this._draped,this.view.state.contentPixelRatio,e?.mode,e?.offset,e?.unit]},()=>this.triggerLoad(),u),a(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),e.on("tiles-changed",()=>this._triggerTilesUpdate()),t.enableFeatureTiles(),a(()=>[this._dataBounds,this._featureTilesBounds,this._loadAllTiles],()=>this._triggerTilesUpdate()),a(()=>this._flowRenderer,(e,t)=>{const i=t?.visualVariables??[],r=e?.visualVariables??[];r.length===i.length&&r.every((e,t)=>e.type===i[t].type)||this.clear()}),n(()=>!t.featureTiles?.updating,()=>this._triggerTilesUpdate())]),this._triggerTilesUpdate()}destroy(){this._updateTask=i(this._updateTask),this.abort(),this.clear()}abort(){this._abortController=r(this._abortController),this.requireLoad=!1}get _clippingArea(){const e=y(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:w(e)}get _dataBounds(){const e=y(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:w(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _ellipsoidRadius(){return g(this.view.spatialReference).radius}get _loadAllTiles(){const{position:e}=this.view.camera,t=e.z;if(null==t)return!1;return t*m(e.spatialReference)/this._ellipsoidRadius>=U}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=y(e,this.surface.spatialReference).geometry;return null==t?null:w(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...q(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),fadeInTime:x,fadeOutTime:E,...this._overrideMaterialParameters,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&G(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _transitionDuration(){const{_averageLoadingTime:e}=this;return h(0===e?I:this._averageLoadingTime*V)}get _visible(){const e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get elevationInfo(){return this.layer.elevationInfo??K}startPositions(e){if(!this._transitionEnabled)return[];const{_flowRenderer:t,_resources:i}=this;return null==t||null==i?[]:j(i.streamlines,i.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get layer(){return this.layerView.layer}get updating(){return this.updatingHandles.updating||this.requireLoad}get visibleAtCurrentScale(){return!N()||O(this.layer.effectiveScaleRange,this.view.scale)}get simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let i=L(e);return i.segmentLength=i.lineCollisionWidth/2,i.onlyForwardTracing=!1,null!=t&&(i={...i,...t}),i}get surface(){return this.view.basemapTerrain}doRefresh(){this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null}_update(e){if(!this.requireLoad||this.updatingHandles.updating)return;const t=c(e.time);if(this._transitionEnabled&&!this._lastResourceIsTransitioned(t))return;const{renderedTiles:i}=this;if(null==i||0===i.size)return;const r=async()=>{const e=performance.now();await this._load(i,t,this._transitionDuration);const r=h((performance.now()-e)/1e3);this._updateAverageLoadingTime(r)};this.updatingHandles.addPromise(o(r())),this.requireLoad=!1}_updateAverageLoadingTime(e){const t=k;this._averageLoadingTime=h(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){this._debugAllowAutoLoading&&(this.requireLoad=!0)}async _load(e,t,i){const{view:r}=this;if(!this._visible)return void this.clear();if(0===e.size)return;const s=this._computeExtent(e);if(null==s)return;const o=this._transitionEnabled&&null!=this._resources?h(t+i):t,a=new B(s,this.layerView.timeExtent,this._viewSizeWithEqualRatio(s),r.state.contentPixelRatio,o);null==this._abortController&&(this._abortController=new AbortController);const n=this._abortController,u=await this._loadStreamlines(a,n.signal);if(l(n.signal),this._visible&&null!=u){u.attach(),this._lastResources?.detach(),this._transitionEnabled?this._lastResources=this._resources:this._resources?.detach(),this._resources=u;const e=performance.now()/1e3,t=this._transitionEnabled&&e>o?e:o;null!=this._lastResources&&(this._lastResources.endTime=t),this._resources.startTime=t}}async _loadStreamlines(e,t){const i=await this.fetchDataAndGenerateStreamlines(e,t);if(null==i||0===i.length)return null;const{geometries:r,material:s}=await this._createGeometry(e,i);return this._draped?new D(e,i,s,r,this.surface.overlayManager):new F(e,i,s,r,this.view.stage)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const i=new H(this._materialParameters,this.view.state.isGlobal),r=new Array,{elevationInfo:s,_draped:o,view:l}=this;function*a(a){for(let n=0;n<t.length;++n)r.push(z(l,e,t[n],s,i,o)),a.madeProgress(),a.done&&(a=yield)}return await this._frameTask.scheduleGenerator(a),{geometries:r,material:i}}_computeExtent(e){const{spatialReference:t}=this.surface;if(null==t)return null;const i=M(e);return null==i?null:(v(i,this._clippingArea,i),T(i,t))}_triggerTilesUpdate(){if(this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;const e=async()=>{await d(()=>this.view.stationary),this._tilesUpdateIsWaiting=!1,await this._debouncedTileUpdate()};this.updatingHandles.addPromise(o(e()))}_getTileFilterFunction(){const{_dataBounds:e,view:i,_featureTilesBounds:r}=this;if(this._loadAllTiles)return t=>t.leaf&&X(e,t.extent);const s=t=>t.rendered&&t.visible&&X(e,t.extent),{featureTiles:o}=i;if(!o)return s;const l=o.tiles.filter(e=>e.measures.visible);return e=>s(e)&&X(r,e.extent)&&l.some(({lij:i})=>t(i,e.lij)||W(i,e.lij))}_viewSizeWithEqualRatio(e){const t=(e.xmax-e.xmin)/(e.ymax-e.ymin),[i,r]=this.view.size;return i<r?[i,Math.floor(i/t)]:[Math.floor(r*t),r]}_lastResourceIsTransitioned(e){const{_lastResources:t,_resources:i,_flowRenderer:r}=this;if(null==t||null==i||null==r)return!0;return i.startTime+E<e}get test(){}};e([_()],J.prototype,"type",void 0),e([_()],J.prototype,"renderedTiles",void 0),e([_()],J.prototype,"_resources",void 0),e([_()],J.prototype,"_lastResources",void 0),e([_()],J.prototype,"requireLoad",void 0),e([_()],J.prototype,"_averageLoadingTime",void 0),e([_()],J.prototype,"emissiveStrength",void 0),e([_()],J.prototype,"_clippingArea",null),e([_()],J.prototype,"_dataBounds",null),e([_()],J.prototype,"_draped",null),e([_()],J.prototype,"_ellipsoidRadius",null),e([_()],J.prototype,"_loadAllTiles",null),e([_()],J.prototype,"_featureTilesBounds",null),e([_()],J.prototype,"_flowRenderer",null),e([_()],J.prototype,"_materialParameters",null),e([_()],J.prototype,"_opacity",null),e([_()],J.prototype,"_transitionDuration",null),e([_()],J.prototype,"_visible",null),e([_()],J.prototype,"elevationInfo",null),e([_()],J.prototype,"needsMagnitude",null),e([_()],J.prototype,"layer",null),e([_()],J.prototype,"updating",null),e([_()],J.prototype,"visibleAtCurrentScale",null),e([_()],J.prototype,"_overrideMaterialParameters",void 0),e([_()],J.prototype,"_overrideSimulationSettings",void 0),e([_()],J.prototype,"simulationSettings",null),e([_()],J.prototype,"surface",null),J=e([f("esri.views.3d.layers.FlowSubView3D")],J);const K=new R({mode:"on-the-ground"});function X(e,t){return null==e||null==t||b(e,t)}export{J as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Logger.js";import{removeMaybe as s}from"../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../core/reactiveUtils.js";import{convertUnit as a}from"../../../core/unitUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{isCompatible as h}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as u,isWebMercator as d,equals as c}from"../../../geometry/support/spatialReferenceUtils.js";import{getHeightModelInfoFromVCS as m}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as f}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as p}from"../../../symbols/support/unitConversionUtils.js";import{LayerView3D as _}from"./LayerView3D.js";import{addLayerViewToWasm as y,getLyr3DWasm as w,removeLayerViewFromWasm as g}from"./Lyr3DWasm.js";import{Obb as b}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as M,elementsPerSplatPage as v,packedGaussianSizeInU32 as C,splatPageSizeInU32WithoutHeader as S,gaussiansPerSplatPage as x,splatAtlasTextureWidth as U}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianTile as j}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as V}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import L from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as R}from"../../support/layerViewUtils.js";const A=()=>t.getLogger("esri.views.3d.layers.GaussianSPlatLayerView3D");let E=class extends(_(L)){constructor(e){super(e),this.type="gaussian-splat-3d",this._gaussianTileHandles=new Map,this._pageBuffer=new Uint32Array(M),this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer),this._memCache=e.view.resourceController.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._renderNode=new V(e)}initialize(){if(!this._canProjectWithoutEngine())throw R("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=y(this).then(e=>{this._wasmLayerId=e,this.addHandles([i(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=i(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r)});this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}get _wasm(){return w(this.view)}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const s=t.desc.prims[0],i=s.vertexCount,r=s.atrbs[0].view,a=s.atrbs[0].view.byteCount,n=s.atrbs[0].view.byteOffset;let o=null;if("U32"!==r.type)return A().warnOnce("unexpected meshData.data format"),{memUsageBytes:0};o=new Uint32Array(t.data.buffer,n,a/4);const h=this.extractHeader(o),u=Math.ceil(i/x),d=new Uint32Array(i),c=[];for(let l=0;l<u;l++){let e=this._data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this._data.textureAtlas.requestPage()),null===e)return A().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0};{c.push(e);const t=i-l*x,s=Math.min(t,x),r=l*x;for(let i=0;i<s;i++)d[i+r]=i+v*e;const a=l*S;this._pageBuffer.set(o.subarray(a,a+s*C)),this._pageBuffer.set(h.packedHeader,S);const n=e*v,u=n%U,m=Math.floor(n/U);this._data.textureAtlas.update(u,m,this._pageBuffer)}}const m=new Float64Array(3*i),f=new Float64Array(i),p=2.048,_=h.tileOrigin.x*p,y=h.tileOrigin.y*p,w=h.tileOrigin.z*p,g=h.invPosScale;let M=0,V=0;for(let l=0;l<i;l++){const e=l*C,{rawX:t,rawY:s,rawZ:i}=this._extractGaussianPosition(o,e),r=this._extractGaussianSphericalScale(o,e);m[M]=t*g+_,m[M+1]=s*g+y,m[M+2]=i*g+w,f[l]=r*r,V=Math.max(V,r),M+=3}let L=null;if(t.desc.obb){const e=t.desc.obb.quaternion;L=new b(t.desc.obb.center,t.desc.obb.halfSize,l(...e))}L||(A().warnOnce("encountered tile without a bounding box"),L=new b);const R=new j(e.handle,L,d,c,m,f,V);return this._memCache.put(`${R.handle}`,R),this._gaussianTileHandles.set(e.handle,R),this._cacheMemory+=R.usedMemory,{memUsageBytes:R.usedMemory}}_extractGaussianPosition(e,t){const s=e[t+1];return{rawX:16383&s,rawY:s>>>14&16383,rawZ:s>>>28&15|(1023&e[t+2])<<4}}_extractGaussianSphericalScale(e,t){const s=e[t+2],i=s>>>10&255,r=s>>>18&255,a=s>>>26&63|(3&e[t+3])<<6,n=Math.exp(i/16-10),o=Math.exp(r/16-10),l=Math.exp(a/16-10);return Math.max(n,o,l)}freeRenderable(e){const t=this._gaussianTileHandles.get(e);t&&(t.isVisible?this._usedMemory-=t.usedMemory:this._cacheMemory-=t.usedMemory,t.pageIds.forEach(e=>this._data.textureAtlas.freePage(e)),this.freeObject(t),this._gaussianTileHandles.delete(e)),this._updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}setRenderableVisibility(e,t,s){for(let i=0;i<s;i++){if(!t[i])continue;const s=e[i],r=this._gaussianTileHandles.get(s);if(r){if(r.isVisible)continue;r.isVisible=!0,this._usedMemory+=r.usedMemory,this._cacheMemory-=r.usedMemory,this._memCache.pop(`${s}`)}}for(let i=0;i<s;i++){if(t[i])continue;const s=e[i],r=this._gaussianTileHandles.get(s);if(r){if(!r.isVisible)continue;r.isVisible=!1,this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,this._memCache.put(`${s}`,r)}}this._updateGaussians()}destroy(){g(this),this._suspendedHandle&&(this._suspendedHandle=s(this._suspendedHandle)),this._renderNode.destroy(),this._memCache.destroy()}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(u(this.view.renderSpatialReference)||d(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&c(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){const e=m(this.layer.esriCrsSpatialReference),t=this.view.heightModelInfo;return this._useEsriCrs=0===h(e,t,!1),this._useEsriCrs&&e&&(this._metersPerVCSUnit=a(1,"meters",e.heightUnit),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=p(e?.unit)/this._metersPerVCSUnit,s=e?.offset??0;this._wasm?.setLayerOffset(this,s*t)}else this._wasm?.setLayerOffset(this,f(e));else this._wasm?.setLayerOffset(this,0)}_updateGaussians(){const e=new Array;for(const t of this._gaussianTileHandles.values())t.isVisible&&e.push(t);this._data.updateGaussianVisibility(e)}_freeInvisibleTiles(){for(const e of this._gaussianTileHandles.values())e.isVisible||this._deleteTile(e)}get _data(){return this._renderNode.data}extractHeader(e){const t=e.length-4,s=this.reinterpretU32AsFloat(e[t]),i=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:s,y:i,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}};e([n()],E.prototype,"layer",void 0),e([n()],E.prototype,"fullExtentInLocalViewSpatialReference",void 0),E=e([o("esri.views.3d.layers.GaussianSplatLayerView3D")],E);const H=E;export{H as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";class a{static isValidProfile(e){return e in
|
|
5
|
+
import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";class a{static isValidProfile(e){return e in l}static getDefaultProfile(){return has("esri-iPhone")?"low":"medium"}static apply(e,a){const i=l[e];a.graphics3D.maxTotalNumberOfFeatures=i.graphics3D.maxTotalNumberOfFeatures,a.graphics3D.maxNumberOfDrawCalls=i.graphics3D.maxNumberOfDrawCalls,a.graphics3D.maxTotalNumberOfVertices=i.graphics3D.maxTotalNumberOfVertices,a.graphics3D.polygonLodFactor=i.graphics3D.polygonLodFactor,a.graphics3D.polylineLodFactor=i.graphics3D.polylineLodFactor,a.graphics3D.snapshotAvailable=i.graphics3D.snapshotAvailable,a.graphics3D.skipHighSymbolLods=i.graphics3D.skipHighSymbolLods;const t=a.sceneService.object,o=i.sceneService.object;t.lodFactor=o.lodFactor,a.sceneService.point.lodFactor=i.sceneService.point.lodFactor,a.sceneService.integratedMesh.lodFactor=i.sceneService.integratedMesh.lodFactor,a.sceneService.pointCloud.lodFactor=i.sceneService.pointCloud.lodFactor,a.tiledSurface.lodBias=i.tiledSurface.lodBias,a.tiledSurface.angledSplitBias=i.tiledSurface.angledSplitBias,a.tiledSurface.vtlContentZoom=i.tiledSurface.vtlContentZoom,a.tiledSurface.elevationLevelDelta=i.tiledSurface.elevationLevelDelta,a.tiledSurface.reduceTileLevelDifferences=i.tiledSurface.reduceTileLevelDifferences,a.gaussianSplat.minimumSplatPixelRadius=i.gaussianSplat.minimumSplatPixelRadius,a.gaussianSplat.minimumOpacity=i.gaussianSplat.minimumOpacity,a.gaussianSplat.maxAllowedVisibleGaussians=i.gaussianSplat.maxAllowedVisibleGaussians,a.heatmap.pixelRatio=i.heatmap.pixelRatio,a.heatmap.maxTotalNumberOfFeatures=i.heatmap.maxTotalNumberOfFeatures,a.fadeDuration=i.fadeDuration,a.antialiasingEnabled=i.antialiasingEnabled,a.physicallyBasedRenderingEnabled=i.physicalBasedRenderingEnabled,a.highQualityTransparency=i.highQualityTransparency,a.highResolutionAtmosphere=i.highResolutionAtmosphere,a.reflections=i.reflections,a.ambientOcclusion=i.ambientOcclusion,a.maxTexturePixels=i.maxTexturePixels,a.memoryLimit=i.memoryLimit,a.additionalCacheMemory=i.additionalCacheMemory,a.frameRate=i.frameRate,a.maximumPixelRatio=i.maximumPixelRatio}static{this.test={reset(){const e=t();for(const a of Object.keys(e))l[a]=e[a]}}}}const i={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430},l=t();function t(){const a=!!has("esri-mobile"),l=!!has("ios"),t=e(400);return{low:{graphics3D:{maxTotalNumberOfFeatures:25e3,maxNumberOfDrawCalls:8e3,maxTotalNumberOfVertices:255e4,polygonLodFactor:.5,polylineLodFactor:1,snapshotAvailable:!1,skipHighSymbolLods:!0},heatmap:{pixelRatio:.125,maxTotalNumberOfFeatures:5e4},sceneService:{object:{lodFactor:.2},point:{lodFactor:1},integratedMesh:{lodFactor:.6},pointCloud:{lodFactor:.5}},gaussianSplat:{minimumSplatPixelRadius:3,minimumOpacity:.1,maxAllowedVisibleGaussians:4e6},tiledSurface:{lodBias:-1,angledSplitBias:.5,vtlContentZoom:.75,elevationLevelDelta:3,reduceTileLevelDifferences:!0},fadeDuration:e(0),antialiasingEnabled:!1,physicalBasedRenderingEnabled:!1,highQualityTransparency:!1,highResolutionAtmosphere:!1,reflections:!1,ambientOcclusion:!1,maxTexturePixels:a?1048576:4194304,memoryLimit:200+i.IPhone12Pro,additionalCacheMemory:0,frameRate:0,maximumPixelRatio:1},medium:{graphics3D:{maxTotalNumberOfFeatures:1e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:625e4,polygonLodFactor:a?.8:1,polylineLodFactor:a?1.2:1.5,snapshotAvailable:!l,skipHighSymbolLods:!1},heatmap:{pixelRatio:.25,maxTotalNumberOfFeatures:13e4},sceneService:{object:{lodFactor:1},point:{lodFactor:1},integratedMesh:{lodFactor:1},pointCloud:{lodFactor:1}},gaussianSplat:{minimumSplatPixelRadius:2,minimumOpacity:.05,maxAllowedVisibleGaussians:8e6},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:3,reduceTileLevelDifferences:!has("disable-feature:reduce-map-tile-levels")},fadeDuration:t,antialiasingEnabled:!1,physicalBasedRenderingEnabled:!0,highQualityTransparency:!0,highResolutionAtmosphere:!1,reflections:!1,ambientOcclusion:!1,maxTexturePixels:a?4194304:4096**2,memoryLimit:a?600+i.GalaxyS20:750+i.FullHD,additionalCacheMemory:a?-100:150,frameRate:0,maximumPixelRatio:1},high:{graphics3D:{maxTotalNumberOfFeatures:1e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:125e5,polygonLodFactor:a?1.2:2,polylineLodFactor:a?1.2:2,snapshotAvailable:!l,skipHighSymbolLods:!1},heatmap:{pixelRatio:.5,maxTotalNumberOfFeatures:23e4},sceneService:{object:{lodFactor:1},point:{lodFactor:1},integratedMesh:{lodFactor:1},pointCloud:{lodFactor:1}},gaussianSplat:{minimumSplatPixelRadius:.5,minimumOpacity:.005,maxAllowedVisibleGaussians:16e6},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:2,reduceTileLevelDifferences:!has("disable-feature:reduce-map-tile-levels")},fadeDuration:t,antialiasingEnabled:!0,physicalBasedRenderingEnabled:!0,highQualityTransparency:!0,highResolutionAtmosphere:!0,reflections:!0,ambientOcclusion:!0,maxTexturePixels:a?4096**2:1/0,memoryLimit:a?900+i.SurfacePro7:1500+i.FullHDRetina,additionalCacheMemory:a?-150:0,frameRate:0,maximumPixelRatio:a?1:1/0}}}export{a as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{Milliseconds as o}from"../../../core/time.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";let r=class extends e{constructor(){super(...arguments),this.minTotalNumberOfFeatures=2e3,this.maxTotalNumberOfFeatures=5e4,this.maxNumberOfDrawCalls=17e3,this.maxTotalNumberOfVertices=17e5,this.snapshotAvailable=!0,this.polygonLodFactor=1,this.polylineLodFactor=1,this.skipHighSymbolLods=!1}};t([i()],r.prototype,"minTotalNumberOfFeatures",void 0),t([i()],r.prototype,"maxTotalNumberOfFeatures",void 0),t([i()],r.prototype,"maxNumberOfDrawCalls",void 0),t([i()],r.prototype,"maxTotalNumberOfVertices",void 0),t([i()],r.prototype,"snapshotAvailable",void 0),t([i()],r.prototype,"polygonLodFactor",void 0),t([i()],r.prototype,"polylineLodFactor",void 0),t([i()],r.prototype,"skipHighSymbolLods",void 0),r=t([s("esri.views.3d.support.QualitySettings.Graphics3DSettings")],r);let p=class extends e{constructor(){super(...arguments),this.lodFactor=1}};t([i()],
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{Milliseconds as o}from"../../../core/time.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";let r=class extends e{constructor(){super(...arguments),this.minTotalNumberOfFeatures=2e3,this.maxTotalNumberOfFeatures=5e4,this.maxNumberOfDrawCalls=17e3,this.maxTotalNumberOfVertices=17e5,this.snapshotAvailable=!0,this.polygonLodFactor=1,this.polylineLodFactor=1,this.skipHighSymbolLods=!1}};t([i()],r.prototype,"minTotalNumberOfFeatures",void 0),t([i()],r.prototype,"maxTotalNumberOfFeatures",void 0),t([i()],r.prototype,"maxNumberOfDrawCalls",void 0),t([i()],r.prototype,"maxTotalNumberOfVertices",void 0),t([i()],r.prototype,"snapshotAvailable",void 0),t([i()],r.prototype,"polygonLodFactor",void 0),t([i()],r.prototype,"polylineLodFactor",void 0),t([i()],r.prototype,"skipHighSymbolLods",void 0),r=t([s("esri.views.3d.support.QualitySettings.Graphics3DSettings")],r);let p=class{constructor(){this.minimumSplatPixelRadius=2,this.minimumOpacity=.05,this.maxAllowedVisibleGaussians=1/0}};t([i()],p.prototype,"minimumSplatPixelRadius",void 0),t([i()],p.prototype,"minimumOpacity",void 0),t([i()],p.prototype,"maxAllowedVisibleGaussians",void 0),p=t([s("esri.views.3d.support.QualitySettings.GaussianSplatSettings")],p);let a=class extends e{constructor(){super(...arguments),this.lodFactor=1}};t([i()],a.prototype,"lodFactor",void 0),a=t([s("esri.views.3d.support.QualitySettings.LoDFactorSettings")],a);let l=class extends e{constructor(){super(...arguments),this.object=new a,this.point=new a,this.integratedMesh=new a,this.pointCloud=new a}};t([i({type:a})],l.prototype,"object",void 0),t([i({type:a})],l.prototype,"point",void 0),t([i({type:a})],l.prototype,"integratedMesh",void 0),t([i({type:a})],l.prototype,"pointCloud",void 0),l=t([s("esri.views.3d.support.QualitySettings.SceneServiceSettings")],l);let n=class extends e{constructor(){super(...arguments),this.lodBias=0,this.angledSplitBias=1,this.vtlContentZoom=1,this.elevationLevelDelta=3,this.reduceTileLevelDifferences=!0}};t([i()],n.prototype,"lodBias",void 0),t([i()],n.prototype,"angledSplitBias",void 0),t([i()],n.prototype,"vtlContentZoom",void 0),t([i()],n.prototype,"elevationLevelDelta",void 0),t([i()],n.prototype,"reduceTileLevelDifferences",void 0),n=t([s("esri.views.3d.support.QualitySettings.TiledSurfaceSettings")],n);let d=class extends e{constructor(){super(...arguments),this.pixelRatio=1,this.maxTotalNumberOfFeatures=5e4}};t([i()],d.prototype,"pixelRatio",void 0),t([i()],d.prototype,"maxTotalNumberOfFeatures",void 0),d=t([s("esri.views.3d.support.QualitySettings.HeatmapSettings")],d);let c=class extends e{constructor(){super(...arguments),this.graphics3D=new r,this.sceneService=new l,this.tiledSurface=new n,this.gaussianSplat=new p,this.heatmap=new d,this.fadeDuration=o(400),this.antialiasingEnabled=!0,this.physicallyBasedRenderingEnabled=!1,this.highQualityTransparency=!0,this.highResolutionAtmosphere=!1,this.reflections=!1,this.ambientOcclusion=!1,this.glow=!0,this.maxTexturePixels=1/0,this.memoryLimit=750,this.additionalCacheMemory=0,this.frameRate=void 0,this.maximumPixelRatio=1/0}};t([i({type:r})],c.prototype,"graphics3D",void 0),t([i({type:l})],c.prototype,"sceneService",void 0),t([i({type:n})],c.prototype,"tiledSurface",void 0),t([i({type:p})],c.prototype,"gaussianSplat",void 0),t([i({type:d})],c.prototype,"heatmap",void 0),t([i()],c.prototype,"fadeDuration",void 0),t([i()],c.prototype,"antialiasingEnabled",void 0),t([i()],c.prototype,"physicallyBasedRenderingEnabled",void 0),t([i()],c.prototype,"highQualityTransparency",void 0),t([i()],c.prototype,"highResolutionAtmosphere",void 0),t([i()],c.prototype,"reflections",void 0),t([i()],c.prototype,"ambientOcclusion",void 0),t([i()],c.prototype,"glow",void 0),t([i()],c.prototype,"maxTexturePixels",void 0),t([i()],c.prototype,"memoryLimit",void 0),t([i()],c.prototype,"additionalCacheMemory",void 0),t([i()],c.prototype,"frameRate",void 0),t([i()],c.prototype,"maximumPixelRatio",void 0),c=t([s("esri.views.3d.support.QualitySettings")],c);const m=c;export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{Seconds as
|
|
5
|
+
import{Seconds as t}from"../../../../core/time.js";class e{constructor(t,e,i,s){this._query=t,this.streamlines=e,this._material=i,this.geometries=s,this._startTime=0,this._endTime=1/0,this.startTime=this._query.time}get startTime(){return this._startTime}set startTime(e){this._query.time!==e&&(this._query={...this.query,time:t(e)}),this._startTime=e,this.setMaterialParameters({startTime:e})}get endTime(){return this._endTime}set endTime(t){this._endTime=t,this.setMaterialParameters({endTime:t})}get query(){return this._query}setMaterialParameters(t){this._material.setParameters(t)}}export{e as StreamlineResources3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{destroyMaybe as e}from"../../../../core/maybe.js";import{StreamlineResources3D as r}from"./StreamlineResources3D.js";import{RenderGeometry as t}from"../../webgl-engine/lib/RenderGeometry.js";class a extends r{constructor(e,r,t,a){super(e,r,t),this._overlayManager=
|
|
5
|
+
import{destroyMaybe as e}from"../../../../core/maybe.js";import{StreamlineResources3D as r}from"./StreamlineResources3D.js";import{RenderGeometry as t}from"../../webgl-engine/lib/RenderGeometry.js";class a extends r{constructor(e,r,t,a,s){super(e,r,t,a),this._overlayManager=s,this._drapeRenderer=null,this.drapeSourceType=2,this.updatePolicy=0,this.renderGroup=0}get attached(){return null!=this._drapeRenderer}get destroyed(){return this.attached}attach(){const{geometries:e}=this;null!=e&&(this.detach(),this._drapeRenderer=this._overlayManager.registerGeometryDrapeSource(this),this._drapeRenderer.addGeometries(e.map(e=>new t(e)),0))}detach(){this.attached&&(this._overlayManager.unregisterDrapeSource(this),this._drapeRenderer=e(this._drapeRenderer))}}export{a as StreamlineResources3DOverlay};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{destroyMaybe as e,disposeMaybe as t}from"../../../../core/maybe.js";import{StreamlineResources3D as i}from"./StreamlineResources3D.js";import{Object3D as s}from"../../webgl-engine/lib/Object3D.js";import{WebGLLayer as n}from"../../webgl-engine/lib/WebGLLayer.js";class r extends i{constructor(e,t,i,s){super(e,t,i),this._stage=
|
|
5
|
+
import{destroyMaybe as e,disposeMaybe as t}from"../../../../core/maybe.js";import{StreamlineResources3D as i}from"./StreamlineResources3D.js";import{Object3D as s}from"../../webgl-engine/lib/Object3D.js";import{WebGLLayer as n}from"../../webgl-engine/lib/WebGLLayer.js";class r extends i{constructor(e,t,i,s,n){super(e,t,i,s),this._stage=n,this._object3D=null,this._engineLayer=null}get attached(){return null!=this._object3D&&null!=this._engineLayer}attach(){const{geometries:e}=this;if(null==e)return;this.detach();const t=new n(this._stage,{pickable:!1}),i=new s({geometries:e});t.add(i),this._object3D=i,this._engineLayer=t}detach(){this.attached&&(this._engineLayer=e(this._engineLayer),this._object3D=t(this._object3D))}}export{r as StreamlineResources3DShape};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{makeScheduleFunction as s}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as r}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatOrderTexture as t}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as i}from"./GaussianSplatTextureAtlas.js";class a{constructor(e){this.visibleGaussians=0,this._visibleGaussianTiles=new Array,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._bufferCapacity=0,this._renderer=e,this._orderTexture=new t(this._renderer.renderingContext),this._textureAtlas=new i(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:a}=this._renderer.view;this._workerHandle=new r(s(a))}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get visibleGaussianTiles(){return this._visibleGaussianTiles}updateGaussianVisibility(e){this._visibleGaussianTiles=e,this.requestSort()}requestSort(){this._isSorting?this._pendingSortTask=!0:(this._isSorting=!0,this._pendingSortTask=!1,this._sortOnWorker().then(()=>{this._isSorting=!1,this._pendingSortTask&&this.requestSort()}).catch(()=>{this._isSorting=!1,this._pendingSortTask&&this.requestSort()}))}destroy(){this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy()}_clearBuffersAndTextures(){this._bufferCapacity=0,this._orderTexture.clear(),this._textureAtlas.clear()}_ensureBufferCapacity(s){if(this._bufferCapacity<s){const r=Math.ceil(s*e);this._atlasIndicesBuffer=new Uint32Array(r),this._sortedAtlasIndicesBuffer=new Uint32Array(r),this._bufferCapacity=r}}async _sortOnWorker(){let e=0;if(this._visibleGaussianTiles.forEach(s=>e+=s.gaussianAtlasIndices.length),0===e)return this.visibleGaussians=0,this._clearBuffersAndTextures(),void this._renderer.requestRender(1);this._ensureBufferCapacity(e),this._textureAtlas.ensureTextureAtlas();const s=this._renderer.camera.ray.direction,r=s[0],t=s[1],i=s[2],
|
|
5
|
+
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{makeScheduleFunction as s}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as r}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatOrderTexture as t}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as i}from"./GaussianSplatTextureAtlas.js";class a{constructor(e){this.visibleGaussians=0,this._visibleGaussianTiles=new Array,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._bufferCapacity=0,this._renderer=e,this._orderTexture=new t(this._renderer.renderingContext),this._textureAtlas=new i(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:a}=this._renderer.view;this._workerHandle=new r(s(a))}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get visibleGaussianTiles(){return this._visibleGaussianTiles}updateGaussianVisibility(e){this._visibleGaussianTiles=e,this.requestSort()}requestSort(){this._isSorting?this._pendingSortTask=!0:(this._isSorting=!0,this._pendingSortTask=!1,this._sortOnWorker().then(()=>{this._isSorting=!1,this._pendingSortTask&&this.requestSort()}).catch(()=>{this._isSorting=!1,this._pendingSortTask&&this.requestSort()}))}destroy(){this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy()}_clearBuffersAndTextures(){this._bufferCapacity=0,this._orderTexture.clear(),this._textureAtlas.clear()}_ensureBufferCapacity(s){if(this._bufferCapacity<s){const r=Math.ceil(s*e);this._atlasIndicesBuffer=new Uint32Array(r),this._sortedAtlasIndicesBuffer=new Uint32Array(r),this._bufferCapacity=r}}async _sortOnWorker(){let e=0;if(this._visibleGaussianTiles.forEach(s=>e+=s.gaussianAtlasIndices.length),0===e)return this.visibleGaussians=0,this._clearBuffersAndTextures(),void this._renderer.requestRender(1);this._ensureBufferCapacity(e),this._textureAtlas.ensureTextureAtlas();const s=this._renderer.camera.ray.direction,r=s[0],t=s[1],i=s[2],a=1/Math.sqrt(r*r+t*t+i*i),n=r*a,o=t*a,u=i*a,l=this._atlasIndicesBuffer.subarray(0,e),h=new Float64Array(e);let d=0;this._visibleGaussianTiles.forEach(e=>{const s=e.gaussianAtlasIndices,r=e.positions;for(let t=0;t<s.length;t++){l[d]=s[t];const e=3*t,i=r[e],a=r[e+1],_=r[e+2];h[d]=i*n+a*o+_*u,d++}});const _=new Uint32Array(e);for(let f=0;f<e;f++)_[f]=f;const c={distances:h,sortOrderIndices:_};await(this._workerHandle?.sort(c).then(s=>{const r=this._sortedAtlasIndicesBuffer.subarray(0,e);for(let i=0;i<e;i++)r[i]=l[s.sortedOrderIndices[i]];this._orderTexture.setData(r,e);const t=this._renderer.view.qualitySettings.gaussianSplat.maxAllowedVisibleGaussians;this.visibleGaussians=Math.min(e,t),this._renderer.requestRender(1)}))}}export{a as GaussianSplatDataStore};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{cyclicalPI as r}from"../../../core/Cyclical.js";import"../../../core/has.js";import{clamp as s,deg2rad as i}from"../../../core/mathUtils.js";import{destroyMaybe as a}from"../../../core/maybe.js";import{watch as n,sync as o}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{f as d,d as u,c as p,j as m}from"../../../chunks/vec32.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as g,c as _,h as f}from"../../../chunks/vec42.js";import{fromValues as v,create as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as S}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as R}from"../../../geometry/projection/projectVectorToVector.js";import{create as w,width as O,center as P,height as T,copy as D,intersection as M,contains as j,intersects as b,offset as I}from"../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as C}from"../../../geometry/support/normalizeUtils.js";import{create as U,wrap as E}from"../../../geometry/support/ray.js";import{l as A,b as q,t as V}from"../../../chunks/sphere.js";import{angleAroundAxis as F}from"../../../geometry/support/vector.js";import{y2lat as G}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as H}from"../state/utils/viewUtils.js";import{debugFlags as z}from"../support/debugFlags.js";import{DebugPoint as L}from"../support/debugUtils.js";import{OverlayRenderer as k}from"./OverlayRenderer.js";import{Intersector as B}from"../webgl-engine/lib/Intersector.js";import{fromValues as W}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as Y}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as N,ensureTextureSize as X}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as Z}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as J,noBudget as K}from"../../support/Scheduler.js";import{Yield as Q}from"../../support/Yield.js";const $=1.3,ee=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let te,re=class extends t{constructor(e){super(e),this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._latestOriginId=0}initialize(){const e=this.view;this.renderer=new k({parent:this}),e.stage.renderer.plugins.add(this.renderer);const t=()=>this.requestRender();this._groundIntersector=new B(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([n(()=>this.renderer.hasHighlights,t),this.renderer.events.on("has-water",()=>e.stage?.renderer.updateHasFlags()),this.renderer.events.on("content-changed",t),n(()=>e.state.camera.pixelRatio,t),n(()=>e.state.alignPixelEnabled,t),this.renderer.events.on("textures-disposed",()=>this.terrainSurface.requestRender()),n(()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location],()=>this.setPlacementDirty()),n(()=>[e.state?.pixelRatio,e.state?.contentPixelRatio],()=>this.setPlacementDirty(),o),this.terrainSurface.on("elevation-change",()=>this.setPlacementDirty()),e.on("resize",()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(J.OVERLAY,this)]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null,a(this.renderer)),te&&(te.hide(),te=null),this.renderer=null}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.renderer.longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this.renderer.longitudeCyclical=C(e))):this.renderer.disposeOverlays()}get readyToRun(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||z.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&(this.terrainSurface.ready||!this.terrainSurface.enabled)}get _isSpherical(){return this.view.state.isGlobal}get worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?S(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return $/this.view.resolutionScale}get _longitudeCyclical(){return this.renderer.longitudeCyclical}get suspended(){return this.terrainSurface.enabled&&this.terrainSurface.suspended}get updating(){return this.readyToRun||!!this.renderer?.updating||this._contentUpdated}render(){return this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.precompileShaders(this.view.state)?this._drawOverlays():null}get hasOverlays(){return this.renderer.hasOverlays}registerDrapeSource(e,t){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.registerDrapeSource(e,t),this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("readyToRun")}registerGeometryDrapeSource(e){const t=new Y({stage:this.view.stage,drapeSource:e,rendererContext:this.renderer});return this.registerDrapeSource(e,t),t}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("readyToRun"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.requestRender()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this.updateOverlays(e,this.view.state.contentCamera,1)}updateOverlays(e,t,r){if(!this._spatialReference)return Q;const s=this._computeOverlayHeight(t);this._computeOverlayExtents(t,s,oe),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,oe.stretch);const i=this._updateOverlay(0,oe.inner,s,1*oe.pixelRatioAdjustment,oe.mapUnitsPerPixel),a=O(oe.inner)/O(oe.outer),n=this._updateOverlay(1,oe.outer,s,a*oe.pixelRatioAdjustment,oe.mapUnitsPerPixel);1!==i&&1!==n||(this._drapeSources.forEach(e=>this._updateDrapeSourceExtent(e)),this.updateOverlayParameters(r)),0===i&&0===n||this.requestRender(),this._placementDirty=!1,e.madeProgress()}_computeOverlayHeight(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s)),{maxPreferredTexturePixels:a,maxTextureSize:n}=this.view.stage.renderView.renderingContext.parameters,o=.5*n;return N(X({width:i,height:i},{maxPreferredTexturePixels:2*a,maxTextureSize:o})[1],o)}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return 0;const a=this.renderer.overlays[e],n=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=s,se(t,a.extent)&&r===a.resolution)return n===i?0:2;a.setExtent(t),a.resolution=r;const o=P(a.extent);return a.renderLocalOrigin=W(o[0],o[1],0,"OV_"+this._latestOriginId++),1}updateOverlayParameters(e){this.terrainSurface.allTiles.forAll(e=>this.updateTileOverlayParameters(e)),this.terrainSurface.requestRender(e)}updateTileOverlayParameters(e){if(!e.renderData)return;const t=e.renderData.overlay;if(0===this.renderer.overlays.length)this._clearTileOverlayData(0,t),this._clearTileOverlayData(1,t);else{const[r,s]=this.renderer.overlays,i=e.extent;this._rectInsideRect(r.extent,i)||this._rectanglesOverlap(i,r.extent)||this._rectanglesOverlap(i,s.extent)?(this._setTileOverlayData(i,0,t),this._setTileOverlayData(i,1,t)):(this._clearTileOverlayData(0,t),this._clearTileOverlayData(1,t))}}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[0],s=this.renderer.overlays[1],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}_setTileOverlayData(e,t,r){if(0===this.renderer.overlays.length)return;const s=this.renderer.overlays[t].extent,i=O(s),a=T(s);let n=e[0];if(this._longitudeCyclical){n=this._longitudeCyclical.minimalMonotonic(s[0],n);const t=this._longitudeCyclical.minimalMonotonic(s[0],e[2]);n>t&&(n=t-(e[2]-e[0]))}r.setScale(t,O(e)/i,T(e)/a),r.setOffset(t,(n-s[0])/i,(e[1]-s[1])/a)}_clearTileOverlayData(e,t){t.setScale(e,-1,-1),t.setOffset(e,-1,-1)}reloadShaders(){Z(),this.requestRender(),this.runTask(K)}requestRender(e=1){this.renderer.hasOverlays?(1===e?(this._contentUpdated=!0,this._drawTexturesDirty=!0):this._drawTexturesAnimateDirty=!0,this.view.stage.renderView.requestRender(e)):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s,i){const a=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,ce,t,r);if(null==a)return!1;const n=a.origin,o=d(ne,a.origin,a.direction);this._groundIntersector.reset(n,o,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,n,o);const l=this._groundIntersector.results.min;return l.getIntersectionPoint(i)&&l.withinDistance(s)}_findHorizonBasedPointOfInterest(e,t){let i=.5;const a=.55,n=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=s(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:n+l,e.aboveGround?n-l:1/0),c=e.aboveGround;if("global"===this.view.viewingMode){const t=ne;A(q(V,S(this.view.spatialReference).radius+h),E(e.eye,e.viewForward),t),u(t,t,e.eye);const s=r.normalize(F(e.viewForward,t,e.viewRight))/e.fovY+.5,n=s<=0||s>=1?.5:a;i=c?n*s:s+n*(1-s)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),r=Math.tan(t),n=v(0,r,1,0),o=g(n,n,e.projectionMatrix)[1],l=s(.5+.5*o,0,1);i=1===l||0===l?.5:c?l*a:1-(1-l)*a}return this._intersectGroundFromView(e,.5,i,o.distance,t)}_computeOverlayExtents(e,t,r){const s=this.view.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,a=y();this._findHorizonBasedPointOfInterest(e,a)||p(a,s),z.OVERLAY_SHOW_CENTER?(null==te&&(te=new L(this.view.graphics,"red")),te.show(a,this._renderSR)):null!=te&&te.hide();const n=Math.max(.1,m(e.eye,a)),o=H(this.view.renderCoordsHelper,s,e.eye);this._overlaySREqualsRenderSR||R(a,this._renderSR,a,this._spatialReference);const l=this.terrainSurface.extent,h=!this._isSpherical&&this._spatialReference?.isGeographic,d=h&&this._spatialReference?1/S(this._spatialReference).metersPerDegree:1,u=this.view.state.contentPixelRatio,g=e.perScreenPixelRatio/u*n*d;r.mapUnitsPerPixel=g/this.worldToPCSRatio,r.stretch=this._overlayStretch;let v=t*g/2*r.stretch,x=!1,w=h?90:1/0;this._isSpherical&&l&&this._spatialReference&&(this._spatialReference.isWebMercator?(v/=Math.cos(G(a[1])),w=l[3]):(x=!0,v/=S(this._spatialReference).metersPerDegree,w=90),v>=w&&(v=w,a[1]=0,this._spatialReference.isWebMercator&&(a[0]=0)));let P=1;x&&(P=1/Math.max(.2,Math.cos(Math.abs(i(a[1])))),v*P>180&&(P=180/v),r.mapUnitsPerPixel*=P);const T=Math.log(2)/12;v=Math.exp(Math.round(Math.log(v)/T)*T);const b=v*P,I=32,C=.5*t/(I*b),U=.5*t/(I*v);a[0]=Math.round(a[0]*C)/C,a[1]=Math.round(a[1]*U)/U;const E=r.inner;E[0]=a[0]-b,E[1]=a[1]-v,E[2]=a[0]+b,E[3]=a[1]+v,this._isSpherical&&this._shiftExtentToFitBounds(E,1/0,w);const A=r.outer;if(6*b>O(l))D(A,l);else{if(Math.PI/2-Math.abs(o-Math.PI/2)<=.25*Math.PI)A[0]=E[0]-b,A[1]=E[1]-v,A[2]=E[2]+b,A[3]=E[3]+v;else{R(e.eye,this._renderSR,ne,this._spatialReference),c(ae,a,ne);let t=-Math.atan2(ae[1],ae[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));_(ae,ee[r],2*v),ae[0]*=P,ae[2]*=P,f(A,E,ae)}}if(this._isSpherical)A[0]=this._longitudeCyclical.clamp(A[0]),A[2]=this._longitudeCyclical.clamp(A[2]),A[1]=Math.max(A[1],-w),A[3]=Math.min(A[3],w);else{const e=M(E,l,le),t=M(A,l,he);j(e,t)&&(A[2]=A[0],A[3]=A[1])}const q=Math.abs(E[2]-E[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,q),r.pixelRatioAdjustment=r.mapUnitsPerPixel/q}_drawOverlays(e=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const t=!this._drawTexturesDirty&&this._drawTexturesAnimateDirty?0:1;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const r=this.renderer.computeValidity();this.renderer.releaseRenderTargets(t),this.renderer.drawOverlays(e,t);return r!==this.renderer.computeValidity()&&this.updateOverlayParameters(1),this.terrainSurface.requestRender(t),1===t&&this.terrainSurface.requestUpdate(),this.renderer}_rectanglesOverlap(e,t){return null!=e&&(this._longitudeCyclical?(this._longitudeCyclical.contains(t[0],t[2],e[0])||this._longitudeCyclical.contains(t[0],t[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],t[0]))&&!(e[1]>t[3]||e[3]<t[1]):b(e,t))}_rectInsideRect(e,t){return null!=t&&(this._longitudeCyclical?this._longitudeCyclical.contains(e[0],e[2],t[0])&&this._longitudeCyclical.contains(e[0],e[2],t[2])&&t[1]>e[1]&&t[3]<e[3]:j(e,t))}_pointIsInExtent(e,t){if(this._longitudeCyclical)return this._longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),I(e,s,i)}get test(){}};function se(e,t){const r=1e-5,s=z.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([l()],re.prototype,"_spatialReference",void 0),e([l({readOnly:!0})],re.prototype,"readyToRun",null),e([l()],re.prototype,"_placementDirty",void 0),e([l()],re.prototype,"_contentUpdated",void 0),e([l()],re.prototype,"_isSpherical",null),e([l()],re.prototype,"worldToPCSRatio",null),e([l()],re.prototype,"renderer",void 0),e([l({constructOnly:!0})],re.prototype,"view",void 0),e([l({constructOnly:!0})],re.prototype,"terrainSurface",void 0),e([l()],re.prototype,"suspended",null),e([l()],re.prototype,"updating",null),re=e([h("esri.views.3d.terrain.OverlayManager")],re);class ie{constructor(){this.inner=w(),this.outer=w(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=$}}const ae=x(),ne=y(),oe=new ie,le=w(),he=w(),ce=U();export{re as OverlayManager};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{cyclicalPI as r}from"../../../core/Cyclical.js";import"../../../core/has.js";import{clamp as s,deg2rad as i}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as a,sync as o}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{f as d,d as u,c as p,j as m}from"../../../chunks/vec32.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as y,c as f,h as _}from"../../../chunks/vec42.js";import{fromValues as v,create as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as S}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as w}from"../../../geometry/projection/projectVectorToVector.js";import{create as R,width as P,center as T,copy as D,intersection as O,contains as M,offset as j}from"../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as b}from"../../../geometry/support/normalizeUtils.js";import{create as I,wrap as U}from"../../../geometry/support/ray.js";import{l as E,b as C,t as q}from"../../../chunks/sphere.js";import{angleAroundAxis as A}from"../../../geometry/support/vector.js";import{y2lat as V}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as F}from"../state/utils/viewUtils.js";import{debugFlags as G}from"../support/debugFlags.js";import{DebugPoint as H}from"../support/debugUtils.js";import{OverlayRenderer as z}from"./OverlayRenderer.js";import{Intersector as L}from"../webgl-engine/lib/Intersector.js";import{fromValues as k}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as B}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as W,ensureTextureSize as Y}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as N}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as X,noBudget as Z}from"../../support/Scheduler.js";import{Yield as J}from"../../support/Yield.js";const K=1.3,Q=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let $,ee=class extends t{constructor(e){super(e),this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._latestOriginId=0}initialize(){const{view:e}=this;this.renderer=new z({parent:this}),e.stage.renderer.plugins.add(this.renderer);const t=()=>this.requestRender();this._groundIntersector=new L(e.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([a(()=>this.renderer.hasHighlights,t),this.renderer.events.on("has-water",()=>e.stage?.renderer.updateHasFlags()),this.renderer.events.on("content-changed",t),a(()=>e.state.camera.pixelRatio,t),a(()=>e.state.alignPixelEnabled,t),this.renderer.events.on("textures-disposed",()=>this.terrainSurface.requestRender()),a(()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location],()=>this.setPlacementDirty()),a(()=>[e.state?.pixelRatio,e.state?.contentPixelRatio],()=>this.setPlacementDirty(),o),this.terrainSurface.on("elevation-change",()=>this.setPlacementDirty()),e.on("resize",()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(X.OVERLAY,this)]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null,n(this.renderer)),$&&($.hide(),$=null),this.renderer=null}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.renderer.longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this.renderer.longitudeCyclical=b(e))):this.renderer.disposeOverlays()}get readyToRun(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||G.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&(this.terrainSurface.ready||!this.terrainSurface.enabled)}get _isSpherical(){return this.view.state.isGlobal}get worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?S(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return K/this.view.resolutionScale}get longitudeCyclical(){return this.renderer.longitudeCyclical}get suspended(){return this.terrainSurface.enabled&&this.terrainSurface.suspended}get updating(){return this.readyToRun||!!this.renderer?.updating||this._contentUpdated}render(){return this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.precompileShaders(this.view.state)?this._drawOverlays():null}get hasOverlays(){return this.renderer.hasOverlays}registerDrapeSource(e,t){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.registerDrapeSource(e,t),this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("readyToRun")}registerGeometryDrapeSource(e){const t=new B({stage:this.view.stage,drapeSource:e,rendererContext:this.renderer});return this.registerDrapeSource(e,t),t}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("readyToRun"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.requestRender()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this.updateOverlays(e,this.view.state.contentCamera,1)}updateOverlays(e,t,r){if(!this._spatialReference)return J;const s=this._computeOverlayHeight(t);this._computeOverlayExtents(t,s,ne),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,ne.stretch);const i=this._updateOverlay(0,ne.inner,s,1*ne.pixelRatioAdjustment,ne.mapUnitsPerPixel),n=P(ne.inner)/P(ne.outer),a=this._updateOverlay(1,ne.outer,s,n*ne.pixelRatioAdjustment,ne.mapUnitsPerPixel);1!==i&&1!==a||(this._drapeSources.forEach(e=>this._updateDrapeSourceExtent(e)),this.terrainSurface.updateOverlayParameters(),this.terrainSurface.requestRender(r)),0===i&&0===a||this.requestRender(),this._placementDirty=!1,e.madeProgress()}_computeOverlayHeight(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s)),{maxPreferredTexturePixels:n,maxTextureSize:a}=this.view.stage.renderView.renderingContext.parameters,o=.5*a;return W(Y({width:i,height:i},{maxPreferredTexturePixels:2*n,maxTextureSize:o})[1],o)}get overlays(){return this.renderer.overlays}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return 0;const n=this.renderer.overlays[e],a=n.mapUnitsPerPixel;if(n.mapUnitsPerPixel=i,n.pixelRatio=s,te(t,n.extent)&&r===n.resolution)return a===i?0:2;n.setExtent(t),n.resolution=r;const o=T(n.extent);return n.renderLocalOrigin=k(o[0],o[1],0,"OV_"+this._latestOriginId++),1}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[0],s=this.renderer.overlays[1],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}reloadShaders(){N(),this.requestRender(),this.runTask(Z)}requestRender(e=1){this.renderer.hasOverlays?(1===e?(this._contentUpdated=!0,this._drawTexturesDirty=!0):this._drawTexturesAnimateDirty=!0,this.view.stage.renderView.requestRender(e)):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s,i){const n=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,le,t,r);if(null==n)return!1;const a=n.origin,o=d(ie,n.origin,n.direction);this._groundIntersector.reset(a,o,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,a,o);const l=this._groundIntersector.results.min;return l.getIntersectionPoint(i)&&l.withinDistance(s)}_findHorizonBasedPointOfInterest(e,t){let i=.5;const n=.55,a=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=s(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:a+l,e.aboveGround?a-l:1/0),c=e.aboveGround;if("global"===this.view.viewingMode){const t=ie;E(C(q,S(this.view.spatialReference).radius+h),U(e.eye,e.viewForward),t),u(t,t,e.eye);const s=r.normalize(A(e.viewForward,t,e.viewRight))/e.fovY+.5,a=s<=0||s>=1?.5:n;i=c?a*s:s+a*(1-s)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),r=Math.tan(t),a=v(0,r,1,0),o=y(a,a,e.projectionMatrix)[1],l=s(.5+.5*o,0,1);i=1===l||0===l?.5:c?l*n:1-(1-l)*n}return this._intersectGroundFromView(e,.5,i,o.distance,t)}_computeOverlayExtents(e,t,r){const{view:s}=this,n=s.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,a=g();this._findHorizonBasedPointOfInterest(e,a)||p(a,n);const o=this._renderSR;G.OVERLAY_SHOW_CENTER?(null==$&&($=new H(s.graphics,"red")),$.show(a,o)):null!=$&&$.hide();const l=Math.max(.1,m(e.eye,a)),h=F(s.renderCoordsHelper,n,e.eye),d=this._spatialReference;this._overlaySREqualsRenderSR||w(a,o,a,d);const u=this._isSpherical,y=this.terrainSurface.extent,v=!u&&d?.isGeographic,x=v&&d?1/S(d).metersPerDegree:1,R=s.state.contentPixelRatio,T=e.perScreenPixelRatio/R*l*x;r.mapUnitsPerPixel=T/this.worldToPCSRatio,r.stretch=this._overlayStretch;let j=t*T/2*r.stretch,b=!1,I=v?90:1/0;u&&y&&d&&(d.isWebMercator?(j/=Math.cos(V(a[1])),I=y[3]):(b=!0,j/=S(d).metersPerDegree,I=90),j>=I&&(j=I,a[1]=0,d.isWebMercator&&(a[0]=0)));let U=1;b&&(U=1/Math.max(.2,Math.cos(Math.abs(i(a[1])))),j*U>180&&(U=180/j),r.mapUnitsPerPixel*=U);const E=Math.log(2)/12;j=Math.exp(Math.round(Math.log(j)/E)*E);const C=j*U,q=32,A=.5*t/(q*C),z=.5*t/(q*j);a[0]=Math.round(a[0]*A)/A,a[1]=Math.round(a[1]*z)/z;const L=r.inner;L[0]=a[0]-C,L[1]=a[1]-j,L[2]=a[0]+C,L[3]=a[1]+j,u&&this._shiftExtentToFitBounds(L,1/0,I);const k=r.outer;if(6*C>P(y))D(k,y);else{if(Math.PI/2-Math.abs(h-Math.PI/2)<=.25*Math.PI)k[0]=L[0]-C,k[1]=L[1]-j,k[2]=L[2]+C,k[3]=L[3]+j;else{w(e.eye,o,ie,d),c(se,a,ie);let t=-Math.atan2(se[1],se[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));f(se,Q[r],2*j),se[0]*=U,se[2]*=U,_(k,L,se)}}if(u)k[0]=this.longitudeCyclical.clamp(k[0]),k[2]=this.longitudeCyclical.clamp(k[2]),k[1]=Math.max(k[1],-I),k[3]=Math.min(k[3],I);else{const e=O(L,y,ae),t=O(k,y,oe);M(e,t)&&(k[2]=k[0],k[3]=k[1])}const B=Math.abs(L[2]-L[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,B),r.pixelRatioAdjustment=r.mapUnitsPerPixel/B}_drawOverlays(e=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const t=!this._drawTexturesDirty&&this._drawTexturesAnimateDirty?0:1;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const r=this.renderer.computeValidity();this.renderer.releaseRenderTargets(t),this.renderer.drawOverlays(e,t);return r!==this.renderer.computeValidity()&&(this.terrainSurface.updateOverlayParameters(),this.terrainSurface.requestRender(1)),this.terrainSurface.requestRender(t),1===t&&this.terrainSurface.requestUpdate(),this.renderer}_pointIsInExtent(e,t){if(this.longitudeCyclical)return this.longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),j(e,s,i)}get test(){}};function te(e,t){const r=1e-5,s=G.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([l()],ee.prototype,"_spatialReference",void 0),e([l({readOnly:!0})],ee.prototype,"readyToRun",null),e([l()],ee.prototype,"_placementDirty",void 0),e([l()],ee.prototype,"_contentUpdated",void 0),e([l()],ee.prototype,"_isSpherical",null),e([l()],ee.prototype,"worldToPCSRatio",null),e([l()],ee.prototype,"renderer",void 0),e([l({constructOnly:!0})],ee.prototype,"view",void 0),e([l({constructOnly:!0})],ee.prototype,"terrainSurface",void 0),e([l()],ee.prototype,"suspended",null),e([l()],ee.prototype,"updating",null),ee=e([h("esri.views.3d.terrain.OverlayManager")],ee);class re{constructor(){this.inner=R(),this.outer=R(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=K}}const se=x(),ie=g(),ne=new re,ae=R(),oe=R(),le=I();export{ee as OverlayManager};
|