@arcgis/core 4.24.0-next.20220520 → 4.24.0-next.20220521
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/{26646a7545a194e67441.js → 27572edd67242e1b6646.js} +1 -1
- package/assets/esri/core/workers/chunks/{d94c5f36d52cf71f0bb9.js → 27f974dae930eb12fe38.js} +1 -1
- package/assets/esri/core/workers/chunks/2b708cc5ba0edd6c80e1.js +1 -0
- package/assets/esri/core/workers/chunks/{c5fadaa98749ffb490f5.js → 3c258ac11c963b7d9509.js} +1 -1
- package/assets/esri/core/workers/chunks/40d70d446abe357d6f43.js +1 -0
- package/assets/esri/core/workers/chunks/5cf2064bfd9d0847d9ec.js +1 -0
- package/assets/esri/core/workers/chunks/{f5089121d845ec594008.js → 6ac32325a961f1cf3c1b.js} +1 -1
- package/assets/esri/core/workers/chunks/{1c2805cc97dcee70e60d.js → 816ae3f0513ecf856f8f.js} +1 -1
- package/assets/esri/core/workers/chunks/{8033531b0cc706b40d86.js → 8523d45cf4765eddc380.js} +1 -1
- package/assets/esri/core/workers/chunks/{a5ee17cdc9eb23ebeaf0.js → 85f2f6a50cf1b6c7ce82.js} +1 -1
- package/assets/esri/core/workers/chunks/{c40d9caf5189be2c698e.js → 87b83dfce3ee252aba94.js} +1 -1
- package/assets/esri/core/workers/chunks/{6e48b0db65bcaaace838.js → 8cd8dad8bcd5c0ef445e.js} +1 -1
- package/assets/esri/core/workers/chunks/{54711b8a98104eeec833.js → 8ec860742695e5bbbcb2.js} +1 -1
- package/assets/esri/core/workers/chunks/{e51f0e71f2a55af604d3.js → 93c4e01b237a6b3f871f.js} +1 -1
- package/assets/esri/core/workers/chunks/{3e94e35f44aadbb332ff.js → aae70408958f6ee7279e.js} +1 -1
- package/assets/esri/core/workers/chunks/{7e150c38e25fbb8bacaf.js → b476a80ef81c211685be.js} +1 -1
- package/assets/esri/core/workers/chunks/b8db486a3dba68a8030a.js +1 -0
- package/assets/esri/core/workers/chunks/{82b6535a30287c74ba13.js → c0e6dbecdbd30066a82c.js} +1 -1
- package/assets/esri/core/workers/chunks/{66e8a253312d72a8e7f9.js → c4115e8d1eb2ca6bb605.js} +1 -1
- package/assets/esri/core/workers/chunks/cd04bae81e5fc27ec97b.js +1 -0
- package/assets/esri/core/workers/chunks/{24217129d492e170f0f0.js → f668ccaf8bd0be0ab57b.js} +1 -1
- package/core/CollectionFlattener.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/interfaces.d.ts +78 -2
- package/layers/FeatureLayer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/graphics/sources/OGCFeatureSource.js +1 -1
- package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/refresh.js +1 -1
- package/layers/support/FeatureReductionCluster.js +1 -1
- package/layers/support/capabilities.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/animatedFormats/BaseAnimatableTextureResource.js +1 -1
- package/views/2d/engine/webgl/animatedFormats/apng.js +1 -1
- package/views/2d/engine/webgl/animatedFormats/gif.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/schemaUtils.js +1 -1
- package/views/SceneView.js +1 -1
- package/assets/esri/core/workers/chunks/128f461007ef039d4f73.js +0 -1
- package/assets/esri/core/workers/chunks/672da24bbf86718bf48d.js +0 -1
- package/assets/esri/core/workers/chunks/824a700ba611e6c4fa9a.js +0 -1
- package/assets/esri/core/workers/chunks/be4bf1e4cbe2a593f8b3.js +0 -1
- package/assets/esri/core/workers/chunks/d6315aa9eedf79a7bca1.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import i from"../../../Graphic.js";import r from"../../../core/Collection.js";import s from"../../../core/Error.js";import a from"../../../core/has.js";import{clone as n}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{applySome as l,isSome as h,unwrap as u,isNone as d}from"../../../core/maybe.js";import{debounce as p,isAbortError as y}from"../../../core/promiseUtils.js";import{watch as c,whenOnce as f,initial as g}from"../../../core/reactiveUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import v from"../../../layers/effects/FeatureEffectView.js";import b from"../../../layers/support/FeatureFilter.js";import R from"../../../rest/support/FeatureSet.js";import S from"../../../rest/support/Query.js";import{MAX_FILTERS as w}from"../engine/webgl/definitions.js";import{LayerView2DMixin as x}from"./LayerView2D.js";import{createSchema as U}from"./features/schemaUtils.js";import{createOrReuseTileRenderer as F}from"./features/tileRenderers.js";import{isRendererSupported as C}from"./features/support/rendererUtils.js";import{findSizeVV as I,createClusterCountSizeVariable as E,isClusterCompatibleRenderer as O,createClusterRenderer as q,convertAggregateFieldFromPublic as T}from"./support/clusterUtils.js";import V from"./support/FeatureCommandQueue.js";import j from"./support/FeatureLayerProxy.js";import{toJSONGeometryType as N}from"./support/util.js";import{TileManager as P}from"../tiling/TileManager.js";import k from"../../layers/FeatureLayerView.js";import L from"../../layers/LayerView.js";import z from"../../layers/RefreshableLayerView.js";import{getWebGLCapabilities as H}from"../../webgl/capabilities.js";import J from"../../../geometry/Extent.js";function Q(e){return e&&"openPorts"in e}const A=o.getLogger("esri.views.2d.layers.FeatureLayerView2D");let M=class extends(k(z(x(L)))){constructor(){super(...arguments),this._pipelineIsUpdating=!0,this._commandsQueue=new V({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"refresh":return this._doRefresh(e.dataChanged);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightIds=new Map,this._updateHighlight=p((async()=>this._proxy.setHighlight(Array.from(this._highlightIds.keys())))),this._uploadsLocked=!1,this._needsClusterSizeUpdate=!1,this.featureEffectView=new v,this._lastDefinitionExpression=null}destroy(){l(this._updateClusterSizeTask,(e=>e.remove())),this._proxy?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(Promise.all([this._initProxy(),this._initServiceOptions()])),this.handles.add([this.on("valueRangesChanged",(e=>{this._set("_aggregateValueRanges",e.valueRanges)})),c((()=>this.featureEffect),(e=>{this.featureEffectView.featureEffect=e}),{initial:!0,sync:!0})])}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new s("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:this.layer});const t="feature"===e.type||"subtype-group"===e.type,i="capabilities"in e&&e.capabilities.operations.supportsQuery;if(t&&!i)throw new s("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._proxy&&this._proxy.destroy();const r=this._createClientOptions();return this._set("_proxy",new j({client:r})),this._proxy.when()}async _initServiceOptions(){return this._set("_serviceOptions",await this._createServiceOptions()),this._serviceOptions}get orderByFields(){return"stream"!==this._serviceOptions.type&&this._serviceOptions.orderByFields}get labelsVisible(){const e="subtype-group"===this.layer.type?this.layer.sublayers.items:[this.layer];return!this.suspended&&e.some((e=>e.labelingInfo&&e.labelsVisible))}get queryMode(){return this._serviceOptions.type}get renderingConfigHash(){if(!this.layer)return null;const e=this.availableFields,t=this.layer,i=this.view.floors,{definitionExpression:r}=t,s="subtype-group"!==this.layer.type&&this.layer.labelsVisible&&this.layer.labelingInfo,a="renderer"in t&&t.renderer,n="feature"===t.type?t.gdbVersion:void 0,o="feature"===t.type&&t.historicMoment?t.historicMoment.getTime():void 0,{timeExtent:l}=this,u="customParameters"in t?JSON.stringify(t.customParameters):void 0,d="apiKey"in t?t.apiKey:void 0,p="stream"===t.type?`${JSON.stringify(t.geometryDefinition)}${t.definitionExpression}`:null,y=JSON.stringify(this.clips),c=t.featureReduction&&t.featureReduction.toJSON(),f="orderBy"in this.layer&&JSON.stringify(this.layer.orderBy),g="sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),"");return JSON.stringify({orderBy:f,sublayerHash:g,filterHash:h(this.filter)&&this.filter.toJSON(),effectHash:h(this.featureEffect)&&this.featureEffect.toJSON(),streamFilter:p,gdbVersion:n,definitionExpression:r,historicMoment:o,availableFields:e,renderer:a,labelingInfo:s,timeExtent:l,floors:i,clipsHash:y,featureReduction:c,customParameters:u,apiKey:d})}highlight(e){let t;return e instanceof i?t=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?t=[e]:Array.isArray(e)&&e.length>0?t="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())):r.isCollection(e)&&e.length>0&&(t=e.map((e=>e?.getObjectId())).toArray()),t=t?.filter((e=>null!=e)),t&&t.length?(this._addHighlight(t),{remove:()=>this._removeHighlight(t)}):{remove:()=>{}}}hasHighlight(){return!!this._highlightIds.size}async hitTest(e,r){if(!this.tileRenderer)return null;const s=await this.tileRenderer.hitTest(r);if(0===s.length)return null;const{features:a,aggregates:n}=await this._proxy.getFeatures(s);return[...n.map((i=>this._createGraphicHit(e,t.fromJSON(i)))),...a.map((t=>this._createGraphicHit(e,i.fromJSON(t))))]}async queryAggregates(){return(await this._proxy.getAggregates()).map((e=>t.fromJSON(e)))}queryStatistics(){return this._proxy.queryStatistics()}async querySummaryStatistics(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.querySummaryStatistics(this._cleanUpQuery(e),r,i)}async queryUniqueValues(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryUniqueValues(this._cleanUpQuery(e),r,i)}async queryClassBreaks(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryClassBreaks(this._cleanUpQuery(e),r,i)}async queryHistogram(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryHistogram(this._cleanUpQuery(e),r,i)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=R.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryVisibleFeatures(e,t){return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e),t).then((e=>{const t=R.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryFeaturesJSON(e,t){return this._proxy.queryFeatures(this._cleanUpQuery(e),t)}queryObjectIds(e,t){return this._proxy.queryObjectIds(this._cleanUpQuery(e),t)}queryFeatureCount(e,t){return this._proxy.queryFeatureCount(this._cleanUpQuery(e),t)}queryExtent(e,t){return this._proxy.queryExtent(this._cleanUpQuery(e),t).then((e=>({count:e.count,extent:J.fromJSON(e.extent)})))}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._tileStrategy||!this.tileRenderer)return;const{hasMissingTiles:t,added:i,removed:r}=this._tileStrategy.update(e);(i.length||r.length)&&this._proxy.updateTiles({added:i,removed:r}),t&&this.requestUpdate(),this.notifyChange("updating")}attach(){this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._tileStrategy=new P({acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme,buffer:0}),this.handles.add(c((()=>this.renderingConfigHash),(()=>this._update()),g),"attach"),"stream"!==this.layer.type&&this.handles.add(this.layer.on("edits",(e=>this._edit(e))),"attach")}detach(){this._commandsQueue.clear(),this._proxy?.stop(),this.container.removeAllChildren(),this.handles.remove("attach"),this.tileRenderer&&(this.tileRenderer.uninstall(this.container),this.tileRenderer=null),this._tileStrategy&&(this._tileStrategy.destroy(),this._tileStrategy=null),this._tileRendererHash=null}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updating,i=null!=this._updatingRequiredFieldsPromise,r=!this._proxy||!this._proxy.isReady,s=this._pipelineIsUpdating,n=null==this.tileRenderer||this.tileRenderer?.updating,o=e&&(t||i||r||s||n);return a("esri-2d-log-updating")&&console.log(`Updating FLV2D: ${o}\n -> hasRenderer ${e}\n -> hasPendingCommand ${t}\n -> updatingRequiredFields ${i}\n -> updatingProxy ${r}\n -> updatingPipeline ${s}\n -> updatingTileRenderer ${n}\n`),o}_createClientOptions(){return{setUpdating:e=>{this._set("_pipelineIsUpdating",e)},emitEvent:e=>{this.emit(e.name,e.event)}}}async _detectQueryMode(e){const t="path"in e,i="editingInfo"in this.layer&&this.layer.editingInfo?.lastEditDate,r=!!this.layer.refreshInterval,s=!i&&r;if(t&&("feature"===this.layer.type||"subtype-group"===this.layer.type)&&"point"===this.layer.geometryType&&this.layer.capabilities.query.supportsPagination&&!this.layer.capabilities.operations.supportsEditing&&!s&&a("featurelayer-snapshot-enabled"))try{const e=await this.layer.queryFeatureCount();if(e<=a("featurelayer-snapshot-point-min-threshold"))return{mode:"snapshot",featureCount:e};const t=a("featurelayer-snapshot-point-max-threshold"),i=a("featurelayer-snapshot-point-coverage"),r=this.view.extent,s=u(this.layer.fullExtent),n=s?.clone().intersection(r),o=h(n)?n.width*n.height:0,l=s?.width*s?.height,d=0===l?0:o/l;if(e<=t&&d>=i)return{mode:"snapshot",featureCount:e}}catch(n){A.warn("mapview-feature-layer","Encountered an error when querying for featureCount",{error:n})}return{mode:"on-demand"}}async _createServiceOptions(){const e=this.layer;if("stream"===e.type)return null;const{capabilities:t,objectIdField:i}=e,r=e.fields.map((e=>e.toJSON())),s=h(e.fullExtent)&&e.fullExtent.toJSON(),a=N(e.geometryType),o=e.timeInfo&&e.timeInfo.toJSON()||null,l=e.spatialReference?e.spatialReference.toJSON():null,u="feature"===e.type?e.globalIdField:null;let d;"ogc-feature"===e.type?d=e.source.getFeatureDefinition():Q(e.source)?d=await e.source.openPorts():e.parsedUrl&&(d=n(e.parsedUrl),"dynamicDataSource"in e&&e.dynamicDataSource&&(d.query={layer:JSON.stringify({source:e.dynamicDataSource})}));const p="datesInUnknownTimezone"in this.layer&&this.layer.datesInUnknownTimezone,y=("subtypeField"in this.layer&&this.layer.subtypeField)??null,{mode:c,featureCount:f}=await this._detectQueryMode(d);let g=this.layer.objectIdField;if("feature"===this.layer.type&&h(this.layer.orderBy)&&this.layer.orderBy.length){const e=!this.layer.orderBy[0].valueExpression&&this.layer.orderBy[0].field;e&&(g=e)}return{type:c,timeReferenceUnknownClient:p,subtypeField:y,featureCount:f,globalIdField:u,maxRecordCount:t.query.maxRecordCount,tileMaxRecordCount:t.query.tileMaxRecordCount,capabilities:t,fields:r,fullExtent:s,geometryType:a,objectIdField:i,source:d,timeInfo:o,spatialReference:l,orderByFields:g}}async _createMemoryServiceOptions(e){const t=await e.openPorts();return{...this._createServiceOptions(),type:"memory",source:t}}_cleanUpQuery(e){const t=S.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.suspended)return void this._clearTiles();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}):void 0}async doRefresh(e){if(this._tileStrategy.tileKeys().length)return this.suspended&&e?void this._clearTiles():this._commandsQueue.push({type:"refresh",dataChanged:e})}_clearTiles(){this._tileStrategy.tileKeys().length&&(this._proxy.updateTiles({added:[],removed:this._tileStrategy.tileKeys()}),this._tileStrategy.clear(),this.requestUpdate(),this._commandsQueue.clear(),this._update())}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,i=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),r=t&&this.availableFields.includes(t);return i&&!r?(A.error(new s("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){try{if(this.destroyed||!this._hasRequiredSupport(this.layer)||!this._tileStrategy)return;const{featureEffectView:t,filter:i}=this;await this._updateRequiredFields();const{renderer:r}=this._getEffectiveRenderer();this._set("_effectiveRenderer",r);const s=this._createSchemaConfig(),a=this._createConfiguration(s,i,t.filter),n=this._lastDefinitionExpression!==a.definitionExpression;this._lastDefinitionExpression=a.definitionExpression;const o=a.schema.tileRenderer,l=this._createTileRendererHash(o);if("snapshot"===this._serviceOptions.type&&(a.schema.source.featureCount=this._serviceOptions.featureCount),l!==this._tileRendererHash){await this._initTileRenderer(o,r);const e=this.layer,t="stream"===e.type?await this._initServiceOptions():this._serviceOptions;this.tileRenderer.onConfigUpdate(r),"stream"!==e.type&&Q(e.source)&&(t.source=await e.source.openPorts());const i={added:this._tileStrategy.tileKeys(),removed:[]};await this._proxy.startup(this.view.featuresTilingScheme,a,t,i),this.hasHighlight()&&await this._proxy.setHighlight(Array.from(this._highlightIds.keys())),await this._onceTilesUpdated(),this.tileRenderer.onConfigUpdate(r)}else{"snapshot"===this._serviceOptions.type&&n&&(a.schema.source.featureCount=await this.layer.queryFeatureCount());const t=await this._proxy.update(a);(t.mesh||t.targets.aggregate)&&this._lockGPUUploads();try{await this._proxy.applyUpdate(t)}catch(e){y(e)||A.error(e)}(t.mesh||t.targets.aggregate)&&this._unlockGPUUploads(),this.tileRenderer.onConfigUpdate(r),this._updateClusterSizeVariable(),this._forceAttributeTextureUpload()}this._tileRendererHash=l,this.tileRenderer.invalidateLabels(),this.requestUpdate()}catch(e){}}async _doEdit(e){try{await this._proxy.onEdits(e)}catch(t){y(t),0}}async _doRefresh(e){this._lockGPUUploads();try{await this._proxy.refresh(e)}catch(t){y(t),0}this._unlockGPUUploads(),this.layer?.featureReduction&&this._updateClusterSizeVariable()}_updateClusterSizeVariable(){this._needsClusterSizeUpdate&&(this.tileRenderer.onConfigUpdate(this._effectiveRenderer),this._needsClusterSizeUpdate=!1)}_createUpdateClusterSizeTask(e,t){return c((()=>this._aggregateValueRanges),(i=>{this._updateClusterEffectiveRendererSizeVariable(e,t,i),this._needsClusterSizeUpdate=!0,this._uploadsLocked||this._updateClusterSizeVariable()}))}async _updateClusterEffectiveRendererSizeVariable(e,t,i){if(e.dynamicClusterSize&&"visualVariables"in e&&e.visualVariables){const r=I(e.visualVariables);if(h(r)&&"cluster_count"===r.field){const s=e.visualVariables.indexOf(r);e.visualVariables[s]=E(t,i);const a=e.clone();a.dynamicClusterSize=!0,this._set("_effectiveRenderer",a)}}}_getEffectiveRenderer(){const e="renderer"in this.layer&&this.layer.renderer,t=this.layer.featureReduction;if(h(this._updateClusterSizeTask)&&(this._updateClusterSizeTask.remove(),this._updateClusterSizeTask=null),t&&"cluster"===t.type&&O(e)){const i=t,r=[],s=q(r,e,i,this._aggregateValueRanges);return l(this._updateClusterSizeTask,(e=>e.remove())),this._updateClusterSizeTask=this._createUpdateClusterSizeTask(s,i),{renderer:s,aggregateFields:r,featureReduction:t}}if(t&&"binning"===t.type){const e=[];for(const i of t.fields)T(e,i);return{renderer:t.renderer,aggregateFields:e,featureReduction:t}}return{renderer:e,aggregateFields:[],featureReduction:null}}_acquireTile(e){const t=this.tileRenderer.acquireTile(e);return t.once("attach",(()=>{this.requestUpdate()})),t}_releaseTile(e){this.tileRenderer.releaseTile(e)}async _initTileRenderer(e,t){const i=await F(e,{layerView:this,tileInfoView:this.view.featuresTilingScheme,layer:this.layer});return this.tileRenderer&&(this._tileStrategy.clear(),this.tileRenderer.uninstall(this.container),this.tileRenderer.destroy(),this.tileRenderer=null),this.destroyed?null:(this._proxy.tileRenderer=i,this._set("tileRenderer",i),this.tileRenderer.install(this.container),this.tileRenderer.onConfigUpdate(t),this.requestUpdate(),this.tileRenderer)}_createTileRendererHash(e){return`${e.type}`}get hasFilter(){const e=!!("floorInfo"in this.layer&&this.layer.floorInfo&&this.view.floors&&this.view.floors.length);return!!this.filter||e||!!this._visibilityOverrides.size||!!this.timeExtent}_injectOverrides(e){const t=h(e)?e.timeExtent:null,i=h(this.timeExtent)&&h(t)?this.timeExtent.intersection(t):this.timeExtent||t;let r=null;const s="floorInfo"in this.layer&&this.layer.floorInfo;if(s){const t=h(e)&&e.where;r=this._addFloorFilterClause(t)}if(!this._visibilityOverrides.size&&!i&&!s)return h(e)?e.toJSON():null;(e=h(e)&&e.clone()||new b).timeExtent=i,r&&(e.where=r);const a=e.toJSON();return a.hiddenIds=Array.from(this._visibilityOverrides),a}_addFloorFilterClause(e){const t=this.layer;let i=e||"";if("floorInfo"in t&&t.floorInfo){let e=this.view.floors;if(!e||!e.length)return i;t.floorInfo.viewAllLevelIds?.length&&(e=t.floorInfo.viewAllLevelIds);const r=e.filter((e=>""!==e)).map((e=>"'"+e+"'"));r.push("''");const s=t.floorInfo.floorField;let a="("+s+" IN ({ids}) OR "+s+" IS NULL)";if(a=a.replace("{ids}",r.join(", ")),h(i)&&i.includes(s)){let e=new RegExp("AND \\("+s+".*NULL\\)","g");i=i.replace(e,""),e=new RegExp("\\("+s+".*NULL\\)","g"),i=i.replace(e,""),i=i.replace(/\s+/g," ").trim()}i=""!==i?"("+i+") AND "+a:a}return""!==i?i:null}_createConfiguration(e,t,i){const r="feature"===this.layer.type&&this.layer.historicMoment?this.layer.historicMoment.getTime():void 0,s="feature"===this.layer.type?this.layer.gdbVersion:void 0,a=new Array(w),n=this._injectOverrides(t);a[0]=n,a[1]=h(i)?i.toJSON():null;const o=U(e);if(d(o))return null;const l=H("2d");return{definitionExpression:this.layer.definitionExpression,availableFields:this.availableFields,gdbVersion:s,historicMoment:r,devicePixelRatio:window.devicePixelRatio||1,filters:a,schema:o,supportsTextureFloat:l.supportsTextureFloat,maxTextureSize:l.maxTextureSize}}_hasRequiredSupport(e){return!("renderer"in e)||C(e.renderer)}_onceTilesUpdated(){return this.requestUpdate(),f((()=>!this._pipelineIsUpdating))}_lockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!0,this.tileRenderer.lockGPUUploads())}_unlockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!1,this.tileRenderer.unlockGPUUploads())}_forceAttributeTextureUpload(){this.tileRenderer&&this.tileRenderer.forceAttributeTextureUpload()}_createSchemaConfig(){const e="feature"===this.layer.type?this.layer.historicMoment:null,t="feature"===this.layer.type?this.layer.gdbVersion:null;return{renderer:"renderer"in this.layer&&this.layer.renderer,spatialReference:this.layer.spatialReference,timeExtent:this.layer.timeExtent,definitionExpression:this.layer.definitionExpression,featureReduction:this.layer.featureReduction,fields:this.layer.fields,geometryType:this.layer.geometryType,historicMoment:e,labelsVisible:"labelsVisible"in this.layer&&this.layer.labelsVisible,labelingInfo:"labelingInfo"in this.layer&&this.layer.labelingInfo,availableFields:this.availableFields,featureEffect:this.featureEffect,filter:this.filter,gdbVersion:t,pixelBuffer:0,orderBy:"orderBy"in this.layer&&this.layer.orderBy?this.layer.orderBy:null,customParameters:{..."customParameters"in this.layer?this.layer.customParameters:void 0,token:"apiKey"in this.layer?this.layer.apiKey:void 0}}}_addHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t);this._highlightIds.set(t,e+1)}else this._highlightIds.set(t,1);this._updateHighlight().catch((e=>{y(e)||A.error(e)}))}_removeHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t)-1;0===e?this._highlightIds.delete(t):this._highlightIds.set(t,e)}this._updateHighlight().catch((e=>{y(e)||A.error(e)}))}_setLayersForFeature(e){const t=this.layer;e.layer=t,e.sourceLayer=t}_createGraphicHit(e,t){return this._setLayersForFeature(t),h(t.geometry)&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};e([m()],M.prototype,"_serviceOptions",void 0),e([m()],M.prototype,"_proxy",void 0),e([m()],M.prototype,"_pipelineIsUpdating",void 0),e([m()],M.prototype,"_effectiveRenderer",void 0),e([m()],M.prototype,"_aggregateValueRanges",void 0),e([m()],M.prototype,"_commandsQueue",void 0),e([m()],M.prototype,"featureEffectView",void 0),e([m()],M.prototype,"labelsVisible",null),e([m({readOnly:!0})],M.prototype,"queryMode",null),e([m()],M.prototype,"renderingConfigHash",null),e([m()],M.prototype,"tileRenderer",void 0),e([m()],M.prototype,"updating",void 0),M=e([_("esri.views.2d.layers.FeatureLayerView2D")],M);const B=M;export{B as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import i from"../../../Graphic.js";import r from"../../../core/Collection.js";import s from"../../../core/Error.js";import a from"../../../core/has.js";import{clone as n}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{applySome as l,isSome as h,unwrap as u,isNone as d}from"../../../core/maybe.js";import{debounce as p,isAbortError as y}from"../../../core/promiseUtils.js";import{watch as c,whenOnce as f,initial as g}from"../../../core/reactiveUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import v from"../../../layers/effects/FeatureEffectView.js";import b from"../../../layers/support/FeatureFilter.js";import R from"../../../rest/support/FeatureSet.js";import S from"../../../rest/support/Query.js";import{MAX_FILTERS as w}from"../engine/webgl/definitions.js";import{LayerView2DMixin as x}from"./LayerView2D.js";import{createSchema as U}from"./features/schemaUtils.js";import{createOrReuseTileRenderer as F}from"./features/tileRenderers.js";import{isRendererSupported as C}from"./features/support/rendererUtils.js";import{findSizeVV as I,createClusterCountSizeVariable as E,convertAggregateFieldFromPublic as O,isClusterCompatibleRenderer as q,createClusterRenderer as T}from"./support/clusterUtils.js";import V from"./support/FeatureCommandQueue.js";import j from"./support/FeatureLayerProxy.js";import{toJSONGeometryType as N}from"./support/util.js";import{TileManager as P}from"../tiling/TileManager.js";import k from"../../layers/FeatureLayerView.js";import L from"../../layers/LayerView.js";import z from"../../layers/RefreshableLayerView.js";import{getWebGLCapabilities as H}from"../../webgl/capabilities.js";import J from"../../../geometry/Extent.js";function Q(e){return e&&"openPorts"in e}const A=o.getLogger("esri.views.2d.layers.FeatureLayerView2D");let M=class extends(k(z(x(L)))){constructor(){super(...arguments),this._pipelineIsUpdating=!0,this._commandsQueue=new V({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"refresh":return this._doRefresh(e.dataChanged);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightIds=new Map,this._updateHighlight=p((async()=>this._proxy.setHighlight(Array.from(this._highlightIds.keys())))),this._uploadsLocked=!1,this._needsClusterSizeUpdate=!1,this.featureEffectView=new v,this._lastDefinitionExpression=null}destroy(){l(this._updateClusterSizeTask,(e=>e.remove())),this._proxy?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(Promise.all([this._initProxy(),this._initServiceOptions()])),this.handles.add([this.on("valueRangesChanged",(e=>{this._set("_aggregateValueRanges",e.valueRanges)})),c((()=>this.featureEffect),(e=>{this.featureEffectView.featureEffect=e}),{initial:!0,sync:!0})])}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new s("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:this.layer});const t="feature"===e.type||"subtype-group"===e.type,i="capabilities"in e&&e.capabilities.operations.supportsQuery;if(t&&!i)throw new s("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._proxy&&this._proxy.destroy();const r=this._createClientOptions();return this._set("_proxy",new j({client:r})),this._proxy.when()}async _initServiceOptions(){return this._set("_serviceOptions",await this._createServiceOptions()),this._serviceOptions}get orderByFields(){return"stream"!==this._serviceOptions.type&&this._serviceOptions.orderByFields}get labelsVisible(){const e="subtype-group"===this.layer.type?this.layer.sublayers.items:[this.layer];return!this.suspended&&e.some((e=>e.labelingInfo&&e.labelsVisible))}get queryMode(){return this._serviceOptions.type}get renderingConfigHash(){if(!this.layer)return null;const e=this.availableFields,t=this.layer,i=this.view.floors,{definitionExpression:r}=t,s="subtype-group"!==this.layer.type&&this.layer.labelsVisible&&this.layer.labelingInfo,a="renderer"in t&&t.renderer,n="feature"===t.type?t.gdbVersion:void 0,o="feature"===t.type&&t.historicMoment?t.historicMoment.getTime():void 0,{timeExtent:l}=this,u="customParameters"in t?JSON.stringify(t.customParameters):void 0,d="apiKey"in t?t.apiKey:void 0,p="stream"===t.type?`${JSON.stringify(t.geometryDefinition)}${t.definitionExpression}`:null,y=JSON.stringify(this.clips),c=t.featureReduction&&t.featureReduction.toJSON(),f="orderBy"in this.layer&&JSON.stringify(this.layer.orderBy),g="sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),"");return JSON.stringify({orderBy:f,sublayerHash:g,filterHash:h(this.filter)&&this.filter.toJSON(),effectHash:h(this.featureEffect)&&this.featureEffect.toJSON(),streamFilter:p,gdbVersion:n,definitionExpression:r,historicMoment:o,availableFields:e,renderer:a,labelingInfo:s,timeExtent:l,floors:i,clipsHash:y,featureReduction:c,customParameters:u,apiKey:d})}highlight(e){let t;return e instanceof i?t=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?t=[e]:Array.isArray(e)&&e.length>0?t="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())):r.isCollection(e)&&e.length>0&&(t=e.map((e=>e?.getObjectId())).toArray()),t=t?.filter((e=>null!=e)),t&&t.length?(this._addHighlight(t),{remove:()=>this._removeHighlight(t)}):{remove:()=>{}}}hasHighlight(){return!!this._highlightIds.size}async hitTest(e,r){if(!this.tileRenderer)return null;const s=await this.tileRenderer.hitTest(r);if(0===s.length)return null;const{features:a,aggregates:n}=await this._proxy.getFeatures(s);return[...n.map((i=>this._createGraphicHit(e,t.fromJSON(i)))),...a.map((t=>this._createGraphicHit(e,i.fromJSON(t))))]}async queryAggregates(){return(await this._proxy.getAggregates()).map((e=>t.fromJSON(e)))}queryStatistics(){return this._proxy.queryStatistics()}async querySummaryStatistics(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.querySummaryStatistics(this._cleanUpQuery(e),r,i)}async queryUniqueValues(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryUniqueValues(this._cleanUpQuery(e),r,i)}async queryClassBreaks(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryClassBreaks(this._cleanUpQuery(e),r,i)}async queryHistogram(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryHistogram(this._cleanUpQuery(e),r,i)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=R.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryVisibleFeatures(e,t){return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e),t).then((e=>{const t=R.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryFeaturesJSON(e,t){return this._proxy.queryFeatures(this._cleanUpQuery(e),t)}queryObjectIds(e,t){return this._proxy.queryObjectIds(this._cleanUpQuery(e),t)}queryFeatureCount(e,t){return this._proxy.queryFeatureCount(this._cleanUpQuery(e),t)}queryExtent(e,t){return this._proxy.queryExtent(this._cleanUpQuery(e),t).then((e=>({count:e.count,extent:J.fromJSON(e.extent)})))}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._tileStrategy||!this.tileRenderer)return;const{hasMissingTiles:t,added:i,removed:r}=this._tileStrategy.update(e);(i.length||r.length)&&this._proxy.updateTiles({added:i,removed:r}),t&&this.requestUpdate(),this.notifyChange("updating")}attach(){this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._tileStrategy=new P({acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme,buffer:0}),this.handles.add(c((()=>this.renderingConfigHash),(()=>this._update()),g),"attach"),"stream"!==this.layer.type&&this.handles.add(this.layer.on("edits",(e=>this._edit(e))),"attach")}detach(){this._commandsQueue.clear(),this._proxy?.stop(),this.container.removeAllChildren(),this.handles.remove("attach"),this.tileRenderer&&(this.tileRenderer.uninstall(this.container),this.tileRenderer=null),this._tileStrategy&&(this._tileStrategy.destroy(),this._tileStrategy=null),this._tileRendererHash=null}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updating,i=null!=this._updatingRequiredFieldsPromise,r=!this._proxy||!this._proxy.isReady,s=this._pipelineIsUpdating,n=null==this.tileRenderer||this.tileRenderer?.updating,o=e&&(t||i||r||s||n);return a("esri-2d-log-updating")&&console.log(`Updating FLV2D: ${o}\n -> hasRenderer ${e}\n -> hasPendingCommand ${t}\n -> updatingRequiredFields ${i}\n -> updatingProxy ${r}\n -> updatingPipeline ${s}\n -> updatingTileRenderer ${n}\n`),o}_createClientOptions(){return{setUpdating:e=>{this._set("_pipelineIsUpdating",e)},emitEvent:e=>{this.emit(e.name,e.event)}}}async _detectQueryMode(e){const t="path"in e,i="editingInfo"in this.layer&&this.layer.editingInfo?.lastEditDate,r=!!this.layer.refreshInterval,s=!i&&r;if(t&&("feature"===this.layer.type||"subtype-group"===this.layer.type)&&"point"===this.layer.geometryType&&this.layer.capabilities.query.supportsPagination&&!this.layer.capabilities.operations.supportsEditing&&!s&&a("featurelayer-snapshot-enabled"))try{const e=await this.layer.queryFeatureCount();if(e<=a("featurelayer-snapshot-point-min-threshold"))return{mode:"snapshot",featureCount:e};const t=a("featurelayer-snapshot-point-max-threshold"),i=a("featurelayer-snapshot-point-coverage"),r=this.view.extent,s=u(this.layer.fullExtent),n=s?.clone().intersection(r),o=h(n)?n.width*n.height:0,l=s?.width*s?.height,d=0===l?0:o/l;if(e<=t&&d>=i)return{mode:"snapshot",featureCount:e}}catch(n){A.warn("mapview-feature-layer","Encountered an error when querying for featureCount",{error:n})}return{mode:"on-demand"}}async _createServiceOptions(){const e=this.layer;if("stream"===e.type)return null;const{capabilities:t,objectIdField:i}=e,r=e.fields.map((e=>e.toJSON())),s=h(e.fullExtent)&&e.fullExtent.toJSON(),a=N(e.geometryType),o=e.timeInfo&&e.timeInfo.toJSON()||null,l=e.spatialReference?e.spatialReference.toJSON():null,u="feature"===e.type?e.globalIdField:null;let d;"ogc-feature"===e.type?d=e.source.getFeatureDefinition():Q(e.source)?d=await e.source.openPorts():e.parsedUrl&&(d=n(e.parsedUrl),"dynamicDataSource"in e&&e.dynamicDataSource&&(d.query={layer:JSON.stringify({source:e.dynamicDataSource})}));const p="datesInUnknownTimezone"in this.layer&&this.layer.datesInUnknownTimezone,y=("subtypeField"in this.layer&&this.layer.subtypeField)??null,{mode:c,featureCount:f}=await this._detectQueryMode(d);let g=this.layer.objectIdField;if("feature"===this.layer.type&&h(this.layer.orderBy)&&this.layer.orderBy.length){const e=!this.layer.orderBy[0].valueExpression&&this.layer.orderBy[0].field;e&&(g=e)}return{type:c,timeReferenceUnknownClient:p,subtypeField:y,featureCount:f,globalIdField:u,maxRecordCount:t.query.maxRecordCount,tileMaxRecordCount:t.query.tileMaxRecordCount,capabilities:t,fields:r,fullExtent:s,geometryType:a,objectIdField:i,source:d,timeInfo:o,spatialReference:l,orderByFields:g}}async _createMemoryServiceOptions(e){const t=await e.openPorts();return{...this._createServiceOptions(),type:"memory",source:t}}_cleanUpQuery(e){const t=S.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.suspended)return void this._clearTiles();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}):void 0}async doRefresh(e){if(this._tileStrategy.tileKeys().length)return this.suspended&&e?void this._clearTiles():this._commandsQueue.push({type:"refresh",dataChanged:e})}_clearTiles(){this._tileStrategy.tileKeys().length&&(this._proxy.updateTiles({added:[],removed:this._tileStrategy.tileKeys()}),this._tileStrategy.clear(),this.requestUpdate(),this._commandsQueue.clear(),this._update())}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,i=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),r=t&&this.availableFields.includes(t);return i&&!r?(A.error(new s("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){try{if(this.destroyed||!this._hasRequiredSupport(this.layer)||!this._tileStrategy)return;const{featureEffectView:t,filter:i}=this;await this._updateRequiredFields();const{renderer:r}=this._getEffectiveRenderer();this._set("_effectiveRenderer",r);const s=this._createSchemaConfig(),a=this._createConfiguration(s,i,t.filter),n=this._lastDefinitionExpression!==a.definitionExpression;this._lastDefinitionExpression=a.definitionExpression;const o=a.schema.tileRenderer,l=this._createTileRendererHash(o);if("snapshot"===this._serviceOptions.type&&(a.schema.source.featureCount=this._serviceOptions.featureCount),l!==this._tileRendererHash){await this._initTileRenderer(o,r);const e=this.layer,t="stream"===e.type?await this._initServiceOptions():this._serviceOptions;this.tileRenderer.onConfigUpdate(r),"stream"!==e.type&&Q(e.source)&&(t.source=await e.source.openPorts());const i={added:this._tileStrategy.tileKeys(),removed:[]};await this._proxy.startup(this.view.featuresTilingScheme,a,t,i),this.hasHighlight()&&await this._proxy.setHighlight(Array.from(this._highlightIds.keys())),await this._onceTilesUpdated(),this.tileRenderer.onConfigUpdate(r)}else{"snapshot"===this._serviceOptions.type&&n&&(a.schema.source.featureCount=await this.layer.queryFeatureCount());const t=await this._proxy.update(a);(t.mesh||t.targets.aggregate)&&this._lockGPUUploads();try{await this._proxy.applyUpdate(t)}catch(e){y(e)||A.error(e)}(t.mesh||t.targets.aggregate)&&this._unlockGPUUploads(),this.tileRenderer.onConfigUpdate(r),this._updateClusterSizeVariable(),this._forceAttributeTextureUpload()}this._tileRendererHash=l,this.tileRenderer.invalidateLabels(),this.requestUpdate()}catch(e){}}async _doEdit(e){try{await this._proxy.onEdits(e)}catch(t){y(t),0}}async _doRefresh(e){this._lockGPUUploads();try{await this._proxy.refresh(e)}catch(t){y(t),0}this._unlockGPUUploads(),this.layer?.featureReduction&&this._updateClusterSizeVariable()}_updateClusterSizeVariable(){this._needsClusterSizeUpdate&&(this.tileRenderer.onConfigUpdate(this._effectiveRenderer),this._needsClusterSizeUpdate=!1)}_createUpdateClusterSizeTask(e,t){return c((()=>this._aggregateValueRanges),(i=>{this._updateClusterEffectiveRendererSizeVariable(e,t,i),this._needsClusterSizeUpdate=!0,this._uploadsLocked||this._updateClusterSizeVariable()}))}async _updateClusterEffectiveRendererSizeVariable(e,t,i){if(e.dynamicClusterSize&&"visualVariables"in e&&e.visualVariables){const r=I(e.visualVariables);if(h(r)&&"cluster_count"===r.field){const s=e.visualVariables.indexOf(r);e.visualVariables[s]=E(t,i);const a=e.clone();a.dynamicClusterSize=!0,this._set("_effectiveRenderer",a)}}}_getEffectiveRenderer(){const e="renderer"in this.layer&&this.layer.renderer,t=this.layer.featureReduction;if(h(this._updateClusterSizeTask)&&(this._updateClusterSizeTask.remove(),this._updateClusterSizeTask=null),t&&"renderer"in t&&t.renderer){const e=[];for(const i of t.fields??[])O(e,i);return{renderer:t.renderer,aggregateFields:e,featureReduction:t}}if(t&&"cluster"===t.type&&q(e)){const i=t,r=[],s=T(r,e,i,this._aggregateValueRanges);return l(this._updateClusterSizeTask,(e=>e.remove())),this._updateClusterSizeTask=this._createUpdateClusterSizeTask(s,i),{renderer:s,aggregateFields:r,featureReduction:t}}return{renderer:e,aggregateFields:[],featureReduction:null}}_acquireTile(e){const t=this.tileRenderer.acquireTile(e);return t.once("attach",(()=>{this.requestUpdate()})),t}_releaseTile(e){this.tileRenderer.releaseTile(e)}async _initTileRenderer(e,t){const i=await F(e,{layerView:this,tileInfoView:this.view.featuresTilingScheme,layer:this.layer});return this.tileRenderer&&(this._tileStrategy.clear(),this.tileRenderer.uninstall(this.container),this.tileRenderer.destroy(),this.tileRenderer=null),this.destroyed?null:(this._proxy.tileRenderer=i,this._set("tileRenderer",i),this.tileRenderer.install(this.container),this.tileRenderer.onConfigUpdate(t),this.requestUpdate(),this.tileRenderer)}_createTileRendererHash(e){return`${e.type}`}get hasFilter(){const e=!!("floorInfo"in this.layer&&this.layer.floorInfo&&this.view.floors&&this.view.floors.length);return!!this.filter||e||!!this._visibilityOverrides.size||!!this.timeExtent}_injectOverrides(e){const t=h(e)?e.timeExtent:null,i=h(this.timeExtent)&&h(t)?this.timeExtent.intersection(t):this.timeExtent||t;let r=null;const s="floorInfo"in this.layer&&this.layer.floorInfo;if(s){const t=h(e)&&e.where;r=this._addFloorFilterClause(t)}if(!this._visibilityOverrides.size&&!i&&!s)return h(e)?e.toJSON():null;(e=h(e)&&e.clone()||new b).timeExtent=i,r&&(e.where=r);const a=e.toJSON();return a.hiddenIds=Array.from(this._visibilityOverrides),a}_addFloorFilterClause(e){const t=this.layer;let i=e||"";if("floorInfo"in t&&t.floorInfo){let e=this.view.floors;if(!e||!e.length)return i;t.floorInfo.viewAllLevelIds?.length&&(e=t.floorInfo.viewAllLevelIds);const r=e.filter((e=>""!==e)).map((e=>"'"+e+"'"));r.push("''");const s=t.floorInfo.floorField;let a="("+s+" IN ({ids}) OR "+s+" IS NULL)";if(a=a.replace("{ids}",r.join(", ")),h(i)&&i.includes(s)){let e=new RegExp("AND \\("+s+".*NULL\\)","g");i=i.replace(e,""),e=new RegExp("\\("+s+".*NULL\\)","g"),i=i.replace(e,""),i=i.replace(/\s+/g," ").trim()}i=""!==i?"("+i+") AND "+a:a}return""!==i?i:null}_createConfiguration(e,t,i){const r="feature"===this.layer.type&&this.layer.historicMoment?this.layer.historicMoment.getTime():void 0,s="feature"===this.layer.type?this.layer.gdbVersion:void 0,a=new Array(w),n=this._injectOverrides(t);a[0]=n,a[1]=h(i)?i.toJSON():null;const o=U(e);if(d(o))return null;const l=H("2d");return{definitionExpression:this.layer.definitionExpression,availableFields:this.availableFields,gdbVersion:s,historicMoment:r,devicePixelRatio:window.devicePixelRatio||1,filters:a,schema:o,supportsTextureFloat:l.supportsTextureFloat,maxTextureSize:l.maxTextureSize}}_hasRequiredSupport(e){return!("renderer"in e)||C(e.renderer)}_onceTilesUpdated(){return this.requestUpdate(),f((()=>!this._pipelineIsUpdating))}_lockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!0,this.tileRenderer.lockGPUUploads())}_unlockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!1,this.tileRenderer.unlockGPUUploads())}_forceAttributeTextureUpload(){this.tileRenderer&&this.tileRenderer.forceAttributeTextureUpload()}_createSchemaConfig(){const e="feature"===this.layer.type?this.layer.historicMoment:null,t="feature"===this.layer.type?this.layer.gdbVersion:null;return{renderer:"renderer"in this.layer&&this.layer.renderer,spatialReference:this.layer.spatialReference,timeExtent:this.layer.timeExtent,definitionExpression:this.layer.definitionExpression,featureReduction:this.layer.featureReduction,fields:this.layer.fields,geometryType:this.layer.geometryType,historicMoment:e,labelsVisible:"labelsVisible"in this.layer&&this.layer.labelsVisible,labelingInfo:"labelingInfo"in this.layer&&this.layer.labelingInfo,availableFields:this.availableFields,featureEffect:this.featureEffect,filter:this.filter,gdbVersion:t,pixelBuffer:0,orderBy:"orderBy"in this.layer&&this.layer.orderBy?this.layer.orderBy:null,customParameters:{..."customParameters"in this.layer?this.layer.customParameters:void 0,token:"apiKey"in this.layer?this.layer.apiKey:void 0}}}_addHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t);this._highlightIds.set(t,e+1)}else this._highlightIds.set(t,1);this._updateHighlight().catch((e=>{y(e)||A.error(e)}))}_removeHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t)-1;0===e?this._highlightIds.delete(t):this._highlightIds.set(t,e)}this._updateHighlight().catch((e=>{y(e)||A.error(e)}))}_setLayersForFeature(e){const t=this.layer;e.layer=t,e.sourceLayer=t}_createGraphicHit(e,t){return this._setLayersForFeature(t),h(t.geometry)&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};e([m()],M.prototype,"_serviceOptions",void 0),e([m()],M.prototype,"_proxy",void 0),e([m()],M.prototype,"_pipelineIsUpdating",void 0),e([m()],M.prototype,"_effectiveRenderer",void 0),e([m()],M.prototype,"_aggregateValueRanges",void 0),e([m()],M.prototype,"_commandsQueue",void 0),e([m()],M.prototype,"featureEffectView",void 0),e([m()],M.prototype,"labelsVisible",null),e([m({readOnly:!0})],M.prototype,"queryMode",null),e([m()],M.prototype,"renderingConfigHash",null),e([m()],M.prototype,"tileRenderer",void 0),e([m()],M.prototype,"updating",void 0),M=e([_("esri.views.2d.layers.FeatureLayerView2D")],M);const B=M;export{B as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import t from"../../../../core/has.js";import{clone as r}from"../../../../core/lang.js";import i from"../../../../core/Logger.js";import{isSome as l,unwrap as n,isNone as s,unwrapOr as o}from"../../../../core/maybe.js";import{pt2px as a}from"../../../../core/screenUtils.js";import{WGLSymbologyType as u}from"../../engine/webgl/enums.js";import{getVVType as f}from"../../engine/webgl/Utils.js";import{getTechniqueFromRenderer as d}from"../../engine/webgl/techniques/utils.js";import{getVVFlags as p}from"../../engine/webgl/util/vvFlagUtils.js";import{createSymbolSchema as c}from"./createSymbolSchema.js";export{createSymbolSchema}from"./createSymbolSchema.js";import{getPtMaxVVSize as y}from"./support/pixelBuffering.js";import{getSupportedHeatmapRenderer as m,simplifyVisualVariables as g}from"./support/rendererUtils.js";import{convertAggregateFieldFromPublic as b,createClusterRenderer as x}from"../support/clusterUtils.js";import{toJSONGeometryType as h}from"../support/util.js";const v=i.getLogger("esri.views.2d.layers.features.schemaUtils"),w="ValidationError",T={esriGeometryPoint:["above-right","above-center","above-left","center-center","center-left","center-right","below-center","below-left","below-right"],esriGeometryPolygon:["always-horizontal"],esriGeometryPolyline:["center-along"],esriGeometryMultipoint:null};function E(e){return e}function I(e){let t=0,r=0,i=u.DEFAULT;if(l(e)){if(r=y(e),"visualVariables"in e&&(t=p(e.visualVariables||[]),"dot-density"===e.type&&(i=u.DOT_DENSITY)),"heatmap"===e.type&&(i=u.HEATMAP),"dictionary"===e.type)return{maxVVSize:r,vvFlags:t,symbologyType:u.DEFAULT};if("pie-chart"===e.type)return{maxVVSize:r,vvFlags:t,symbologyType:u.PIE_CHART};if(i!==u.DOT_DENSITY&&i!==u.HEATMAP){const t=e.getSymbols();"backgroundFillSymbol"in e&&e.backgroundFillSymbol&&t.push(e.backgroundFillSymbol);let r=!0,l=!0;for(const e of t)if("cim"===e.type&&(l=!1),"simple-fill"===e.type||"picture-fill"===e.type){const t=e.outline,i=t&&"none"!==t.style&&"solid"!==t.style,n="simple-fill"===e.type&&"none"!==e.style&&"solid"!==e.style,s="picture-fill"===e.type||n||i;i&&(r=!1),s&&(l=!1)}r?i=l?u.OUTLINE_FILL_SIMPLE:u.OUTLINE_FILL:l&&(i=u.SIMPLE)}}return{vvFlags:t,maxVVSize:r,symbologyType:i}}function S(t,r){const i=t.labelPlacement,l=T[r];if(!t.symbol)return v.warn("No ILabelClass symbol specified."),!0;if(!l)return v.error(new e("mapview-labeling:unsupported-geometry-type",`Unable to create labels for Feature Layer, ${r} is not supported`)),!0;if(!l.includes(i)){const e=l[0];i&&v.warn(`Found invalid label placement type ${i} for ${r}. Defaulting to ${e}`),t.labelPlacement=e}return!1}function F(e,t){const i=r(e);return i.some((e=>S(e,t)))?[]:i}function V(e){return t("esri-2d-update-debug")&&console.debug("Created new schema",z(e,!0)),z(e)}function z(e,t=!1){try{const r=B(e,t),i=C(e),l={};r.map((t=>N(l,e,t)));return{source:{definitionExpression:e.definitionExpression,fields:e.fields.map((e=>e.toJSON())),gdbVersion:e.gdbVersion,historicMoment:e.historicMoment?.getTime(),outFields:e.availableFields,pixelBuffer:e.pixelBuffer,spatialReference:e.spatialReference.toJSON(),timeExtent:e.timeExtent?.toJSON(),customParameters:e.customParameters},attributes:{fields:{},indexCount:0},processors:r,tileRenderer:i,targets:l}}catch(r){if(r.fieldName===w)return v.error(r),null;throw r}}function N(t,r,i){switch(i.target){case"feature":return void O(t,L(r),i);case"aggregate":{if(!("featureReduction"in r))return;const l=r.featureReduction;switch(l.type){case"selection":throw new e(w,"Mapview does not support `selection` reduction type",l);case"binning":return O(t,L(r),i),void j(t,l,i);case"cluster":return O(t,L(r),i),void R(t,l,i)}}}}function M(e,t){for(const r in t){const i=t[r];if(i.target!==e.name)continue;const l=e.attributes[r];l?(l.context.mesh=l.context.mesh||i.context.mesh,l.context.storage=l.context.storage||i.context.storage):e.attributes[r]=i}return e}function L(e){return[n(e.filter)?.toJSON()??null,n(n(e.featureEffect)?.filter)?.toJSON()??null]}function O(e,t,r){return e.feature||(e.feature={name:"feature",input:"source",filters:t,attributes:{}}),M(e.feature,r.attributes.fields),e}function j(e,t,r){return e.aggregate||(e.aggregate={name:"aggregate",type:"bin",filters:null,input:"feature",params:{fixedBinLevel:t.fixedBinLevel},attributes:{}}),M(e.aggregate,r.attributes.fields),e}function R(e,t,r){return e.aggregate||(e.aggregate={name:"aggregate",type:"cluster",input:"feature",filters:null,attributes:{},params:{clusterRadius:a(t.clusterRadius/2),clusterPixelBuffer:64*Math.ceil(a(t.clusterMaxSize)/64),fields:r.aggregateFields}}),M(e.aggregate,r.attributes.fields),e}function P(e,t){return t.field?k(e,{...t,type:"field",field:t.field}):t.valueExpression?k(e,{...t,type:"expression",valueExpression:t.valueExpression}):{field:null,fieldIndex:null}}function k(e,t){switch(t.type){case"expression":{const r=E(t.valueExpression);if(!e.fields[r]){const i=e.indexCount++;e.fields[r]={...t,name:r,fieldIndex:i}}return{fieldIndex:e.fields[r].fieldIndex}}case"label-expression":{const r=E(JSON.stringify(t.label));if(!e.fields[r]){const i=e.indexCount++;e.fields[r]={...t,name:r,fieldIndex:i}}return{fieldIndex:e.fields[r].fieldIndex}}case"field":{const r=t.field;return"aggregate"===t.target&&e.fields[r]||(e.fields[r]={...t,name:r}),{field:r}}case"statistic":return e.fields[t.name]={...t},{field:t.name}}}function B(e,t=!1){const r=new Array;let i=0;return r.push(A(e,i++,t)),r}function U(e,t,r,i,l,n=!1){const s=k(t,{type:"label-expression",target:i,context:{mesh:!0},resultType:"string",label:{labelExpression:r.labelExpression,labelExpressionInfo:r.labelExpressionInfo?{expression:r.labelExpressionInfo.expression}:null,symbol:!!r.symbol,where:r.where}}),{fieldIndex:o}=s,a=I(e);return{...c(r,a,n),fieldIndex:o,target:i,index:l}}function D(t,r,i){const l="featureReduction"in r&&r.featureReduction;if(!l)return{fields:[],labels:[],matcher:null,rendererOverride:null};const n="aggregate",s=[];let o=null;const a=h(r.geometryType);let u=[],f=null;if(l)switch(l.type){case"selection":throw new e(w,"Mapview does not support `selection` reduction type",l);case"cluster":if(f=x(s,r.renderer,l,null),l.symbol){const e=I(f);o={type:"simple",symbol:c(l.symbol,e,i),symbologyType:e.symbologyType}}u=l&&l.labelsVisible&&l.labelingInfo||[];break;case"binning":for(const e of l.fields)b(s,e);f=l.renderer,o=H(null,n,l.renderer,i),u=l&&l.labelsVisible&&l.labelingInfo||[]}$(t,s);return{labels:F(u,a),matcher:o,fields:s,rendererOverride:f}}function A(t,r,i=!1){const n={indexCount:0,fields:{}},s="featureReduction"in t&&t.featureReduction?"aggregate":"feature";if("sublayers"in t){const r={type:"subtype",subtypeField:t.subtypeField,renderers:{},symbologyType:u.DEFAULT},o={type:"subtype",mapping:{},target:"feature"},a={type:"subtype",classes:{}},f={type:"symbol",target:"feature",aggregateFields:[],attributes:n,storage:o,mesh:{matcher:r,aggregateMatcher:null,labels:a,sortKey:null}},d=new Set;let p=0;for(const{renderer:u,subtypeCode:c,labelingInfo:y,labelsVisible:m}of t.sublayers){const t=H(n,s,u,i),f=_(n,s,u),g=m&&y;if("visualVariables"in u&&u.visualVariables&&u.visualVariables.length)throw new e(w,"Visual variables are currently not supported for subtype layers");if("dictionary"===t.type)throw new e(w,"Dictionary renderer is not supported in subtype layers");if("subtype"===t.type)throw new e(w,"Nested subtype renderers is not supported");if(l(f)&&"subtype"===f.type)throw new e(w,"Nested subtype storage is not supported");if(l(f)&&l(f.attributeMapping))throw new e(w,"Non-visual-variable attributes are not supported in subtype layers");if("heatmap"===t.type)throw new e(w,"Heatmaps are not supported in subtype layers");if("pie-chart"===t.type)throw new e(w,"Pie-charts are not supported in subtype layers");if(d.has(c))throw new e(w,"Subtype codes for sublayers must be unique");d.add(c),r.renderers[c]=t,o.mapping[c]=f,g&&(a.classes[c]=g.map((e=>U(u,n,e,"feature",p++,i))))}return f}if("heatmap"===t.renderer.type&&"raster"===m()){const{blurRadius:e,fieldOffset:r,field:i}=t.renderer;return{type:"heatmap",aggregateFields:[],attributes:n,target:s,storage:null,mesh:{blurRadius:e,fieldOffset:r,field:P(n,{target:s,field:i,resultType:"numeric"}).field}}}const o=D(n,t,i),a=h(t.geometryType),f=o.rendererOverride??t.renderer,d=H(n,s,f,i),p=_(n,s,f),c=J(n,t.orderBy),y=F(t.labelsVisible&&t.labelingInfo||[],a);let g=0;const b=[...y.map((e=>U(f,n,e,"feature",g++,i))),...o.labels.map((e=>U(f,n,e,"aggregate",g++,i)))];return{type:"symbol",target:s,attributes:n,aggregateFields:o.fields,storage:p,mesh:{matcher:d,labels:{type:"simple",classes:b},aggregateMatcher:o.matcher,sortKey:c}}}function C(e){return"heatmap"===e.renderer?.type&&"raster"===m()?{type:"heatmap"}:{type:"symbol"}}function J(t,r){if(s(r)||!r.length)return null;r.length>1&&v.warn(`Layer rendering currently only supports ordering by 1 orderByInfo, but found ${r.length}. All but the first will be discarded`);const i=r[0],l="ascending"===i.order?"asc":"desc";if(i.field)return{field:i.field,order:l};if(i.valueExpression){return{fieldIndex:k(t,{type:"expression",target:"feature",valueExpression:i.valueExpression,resultType:"numeric"}).fieldIndex,order:l}}return v.error(new e(w,"Expected to find a field or valueExpression for OrderByInfo",i)),null}function $(e,t){const r={mesh:!0,storage:!0};for(const i of t){const{name:t,outStatistic:l}=i,{statisticType:n,onStatisticField:s}=l;let o=null,a=null,u=null;const f="numeric",d="feature";if("onStatisticValueExpression"in l){a=k(e,{type:"expression",target:d,valueExpression:l.onStatisticValueExpression,resultType:f}).fieldIndex}else if("onStatisticNormalizationField"in l){o=k(e,{type:"field",target:d,field:s,resultType:f}).field,u=l.onStatisticNormalizationField}else{o=k(e,{type:"field",target:d,field:s,resultType:f}).field}k(e,{type:"statistic",target:"aggregate",name:t,context:r,inField:o,inNormalizationField:u,inFieldIndex:a,statisticType:n})}}function _(e,t,r){let i;switch(r.type){case"simple":case"class-breaks":case"unique-value":case"dictionary":i={visualVariables:!0,attributes:null};break;default:i=d(r).getStorageSpec(r)}return q(e,t,i,r)}function q(e,t,r,i){if(s(r))return null;const{visualVariables:n,attributes:o}=r;let a=null;n&&"visualVariables"in i&&(a=G(e,t,i.visualVariables));const u=l(a)?4:0;let f=null;return l(o)&&(f=o.map(((r,i)=>{const{field:l,fieldIndex:n}=P(e,{valueExpression:r.valueExpression,field:r.field,resultType:"numeric",target:t});return{binding:i+u,field:l,fieldIndex:n}}))),{type:"simple",target:t,attributeMapping:f,vvMapping:a}}function G(e,t,r){if(!r||!r.length)return[];const i={storage:!0},l="numeric";return g(r).map((r=>{const n=f(r.type),{field:s,fieldIndex:o}=P(e,{target:t,valueExpression:r.valueExpression,field:r.field,context:i,resultType:l});switch(r.type){case"size":return"$view.scale"===r.valueExpression?null:{type:"size",binding:n,field:s,fieldIndex:o,normalizationField:P(e,{target:t,field:r.normalizationField,context:i,resultType:l}).field,valueRepresentation:r.valueRepresentation??null};case"color":return{type:"color",binding:n,field:s,fieldIndex:o,normalizationField:P(e,{target:t,field:r.normalizationField,context:i,resultType:l}).field};case"opacity":return{type:"opacity",binding:n,field:s,fieldIndex:o,normalizationField:P(e,{target:t,field:r.normalizationField,context:i,resultType:l}).field};case"rotation":return{type:"rotation",binding:n,field:s,fieldIndex:o}}})).filter((e=>e))}function H(e,t,r,i=!1){const l=o(e,{indexCount:0,fields:{}});switch(r.type){case"simple":case"dot-density":return K(l,r,i);case"class-breaks":return Q(l,t,r,i);case"unique-value":return W(l,t,r,i);case"dictionary":return X(l,r,i);case"heatmap":return Z(l,r,i);case"pie-chart":return Y(l,r,i)}}function K(e,t,r=!1){const i=t.getSymbols(),l=i.length?i[0]:null,n=I(t);return{type:"simple",symbol:c(l,n,r),symbologyType:n.symbologyType}}function Y(e,t,r=!1){const i=t.getSymbols(),l=i[0],n=i.length>1?i[1]:null,s=I(t);return{type:"pie-chart",markerSymbol:c(l,s,r),fillSymbol:c(n,s,r),symbologyType:s.symbologyType}}function Q(e,t,r,i=!1){const l={mesh:!0,use:"renderer.field"},n=r.backgroundFillSymbol,{field:s,fieldIndex:o}=P(e,{target:t,field:r.field,valueExpression:r.valueExpression,resultType:"numeric",context:l}),a=r.normalizationType,u="log"===a?"esriNormalizeByLog":"percent-of-total"===a?"esriNormalizeByPercentOfTotal":"field"===a?"esriNormalizeByField":null,f=I(r),d=r.classBreakInfos.map((e=>({symbol:c(e.symbol,f,i),min:e.minValue,max:e.maxValue}))).sort(((e,t)=>e.min-t.min));return{type:"interval",attributes:e.fields,field:s,fieldIndex:o,backgroundFillSymbol:c(n,f,i),defaultSymbol:c(r.defaultSymbol,f,i),intervals:d,normalizationField:r.normalizationField,normalizationTotal:r.normalizationTotal,normalizationType:u,isMaxInclusive:r.isMaxInclusive,symbologyType:f.symbologyType}}function W(t,r,i,l=!1){const n=[],s=i.backgroundFillSymbol,o={target:r,context:{mesh:!0},resultType:"string"};if(i.field&&"string"!=typeof i.field)throw new e(w,"Expected renderer.field to be a string",i);const{field:a,fieldIndex:u}=P(t,{...o,field:i.field,valueExpression:i.valueExpression}),f=I(i);for(const e of i.uniqueValueInfos)n.push({value:""+e.value,symbol:c(e.symbol,f,l)});return{type:"map",attributes:t.fields,field:a,fieldIndex:u,field2:P(t,{...o,field:i.field2}).field,field3:P(t,{...o,field:i.field3}).field,fieldDelimiter:i.fieldDelimiter,backgroundFillSymbol:c(s,f),defaultSymbol:c(i.defaultSymbol,f),map:n,symbologyType:f.symbologyType}}function X(e,t,r=!1){const i=I(t);return{type:"dictionary",config:t.config,fieldMap:t.fieldMap,scaleExpression:t.scaleExpression,url:t.url,symbolOptions:i,symbologyType:i.symbologyType}}function Z(e,t,r=!1){const i=t.getSymbols(),l=i.length?i[0]:null,n=I(t);return{type:"heatmap",symbol:c(l,n,r),symbologyType:n.symbologyType}}export{$ as addAggregateFields,H as createMatcherSchema,P as createRendererAttributeSchema,V as createSchema,I as createSymbolSchemaOptions};
|
|
5
|
+
import e from"../../../../core/Error.js";import t from"../../../../core/has.js";import{clone as r}from"../../../../core/lang.js";import i from"../../../../core/Logger.js";import{isSome as l,unwrap as n,isNone as s,unwrapOr as o}from"../../../../core/maybe.js";import{pt2px as a}from"../../../../core/screenUtils.js";import{WGLSymbologyType as u}from"../../engine/webgl/enums.js";import{getVVType as f}from"../../engine/webgl/Utils.js";import{getTechniqueFromRenderer as d}from"../../engine/webgl/techniques/utils.js";import{getVVFlags as p}from"../../engine/webgl/util/vvFlagUtils.js";import{createSymbolSchema as c}from"./createSymbolSchema.js";export{createSymbolSchema}from"./createSymbolSchema.js";import{getPtMaxVVSize as y}from"./support/pixelBuffering.js";import{getSupportedHeatmapRenderer as m,simplifyVisualVariables as g}from"./support/rendererUtils.js";import{convertAggregateFieldFromPublic as b,createClusterRenderer as x}from"../support/clusterUtils.js";import{toJSONGeometryType as h}from"../support/util.js";const v=i.getLogger("esri.views.2d.layers.features.schemaUtils"),w="ValidationError",T={esriGeometryPoint:["above-right","above-center","above-left","center-center","center-left","center-right","below-center","below-left","below-right"],esriGeometryPolygon:["always-horizontal"],esriGeometryPolyline:["center-along"],esriGeometryMultipoint:null};function E(e){return e}function I(e){let t=0,r=0,i=u.DEFAULT;if(l(e)){if(r=y(e),"visualVariables"in e&&(t=p(e.visualVariables||[]),"dot-density"===e.type&&(i=u.DOT_DENSITY)),"heatmap"===e.type&&(i=u.HEATMAP),"dictionary"===e.type)return{maxVVSize:r,vvFlags:t,symbologyType:u.DEFAULT};if("pie-chart"===e.type)return{maxVVSize:r,vvFlags:t,symbologyType:u.PIE_CHART};if(i!==u.DOT_DENSITY&&i!==u.HEATMAP){const t=e.getSymbols();"backgroundFillSymbol"in e&&e.backgroundFillSymbol&&t.push(e.backgroundFillSymbol);let r=!0,l=!0;for(const e of t)if("cim"===e.type&&(l=!1),"simple-fill"===e.type||"picture-fill"===e.type){const t=e.outline,i=t&&"none"!==t.style&&"solid"!==t.style,n="simple-fill"===e.type&&"none"!==e.style&&"solid"!==e.style,s="picture-fill"===e.type||n||i;i&&(r=!1),s&&(l=!1)}r?i=l?u.OUTLINE_FILL_SIMPLE:u.OUTLINE_FILL:l&&(i=u.SIMPLE)}}return{vvFlags:t,maxVVSize:r,symbologyType:i}}function S(t,r){const i=t.labelPlacement,l=T[r];if(!t.symbol)return v.warn("No ILabelClass symbol specified."),!0;if(!l)return v.error(new e("mapview-labeling:unsupported-geometry-type",`Unable to create labels for Feature Layer, ${r} is not supported`)),!0;if(!l.includes(i)){const e=l[0];i&&v.warn(`Found invalid label placement type ${i} for ${r}. Defaulting to ${e}`),t.labelPlacement=e}return!1}function F(e,t){const i=r(e);return i.some((e=>S(e,t)))?[]:i}function V(e){return t("esri-2d-update-debug")&&console.debug("Created new schema",z(e,!0)),z(e)}function z(e,t=!1){try{const r=k(e,t),i=C(e),l={};r.map((t=>N(l,e,t)));return{source:{definitionExpression:e.definitionExpression,fields:e.fields.map((e=>e.toJSON())),gdbVersion:e.gdbVersion,historicMoment:e.historicMoment?.getTime(),outFields:e.availableFields,pixelBuffer:e.pixelBuffer,spatialReference:e.spatialReference.toJSON(),timeExtent:e.timeExtent?.toJSON(),customParameters:e.customParameters},attributes:{fields:{},indexCount:0},processors:r,tileRenderer:i,targets:l}}catch(r){if(r.fieldName===w)return v.error(r),null;throw r}}function N(t,r,i){switch(i.target){case"feature":return void O(t,L(r),i);case"aggregate":{if(!("featureReduction"in r))return;const l=r.featureReduction;switch(l.type){case"selection":throw new e(w,"Mapview does not support `selection` reduction type",l);case"binning":return O(t,L(r),i),void j(t,l,i);case"cluster":return O(t,L(r),i),void R(t,l,i)}}}}function M(e,t){for(const r in t){const i=t[r];if(i.target!==e.name)continue;const l=e.attributes[r];l?(l.context.mesh=l.context.mesh||i.context.mesh,l.context.storage=l.context.storage||i.context.storage):e.attributes[r]=i}return e}function L(e){return[n(e.filter)?.toJSON()??null,n(n(e.featureEffect)?.filter)?.toJSON()??null]}function O(e,t,r){return e.feature||(e.feature={name:"feature",input:"source",filters:t,attributes:{}}),M(e.feature,r.attributes.fields),e}function j(e,t,r){return e.aggregate||(e.aggregate={name:"aggregate",type:"bin",filters:null,input:"feature",params:{fixedBinLevel:t.fixedBinLevel},attributes:{}}),M(e.aggregate,r.attributes.fields),e}function R(e,t,r){return e.aggregate||(e.aggregate={name:"aggregate",type:"cluster",input:"feature",filters:null,attributes:{},params:{clusterRadius:a(t.clusterRadius/2),clusterPixelBuffer:64*Math.ceil(a(t.clusterMaxSize)/64),fields:r.aggregateFields}}),M(e.aggregate,r.attributes.fields),e}function P(e,t){return t.field?B(e,{...t,type:"field",field:t.field}):t.valueExpression?B(e,{...t,type:"expression",valueExpression:t.valueExpression}):{field:null,fieldIndex:null}}function B(e,t){switch(t.type){case"expression":{const r=E(t.valueExpression);if(!e.fields[r]){const i=e.indexCount++;e.fields[r]={...t,name:r,fieldIndex:i}}return{fieldIndex:e.fields[r].fieldIndex}}case"label-expression":{const r=E(JSON.stringify(t.label));if(!e.fields[r]){const i=e.indexCount++;e.fields[r]={...t,name:r,fieldIndex:i}}return{fieldIndex:e.fields[r].fieldIndex}}case"field":{const r=t.field;return"aggregate"===t.target&&e.fields[r]||(e.fields[r]={...t,name:r}),{field:r}}case"statistic":return e.fields[t.name]={...t},{field:t.name}}}function k(e,t=!1){const r=new Array;let i=0;return r.push(A(e,i++,t)),r}function U(e,t,r,i,l,n=!1){const s=B(t,{type:"label-expression",target:i,context:{mesh:!0},resultType:"string",label:{labelExpression:r.labelExpression,labelExpressionInfo:r.labelExpressionInfo?{expression:r.labelExpressionInfo.expression}:null,symbol:!!r.symbol,where:r.where}}),{fieldIndex:o}=s,a=I(e);return{...c(r,a,n),fieldIndex:o,target:i,index:l}}function D(t,r,i){const l="featureReduction"in r&&r.featureReduction;if(!l)return{fields:[],labels:[],matcher:null,rendererOverride:null};const n="aggregate",s=[];let o=null;const a=h(r.geometryType);let u=[],f=null;if(l)switch(l.type){case"selection":throw new e(w,"Mapview does not support `selection` reduction type",l);case"cluster":case"binning":if(l.renderer){for(const e of l.fields)b(s,e);f=l.renderer,o=H(null,n,l.renderer,i),u=l&&l.labelsVisible&&l.labelingInfo||[]}else if("cluster"===l.type){if(f=x(s,r.renderer,l,null),l.symbol){const e=I(f);o={type:"simple",symbol:c(l.symbol,e,i),symbologyType:e.symbologyType}}u=l&&l.labelsVisible&&l.labelingInfo||[]}}$(t,s);return{labels:F(u,a),matcher:o,fields:s,rendererOverride:f}}function A(t,r,i=!1){const n={indexCount:0,fields:{}},s="featureReduction"in t&&t.featureReduction?"aggregate":"feature";if("sublayers"in t){const r={type:"subtype",subtypeField:t.subtypeField,renderers:{},symbologyType:u.DEFAULT},o={type:"subtype",mapping:{},target:"feature"},a={type:"subtype",classes:{}},f={type:"symbol",target:"feature",aggregateFields:[],attributes:n,storage:o,mesh:{matcher:r,aggregateMatcher:null,labels:a,sortKey:null}},d=new Set;let p=0;for(const{renderer:u,subtypeCode:c,labelingInfo:y,labelsVisible:m}of t.sublayers){const t=H(n,s,u,i),f=_(n,s,u),g=m&&y;if("visualVariables"in u&&u.visualVariables&&u.visualVariables.length)throw new e(w,"Visual variables are currently not supported for subtype layers");if("dictionary"===t.type)throw new e(w,"Dictionary renderer is not supported in subtype layers");if("subtype"===t.type)throw new e(w,"Nested subtype renderers is not supported");if(l(f)&&"subtype"===f.type)throw new e(w,"Nested subtype storage is not supported");if(l(f)&&l(f.attributeMapping))throw new e(w,"Non-visual-variable attributes are not supported in subtype layers");if("heatmap"===t.type)throw new e(w,"Heatmaps are not supported in subtype layers");if("pie-chart"===t.type)throw new e(w,"Pie-charts are not supported in subtype layers");if(d.has(c))throw new e(w,"Subtype codes for sublayers must be unique");d.add(c),r.renderers[c]=t,o.mapping[c]=f,g&&(a.classes[c]=g.map((e=>U(u,n,e,"feature",p++,i))))}return f}if("heatmap"===t.renderer.type&&"raster"===m()){const{blurRadius:e,fieldOffset:r,field:i}=t.renderer;return{type:"heatmap",aggregateFields:[],attributes:n,target:s,storage:null,mesh:{blurRadius:e,fieldOffset:r,field:P(n,{target:s,field:i,resultType:"numeric"}).field}}}const o=D(n,t,i),a=h(t.geometryType),f=o.rendererOverride??t.renderer,d=H(n,s,f,i),p=_(n,s,f),c=J(n,t.orderBy),y=F(t.labelsVisible&&t.labelingInfo||[],a);let g=0;const b=[...y.map((e=>U(f,n,e,"feature",g++,i))),...o.labels.map((e=>U(f,n,e,"aggregate",g++,i)))];return{type:"symbol",target:s,attributes:n,aggregateFields:o.fields,storage:p,mesh:{matcher:d,labels:{type:"simple",classes:b},aggregateMatcher:o.matcher,sortKey:c}}}function C(e){return"heatmap"===e.renderer?.type&&"raster"===m()?{type:"heatmap"}:{type:"symbol"}}function J(t,r){if(s(r)||!r.length)return null;r.length>1&&v.warn(`Layer rendering currently only supports ordering by 1 orderByInfo, but found ${r.length}. All but the first will be discarded`);const i=r[0],l="ascending"===i.order?"asc":"desc";if(i.field)return{field:i.field,order:l};if(i.valueExpression){return{fieldIndex:B(t,{type:"expression",target:"feature",valueExpression:i.valueExpression,resultType:"numeric"}).fieldIndex,order:l}}return v.error(new e(w,"Expected to find a field or valueExpression for OrderByInfo",i)),null}function $(e,t){const r={mesh:!0,storage:!0};for(const i of t){const{name:t,outStatistic:l}=i,{statisticType:n,onStatisticField:s}=l;let o=null,a=null,u=null;const f="numeric",d="feature";if("onStatisticValueExpression"in l){a=B(e,{type:"expression",target:d,valueExpression:l.onStatisticValueExpression,resultType:f}).fieldIndex}else if("onStatisticNormalizationField"in l){o=B(e,{type:"field",target:d,field:s,resultType:f}).field,u=l.onStatisticNormalizationField}else{o=B(e,{type:"field",target:d,field:s,resultType:f}).field}B(e,{type:"statistic",target:"aggregate",name:t,context:r,inField:o,inNormalizationField:u,inFieldIndex:a,statisticType:n})}}function _(e,t,r){let i;switch(r.type){case"simple":case"class-breaks":case"unique-value":case"dictionary":i={visualVariables:!0,attributes:null};break;default:i=d(r).getStorageSpec(r)}return q(e,t,i,r)}function q(e,t,r,i){if(s(r))return null;const{visualVariables:n,attributes:o}=r;let a=null;n&&"visualVariables"in i&&(a=G(e,t,i.visualVariables));const u=l(a)?4:0;let f=null;return l(o)&&(f=o.map(((r,i)=>{const{field:l,fieldIndex:n}=P(e,{valueExpression:r.valueExpression,field:r.field,resultType:"numeric",target:t});return{binding:i+u,field:l,fieldIndex:n}}))),{type:"simple",target:t,attributeMapping:f,vvMapping:a}}function G(e,t,r){if(!r||!r.length)return[];const i={storage:!0},l="numeric";return g(r).map((r=>{const n=f(r.type),{field:s,fieldIndex:o}=P(e,{target:t,valueExpression:r.valueExpression,field:r.field,context:i,resultType:l});switch(r.type){case"size":return"$view.scale"===r.valueExpression?null:{type:"size",binding:n,field:s,fieldIndex:o,normalizationField:P(e,{target:t,field:r.normalizationField,context:i,resultType:l}).field,valueRepresentation:r.valueRepresentation??null};case"color":return{type:"color",binding:n,field:s,fieldIndex:o,normalizationField:P(e,{target:t,field:r.normalizationField,context:i,resultType:l}).field};case"opacity":return{type:"opacity",binding:n,field:s,fieldIndex:o,normalizationField:P(e,{target:t,field:r.normalizationField,context:i,resultType:l}).field};case"rotation":return{type:"rotation",binding:n,field:s,fieldIndex:o}}})).filter((e=>e))}function H(e,t,r,i=!1){const l=o(e,{indexCount:0,fields:{}});switch(r.type){case"simple":case"dot-density":return K(l,r,i);case"class-breaks":return Q(l,t,r,i);case"unique-value":return W(l,t,r,i);case"dictionary":return X(l,r,i);case"heatmap":return Z(l,r,i);case"pie-chart":return Y(l,r,i)}}function K(e,t,r=!1){const i=t.getSymbols(),l=i.length?i[0]:null,n=I(t);return{type:"simple",symbol:c(l,n,r),symbologyType:n.symbologyType}}function Y(e,t,r=!1){const i=t.getSymbols(),l=i[0],n=i.length>1?i[1]:null,s=I(t);return{type:"pie-chart",markerSymbol:c(l,s,r),fillSymbol:c(n,s,r),symbologyType:s.symbologyType}}function Q(e,t,r,i=!1){const l={mesh:!0,use:"renderer.field"},n=r.backgroundFillSymbol,{field:s,fieldIndex:o}=P(e,{target:t,field:r.field,valueExpression:r.valueExpression,resultType:"numeric",context:l}),a=r.normalizationType,u="log"===a?"esriNormalizeByLog":"percent-of-total"===a?"esriNormalizeByPercentOfTotal":"field"===a?"esriNormalizeByField":null,f=I(r),d=r.classBreakInfos.map((e=>({symbol:c(e.symbol,f,i),min:e.minValue,max:e.maxValue}))).sort(((e,t)=>e.min-t.min));return{type:"interval",attributes:e.fields,field:s,fieldIndex:o,backgroundFillSymbol:c(n,f,i),defaultSymbol:c(r.defaultSymbol,f,i),intervals:d,normalizationField:r.normalizationField,normalizationTotal:r.normalizationTotal,normalizationType:u,isMaxInclusive:r.isMaxInclusive,symbologyType:f.symbologyType}}function W(t,r,i,l=!1){const n=[],s=i.backgroundFillSymbol,o={target:r,context:{mesh:!0},resultType:"string"};if(i.field&&"string"!=typeof i.field)throw new e(w,"Expected renderer.field to be a string",i);const{field:a,fieldIndex:u}=P(t,{...o,field:i.field,valueExpression:i.valueExpression}),f=I(i);for(const e of i.uniqueValueInfos)n.push({value:""+e.value,symbol:c(e.symbol,f,l)});return{type:"map",attributes:t.fields,field:a,fieldIndex:u,field2:P(t,{...o,field:i.field2}).field,field3:P(t,{...o,field:i.field3}).field,fieldDelimiter:i.fieldDelimiter,backgroundFillSymbol:c(s,f),defaultSymbol:c(i.defaultSymbol,f),map:n,symbologyType:f.symbologyType}}function X(e,t,r=!1){const i=I(t);return{type:"dictionary",config:t.config,fieldMap:t.fieldMap,scaleExpression:t.scaleExpression,url:t.url,symbolOptions:i,symbologyType:i.symbologyType}}function Z(e,t,r=!1){const i=t.getSymbols(),l=i.length?i[0]:null,n=I(t);return{type:"heatmap",symbol:c(l,n,r),symbologyType:n.symbologyType}}export{$ as addAggregateFields,H as createMatcherSchema,P as createRendererAttributeSchema,V as createSchema,I as createSymbolSchemaOptions};
|
package/views/SceneView.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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Graphic.js";import r from"../Viewpoint.js";import s from"../core/Collection.js";import{byId as n}from"../core/domUtils.js";import a from"../core/Error.js";import{on as o}from"../core/events.js";import{handlesGroup as l,makeHandle as p}from"../core/handleUtils.js";import h from"../core/has.js";import{isIterable as d}from"../core/iteratorUtils.js";import{equalsShallow as c}from"../core/lang.js";import u from"../core/Logger.js";import{destroyMaybe as g,isNone as m,isSome as f,unwrapOr as y}from"../core/maybe.js";import{ObservableChangesType as w}from"../core/ObservableChangesType.js";import{throwIfAborted as v}from"../core/promiseUtils.js";import{on as _,watch as b,initial as S,syncAndInitial as M,whenOnce as R,sync as V}from"../core/reactiveUtils.js";import{setFrameDuration as T}from"../core/scheduling.js";import{screenPointObjectToArray as C,createScreenPoint as x,createScreenPointArray as O}from"../core/screenUtils.js";import{initialize as E}from"../core/workers/workers.js";import{property as j}from"../core/accessorSupport/decorators/property.js";import{cast as P}from"../core/accessorSupport/decorators/cast.js";import{subclass as I}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as L}from"../core/accessorSupport/ensureType.js";import{c as G}from"../chunks/vec3f64.js";import{owningCollectionProperty as H}from"../core/support/OwningCollection.js";import U from"../geometry/HeightModelInfo.js";import{canProjectWithoutEngine as A,project as F,projectPointToVector as D,projectVectorToVector as W,projectBoundingRect as q}from"../geometry/projection.js";import{create as k,toExtent as z}from"../geometry/support/aaBoundingRect.js";import{B as N,a as B}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as Q}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as $}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as X,isTiledLayer as Y,isVoxelLayer as Z}from"../layers/support/layerUtils.js";import{AnalysesCollection as J}from"../support/AnalysesCollection.js";import{BreakpointsOwner as K}from"./BreakpointsOwner.js";import{DOMContainer as ee}from"./DOMContainer.js";import te from"./GroundView.js";import{PopupView as ie}from"./PopupView.js";import re from"./View.js";import se from"./ViewAnimation.js";import{ViewingMode as ne,stringFromViewingMode as ae,viewingModeFromString as oe}from"./ViewingMode.js";import{layerView3DImporter as le}from"./3d/layerViewModuleImportUtils.js";import pe from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as he}from"./3d/constraints/Constraints.js";import de from"./3d/environment/SceneViewEnvironment.js";import{SceneViewEnvironmentManager as ce}from"./3d/environment/SceneViewEnvironmentManager.js";import ue from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as ge}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as me}from"./3d/layers/graphics/Labeler.js";import{ObjectResourceCache as fe}from"./3d/layers/graphics/ObjectResourceCache.js";import{FeatureTileTree3D as ye}from"./3d/layers/support/FeatureTileTree3D.js";import we from"./3d/state/ViewState.js";import ve from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as _e}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as be}from"./3d/support/CombinedElevationProvider.js";import Se from"./3d/support/debugFlags.js";import Me from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as Re}from"./3d/support/ElevationProvider.js";import Ve from"./3d/support/HighlightOptions.js";import{MapCoordsHelper as Te}from"./3d/support/MapCoordsHelper.js";import{PropertiesPool as Ce}from"./3d/support/PropertiesPool.js";import xe from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Oe}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Ee}from"./3d/support/ResourceController.js";import je from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Pe}from"./3d/support/SharedSymbolResources.js";import{PointsOfInterest as Ie}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Le from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Ge,getTiledLayerInfo as He,checkIfTileInfoSupportedForView as Ue}from"./3d/terrain/terrainUtils.js";import{Stage as Ae}from"./3d/webgl-engine/Stage.js";import{newIntersector as Fe,DEFAULT_TOLERANCE as De}from"./3d/webgl-engine/lib/Intersector.js";import{StoreResults as We,IntersectorType as qe}from"./3d/webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as ke}from"./3d/webgl-engine/lib/intersectorUtils.js";import{toHit as ze,toOwner as Ne}from"./3d/webgl-engine/lib/intersectorUtilsConversions.js";import{TERRAIN_ID as Be}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{hitTestSelectSimilarDistance as Qe}from"./support/hitTestSelectUtils.js";import{occludeesSupported as $e}from"./support/layerViewUtils.js";import{encode as Xe,encodeData as Ye,toRenderSettings as Ze,screenshotSuperSampleSettings as Je}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as Ke,createScreenPointFromSupportedEvent as et}from"./support/screenUtils.js";import{isSpatialReferenceSupported as tt}from"./support/spatialReferenceSupport.js";import{check as it}from"./support/WebGLRequirements.js";import rt from"./ui/3d/DefaultUI3D.js";import st from"../webscene/Environment.js";import nt from"../geometry/Extent.js";import at from"../geometry/SpatialReference.js";import ot from"../geometry/Point.js";const lt=u.getLogger("esri.views.SceneView");let pt=class extends(K(ee(ie(re)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._defaults={},this._externallySet={environment:!1},this._createGraphicsViewController=null,this._resolveWhenReady=[],this.propertiesPool=new Ce({slicePlane:N},this),this._resourceController=Ee(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new ge({view:this}),this.labeler=new me({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new J,this.basemapTerrain=null,this.elevationProvider=null,this.camera=null,this.canvas=null,this.center=null,this.constraints=new he,this.environmentManager=new ce,this.extent=null,this.floors=new s,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new pe({view:this}),this.groundView=null,this.navigating=!1,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new we,this.scale=null,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new rt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.viewpoint=null,this.zoom=null,this.highlightOptions=new Ve,this.voxelWasm=null,E(),e&&e.environment||(this._defaults.environment=new de,this.environment=this._defaults.environment);const t=(e=null)=>{f(e)&&e.type===w.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.handles.add([_((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),b((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new ue({view:this}),this.stateManager=new ve({view:this})}initialize(){this.groundView=new te({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.handles.add(_((()=>this.map?.allLayers),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),S),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),S),this.updatingHandles.add((()=>this.qualitySettings.frameRate),(e=>T(e>0?1e3/Math.ceil(e):0)),S),this.updatingHandles.add((()=>this.map?.ground),e,M),this.updatingHandles.add((()=>this.map?.ground?.opacity),(()=>this._updateDefaultHitTestOptions()),M),this.handles.add(b((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),V))}destroy(){this.destroyed||(this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=g(this.sharedSymbolResources),this.labeler.destroy(),this._set("labeler",null),this.deconflictor.destroy(),this._set("deconflictor",null),this._resourceController=g(this._resourceController),this.stateManager.destroy(),this._set("stateManager",null),this.inputManager.destroy(),this._set("inputManager",null),this.propertiesPool.destroy(),this.handles.remove("updatingMonitors"),this.environmentManager.destroy(),this._set("environmentManager",null),this.groundView=g(this.groundView))}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get clippingArea(){if("global"===this.viewingMode)return null;let e=this._userClippingArea||this.get("map.clippingArea");return!(!!this._userClippingArea||this.get("map.clippingEnabled"))||m(e)?(this._clippingArea=null,null):e instanceof nt?this.spatialReference&&(e=ct(e,this.spatialReference),m(e))?(lt.error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(e=e.clone(),m(e.intersection(this.groundAndLayersExtent))&&(e.xmin=e.xmax,e.ymin=e.ymax),e.zmin=void 0,e.zmax=void 0,e.equals(this._clippingArea)||(this._clippingArea=e),this._clippingArea):(lt.error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&f(e)?lt.error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===ne.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return m(t)||m(e)||t.spatialReference.equals(e)?t:ct(t,e)}get dataExtent(){let e=this.groundAndLayersExtent;const t=this.spatialReference||at.WGS84,i=ct(this.clippingArea,t);f(i)&&(e=f(e)?e.intersection(i):i);const r=this._get("dataExtent");return f(e)&&e.equals(r)?r:e}get groundAndLayersExtent(){const e=this.spatialReference||at.WGS84;let t;const i=i=>{const r=ct(i,e);m(r)||(f(t)?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new nt({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{!f(e.fullExtent)||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(m(t))return null;t.hasZ?(t.zmin=Math.min(0,t.zmin),t.zmax=Math.max(0,t.zmax)):(t.zmin=0,t.zmax=0);const s=this._get("groundAndLayersExtent");return t.equals(s)?s:t}set environment(e){e!==this._defaults.environment&&(this._externallySet.environment=!0),this._set("environment",e)}castEnvironment(e){return e?e instanceof de?e:e instanceof st?null!=this.environment?this.environment.cloneWithWebsceneEnvironment(e):de.fromWebsceneEnvironment(e):L(de,e):new de}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get _defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||f(this.activeTool)}get stationary(){return!this.animation&&!this.resizing&&(m(this.state)||this.state.stationary)}set qualityProfile(e){Me.isValidProfile(e)&&(Me.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Me.getDefaultProfile()}set slicePlane(e){if(f(this._stage)&&this._stage.renderView.setRenderParameters({slicePlane:e}),m(e))return void this._set("slicePlane",null);const t=this.propertiesPool.get("slicePlane");B(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode}get resolution(){return null!=this.spatialReference?$(this.scale,this.spatialReference):0}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?U.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Ge(r))return;++i,e+=r.updatingProgress}}else++i}));for(const r of[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this.featureTreeDebugger,this.toolViewManager,this.analysisViewManager])if(f(r)&&r.updating){const t=.1;i+=t,e+=.5*t}for(const r of[this.deconflictor,this.labeler,this.basemapTerrain])f(r)&&r.updating&&(++i,e+=r.updatingProgress);if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||this._createGraphicsViewController||this.inputManager?.hasPendingInputs||this.map?.allLayers?.some((e=>!e.isFulfilled()))),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get viewingMode(){const e=this._predeterminedViewingMode;if(f(e))return ae(e);const t=this.spatialReference;return t?f(this.defaultsFromMap?.viewingMode)&&t.equals(this.defaultsFromMap.spatialReference)?ae(this.defaultsFromMap.viewingMode):tt(t,ne.Global)?"global":"local":"global"}set viewingMode(e){this.ready?lt.error("#viewingMode","viewingMode cannot be set once view is ready"):e?this._override("viewingMode",e):void 0===e&&this._clearOverride("viewingMode")}get resourceController(){return this._resourceController}get performanceInfo(){return new je(this)}forceAnimationTime(e){this._stage.renderView.forcedAnimationTime=this.basemapTerrain.overlayManager.forcedAnimationTime=e}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return lt.error("#toMap()","Scene view cannot be used before it is ready"),null;const i=t?this.externalToInternalIntersectOptions(t):this._defaultToMapOptions,r=f(i.graphics)&&(f(i.graphics.include)||f(i.graphics.exclude)),s=Ke(e)?et(this,e):e,n=C(s);i.enableDraped=i.include&&!i.include.has(Be)||i.exclude&&i.exclude.has(Be);const a=this.sceneIntersectionHelper,o=Fe(this.state.viewingMode);if(o.options.selectionMode=!0,o.options.store=r?We.ALL:We.MIN,a.intersectIntersectorScreen(n,o,i),r){for(const e of o.results.all){const t=ze(e,this);if(m(t))return this._intersectResultToMapPoint(e);if("graphic"!==t.type||this._testGraphicUidFilter(i.graphics,t.graphic))return this._intersectResultToMapPoint(e)}return null}return this._intersectResultToMapPoint(o.results.min)}toScreen(e){if(!this.ready)return lt.error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=y(null==e.z&&Re(this.elevationProvider,e),0);return D(e,gt,this.renderSpatialReference,t),this.state.camera.projectToScreen(gt,mt),x(mt[0],mt[1])}pixelSizeAt(e){return this.ready?e?(D(e,gt,this.renderSpatialReference),this.state.camera.computeScreenPixelSizeAt(gt)):0:(lt.error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null)}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e):1}hitTest(e,t){if(!this.ready)return lt.error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=Ke(e)?et(this,e):e,r=O(i.x,i.y),s=t?this.externalToInternalIntersectOptions(t):this._defaultHitTestOptions;s.requiresGroundFeedback=!0,s.enableDraped=!0;const n=Fe(this.state.viewingMode);n.options.selectionMode=!0,n.options.store=We.ALL,this.sceneIntersectionHelper.intersectIntersectorScreen(r,n,s);const a=this._intersectResultsToHits(n.results.all,s.graphics),o=n.results.ground,l=Ne(o,this),p=f(l)&&"type"in l&&"integrated-mesh"===l.type?l:null,h={screenPoint:i,results:a,ground:{mapPoint:this._intersectResultToMapPoint(o),distance:ke(o)?o.distanceInRenderSpace:0,layer:p}};return Se.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=n),Promise.resolve(h)}async popupHitTest(e){const{results:t,ground:i}=await Qe(this,e);let r=null;return!(0===t.length||Math.abs(y(t[0].distance,0)-i.distance)<1e-5)||i.layer&&"integrated-mesh"===i.layer.type||(r=i.mapPoint),{results:t,screenPoint:e,mapPoint:r}}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(await this.whenReady(),m(e.parent))throw new a("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});if("line-of-sight"===e.parent.type){return(await this.whenLayerView(e.parent)).whenAnalysisView()}return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Xe(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Ye(i,this._pixelFormat())}_completeSettings(e){const t=Ze(e,this);return t.pixelRatio/=this.state.pixelRatio,Je(t,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){return{takeScreenshot:e=>this._takeScreenshot(e)}}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return le.importLayerView(e)}hasLayerViewModule(e){return le.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=it(this.type);if(h("safari")&&h("safari")<9&&(e=new a("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:h("safari")})),f(e))throw lt.warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return f(e)?oe(e):null}getSpatialReferenceSupport({spatialReference:e,layer:t}){const i=this._predeterminedViewingMode;if(f(i))return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,ne.Local),s=this._validateSpatialReferenceForViewingMode(e,t,ne.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,ne.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,ne.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!tt(e,i)&&(!!m(t)||(!!X(t)||(!Y(t)||!m(He(t,e,i)))&&(!Z(t)||i!==ne.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(m(t))return[{spatialReference:e,viewingMode:i}];const r=e.isWebMercator,s=e.isWGS84;if(X(t)&&(r||s)){return!s||i===ne.Local||null===Ue(t.tileInfo,t.fullExtent,e,ne.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:at.WebMercator,viewingMode:i}]:[{spatialReference:r?at.WGS84:at.WebMercator,viewingMode:i}]}return Y(t)||Z(t)||!r&&!s?Y(t)&&r&&i!==ne.Global?[{spatialReference:e,viewingMode:i},{spatialReference:at.WGS84,viewingMode:ne.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?at.WGS84:at.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=f(this.getSpatialReferenceSupport({spatialReference:e})),i=this._predeterminedViewingMode;return t||(f(i)?lt.warnOnce(`Spatial reference defined on view not supported in ${ae(i)} viewing mode.`):e.isGeographic&<.warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}computeMapPointFromVec3d(e,t){let i=this.spatialReference||at.WGS84;return W(e,this.renderSpatialReference,e,i)||(i=at.WGS84,W(e,this.renderSpatialReference,e,i)),t?(t.x=e[0],t.y=e[1],t.z=e[2],t.spatialReference=i):t=new ot(e,i),t}trackGraphicState(e){if(!e.graphic)return lt.error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&f(t)&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return f(t)?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,f(i)&&(i.remove(),i=null)}}}highlight(e){if(Array.isArray(e))return l(e.map((e=>this.highlight(e))));if(s.isCollection(e))return l(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):p()}maskOccludee(e){if(!e)return lt.error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&f(t)&&$e(t)&&(i=t.maskOccludee(e))};return f(t)?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,f(i)&&(i.remove(),i=null)}}}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){f(this.graphicsView)&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await R((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new a("no-view-for-graphic");return t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer)}externalToInternalIntersectOptions(e){const t=this._externalToInternalRenderItems(e.include,ut.INCLUDE),i=this._externalToInternalRenderItems(e.exclude,ut.EXCLUDE);return{include:t.layerUids,exclude:i.layerUids,graphics:{include:t.graphicUids,exclude:i.graphicUids}}}_intersectResultToMapPoint(e,t){return e.getIntersectionPoint(gt)?(t=this.computeMapPointFromVec3d(gt,t),e.intersector===qe.TERRAIN&&this.basemapTerrain&&(t.z=y(Re(this.basemapTerrain,t),0)),t):null}_intersectResultsToHits(e,t){const i=new Array;let r=null;for(let s=0;s<e.length;s++){const n=e[s],a=Ne(n,this);if(f(a)&&(a===this.map.ground||"type"in a&&"integrated-mesh"===a.type))break;const o=ze(n,this);if(m(o))continue;if("graphic"===o.type){if(m(r)&&s!==e.length-1&&(r=new Set),f(r)){const e=this._getGraphicFilterUid(o.graphic);if(r.has(e))continue;r.add(e)}if(!this._testGraphicUidFilter(t,o.graphic))continue}const l=this._intersectResultToMapPoint(n),p=n.distanceInRenderSpace;i.push({...o,mapPoint:l,distance:p})}return i}_getGraphicFilterUid(e){if(e.layer&&"objectIdField"in e.layer){const t=e.attributes[e.layer.objectIdField];if(t)return`o-${e.layer.id}-${t}`}return`u-${e.uid}`}_testGraphicUidFilter(e,t){const i=this._getGraphicFilterUid(t);return m(e)||(m(e.include)||e.include.has(i))&&(m(e.exclude)||!e.exclude.has(i))}_externalToInternalRenderItems(e,t,r={layerUids:null,graphicUids:null}){if(!e)return r;if(e instanceof i)dt(r,this._getGraphicFilterUid(e)),t===ut.INCLUDE&&(f(this.graphicsView)&&e.layer===this?ht(r,this.graphicsView.processor.layer.id):e.layer&&ht(r,e.layer.uid));else if(d(e))for(const i of e)i===this.graphics&&f(this.graphicsView)?ht(r,this.graphicsView.processor.layer.id):i===this.map.ground?ht(r,Be):this._externalToInternalRenderItems(i,t,r);else"uid"in e&&ht(r,e.uid);return r}_initBasemapTerrain(){this._set("basemapTerrain",new Le({view:this})),this._set("elevationProvider",new be({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Ie({view:this})),this._set("featureTiles",new ye({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.contentCameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=f(this.basemapTerrain.extent)?F(z(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;f(this.clippingArea)?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.handles.add([this.updatingHandles.add((()=>Se.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this.featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this.featureTreeDebugger&&Se.FEATURE_TILE_TREE_SHOW_TILES&&(this.featureTreeDebugger=new e({view:this}))})):e||!this.featureTreeDebugger||Se.FEATURE_TILE_TREE_SHOW_TILES||(this.featureTreeDebugger.destroy(),this.featureTreeDebugger=null)}),M),this.updatingHandles.add((()=>this.clippingArea),e,M),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,M)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.deinit(),this.handles.remove("render-coords-helper"),this.handles.remove("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference;this.mapCoordsHelper&&this.mapCoordsHelper.spatialReference.equals(e)||this._set("mapCoordsHelper",new Te(this.map,e));const t=this.state.isGlobal,i=Q(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Oe.create(this.state.viewingMode,i)),t||this.handles.add(b((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;e&&(0!==e[0]||0!==e[1]||0!==e[2]||0!==e[3])&&q(e,this.basemapTerrain.spatialReference,ft,t)&&(this.renderCoordsHelper.extent=ft)}),V),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters))}else this._set("mapCoordsHelper",null),this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.mapCoordsHelper&&(this.handles.remove("render-coords-helper"),this._set("renderCoordsHelper",null),this._set("mapCoordsHelper",null))}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){f(e)&&e.type===w.MOVE||(this.handles.remove("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.handles.add(b((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),{sync:!0,equals:c}),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}_renderScreenshotOverlay(e,t){if(!this.overlay||!this.overlay.hasVisibleItems)return t;const i=e.getContext("2d");return i.putImageData(t,0,0),this.overlay.renderCanvas(e),i.getImageData(0,0,t.width,t.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,canvas:this.renderCanvas,screenshot:{renderOverlay:(e,t)=>this._renderScreenshotOverlay(e,t)}},t=new _e(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=n(this.surface),{resourceController:r,state:s,renderSpatialReference:l}=this;this._stage=new Ae({options:e,container:i,resourceController:r,state:s,sceneIntersectionHelper:t,renderSR:l}),this._stage.renderView.setRenderParameters({slicePlane:this.slicePlane}),this._lostWebGLContextHandle=o(this._stage.renderView.canvas,"webglcontextlost",(()=>this.fatalError=new a("webgl-context-lost"))),this.handles.add([this.updatingHandles.add((()=>this.qualitySettings.antialiasingEnabled),(()=>this._stage.renderView.setRenderParameters({antialiasingEnabled:this.qualitySettings.antialiasingEnabled})),S),this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(()=>this._stage.renderView.setRenderParameters({highQualityTransparency:this.qualitySettings.highQualityTransparency})),S),b((()=>this.magnifier),(e=>this._stage.renderView.magnifier=e),M)],"stage");const p=()=>{this._stage.renderView.setRenderParameters({defaultHighlightOptions:Ve.toEngineOptions(this.highlightOptions)})};this.handles.add(this.updatingHandles.add((()=>[this.highlightOptions.color,this.highlightOptions.haloColor,this.highlightOptions.haloOpacity,this.highlightOptions.fillOpacity,this.highlightOptions.shadowOpacity,this.highlightOptions.shadowColor,this.highlightOptions.shadowDifference]),p),"stage"),p(),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage.destroy(),this._stage=null,this._lostWebGLContextHandle.remove(),this._lostWebGLContextHandle=null,this.handles.remove("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Pe({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state,objectResourceCache:new fe})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.handles.remove("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;v(e),await R((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.handles.remove("graphics-view"),f(this.graphicsView)&&(this.handles.remove(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=oe(this.viewingMode);if(e===ne.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.handles.add(_((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded(),!this._externallySet.environment){const e=this.get("map.initialViewProperties.environment");e&&(this.environment=e)}this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const t=this._resolveWhenReady;this._resolveWhenReady=[],t.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this.labeler.dispose(),this._disposeGraphicsView(),this.handles.remove("graphics-view"),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(Be);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(Be);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&e.opacity<1&&this._defaultToMapOptions.exclude.add(e.uid)}}async addVoxelLayerViewToWasm(e){if(!f(this.voxelWasm)){const e=(await import("../layers/VoxelWasmPerSceneView.js")).default;this.voxelWasm=new e(this)}return this.voxelWasm.addVoxelLayer(e)}removeVoxelLayerViewFromWasm(e){if(f(this.voxelWasm)){this.voxelWasm.removeVoxelLayer(e)<1&&(this.voxelWasm=null)}}};function ht(e,t){e.layerUids||(e.layerUids=new Set),e.layerUids.add(t)}function dt(e,t){e.graphicUids||(e.graphicUids=new Set),e.graphicUids.add(t)}function ct(e,t){return f(e)&&A(e.spatialReference,t)?F(e,t):null}var ut;pt.type="3d",e([j()],pt.prototype,"_userClippingArea",void 0),e([j()],pt.prototype,"_resourceController",void 0),e([j()],pt.prototype,"_stage",void 0),e([j({readOnly:!0})],pt.prototype,"deconflictor",void 0),e([j({readOnly:!0})],pt.prototype,"labeler",void 0),e([j(H(J,"analyses"))],pt.prototype,"analyses",void 0),e([j({type:se,readOnly:!0,aliasOf:"state.animation"})],pt.prototype,"animation",void 0),e([j({readOnly:!0})],pt.prototype,"basemapTerrain",void 0),e([j({readOnly:!0})],pt.prototype,"elevationProvider",void 0),e([j({type:t,aliasOf:"stateManager.camera"})],pt.prototype,"camera",void 0),e([j({type:t,aliasOf:"stateManager.contentCamera"})],pt.prototype,"contentCamera",void 0),e([j({readOnly:!0})],pt.prototype,"canvas",void 0),e([j({type:ot,aliasOf:"stateManager.center"})],pt.prototype,"center",void 0),e([j({type:nt})],pt.prototype,"clippingArea",null),e([j({type:he})],pt.prototype,"constraints",void 0),e([j({type:nt,readOnly:!0})],pt.prototype,"renderDataExtent",null),e([j({type:nt,readOnly:!0})],pt.prototype,"dataExtent",null),e([j({type:nt,readOnly:!0})],pt.prototype,"groundAndLayersExtent",null),e([j({value:null,type:de})],pt.prototype,"environment",null),e([P("environment")],pt.prototype,"castEnvironment",null),e([j({readOnly:!0})],pt.prototype,"environmentManager",void 0),e([j({type:nt,aliasOf:"stateManager.extent"})],pt.prototype,"extent",void 0),e([j()],pt.prototype,"floors",void 0),e([j({readOnly:!0,aliasOf:"stateManager.screenCenter"})],pt.prototype,"screenCenter",void 0),e([j({aliasOf:"stateManager.frustum"})],pt.prototype,"frustum",void 0),e([j({type:Number,readOnly:!0})],pt.prototype,"fullOpacity",void 0),e([j({readOnly:!0})],pt.prototype,"graphicsView",void 0),e([j({readOnly:!0})],pt.prototype,"analysisViewManager",void 0),e([j()],pt.prototype,"groundView",void 0),e([j({type:Boolean})],pt.prototype,"initialExtentRequired",null),e([j()],pt.prototype,"_defaultsFromMapSettings",null),e([j({type:Boolean,readOnly:!0})],pt.prototype,"interacting",null),e([j()],pt.prototype,"stationary",null),e([j({aliasOf:"state.navigating"})],pt.prototype,"navigating",void 0),e([j()],pt.prototype,"map",void 0),e([j({readOnly:!0})],pt.prototype,"mapCoordsHelper",void 0),e([j({aliasOf:"stateManager.padding"})],pt.prototype,"padding",void 0),e([j({type:Ie,readOnly:!0})],pt.prototype,"pointsOfInterest",void 0),e([j({type:ye,readOnly:!0})],pt.prototype,"featureTiles",void 0),e([j()],pt.prototype,"featureTreeDebugger",void 0),e([j({type:Boolean})],pt.prototype,"screenSizePerspectiveEnabled",void 0),e([j({constructOnly:!0})],pt.prototype,"deactivatedWebGLExtensions",void 0),e([j({constructOnly:!0})],pt.prototype,"debugWebGLExtensions",void 0),e([j({constructOnly:!0})],pt.prototype,"renderCanvas",void 0),e([j({constructOnly:!0})],pt.prototype,"state",void 0),e([j({readOnly:!0})],pt.prototype,"inputManager",void 0),e([j({readOnly:!0})],pt.prototype,"stateManager",void 0),e([j({type:["low","medium","high"]})],pt.prototype,"qualityProfile",null),e([j({type:xe,get(){let e=this._get("qualitySettings");return e||(e=new xe,Me.apply(this.qualityProfile,e)),e}})],pt.prototype,"qualitySettings",void 0),e([j()],pt.prototype,"slicePlane",null),e([j({readOnly:!0})],pt.prototype,"typeSpecificPreconditionsReady",null),e([j({readOnly:!0})],pt.prototype,"renderCoordsHelper",void 0),e([j({readOnly:!0})],pt.prototype,"sceneIntersectionHelper",void 0),e([j({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],pt.prototype,"resolution",null),e([j({type:Number,aliasOf:"stateManager.scale"})],pt.prototype,"scale",void 0),e([j()],pt.prototype,"heightModelInfo",null),e([j()],pt.prototype,"spatialReference",void 0),e([j({type:Boolean,constructOnly:!0})],pt.prototype,"alphaCompositingEnabled",void 0),e([j({type:Boolean})],pt.prototype,"supersampleScreenshotsEnabled",void 0),e([j({readOnly:!0})],pt.prototype,"type",void 0),e([j({type:rt})],pt.prototype,"ui",void 0),e([j({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.hasPendingInputs","toolViewManager.updating","analysisViewManager.updating"]})],pt.prototype,"updating",null),e([j({type:Number,readOnly:!0,dependsOn:["updating"]})],pt.prototype,"updatingProgress",void 0),e([j({type:["global","local"]})],pt.prototype,"viewingMode",null),e([j({type:r,aliasOf:"stateManager.viewpoint"})],pt.prototype,"viewpoint",void 0),e([j({type:Number,aliasOf:"stateManager.zoom"})],pt.prototype,"zoom",void 0),e([j({type:Ve})],pt.prototype,"highlightOptions",void 0),pt=e([I("esri.views.SceneView")],pt),function(e){e[e.INCLUDE=0]="INCLUDE",e[e.EXCLUDE=1]="EXCLUDE"}(ut||(ut={}));const gt=G(),mt=O(),ft=k(),yt=pt;export{yt as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Graphic.js";import r from"../Viewpoint.js";import s from"../core/Collection.js";import{byId as n}from"../core/domUtils.js";import a from"../core/Error.js";import{on as o}from"../core/events.js";import{handlesGroup as l,makeHandle as p}from"../core/handleUtils.js";import h from"../core/has.js";import{isIterable as d}from"../core/iteratorUtils.js";import{equalsShallow as c}from"../core/lang.js";import u from"../core/Logger.js";import{destroyMaybe as g,isNone as m,isSome as f,unwrapOr as y}from"../core/maybe.js";import{ObservableChangesType as w}from"../core/ObservableChangesType.js";import{throwIfAborted as v}from"../core/promiseUtils.js";import{on as _,watch as b,initial as S,syncAndInitial as M,whenOnce as R,sync as V}from"../core/reactiveUtils.js";import{setFrameDuration as T}from"../core/scheduling.js";import{screenPointObjectToArray as C,createScreenPoint as x,createScreenPointArray as O}from"../core/screenUtils.js";import{initialize as E}from"../core/workers/workers.js";import{property as j}from"../core/accessorSupport/decorators/property.js";import{cast as P}from"../core/accessorSupport/decorators/cast.js";import{subclass as I}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as L}from"../core/accessorSupport/ensureType.js";import{c as G}from"../chunks/vec3f64.js";import{owningCollectionProperty as H}from"../core/support/OwningCollection.js";import U from"../geometry/HeightModelInfo.js";import{canProjectWithoutEngine as A,project as W,projectPointToVector as F,projectVectorToVector as D,projectBoundingRect as q}from"../geometry/projection.js";import{create as k,toExtent as z}from"../geometry/support/aaBoundingRect.js";import{B as N,a as B}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as Q}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as $}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as X,isTiledLayer as Y,isVoxelLayer as Z}from"../layers/support/layerUtils.js";import{AnalysesCollection as J}from"../support/AnalysesCollection.js";import{BreakpointsOwner as K}from"./BreakpointsOwner.js";import{DOMContainer as ee}from"./DOMContainer.js";import te from"./GroundView.js";import{PopupView as ie}from"./PopupView.js";import re from"./View.js";import se from"./ViewAnimation.js";import{ViewingMode as ne,stringFromViewingMode as ae,viewingModeFromString as oe}from"./ViewingMode.js";import{layerView3DImporter as le}from"./3d/layerViewModuleImportUtils.js";import pe from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as he}from"./3d/constraints/Constraints.js";import de from"./3d/environment/SceneViewEnvironment.js";import{SceneViewEnvironmentManager as ce}from"./3d/environment/SceneViewEnvironmentManager.js";import ue from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as ge}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as me}from"./3d/layers/graphics/Labeler.js";import{ObjectResourceCache as fe}from"./3d/layers/graphics/ObjectResourceCache.js";import{FeatureTileTree3D as ye}from"./3d/layers/support/FeatureTileTree3D.js";import we from"./3d/state/ViewState.js";import ve from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as _e}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as be}from"./3d/support/CombinedElevationProvider.js";import Se from"./3d/support/debugFlags.js";import Me from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as Re}from"./3d/support/ElevationProvider.js";import Ve from"./3d/support/HighlightOptions.js";import{MapCoordsHelper as Te}from"./3d/support/MapCoordsHelper.js";import{PropertiesPool as Ce}from"./3d/support/PropertiesPool.js";import xe from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Oe}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Ee}from"./3d/support/ResourceController.js";import je from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Pe}from"./3d/support/SharedSymbolResources.js";import{PointsOfInterest as Ie}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Le from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Ge,getTiledLayerInfo as He,checkIfTileInfoSupportedForView as Ue}from"./3d/terrain/terrainUtils.js";import{Stage as Ae}from"./3d/webgl-engine/Stage.js";import{newIntersector as We,DEFAULT_TOLERANCE as Fe}from"./3d/webgl-engine/lib/Intersector.js";import{StoreResults as De,IntersectorType as qe}from"./3d/webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as ke}from"./3d/webgl-engine/lib/intersectorUtils.js";import{toHit as ze,toOwner as Ne}from"./3d/webgl-engine/lib/intersectorUtilsConversions.js";import{TERRAIN_ID as Be}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{hitTestSelectSimilarDistance as Qe}from"./support/hitTestSelectUtils.js";import{occludeesSupported as $e}from"./support/layerViewUtils.js";import{encode as Xe,encodeData as Ye,toRenderSettings as Ze,screenshotSuperSampleSettings as Je}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as Ke,createScreenPointFromSupportedEvent as et}from"./support/screenUtils.js";import{isSpatialReferenceSupported as tt}from"./support/spatialReferenceSupport.js";import{check as it}from"./support/WebGLRequirements.js";import rt from"./ui/3d/DefaultUI3D.js";import st from"../webscene/Environment.js";import nt from"../geometry/Extent.js";import at from"../geometry/SpatialReference.js";import ot from"../geometry/Point.js";const lt=u.getLogger("esri.views.SceneView");let pt=class extends(K(ee(ie(re)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._defaults={},this._externallySet={environment:!1},this._createGraphicsViewController=null,this._resolveWhenReady=[],this.propertiesPool=new Ce({slicePlane:N},this),this._resourceController=Ee(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new ge({view:this}),this.labeler=new me({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new J,this.basemapTerrain=null,this.elevationProvider=null,this.camera=null,this.canvas=null,this.center=null,this.constraints=new he,this.environmentManager=new ce,this.extent=null,this.floors=new s,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new pe({view:this}),this.groundView=null,this.navigating=!1,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new we,this.scale=null,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new rt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.viewpoint=null,this.zoom=null,this.highlightOptions=new Ve,this.voxelWasm=null,this.voxelWasmPromise=null,E(),e&&e.environment||(this._defaults.environment=new de,this.environment=this._defaults.environment);const t=(e=null)=>{f(e)&&e.type===w.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.handles.add([_((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),b((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new ue({view:this}),this.stateManager=new ve({view:this})}initialize(){this.groundView=new te({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.handles.add(_((()=>this.map?.allLayers),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),S),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),S),this.updatingHandles.add((()=>this.qualitySettings.frameRate),(e=>T(e>0?1e3/Math.ceil(e):0)),S),this.updatingHandles.add((()=>this.map?.ground),e,M),this.updatingHandles.add((()=>this.map?.ground?.opacity),(()=>this._updateDefaultHitTestOptions()),M),this.handles.add(b((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),V))}destroy(){this.destroyed||(this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=g(this.sharedSymbolResources),this.labeler.destroy(),this._set("labeler",null),this.deconflictor.destroy(),this._set("deconflictor",null),this._resourceController=g(this._resourceController),this.stateManager.destroy(),this._set("stateManager",null),this.inputManager.destroy(),this._set("inputManager",null),this.propertiesPool.destroy(),this.handles.remove("updatingMonitors"),this.environmentManager.destroy(),this._set("environmentManager",null),this.groundView=g(this.groundView))}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get clippingArea(){if("global"===this.viewingMode)return null;let e=this._userClippingArea||this.get("map.clippingArea");return!(!!this._userClippingArea||this.get("map.clippingEnabled"))||m(e)?(this._clippingArea=null,null):e instanceof nt?this.spatialReference&&(e=ct(e,this.spatialReference),m(e))?(lt.error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(e=e.clone(),m(e.intersection(this.groundAndLayersExtent))&&(e.xmin=e.xmax,e.ymin=e.ymax),e.zmin=void 0,e.zmax=void 0,e.equals(this._clippingArea)||(this._clippingArea=e),this._clippingArea):(lt.error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&f(e)?lt.error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===ne.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return m(t)||m(e)||t.spatialReference.equals(e)?t:ct(t,e)}get dataExtent(){let e=this.groundAndLayersExtent;const t=this.spatialReference||at.WGS84,i=ct(this.clippingArea,t);f(i)&&(e=f(e)?e.intersection(i):i);const r=this._get("dataExtent");return f(e)&&e.equals(r)?r:e}get groundAndLayersExtent(){const e=this.spatialReference||at.WGS84;let t;const i=i=>{const r=ct(i,e);m(r)||(f(t)?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new nt({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{!f(e.fullExtent)||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(m(t))return null;t.hasZ?(t.zmin=Math.min(0,t.zmin),t.zmax=Math.max(0,t.zmax)):(t.zmin=0,t.zmax=0);const s=this._get("groundAndLayersExtent");return t.equals(s)?s:t}set environment(e){e!==this._defaults.environment&&(this._externallySet.environment=!0),this._set("environment",e)}castEnvironment(e){return e?e instanceof de?e:e instanceof st?null!=this.environment?this.environment.cloneWithWebsceneEnvironment(e):de.fromWebsceneEnvironment(e):L(de,e):new de}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get _defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||f(this.activeTool)}get stationary(){return!this.animation&&!this.resizing&&(m(this.state)||this.state.stationary)}set qualityProfile(e){Me.isValidProfile(e)&&(Me.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Me.getDefaultProfile()}set slicePlane(e){if(f(this._stage)&&this._stage.renderView.setRenderParameters({slicePlane:e}),m(e))return void this._set("slicePlane",null);const t=this.propertiesPool.get("slicePlane");B(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode}get resolution(){return null!=this.spatialReference?$(this.scale,this.spatialReference):0}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?U.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Ge(r))return;++i,e+=r.updatingProgress}}else++i}));for(const r of[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this.featureTreeDebugger,this.toolViewManager,this.analysisViewManager])if(f(r)&&r.updating){const t=.1;i+=t,e+=.5*t}for(const r of[this.deconflictor,this.labeler,this.basemapTerrain])f(r)&&r.updating&&(++i,e+=r.updatingProgress);if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||this._createGraphicsViewController||this.inputManager?.hasPendingInputs||this.map?.allLayers?.some((e=>!e.isFulfilled()))),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get viewingMode(){const e=this._predeterminedViewingMode;if(f(e))return ae(e);const t=this.spatialReference;return t?f(this.defaultsFromMap?.viewingMode)&&t.equals(this.defaultsFromMap.spatialReference)?ae(this.defaultsFromMap.viewingMode):tt(t,ne.Global)?"global":"local":"global"}set viewingMode(e){this.ready?lt.error("#viewingMode","viewingMode cannot be set once view is ready"):e?this._override("viewingMode",e):void 0===e&&this._clearOverride("viewingMode")}get resourceController(){return this._resourceController}get performanceInfo(){return new je(this)}forceAnimationTime(e){this._stage.renderView.forcedAnimationTime=this.basemapTerrain.overlayManager.forcedAnimationTime=e}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return lt.error("#toMap()","Scene view cannot be used before it is ready"),null;const i=t?this.externalToInternalIntersectOptions(t):this._defaultToMapOptions,r=f(i.graphics)&&(f(i.graphics.include)||f(i.graphics.exclude)),s=Ke(e)?et(this,e):e,n=C(s);i.enableDraped=i.include&&!i.include.has(Be)||i.exclude&&i.exclude.has(Be);const a=this.sceneIntersectionHelper,o=We(this.state.viewingMode);if(o.options.selectionMode=!0,o.options.store=r?De.ALL:De.MIN,a.intersectIntersectorScreen(n,o,i),r){for(const e of o.results.all){const t=ze(e,this);if(m(t))return this._intersectResultToMapPoint(e);if("graphic"!==t.type||this._testGraphicUidFilter(i.graphics,t.graphic))return this._intersectResultToMapPoint(e)}return null}return this._intersectResultToMapPoint(o.results.min)}toScreen(e){if(!this.ready)return lt.error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=y(null==e.z&&Re(this.elevationProvider,e),0);return F(e,gt,this.renderSpatialReference,t),this.state.camera.projectToScreen(gt,mt),x(mt[0],mt[1])}pixelSizeAt(e){return this.ready?e?(F(e,gt,this.renderSpatialReference),this.state.camera.computeScreenPixelSizeAt(gt)):0:(lt.error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null)}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e):1}hitTest(e,t){if(!this.ready)return lt.error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=Ke(e)?et(this,e):e,r=O(i.x,i.y),s=t?this.externalToInternalIntersectOptions(t):this._defaultHitTestOptions;s.requiresGroundFeedback=!0,s.enableDraped=!0;const n=We(this.state.viewingMode);n.options.selectionMode=!0,n.options.store=De.ALL,this.sceneIntersectionHelper.intersectIntersectorScreen(r,n,s);const a=this._intersectResultsToHits(n.results.all,s.graphics),o=n.results.ground,l=Ne(o,this),p=f(l)&&"type"in l&&"integrated-mesh"===l.type?l:null,h={screenPoint:i,results:a,ground:{mapPoint:this._intersectResultToMapPoint(o),distance:ke(o)?o.distanceInRenderSpace:0,layer:p}};return Se.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=n),Promise.resolve(h)}async popupHitTest(e){const{results:t,ground:i}=await Qe(this,e);let r=null;return!(0===t.length||Math.abs(y(t[0].distance,0)-i.distance)<1e-5)||i.layer&&"integrated-mesh"===i.layer.type||(r=i.mapPoint),{results:t,screenPoint:e,mapPoint:r}}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(await this.whenReady(),m(e.parent))throw new a("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});if("line-of-sight"===e.parent.type){return(await this.whenLayerView(e.parent)).whenAnalysisView()}return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Xe(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Ye(i,this._pixelFormat())}_completeSettings(e){const t=Ze(e,this);return t.pixelRatio/=this.state.pixelRatio,Je(t,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){return{takeScreenshot:e=>this._takeScreenshot(e)}}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return le.importLayerView(e)}hasLayerViewModule(e){return le.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=it(this.type);if(h("safari")&&h("safari")<9&&(e=new a("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:h("safari")})),f(e))throw lt.warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return f(e)?oe(e):null}getSpatialReferenceSupport({spatialReference:e,layer:t}){const i=this._predeterminedViewingMode;if(f(i))return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,ne.Local),s=this._validateSpatialReferenceForViewingMode(e,t,ne.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,ne.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,ne.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!tt(e,i)&&(!!m(t)||(!!X(t)||(!Y(t)||!m(He(t,e,i)))&&(!Z(t)||i!==ne.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(m(t))return[{spatialReference:e,viewingMode:i}];const r=e.isWebMercator,s=e.isWGS84;if(X(t)&&(r||s)){return!s||i===ne.Local||null===Ue(t.tileInfo,t.fullExtent,e,ne.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:at.WebMercator,viewingMode:i}]:[{spatialReference:r?at.WGS84:at.WebMercator,viewingMode:i}]}return Y(t)||Z(t)||!r&&!s?Y(t)&&r&&i!==ne.Global?[{spatialReference:e,viewingMode:i},{spatialReference:at.WGS84,viewingMode:ne.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?at.WGS84:at.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=f(this.getSpatialReferenceSupport({spatialReference:e})),i=this._predeterminedViewingMode;return t||(f(i)?lt.warnOnce(`Spatial reference defined on view not supported in ${ae(i)} viewing mode.`):e.isGeographic&<.warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}computeMapPointFromVec3d(e,t){let i=this.spatialReference||at.WGS84;return D(e,this.renderSpatialReference,e,i)||(i=at.WGS84,D(e,this.renderSpatialReference,e,i)),t?(t.x=e[0],t.y=e[1],t.z=e[2],t.spatialReference=i):t=new ot(e,i),t}trackGraphicState(e){if(!e.graphic)return lt.error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&f(t)&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return f(t)?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,f(i)&&(i.remove(),i=null)}}}highlight(e){if(Array.isArray(e))return l(e.map((e=>this.highlight(e))));if(s.isCollection(e))return l(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):p()}maskOccludee(e){if(!e)return lt.error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&f(t)&&$e(t)&&(i=t.maskOccludee(e))};return f(t)?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,f(i)&&(i.remove(),i=null)}}}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){f(this.graphicsView)&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await R((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new a("no-view-for-graphic");return t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer)}externalToInternalIntersectOptions(e){const t=this._externalToInternalRenderItems(e.include,ut.INCLUDE),i=this._externalToInternalRenderItems(e.exclude,ut.EXCLUDE);return{include:t.layerUids,exclude:i.layerUids,graphics:{include:t.graphicUids,exclude:i.graphicUids}}}_intersectResultToMapPoint(e,t){return e.getIntersectionPoint(gt)?(t=this.computeMapPointFromVec3d(gt,t),e.intersector===qe.TERRAIN&&this.basemapTerrain&&(t.z=y(Re(this.basemapTerrain,t),0)),t):null}_intersectResultsToHits(e,t){const i=new Array;let r=null;for(let s=0;s<e.length;s++){const n=e[s],a=Ne(n,this);if(f(a)&&(a===this.map.ground||"type"in a&&"integrated-mesh"===a.type))break;const o=ze(n,this);if(m(o))continue;if("graphic"===o.type){if(m(r)&&s!==e.length-1&&(r=new Set),f(r)){const e=this._getGraphicFilterUid(o.graphic);if(r.has(e))continue;r.add(e)}if(!this._testGraphicUidFilter(t,o.graphic))continue}const l=this._intersectResultToMapPoint(n),p=n.distanceInRenderSpace;i.push({...o,mapPoint:l,distance:p})}return i}_getGraphicFilterUid(e){if(e.layer&&"objectIdField"in e.layer){const t=e.attributes[e.layer.objectIdField];if(t)return`o-${e.layer.id}-${t}`}return`u-${e.uid}`}_testGraphicUidFilter(e,t){const i=this._getGraphicFilterUid(t);return m(e)||(m(e.include)||e.include.has(i))&&(m(e.exclude)||!e.exclude.has(i))}_externalToInternalRenderItems(e,t,r={layerUids:null,graphicUids:null}){if(!e)return r;if(e instanceof i)dt(r,this._getGraphicFilterUid(e)),t===ut.INCLUDE&&(f(this.graphicsView)&&e.layer===this?ht(r,this.graphicsView.processor.layer.id):e.layer&&ht(r,e.layer.uid));else if(d(e))for(const i of e)i===this.graphics&&f(this.graphicsView)?ht(r,this.graphicsView.processor.layer.id):i===this.map.ground?ht(r,Be):this._externalToInternalRenderItems(i,t,r);else"uid"in e&&ht(r,e.uid);return r}_initBasemapTerrain(){this._set("basemapTerrain",new Le({view:this})),this._set("elevationProvider",new be({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Ie({view:this})),this._set("featureTiles",new ye({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.contentCameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=f(this.basemapTerrain.extent)?W(z(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;f(this.clippingArea)?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.handles.add([this.updatingHandles.add((()=>Se.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this.featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this.featureTreeDebugger&&Se.FEATURE_TILE_TREE_SHOW_TILES&&(this.featureTreeDebugger=new e({view:this}))})):e||!this.featureTreeDebugger||Se.FEATURE_TILE_TREE_SHOW_TILES||(this.featureTreeDebugger.destroy(),this.featureTreeDebugger=null)}),M),this.updatingHandles.add((()=>this.clippingArea),e,M),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,M)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.deinit(),this.handles.remove("render-coords-helper"),this.handles.remove("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference;this.mapCoordsHelper&&this.mapCoordsHelper.spatialReference.equals(e)||this._set("mapCoordsHelper",new Te(this.map,e));const t=this.state.isGlobal,i=Q(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Oe.create(this.state.viewingMode,i)),t||this.handles.add(b((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;e&&(0!==e[0]||0!==e[1]||0!==e[2]||0!==e[3])&&q(e,this.basemapTerrain.spatialReference,ft,t)&&(this.renderCoordsHelper.extent=ft)}),V),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Fe/this.renderCoordsHelper.unitInMeters))}else this._set("mapCoordsHelper",null),this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.mapCoordsHelper&&(this.handles.remove("render-coords-helper"),this._set("renderCoordsHelper",null),this._set("mapCoordsHelper",null))}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){f(e)&&e.type===w.MOVE||(this.handles.remove("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.handles.add(b((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),{sync:!0,equals:c}),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}_renderScreenshotOverlay(e,t){if(!this.overlay||!this.overlay.hasVisibleItems)return t;const i=e.getContext("2d");return i.putImageData(t,0,0),this.overlay.renderCanvas(e),i.getImageData(0,0,t.width,t.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,canvas:this.renderCanvas,screenshot:{renderOverlay:(e,t)=>this._renderScreenshotOverlay(e,t)}},t=new _e(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=n(this.surface),{resourceController:r,state:s,renderSpatialReference:l}=this;this._stage=new Ae({options:e,container:i,resourceController:r,state:s,sceneIntersectionHelper:t,renderSR:l}),this._stage.renderView.setRenderParameters({slicePlane:this.slicePlane}),this._lostWebGLContextHandle=o(this._stage.renderView.canvas,"webglcontextlost",(()=>this.fatalError=new a("webgl-context-lost"))),this.handles.add([this.updatingHandles.add((()=>this.qualitySettings.antialiasingEnabled),(()=>this._stage.renderView.setRenderParameters({antialiasingEnabled:this.qualitySettings.antialiasingEnabled})),S),this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(()=>this._stage.renderView.setRenderParameters({highQualityTransparency:this.qualitySettings.highQualityTransparency})),S),b((()=>this.magnifier),(e=>this._stage.renderView.magnifier=e),M)],"stage");const p=()=>{this._stage.renderView.setRenderParameters({defaultHighlightOptions:Ve.toEngineOptions(this.highlightOptions)})};this.handles.add(this.updatingHandles.add((()=>[this.highlightOptions.color,this.highlightOptions.haloColor,this.highlightOptions.haloOpacity,this.highlightOptions.fillOpacity,this.highlightOptions.shadowOpacity,this.highlightOptions.shadowColor,this.highlightOptions.shadowDifference]),p),"stage"),p(),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Fe/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage.destroy(),this._stage=null,this._lostWebGLContextHandle.remove(),this._lostWebGLContextHandle=null,this.handles.remove("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Pe({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state,objectResourceCache:new fe})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.handles.remove("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;v(e),await R((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.handles.remove("graphics-view"),f(this.graphicsView)&&(this.handles.remove(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=oe(this.viewingMode);if(e===ne.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.handles.add(_((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded(),!this._externallySet.environment){const e=this.get("map.initialViewProperties.environment");e&&(this.environment=e)}this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const t=this._resolveWhenReady;this._resolveWhenReady=[],t.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this.labeler.dispose(),this._disposeGraphicsView(),this.handles.remove("graphics-view"),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(Be);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(Be);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&e.opacity<1&&this._defaultToMapOptions.exclude.add(e.uid)}}addVoxelLayerViewToWasm(e){return m(this.voxelWasm)?(m(this.voxelWasmPromise)&&(this.voxelWasmPromise=import("../layers/VoxelWasmPerSceneView.js").then((e=>(this.voxelWasm=new e.default(this),this.voxelWasm)))),this.voxelWasmPromise.then((t=>t.addVoxelLayer(e)))):this.voxelWasm.addVoxelLayer(e)}removeVoxelLayerViewFromWasm(e){if(f(this.voxelWasm)){this.voxelWasm.removeVoxelLayer(e)<1&&(this.voxelWasm=null,this.voxelWasmPromise=null)}}};function ht(e,t){e.layerUids||(e.layerUids=new Set),e.layerUids.add(t)}function dt(e,t){e.graphicUids||(e.graphicUids=new Set),e.graphicUids.add(t)}function ct(e,t){return f(e)&&A(e.spatialReference,t)?W(e,t):null}var ut;pt.type="3d",e([j()],pt.prototype,"_userClippingArea",void 0),e([j()],pt.prototype,"_resourceController",void 0),e([j()],pt.prototype,"_stage",void 0),e([j({readOnly:!0})],pt.prototype,"deconflictor",void 0),e([j({readOnly:!0})],pt.prototype,"labeler",void 0),e([j(H(J,"analyses"))],pt.prototype,"analyses",void 0),e([j({type:se,readOnly:!0,aliasOf:"state.animation"})],pt.prototype,"animation",void 0),e([j({readOnly:!0})],pt.prototype,"basemapTerrain",void 0),e([j({readOnly:!0})],pt.prototype,"elevationProvider",void 0),e([j({type:t,aliasOf:"stateManager.camera"})],pt.prototype,"camera",void 0),e([j({type:t,aliasOf:"stateManager.contentCamera"})],pt.prototype,"contentCamera",void 0),e([j({readOnly:!0})],pt.prototype,"canvas",void 0),e([j({type:ot,aliasOf:"stateManager.center"})],pt.prototype,"center",void 0),e([j({type:nt})],pt.prototype,"clippingArea",null),e([j({type:he})],pt.prototype,"constraints",void 0),e([j({type:nt,readOnly:!0})],pt.prototype,"renderDataExtent",null),e([j({type:nt,readOnly:!0})],pt.prototype,"dataExtent",null),e([j({type:nt,readOnly:!0})],pt.prototype,"groundAndLayersExtent",null),e([j({value:null,type:de})],pt.prototype,"environment",null),e([P("environment")],pt.prototype,"castEnvironment",null),e([j({readOnly:!0})],pt.prototype,"environmentManager",void 0),e([j({type:nt,aliasOf:"stateManager.extent"})],pt.prototype,"extent",void 0),e([j()],pt.prototype,"floors",void 0),e([j({readOnly:!0,aliasOf:"stateManager.screenCenter"})],pt.prototype,"screenCenter",void 0),e([j({aliasOf:"stateManager.frustum"})],pt.prototype,"frustum",void 0),e([j({type:Number,readOnly:!0})],pt.prototype,"fullOpacity",void 0),e([j({readOnly:!0})],pt.prototype,"graphicsView",void 0),e([j({readOnly:!0})],pt.prototype,"analysisViewManager",void 0),e([j()],pt.prototype,"groundView",void 0),e([j({type:Boolean})],pt.prototype,"initialExtentRequired",null),e([j()],pt.prototype,"_defaultsFromMapSettings",null),e([j({type:Boolean,readOnly:!0})],pt.prototype,"interacting",null),e([j()],pt.prototype,"stationary",null),e([j({aliasOf:"state.navigating"})],pt.prototype,"navigating",void 0),e([j()],pt.prototype,"map",void 0),e([j({readOnly:!0})],pt.prototype,"mapCoordsHelper",void 0),e([j({aliasOf:"stateManager.padding"})],pt.prototype,"padding",void 0),e([j({type:Ie,readOnly:!0})],pt.prototype,"pointsOfInterest",void 0),e([j({type:ye,readOnly:!0})],pt.prototype,"featureTiles",void 0),e([j()],pt.prototype,"featureTreeDebugger",void 0),e([j({type:Boolean})],pt.prototype,"screenSizePerspectiveEnabled",void 0),e([j({constructOnly:!0})],pt.prototype,"deactivatedWebGLExtensions",void 0),e([j({constructOnly:!0})],pt.prototype,"debugWebGLExtensions",void 0),e([j({constructOnly:!0})],pt.prototype,"renderCanvas",void 0),e([j({constructOnly:!0})],pt.prototype,"state",void 0),e([j({readOnly:!0})],pt.prototype,"inputManager",void 0),e([j({readOnly:!0})],pt.prototype,"stateManager",void 0),e([j({type:["low","medium","high"]})],pt.prototype,"qualityProfile",null),e([j({type:xe,get(){let e=this._get("qualitySettings");return e||(e=new xe,Me.apply(this.qualityProfile,e)),e}})],pt.prototype,"qualitySettings",void 0),e([j()],pt.prototype,"slicePlane",null),e([j({readOnly:!0})],pt.prototype,"typeSpecificPreconditionsReady",null),e([j({readOnly:!0})],pt.prototype,"renderCoordsHelper",void 0),e([j({readOnly:!0})],pt.prototype,"sceneIntersectionHelper",void 0),e([j({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],pt.prototype,"resolution",null),e([j({type:Number,aliasOf:"stateManager.scale"})],pt.prototype,"scale",void 0),e([j()],pt.prototype,"heightModelInfo",null),e([j()],pt.prototype,"spatialReference",void 0),e([j({type:Boolean,constructOnly:!0})],pt.prototype,"alphaCompositingEnabled",void 0),e([j({type:Boolean})],pt.prototype,"supersampleScreenshotsEnabled",void 0),e([j({readOnly:!0})],pt.prototype,"type",void 0),e([j({type:rt})],pt.prototype,"ui",void 0),e([j({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.hasPendingInputs","toolViewManager.updating","analysisViewManager.updating"]})],pt.prototype,"updating",null),e([j({type:Number,readOnly:!0,dependsOn:["updating"]})],pt.prototype,"updatingProgress",void 0),e([j({type:["global","local"]})],pt.prototype,"viewingMode",null),e([j({type:r,aliasOf:"stateManager.viewpoint"})],pt.prototype,"viewpoint",void 0),e([j({type:Number,aliasOf:"stateManager.zoom"})],pt.prototype,"zoom",void 0),e([j({type:Ve})],pt.prototype,"highlightOptions",void 0),pt=e([I("esri.views.SceneView")],pt),function(e){e[e.INCLUDE=0]="INCLUDE",e[e.EXCLUDE=1]="EXCLUDE"}(ut||(ut={}));const gt=G(),mt=O(),ft=k(),yt=pt;export{yt as default};
|