@arcgis/core 4.25.0-next.20220921 → 4.25.0-next.20220923
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/README.md +17 -9
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/10892098faaf2f36fd0a.js +1 -0
- package/assets/esri/core/workers/chunks/28932ef68b6f3784c760.js +1 -0
- package/assets/esri/core/workers/chunks/2dca9023f01864f724cb.js +1 -0
- package/assets/esri/core/workers/chunks/477e02c178d392cde5d3.js +1 -0
- package/assets/esri/core/workers/chunks/{cc7569489b572b8b3b53.js → 4ef7e925f94ee85f79bb.js} +1 -1
- package/assets/esri/core/workers/chunks/b175a80296002ee9bca8.js +1 -0
- package/assets/esri/core/workers/chunks/{b8eba8c9d5424a7ae5f2.js → c06e7bd2468646631db2.js} +1 -1
- package/assets/esri/core/workers/chunks/e00327925ca82b63fded.js +1 -0
- package/assets/esri/core/workers/chunks/{64de93865088bbe0398f.js → e57a4d66f74510ce7a61.js} +1 -1
- package/assets/esri/core/workers/chunks/fb82788888990fbea11e.js +1 -0
- package/assets/esri/libs/linkchartlayout/lclayout.wasm +0 -0
- package/assets/esri/themes/base/widgets/_BasemapGallery.scss +2 -2
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/dark/main.scss +7 -5
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_ar.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_bg.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_bs.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_ca.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_cs.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_da.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_de.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_el.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_en.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_es.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_et.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_fi.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_fr.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_he.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_hr.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_hu.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_id.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_it.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_ja.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_ko.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_lt.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_lv.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_nb.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_nl.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_pl.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_pt-BR.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_pt-PT.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_ro.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_ru.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_sk.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_sl.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_sr.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_sv.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_th.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_tr.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_uk.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_vi.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_zh-CN.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_zh-HK.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_zh-TW.json +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/form/elements/inputs/ComboBoxInput.js +1 -1
- package/form/elements/inputs/RadioButtonsInput.js +1 -1
- package/interfaces.d.ts +957 -5
- package/libs/linkchartlayout/LinkChartLayout.js +1 -1
- package/networks/Network.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/networks/support/NetworkSystemLayers.js +5 -0
- package/package.json +1 -1
- package/rest/knowledgeGraph/DataModel.d.ts +4 -0
- package/rest/knowledgeGraph/Entity.d.ts +4 -0
- package/rest/knowledgeGraph/EntityType.d.ts +4 -0
- package/rest/knowledgeGraph/FieldIndex.d.ts +4 -0
- package/rest/knowledgeGraph/GraphNamedObject.d.ts +4 -0
- package/rest/knowledgeGraph/GraphObject.d.ts +4 -0
- package/rest/knowledgeGraph/GraphObjectType.d.ts +4 -0
- package/rest/knowledgeGraph/GraphProperty.d.ts +4 -0
- package/rest/knowledgeGraph/GraphQuery.d.ts +4 -0
- package/rest/knowledgeGraph/GraphQueryResult.d.ts +4 -0
- package/rest/knowledgeGraph/GraphSearch.d.ts +4 -0
- package/rest/knowledgeGraph/KnowledgeGraph.d.ts +4 -0
- package/rest/knowledgeGraph/Path.d.ts +4 -0
- package/rest/knowledgeGraph/Relationship.d.ts +4 -0
- package/rest/knowledgeGraph/RelationshipType.d.ts +4 -0
- package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
- package/rest/knowledgeGraphService.d.ts +4 -0
- package/rest/support/AggregateFeatureSet.js +1 -1
- package/support/featureFlags.js +1 -1
- package/support/revision.js +1 -1
- package/support/webSceneUtils.js +1 -1
- package/views/2d/MapViewConstraints.js +1 -1
- package/views/2d/constraints/GeometryConstraint.js +1 -1
- package/views/2d/constraints/RotationConstraint.js +1 -1
- package/views/2d/constraints/ZoomConstraint.js +1 -1
- package/views/2d/layers/MapImageLayerView2D.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/schemaUtils.js +1 -1
- package/views/2d/layers/features/sources/DataTileSource.js +1 -1
- package/views/2d/layers/features/support/ClusterStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
- package/views/3d/layers/MapImageLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerFeatureView3D.js +5 -0
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/interactive/tooltip/ReshapeTooltipInfos.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentReshapeEdgeOffset.js +1 -1
- package/views/layers/MapImageLayerView.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/Feature/FeatureRelationship.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/FormExpressionArcadeExecutor.js +5 -0
- package/widgets/FeatureForm/FormExpressionsManager.js +5 -0
- package/widgets/FeatureForm/InputField.js +1 -1
- package/widgets/FeatureForm/InputFieldGroup.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/01ac91fc0bc6b4d4e3c6.js +0 -1
- package/assets/esri/core/workers/chunks/43e4560d65e5ddeeef6f.js +0 -1
- package/assets/esri/core/workers/chunks/58824250492b89ec24ea.js +0 -1
- package/assets/esri/core/workers/chunks/64a6b837f1d5d7ad7619.js +0 -1
- package/assets/esri/core/workers/chunks/d1be3ab7846e3a555b6c.js +0 -1
- package/assets/esri/core/workers/chunks/e20e99f8f76f5002437e.js +0 -1
- package/assets/esri/core/workers/chunks/ef95d6ab7b1c032ab4ad.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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getAssetUrl as t}from"../../assets.js";let n,r=null;function a(){return!!r}function
|
|
5
|
+
import{getAssetUrl as t}from"../../assets.js";let n,r=null;function a(){return!!r}function e(){return n||(n=import("../../chunks/lclayout.js").then((t=>t.l)).then((({default:n})=>n({locateFile:n=>t(`esri/libs/linkchartlayout/${n}`)}))).then((t=>{o(t)})),n)}function o(t){r=t}var u,l,i,s,c,y,p;function f(t,n,a,e,o,u){const l=a.length,i=o.length,s=Float64Array.BYTES_PER_ELEMENT,c=Uint32Array.BYTES_PER_ELEMENT,y=Uint8Array.BYTES_PER_ELEMENT,p=16,f=p-1+l*(y+2*s)+i*(2*c),E=r._malloc(f);try{const y=E+p-E%p,f=y+l*s,h=f+l*s,L=h+i*c,b=L+i*c,m=()=>[r.HEAPF64.subarray(y>>3,(y>>3)+l),r.HEAPF64.subarray(f>>3,(f>>3)+l),r.HEAPU32.subarray(h>>2,(h>>2)+i),r.HEAPU32.subarray(L>>2,(L>>2)+i),r.HEAPU8.subarray(b,b+l)],[A,P,T,_,H]=m();A.set(a),P.set(e),T.set(o),_.set(u),H.set(n);const I=t(l,b,y,f,i,h,L),[R,F,M,N,S]=m();return a.set(R),e.set(F),o.set(M),u.set(N),n.set(S),I}finally{r._free(E)}}!function(t){t[t.None=0]="None",t[t.IsMovable=1]="IsMovable",t[t.IsGeographic=2]="IsGeographic",t[t.IsRoot=4]="IsRoot"}(u||(u={})),function(t){function n(t,n,a,e,o){return f(r.applyForceDirectedLayout,t,n,a,e,o)}t.apply=n}(l||(l={})),function(t){function n(t,n,a,e,o){return f(r.applyCommunityLayout,t,n,a,e,o)}t.apply=n}(i||(i={})),function(t){function n(t,n,a,e,o){return f(r.applySimpleLayout,t,n,a,e,o)}t.apply=n}(s||(s={})),function(t){function n(t,n,a,e,o){return f(r.applyHierarchicalLayout,t,n,a,e,o)}t.apply=n}(c||(c={})),function(t){function n(t,n,a,e,o){return f(r.applyRadialTreeLayout,t,n,a,e,o)}t.apply=n}(y||(y={})),function(t){function n(t,n,a,e,o){return f(r.applySmartTreeLayout,t,n,a,e,o)}t.apply=n}(p||(p={}));export{i as LCCommunityLayout,l as LCForceDirectedLayout,c as LCHierarchicalLayout,y as LCRadialTreeLayout,s as LCSimpleLayout,p as LCSmartTreeLayout,u as NodeFlag,r as _lclayout,a as isLoaded,e as load};
|
package/networks/Network.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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/Loadable.js";import o from"../core/Logger.js";import{isSome as s}from"../core/maybe.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{isAbortError as i}from"../core/promiseUtils.js";import{urlToObject as n}from"../core/urlUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import p from"../geometry/Extent.js";import d from"../geometry/SpatialReference.js";import{parse as c}from"../layers/support/arcgisLayerUrl.js";import y from"../rest/networks/support/QueryNamedTraceConfigurationsParameters.js";let m=class extends(a(t)){constructor(e){super(e),this.id=null,this.title=null,this.layerUrl=null,this.dataElement=null,this.fullExtent=null,this.spatialReference=null,this.type=null,this.sourceJSON=null}initialize(){this.when().catch((e=>{i(e)||o.getLogger(this.declaredClass).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})}))}get datasetName(){return this.dataElement?.name??null}get owner(){return this.dataElement?.userIdentity??null}get schemaGeneration(){return this.dataElement?.schemaGeneration??null}get parsedUrl(){const e=this.layerUrl;return e?n(e):null}get featureServiceUrl(){const e=this.parsedUrl&&c(this.parsedUrl.path);return s(e)?e.url.path:null}get networkServiceUrl(){return this.featureServiceUrl?this.featureServiceUrl.replace(/\/FeatureServer/i,"/UtilityNetworkServer"):null}get layerId(){const e=this.parsedUrl&&c(this.parsedUrl.path);return s(e)?e.sublayer:null}async load(e){return this.addResolvingPromise(this._fetchDataElement(this.featureServiceUrl,this.layerId.toString(),e)),this.addResolvingPromise(this._fetchLayerMetaData(this.layerUrl,e)),this}getLayerIdBySourceId(e){if(this.dataElement){const r=this.dataElement.domainNetworks;for(const t of r){for(const r of t.edgeSources?t.edgeSources:[])if(r.sourceId===e)return r.layerId;for(const r of t.junctionSources?t.junctionSources:[])if(r.sourceId===e)return r.layerId}return null}return null}async queryNamedTraceConfigurations(e,r){const{queryNamedTraceConfigurations:t}=await import("../rest/networks/queryNamedTraceConfigurations.js"),o=this.networkServiceUrl,s=new y({...e});return(await t(o,s,{...r}))?.namedTraceConfigurations??null}async _fetchLayerMetaData(e,t){const o=await r(e,{responseType:"json",query:{f:"json"},...t});this.sourceJSON=o.data,this.read(o.data,{origin:"service"})}async _fetchDataElement(e,t,o){if(this.dataElement)return;const s=await r(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([t]),f:"json"},...o}).then((e=>e.data.layerDataElements?.[0]));s&&this.read(s,{origin:"service"})}};e([l({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}}},read:!1}})],m.prototype,"id",void 0),e([l({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}}},read:!1}})],m.prototype,"title",void 0),e([l({type:String,nonNullable:!0,json:{origins:{"web-map":{read:{source:"url"},write:{target:"url",isRequired:!0}}},read:!1}})],m.prototype,"layerUrl",void 0),e([l({type:Object,json:{origins:{service:{read:!0}},read:!1}})],m.prototype,"dataElement",void 0),e([l({type:p,json:{origins:{service:{read:{source:"extent"}}},read:!1}})],m.prototype,"fullExtent",void 0),e([l({type:d,json:{origins:{service:{read:{source:"extent.spatialReference"}}},read:!1}})],m.prototype,"spatialReference",void 0),e([l({type:["utility","trace"],readOnly:!0,json:{read:!1,write:!1}})],m.prototype,"type",void 0),e([l({readOnly:!0})],m.prototype,"datasetName",null),e([l({readOnly:!0})],m.prototype,"owner",null),e([l({readOnly:!0})],m.prototype,"schemaGeneration",null),e([l({readOnly:!0})],m.prototype,"parsedUrl",null),e([l({readOnly:!0})],m.prototype,"featureServiceUrl",null),e([l({readOnly:!0})],m.prototype,"networkServiceUrl",null),e([l({readOnly:!0})],m.prototype,"layerId",null),e([l()],m.prototype,"sourceJSON",void 0),m=e([u("esri.networks.Network")],m);const h=m;export{h as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/Loadable.js";import o from"../core/Logger.js";import{isSome as s}from"../core/maybe.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{isAbortError as i}from"../core/promiseUtils.js";import{urlToObject as n}from"../core/urlUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import p from"../geometry/Extent.js";import d from"../geometry/SpatialReference.js";import{parse as c}from"../layers/support/arcgisLayerUrl.js";import y from"../rest/networks/support/QueryNamedTraceConfigurationsParameters.js";let m=class extends(a(t)){constructor(e){super(e),this.id=null,this.title=null,this.layerUrl=null,this.dataElement=null,this.fullExtent=null,this.spatialReference=null,this.type=null,this.sourceJSON=null}initialize(){this.when().catch((e=>{i(e)||o.getLogger(this.declaredClass).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})}))}get datasetName(){return this.dataElement?.name??null}get owner(){return this.dataElement?.userIdentity??null}get schemaGeneration(){return this.dataElement?.schemaGeneration??null}get parsedUrl(){const e=this.layerUrl;return e?n(e):null}get featureServiceUrl(){const e=this.parsedUrl&&c(this.parsedUrl.path);return s(e)?e.url.path:null}get networkServiceUrl(){return this.featureServiceUrl?this.featureServiceUrl.replace(/\/FeatureServer/i,"/UtilityNetworkServer"):null}get layerId(){const e=this.parsedUrl&&c(this.parsedUrl.path);return s(e)?e.sublayer:null}get networkSystemLayers(){return null}async load(e){return this.addResolvingPromise(this._fetchDataElement(this.featureServiceUrl,this.layerId.toString(),e)),this.addResolvingPromise(this._fetchLayerMetaData(this.layerUrl,e)),this}getLayerIdBySourceId(e){if(this.dataElement){const r=this.dataElement.domainNetworks;for(const t of r){for(const r of t.edgeSources?t.edgeSources:[])if(r.sourceId===e)return r.layerId;for(const r of t.junctionSources?t.junctionSources:[])if(r.sourceId===e)return r.layerId}return null}return null}async queryNamedTraceConfigurations(e,r){const{queryNamedTraceConfigurations:t}=await import("../rest/networks/queryNamedTraceConfigurations.js"),o=this.networkServiceUrl,s=new y({...e});return(await t(o,s,{...r}))?.namedTraceConfigurations??null}async _fetchLayerMetaData(e,t){const o=await r(e,{responseType:"json",query:{f:"json"},...t});this.sourceJSON=o.data,this.read(o.data,{origin:"service"})}async _fetchDataElement(e,t,o){if(this.dataElement)return;const s=await r(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([t]),f:"json"},...o}).then((e=>e.data.layerDataElements?.[0]));s&&this.read(s,{origin:"service"})}};e([l({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}}},read:!1}})],m.prototype,"id",void 0),e([l({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}}},read:!1}})],m.prototype,"title",void 0),e([l({type:String,nonNullable:!0,json:{origins:{"web-map":{read:{source:"url"},write:{target:"url",isRequired:!0}}},read:!1}})],m.prototype,"layerUrl",void 0),e([l({type:Object,json:{origins:{service:{read:!0}},read:!1}})],m.prototype,"dataElement",void 0),e([l({type:p,json:{origins:{service:{read:{source:"extent"}}},read:!1}})],m.prototype,"fullExtent",void 0),e([l({type:d,json:{origins:{service:{read:{source:"extent.spatialReference"}}},read:!1}})],m.prototype,"spatialReference",void 0),e([l({type:["utility","trace"],readOnly:!0,json:{read:!1,write:!1}})],m.prototype,"type",void 0),e([l({readOnly:!0})],m.prototype,"datasetName",null),e([l({readOnly:!0})],m.prototype,"owner",null),e([l({readOnly:!0})],m.prototype,"schemaGeneration",null),e([l({readOnly:!0})],m.prototype,"parsedUrl",null),e([l({readOnly:!0})],m.prototype,"featureServiceUrl",null),e([l({readOnly:!0})],m.prototype,"networkServiceUrl",null),e([l({readOnly:!0})],m.prototype,"layerId",null),e([l()],m.prototype,"sourceJSON",void 0),e([l({readOnly:!0})],m.prototype,"networkSystemLayers",null),m=e([u("esri.networks.Network")],m);const h=m;export{h as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import s from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import o from"./Network.js";import n from"./RulesTable.js";import i from"./support/NamedTraceConfiguration.js";import l from"./support/TerminalConfiguration.js";import{RuleType as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import s from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import o from"./Network.js";import n from"./RulesTable.js";import i from"./support/NamedTraceConfiguration.js";import l from"./support/NetworkSystemLayers.js";import u from"./support/TerminalConfiguration.js";import{RuleType as d}from"./support/typeUtils.js";import m from"../rest/support/Query.js";let c=class extends o{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility"}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new l({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null})}get rulesTableId(){return this.sourceJSON?.systemLayers.rulesTableId}get rulesTableUrl(){return this.sourceJSON?`${this.featureServiceUrl}/${this.rulesTableId}`:null}get subnetworksTableId(){return this.sourceJSON?.systemLayers.subnetworksTableId}get subnetworksTableUrl(){return this.sourceJSON?`${this.featureServiceUrl}/${this.subnetworksTableId}`:null}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map((e=>u.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t.edgeSources.map((t=>{e.add(t.layerId)})),t.junctionSources.map((t=>{e.add(t.layerId)}))})),e}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let a=null;if("feature"!==s?.type)return null;if(a=s.layerId,null===a)return null;const o=e.attributes;if(null==o)return null;for(const l of Object.keys(o))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let n=null;const i=this.dataElement.domainNetworks;for(const l of i){const e=l.junctionSources?.find((e=>e.layerId===a));if(e){const s=e.assetGroups?.find((e=>e.assetGroupCode===t));if(s){const e=s.assetTypes?.find((e=>e.assetTypeCode===r));if(e){n=e.terminalConfigurationId;break}}}}if(null!=n){const e=this.dataElement.terminalConfigurations?.find((e=>e.terminalConfigurationId===n));return e?u.fromJSON(e):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find((t=>t.domainNetworkName===e));return t?.tiers.map((e=>e.name))||[]}async getRulesTable(){return this._createRulesTable()}isUtilityLayer(e){return this._utilityLayerList.has(e.layerId)}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map((e=>e.globalId)),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find((e=>e.globalId===s.globalId));if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}async _createRulesTable(){const e=new s({url:this.rulesTableUrl});await e.load();const t=this.dataElement?.domainNetworks;if(!t)return null;const r=t.flatMap((e=>[...e.edgeSources,...e.junctionSources])),a=(await this._queryRulesTable(e)).map((t=>this._hydrateRuleInfo(e,r,t)));return new n({layer:e,rules:a})}async _queryRulesTable(e){const t=new m({where:"1=1",outFields:["*"]});return(await a(e,t)).features}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,a=s.get("RULETYPE"),o=s.get("CREATIONDATE"),n=s.get("FROMNETWORKSOURCEID"),i=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),m=s.get("TONETWORKSOURCEID"),c=s.get("TOASSETGROUP"),y=s.get("TOASSETTYPE"),p=s.get("TOTERMINALID"),f=s.get("VIANETWORKSOURCEID"),T=s.get("VIAASSETGROUP"),g=s.get("VIAASSETTYPE"),I=s.get("VIATERMINALID"),b=r.attributes[a.name],h=new Date(r.attributes[o.name]),S=[{networkSourceId:r.attributes[n.name],assetGroupId:r.attributes[i.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[m.name],assetGroupId:r.attributes[c.name],assetTypeId:r.attributes[y.name],terminalId:r.attributes[p.name]},{networkSourceId:r.attributes[f.name],assetGroupId:r.attributes[T.name],assetTypeId:r.attributes[g.name],terminalId:r.attributes[I.name]}];let N;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(N||(N={}));const w={ruleType:b,creationDate:h};for(const O of[N.from,N.to,N.via]){if(b!==d.RTEdgeJunctionEdgeConnectivity&&O===N.via)continue;const e=S[O],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),a=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId));let o=this._getTerminal(b,a,e);b!==d.RTContainment&&b!==d.RTAttachment||(o=null);let n="";switch(O){case N.from:n="from";break;case N.to:n="to";break;case N.via:n="via"}w[`${n}NetworkSource`]=r,w[`${n}AssetGroup`]=s,w[`${n}AssetType`]=a,w[`${n}Terminal`]=o}return w}_getTerminal(e,t,r){if(e===d.RTAttachment||e===d.RTContainment)return null;const s=t?.terminalConfigurationId,a=this.terminalConfigurations?.find((e=>e.id===s));return a?.terminals?.find((e=>e.id===r.terminalId))??null}};e([t({type:[i],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],c.prototype,"sharedNamedTraceConfigurations",void 0),e([t({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],c.prototype,"type",void 0),e([t({readOnly:!0})],c.prototype,"serviceTerritoryFeatureLayerId",null),e([t({readOnly:!0})],c.prototype,"networkSystemLayers",null),e([t({readOnly:!0})],c.prototype,"rulesTableId",null),e([t({readOnly:!0})],c.prototype,"rulesTableUrl",null),e([t({readOnly:!0})],c.prototype,"subnetworksTableId",null),e([t({readOnly:!0})],c.prototype,"subnetworksTableUrl",null),e([t({readOnly:!0})],c.prototype,"terminalConfigurations",null),e([t({readOnly:!0})],c.prototype,"domainNetworkNames",null),c=e([r("esri.networks.UtilityNetwork")],c);const y=c;export{y as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";let e=class extends s{constructor(r){super(r),this.rulesTableId=null,this.rulesTableUrl=null,this.subnetworksTableId=null,this.subnetworksTableUrl=null,this.dirtyAreasLayerId=null,this.dirtyAreasLayerUrl=null}};r([o({constructOnly:!0})],e.prototype,"rulesTableId",void 0),r([o({constructOnly:!0})],e.prototype,"rulesTableUrl",void 0),r([o({constructOnly:!0})],e.prototype,"subnetworksTableId",void 0),r([o({constructOnly:!0})],e.prototype,"subnetworksTableUrl",void 0),r([o({constructOnly:!0})],e.prototype,"dirtyAreasLayerId",void 0),r([o({constructOnly:!0})],e.prototype,"dirtyAreasLayerUrl",void 0),e=r([t("esri.networks.support.NetworkSystemLayers")],e);const l=e;export{l as default};
|
package/package.json
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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../GraphApplyEditsResult.js";function r(r){const t=new e;t.hasError=r.has_error(),t.hasError&&(t.error={errorCode:r.error.error_code,errorMessage:r.error.error_message});const
|
|
5
|
+
import e from"../GraphApplyEditsResult.js";function r(r){const t=new e;t.hasError=r.has_error(),t.hasError&&(t.error={errorCode:r.error.error_code,errorMessage:r.error.error_message});const s=r.get_edit_results_count();for(let e=0;e<s;e++){const s=r.get_edit_results_at(e),o=r.get_edit_results_type_name_at(e),_=[],d=[],l=[],u=s.get_add_results_count(),a=s.get_update_results_count(),n=s.get_delete_results_count();for(let e=0;e<u;e++){const r=s.get_add_result_at(e);_.push({id:r.globalId,error:r.error})}for(let e=0;e<a;e++){const r=s.get_update_result_at(e);d.push({id:r.globalId,error:r.error})}for(let e=0;e<n;e++){const r=s.get_delete_result_at(e);l.push({id:r.globalId,error:r.error})}t.editResults.push({typeName:o,adds:_,updates:d,deletes:l})}return t}export{r as decoderToApplyEditsResponse};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../AggregateGraphic.js";import"../../geometry.js";import{isSome as t}from"../../core/maybe.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{reader as s}from"../../core/accessorSupport/decorators/reader.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import p from"./FeatureSet.js";import c from"../../geometry/SpatialReference.js";let m=class extends p{constructor(){super(...arguments),this.features=[]}readFeatures(e,o){const s=c.fromJSON(o.spatialReference),a=[];for(let p=0;p<e.length;p++){const o=e[p],c=r.fromJSON(o),m=o.geometry&&o.geometry.spatialReference;t(c.geometry)&&!m&&(c.geometry.spatialReference=s);const i=o.aggregateGeometries,f=c.aggregateGeometries;if(i&&t(f))for(const e in f){const r=f[e],o=i[e]?.spatialReference;t(r)&&!o&&(r.spatialReference=s)}a.push(c)}return a}};e([o({type:[r],json:{write:!0}})],m.prototype,"features",void 0),e([s("features")],m.prototype,"readFeatures",null),m=e([a("esri.rest.support.AggregateFeatureSet")],m);const i=m;export{i as default};
|
package/support/featureFlags.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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../core/has.js";const e=()=>!!has("enable-feature:force-wosr"),
|
|
5
|
+
import has from"../core/has.js";const e=()=>!!has("enable-feature:force-wosr"),a=()=>!!has("enable-feature:direct-3d-object-feature-layer-display"),r=()=>has.cache["enable-feature:direct-3d-object-feature-layer-display"]=!0,t=()=>!!has("enable-feature:SceneLayer-editing"),c=()=>{has.cache["enable-feature:SceneLayer-editing"]=!0,r()};export{a as enableDirect3DObjectFeatureLayerDisplay,c as enableSceneLayerEditing,e as enableWebStyleForceWOSR,t as sceneLayerEditingEnabled,r as turnOnDirect3DObjectFeatureLayerDisplay};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const a="
|
|
5
|
+
const a="20220923",f="7df73a99e69aedca023b5f44bfc0a8a68f1afc7e";export{a as buildDate,f as commitHash};
|
package/support/webSceneUtils.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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../core/Error.js";const r="webscene:failed-to-copy-embedded-resources",o="webscene:schema-validation";function n(){return new e(r,"Copying of embedded resources is currently not supported")}function s(r){return new e(o,"Failed to save webscene due to schema validation errors. See 'details.errors' for more detailed information",{errors:r})}export{n as createCopyError,s as createSchemaValidationError};
|
|
5
|
+
import e from"../core/Error.js";const r="webscene:failed-to-copy-embedded-resources",o="webscene:schema-validation";function n(){return new e(r,"Copying of embedded resources is currently not supported")}function s(r){return new e(o,"Failed to save webscene due to schema validation errors. See 'details.errors' for more detailed information",{errors:r})}export{n as createCopyError,s as createSchemaValidationError,o as schemaValidationErrorName};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../chunks/tslib.es6.js";import"../../geometry.js";import e from"../../core/Accessor.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import s from"../../layers/support/LOD.js";import{GeometryConstraint as i}from"./constraints/GeometryConstraint.js";import n from"./constraints/RotationConstraint.js";import a from"./constraints/ZoomConstraint.js";import m from"../../geometry/Extent.js";import l from"../../geometry/Polygon.js";const p={base:null,key:"type",typeMap:{extent:m,polygon:l}};let c=class extends e{constructor(o){super(o),this.lods=null,this.minScale=0,this.maxScale=0,this.minZoom=-1,this.maxZoom=-1,this.rotationEnabled=!0,this.snapToZoom=!0}destroy(){this.view=null}get effectiveLODs(){return this._zoom.effectiveLODs}get effectiveMinScale(){return this._zoom.effectiveMinScale}get effectiveMaxScale(){return this._zoom.effectiveMaxScale}get effectiveMinZoom(){return this._zoom.effectiveMinZoom}get effectiveMaxZoom(){return this._zoom.effectiveMaxZoom}set geometry(o){o?this._set("geometry",o):this._set("geometry",null)}get version(){return
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import"../../geometry.js";import e from"../../core/Accessor.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import s from"../../layers/support/LOD.js";import{GeometryConstraint as i}from"./constraints/GeometryConstraint.js";import n from"./constraints/RotationConstraint.js";import a from"./constraints/ZoomConstraint.js";import m from"../../geometry/Extent.js";import l from"../../geometry/Polygon.js";const p={base:null,key:"type",typeMap:{extent:m,polygon:l}};let c=class extends e{constructor(o){super(o),this.lods=null,this.minScale=0,this.maxScale=0,this.minZoom=-1,this.maxZoom=-1,this.rotationEnabled=!0,this.snapToZoom=!0}destroy(){this.view=null}get effectiveLODs(){return this._zoom.effectiveLODs}get effectiveMinScale(){return this._zoom.effectiveMinScale}get effectiveMaxScale(){return this._zoom.effectiveMaxScale}get effectiveMinZoom(){return this._zoom.effectiveMinZoom}get effectiveMaxZoom(){return this._zoom.effectiveMaxZoom}set geometry(o){o?this._set("geometry",o):this._set("geometry",null)}get version(){return`${this._zoom?.uid}/${this._rotation?.uid}/${this._geometry?.uid}`}get _defaultLODs(){const o=this.view?.defaultsFromMap?.tileInfo,e=this.view?.spatialReference;return o&&e&&o.spatialReference.equals(e)?o.lods:null}get _geometry(){return new i({geometry:this.geometry,spatialReference:this.view?.spatialReference})}get _rotation(){return new n({rotationEnabled:this.rotationEnabled})}get _zoom(){const o=this._get("_zoom"),e=this.lods||this._defaultLODs,t=this.minZoom,r=this.maxZoom,s=this.minScale,i=this.maxScale,n=this.snapToZoom;return o&&o.lods===e&&o.minZoom===t&&o.maxZoom===r&&o.minScale===s&&o.maxScale===i&&o.snapToZoom===n?o:new a({lods:e,minZoom:t,maxZoom:r,minScale:s,maxScale:i,snapToZoom:n})}canZoomInTo(o){const e=this.effectiveMaxScale;return 0===e||o>=e}canZoomOutTo(o){const e=this.effectiveMinScale;return 0===e||o<=e}constrain(o,e){return this._zoom.constrain(o,e),this._rotation.constrain(o,e),this._geometry.constrain(o,e),o}constrainByGeometry(o){return this._geometry.constrain(o)}fit(o){return this._zoom.fit(o)}zoomToScale(o){return this._zoom.zoomToScale(o)}scaleToZoom(o){return this._zoom.scaleToZoom(o)}snapScale(o){return this._zoom.snapToClosestScale(o)}snapToNextScale(o){return this._zoom.snapToNextScale(o)}snapToPreviousScale(o){return this._zoom.snapToPreviousScale(o)}};o([t({readOnly:!0})],c.prototype,"effectiveLODs",null),o([t({readOnly:!0})],c.prototype,"effectiveMinScale",null),o([t({readOnly:!0})],c.prototype,"effectiveMaxScale",null),o([t({readOnly:!0})],c.prototype,"effectiveMinZoom",null),o([t({readOnly:!0})],c.prototype,"effectiveMaxZoom",null),o([t({types:p,value:null})],c.prototype,"geometry",null),o([t({type:[s]})],c.prototype,"lods",void 0),o([t()],c.prototype,"minScale",void 0),o([t()],c.prototype,"maxScale",void 0),o([t()],c.prototype,"minZoom",void 0),o([t()],c.prototype,"maxZoom",void 0),o([t()],c.prototype,"rotationEnabled",void 0),o([t()],c.prototype,"snapToZoom",void 0),o([t()],c.prototype,"view",void 0),o([t({readOnly:!0})],c.prototype,"version",null),o([t()],c.prototype,"_defaultLODs",null),o([t({type:i})],c.prototype,"_geometry",null),o([t({type:n})],c.prototype,"_rotation",null),o([t({readOnly:!0,type:a})],c.prototype,"_zoom",null),c=o([r("esri.views.2d.MapViewConstraints")],c);const u=c;export{u 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import t from"../../../core/Logger.js";import{isNone as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import{NumericIdentifiableMixin as t}from"../../../core/Identifiable.js";import o from"../../../core/Logger.js";import{isNone as s}from"../../../core/maybe.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{project as a}from"../../../geometry/projection.js";import{extentContainsPoint as m,polygonContainsPoint as c}from"../../../geometry/support/contains.js";import{nearestCoordinate as p}from"../../../geometry/support/near.js";var l;let y=l=class extends(t(r)){constructor(e){super(e),this.geometry=null,this.spatialReference=null}get normalizedGeometry(){if(s(this.geometry)||!this.spatialReference)return null;if(!this.spatialReference.equals(this.geometry.spatialReference))try{return a(this.geometry,this.spatialReference)}catch(e){return o.getLogger(this.declaredClass).error("#constraints.geometry","could not project the geometry to the view's spatial reference",{geometry:this.geometry,spatialReference:this.spatialReference,error:e}),null}return this.geometry}constrain(e,r){if(s(this.normalizedGeometry))return e;const t=e.targetGeometry;if("extent"===this.normalizedGeometry.type?m(this.normalizedGeometry,t):c(this.normalizedGeometry,t))return e;const{coordinate:o}=p(this.normalizedGeometry,t);return o?(e.targetGeometry=o,e):e}clone(){return new l({geometry:this.geometry?.clone(),spatialReference:this.spatialReference?.clone()})}};e([i({constructOnly:!0})],y.prototype,"geometry",void 0),e([i({readOnly:!0})],y.prototype,"normalizedGeometry",null),e([i({constructOnly:!0})],y.prototype,"spatialReference",void 0),y=l=e([n("esri.views.2d.constraints.GeometryConstraint")],y);export{y as GeometryConstraint};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import{
|
|
5
|
+
import{_ as o}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import{NumericIdentifiableMixin as t}from"../../../core/Identifiable.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";var a;let n=a=class extends(t(r)){constructor(){super(...arguments),this.enabled=!0,this.rotationEnabled=!0}constrain(o,r){return this.enabled&&r?(this.rotationEnabled||(o.rotation=r.rotation),o):o}clone(){return new a({enabled:this.enabled,rotationEnabled:this.rotationEnabled})}};o([e()],n.prototype,"enabled",void 0),o([e()],n.prototype,"rotationEnabled",void 0),n=a=o([s("esri.views.2d.constraints.RotationConstraint")],n);const i=n;export{i 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{NumericIdentifiableMixin as o}from"../../../core/Identifiable.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";var a;let c=a=class extends(o(t)){constructor(e){super(e),this._lodByScale={},this._scales=[],this.effectiveLODs=null,this.effectiveMinZoom=-1,this.effectiveMaxZoom=-1,this.effectiveMinScale=0,this.effectiveMaxScale=0,this.lods=null,this.minZoom=-1,this.maxZoom=-1,this.minScale=0,this.maxScale=0,this.snapToZoom=!0}initialize(){let e,{lods:t,minScale:o,maxScale:s,minZoom:i,maxZoom:a}=this,c=-1,r=-1,l=!1,n=!1;if(0!==o&&0!==s&&o<s&&([o,s]=[s,o]),!t||!t.length)return this._set("effectiveMinScale",o),void this._set("effectiveMaxScale",s);t=t.map((e=>e.clone())),t.sort(((e,t)=>t.scale-e.scale)),t.forEach(((e,t)=>e.level=t));for(const f of t)!l&&o>0&&o>=f.scale&&(c=f.level,l=!0),!n&&s>0&&s>=f.scale&&(r=e?e.level:-1,n=!0),e=f;-1===i&&(i=0===o?0:c),-1===a&&(a=0===s?t.length-1:r),i=Math.max(i,0),i=Math.min(i,t.length-1),a=Math.max(a,0),a=Math.min(a,t.length-1),i>a&&([i,a]=[a,i]),o=t[i].scale,s=t[a].scale,t.splice(0,i),t.splice(a-i+1,t.length),t.forEach(((e,t)=>{this._lodByScale[e.scale]=e,this._scales[t]=e.scale})),this._set("effectiveLODs",t),this._set("effectiveMinZoom",i),this._set("effectiveMaxZoom",a),this._set("effectiveMinScale",o),this._set("effectiveMaxScale",s)}constrain(e,t){if(t&&e.scale===t.scale)return e;const o=this.effectiveMinScale,s=this.effectiveMaxScale,i=e.targetGeometry,a=t&&t.targetGeometry,c=0!==s&&e.scale<s,r=0!==o&&e.scale>o;if(c||r){const c=r?o:s;if(t&&a){const o=(c-t.scale)/(e.scale-t.scale);i.x=a.x+(i.x-a.x)*o,i.y=a.y+(i.y-a.y)*o}e.scale=c}return this.snapToZoom&&this.effectiveLODs&&(e.scale=this._getClosestScale(e.scale)),e}fit(e){if(!this.effectiveLODs||!this.snapToZoom)return this.constrain(e,null);const t=this.scaleToZoom(e.scale),o=Math.abs(t-Math.floor(t));return e.scale=this.zoomToScale(o>.99?Math.round(t):Math.floor(t)),e}zoomToScale(e){if(!this.effectiveLODs)return 0;e-=this.effectiveMinZoom,e=Math.max(0,e);const t=this._scales;if(e<=0)return t[0];if(e>=t.length)return t[t.length-1];const o=Math.round(e-.5),s=Math.round(e);return t[s]+(s-e)*(t[o]-t[s])}scaleToZoom(e){if(!this.effectiveLODs)return-1;const t=this._scales;let o,s;if(e>=t[0])return this.effectiveMinZoom;if(e<=t[t.length-1])return this.effectiveMaxZoom;for(let i=0;i<t.length-1;i++){if(o=t[i],s=t[i+1],s===e){return i+this.effectiveMinZoom+1}if(o>e&&s<e){return i+this.effectiveMinZoom+1-(e-s)/(o-s)}}return-1}snapToClosestScale(e){if(!this.effectiveLODs)return e;const t=this.scaleToZoom(e);return this.zoomToScale(Math.round(t))}snapToNextScale(e,t=.5){if(!this.effectiveLODs)return e*t;const o=Math.round(this.scaleToZoom(e));return this.zoomToScale(o+1)}snapToPreviousScale(e,t=2){if(!this.effectiveLODs)return e*t;const o=Math.round(this.scaleToZoom(e));return this.zoomToScale(o-1)}clone(){return new a({lods:this.lods,minZoom:this.minZoom,maxZoom:this.maxZoom,minScale:this.minScale,maxScale:this.maxScale})}_getClosestScale(e){return this._lodByScale[e]||(e=this._scales.reduce(((t,o)=>Math.abs(o-e)<=Math.abs(t-e)?o:t),this._scales[0])),this._lodByScale[e].scale}};e([s({readOnly:!0})],c.prototype,"effectiveLODs",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMinZoom",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMaxZoom",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMinScale",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMaxScale",void 0),e([s()],c.prototype,"lods",void 0),e([s()],c.prototype,"minZoom",void 0),e([s()],c.prototype,"maxZoom",void 0),e([s()],c.prototype,"minScale",void 0),e([s()],c.prototype,"maxScale",void 0),e([s()],c.prototype,"snapToZoom",void 0),c=a=e([i("esri.views.2d.constraints.ZoomConstraint")],c);const r=c;export{r 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Logger.js";import{isAbortError as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Collection.js";import i from"../../../core/Logger.js";import{isAbortError as s}from"../../../core/promiseUtils.js";import{watch as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{BitmapContainer as p}from"../engine/BitmapContainer.js";import{LayerView2DMixin as n}from"./LayerView2D.js";import m from"./graphics/GraphicsView2D.js";import l from"./graphics/HighlightGraphicContainer.js";import g from"./support/ExportStrategy.js";import c from"../../layers/LayerView.js";import d from"../../layers/MapImageLayerView.js";import u from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as y}from"../../support/drapedUtils.js";let f=class extends(d(u(n(c)))){update(e){this.strategy.update(e).catch((e=>{s(e)||i.getLogger(this.declaredClass).error(e)})),e.stationary&&this.updateHighlightedFeatures(e.state.resolution),this._highlightView.processUpdate(e)}attach(){const{imageMaxWidth:e,imageMaxHeight:t,version:r}=this.layer,i=r>=10.3,s=r>=10;this._bitmapContainer=new p,this.container.addChild(this._bitmapContainer),this._highlightView=new m({view:this.view,graphics:this.highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new l(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container),this.strategy=new g({container:this._bitmapContainer,fetchSource:this.fetchImage.bind(this),requestUpdate:this.requestUpdate.bind(this),imageMaxWidth:e,imageMaxHeight:t,imageRotationSupported:i,imageNormalizationSupported:s,hidpi:!0}),this.handles.add(a((()=>this.exportImageVersion),(()=>this.requestUpdate())),"exportImageVersion"),this.handles.add(a((()=>this.view?.floors),(()=>this.requestUpdate())),"view.floors"),this.requestUpdate()}detach(){this.handles.remove("exportImageVersion"),this.handles.remove("view.floors"),this.strategy.destroy(),this.container.removeAllChildren(),this._bitmapContainer.removeAllChildren(),this._highlightView.destroy()}moveStart(){}viewChange(){}moveEnd(){this.requestUpdate()}highlight(e){let i=null;if(e instanceof t?i=[e]:r.isCollection(e)&&e.length>0?i=e.toArray():Array.isArray(e)&&e.length>0&&(i=e),i=i?.filter(Boolean),!i||!i.length)return{remove:()=>{}};for(const t of i)"geometryType"in t.sourceLayer&&"point"===t.sourceLayer.geometryType&&(t.visible=!1);return this.highlightGraphics.addMany(i),{remove:()=>{this.highlightGraphics.removeMany(i)}}}supportsSpatialReference(e){return this.layer.serviceSupportsSpatialReference(e)}createFetchPopupFeaturesQueryGeometry(e,t){return y(e,t,this.view)}async doRefresh(){this.requestUpdate()}isUpdating(){return this.strategy.updating||this.updateRequested}highlightGraphicUpdated(e,t){this._highlightView.graphicUpdateHandler({graphic:e,property:t})}fetchImage(e,t,r,i){return this.layer.fetchImage(e,t,r,{timeExtent:this.timeExtent,floors:this.view.floors,...i})}};e([o()],f.prototype,"strategy",void 0),e([o()],f.prototype,"updating",void 0),f=e([h("esri.views.2d.layers.MapImageLayerView2D")],f);const v=f;export{v 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{HandleOwner as t}from"../../../../../core/HandleOwner.js";import has from"../../../../../core/has.js";import{isNone as r,applySome as s,isSome as i,filterNones as a}from"../../../../../core/maybe.js";import{ignoreAbortErrors as o,after as n,throwIfAborted as u,throwIfNotAbortError as h,isAbortError as g}from"../../../../../core/promiseUtils.js";import{when as d,whenOnce as c}from"../../../../../core/reactiveUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{convertToGeometry as f}from"../../../../../layers/graphics/featureConversionUtils.js";import{QueryEngine as y}from"../../../../../layers/graphics/data/QueryEngine.js";import m from"../../../../../layers/support/FieldsIndex.js";import{FeatureStore2D as S}from"../FeatureStore2D.js";import{createSource as _}from"../sources/createSource.js";import v from"../support/AttributeStore.js";import{BinStore as b}from"../support/BinStore.js";import{ClusterStore as I}from"../support/ClusterStore.js";import{ComputedAttributeStorage as w}from"../support/ComputedAttributeStorage.js";import{FeatureSetReaderJSON as Q}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as E}from"../support/UpdateToken.js";import{QueueProcessor as C}from"../../../../support/QueueProcessor.js";const F=5e3,j="tileRenderer.featuresView.attributeView.initialize",T="tileRenderer.featuresView.attributeView.requestUpdate",k="tileRenderer.featuresView.requestRender";function R(e){return"worker:port-closed"===e.name}function x(e){if(!g(e)&&!R(e))throw e}function A(e){return"feature"===e.type&&"snapshot"===e.mode}let U=class extends t{constructor(){super(...arguments),this._storage=new w,this._markedIdsBufId=this._storage.createBitset(),this._lastCleanup=performance.now(),this._cleanupNeeded=!1,this._invalidated=!1,this._tileToResolver=new Map,this._didEdit=!1,this._updateVersion=1,this.tileStore=null,this.config=null,this.processor=null,this.remoteClient=null,this.service=null}initialize(){this._initStores(),this._initSource(),this._updateQueue=new C({concurrency:"geoevent"===this._source.type?1:4,process:(e,t)=>this._onTileMessage(e,{signal:t})}),this.handles.add([this.tileStore.on("update",this.onTileUpdate.bind(this)),d((()=>!this.updating),(()=>this.onIdle()))]),this._checkUpdating=setInterval((()=>this.notifyChange("updating")),300)}_initSource(){const e=this.tileStore.tileScheme,t=()=>this._updateQueue.length<50,r=(e,t)=>(this._invalidated=!0,this._patchTile(e,t));this._source=_(this.service,this.spatialReference,e,r,t,this.featureStore),this._proxyEvents()}_proxyEvents(){if("geoevent"===this._source.type){const e=this._source.events;this.handles.add([e.on("connectionStatus",(e=>this.remoteClient.invoke("setProperty",{propertyName:"connectionStatus",value:e}).catch(x))),e.on("errorString",(e=>this.remoteClient.invoke("setProperty",{propertyName:"errorString",value:e}).catch(x))),e.on("data-received",(e=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}}).catch(x))),e.on("updateRate",(e=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...e}}).catch(x)))])}}_initAttributeStore(e){this.attributeStore?this.attributeStore.invalidateResources():this.attributeStore=new v({type:"remote",initialize:(e,t)=>o(this.remoteClient.invoke(j,e,{signal:t}).catch(x)),update:(e,t)=>o(this.remoteClient.invoke(T,e,{signal:t}).catch(x)),render:e=>o(this.remoteClient.invoke(k,void 0,{signal:e}).catch(x))},e,(()=>this.notifyChange("updating")))}_initStores(){const e="snapshot"===this.service.type?"snapshot":"on-demand",t={geometryInfo:{geometryType:this.service.geometryType,hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.featureStore=new S(t,this._storage,e)}_initQueryEngine(e){const t=this;this.featureQueryEngine?.destroy(),this.featureQueryEngine=new y({definitionExpression:e.schema.source.definitionExpression,fields:this.service.fields,geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds(e){if(r(t.aggregateStore))return[];return t.aggregateStore.getFeatureDisplayIdsForAggregate(e).map((e=>t.getObjectId(e)))}},timeInfo:this.service.timeInfo})}_initAggregateQueryEngine(e){this.aggregateQueryEngine?.destroy(),r(e)||(this.aggregateQueryEngine=new y({definitionExpression:null,fields:e.fields,geometryType:e.geometryInfo.geometryType,objectIdField:e.objectIdField,hasM:e.geometryInfo.hasM,hasZ:e.geometryInfo.hasZ,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!1,featureStore:e,aggregateAdapter:{getFeatureObjectIds:e=>[]}}))}destroy(){this._updateQueue.destroy(),this._source.destroy(),this.featureQueryEngine?.destroy(),this.aggregateQueryEngine?.destroy(),this.attributeStore?.destroy();for(const e of this.tileStore.tiles)this._source.unsubscribe(e);clearInterval(this._checkUpdating)}get fieldsIndex(){return new m(this.service.fields)}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get updating(){return this.isUpdating()}isUpdating(){const e=this._source.updating,t=!!this._updateQueue.length,r=!this.attributeStore||this.attributeStore.isUpdating(),s=e||t||r;return has("esri-2d-log-updating")&&console.log(`Updating FeatureController2D: ${s}\n -> updatingSource ${e}\n -> updateQueue ${t}\n -> updatingAttributeStore ${r}\n`),s}enableEvent(e){this._source.enableEvent(e.name,e.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}resume(){this._updateQueue.resume()}pauseStream(){"geoevent"===this._source.type&&this._source.pauseStream()}resumeStream(){"geoevent"===this._source.type&&this._source.resumeStream()}_initAggregateStore(e){const t=e.schema.targets?.aggregate?.type,r=s(this.config,(e=>e.schema.targets?.aggregate?.type));if(r!==t&&(i(this.aggregateStore)&&(this.handles.remove("valueRangesChanged"),this.aggregateStore.destroy(),this.aggregateStore=null),t)){switch(t){case"cluster":{const e={geometryInfo:{geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new I(e,this.spatialReference,this._storage,this.service),this.handles.add(this.aggregateStore.events.on("valueRangesChanged",(e=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:e.valueRanges}}).catch(x)})),"valueRangesChanged");break}case"bin":{const e={geometryInfo:{geometryType:"esriGeometryPolygon",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new b(e,this.spatialReference,this._storage,this.service);break}}this.aggregateStore.onTileUpdate({added:this.tileStore.tiles,removed:[]})}}async update(e,t){this._updateVersion++,this._initQueryEngine(t),this._initAttributeStore(t),this.pause(),await Promise.all([this._source.update(e,t.schema.source),this.featureStore.updateSchema(e,t.schema.targets.feature),this.attributeStore.update(e,t),this.attributeStore.updateFilters(e,t,this)]),this._initAggregateStore(t),this._initAggregateQueryEngine(this.aggregateStore),i(this.aggregateStore)&&await this.aggregateStore.updateSchema(e,t.schema.targets.aggregate),has("esri-2d-update-debug")&&e.describe(),this._set("config",t)}async applyUpdate(e){e.version=this._updateVersion,has("esri-2d-update-debug")&&console.debug(`Applying update ${e.version}`),e.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(e),this.notifyChange("updating"),await c((()=>!this.updating)),i(this.aggregateStore)&&(await n(10),await c((()=>!this.updating)))}async onEdits({edits:e}){has("esri-2d-update-debug")&&console.debug("Applying Edit:",e),this._didEdit=!0;try{const t=e.removed.map((e=>e.objectId&&-1!==e.objectId?e.objectId:this._lookupObjectIdByGlobalId(e.globalId))),r=e.addOrModified.map((({objectId:e})=>e));this.featureStore.invalidate(),await this._source.edit(r,t),this.clearTiles(),this.notifyChange("updating"),i(this.aggregateStore)&&this.aggregateStore.clear(),await this._source.resend(),await c((()=>!this.updating))}catch(t){}}async refresh(e){if(!e){const e=E.empty();return e.storage.filters=!0,this.applyUpdate(e)}this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(this._updateVersion),this._cleanupNeeded=!0,this.notifyChange("updating"),await c((()=>!this.updating))}clearTiles(){for(const e of this.tileStore.tiles)this.processor.onTileClear(e)}onTileUpdate(e){i(this.aggregateStore)&&this.aggregateStore.onTileUpdate(e);for(const t of e.added)this._source.subscribe(t,this._updateVersion),this._level=t.level;for(const t of e.removed)this._source.unsubscribe(t),this._cleanupNeeded=!0,this._tileToResolver.has(t.id)&&(this._tileToResolver.get(t.id).resolve(),this._tileToResolver.delete(t.id));this.notifyChange("updating")}async onIdle(){this._invalidated&&(this._invalidated=!1,(i(this.aggregateStore)||"heatmap"===this.processor.type)&&await this._repushCurrentLevelTiles()),this._markAndSweep()}async querySummaryStatistics({query:e,params:t}){return this.featureQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryUniqueValues({query:e,params:t}){return this.featureQueryEngine.executeQueryForUniqueValues(e,t)}async queryClassBreaks({query:e,params:t}){return this.featureQueryEngine.executeQueryForClassBreaks(e,t)}async queryHistogram({query:e,params:t}){return this.featureQueryEngine.executeQueryForHistogram(e,t)}queryExtent(e){return this.featureQueryEngine.executeQueryForExtent(e)}queryAggregates(e){return this.aggregateQueryEngine.executeQuery(e)}queryAggregateCount(e){return this.aggregateQueryEngine.executeQueryForCount(e)}queryAggregateIds(e){return this.aggregateQueryEngine.executeQueryForIds(e)}queryFeatures(e){return this.featureQueryEngine.executeQuery(e)}async queryVisibleFeatures(e){const t=await this.featureQueryEngine.executeQuery(e),r=t.objectIdFieldName;return t.features=t.features.filter((e=>{const t=e.attributes[r],i=this.getDisplayId(t);return s(i,(e=>this.attributeStore.isVisible(e)))})),t}queryFeatureCount(e){return this.featureQueryEngine.executeQueryForCount(e)}queryLatestObservations(e){return this.featureQueryEngine.executeQueryForLatestObservations(e)}queryObjectIds(e){return this.featureQueryEngine.executeQueryForIds(e)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(e){return this.featureStore.lookupObjectId(e,this._storage)}getDisplayId(e){if(i(this.aggregateStore)){const t=this.aggregateStore.getDisplayId(e);if(r(t)){const t=this.featureStore.lookupDisplayId(e);return this.aggregateStore.getDisplayIdForReferenceId(t)}return t}return this.featureStore.lookupDisplayId(e)}getFeatures(e){const t=[],r=[];for(const s of e){const e=i(this.aggregateStore)?this.getAggregate(s):null;if(i(e))if(i(e.attributes.referenceId)){const r=this.getFeature(e.attributes.referenceId);i(r)&&t.push(r)}else r.push(e);else{const e=this.getFeature(s);i(e)&&t.push(e)}}return{features:t,aggregates:r}}getFeature(e){const t=this.featureStore.lookupFeatureByDisplayId(e,this._storage);if(r(t))return null;const s=t.readHydratedGeometry(),i=f(s,t.geometryType,t.hasZ,t.hasM);return{attributes:t.readAttributes(),geometry:i}}getAggregate(e){return r(this.aggregateStore)?null:this.aggregateStore.getAggregate(e)}getAggregates(){return r(this.aggregateStore)?[]:this.aggregateStore.getAggregates()}async setHighlight(e){const t=a(e.map((e=>this.getDisplayId(e))));return this.attributeStore.setHighlight(e,t)}_lookupObjectIdByGlobalId(e){const t=this.service.globalIdField;if(r(t))throw new Error("Expected globalIdField to be defined");let s=null;if(this.featureStore.forEach((r=>{e===r.readAttribute(t)&&(s=r.getObjectId())})),r(s))throw new Error(`Expected to find a feature with globalId ${e}`);return s}async _repushCurrentLevelTiles(){const e=this.tileStore.tiles.filter((e=>e.level===this._level)).map((async e=>this._patchTile({type:"append",id:e.key.id,addOrUpdate:Q.fromOptimizedFeatures([],this.service),remove:[],end:!0,status:E.empty()})));await Promise.all(e)}_maybeForceCleanup(){performance.now()-this._lastCleanup>F&&this._markAndSweep()}_patchTile(e,t){const r=this._updateQueue.push(e,t).then((()=>{this.notifyChange("updating")})).catch((e=>{this.notifyChange("updating")}));return this.notifyChange("updating"),r}async _onTileMessage(e,t){u(t);const s=this.tileStore.get(e.id);if(!s)return;if(e.clear)return this.processor.onTileClear(s);const a=e.status;this._cleanupNeeded=!0;const o=[];for(const r of e.remove){const e=this.featureStore.lookupDisplayId(r);e&&o.push(e)}e.remove=o;try{if(r(e.addOrUpdate))return void this.processor.onTileMessage(s,{...e,addOrUpdate:null},i(this.aggregateStore),t).catch(h);if(e.addOrUpdate.setArcadeSpatialReference(this.spatialReference),this.featureStore.hasInstance(e.addOrUpdate.instance)&&a.targets.feature||(a.targets.feature=!0,this.featureStore.onTileData(s,e)),!a.storage.data||!a.storage.filters){a.storage.data=!0,a.storage.filters=!0,this.attributeStore.onTileData(s,e);"geoevent"===this._source.type||this._didEdit?(await this.attributeStore.sendUpdates(),u(t)):this.attributeStore.sendUpdates()}if(i(this.aggregateStore)&&!a.targets.aggregate){a.targets.aggregate=!0;const t=A(this._source)&&this._source.loading,r=!A(this._source)||t||e.end;if(this.aggregateStore.onTileData(s,e,this._storage,this.attributeStore,r),!r)return;a.mesh||(this.attributeStore.onTileData(s,e),await this.attributeStore.sendUpdates())}a.mesh||(a.mesh=!0,await this.processor.onTileMessage(s,e,i(this.aggregateStore),t),u(t)),this._maybeForceCleanup()}catch(n){h(n)}}_mark(e,t,r){const s=(4294901760&this._storage.getInstanceId(e))>>>16;e&&(t.add(s),r.set(e))}_markAndSweep(){this._lastCleanup=performance.now();if(!(!("feature"===this._source.type&&"snapshot"===this._source.mode)&&("geoevent"===this._source.type||this._cleanupNeeded)))return;this._cleanupNeeded=!1;const e=this._storage.getBitset(this._markedIdsBufId),t=new Set;e.clear();for(const r of this.tileStore.tiles)for(const s of this._source.readers(r.id)){const r=s.getCursor();for(;r.next();){let s=r.getDisplayId();if(!s){const e=r.getObjectId();s=this.featureStore.lookupDisplayId(e)}this._mark(s,t,e)}}"symbol"===this.processor.type&&this.processor.forEachBufferId((r=>{this._mark(r,t,e)})),this._updateQueue.forEach((r=>{for(const s of r.remove){const r=this.featureStore.lookupDisplayId(s);this._mark(r,t,e)}})),i(this.aggregateStore)&&(this.aggregateStore.sweepFeatures(e,this.featureStore),"sweepAggregates"in this.aggregateStore&&this.aggregateStore.sweepAggregates(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(e,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(t)}};e([l({constructOnly:!0})],U.prototype,"tileStore",void 0),e([l()],U.prototype,"config",void 0),e([l({readOnly:!0})],U.prototype,"fieldsIndex",null),e([l()],U.prototype,"processor",void 0),e([l({constructOnly:!0})],U.prototype,"remoteClient",void 0),e([l({constructOnly:!0})],U.prototype,"service",void 0),e([l()],U.prototype,"spatialReference",null),e([l()],U.prototype,"updating",null),U=e([p("esri.views.2d.layers.features.controllers.FeatureController2D")],U);const O=U;export{O as default};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{HandleOwner as t}from"../../../../../core/HandleOwner.js";import has from"../../../../../core/has.js";import{isNone as r,applySome as s,isSome as i,filterNones as a}from"../../../../../core/maybe.js";import{ignoreAbortErrors as o,after as n,throwIfAborted as u,throwIfNotAbortError as g,isAbortError as h}from"../../../../../core/promiseUtils.js";import{when as d,whenOnce as c}from"../../../../../core/reactiveUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{convertToGeometry as f}from"../../../../../layers/graphics/featureConversionUtils.js";import{QueryEngine as y}from"../../../../../layers/graphics/data/QueryEngine.js";import m from"../../../../../layers/support/FieldsIndex.js";import{FeatureStore2D as S}from"../FeatureStore2D.js";import{createSource as _}from"../sources/createSource.js";import v from"../support/AttributeStore.js";import{BinStore as b}from"../support/BinStore.js";import{ClusterStore as I}from"../support/ClusterStore.js";import{ComputedAttributeStorage as w}from"../support/ComputedAttributeStorage.js";import{FeatureSetReaderJSON as Q}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as E}from"../support/UpdateToken.js";import{QueueProcessor as C}from"../../../../support/QueueProcessor.js";const F=5e3,j="tileRenderer.featuresView.attributeView.initialize",T="tileRenderer.featuresView.attributeView.requestUpdate",k="tileRenderer.featuresView.requestRender";function R(e){return"worker:port-closed"===e.name}function x(e){if(!h(e)&&!R(e))throw e}function A(e){return"feature"===e.type&&"snapshot"===e.mode}let U=class extends t{constructor(){super(...arguments),this._storage=new w,this._markedIdsBufId=this._storage.createBitset(),this._lastCleanup=performance.now(),this._cleanupNeeded=!1,this._invalidated=!1,this._tileToResolver=new Map,this._didEdit=!1,this._updateVersion=1,this.tileStore=null,this.config=null,this.processor=null,this.remoteClient=null,this.service=null}initialize(){this._initStores(),this._initSource(),this._updateQueue=new C({concurrency:"geoevent"===this._source.type?1:4,process:(e,t)=>this._onTileMessage(e,{signal:t})}),this.handles.add([this.tileStore.on("update",this.onTileUpdate.bind(this)),d((()=>!this.updating),(()=>this.onIdle()))]),this._checkUpdating=setInterval((()=>this.notifyChange("updating")),300)}_initSource(){const e=this.tileStore.tileScheme,t=()=>this._updateQueue.length<50,r=(e,t)=>(this._invalidated=!0,this._patchTile(e,t));this._source=_(this.service,this.spatialReference,e,r,t,this.featureStore),this._proxyEvents()}_proxyEvents(){if("geoevent"===this._source.type){const e=this._source.events;this.handles.add([e.on("connectionStatus",(e=>this.remoteClient.invoke("setProperty",{propertyName:"connectionStatus",value:e}).catch(x))),e.on("errorString",(e=>this.remoteClient.invoke("setProperty",{propertyName:"errorString",value:e}).catch(x))),e.on("data-received",(e=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}}).catch(x))),e.on("updateRate",(e=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...e}}).catch(x)))])}}_initAttributeStore(e){this.attributeStore?this.attributeStore.invalidateResources():this.attributeStore=new v({type:"remote",initialize:(e,t)=>o(this.remoteClient.invoke(j,e,{signal:t}).catch(x)),update:(e,t)=>o(this.remoteClient.invoke(T,e,{signal:t}).catch(x)),render:e=>o(this.remoteClient.invoke(k,void 0,{signal:e}).catch(x))},e,(()=>this.notifyChange("updating")))}_initStores(){const e="snapshot"===this.service.type?"snapshot":"on-demand",t={geometryInfo:{geometryType:this.service.geometryType,hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.featureStore=new S(t,this._storage,e)}_initQueryEngine(e){const t=this;this.featureQueryEngine?.destroy(),this.featureQueryEngine=new y({definitionExpression:e.schema.source.definitionExpression,fields:this.service.fields,geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds(e){if(r(t.aggregateStore))return[];return t.aggregateStore.getFeatureDisplayIdsForAggregate(e).map((e=>t.getObjectId(e)))}},timeInfo:this.service.timeInfo})}_initAggregateQueryEngine(e,t){if(this.aggregateQueryEngine?.destroy(),r(e))return;const s=t.targets.aggregate.params.fields.slice();this.aggregateQueryEngine=new y({definitionExpression:null,fields:s,geometryType:e.geometryInfo.geometryType,objectIdField:e.objectIdField,hasM:e.geometryInfo.hasM,hasZ:e.geometryInfo.hasZ,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!1,featureStore:e,aggregateAdapter:{getFeatureObjectIds:e=>[]}})}destroy(){this._updateQueue.destroy(),this._source.destroy(),this.featureQueryEngine?.destroy(),this.aggregateQueryEngine?.destroy(),this.attributeStore?.destroy();for(const e of this.tileStore.tiles)this._source.unsubscribe(e);clearInterval(this._checkUpdating)}get fieldsIndex(){return new m(this.service.fields)}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get updating(){return this.isUpdating()}isUpdating(){const e=this._source.updating,t=!!this._updateQueue.length,r=!this.attributeStore||this.attributeStore.isUpdating(),s=e||t||r;return has("esri-2d-log-updating")&&console.log(`Updating FeatureController2D: ${s}\n -> updatingSource ${e}\n -> updateQueue ${t}\n -> updatingAttributeStore ${r}\n`),s}enableEvent(e){this._source.enableEvent(e.name,e.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}resume(){this._updateQueue.resume()}pauseStream(){"geoevent"===this._source.type&&this._source.pauseStream()}resumeStream(){"geoevent"===this._source.type&&this._source.resumeStream()}_initAggregateStore(e){const t=e.schema.targets?.aggregate?.type,r=s(this.config,(e=>e.schema.targets?.aggregate?.type));if(r!==t&&(i(this.aggregateStore)&&(this.handles.remove("valueRangesChanged"),this.aggregateStore.destroy(),this.aggregateStore=null),t)){switch(t){case"cluster":{const e={geometryInfo:{geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new I(e,this.spatialReference,this._storage,this.service),this.handles.add(this.aggregateStore.events.on("valueRangesChanged",(e=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:e.valueRanges}}).catch(x)})),"valueRangesChanged");break}case"bin":{const e={geometryInfo:{geometryType:"esriGeometryPolygon",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new b(e,this.spatialReference,this._storage,this.service);break}}this.aggregateStore.onTileUpdate({added:this.tileStore.tiles,removed:[]})}}async update(e,t){this._updateVersion++,this._initQueryEngine(t),this._initAttributeStore(t),this.pause(),await Promise.all([this._source.update(e,t.schema.source),this.featureStore.updateSchema(e,t.schema.targets.feature),this.attributeStore.update(e,t),this.attributeStore.updateFilters(e,t,this)]),this._initAggregateStore(t),i(this.aggregateStore)&&await this.aggregateStore.updateSchema(e,t.schema.targets.aggregate),this._initAggregateQueryEngine(this.aggregateStore,t.schema),has("esri-2d-update-debug")&&e.describe(),this._set("config",t)}async applyUpdate(e){e.version=this._updateVersion,has("esri-2d-update-debug")&&console.debug(`Applying update ${e.version}`),e.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(e),this.notifyChange("updating"),await c((()=>!this.updating)),i(this.aggregateStore)&&(await n(10),await c((()=>!this.updating)))}async onEdits({edits:e}){has("esri-2d-update-debug")&&console.debug("Applying Edit:",e),this._didEdit=!0;try{const t=e.removed.map((e=>e.objectId&&-1!==e.objectId?e.objectId:this._lookupObjectIdByGlobalId(e.globalId))),r=e.addOrModified.map((({objectId:e})=>e));this.featureStore.invalidate(),await this._source.edit(r,t),this.clearTiles(),this.notifyChange("updating"),i(this.aggregateStore)&&this.aggregateStore.clear(),await this._source.resend(),await c((()=>!this.updating))}catch(t){}}async refresh(e){if(!e){const e=E.empty();return e.storage.filters=!0,this.applyUpdate(e)}this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(this._updateVersion),this._cleanupNeeded=!0,this.notifyChange("updating"),await c((()=>!this.updating))}clearTiles(){for(const e of this.tileStore.tiles)this.processor.onTileClear(e)}onTileUpdate(e){i(this.aggregateStore)&&this.aggregateStore.onTileUpdate(e);for(const t of e.added)this._source.subscribe(t,this._updateVersion),this._level=t.level;for(const t of e.removed)this._source.unsubscribe(t),this._cleanupNeeded=!0,this._tileToResolver.has(t.id)&&(this._tileToResolver.get(t.id).resolve(),this._tileToResolver.delete(t.id));this.notifyChange("updating")}async onIdle(){this._invalidated&&(this._invalidated=!1,(i(this.aggregateStore)||"heatmap"===this.processor.type)&&await this._repushCurrentLevelTiles()),this._markAndSweep()}async querySummaryStatistics({query:e,params:t}){return this.featureQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryUniqueValues({query:e,params:t}){return this.featureQueryEngine.executeQueryForUniqueValues(e,t)}async queryClassBreaks({query:e,params:t}){return this.featureQueryEngine.executeQueryForClassBreaks(e,t)}async queryHistogram({query:e,params:t}){return this.featureQueryEngine.executeQueryForHistogram(e,t)}queryExtent(e){return this.featureQueryEngine.executeQueryForExtent(e)}queryAggregates(e){return this.aggregateQueryEngine.executeQuery(e)}queryAggregateCount(e){return this.aggregateQueryEngine.executeQueryForCount(e)}queryAggregateIds(e){return this.aggregateQueryEngine.executeQueryForIds(e)}queryFeatures(e){return this.featureQueryEngine.executeQuery(e)}async queryVisibleFeatures(e){const t=await this.featureQueryEngine.executeQuery(e),r=t.objectIdFieldName;return t.features=t.features.filter((e=>{const t=e.attributes[r],i=this.getDisplayId(t);return s(i,(e=>this.attributeStore.isVisible(e)))})),t}queryFeatureCount(e){return this.featureQueryEngine.executeQueryForCount(e)}queryLatestObservations(e){return this.featureQueryEngine.executeQueryForLatestObservations(e)}queryObjectIds(e){return this.featureQueryEngine.executeQueryForIds(e)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(e){return this.featureStore.lookupObjectId(e,this._storage)}getDisplayId(e){if(i(this.aggregateStore)){const t=this.aggregateStore.getDisplayId(e);if(r(t)){const t=this.featureStore.lookupDisplayId(e);return this.aggregateStore.getDisplayIdForReferenceId(t)}return t}return this.featureStore.lookupDisplayId(e)}getFeatures(e){const t=[],r=[];for(const s of e){const e=i(this.aggregateStore)?this.getAggregate(s):null;if(i(e))if(i(e.attributes.referenceId)){const r=this.getFeature(e.attributes.referenceId);i(r)&&t.push(r)}else r.push(e);else{const e=this.getFeature(s);i(e)&&t.push(e)}}return{features:t,aggregates:r}}getFeature(e){const t=this.featureStore.lookupFeatureByDisplayId(e,this._storage);if(r(t))return null;const s=t.readHydratedGeometry(),i=f(s,t.geometryType,t.hasZ,t.hasM);return{attributes:t.readAttributes(),geometry:i}}getAggregate(e){return r(this.aggregateStore)?null:this.aggregateStore.getAggregate(e)}getAggregates(){return r(this.aggregateStore)?[]:this.aggregateStore.getAggregates()}async setHighlight(e){const t=a(e.map((e=>this.getDisplayId(e))));return this.attributeStore.setHighlight(e,t)}_lookupObjectIdByGlobalId(e){const t=this.service.globalIdField;if(r(t))throw new Error("Expected globalIdField to be defined");let s=null;if(this.featureStore.forEach((r=>{e===r.readAttribute(t)&&(s=r.getObjectId())})),r(s))throw new Error(`Expected to find a feature with globalId ${e}`);return s}async _repushCurrentLevelTiles(){const e=this.tileStore.tiles.filter((e=>e.level===this._level)).map((async e=>this._patchTile({type:"append",id:e.key.id,addOrUpdate:Q.fromOptimizedFeatures([],this.service),remove:[],end:!0,status:E.empty()})));await Promise.all(e)}_maybeForceCleanup(){performance.now()-this._lastCleanup>F&&this._markAndSweep()}_patchTile(e,t){const r=this._updateQueue.push(e,t).then((()=>{this.notifyChange("updating")})).catch((e=>{this.notifyChange("updating")}));return this.notifyChange("updating"),r}async _onTileMessage(e,t){u(t);const s=this.tileStore.get(e.id);if(!s)return;if(e.clear)return this.processor.onTileClear(s);const a=e.status;this._cleanupNeeded=!0;const o=[];for(const r of e.remove){const e=this.featureStore.lookupDisplayId(r);e&&o.push(e)}e.remove=o;try{if(r(e.addOrUpdate))return void this.processor.onTileMessage(s,{...e,addOrUpdate:null},i(this.aggregateStore),t).catch(g);if(e.addOrUpdate.setArcadeSpatialReference(this.spatialReference),this.featureStore.hasInstance(e.addOrUpdate.instance)&&a.targets.feature||(a.targets.feature=!0,this.featureStore.onTileData(s,e)),!a.storage.data||!a.storage.filters){a.storage.data=!0,a.storage.filters=!0,this.attributeStore.onTileData(s,e);"geoevent"===this._source.type||this._didEdit?(await this.attributeStore.sendUpdates(),u(t)):this.attributeStore.sendUpdates()}if(i(this.aggregateStore)&&!a.targets.aggregate){a.targets.aggregate=!0;const t=A(this._source)&&this._source.loading,r=!A(this._source)||t||e.end;if(this.aggregateStore.onTileData(s,e,this._storage,this.attributeStore,r),!r)return;a.mesh||(this.attributeStore.onTileData(s,e),await this.attributeStore.sendUpdates())}a.mesh||(a.mesh=!0,await this.processor.onTileMessage(s,e,i(this.aggregateStore),t),u(t)),this._maybeForceCleanup()}catch(n){g(n)}}_mark(e,t,r){const s=(4294901760&this._storage.getInstanceId(e))>>>16;e&&(t.add(s),r.set(e))}_markAndSweep(){this._lastCleanup=performance.now();if(!(!("feature"===this._source.type&&"snapshot"===this._source.mode)&&("geoevent"===this._source.type||this._cleanupNeeded)))return;this._cleanupNeeded=!1;const e=this._storage.getBitset(this._markedIdsBufId),t=new Set;e.clear();for(const r of this.tileStore.tiles)for(const s of this._source.readers(r.id)){const r=s.getCursor();for(;r.next();){let s=r.getDisplayId();if(!s){const e=r.getObjectId();s=this.featureStore.lookupDisplayId(e)}this._mark(s,t,e)}}"symbol"===this.processor.type&&this.processor.forEachBufferId((r=>{this._mark(r,t,e)})),this._updateQueue.forEach((r=>{for(const s of r.remove){const r=this.featureStore.lookupDisplayId(s);this._mark(r,t,e)}})),i(this.aggregateStore)&&(this.aggregateStore.sweepFeatures(e,this.featureStore),"sweepAggregates"in this.aggregateStore&&this.aggregateStore.sweepAggregates(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(e,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(t)}};e([l({constructOnly:!0})],U.prototype,"tileStore",void 0),e([l()],U.prototype,"config",void 0),e([l({readOnly:!0})],U.prototype,"fieldsIndex",null),e([l()],U.prototype,"processor",void 0),e([l({constructOnly:!0})],U.prototype,"remoteClient",void 0),e([l({constructOnly:!0})],U.prototype,"service",void 0),e([l()],U.prototype,"spatialReference",null),e([l()],U.prototype,"updating",null),U=e([p("esri.views.2d.layers.features.controllers.FeatureController2D")],U);const O=U;export{O 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{isSome as r,unwrap as i,isNone as l,unwrapOr as n}from"../../../../core/maybe.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{sqlAnd as o}from"../../../../core/sql.js";import{diff as a}from"../../../../core/accessorSupport/diffUtils.js";import{validateLabelingInfo as u}from"../../../../layers/support/labelingInfo.js";import{WGLSymbologyType as f}from"../../engine/webgl/enums.js";import{getVVType as d}from"../../engine/webgl/Utils.js";import{getTechniqueFromRenderer as p}from"../../engine/webgl/techniques/utils.js";import{getVVFlags as c}from"../../engine/webgl/util/vvFlagUtils.js";import{createSymbolSchema as y}from"./createSymbolSchema.js";export{createSymbolSchema}from"./createSymbolSchema.js";import{getPtMaxVVSize as m}from"./support/pixelBuffering.js";import{getSupportedHeatmapRenderer as g,simplifyVisualVariables as b}from"./support/rendererUtils.js";import{createClusterRenderer as x}from"../support/clusterUtils.js";import{toJSONGeometryType as h}from"../support/util.js";const v=t.getLogger("esri.views.2d.layers.features.schemaUtils"),T="ValidationError";function S(e){return e}function E(e){let t=0,i=0,l=f.DEFAULT;if(r(e)){if(i=m(e),"visualVariables"in e&&(t=c(e.visualVariables||[]),"dot-density"===e.type&&(l=f.DOT_DENSITY)),"heatmap"===e.type&&(l=f.HEATMAP),"dictionary"===e.type)return{maxVVSize:i,vvFlags:t,symbologyType:f.DEFAULT};if("pie-chart"===e.type)return{maxVVSize:i,vvFlags:t,symbologyType:f.PIE_CHART};if(l!==f.DOT_DENSITY&&l!==f.HEATMAP){const t=e.getSymbols();"backgroundFillSymbol"in e&&e.backgroundFillSymbol&&t.push(e.backgroundFillSymbol);let r=!0,i=!0;for(const e of t)if("cim"===e.type&&(i=!1),"simple-fill"===e.type||"picture-fill"===e.type){const t=e.outline,l=t&&"none"!==t.style&&"solid"!==t.style,n="simple-fill"===e.type&&"none"!==e.style&&"solid"!==e.style,s="picture-fill"===e.type||n||l;l&&(r=!1),s&&(i=!1)}r?l=i?f.OUTLINE_FILL_SIMPLE:f.OUTLINE_FILL:i&&(l=f.SIMPLE)}}return{vvFlags:t,maxVVSize:i,symbologyType:l}}let I=null;function w(e){if(has("esri-2d-update-debug")){const t=F(e,!0);console.debug("Created new schema",t),console.debug("Schema diff",a(I,t)),I=t}return F(e)}function F(e,t=!1){try{const i=B(e,t),l=A(e),n={};i.map((t=>V(n,e,t)));const s=r(e.subtypeCode)?`${e.subtypeField} = ${e.subtypeCode}`:null,a=o(e.definitionExpression,s);return{source:{definitionExpression:a,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:i,tileRenderer:l,targets:n}}catch(i){if(i.fieldName===T)return v.error(i),null;throw i}}function V(t,r,i){switch(i.target){case"feature":return void M(t,O(r),i);case"aggregate":{if(!("featureReduction"in r))return;const l=r.featureReduction;switch(l.type){case"selection":throw new e(T,"Mapview does not support `selection` reduction type",l);case"binning":return M(t,O(r),i),void N(t,l,i);case"cluster":return M(t,O(r),i),void j(t,l,i)}}}}function z(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 O(e){return[i(e.filter)?.toJSON()??null,i(i(e.featureEffect)?.filter)?.toJSON()??null]}function M(e,t,r){return e.feature||(e.feature={name:"feature",input:"source",filters:t,attributes:{}}),z(e.feature,r.attributes.fields),e}function N(e,t,r){return e.aggregate||(e.aggregate={name:"aggregate",type:"bin",filters:null,input:"feature",params:{fixedBinLevel:t.fixedBinLevel,fields:t.fields.map((e=>e.toJSON()))},attributes:{}}),z(e.aggregate,r.attributes.fields),e}function j(e,t,r){return e.aggregate||(e.aggregate={name:"aggregate",type:"cluster",input:"feature",filters:null,attributes:{},params:{clusterRadius:s(t.clusterRadius/2),clusterPixelBuffer:64*Math.ceil(s(t.clusterMaxSize)/64),fields:r.aggregateFields.map((e=>e.toJSON()))}}),z(e.aggregate,r.attributes.fields),e}function L(e,t){return t.field?R(e,{...t,type:"field",field:t.field}):t.valueExpression?R(e,{...t,type:"expression",valueExpression:t.valueExpression}):{field:null,fieldIndex:null}}function R(e,t){switch(t.type){case"expression":{const r=S(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=S(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(U(e,i++,t)),r}function P(e,t,r,i,l,n=!1){const s=R(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=E(e);return{...y(r,a,n),fieldIndex:o,target:i,index:l}}function k(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,a=h(r.geometryType),f=[],d=null;if(l)switch(l.type){case"selection":throw new e(T,"Mapview does not support `selection` reduction type",l);case"cluster":case"binning":if(s.push(...l.fields??[]),"cluster"===l.type?a="esriGeometryPoint":"binning"===l.type&&(a="esriGeometryPolygon"),l.renderer)d=l.renderer,o=H(null,n,l.renderer,i),f=l&&l.labelsVisible&&l.labelingInfo||[];else if("cluster"===l.type){if(d=x(s,r.renderer,l,null),l.symbol){const e=E(d);o={type:"simple",symbol:y(l.symbol,e,i),symbologyType:e.symbologyType}}f=l&&l.labelsVisible&&l.labelingInfo||[]}}D(t,s);return{labels:u(f,"binning"===l.type?"esriGeometryPolygon":a),matcher:o,fields:s,rendererOverride:d}}function U(t,i,l=!1){const n={indexCount:0,fields:{}},s="featureReduction"in t&&t.featureReduction?"aggregate":"feature";if("sublayers"in t){const i={type:"subtype",subtypeField:t.subtypeField,renderers:{},symbologyType:f.DEFAULT},o={type:"subtype",mapping:{},target:"feature"},a={type:"subtype",classes:{}},u={type:"symbol",target:"feature",aggregateFields:[],attributes:n,storage:o,mesh:{matcher:i,aggregateMatcher:null,labels:a,sortKey:null}},d=new Set;let p=0;for(const{renderer:f,subtypeCode:c,labelingInfo:y,labelsVisible:m}of t.sublayers){const t=H(n,s,f,l),u=J(n,s,f),g=m&&y;if("visualVariables"in f&&f.visualVariables&&f.visualVariables.length)throw new e(T,"Visual variables are currently not supported for subtype layers");if("dictionary"===t.type)throw new e(T,"Dictionary renderer is not supported in subtype layers");if("subtype"===t.type)throw new e(T,"Nested subtype renderers is not supported");if(r(u)&&"subtype"===u.type)throw new e(T,"Nested subtype storage is not supported");if(r(u)&&r(u.attributeMapping))throw new e(T,"Non-visual-variable attributes are not supported in subtype layers");if("heatmap"===t.type)throw new e(T,"Heatmaps are not supported in subtype layers");if("pie-chart"===t.type)throw new e(T,"Pie-charts are not supported in subtype layers");if(d.has(c))throw new e(T,"Subtype codes for sublayers must be unique");d.add(c),i.renderers[c]=t,o.mapping[c]=u,g&&(a.classes[c]=g.map((e=>P(f,n,e,"feature",p++,l))))}return u}if("heatmap"===t.renderer.type&&"raster"===g()){const{radius:e,fieldOffset:r,field:i}=t.renderer;return{type:"heatmap",aggregateFields:[],attributes:n,target:s,storage:null,mesh:{radius:e,fieldOffset:r,field:L(n,{target:s,field:i,resultType:"numeric"}).field}}}const o=k(n,t,l),a=h(t.geometryType),d=o.rendererOverride??t.renderer,p=H(n,s,d,l),c=J(n,s,d),y=C(n,t.orderBy),m=t.labelsVisible&&t.labelingInfo||[],b=u(m,a);let x=0;const v=[...b.map((e=>P(d,n,e,"feature",x++,l))),...o.labels.map((e=>P(d,n,e,"aggregate",x++,l)))];return{type:"symbol",target:s,attributes:n,aggregateFields:o.fields,storage:c,mesh:{matcher:p,labels:{type:"simple",classes:v},aggregateMatcher:o.matcher,sortKey:y}}}function A(e){return"heatmap"===e.renderer?.type&&"raster"===g()?{type:"heatmap"}:{type:"symbol"}}function C(t,r){if(l(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],n="ascending"===i.order?"asc":"desc";if(i.field)return{field:i.field,order:n};if(i.valueExpression){return{fieldIndex:R(t,{type:"expression",target:"feature",valueExpression:i.valueExpression,resultType:"numeric"}).fieldIndex,order:n}}return v.error(new e(T,"Expected to find a field or valueExpression for OrderByInfo",i)),null}function D(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;const u="numeric",f="feature";if(l.onStatisticValueExpression){a=R(e,{type:"expression",target:f,valueExpression:l.onStatisticValueExpression,resultType:u}).fieldIndex}else{o=R(e,{type:"field",target:f,field:s,resultType:u}).field}R(e,{type:"statistic",target:"aggregate",name:t,context:r,inField:o,inFieldIndex:a,statisticType:n})}}function J(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=p(r).getStorageSpec(r)}return q(e,t,i,r)}function q(e,t,i,n){if(l(i))return null;const{visualVariables:s,attributes:o}=i;let a=null;s&&"visualVariables"in n&&(a=_(e,t,n.visualVariables));const u=r(a)?4:0;let f=null;return r(o)&&(f=o.map(((r,i)=>{const{field:l,fieldIndex:n}=L(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 _(e,t,r){if(!r||!r.length)return[];const i={storage:!0},l="numeric";return b(r).map((r=>{const n=d(r.type),{field:s,fieldIndex:o}=L(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:L(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:L(e,{target:t,field:r.normalizationField,context:i,resultType:l}).field};case"opacity":return{type:"opacity",binding:n,field:s,fieldIndex:o,normalizationField:L(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=n(e,{indexCount:0,fields:{}});switch(r.type){case"simple":case"dot-density":return $(l,r,i);case"class-breaks":return K(l,t,r,i);case"unique-value":return Y(l,t,r,i);case"dictionary":return Q(l,r,i);case"heatmap":return W(l,r,i);case"pie-chart":return G(l,r,i)}}function $(e,t,r=!1){const i=t.getSymbols(),l=i.length?i[0]:null,n=E(t);return{type:"simple",symbol:y(l,n,r),symbologyType:n.symbologyType}}function G(e,t,r=!1){const i=t.getSymbols(),l=i[0],n=i.length>1?i[1]:null,s=E(t);return{type:"pie-chart",markerSymbol:y(l,s,r),fillSymbol:y(n,s,r),symbologyType:s.symbologyType}}function K(e,t,r,i=!1){const l={mesh:!0,use:"renderer.field"},n=r.backgroundFillSymbol,{field:s,fieldIndex:o}=L(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=E(r),d=r.classBreakInfos.map((e=>({symbol:y(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:y(n,f,i),defaultSymbol:y(r.defaultSymbol,f,i),intervals:d,normalizationField:r.normalizationField,normalizationTotal:r.normalizationTotal,normalizationType:u,isMaxInclusive:r.isMaxInclusive,symbologyType:f.symbologyType}}function Y(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(T,"Expected renderer.field to be a string",i);const{field:a,fieldIndex:u}=L(t,{...o,field:i.field,valueExpression:i.valueExpression}),f=E(i);for(const e of i.uniqueValueInfos)n.push({value:""+e.value,symbol:y(e.symbol,f,l)});return{type:"map",attributes:t.fields,field:a,fieldIndex:u,field2:L(t,{...o,field:i.field2}).field,field3:L(t,{...o,field:i.field3}).field,fieldDelimiter:i.fieldDelimiter,backgroundFillSymbol:y(s,f),defaultSymbol:y(i.defaultSymbol,f),map:n,symbologyType:f.symbologyType}}function Q(e,t,r=!1){const i=E(t);return{type:"dictionary",config:t.config,fieldMap:t.fieldMap,scaleExpression:t.scaleExpression,url:t.url,symbolOptions:i,symbologyType:i.symbologyType}}function W(e,t,r=!1){const i=t.getSymbols(),l=i.length?i[0]:null,n=E(t);return{type:"heatmap",symbol:y(l,n,r),symbologyType:n.symbologyType}}export{D as addAggregateFields,H as createMatcherSchema,L as createRendererAttributeSchema,w as createSchema,E as createSymbolSchemaOptions};
|
|
5
|
+
import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{isSome as r,unwrap as i,isNone as n,unwrapOr as l}from"../../../../core/maybe.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{sqlAnd as o}from"../../../../core/sql.js";import{diff as a}from"../../../../core/accessorSupport/diffUtils.js";import u from"../../../../layers/support/AggregateField.js";import{validateLabelingInfo as d}from"../../../../layers/support/labelingInfo.js";import{WGLSymbologyType as f}from"../../engine/webgl/enums.js";import{getVVType as p}from"../../engine/webgl/Utils.js";import{getTechniqueFromRenderer as c}from"../../engine/webgl/techniques/utils.js";import{getVVFlags as y}from"../../engine/webgl/util/vvFlagUtils.js";import{createSymbolSchema as m}from"./createSymbolSchema.js";export{createSymbolSchema}from"./createSymbolSchema.js";import{getPtMaxVVSize as g}from"./support/pixelBuffering.js";import{getSupportedHeatmapRenderer as b,simplifyVisualVariables as x}from"./support/rendererUtils.js";import{createClusterRenderer as h}from"../support/clusterUtils.js";import{toJSONGeometryType as v}from"../support/util.js";const S=t.getLogger("esri.views.2d.layers.features.schemaUtils"),w="ValidationError";function T(e){return e}function I(e){let t=0,i=0,n=f.DEFAULT;if(r(e)){if(i=g(e),"visualVariables"in e&&(t=y(e.visualVariables||[]),"dot-density"===e.type&&(n=f.DOT_DENSITY)),"heatmap"===e.type&&(n=f.HEATMAP),"dictionary"===e.type)return{maxVVSize:i,vvFlags:t,symbologyType:f.DEFAULT};if("pie-chart"===e.type)return{maxVVSize:i,vvFlags:t,symbologyType:f.PIE_CHART};if(n!==f.DOT_DENSITY&&n!==f.HEATMAP){const t=e.getSymbols();"backgroundFillSymbol"in e&&e.backgroundFillSymbol&&t.push(e.backgroundFillSymbol);let r=!0,i=!0;for(const e of t)if("cim"===e.type&&(i=!1),"simple-fill"===e.type||"picture-fill"===e.type){const t=e.outline,n=t&&"none"!==t.style&&"solid"!==t.style,l="simple-fill"===e.type&&"none"!==e.style&&"solid"!==e.style,s="picture-fill"===e.type||l||n;n&&(r=!1),s&&(i=!1)}r?n=i?f.OUTLINE_FILL_SIMPLE:f.OUTLINE_FILL:i&&(n=f.SIMPLE)}}return{vvFlags:t,maxVVSize:i,symbologyType:n}}let E=null;function F(e){if(has("esri-2d-update-debug")){const t=V(e,!0);console.debug("Created new schema",t),console.debug("Schema diff",a(E,t)),E=t}return V(e)}function V(e,t=!1){try{const i=B(e,t),n=C(e),l={};i.map((t=>O(l,e,t)));const s=r(e.subtypeCode)?`${e.subtypeField} = ${e.subtypeCode}`:null,a=o(e.definitionExpression,s);return{source:{definitionExpression:a,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:i,tileRenderer:n,targets:l}}catch(i){if(i.fieldName===w)return S.error(i),null;throw i}}function O(t,r,i){switch(i.target){case"feature":return void j(t,M(r),i);case"aggregate":{if(!("featureReduction"in r))return;const n=r.featureReduction;switch(n.type){case"selection":throw new e(w,"Mapview does not support `selection` reduction type",n);case"binning":return j(t,M(r),i),void N(t,n,i);case"cluster":return j(t,M(r),i),void L(t,n,i)}}}}function z(e,t){for(const r in t){const i=t[r];if(i.target!==e.name)continue;const n=e.attributes[r];n?(n.context.mesh=n.context.mesh||i.context.mesh,n.context.storage=n.context.storage||i.context.storage):e.attributes[r]=i}return e}function M(e){return[i(e.filter)?.toJSON()??null,i(i(e.featureEffect)?.filter)?.toJSON()??null]}function j(e,t,r){return e.feature||(e.feature={name:"feature",input:"source",filters:t,attributes:{}}),z(e.feature,r.attributes.fields),e}function N(e,t,r){return e.aggregate||(e.aggregate={name:"aggregate",type:"bin",filters:null,input:"feature",params:{fixedBinLevel:t.fixedBinLevel,fields:t.fields.map((e=>e.toJSON()))},attributes:{}}),z(e.aggregate,r.attributes.fields),e}function L(e,t,r){return e.aggregate||(e.aggregate={name:"aggregate",type:"cluster",input:"feature",filters:null,attributes:{},params:{clusterRadius:s(t.clusterRadius/2),clusterPixelBuffer:64*Math.ceil(s(t.clusterMaxSize)/64),fields:r.aggregateFields.map((e=>e.toJSON()))}}),z(e.aggregate,r.attributes.fields),e}function R(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=T(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=T(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 P(e,t,r,i,n,l=!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{...m(r,a,l),fieldIndex:o,target:i,index:n}}function U(t,r,i){const n="featureReduction"in r&&r.featureReduction;if(!n)return{fields:[],labels:[],matcher:null,rendererOverride:null};const l="aggregate",s=[];let o=null,a=v(r.geometryType),f=[],p=null;if(n)switch(n.type){case"selection":return S.error(new e(w,"Mapview does not support `selection` reduction type",n)),{fields:[],labels:[],matcher:null,rendererOverride:null};case"cluster":case"binning":if(s.push(...n.fields??[]),"cluster"===n.type?a="esriGeometryPoint":"binning"===n.type&&(a="esriGeometryPolygon"),n.renderer)p=n.renderer,o=$(null,l,n.renderer,i),f=n&&n.labelsVisible&&n.labelingInfo||[];else if("cluster"===n.type){if(p=h(s,r.renderer,n,null),n.symbol){const e=I(p);o={type:"simple",symbol:m(n.symbol,e,i),symbologyType:e.symbologyType}}f=n&&n.labelsVisible&&n.labelingInfo||[]}}if(J(t,s),n)switch(n.type){case"selection":return S.error(new e(w,"Mapview does not support `selection` reduction type",n)),{fields:[],labels:[],matcher:null,rendererOverride:null};case"cluster":s.push(new u({name:"aggregateId",type:"oid",outStatistic:null})),s.push(new u({name:"cluster_count",type:"integer",outStatistic:null}));break;case"binning":s.push(new u({name:"aggregateId",type:"oid",outStatistic:null})),s.push(new u({name:"aggregateCount",type:"integer",outStatistic:null}))}return{labels:d(f,"binning"===n.type?"esriGeometryPolygon":a),matcher:o,fields:s,rendererOverride:p}}function A(t,i,n=!1){const l={indexCount:0,fields:{}},s="featureReduction"in t&&t.featureReduction?"aggregate":"feature";if("sublayers"in t){const i={type:"subtype",subtypeField:t.subtypeField,renderers:{},symbologyType:f.DEFAULT},o={type:"subtype",mapping:{},target:"feature"},a={type:"subtype",classes:{}},u={type:"symbol",target:"feature",aggregateFields:[],attributes:l,storage:o,mesh:{matcher:i,aggregateMatcher:null,labels:a,sortKey:null}},d=new Set;let p=0;for(const{renderer:f,subtypeCode:c,labelingInfo:y,labelsVisible:m}of t.sublayers){const t=$(l,s,f,n),u=_(l,s,f),g=m&&y;if("visualVariables"in f&&f.visualVariables&&f.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(r(u)&&"subtype"===u.type)throw new e(w,"Nested subtype storage is not supported");if(r(u)&&r(u.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),i.renderers[c]=t,o.mapping[c]=u,g&&(a.classes[c]=g.map((e=>P(f,l,e,"feature",p++,n))))}return u}if("heatmap"===t.renderer.type&&"raster"===b()){const{radius:e,fieldOffset:r,field:i}=t.renderer;return{type:"heatmap",aggregateFields:[],attributes:l,target:s,storage:null,mesh:{radius:e,fieldOffset:r,field:R(l,{target:s,field:i,resultType:"numeric"}).field}}}const o=U(l,t,n),a=v(t.geometryType),u=o.rendererOverride??t.renderer,p=$(l,s,u,n),c=_(l,s,u),y=D(l,t.orderBy),m=t.labelsVisible&&t.labelingInfo||[],g=d(m,a);let x=0;const h=[...g.map((e=>P(u,l,e,"feature",x++,n))),...o.labels.map((e=>P(u,l,e,"aggregate",x++,n)))];return{type:"symbol",target:s,attributes:l,aggregateFields:o.fields,storage:c,mesh:{matcher:p,labels:{type:"simple",classes:h},aggregateMatcher:o.matcher,sortKey:y}}}function C(e){return"heatmap"===e.renderer?.type&&"raster"===b()?{type:"heatmap"}:{type:"symbol"}}function D(t,r){if(n(r)||!r.length)return null;r.length>1&&S.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 S.error(new e(w,"Expected to find a field or valueExpression for OrderByInfo",i)),null}function J(e,t){const r={mesh:!0,storage:!0};for(const i of t){const{name:t,outStatistic:n}=i,{statisticType:l,onStatisticField:s}=n;let o=null,a=null;const u="numeric",d="feature";if(n.onStatisticValueExpression){a=k(e,{type:"expression",target:d,valueExpression:n.onStatisticValueExpression,resultType:u}).fieldIndex}else{o=k(e,{type:"field",target:d,field:s,resultType:u}).field}k(e,{type:"statistic",target:"aggregate",name:t,context:r,inField:o,inFieldIndex:a,statisticType:l})}}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=c(r).getStorageSpec(r)}return q(e,t,i,r)}function q(e,t,i,l){if(n(i))return null;const{visualVariables:s,attributes:o}=i;let a=null;s&&"visualVariables"in l&&(a=H(e,t,l.visualVariables));const u=r(a)?4:0;let d=null;return r(o)&&(d=o.map(((r,i)=>{const{field:n,fieldIndex:l}=R(e,{valueExpression:r.valueExpression,field:r.field,resultType:"numeric",target:t});return{binding:i+u,field:n,fieldIndex:l}}))),{type:"simple",target:t,attributeMapping:d,vvMapping:a}}function H(e,t,r){if(!r||!r.length)return[];const i={storage:!0},n="numeric";return x(r).map((r=>{const l=p(r.type),{field:s,fieldIndex:o}=R(e,{target:t,valueExpression:r.valueExpression,field:r.field,context:i,resultType:n});switch(r.type){case"size":return"$view.scale"===r.valueExpression?null:{type:"size",binding:l,field:s,fieldIndex:o,normalizationField:R(e,{target:t,field:r.normalizationField,context:i,resultType:n}).field,valueRepresentation:r.valueRepresentation??null};case"color":return{type:"color",binding:l,field:s,fieldIndex:o,normalizationField:R(e,{target:t,field:r.normalizationField,context:i,resultType:n}).field};case"opacity":return{type:"opacity",binding:l,field:s,fieldIndex:o,normalizationField:R(e,{target:t,field:r.normalizationField,context:i,resultType:n}).field};case"rotation":return{type:"rotation",binding:l,field:s,fieldIndex:o}}})).filter((e=>e))}function $(e,t,r,i=!1){const n=l(e,{indexCount:0,fields:{}});switch(r.type){case"simple":case"dot-density":return G(n,r,i);case"class-breaks":return Y(n,t,r,i);case"unique-value":return Q(n,t,r,i);case"dictionary":return W(n,r,i);case"heatmap":return X(n,r,i);case"pie-chart":return K(n,r,i)}}function G(e,t,r=!1){const i=t.getSymbols(),n=i.length?i[0]:null,l=I(t);return{type:"simple",symbol:m(n,l,r),symbologyType:l.symbologyType}}function K(e,t,r=!1){const i=t.getSymbols(),n=i[0],l=i.length>1?i[1]:null,s=I(t);return{type:"pie-chart",markerSymbol:m(n,s,r),fillSymbol:m(l,s,r),symbologyType:s.symbologyType}}function Y(e,t,r,i=!1){const n={mesh:!0,use:"renderer.field"},l=r.backgroundFillSymbol,{field:s,fieldIndex:o}=R(e,{target:t,field:r.field,valueExpression:r.valueExpression,resultType:"numeric",context:n}),a=r.normalizationType,u="log"===a?"esriNormalizeByLog":"percent-of-total"===a?"esriNormalizeByPercentOfTotal":"field"===a?"esriNormalizeByField":null,d=I(r),f=r.classBreakInfos.map((e=>({symbol:m(e.symbol,d,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:m(l,d,i),defaultSymbol:m(r.defaultSymbol,d,i),intervals:f,normalizationField:r.normalizationField,normalizationTotal:r.normalizationTotal,normalizationType:u,isMaxInclusive:r.isMaxInclusive,symbologyType:d.symbologyType}}function Q(t,r,i,n=!1){const l=[],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}=R(t,{...o,field:i.field,valueExpression:i.valueExpression}),d=I(i);for(const e of i.uniqueValueInfos)l.push({value:""+e.value,symbol:m(e.symbol,d,n)});return{type:"map",attributes:t.fields,field:a,fieldIndex:u,field2:R(t,{...o,field:i.field2}).field,field3:R(t,{...o,field:i.field3}).field,fieldDelimiter:i.fieldDelimiter,backgroundFillSymbol:m(s,d),defaultSymbol:m(i.defaultSymbol,d),map:l,symbologyType:d.symbologyType}}function W(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 X(e,t,r=!1){const i=t.getSymbols(),n=i.length?i[0]:null,l=I(t);return{type:"heatmap",symbol:m(n,l,r),symbologyType:l.symbologyType}}export{J as addAggregateFields,$ as createMatcherSchema,R as createRendererAttributeSchema,F as createSchema,I as createSymbolSchemaOptions};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../TimeExtent.js";import s from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import{isSome as t}from"../../../../../core/maybe.js";import{createResolver as r,ignoreAbortErrors as i,eachAlwaysValues as o,eachAlways as n}from"../../../../../core/promiseUtils.js";import{diff as c,hasDiff as u,hasDiffAny as h}from"../../../../../core/accessorSupport/diffUtils.js";import a from"../../../../../rest/support/Query.js";import{DataTileSubscription as d}from"./DataTileSubscription.js";import{UpdateToken as
|
|
5
|
+
import e from"../../../../../TimeExtent.js";import s from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import{isSome as t}from"../../../../../core/maybe.js";import{createResolver as r,ignoreAbortErrors as i,eachAlwaysValues as o,eachAlways as n}from"../../../../../core/promiseUtils.js";import{diff as c,hasDiff as u,hasDiffAny as h}from"../../../../../core/accessorSupport/diffUtils.js";import a from"../../../../../rest/support/Query.js";import{DataTileSubscription as d}from"./DataTileSubscription.js";import{UpdateToken as p}from"../support/UpdateToken.js";function l(e,s){const t=new Set;return e&&e.forEach((e=>t.add(e))),s&&s.forEach((e=>t.add(e))),t.has("*")?["*"]:Array.from(t)}class m{constructor(e){this.events=new s,this._resolver=r(),this._didEdit=!1,this._subscriptions=new Map,this._outSR=e.outSR,this._serviceInfo=e.serviceInfo,this._onTileUpdateMessage=e.onMessage}destroy(){}async _onMessage(e){const s=this._subscriptions.get(e.id);if(!s)return;const t={...e,remove:e.remove??[],status:e.status??p.empty()};return i(this._onTileUpdateMessage(t,s.options))}update(s,t){const r=t.fields.length;t.outFields=l(this._schema?.outFields,t.outFields),t.outFields=t.outFields.length>=.75*r?["*"]:t.outFields,t.outFields.sort();const i=c(this._schema,t);if(!i)return;has("esri-2d-update-debug")&&console.debug("Applying Update - Source:",i);const o="orderByFields"in this._serviceInfo&&this._serviceInfo.orderByFields?this._serviceInfo.orderByFields:this._serviceInfo.objectIdField+" ASC",n={returnCentroid:"esriGeometryPolygon"===this._serviceInfo.geometryType,returnGeometry:!0,timeReferenceUnknownClient:"stream"!==this._serviceInfo.type&&this._serviceInfo.timeReferenceUnknownClient,outFields:t.outFields,outSpatialReference:this._outSR,orderByFields:[o],where:t.definitionExpression||"1=1",gdbVersion:t.gdbVersion,historicMoment:t.historicMoment,timeExtent:e.fromJSON(t.timeExtent)},a=this._schema&&u(i,"outFields");this._schema&&h(i,["timeExtent","definitionExpression","gdbVersion","historicMoment","customParameters"])&&(s.why.mesh.push("Layer filter and/or custom parameters changed"),s.why.source.push("Layer filter and/or custom parameters changed"),s.mesh=!0,s.source=!0,s.queryFilter=!0),a&&(s.why.source.push("Layer required fields changed"),s.source=!0),c(n,this._queryInfo)&&(this._queryInfo=n),this._schema=t,this._resolver.resolve()}whenInitialized(){return this._resolver.promise}async applyUpdate(e){if(e.queryFilter||e.source&&this._didEdit)return this.refresh(e.version),void(this._didEdit=!1);this._subscriptions.forEach((s=>s.applyUpdate(e))),await this.resend()}refresh(e){for(const s of this._tiles())this.unsubscribe(s),this.subscribe(s,e)}subscribe(e,s){const t=new d(e,s);this._subscriptions.set(e.id,t)}unsubscribe(e){const s=this.get(e.id);t(s)&&s.abort(),this._subscriptions.delete(e.id)}createQuery(e={}){const s=this._queryInfo.historicMoment?new Date(this._queryInfo.historicMoment):null;return new a({...this._queryInfo,historicMoment:s,...e})}get(e){return this._subscriptions.has(e)?this._subscriptions.get(e):null}async queryLastEditDate(){throw new Error("Service does not support query type")}async query(e){throw new Error("Service does not support query")}*_tiles(){const e=Array.from(this._subscriptions.values());for(const s of e)yield s.tile}async edit(e,s){const t=Array.from(this._subscriptions.values()),r=t.map((({tile:e})=>e));for(const i of t)i.removeIds(s);if(e.length){const t=r.map((s=>{const t=this.createTileQuery(s);return t.objectIds=e,{tile:s,query:t}})).map((async({tile:e,query:s})=>({tile:e,result:await this.query(s),query:s}))),i=(await o(t)).map((async({tile:t,result:r})=>{if(!r.hasFeatures&&!s.length&&!e.length)return;const i=this._subscriptions.get(t.key.id);i&&i.edit(r,e)}));await n(i)}this._didEdit=!0}}export{m as DataTileSource};
|