@arcgis/core 4.34.0-next.29 → 4.34.0-next.30
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/Map.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0260b33daf48fc207880.js +1 -0
- package/assets/esri/core/workers/chunks/{f469224c6e4804fd835a.js → 140efe4735605258ecc9.js} +1 -1
- package/assets/esri/core/workers/chunks/173c5b8fa1ac7aa6e072.js +1 -0
- package/assets/esri/core/workers/chunks/1aa6719be3afbdc7c880.js +1 -0
- package/assets/esri/core/workers/chunks/{8552fdb3230f4dd082c6.js → 20a96c17d1a117dfdf77.js} +1 -1
- package/assets/esri/core/workers/chunks/28e04ef3575f164f611a.js +1 -0
- package/assets/esri/core/workers/chunks/{2173012af606ac4cdf87.js → 2a695b50a384c45ace9a.js} +1 -1
- package/assets/esri/core/workers/chunks/{cf635f7ca998dd33d947.js → 439ce953a25b2776cb7f.js} +1 -1
- package/assets/esri/core/workers/chunks/{ecdbbfebca1fcef567bb.js → 4e267a813e8b10d10b3b.js} +9 -9
- package/assets/esri/core/workers/chunks/7099ff8dc699fedea931.js +1 -0
- package/assets/esri/core/workers/chunks/{e89698fc404379627349.js → 949dc266ac6f3505d357.js} +1 -1
- package/assets/esri/core/workers/chunks/{0aba41e0ee0a591b254b.js → 971b16677b66c16fb6b9.js} +1 -1
- package/assets/esri/core/workers/chunks/a809042fdce7ced2a415.js +1 -0
- package/assets/esri/core/workers/chunks/{16d82cbec34bc434efcd.js → a82d7e2eecfe654a65de.js} +1 -1
- package/assets/esri/core/workers/chunks/{27e089acb1cc76758b0a.js → ac30cf2f9a94597f7665.js} +8 -8
- package/assets/esri/core/workers/chunks/{ec4428250dbd807df0bd.js → c50c2f014e8567870686.js} +1 -1
- package/assets/esri/core/workers/chunks/{ce3a1ac43e8579db65cd.js → c854c3bb4440fd942c12.js} +1 -1
- package/assets/esri/core/workers/chunks/{9cbed3b43d7aadc7e627.js → ca88859fc69fcb4568c0.js} +1 -1
- package/assets/esri/core/workers/chunks/e7209654ecdfde926272.js +1 -0
- package/assets/esri/core/workers/chunks/e82b1f91465d569012c4.js +1 -0
- package/assets/esri/core/workers/chunks/e9311386f58f3cb95c22.js +1 -0
- package/assets/esri/core/workers/chunks/{45485d8f0b0e0e0a6365.js → efec0f496491a0647051.js} +1 -1
- package/chunks/RealisticTree.glsl.js +6 -6
- package/colorUtils.js +1 -1
- package/config.js +1 -1
- package/core/Evented.js +1 -1
- package/interfaces.d.ts +2 -2
- package/kernel.js +1 -1
- package/layers/CatalogLayer.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/GeoJSONLayer.js +1 -1
- package/layers/GraphicsLayer.js +1 -1
- package/layers/OGCFeatureLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/graphics/data/FeatureStore.js +1 -1
- package/layers/graphics/dehydratedPoint.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/mixins/SublayersOwner.js +1 -1
- package/layers/support/LayerContingentValuesCache.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +1 -1
- package/portal/support/layersLoader.js +1 -1
- package/rest/networks/support/CircuitTraceResult.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/ManagedCanvas.js +1 -1
- package/views/2d/engine/imagery/RasterTileContainer.js +1 -1
- package/views/2d/engine/webgl/Profiler.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ReprojectTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
- package/views/2d/layers/features/processor/AAggregateStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/2d/support/hitTestUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementVisualization.js +5 -0
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementConfiguration.js +5 -0
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveXYAxisManipulation.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SQueryFeatureStore.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/support/CombinedElevationProvider.js +1 -1
- package/views/3d/support/pointsOfInterest/ContentGeometryUpdates.js +1 -1
- package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
- package/views/3d/webgl-engine/lib/ChangeSet.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
- package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
- package/views/3d/webgl-engine/lib/rendererUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/Viewport2DMixin.js +1 -1
- package/views/draw/DrawManipulator.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/interactive/snapping/SnappingManager.js +1 -1
- package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/layers/support/editableLayerViews.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/support/GeolocationPositioning.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/230e7b817ae16505ccf0.js +0 -1
- package/assets/esri/core/workers/chunks/450a7ebe2535a55c5193.js +0 -1
- package/assets/esri/core/workers/chunks/4599f5cebbafddb6720e.js +0 -1
- package/assets/esri/core/workers/chunks/676fec273f2f660a614d.js +0 -1
- package/assets/esri/core/workers/chunks/6aced8e446beceefaf2c.js +0 -1
- package/assets/esri/core/workers/chunks/9f459805a6698708830a.js +0 -1
- package/assets/esri/core/workers/chunks/a4104b21f2b282dfb14f.js +0 -1
- package/assets/esri/core/workers/chunks/cab3199d37411c8ed074.js +0 -1
- package/assets/esri/core/workers/chunks/fbfe2195ba87d18bc37a.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import r from"../../core/Collection.js";import s from"../../core/CollectionFlattener.js";import t from"../../core/Error.js";import o from"../../core/Logger.js";import{watch as a,sync as l}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{getProperties as n}from"../../core/accessorSupport/utils.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{nameToId as y,idToName as c}from"../../core/accessorSupport/PropertyOrigin.js";import b from"../support/Sublayer.js";import{isSublayerOverhaul as d}from"../support/sublayerUtils.js";function p(e,r){const s=[],t={};return e?(e.forEach(e=>{const o=new b;if(o.read(e,r),t[o.id]=o,null!=e.parentLayerId&&-1!==e.parentLayerId){const r=t[e.parentLayerId];r.sublayers||(r.sublayers=[]),r.sublayers.unshift(o)}else s.unshift(o)}),s):s}const h=r.ofType(b);function f(e,r){e&&e.forEach(e=>{r(e),e.sublayers&&e.sublayers.length&&f(e.sublayers,r)})}const m=m=>{const S=m;let v=class extends S{constructor(...e){super(...e),this.allSublayers=new s({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.sublayersSourceJSON={2:{},3:{},4:{},5:{},6:{}},this.subtables=null,this.addHandles([a(()=>this.sublayers,(e,r)=>this._handleSublayersChange(e,r),l),a(()=>this.subtables,(e,r)=>this._handleSublayersChange(e,r),l)])}destroy(){this.allSublayers.destroy()}readSublayers(e,r){if(!r||!e)return;const{sublayersSourceJSON:s}=this,t=y(r.origin);if(t<2)return;if(s[t]={context:r,visibleLayers:e.visibleLayers||s[t].visibleLayers,layers:e.layers||s[t].layers},t>2)return;this._set("serviceSublayers",this.createSublayersForOrigin("service").sublayers);const{sublayers:o,origin:a}=this.createSublayersForOrigin("web-document"),l=n(this);l.setDefaultOrigin(a),this._set("sublayers",new h(o)),l.setDefaultOrigin("user")}findSublayerById(e){return this.allSublayers.find(r=>r.id===e)}createServiceSublayers(){return this.createSublayersForOrigin("service").sublayers}createSublayersForOrigin(e){let r;const s=y("web-document"===e?"web-map":e);let t=2,o=this.sublayersSourceJSON[2].layers,a=this.sublayersSourceJSON[2].context,l=null;const i=[3,4,5].filter(e=>e<=s);for(const y of i){const e=this.sublayersSourceJSON[y];d(e.layers)&&(t=y,o=e.layers,a=e.context,e.visibleLayers&&(l={visibleLayers:e.visibleLayers,context:e.context}))}const n=[3,4,5].filter(e=>e>t&&e<=s);let u=null;for(const y of n){const{layers:e,visibleLayers:s,context:t}=this.sublayersSourceJSON[y];e&&(u={layers:e,context:t},r??=y),s&&(l={visibleLayers:s,context:t})}const b=p(o,a),m=new Map,S=new Set;if(u)for(const y of u.layers)m.set(y.id,y);if(l?.visibleLayers)for(const y of l.visibleLayers)S.add(y);return f(b,e=>{u&&e.read(m.get(e.id),u.context),l&&e.read({defaultVisibility:S.has(e.id)},l.context)}),{origin:c(t),originWithPartialOverrides:r?c(r):null,sublayers:new h({items:b})}}read(e,r){super.read(e,r),this.readSublayers(e,r)}_handleSublayersChange(e,r){r&&(r.forEach(e=>{e.parent=null,e.layer=null}),this.removeHandles("sublayers-owner")),e&&(e.forEach(e=>{e.parent=this,e.layer=this}),this.addHandles([e.on("after-add",({item:e})=>{e.parent=this,e.layer=this}),e.on("after-remove",({item:e})=>{e.parent=null,e.layer=null})],"sublayers-owner"),"tile"===this.type&&this.addHandles(e.on("before-changes",e=>{o.getLogger("esri.layers.TileLayer").error(new t("tilelayer:sublayers-non-modifiable","
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../core/Collection.js";import s from"../../core/CollectionFlattener.js";import t from"../../core/Error.js";import o from"../../core/Logger.js";import{watch as a,sync as l}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{getProperties as n}from"../../core/accessorSupport/utils.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{nameToId as y,idToName as c}from"../../core/accessorSupport/PropertyOrigin.js";import b from"../support/Sublayer.js";import{isSublayerOverhaul as d}from"../support/sublayerUtils.js";function p(e,r){const s=[],t={};return e?(e.forEach(e=>{const o=new b;if(o.read(e,r),t[o.id]=o,null!=e.parentLayerId&&-1!==e.parentLayerId){const r=t[e.parentLayerId];r.sublayers||(r.sublayers=[]),r.sublayers.unshift(o)}else s.unshift(o)}),s):s}const h=r.ofType(b);function f(e,r){e&&e.forEach(e=>{r(e),e.sublayers&&e.sublayers.length&&f(e.sublayers,r)})}const m=m=>{const S=m;let v=class extends S{constructor(...e){super(...e),this.allSublayers=new s({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.sublayersSourceJSON={2:{},3:{},4:{},5:{},6:{}},this.subtables=null,this.addHandles([a(()=>this.sublayers,(e,r)=>this._handleSublayersChange(e,r),l),a(()=>this.subtables,(e,r)=>this._handleSublayersChange(e,r),l)])}destroy(){this.allSublayers.destroy()}readSublayers(e,r){if(!r||!e)return;const{sublayersSourceJSON:s}=this,t=y(r.origin);if(t<2)return;if(s[t]={context:r,visibleLayers:e.visibleLayers||s[t].visibleLayers,layers:e.layers||s[t].layers},t>2)return;this._set("serviceSublayers",this.createSublayersForOrigin("service").sublayers);const{sublayers:o,origin:a}=this.createSublayersForOrigin("web-document"),l=n(this);l.setDefaultOrigin(a),this._set("sublayers",new h(o)),l.setDefaultOrigin("user")}findSublayerById(e){return this.allSublayers.find(r=>r.id===e)}createServiceSublayers(){return this.createSublayersForOrigin("service").sublayers}createSublayersForOrigin(e){let r;const s=y("web-document"===e?"web-map":e);let t=2,o=this.sublayersSourceJSON[2].layers,a=this.sublayersSourceJSON[2].context,l=null;const i=[3,4,5].filter(e=>e<=s);for(const y of i){const e=this.sublayersSourceJSON[y];d(e.layers)&&(t=y,o=e.layers,a=e.context,e.visibleLayers&&(l={visibleLayers:e.visibleLayers,context:e.context}))}const n=[3,4,5].filter(e=>e>t&&e<=s);let u=null;for(const y of n){const{layers:e,visibleLayers:s,context:t}=this.sublayersSourceJSON[y];e&&(u={layers:e,context:t},r??=y),s&&(l={visibleLayers:s,context:t})}const b=p(o,a),m=new Map,S=new Set;if(u)for(const y of u.layers)m.set(y.id,y);if(l?.visibleLayers)for(const y of l.visibleLayers)S.add(y);return f(b,e=>{u&&e.read(m.get(e.id),u.context),l&&e.read({defaultVisibility:S.has(e.id)},l.context)}),{origin:c(t),originWithPartialOverrides:r?c(r):null,sublayers:new h({items:b})}}read(e,r){super.read(e,r),this.readSublayers(e,r)}_handleSublayersChange(e,r){r&&(r.forEach(e=>{e.parent=null,e.layer=null}),this.removeHandles("sublayers-owner")),e&&(e.forEach(e=>{e.parent=this,e.layer=this}),this.addHandles([e.on("after-add",({item:e})=>{e.parent=this,e.layer=this}),e.on("after-remove",({item:e})=>{e.parent=null,e.layer=null})],"sublayers-owner"),"tile"===this.type&&this.addHandles(e.on("before-changes",e=>{o.getLogger("esri.layers.TileLayer").error(new t("tilelayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{layer:this})),e.preventDefault()}),"sublayers-owner"))}};return e([i({readOnly:!0})],v.prototype,"allSublayers",void 0),e([i({readOnly:!0,type:r.ofType(b)})],v.prototype,"serviceSublayers",void 0),e([i({value:null,type:h,json:{read:!1,write:{allowNull:!0,ignoreOrigin:!0}}})],v.prototype,"sublayers",void 0),e([i({readOnly:!0})],v.prototype,"sublayersSourceJSON",void 0),e([i({type:h,json:{read:{source:"tables"}}})],v.prototype,"subtables",void 0),v=e([u("esri.layers.mixins.SublayersOwner")],v),v};export{m as SublayersOwner,f as forEachSublayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import i from"../../core/JSONSupport.js";import s from"../../core/Loadable.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{parse as a}from"./arcgisLayerUrl.js";import l from"./Contingency.js";import u from"./ContingencyConstraintViolation.js";import c from"./ContingentValue.js";import p from"./ContingentValuesResult.js";import f from"./FieldGroup.js";import{isStringField as d,isDateField as y}from"./fieldUtils.js";import m from"./Subtype.js";import{getNormalizedFeatureTypeInfo as g}from"../../widgets/FeatureForm/featureFormUtils.js";var h;let V=h=class extends(i.JSONSupportMixin(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this.fieldGroupDefinitions=null}initialize(){}get subtypeFieldName(){return g(this.layer).typeFieldName}static async createLoadedLayerContingentValuesCache(e){await e.load();const t=e.sourceJSON;if(void 0===e.layerId)return null;const n=t.hasContingentValuesDefinition;if(n)return new h({layer:e}).load();if(void 0===n){const t=a(e.url);if(null==t)return null;const n=t.url.path;if((await S(n)).supportsQueryDataElements){const t=e.layerId.toString(),i=await x(n,t);if(i){const t=i.map(t=>({name:t.name,isEditingRestrictive:t.isEditingRestrictive,fields:t.fieldNames.names.map(t=>e.fieldsIndex.normalizeFieldName(t))}));return new h({layer:e,fieldGroupDefinitions:t}).load()}}}return null}async load(e){const t=this.layer.load(e).then(()=>this._initializeContingentValues(this.fieldGroupDefinitions,e));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const o of this.fieldGroups){const r=o.isEditingRestrictive?"error":"warning";if(t&&!o.fields.some(e=>t.includes(e)))continue;if(!o.fields.every(e=>n.includes(e))){s.push(new u({fieldGroup:o,type:r}));continue}let a=!1;const l=e[this.subtypeFieldName],c=o.contingencies.filter(e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l);if(0!==c.length){for(const t of c){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new u({fieldGroup:o,type:r}))}}return{invalid:i,incomplete:s}}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,o={};let r=[];const a=this.fieldGroups.filter(e=>e.fields.includes(t));r.push(new c({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter(e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i));let c=!1;const p={};for(const n of u){let i,s=!0;for(const o in n.values){const r=n.values[o];if(t!==o){if(void 0!==e[o]&&"any"!==r.objectType)if("null"===r.objectType)null!==e[o]&&(s=!1);else if("code"===r.objectType)e[o]!==r.codedValue.code&&(s=!1);else if("range"===r.objectType){const t=e[o];(t<r.minValue||t>r.maxValue)&&(s=!1)}}else i=r,c=c||"range"===r.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=b(i);p[e]||a.push(i),p[e]=!0}}c&&(a=j(a)),o[l.name]=a,r=n?G(r,a):[]}return 1===a.length&&n&&(r=[]),new p({contingentValuesAllGroups:r,contingentValuesByFieldGroup:o})}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return void(this.fieldGroups=[]);const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=a(this.layer.url).url.path;if(t.hasContingentValuesDefinition){return(await v(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return void 0!==t.hasContingentValuesDefinition?[]:S(i,e).then(async t=>{if(t.supportsQueryDataElements){return(await x(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return[]})}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=a(this.layer.url).url.path;if(n.hasContingentValuesDefinition){const n=await F(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const o=await C(s,i,t);return this._constructFieldGroupsEnterprise(e,o)}_constructFieldGroupsAGOL(e,t){return e.map(e=>{const n=t.contingentValuesDefinition.fieldGroups.find(t=>t.name===e.name);if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new f({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach(n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))}),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const o of n??[]){const n=this._parseAGOLContingency(o,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,o=!!e.retired&&1===e.retired,r={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],o=n.typeCodes[e.types[a]];if("Code"===o){let t=e.values[l];l++;const o=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find(e=>e.domain===o?.name);e&&(t=e.entries[t])}const u=o?.codedValues.find(e=>e.code===t),p=new c({codedValue:u,objectType:"code"});r[s]=p}else if("Range"===o){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],o=new c({minValue:n,maxValue:i,objectType:"range"});r[s]=o}else if("Any"===o){const e=new c({objectType:"any"});r[s]=e}else{const e=new c({objectType:"null"});r[s]=e}}return new l({id:s,isRetired:o,subtype:i,values:r})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map(e=>{const n=i.find(t=>t.name===e.name);if(n){const i=n.contingencies.map(n=>{const i=n.id,s=n.isRetired||!1,o=this._getSubtypeEnterprise(n.subtypeCode),r={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(o,i),n=this.layer.getField(i);if(d(n))s=t.stringDictionary[s];else if(y(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find(e=>e.code===s),l=new c({codedValue:a,objectType:"code"});r[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new c({minValue:e,maxValue:t,objectType:"range"});r[i]=n}else if(s){const e=new c({objectType:"any"});r[i]=e}else{const e=new c({objectType:"null"});r[i]=e}}return new l({id:i,isRetired:s,subtype:o,values:r})});return new f({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find(t=>t.code===e);n=m.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find(t=>t.name===e);n=m.fromJSON(i)}return n||null}_getDomain(e,t){const n=e?O(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};function b(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}function j(e){let t,n;e.sort((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue);const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new c({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new c({objectType:"range",minValue:t,maxValue:n})),i}function T(e,t){const n=[];let i,s=0;for(const o of e)for(;s<t.length;s++){const e=t[s];if("null"===o.objectType&&"null"===e.objectType)n.push(new c({objectType:"null"}));else{if("null"===o.objectType)break;if("null"===e.objectType)continue}if(o.maxValue<e.minValue)break;if(o.maxValue===e.minValue){n.push(new c({objectType:"range",minValue:o.maxValue,maxValue:e.minValue}));break}if(!(o.minValue>e.maxValue))if(o.minValue!==e.maxValue){if(i=o.minValue>e.minValue?o.minValue:e.minValue,o.maxValue<e.maxValue){n.push(new c({objectType:"range",minValue:i,maxValue:o.maxValue}));break}n.push(new c({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new c({objectType:"range",minValue:o.minValue,maxValue:e.maxValue}))}return n}function w(e,t){const n=[];for(const i of e)t.some(e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1})&&n.push(i);return n}function G(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?T(e,t):w(e,t)}async function v(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data.fieldGroups??[])}async function x(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.layerDataElements?.[0].dataElement.fieldGroups??[])}async function S(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then(e=>e.data)}async function C(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.contingentValueSets?.[0])}async function F(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data)}function O(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find(([e])=>e.trim().toLowerCase()===t.trim().toLowerCase())||[];return i||null}return null}e([o({constructOnly:!0})],V.prototype,"layer",void 0),e([o({constructOnly:!0})],V.prototype,"request",void 0),e([o({type:[f]})],V.prototype,"fieldGroups",void 0),e([o({constructOnly:!0})],V.prototype,"fieldGroupDefinitions",void 0),e([o()],V.prototype,"subtypeFieldName",null),V=h=e([r("esri.layers.support.LayerContingentValuesCache")],V);const D=V;export{D as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import i from"../../core/JSONSupport.js";import s from"../../core/Loadable.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{parse as a}from"./arcgisLayerUrl.js";import l from"./Contingency.js";import u from"./ContingencyConstraintViolation.js";import c from"./ContingentValue.js";import p from"./ContingentValuesResult.js";import f from"./FieldGroup.js";import{isStringField as d,isDateField as y}from"./fieldUtils.js";import m from"./Subtype.js";import{getNormalizedFeatureTypeInfo as g}from"../../widgets/FeatureForm/featureFormUtils.js";var h;let V=h=class extends(i.JSONSupportMixin(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this.fieldGroupDefinitions=null}initialize(){}get subtypeFieldName(){return g(this.layer).typeFieldName}static async createLoadedLayerContingentValuesCache(e){await e.load();const t=e.sourceJSON;if(void 0===e.layerId)return null;const n=t?.hasContingentValuesDefinition;if(n)return new h({layer:e}).load();if(void 0===n){const t=a(e.url);if(null==t)return null;const n=t.url.path;if((await S(n)).supportsQueryDataElements){const t=e.layerId.toString(),i=await x(n,t);if(i){const t=i.map(t=>({name:t.name,isEditingRestrictive:t.isEditingRestrictive,fields:t.fieldNames.names.map(t=>e.fieldsIndex.normalizeFieldName(t))}));return new h({layer:e,fieldGroupDefinitions:t}).load()}}}return null}async load(e){const t=this.layer.load(e).then(()=>this._initializeContingentValues(this.fieldGroupDefinitions,e));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const o of this.fieldGroups){const r=o.isEditingRestrictive?"error":"warning";if(t&&!o.fields.some(e=>t.includes(e)))continue;if(!o.fields.every(e=>n.includes(e))){s.push(new u({fieldGroup:o,type:r}));continue}let a=!1;const l=e[this.subtypeFieldName],c=o.contingencies.filter(e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l);if(0!==c.length){for(const t of c){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new u({fieldGroup:o,type:r}))}}return{invalid:i,incomplete:s}}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,o={};let r=[];const a=this.fieldGroups.filter(e=>e.fields.includes(t));r.push(new c({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter(e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i));let c=!1;const p={};for(const n of u){let i,s=!0;for(const o in n.values){const r=n.values[o];if(t!==o){if(void 0!==e[o]&&"any"!==r.objectType)if("null"===r.objectType)null!==e[o]&&(s=!1);else if("code"===r.objectType)e[o]!==r.codedValue.code&&(s=!1);else if("range"===r.objectType){const t=e[o];(t<r.minValue||t>r.maxValue)&&(s=!1)}}else i=r,c=c||"range"===r.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=b(i);p[e]||a.push(i),p[e]=!0}}c&&(a=j(a)),o[l.name]=a,r=n?G(r,a):[]}return 1===a.length&&n&&(r=[]),new p({contingentValuesAllGroups:r,contingentValuesByFieldGroup:o})}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return void(this.fieldGroups=[]);const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=a(this.layer.url).url.path;if(t?.hasContingentValuesDefinition){return(await v(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return void 0!==t?.hasContingentValuesDefinition?[]:S(i,e).then(async t=>{if(t.supportsQueryDataElements){return(await x(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return[]})}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=a(this.layer.url).url.path;if(n?.hasContingentValuesDefinition){const n=await F(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const o=await C(s,i,t);return this._constructFieldGroupsEnterprise(e,o)}_constructFieldGroupsAGOL(e,t){return e.map(e=>{const n=t.contingentValuesDefinition.fieldGroups.find(t=>t.name===e.name);if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new f({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach(n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))}),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const o of n??[]){const n=this._parseAGOLContingency(o,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,o=!!e.retired&&1===e.retired,r={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],o=n.typeCodes[e.types[a]];if("Code"===o){let t=e.values[l];l++;const o=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find(e=>e.domain===o?.name);e&&(t=e.entries[t])}const u=o?.codedValues.find(e=>e.code===t),p=new c({codedValue:u,objectType:"code"});r[s]=p}else if("Range"===o){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],o=new c({minValue:n,maxValue:i,objectType:"range"});r[s]=o}else if("Any"===o){const e=new c({objectType:"any"});r[s]=e}else{const e=new c({objectType:"null"});r[s]=e}}return new l({id:s,isRetired:o,subtype:i,values:r})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map(e=>{const n=i.find(t=>t.name===e.name);if(n){const i=n.contingencies.map(n=>{const i=n.id,s=n.isRetired||!1,o=this._getSubtypeEnterprise(n.subtypeCode),r={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(o,i),n=this.layer.getField(i);if(d(n))s=t.stringDictionary[s];else if(y(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find(e=>e.code===s),l=new c({codedValue:a,objectType:"code"});r[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new c({minValue:e,maxValue:t,objectType:"range"});r[i]=n}else if(s){const e=new c({objectType:"any"});r[i]=e}else{const e=new c({objectType:"null"});r[i]=e}}return new l({id:i,isRetired:s,subtype:o,values:r})});return new f({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t?.subtypes){const i=t.subtypes.find(t=>t.code===e);n=m.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t?.subtypes){const i=t.subtypes.find(t=>t.name===e);n=m.fromJSON(i)}return n||null}_getDomain(e,t){const n=e?O(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};function b(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}function j(e){let t,n;e.sort((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue);const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new c({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new c({objectType:"range",minValue:t,maxValue:n})),i}function T(e,t){const n=[];let i,s=0;for(const o of e)for(;s<t.length;s++){const e=t[s];if("null"===o.objectType&&"null"===e.objectType)n.push(new c({objectType:"null"}));else{if("null"===o.objectType)break;if("null"===e.objectType)continue}if(o.maxValue<e.minValue)break;if(o.maxValue===e.minValue){n.push(new c({objectType:"range",minValue:o.maxValue,maxValue:e.minValue}));break}if(!(o.minValue>e.maxValue))if(o.minValue!==e.maxValue){if(i=o.minValue>e.minValue?o.minValue:e.minValue,o.maxValue<e.maxValue){n.push(new c({objectType:"range",minValue:i,maxValue:o.maxValue}));break}n.push(new c({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new c({objectType:"range",minValue:o.minValue,maxValue:e.maxValue}))}return n}function w(e,t){const n=[];for(const i of e)t.some(e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1})&&n.push(i);return n}function G(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?T(e,t):w(e,t)}async function v(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data.fieldGroups??[])}async function x(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.layerDataElements?.[0].dataElement.fieldGroups??[])}async function S(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then(e=>e.data)}async function C(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.contingentValueSets?.[0])}async function F(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data)}function O(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find(([e])=>e.trim().toLowerCase()===t.trim().toLowerCase())||[];return i||null}return null}e([o({constructOnly:!0})],V.prototype,"layer",void 0),e([o({constructOnly:!0})],V.prototype,"request",void 0),e([o({type:[f]})],V.prototype,"fieldGroups",void 0),e([o({constructOnly:!0})],V.prototype,"fieldGroupDefinitions",void 0),e([o()],V.prototype,"subtypeFieldName",null),V=h=e([r("esri.layers.support.LayerContingentValuesCache")],V);const D=V;export{D as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../Graphic.js";import{getOrCreateMapValue as r}from"../core/MapUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import n from"./Network.js";import l from"./RulesTable.js";import u from"./support/NamedTraceConfiguration.js";import{getAssociationsTableFields as d}from"./support/networkFieldUtils.js";import m from"./support/NetworkSystemLayers.js";import c from"./support/TerminalConfiguration.js";import y from"./support/TraceJobInfo.js";import{AssociationTypeEnum as p}from"./support/typeUtils.js";import{doesRuleAllowAssociation as f}from"./support/utils.js";import h from"../rest/support/Query.js";let g=class extends n{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._circuitManagerMap=new Map,this._terminalById=new Map,this._unitIdentifierManager=null}get _rulesLayer(){const{gdbVersion:e,historicMoment:t}=this,r=this.networkSystemLayers.rulesTableUrl;return new o({url:r,gdbVersion:e,historicMoment:t})}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map(t=>{t?.edgeSources?.map(({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}),t?.junctionSources?.map(({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})}),e}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new m({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,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map(e=>c.fromJSON(e))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map(e=>e.domainNetworkName)||[]}get hasTelecomNetwork(){return this.dataElement?.domainNetworks.some(e=>e.isTelecomNetwork)??!1}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.sourceLayer;let i=null;if("feature"===s?.type){if(i=s.layerId,null===i)return null}else{if("subtype-sublayer"!==s?.type)return null;if(i=s?.parent?.layerId??null,null===i)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 a=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find(e=>e.layerId===i);if(e){const s=e.assetGroups?.find(e=>e.assetGroupCode===t);if(s){const e=s.assetTypes?.find(e=>e.assetTypeCode===r);if(e?.isTerminalConfigurationSupported){a=e.terminalConfigurationId;break}}}}if(null!=a){const e=this.dataElement.terminalConfigurations,t=e?.find(e=>e.terminalConfigurationId===a);return t?c.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find(t=>t.domainNetworkName===e);return t?.tiers?.map(e=>e.name)||[]}async getRulesTable(){const e=this._rulesLayer;e.loaded||await e.load();const t=this.dataElement?.domainNetworks;if(!t)return null;const r=t.flatMap(e=>[...e.edgeSources||[],...e.junctionSources||[]]),s=(await this._queryRulesTable(e)).map(t=>this._hydrateRuleInfo(e,r,t));return new l({rulesLayer:e,rules:s})}async getCircuitManager(e){if(!this.hasTelecomNetwork)return null;const t=this.dataElement?.domainNetworks.find(t=>t.domainNetworkName===e&&t.isTelecomNetwork);if(!t)return null;const{default:s}=await import("./CircuitManager.js");return r(this._circuitManagerMap,e,()=>new s({utilityNetwork:this,telecomDomainNetwork:t}))}async getUnitIdentifierManager(){if(!this.hasTelecomNetwork)return null;if(this._unitIdentifierManager)return this._unitIdentifierManager;const{default:e}=await import("./UnitIdentifierManager.js");return this._unitIdentifierManager=new e({utilityNetwork:this}),this._unitIdentifierManager}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach(e=>{e.terminals.forEach(e=>{this._terminalById.set(e.id,e)})}),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?this._utilityLayerList.has(e?.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),i=s.from(e);i.gdbVersion=this.gdbVersion,i.moment=this.historicMoment;return(await r(this.networkServiceUrl,i,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const i=await t(this.networkServiceUrl,s);return new y({statusUrl:i})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;const{fromNetworkElement:r,toNetworkElement:s}=e;if(!r||!s)return!1;await t.load();let i=null;switch(e.associationType){case"containment":i=t.rulesCategorized.containment;break;case"attachment":i=t.rulesCategorized.attachment;break;default:i=t.rulesCategorized.connectivity}return i.some(e=>f(e,r,s))}generateAddAssociations(e){const{associationsTable:r}=this.networkSystemLayers,{fromNetworkSourceId:s,fromGlobalId:i,fromTerminalId:o,toNetworkSourceId:a,toGlobalId:n,toTerminalId:l,associationType:u,isContentVisible:m,percentAlong:c,globalId:y}=d(r);return{addFeatures:e.map(e=>new t({attributes:{[s]:e.fromNetworkElement?.networkSourceId,[i]:e.fromNetworkElement?.globalId,[o]:e.fromNetworkElement?.terminalId,[a]:e.toNetworkElement?.networkSourceId,[n]:e.toNetworkElement?.globalId,[l]:e.toNetworkElement?.terminalId,[u]:p[e.associationType],[m]:null==e.isContentVisible?void 0:e.isContentVisible?1:0,[c]:e.percentAlong,[y]:e.globalId}})),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:r?.globalIdField??"globalid",objectIdField:r?.objectIdField??"objectid"}}}generateDeleteAssociations(e){const{associationsTable:t,associationsTableId:r}=this.networkSystemLayers;return{deleteFeatures:e.map(e=>({globalId:e.globalId})),id:r,identifierFields:{globalIdField:t?.globalIdField??"globalid",objectIdField:t?.objectIdField??"objectid"}}}async loadAssociationsTable(){return this.networkSystemLayers.loadAssociationsTable()}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"})}}}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,i=s.get("RULETYPE"),o=s.get("CREATIONDATE"),a=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),d=s.get("TONETWORKSOURCEID"),m=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),p=s.get("VIANETWORKSOURCEID"),f=s.get("VIAASSETGROUP"),h=s.get("VIAASSETTYPE"),g=s.get("VIATERMINALID"),I=r.attributes[i.name],b=new Date(r.attributes[o.name]),w=[{networkSourceId:r.attributes[a.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[d.name],assetGroupId:r.attributes[m.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[p.name],assetGroupId:r.attributes[f.name],assetTypeId:r.attributes[h.name],terminalId:r.attributes[g.name]}],T={ruleType:I,creationDate:b};for(const k of[0,1,2]){if(5!==I&&2===k)continue;const e=w[k],r=t.find(t=>t.sourceId===e.networkSourceId),s=r?.assetGroups.find(t=>t.assetGroupCode===e.assetGroupId),i=s?.assetTypes.find(t=>t.assetTypeCode===e.assetTypeId),o=this._getTerminal(i,e);let a="";switch(k){case 0:a="from";break;case 1:a="to";break;case 2:a="via"}T[`${a}NetworkSource`]=r,T[`${a}AssetGroup`]=s,T[`${a}AssetType`]=i,T[`${a}Terminal`]=o?.toJSON()}return T}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find(e=>e.id===r);return s?.terminals?.find(e=>e.id===t.terminalId)??null}async _queryRulesTable(e){const{gdbVersion:t,historicMoment:r}=this,s=new h({where:"1=1",outFields:["*"],gdbVersion:t,historicMoment:r});return(await a(e,s)).features}};e([s({readOnly:!0})],g.prototype,"_rulesLayer",null),e([s({type:[u],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],g.prototype,"sharedNamedTraceConfigurations",void 0),e([s({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],g.prototype,"type",void 0),e([s({readOnly:!0})],g.prototype,"serviceTerritoryFeatureLayerId",null),e([s({readOnly:!0})],g.prototype,"networkSystemLayers",null),e([s({readOnly:!0})],g.prototype,"terminalConfigurations",null),e([s({readOnly:!0})],g.prototype,"domainNetworkNames",null),e([s({readOnly:!0})],g.prototype,"hasTelecomNetwork",null),g=e([i("esri.networks.UtilityNetwork")],g);const I=g;export{I as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../Graphic.js";import{getOrCreateMapValue as r}from"../core/MapUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import n from"./Network.js";import l from"./RulesTable.js";import u from"./support/NamedTraceConfiguration.js";import{getAssociationsTableFields as d}from"./support/networkFieldUtils.js";import m from"./support/NetworkSystemLayers.js";import c from"./support/TerminalConfiguration.js";import y from"./support/TraceJobInfo.js";import{AssociationTypeEnum as p}from"./support/typeUtils.js";import{doesRuleAllowAssociation as f}from"./support/utils.js";import h from"../rest/support/Query.js";let g=class extends n{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._circuitManagerMap=new Map,this._terminalById=new Map,this._unitIdentifierManager=null}get _rulesLayer(){const{gdbVersion:e,historicMoment:t}=this,r=this.networkSystemLayers.rulesTableUrl;return new o({url:r,gdbVersion:e,historicMoment:t})}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map(t=>{t?.edgeSources?.map(({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}),t?.junctionSources?.map(({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})}),e}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new m({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,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map(e=>c.fromJSON(e))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map(e=>e.domainNetworkName)||[]}get hasTelecomNetwork(){return this.dataElement?.domainNetworks.some(e=>e.isTelecomNetwork)??!1}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.sourceLayer;let i=null;if("feature"===s?.type){if(i=s.layerId,null===i)return null}else{if("subtype-sublayer"!==s?.type)return null;if(i=s?.parent?.layerId??null,null===i)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 a=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find(e=>e.layerId===i);if(e){const s=e.assetGroups?.find(e=>e.assetGroupCode===t);if(s){const e=s.assetTypes?.find(e=>e.assetTypeCode===r);if(e?.isTerminalConfigurationSupported){a=e.terminalConfigurationId;break}}}}if(null!=a){const e=this.dataElement.terminalConfigurations,t=e?.find(e=>e.terminalConfigurationId===a);return t?c.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find(t=>t.domainNetworkName===e);return t?.tiers?.map(e=>e.name)||[]}async getRulesTable(){const e=this._rulesLayer;e.loaded||await e.load();const t=this.dataElement?.domainNetworks;if(!t)return null;const r=t.flatMap(e=>[...e.edgeSources||[],...e.junctionSources||[]]),s=(await this._queryRulesTable(e)).map(t=>this._hydrateRuleInfo(e,r,t));return new l({rulesLayer:e,rules:s})}async getCircuitManager(e){if(!this.hasTelecomNetwork)return null;const t=this.dataElement?.domainNetworks.find(t=>t.domainNetworkName===e&&t.isTelecomNetwork);if(!t)return null;const{default:s}=await import("./CircuitManager.js");return r(this._circuitManagerMap,e,()=>new s({utilityNetwork:this,telecomDomainNetwork:t}))}async getUnitIdentifierManager(){if(!this.hasTelecomNetwork)return null;if(this._unitIdentifierManager)return this._unitIdentifierManager;const{default:e}=await import("./UnitIdentifierManager.js");return this._unitIdentifierManager=new e({utilityNetwork:this}),this._unitIdentifierManager}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach(e=>{e.terminals.forEach(e=>{this._terminalById.set(e.id,e)})}),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?null!=e.layerId&&this._utilityLayerList.has(e.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),i=s.from(e);i.gdbVersion=this.gdbVersion,i.moment=this.historicMoment;return(await r(this.networkServiceUrl,i,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const i=await t(this.networkServiceUrl,s);return new y({statusUrl:i})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;const{fromNetworkElement:r,toNetworkElement:s}=e;if(!r||!s)return!1;await t.load();let i=null;switch(e.associationType){case"containment":i=t.rulesCategorized.containment;break;case"attachment":i=t.rulesCategorized.attachment;break;default:i=t.rulesCategorized.connectivity}return i.some(e=>f(e,r,s))}generateAddAssociations(e){const{associationsTable:r}=this.networkSystemLayers,{fromNetworkSourceId:s,fromGlobalId:i,fromTerminalId:o,toNetworkSourceId:a,toGlobalId:n,toTerminalId:l,associationType:u,isContentVisible:m,percentAlong:c,globalId:y}=d(r);return{addFeatures:e.map(e=>new t({attributes:{[s]:e.fromNetworkElement?.networkSourceId,[i]:e.fromNetworkElement?.globalId,[o]:e.fromNetworkElement?.terminalId,[a]:e.toNetworkElement?.networkSourceId,[n]:e.toNetworkElement?.globalId,[l]:e.toNetworkElement?.terminalId,[u]:p[e.associationType],[m]:null==e.isContentVisible?void 0:e.isContentVisible?1:0,[c]:e.percentAlong,[y]:e.globalId}})),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:r?.globalIdField??"globalid",objectIdField:r?.objectIdField??"objectid"}}}generateDeleteAssociations(e){const{associationsTable:t,associationsTableId:r}=this.networkSystemLayers;return{deleteFeatures:e.map(e=>({globalId:e.globalId})),id:r,identifierFields:{globalIdField:t?.globalIdField??"globalid",objectIdField:t?.objectIdField??"objectid"}}}async loadAssociationsTable(){return this.networkSystemLayers.loadAssociationsTable()}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"})}}}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,i=s.get("RULETYPE"),o=s.get("CREATIONDATE"),a=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),d=s.get("TONETWORKSOURCEID"),m=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),p=s.get("VIANETWORKSOURCEID"),f=s.get("VIAASSETGROUP"),h=s.get("VIAASSETTYPE"),g=s.get("VIATERMINALID"),I=r.attributes[i.name],b=new Date(r.attributes[o.name]),w=[{networkSourceId:r.attributes[a.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[d.name],assetGroupId:r.attributes[m.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[p.name],assetGroupId:r.attributes[f.name],assetTypeId:r.attributes[h.name],terminalId:r.attributes[g.name]}],T={ruleType:I,creationDate:b};for(const k of[0,1,2]){if(5!==I&&2===k)continue;const e=w[k],r=t.find(t=>t.sourceId===e.networkSourceId),s=r?.assetGroups.find(t=>t.assetGroupCode===e.assetGroupId),i=s?.assetTypes.find(t=>t.assetTypeCode===e.assetTypeId),o=this._getTerminal(i,e);let a="";switch(k){case 0:a="from";break;case 1:a="to";break;case 2:a="via"}T[`${a}NetworkSource`]=r,T[`${a}AssetGroup`]=s,T[`${a}AssetType`]=i,T[`${a}Terminal`]=o?.toJSON()}return T}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find(e=>e.id===r);return s?.terminals?.find(e=>e.id===t.terminalId)??null}async _queryRulesTable(e){const{gdbVersion:t,historicMoment:r}=this,s=new h({where:"1=1",outFields:["*"],gdbVersion:t,historicMoment:r});return(await a(e,s)).features}};e([s({readOnly:!0})],g.prototype,"_rulesLayer",null),e([s({type:[u],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],g.prototype,"sharedNamedTraceConfigurations",void 0),e([s({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],g.prototype,"type",void 0),e([s({readOnly:!0})],g.prototype,"serviceTerritoryFeatureLayerId",null),e([s({readOnly:!0})],g.prototype,"networkSystemLayers",null),e([s({readOnly:!0})],g.prototype,"terminalConfigurations",null),e([s({readOnly:!0})],g.prototype,"domainNetworkNames",null),e([s({readOnly:!0})],g.prototype,"hasTelecomNetwork",null),g=e([i("esri.networks.UtilityNetwork")],g);const I=g;export{I 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Error.js";import{parse as t}from"../../layers/support/arcgisLayerUrl.js";import{fetchFeatureService as r}from"../../layers/support/fetchService.js";import{LayerLoadContext as a}from"../../layers/support/LayerLoadContext.js";import{applyPreferredHostToPortalItem as o,getPreferredHost as n,isPreferredUrlApplicable as s}from"../../layers/support/layerUtils.js";import l from"../Portal.js";import{createForItemRead as i}from"./jsonContext.js";import{instanceTypeToLayerTypes as p,getSublayersByLayerType as u,getFirstLayerOrTable as c,preprocessFSItemData as y,populateSceneServiceItemData as d,getNumLayersAndTables as f,layerTypeToLayerModuleType as m,createSublayerData as w}from"./loadUtils.js";import{hasTypeKeyword as h}from"./portalItemUtils.js";import{loadStyleRenderer as g}from"../../renderers/support/styleUtils.js";import{fetchArcGISServiceJSON as I}from"../../support/requestPresets.js";async function b(e,t){const r=e.instance.portalItem;if(r?.id)return await r.load(t),v(e),e.validateItem&&e.validateItem(r),L(e,t)}function v(t){const r=t.instance.portalItem;if(!r?.type||!t.supportedTypes.includes(r.type))throw new e("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}'",{type:r?.type,expectedType:t.supportedTypes.join(", ")})}async function L(e,t){const r=e.instance,o=r.portalItem;if(!o)return;let{url:n}=o;const{title:s}=o,l=i(o,"portal-item");if("group"===r.type)return S(r,l,e);n&&"media"!==r.type&&r.read({url:n},l);const p=new a,{data:u,preferredHost:c}=await x(e,p,t);return n=o.url,"isUrlHostModified"in r&&(c?r.applyPreferredHost({preferredHost:c}):r.applyHostFromPortalItem()),u&&r.read(u,l),r.resourceReferences={portalItem:o,paths:l.readResourcePaths??[]},"subtype-group"!==r.type&&r.read({title:s},l),g(r,l)}async function S(t,r,a){const o=t.portalItem;if(!t.sourceIsPortalItem)return;const{title:n,type:s}=o;if("Group Layer"===s){if(!h(o,"Map"))throw new e("portal:invalid-layer-item-typekeyword","'Group Layer' item without 'Map' type keyword is not supported");return T(t,a)}return t.read({title:n},r),j(t,a)}async function T(t,r){const a=t.portalItem,o=await a.fetchData("json");if(!o)return;if(!r.populateGroupLayer)throw new e("portal:missing-populate-group-layer","Missing populate group layer");const n=i(a,"web-map");t.read(o,n),await r.populateGroupLayer(t,o,{context:n}),t.resourceReferences={portalItem:a,paths:n.readResourcePaths??[]}}async function j(t,r){let n;const{portalItem:s}=t;if(!s)return;const l=s.type,i=r.layerModuleTypeMap;if(!i)throw new e("portal:missing-layer-module-type-map","Layer module type map is required to construct sub layers");switch(l){case"Feature Service":case"Feature Collection":n=i.FeatureLayer;break;case"Stream Service":n=i.StreamLayer;break;case"Scene Service":n=i.SceneLayer;break;case"Video Service":n=i.VideoLayer;break;default:throw new e("portal:unsupported-item-type-as-group",`The item type '${l}' is not supported as a '
|
|
5
|
+
import e from"../../core/Error.js";import{parse as t}from"../../layers/support/arcgisLayerUrl.js";import{fetchFeatureService as r}from"../../layers/support/fetchService.js";import{LayerLoadContext as a}from"../../layers/support/LayerLoadContext.js";import{applyPreferredHostToPortalItem as o,getPreferredHost as n,isPreferredUrlApplicable as s}from"../../layers/support/layerUtils.js";import l from"../Portal.js";import{createForItemRead as i}from"./jsonContext.js";import{instanceTypeToLayerTypes as p,getSublayersByLayerType as u,getFirstLayerOrTable as c,preprocessFSItemData as y,populateSceneServiceItemData as d,getNumLayersAndTables as f,layerTypeToLayerModuleType as m,createSublayerData as w}from"./loadUtils.js";import{hasTypeKeyword as h}from"./portalItemUtils.js";import{loadStyleRenderer as g}from"../../renderers/support/styleUtils.js";import{fetchArcGISServiceJSON as I}from"../../support/requestPresets.js";async function b(e,t){const r=e.instance.portalItem;if(r?.id)return await r.load(t),v(e),e.validateItem&&e.validateItem(r),L(e,t)}function v(t){const r=t.instance.portalItem;if(!r?.type||!t.supportedTypes.includes(r.type))throw new e("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}'",{type:r?.type,expectedType:t.supportedTypes.join(", ")})}async function L(e,t){const r=e.instance,o=r.portalItem;if(!o)return;let{url:n}=o;const{title:s}=o,l=i(o,"portal-item");if("group"===r.type)return S(r,l,e);n&&"media"!==r.type&&r.read({url:n},l);const p=new a,{data:u,preferredHost:c}=await x(e,p,t);return n=o.url,"isUrlHostModified"in r&&(c?r.applyPreferredHost({preferredHost:c}):r.applyHostFromPortalItem()),u&&r.read(u,l),r.resourceReferences={portalItem:o,paths:l.readResourcePaths??[]},"subtype-group"!==r.type&&r.read({title:s},l),g(r,l)}async function S(t,r,a){const o=t.portalItem;if(!t.sourceIsPortalItem)return;const{title:n,type:s}=o;if("Group Layer"===s){if(!h(o,"Map"))throw new e("portal:invalid-layer-item-typekeyword","'Group Layer' item without 'Map' type keyword is not supported");return T(t,a)}return t.read({title:n},r),j(t,a)}async function T(t,r){const a=t.portalItem,o=await a.fetchData("json");if(!o)return;if(!r.populateGroupLayer)throw new e("portal:missing-populate-group-layer","Missing populate group layer");const n=i(a,"web-map");t.read(o,n),await r.populateGroupLayer(t,o,{context:n}),t.resourceReferences={portalItem:a,paths:n.readResourcePaths??[]}}async function j(t,r){let n;const{portalItem:s}=t;if(!s)return;const l=s.type,i=r.layerModuleTypeMap;if(!i)throw new e("portal:missing-layer-module-type-map","Layer module type map is required to construct sub layers");switch(l){case"Feature Service":case"Feature Collection":n=i.FeatureLayer;break;case"Stream Service":n=i.StreamLayer;break;case"Scene Service":n=i.SceneLayer;break;case"Video Service":n=i.VideoLayer;break;default:throw new e("portal:unsupported-item-type-as-group",`The item type '${l}' is not supported as a 'GroupLayer'`)}const p="Video Service"===l,u=new a;let[m,{data:w}]=await Promise.all([n(),p?{data:null}:x(r,u)]),h=()=>m;if(p)return F(t,h,i);if("Feature Service"===l){const e=c(w)?.customParameters;w=s.url?(await y(w,s.url,u)).data:{},h=await E(w,i)||h;const{provider:r,preferredHost:a}=await U(s.url,{customParameters:e,loadContext:u});return o(s,a),await H(t,h,h,w,i,r)}return"Scene Service"===l&&s.url&&(w=await d(s,w,u)),f(w)>0?await H(t,h,null,w,i):await P(t,h,i)}async function P(e,t,r){const{portalItem:a}=e;if(!a?.url)return;const o=await I(a.url);o&&H(e,t,null,{layers:o.layers?.map(w),tables:o.tables?.map(w)},r)}async function F(e,t,r){const{portalItem:a}=e;if(!a?.url)return;const o=await I(a.url);o&&H(e,t,null,{layers:o.layers?.map(({id:e,name:t})=>({id:e,name:t}))},r)}async function H(e,t,r,a,o,n){let s=a.layers||[];const l=a.tables||[];if("Feature Collection"===e.portalItem?.type?(s.forEach((e,t)=>{e.id=t,"Table"===e?.layerDefinition?.type&&l.push(e)}),s=s.filter(e=>"Table"!==e?.layerDefinition?.type)):(s.reverse(),l.reverse()),s.forEach(r=>{const o=n?.(r);if(o||!n){const n=M(e,t(r),a,r,o);e.add(n)}}),l.length){const t=r?null:await o.FeatureLayer();l.forEach(o=>{const s=n?.(o);if(s||!n){const n=M(e,r?r(o):t,a,o,s);e.tables.add(n)}})}}function M(e,t,r,a,o){const n=e.portalItem,s={portalItem:n.clone(),layerId:a.id};null!=a.url&&(s.url=a.url);const i=new t(s);if("sourceJSON"in i&&(i.sourceJSON=o),"subtype-group"!==i.type&&"catalog"!==i.type&&(i.sublayerTitleMode="service-name"),"Feature Collection"===n.type){const e={origin:"portal-item",portal:n.portal||l.getDefault()};i.read(a,e);const t=r.showLegend;null!=t&&i.read({showLegend:t},e)}return i}async function x(e,t,r){if(!1===e.supportsData)return{data:void 0};const a=e.instance,n=a.portalItem;if(!n)return{data:void 0};let s=null;try{s=await n.fetchData("json",r)}catch(l){}if(C(a)){let e=null;const{count:r,preferredHost:l}=await G(n,s,t);if(o(n,l),(s?.layers||s?.tables)&&r>0){if(null==a.layerId){const e=p(a.type),t=e?.length?u(s,e)[0]:c(s);t&&(a.layerId=t.id)}e=k(s,a),"OrientedImageryLayer"===e?.layerType&&"oriented-imagery"===a.type&&a.supportedSourceTypes.add("Feature Layer"),e&&null!=s.showLegend&&(e.showLegend=s.showLegend)}return r>1&&"sublayerTitleMode"in a&&"service-name"!==a.sublayerTitleMode&&(a.sublayerTitleMode="item-title-and-service-name"),{data:e,preferredHost:l}}return{data:s}}async function G(e,r,a){if(r?.layers&&r?.tables)return{count:f(r)};const o=t(e.url);if(!o)return{count:1};const l=o.url.path,i=await a.fetchServiceMetadata(l,{customParameters:c(r)?.customParameters}).catch(()=>null);return{count:(r?.layers?.length??i?.layers?.length??0)+(r?.tables?.length??i?.tables?.length??0),preferredHost:s(e)?n():null}}function k(e,t){const{layerId:r}=t,a=e.layers?.find(e=>e.id===r)||e.tables?.find(e=>e.id===r);return a&&D(a,t)?a:null}function C(e){return"stream"!==e.type&&"layerId"in e}function D(e,t){const r="layerType"in e&&e.layerType,{type:a}=t;return!("feature"===a&&r&&"ArcGISFeatureLayer"!==e.layerType||"catalog"===a&&!r||"oriented-imagery"===a&&!r||"subtype-group"===a&&!r)}async function U(e,t){const{layersJSON:a,preferredHost:o}=await r(e,t);if(!a)return{provider:null,preferredHost:o};const n=[...a.layers,...a.tables];return{provider:e=>n.find(t=>t.id===e.id),preferredHost:o}}async function E(e,t){const{layers:r,tables:a}=e,o=[...r??[],...a??[]];if(!o.length)return;const n=new Set,s=[];for(const{layerType:p}of o){const e=p??"ArcGISFeatureLayer";if(n.has(e))continue;n.add(e);const r=t[m(e)];s.push(r())}const l=await Promise.all(s),i=new Map;return Array.from(n).forEach((e,t)=>{i.set(e,l[t])}),({layerType:e})=>{const t=e??"ArcGISFeatureLayer";return i.get(t)}}export{b as load};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../core/JSONSupport.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{reader as r}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as s}from"../../../core/accessorSupport/decorators/writer.js";import c from"../../../geometry/Polyline.js";import a from"./CircuitPath.js";let p=class extends e{constructor(t){super(t),this.circuit=null,this.geometry=null,this.path=null}readCircuit(t,e){const o=e.sections?.map(t=>({...t,path:a.fromJSON(t.path)}));return{name:e.name,globalId:e.globalId,isSectioned:e.isSectioned,sectionOrder:e.sectionOrder,startLocation:e.startLocation,stopLocation:e.stopLocation,sections:o,subcircuits:e.subcircuits,lastVerifiedTime:e.lastVerifiedTime?new Date(e.lastVerifiedTime):null,lastExportedTime:e.lastExportedTime?new Date(e.lastExportedTime):null,circuitType:e.circuitType,status:e.status}}writeCircuit(t,e){const o=t.sections?.map(t=>({...t,path:t.path?.toJSON()}));e.name=t.name,e.globalId=t.globalId,e.isSectioned=t.isSectioned,e.sectionOrder=t.sectionOrder,e.startLocation=t.startLocation,e.stopLocation=t.stopLocation,e.sections=o,e.subcircuits=t.subcircuits,e.lastVerifiedTime=t.lastVerifiedTime?.getTime(),e.lastExportedTime=t.lastExportedTime?.getTime(),e.circuitType=t.circuitType,e.status=t.status}};t([o({type:Object,json:{write:!0,read:{source:["name","globalId","isSectioned","sectionOrder","startLocation","stopLocation","sections","subcircuits","lastVerifiedTime","lastExportedTime","circuitType","status"]}}})],p.prototype,"circuit",void 0),t([r("circuit")],p.prototype,"readCircuit",null),t([s("circuit")],p.prototype,"writeCircuit",null),t([o({type:c,json:{write:!0}})],p.prototype,"geometry",void 0),t([o({type:a,json:{write:!0}})],p.prototype,"path",void 0),p=t([i("esri.rest.networks.support.CircuitTraceResult")],p);const n=p;export{n as default};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const c="20250704",d="d944d02dc9e200f68173a12358cd4dc37f4c3948";export{c as buildDate,d as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Evented.js";import{on as t}from"../../../core/events.js";import{handlesGroup as a}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{deg2rad as s}from"../../../core/mathUtils.js";import{identity as r,scale as n,rotate as i,translate as o}from"../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/mat2df64.js";class c{constructor(s,r={}){this.events=new e,this._hasMajorPerformanceCaveat=!1,this._lastRenderFrameCounter=0,null!=s?(this._canvas=document.createElement("canvas"),this._canvas.setAttribute("style","width: 100%; height:100%; display:block; willChange:transform"),s.contains(this._canvas)||s.appendChild(this._canvas)):null!=r.canvas&&(this._canvas=r.canvas);const n={failIfMajorPerformanceCaveat:!0,alpha:!0,antialias:!1,depth:!0,stencil:!0,powerPreference:"high-performance"};let i=this._canvas.getContext("webgl2",n);i||(i=this._canvas.getContext("webgl2",{...n,failIfMajorPerformanceCaveat:!1}),this._hasMajorPerformanceCaveat=!0),this._gl=i,this._handles=a([t(this._canvas,"webglcontextlost",e=>this.events.emit("webgl-context-lost",e))])}destroy(){this._canvas.remove(),this._canvas=null,this._handles.remove(),this._gl=null}get gl(){return this._gl}get canvas(){return this._canvas}render(e,t){if(this._hasMajorPerformanceCaveat||has("esri-force-performance-mode")){if(++this._lastRenderFrameCounter>=has("esri-performance-mode-frames-between-render")&&(t(),this._lastRenderViewState=e.state.clone(),this._lastRenderFrameCounter=0),this._lastRenderViewState){const[t,a,s,r,n,i]=this._computeViewTransform(this._lastRenderViewState,e.state);this._canvas.style.transform=`matrix(${t}, ${a}, ${s}, ${r}, ${n}, ${i})`}}else t()}resize(e){const t=this._canvas,a=t.style,{state:{size:s},pixelRatio:r}=e,n=s[0],i=s[1],o=Math.round(n*r),h=Math.round(i*r);t.width===o&&t.height===h||(t.width=o,t.height=h),a.width=n+"px",a.height=i+"px"}_computeViewTransform(e,t){const[a,c]=e.center,[l,m]=t.center,[f,
|
|
5
|
+
import e from"../../../core/Evented.js";import{on as t}from"../../../core/events.js";import{handlesGroup as a}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{deg2rad as s}from"../../../core/mathUtils.js";import{identity as r,scale as n,rotate as i,translate as o}from"../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/mat2df64.js";class c{constructor(s,r={}){this.events=new e.EventEmitter,this._hasMajorPerformanceCaveat=!1,this._lastRenderFrameCounter=0,null!=s?(this._canvas=document.createElement("canvas"),this._canvas.setAttribute("style","width: 100%; height:100%; display:block; willChange:transform"),s.contains(this._canvas)||s.appendChild(this._canvas)):null!=r.canvas&&(this._canvas=r.canvas);const n={failIfMajorPerformanceCaveat:!0,alpha:!0,antialias:!1,depth:!0,stencil:!0,powerPreference:"high-performance"};let i=this._canvas.getContext("webgl2",n);i||(i=this._canvas.getContext("webgl2",{...n,failIfMajorPerformanceCaveat:!1}),this._hasMajorPerformanceCaveat=!0),this._gl=i,this._handles=a([t(this._canvas,"webglcontextlost",e=>this.events.emit("webgl-context-lost",e))])}destroy(){this._canvas.remove(),this._canvas=null,this._handles.remove(),this._gl=null}get gl(){return this._gl}get canvas(){return this._canvas}render(e,t){if(this._hasMajorPerformanceCaveat||has("esri-force-performance-mode")){if(++this._lastRenderFrameCounter>=has("esri-performance-mode-frames-between-render")&&(t(),this._lastRenderViewState=e.state.clone(),this._lastRenderFrameCounter=0),this._lastRenderViewState){const[t,a,s,r,n,i]=this._computeViewTransform(this._lastRenderViewState,e.state);this._canvas.style.transform=`matrix(${t}, ${a}, ${s}, ${r}, ${n}, ${i})`}}else t()}resize(e){const t=this._canvas,a=t.style,{state:{size:s},pixelRatio:r}=e,n=s[0],i=s[1],o=Math.round(n*r),h=Math.round(i*r);t.width===o&&t.height===h||(t.width=o,t.height=h),a.width=n+"px",a.height=i+"px"}_computeViewTransform(e,t){const[a,c]=e.center,[l,m]=t.center,[f,v]=e.toScreen([0,0],l,m),[_,d]=e.toScreen([0,0],a,c),p=_-f,g=d-v,u=e.scale/t.scale,w=t.rotation-e.rotation,j=h();return r(j),n(j,j,[u,u]),i(j,j,s(w)),o(j,j,[p,g]),j}}export{c as ManagedCanvas};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as e}from"../../../../geometry/support/aaBoundingRect.js";import{getWorldWidth as i}from"../../viewpointUtils.js";import{RasterTile as t}from"./RasterTile.js";import s from"../webgl/TileContainer.js";import{RasterColorizerTechnique as o}from"../webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js";import{RasterProcessorTechnique as
|
|
5
|
+
import{create as e}from"../../../../geometry/support/aaBoundingRect.js";import{getWorldWidth as i}from"../../viewpointUtils.js";import{RasterTile as t}from"./RasterTile.js";import s from"../webgl/TileContainer.js";import{RasterColorizerTechnique as o}from"../webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js";import{RasterProcessorTechnique as n}from"../webgl/shaderGraph/techniques/raster/RasterProcessorTechnique.js";class r extends s{constructor(){super(...arguments),this.isCustomTilingScheme=!1}get pixelHighlightOptions(){return this._pixelHighlightOptions}set pixelHighlightOptions(e){this._pixelHighlightOptions=e,this.requestRender()}createTile(e){const i=this._getTileBounds(e),[s,o]=this.tileInfoView.tileInfo.size,n=this.tileInfoView.getTileResolution(e.level);return new t(e,n,i[0],i[3],s,o)}onAttach(){super.onAttach(),this._colorizerTechnique=new o,this._processorTechnique=new n}onDetach(){super.onDetach(),this._colorizerTechnique?.shutdown(),this._colorizerTechnique=void 0,this._processorTechnique?.shutdown(),this._processorTechnique=void 0}doRender(e){if(!this.visible||1!==e.drawPhase||!this._colorizerTechnique)return;const{rasterFunctionChain:i}=this;if(i?.functions?.length){if(!this._processorTechnique)return;const{functions:t,hasBranches:s}=i;for(const i of t){if("Constant"===i.name||"Identity"===i.name)continue;e.rasterFunction=i,e.hasBranches=s,super.doRender(e);const t=this.children.map(e=>e.bitmap);this._processorTechnique.render(e,{bitmaps:t})}}e.rasterFunction=null,e.pixelHighlightOptions=this.pixelHighlightOptions,super.doRender(e);const t=this.children.map(e=>e.bitmap);this._colorizerTechnique.render(e,{bitmaps:t})}_getTileBounds(t){const s=this.tileInfoView.getTileBounds(e(),t);if(this.isCustomTilingScheme&&t.world){const{tileInfo:e}=this.tileInfoView,o=i(e.spatialReference);if(o){const i=e.lodAt(t.level);if(!i)return s;const{resolution:n}=i,r=n*e.size[0];s[0]=o*t.world+e.origin.x+t.col*r,s[2]=s[0]+r}}return s}}export{r as RasterTileContainer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/CircularArray.js";import t from"../../../../core/Evented.js";import has from"../../../../core/has.js";import{createDisjointTimerQuery as s}from"../../../webgl/capabilities/DisjointTimerQuery.js";const r=!!has("esri-2d-profiler");class n{constructor(n,i){if(this._events=new t,this._entries=new Map,this._timings=new e(10),this._currentContainer=null,this._currentPass=null,this._currentBrush=null,this._currentSummary=null,!r)return;this._ext=s(n.gl,{}),this._debugOutput=i;const o=n.gl;if(!this.enableCommandLogging)return;let a;for(a in o)if("function"==typeof o[a]){const e=o[a],t=a.includes("draw");o[a]=(...s)=>(this._events.emit("command",{container:this._currentContainer,pass:this._currentPass,brush:this._currentBrush,method:a,args:s,isDrawCommand:t}),this._currentSummary&&(this._currentSummary.commands++,t&&this._currentSummary.drawCommands++),e.apply(o,s))}}get enableCommandLogging(){return!("object"==typeof r&&r.disableCommands)}recordContainerStart(e){r&&(this._currentContainer=e)}recordContainerEnd(){r&&(this._currentContainer=null)}recordPassStart(e){r&&(this._currentPass=e,this._initSummary())}recordPassEnd(){r&&(this._currentPass=null,this._emitSummary())}recordBrushStart(e){r&&(this._currentBrush=e)}recordBrushEnd(){r&&(this._currentBrush=null)}recordStart(e){if(r&&null!=this._ext){if(this._entries.has(e)){const t=this._entries.get(e),s=this._ext.resultAvailable(t.query),r=this._ext.disjoint();if(s&&!r){const s=this._ext.getResult(t.query)/1e6;let r=0;if(null!=this._timings.enqueue(s)){const e=this._timings.entries,t=e.length;let s=0;for(const r of e)s+=r;r=s/t}const n=s.toFixed(2),i=r?r.toFixed(2):"--";this.enableCommandLogging?(console.groupCollapsed(`Frame report for ${e}, ${n} ms (${i} last 10 avg)\n${t.commandsLen} Commands (${t.drawCommands} draw)`),console.log("RenderPass breakdown: "),console.table(t.summaries),console.log("Commands: ",t.commands),console.groupEnd()):console.log(`Frame report for ${e}, ${n} ms (${i} last 10 avg)`),this._debugOutput.innerHTML=`${n} (${i})`}for(const e of t.handles)e.remove();this._ext.deleteQuery(t.query),this._entries.delete(e)}const t={name:e,query:this._ext.createQuery(),commands:[],commandsLen:0,drawCommands:0,summaries:[],handles:[]};this.enableCommandLogging&&(t.handles.push(this._events.on("command",e=>{t.commandsLen++,t.commands.push(e),e.isDrawCommand&&t.drawCommands++})),t.handles.push(this._events.on("summary",e=>{t.summaries.push(e)}))),this._ext.beginTimeElapsed(t.query),this._entries.set(e,t)}}recordEnd(e){r&&null!=this._ext&&this._entries.has(e)&&this._ext.endTimeElapsed()}_initSummary(){this.enableCommandLogging&&(this._currentSummary={container:this._currentContainer,pass:this._currentPass,drawCommands:0,commands:0})}_emitSummary(){this.enableCommandLogging&&this._currentSummary&&this._events.emit("summary",this._currentSummary)}}export{n as Profiler};
|
|
5
|
+
import e from"../../../../core/CircularArray.js";import t from"../../../../core/Evented.js";import has from"../../../../core/has.js";import{createDisjointTimerQuery as s}from"../../../webgl/capabilities/DisjointTimerQuery.js";const r=!!has("esri-2d-profiler");class n{constructor(n,i){if(this._events=new t.EventEmitter,this._entries=new Map,this._timings=new e(10),this._currentContainer=null,this._currentPass=null,this._currentBrush=null,this._currentSummary=null,!r)return;this._ext=s(n.gl,{}),this._debugOutput=i;const o=n.gl;if(!this.enableCommandLogging)return;let a;for(a in o)if("function"==typeof o[a]){const e=o[a],t=a.includes("draw");o[a]=(...s)=>(this._events.emit("command",{container:this._currentContainer,pass:this._currentPass,brush:this._currentBrush,method:a,args:s,isDrawCommand:t}),this._currentSummary&&(this._currentSummary.commands++,t&&this._currentSummary.drawCommands++),e.apply(o,s))}}get enableCommandLogging(){return!("object"==typeof r&&r.disableCommands)}recordContainerStart(e){r&&(this._currentContainer=e)}recordContainerEnd(){r&&(this._currentContainer=null)}recordPassStart(e){r&&(this._currentPass=e,this._initSummary())}recordPassEnd(){r&&(this._currentPass=null,this._emitSummary())}recordBrushStart(e){r&&(this._currentBrush=e)}recordBrushEnd(){r&&(this._currentBrush=null)}recordStart(e){if(r&&null!=this._ext){if(this._entries.has(e)){const t=this._entries.get(e),s=this._ext.resultAvailable(t.query),r=this._ext.disjoint();if(s&&!r){const s=this._ext.getResult(t.query)/1e6;let r=0;if(null!=this._timings.enqueue(s)){const e=this._timings.entries,t=e.length;let s=0;for(const r of e)s+=r;r=s/t}const n=s.toFixed(2),i=r?r.toFixed(2):"--";this.enableCommandLogging?(console.groupCollapsed(`Frame report for ${e}, ${n} ms (${i} last 10 avg)\n${t.commandsLen} Commands (${t.drawCommands} draw)`),console.log("RenderPass breakdown: "),console.table(t.summaries),console.log("Commands: ",t.commands),console.groupEnd()):console.log(`Frame report for ${e}, ${n} ms (${i} last 10 avg)`),this._debugOutput.innerHTML=`${n} (${i})`}for(const e of t.handles)e.remove();this._ext.deleteQuery(t.query),this._entries.delete(e)}const t={name:e,query:this._ext.createQuery(),commands:[],commandsLen:0,drawCommands:0,summaries:[],handles:[]};this.enableCommandLogging&&(t.handles.push(this._events.on("command",e=>{t.commandsLen++,t.commands.push(e),e.isDrawCommand&&t.drawCommands++})),t.handles.push(this._events.on("summary",e=>{t.summaries.push(e)}))),this._ext.beginTimeElapsed(t.query),this._entries.set(e,t)}}recordEnd(e){r&&null!=this._ext&&this._entries.has(e)&&this._ext.endTimeElapsed()}_initSummary(){this.enableCommandLogging&&(this._currentSummary={container:this._currentContainer,pass:this._currentPass,drawCommands:0,commands:0})}_emitSummary(){this.enableCommandLogging&&this._currentSummary&&this._events.emit("summary",this._currentSummary)}}export{n as Profiler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{Technique as e}from"../Technique.js";import{RasterColorizerLUTShader as
|
|
5
|
+
import{Technique as e}from"../Technique.js";import{RasterColorizerLUTShader as i}from"../shaders/raster/RasterColorizerLUTShader.js";import{RasterColorizerShadedReliefShader as t}from"../shaders/raster/RasterColorizerShadedReliefShader.js";import{RasterColorizerStretchShader as o}from"../shaders/raster/RasterColorizerStretchShader.js";class r extends e{constructor(){super(...arguments),this.name="BrushRasterColorizer",this.type=0,this.shaders={lut:new i,stretch:new o,shadedRelief:new t}}render(e,i){for(const t of i.bitmaps){if(!t.source||t.suspended)continue;e.timeline.begin(this.name);const{painter:i}=e;i.setPipelineState({depth:!1,stencil:{test:{mask:255,ref:t.stencilRef,compare:514,op:{fail:7680,zFail:7680,zPass:7680}},write:!1},color:{write:[!0,!0,!0,!0],blendMode:"composite"}}),t.updateTexture(e),t.processedTexture||t.updateProcessedTexture();const{type:o}=t.symbolizerParameters,r="stretch"===o?this._getStretchOptions(t):"lut"===o?this._getLutOptions(t):this._getShadedReliefOptions(t);"bilinear"!==t.interpolation||e.context.capabilities.textureFloatLinear||(r.defines.bilinear=!0);const{pixelHighlightOptions:n}=e;if(n&&!t.isRendereredSource){const e=t.bandIds?.length?t.bandIds.indexOf(n.bandId):0;if(e>=0&&e<=2){r.defines.applyPixelHighlights=!0;const i=new Float32Array(9);i[3*e]=1,r.uniforms.highlightConfig={...n,bandSwap:i}}}i.submitDrawMesh(e.context,r,i.quadMesh),e.timeline.end(this.name)}}_getLutOptions(e){const{config:i,projectionConfig:t,colormapConfig:o,pixelMaskConfig:r,projectionDefines:n}=this._getCommonConfig(e),s=this._getInterpolationDefines("nearest",!1);return{shader:this.shaders.lut,uniforms:{projectionConfig:t,config:i,colormapConfig:o,pixelMaskConfig:r},defines:{...n,...s,applyPixelMask:!!r,applyPixelHighlights:!1},optionalAttributes:null,useComputeBuffer:!1}}_getStretchOptions(e){const i=e.symbolizerParameters,{config:t,projectionConfig:o,colormapConfig:r,pixelMaskConfig:n,projectionDefines:s}=this._getCommonConfig(e),a=this._getInterpolationDefines(e.interpolation,1===i.bandCount);return{shader:this.shaders.stretch,uniforms:{projectionConfig:o,config:t,stretchConfig:i,colormapConfig:r,pixelMaskConfig:n},defines:{...s,...a,isMultiband:i.bandCount>1,applyColormap:!!r,useGamma:i.useGamma,noOp:e.isRendereredSource&&!e.processed,applyPixelMask:!!n,applyPixelHighlights:!1},optionalAttributes:null,useComputeBuffer:!1}}_getShadedReliefOptions(e){const i=e.symbolizerParameters,{config:t,projectionConfig:o,colormapConfig:r,pixelMaskConfig:n,projectionDefines:s}=this._getCommonConfig(e),a=this._getInterpolationDefines(e.interpolation,!0);return{shader:this.shaders.shadedRelief,uniforms:{projectionConfig:o,config:t,hillshadeConfig:i,colormapConfig:r,pixelMaskConfig:n},defines:{...s,...a,isMultidirectional:i.hillshadeType>0,applyColormap:!!r,applyPixelMask:!!n,applyPixelHighlights:!1},optionalAttributes:null,useComputeBuffer:!1}}_getCommonConfig(e){const{coordScale:i,computedOpacity:t,transforms:o}=e,{names:r,textures:n}=e.getTextures({useProcessedTexture:e.processed}),s=n[r.indexOf("u_image")],a=e.getRasterTextureSize(),l={texture:{texture:s,unit:0},dvsMat3:o.displayViewScreenMat3,coordScale:i,srcImageSize:a,opacity:t},p=n[r.indexOf("u_transformGrid")],{transformGrid:f}=e,c=!(!p||!f),d=c?{transformTexture:{texture:p,unit:2},targetImageSize:[e.width,e.height],transformSpacing:f.spacing,transformGridSize:f.size}:void 0,u=n[r.indexOf("u_colormap")],{colormap:g,colormapOffset:m}=e.symbolizerParameters,h=u&&g?{colormapTexture:{texture:u,unit:1},colormapOffset:m??0,colormapMaxIndex:g.length/4-1}:void 0,C=n[r.indexOf("u_mask")];return{config:l,projectionConfig:d,colormapConfig:h,pixelMaskConfig:C?{maskTexture:{texture:C,unit:3}}:void 0,projectionDefines:{applyProjection:c,lookupProjection:c&&1===f.spacing[0]}}}_getInterpolationDefines(e,i){const t="bilinear"===e&&i;return{bilinear:t,bicubic:"cubic"===e,nearestOnEdge:t}}}export{r as RasterColorizerTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{BaseRasterProcessorTechnique as e}from"./BaseRasterProcessorTechnique.js";import{ReprojectShader as t}from"../../shaders/raster/processor/ReprojectShader.js";class r extends e{constructor(){super(...arguments),this.name="RasterReprojectProcessor",this.type=17,this.shaders={reproject:new t}}_process(e,t){const r=e.rasterFunction.parameters,o=this._getInterpolationDefines(t.interpolation,!!r.requireNNEdge),{config:i,projectionConfig:n,projectionDefines:s}=this._getReprojectConfig(t),a={shader:this.shaders.reproject,uniforms:{config:i,projectionConfig:n},defines:{...s,...o,applyPixelMask:!1},optionalAttributes:null,useComputeBuffer:!1},{interpolation:c}=t;t.interpolation="nearest";const{painter:p,context:u}=e;p.submitDrawMesh(u,a,p.quadMesh),t.interpolation=c,t.projected=!0}_getReprojectConfig(e){const{source:t}=e,{names:r,textures:o}=e.getTextures({forProcessing:!0}),i={texture:{texture:o[r.indexOf("u_image")],unit:0},dvsMat3:new Float32Array([2,0,0,0,2,0,-1,-1,0]),coordScale:[1,1],srcImageSize:[t.width,t.height],opacity:1},n=o[r.indexOf("u_transformGrid")],{transformGrid:s}=e,a=!(!n||!s);return{config:i,projectionConfig:a?{transformTexture:{texture:n,unit:1},targetImageSize:[e.width,e.height],transformSpacing:s.spacing,transformGridSize:s.size}:void 0,projectionDefines:{applyProjection:a,lookupProjection:a&&1===s.spacing[0]}}}_getInterpolationDefines(e,t){const r="bilinear"===e&&t;return{bilinear:r,bicubic:"cubic"===e,nearestOnEdge:r}}}export{r as ReprojectTechnique};
|
|
5
|
+
import{BaseRasterProcessorTechnique as e}from"./BaseRasterProcessorTechnique.js";import{ReprojectShader as t}from"../../shaders/raster/processor/ReprojectShader.js";class r extends e{constructor(){super(...arguments),this.name="RasterReprojectProcessor",this.type=17,this.shaders={reproject:new t}}_process(e,t){const r=e.rasterFunction.parameters,o=this._getInterpolationDefines(t.interpolation,!!r.requireNNEdge),{config:i,projectionConfig:n,projectionDefines:s}=this._getReprojectConfig(t),a={shader:this.shaders.reproject,uniforms:{config:i,projectionConfig:n},defines:{...s,...o,applyPixelMask:!1,applyPixelHighlights:!1},optionalAttributes:null,useComputeBuffer:!1},{interpolation:c}=t;t.interpolation="nearest";const{painter:p,context:u}=e;p.submitDrawMesh(u,a,p.quadMesh),t.interpolation=c,t.projected=!0}_getReprojectConfig(e){const{source:t}=e,{names:r,textures:o}=e.getTextures({forProcessing:!0}),i={texture:{texture:o[r.indexOf("u_image")],unit:0},dvsMat3:new Float32Array([2,0,0,0,2,0,-1,-1,0]),coordScale:[1,1],srcImageSize:[t.width,t.height],opacity:1},n=o[r.indexOf("u_transformGrid")],{transformGrid:s}=e,a=!(!n||!s);return{config:i,projectionConfig:a?{transformTexture:{texture:n,unit:1},targetImageSize:[e.width,e.height],transformSpacing:s.spacing,transformGridSize:s.size}:void 0,projectionDefines:{applyProjection:a,lookupProjection:a&&1===s.spacing[0]}}}_getInterpolationDefines(e,t){const r="bilinear"===e&&t;return{bilinear:r,bicubic:"cubic"===e,nearestOnEdge:r}}}export{r as ReprojectTechnique};
|
package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as o,__param as t}from"tslib";import{GraphShaderModule as e,FragmentOutput as
|
|
5
|
+
import{__decorate as o,__param as t}from"tslib";import{maxMapSizeGpu as i}from"../../../../../../../../layers/support/rasterFunctions/pixelUtils.js";import{GraphShaderModule as e,FragmentOutput as p,location as r,uniform as s,define as l,option as n,input as a,VertexInput as c,UniformGroup as g,FragmentInput as h}from"../../../GraphShaderModule.js";import{Vec3 as y,Vec4 as d,ifElse as u,texture2D as v,sign as x,mix as m,Vec2 as f,Sampler2D as P,Mat3 as b,Float as j,FixedArray as k}from"../../../graph/glsl.js";import{getPixelLocation as M,isOutside as w,getPixel as C,ProjectionConfig as _}from"./projection.js";import{computeSingleBandRangeFactor as S}from"./processor/math.js";class E extends c{}o([r(0,f)],E.prototype,"position",void 0);class O extends h{}class H extends g{}o([s(P)],H.prototype,"texture",void 0),o([s(b)],H.prototype,"dvsMat3",void 0),o([s(f)],H.prototype,"coordScale",void 0),o([s(f)],H.prototype,"srcImageSize",void 0),o([s(j)],H.prototype,"opacity",void 0);class T extends g{}o([s(P)],T.prototype,"maskTexture",void 0);class z extends g{}o([s(k.ofType(j,2*i))],z.prototype,"ranges",void 0),o([s(b)],z.prototype,"bandSwap",void 0),o([s(d)],z.prototype,"color",void 0);class F extends e{constructor(){super(...arguments),this.applyProjection=!0,this.lookupProjection=!1,this.bilinear=!1,this.bicubic=!1,this.nearestOnEdge=!1,this.applyPixelMask=!1,this.applyPixelHighlights=!1}vertex(o){const t=o.position,{dvsMat3:i,coordScale:e}=this.config,p=i.multiply(new y(t.multiply(e),1));return{uv:t,glPosition:new d(p,1)}}fragment(o){const t=new p,i=M(o.uv,this.applyProjection?this.projectionConfig:void 0,this.lookupProjection);let e=this._colorize(i);this.applyPixelHighlights&&(e=this._highlightPixels(i,e));const r=u(w(i),new d(0),e);let s=r.a.multiply(this.config.opacity);if(this.applyPixelMask){const t=this._getPixelMask(o.uv);s=s.multiply(t)}return t.fragColor=new d(r.rgb,1).multiply(s),t}_getPixel(o){const{config:t,bicubic:i,bilinear:e,nearestOnEdge:p}=this;return C(o,t,{bicubic:i,bilinear:e,nearestOnEdge:p})}_getPixelMask(o){const{maskTexture:t}=this.pixelMaskConfig,i=v(t,o);return x(i.a)}_highlightPixels(o,t){const i=this._getPixel(o),{ranges:e,color:p,bandSwap:r}=this.highlightConfig,s=r.multiply(i.rgb).x,l=S(s,e).multiply(i.a);return m(t,p,l)}}o([l],F.prototype,"applyProjection",void 0),o([l],F.prototype,"lookupProjection",void 0),o([l],F.prototype,"bilinear",void 0),o([l],F.prototype,"bicubic",void 0),o([l],F.prototype,"nearestOnEdge",void 0),o([l],F.prototype,"applyPixelMask",void 0),o([l],F.prototype,"applyPixelHighlights",void 0),o([s(H)],F.prototype,"config",void 0),o([n(_)],F.prototype,"projectionConfig",void 0),o([n(T)],F.prototype,"pixelMaskConfig",void 0),o([n(z)],F.prototype,"highlightConfig",void 0),o([t(0,a(E))],F.prototype,"vertex",null),o([t(0,a(O))],F.prototype,"fragment",null);export{F as BaseRasterColorizerShader,z as HighlightConfig,T as PixelMaskConfig,O as RasterColorizerFragmentInput,H as RasterConfig};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{maxMapSizeGpu as n}from"../../../../../../../../../layers/support/rasterFunctions/pixelUtils.js";import{Vec3 as t,step as e,sign as r,dot as l,Vec4 as o,floor as u,abs as i,Float as s,mix as c}from"../../../../graph/glsl.js";function w(n){const t=r(n),e=n.add(i(t).subtract(1));return t.multiply(t).divide(e)}function a(n){return new o(u(n.rgb.add(.5)),n.a)}function p(n,t){return e(t.x,n).multiply(e(n,t.y))}function d(o,u){let i=new t(0,0,0);const s=new t(o);for(let r=0;r<n/3;r++){const n=6*r,l=new t(u[n],u[n+2],u[n+4]),o=new t(u[n+1],u[n+3],u[n+5]);i=i.add(e(l,s).multiply(e(s,o)))}return r(l(i,new t(1,1,1)))}function f(n,o,u){const i=new t(n);let w=new t(0,0,0),a=new s(0);for(let r=0;r<u/3;r++){const n=9*r,l=new t(o[n],o[n+3],o[n+6]),u=new t(o[n+1],o[n+4],o[n+7]),s=e(l,i).multiply(e(i,u)),p=new t(o[n+2],o[n+5],o[n+8]);a=c(a,p.x,s.x),a=c(a,p.y,s.y),a=c(a,p.z,s.z),w=w.add(s)}return{mapValue:a,includeMask:r(l(w,new t(1,1,1)))}}export{f as computeMapValue,d as computeSingleBandRangeFactor,p as getRangeClipFactor,w as invertValue,a as roundOutput};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import
|
|
5
|
+
import{__decorate as e}from"tslib";import{makeHandle as i}from"../../../core/handleUtils.js";import t from"../../../core/Logger.js";import{isAbortError as s}from"../../../core/promiseUtils.js";import{watch as r,sync as o,initial as h}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{hasExcludedVariableOrDimension as l}from"../../../layers/support/rasterDatasets/multidimensionalUtils.js";import u from"../engine/flow/FlowView2D.js";import{LayerView2DMixin as g}from"./LayerView2D.js";import p from"./imagery/ImageryTileView2D.js";import d from"./imagery/VectorFieldTileView2D.js";import{canUseMajorityInterpolationOnDataSource as c}from"./support/util.js";import m from"../../layers/ImageryTileLayerView.js";import v from"../../layers/LayerView.js";import w from"../../layers/RefreshableLayerView.js";import{defaultHighlightName as b}from"../../support/HighlightDefaults.js";let y=class extends(m(w(g(v)))){constructor(){super(...arguments),this._useWebGLForProcessing=!0,this._useProgressiveUpdate=!0,this._pixelHighlightId=-1,this.subview=null}get useWebGLForProcessing(){return this._useWebGLForProcessing}set useWebGLForProcessing(e){this._useWebGLForProcessing=e,this.subview&&"useWebGLForProcessing"in this.subview&&(this.subview.useWebGLForProcessing=e)}get useProgressiveUpdate(){return this._useWebGLForProcessing}set useProgressiveUpdate(e){this._useProgressiveUpdate=e,this.subview&&"useProgressiveUpdate"in this.subview&&(this.subview.useProgressiveUpdate=e)}get displayParameters(){const{layer:e}=this,i=this._get("displayParameters");return e.renderer&&e.visible?{bandIds:e.bandIds,renderer:e.renderer,interpolation:e.interpolation,multidimensionalDefinition:e.multidimensionalDefinition,rasterFunction:"imagery-tile"===e.type?e.rasterFunction:null}:i}update(e){this.subview?.update(e),this.notifyChange("updating")}isUpdating(){return!this.subview||this.subview.updating}attach(){this.layer.increaseRasterJobHandlerUsage(),this._updateSubview(),this.addAttachHandles([r(()=>this.displayParameters,(e,i)=>{const r=e.interpolation!==i?.interpolation&&("majority"===e.interpolation||"majority"===i?.interpolation)&&c(this.layer),o=!!this.layer.serviceRasterInfo?.storageInfo?.isBsqTile&&e.bandIds?.join()!==i?.bandIds?.join(),h=e.renderer!==i?.renderer&&this._getSubviewType(i?.renderer)!==this._getSubviewType(e.renderer);h&&this._updateSubview();const a=e.multidimensionalDefinition!==i?.multidimensionalDefinition,n=e.rasterFunction!==i?.rasterFunction,l=n&&!this._useWebGLForProcessing,u=a||r||h||l||o;this.subview.redrawOrRefetch({refetch:u,reprocess:n}).catch(e=>{s(e)||t.getLogger(this).error(e)}),this.notifyChange("updating")}),r(()=>this.layer.multidimensionalSubset??null,(e,i)=>{const{multidimensionalDefinition:r}=this.layer;null!=r&&l(r,e)!==l(r,i)&&(this.subview.redrawOrRefetch({refetch:!0}).catch(e=>{s(e)||t.getLogger(this).error(e)}),this.notifyChange("updating"))},o),r(()=>this.timeExtent,()=>{this.subview.timeExtent=this.timeExtent,this.subview.redrawOrRefetch({refetch:!0}).catch(e=>{s(e)||t.getLogger(this).error(e)})},h),r(()=>this.view.highlights.items.map(({name:e,color:i})=>({name:e,color:i})),()=>{if("raster"===this.subview?.type&&this._pixelHighlightTarget){const e=this._getHighlightGroupColor();this.subview.updateHighlightOptions(this._pixelHighlightTarget,e)}},h)])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null}viewChange(){this.requestUpdate()}moveEnd(){this.subview.moveEnd()}highlight(e,t){if(!e.ranges?.length)return i();this._pixelHighlightTarget=e,this._pixelHighlightOptions=t;const{subview:s}=this;if("raster"===s?.type){const i=this._getHighlightGroupColor();s.updateHighlightOptions(e,i)}this._pixelHighlightId++;const r=this._pixelHighlightId;return i(()=>{r===this._pixelHighlightId&&(this._pixelHighlightTarget=void 0,"raster"===this.subview?.type&&this.subview.updateHighlightOptions(null))})}doRefresh(){return this.subview?this.subview.doRefresh():Promise.resolve()}_updateSubview(){const{renderer:e}=this.layer;if(!e)return;const i=this._getSubviewType(e);if(this.subview){if(this.subview.type===i)return void this._attachSubview(this.subview);this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null}const{layer:t}=this;let s;if(s="rasterVF"===i?new d({layer:t,layerView:this,scheduler:this.scheduler}):"flow"===i?new u({layer:t,layerView:this,scheduler:this.scheduler}):new p({layer:t,layerView:this,scheduler:this.scheduler}),"useWebGLForProcessing"in s&&(s.useWebGLForProcessing=this._useWebGLForProcessing),"useProgressiveUpdate"in s&&(s.useProgressiveUpdate=this._useProgressiveUpdate),"previousLOD"in s){const{subview:e}=this;s.previousLOD=e&&"previousLOD"in e?e.previousLOD:null}if(this._attachSubview(s),"raster"===s.type&&this._pixelHighlightTarget){const e=this._getHighlightGroupColor();s.updateHighlightOptions(this._pixelHighlightTarget,e)}this.subview=s,this.requestUpdate()}_getHighlightGroupColor(){const e=this._pixelHighlightOptions?.name??b;return this.view.highlights.find(i=>i.name===e)?.color}_attachSubview(e){e&&!e.attached&&(e.attach(),e.attached=!0,this.container.addChildAt(e.container,0))}_detachSubview(e){e?.attached&&(this.container.removeChild(e.container),e.detach(),e.attached=!1)}_getSubviewType(e){const i=e?.type;return"vector-field"===i?"rasterVF":"flow"===i?"flow":"raster"}};e([a()],y.prototype,"subview",void 0),e([a()],y.prototype,"useWebGLForProcessing",null),e([a()],y.prototype,"useProgressiveUpdate",null),e([a({readOnly:!0})],y.prototype,"displayParameters",null),y=e([n("esri.views.2d.layers.ImageryTileLayerView2D")],y);const f=y;export{f as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import s from"../../../../core/CircularArray.js";import r from"../../../../core/Evented.js";import o from"../../../../core/ReactiveMap.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";const n=10;let l=class extends e{constructor(){super(...arguments),this.events=new r,this._updatingStrategy=!0,this._tileToEvent=new o,this._fetchStatus={outstanding:0,done:0}}get hasAllData(){return!this._updatingStrategy&&this._hasAllTileData()}get willQueryAllFeatures(){return this._strategyInfo?.willQueryAllFeatures??!1}get willQueryFullResolutionGeometry(){return this._strategyInfo?.willQueryAllFeatures??!1}onEvent(t){switch(t.type){case"subscribe":case"unsubscribe":case"loaded":case"error":this._handleTileEvent(t);break;case"updateStrategyStart":this._updatingStrategy=!0,this._fetchStatus={done:0,outstanding:0},this._strategyInfo=t.about;break;case"updateStrategyEnd":this._updatingStrategy=!1;break;case"updateFieldsStart":this._fetchStatus={done:0,outstanding:0};break;case"updateFieldsEnd":break;case"updateFieldsError":this.events.emit("error",t);break;case"fetchStart":this._fetchStatus.outstanding+=1,this.events.emit("status",this._fetchStatus);break;case"fetchEnd":this._fetchStatus.done+=1,this.events.emit("status",this._fetchStatus),t.done&&(this._fetchStatus={done:0,outstanding:0})}}_hasAllTileData(){for(const t of this._tileToEvent.values()){const e=t.peekLast();if("loaded"!==e?.type)return!1}return!0}_handleTileEvent(t){switch(t.type){case"subscribe":{const e=new s(n);e.enqueue(t),this._tileToEvent.set(t.tile,e);break}case"unsubscribe":this._tileToEvent.delete(t.tile);break;case"loaded":{const e=this._tileToEvent.get(t.tile);if(!e)return;e.enqueue(t),this._tileToEvent.set(t.tile,e);break}case"error":{const e=this._tileToEvent.get(t.tile);if(!e)return;e.enqueue(t),this._tileToEvent.set(t.tile,e),this.events.emit("error",t);break}}}};t([a({readOnly:!0})],l.prototype,"hasAllData",null),t([a()],l.prototype,"willQueryAllFeatures",null),t([a()],l.prototype,"willQueryFullResolutionGeometry",null),t([a()],l.prototype,"_updatingStrategy",void 0),t([a()],l.prototype,"_strategyInfo",void 0),t([a()],l.prototype,"_tileToEvent",void 0),l=t([i("esri.views.2d.layers.features.FeatureSourceEventLog")],l);export{l as FeatureSourceEventLog};
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import s from"../../../../core/CircularArray.js";import r from"../../../../core/Evented.js";import o from"../../../../core/ReactiveMap.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";const n=10;let l=class extends e{constructor(){super(...arguments),this.events=new r.EventEmitter,this._updatingStrategy=!0,this._tileToEvent=new o,this._fetchStatus={outstanding:0,done:0}}get hasAllData(){return!this._updatingStrategy&&this._hasAllTileData()}get willQueryAllFeatures(){return this._strategyInfo?.willQueryAllFeatures??!1}get willQueryFullResolutionGeometry(){return this._strategyInfo?.willQueryAllFeatures??!1}onEvent(t){switch(t.type){case"subscribe":case"unsubscribe":case"loaded":case"error":this._handleTileEvent(t);break;case"updateStrategyStart":this._updatingStrategy=!0,this._fetchStatus={done:0,outstanding:0},this._strategyInfo=t.about;break;case"updateStrategyEnd":this._updatingStrategy=!1;break;case"updateFieldsStart":this._fetchStatus={done:0,outstanding:0};break;case"updateFieldsEnd":break;case"updateFieldsError":this.events.emit("error",t);break;case"fetchStart":this._fetchStatus.outstanding+=1,this.events.emit("status",this._fetchStatus);break;case"fetchEnd":this._fetchStatus.done+=1,this.events.emit("status",this._fetchStatus),t.done&&(this._fetchStatus={done:0,outstanding:0})}}_hasAllTileData(){for(const t of this._tileToEvent.values()){const e=t.peekLast();if("loaded"!==e?.type)return!1}return!0}_handleTileEvent(t){switch(t.type){case"subscribe":{const e=new s(n);e.enqueue(t),this._tileToEvent.set(t.tile,e);break}case"unsubscribe":this._tileToEvent.delete(t.tile);break;case"loaded":{const e=this._tileToEvent.get(t.tile);if(!e)return;e.enqueue(t),this._tileToEvent.set(t.tile,e);break}case"error":{const e=this._tileToEvent.get(t.tile);if(!e)return;e.enqueue(t),this._tileToEvent.set(t.tile,e),this.events.emit("error",t);break}}}};t([a({readOnly:!0})],l.prototype,"hasAllData",null),t([a()],l.prototype,"willQueryAllFeatures",null),t([a()],l.prototype,"willQueryFullResolutionGeometry",null),t([a()],l.prototype,"_updatingStrategy",void 0),t([a()],l.prototype,"_strategyInfo",void 0),t([a()],l.prototype,"_tileToEvent",void 0),l=t([i("esri.views.2d.layers.features.FeatureSourceEventLog")],l);export{l as FeatureSourceEventLog};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../core/Evented.js";import{create as r}from"../../../../../geometry/support/aaBoundingBox.js";import{getBoundsOptimizedGeometry as t}from"../../../../../layers/graphics/featureConversionUtils.js";import{optimizedFeatureQueryEngineAdapter as a}from"../../../../../layers/graphics/data/optimizedFeatureQueryEngineAdapter.js";import{QueryEngine as s}from"../../../../../layers/graphics/data/QueryEngine.js";import{collectExpressionDependencies as
|
|
5
|
+
import e from"../../../../../core/Evented.js";import{create as r}from"../../../../../geometry/support/aaBoundingBox.js";import{getBoundsOptimizedGeometry as t}from"../../../../../layers/graphics/featureConversionUtils.js";import{optimizedFeatureQueryEngineAdapter as a}from"../../../../../layers/graphics/data/optimizedFeatureQueryEngineAdapter.js";import{QueryEngine as s}from"../../../../../layers/graphics/data/QueryEngine.js";import{collectExpressionDependencies as n}from"../../../../../support/ArcadeExpression.js";import{AProcessorStrategy as o}from"./AProcessorStrategy.js";class i extends o{constructor(r,t,s,o,i){super(r,t,i),this.spatialReference=s,this.aggregateFields=o,this._arcadeDependencies=new Set,this.events=new e.EventEmitter,this.featureAdapter=a;for(const e of o)n(this._arcadeDependencies,e.computed)}get aggregateQueryEngine(){return this._aggregateQueryEngine||(this._aggregateQueryEngine=new s({featureStore:this,fieldsIndex:this._metadata.fieldsIndex,geometryType:this._metadata.geometryType,featureIdInfo:this._metadata.featureIdInfo,spatialReference:this.spatialReference})),this._aggregateQueryEngine}get isAggregate(){return!0}removeChunks(e){}hasArcadeDependency(e){return this._arcadeDependencies.has(e)}forEach(e){return this.forEachAggregateWorldSpace(e)}forEachInBounds(e,r){}forEachBounds(e,a){const s=r();for(const r of e){const e=t(s,r.geometry,!1,!1);e&&a(e)}}}export{i as AAggregateStrategy};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../../core/Evented.js";import{handlesGroup as t}from"../../../../../../core/handleUtils.js";import"../../../../../../core/has.js";import{destroyMaybe as s}from"../../../../../../core/maybe.js";import{StreamFeatureManager as n}from"../../../../../../layers/graphics/data/StreamFeatureManager.js";import{createConnection as
|
|
5
|
+
import e from"../../../../../../core/Evented.js";import{handlesGroup as t}from"../../../../../../core/handleUtils.js";import"../../../../../../core/has.js";import{destroyMaybe as s}from"../../../../../../core/maybe.js";import{StreamFeatureManager as n}from"../../../../../../layers/graphics/data/StreamFeatureManager.js";import{createConnection as i}from"../../../../../../layers/graphics/sources/connections/createConnection.js";import{internalTimeReceivedField as o}from"../../../../../../layers/support/streamLayerUtils.js";import{StreamConnectionState as r}from"../StreamConnectionState.js";import{StreamFeatureStore as a}from"../StreamFeatureStore.js";import{ALoadStrategy as c}from"./ALoadStrategy.js";import{StreamSourceChunk as h}from"./chunks/StreamSourceChunk.js";class m extends c{constructor(t,s,i,c,h){super(i),this._service=t,this._dataFilter=s,this._streamOptions=c,this._metadata=h,this._connectionState=new r,this._forceRefresh=!1,this.events=new e.EventEmitter;const{timeInfo:m}=this._metadata,{purgeOptions:d}=s;this._stagingStore=new a(this._metadata.weakCloneWithAdditionalFields([{name:o,alias:"timeReceived",type:"esriFieldTypeDate"}]),e=>this.events.emit("features-updated",e)),this._manager=new n(this._stagingStore,h.featureIdInfo,m,d),this.connect()}destroy(){super.destroy(),this.disconnect()}get about(){return{supportsDisplayFilter:!1,willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState?.errorString}async refresh(){const e=null!=this._chunk;return this._manager.checkForUpdates()||!e||this._forceRefresh?(this._chunk&&this._store.remove(this._chunk),this._forceRefresh=!1,this._chunk=new h(this._stagingStore.reader),this._store.insert(this._chunk),this.events.emit("tick"),!0):(this.events.emit("tick"),!1)}async updateFields(e){throw new Error("Updating available fields not supported for StreamLayer")}async load(e){}unload(e){}disconnect(){this._connection=s(this._connection),this._connectionState.connection=null,this._handlesGroup?.remove()}connect(){if(null!=this._connection)return;const{geometryType:e,spatialReference:s}=this._metadata,{maxReconnectionAttempts:n,maxReconnectionInterval:o,geometryDefinition:r,definitionExpression:a,customParameters:c}=this._dataFilter;this._connection=i(this._service.source,s,this._streamOptions.outSR,e,a,r,n,o,c),this._handlesGroup=t([this._connection.on("data-received",e=>this._onFeature(e)),this._connection.on("message-received",e=>this._onWebSocketMessage(e))]),this._connectionState.connection=this._connection}clear(){this._manager.checkForUpdates(),this._stagingStore.clear(),this._forceRefresh=!0}updateCustomParameters(e){this._connection?.updateCustomParameters(e)}sendMessageToSocket(e){this._connection?.sendMessageToSocket(e)}sendMessageToClient(e){this._connection?.sendMessageToClient(e)}_onWebSocketMessage(e){if("type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this._manager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this._manager.removeByTrackId(t);break;case"clear":this.clear()}this.events.emit("message-received",e)}_onFeature(e){try{this._manager.add(e),this.events.emit("data-received",e)}catch(t){}}}export{m as StreamLoadStrategy};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../../../core/Evented.js";import has from"../../../../../../../core/has.js";import{create as s}from"../../../../../../../geometry/support/aaBoundingBox.js";import{FeatureStoreQueryAdapter as t}from"../../../FeatureStoreQueryAdapter.js";import{OverrideState as r}from"./Overrides.js";class o{constructor(s){this._metadata=s,this._chunks=new Map,this._chunksToRemove=[],this._overrides=new r,this.events=new e,this.featureAdapter=new t}destroy(){this.clear()}clear(){for(const e of this._chunks.values())this._chunksToRemove.push(e);this._chunks.clear(),this._overrides.clearWeakOverrides()}*chunks(){this._overrides&&(yield this._overrides.asChunk(this._metadata)),yield*this._chunks.values()}insert(e){has("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.insert`),this._overrides.onChunkInsert(e),this._chunks.set(e.chunkId,e),this.events.emit("changed")}remove(e){has("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.remove`),this._chunks.delete(e.chunkId),this._chunksToRemove.push(e)}removeById(e){has("esri-2d-update-debug")&&console.debug(`Chunk[${e}] SourceChunkStore.remove`);const s=this._chunks.get(e);this._chunks.delete(e),s&&this._chunksToRemove.push(s)}cleanup(){const e=this._chunksToRemove;return this._chunksToRemove=[],this._overrides.cleanup(this._chunks.values()),e}applyOverride(e){this._overrides.apply(e,this),this.events.emit("changed");for(const s of this._chunks.values())s.invalidate()}takeOverrideUpdate(){return this._overrides.takeOverrideUpdate()}refresh(){this.events.emit("refresh")}forEach(e){const s=new Set;for(const t of this.chunks()){const r=t.reader.getCursor();for(;r.next();){const t=r.getObjectId();s.has(t)||(e(r.copy()),s.add(t))}}}forEachUnsafe(e){const s=new Set;for(const t of this.chunks()){const r=t.reader.getCursor();for(;r.next();){const t=r.getObjectId();s.has(t)||(e(r),s.add(t))}}}mapObjectIdsFromGlobalIds(e,s){const t=new Map,r=new Set(e);return this._overrides.putWeakObjectIdsFromGlobalIds(t,r,s),this._forEachUnsafeIgnoreOverrides(e=>{const o=e.readAttribute(s);if(o&&r.has(o)&&!t.has(o)){const s=e.getObjectId();t.set(o,s)}}),t}forEachInBounds(e,s){const t=new Set;for(const r of this.chunks()){const o=r.queryFeaturesInBounds(e);for(;o.next();){const e=o.getObjectId();t.has(e)||(s(o.copy()),t.add(e))}}}forEachBounds(e,t){const r=s();for(const s of e){s.getBounds(r)&&t(r)}}_forEachUnsafeIgnoreOverrides(e){const s=new Set;for(const t of this._chunks.values()){const r=t.reader.withoutOverrides().getCursor();for(;r.next();){const t=r.getObjectId();s.has(t)||(e(r),s.add(t))}}}}export{o as FeatureSourceChunkStore};
|
|
5
|
+
import e from"../../../../../../../core/Evented.js";import has from"../../../../../../../core/has.js";import{create as s}from"../../../../../../../geometry/support/aaBoundingBox.js";import{FeatureStoreQueryAdapter as t}from"../../../FeatureStoreQueryAdapter.js";import{OverrideState as r}from"./Overrides.js";class o{constructor(s){this._metadata=s,this._chunks=new Map,this._chunksToRemove=[],this._overrides=new r,this.events=new e.EventEmitter,this.featureAdapter=new t}destroy(){this.clear()}clear(){for(const e of this._chunks.values())this._chunksToRemove.push(e);this._chunks.clear(),this._overrides.clearWeakOverrides()}*chunks(){this._overrides&&(yield this._overrides.asChunk(this._metadata)),yield*this._chunks.values()}insert(e){has("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.insert`),this._overrides.onChunkInsert(e),this._chunks.set(e.chunkId,e),this.events.emit("changed")}remove(e){has("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.remove`),this._chunks.delete(e.chunkId),this._chunksToRemove.push(e)}removeById(e){has("esri-2d-update-debug")&&console.debug(`Chunk[${e}] SourceChunkStore.remove`);const s=this._chunks.get(e);this._chunks.delete(e),s&&this._chunksToRemove.push(s)}cleanup(){const e=this._chunksToRemove;return this._chunksToRemove=[],this._overrides.cleanup(this._chunks.values()),e}applyOverride(e){this._overrides.apply(e,this),this.events.emit("changed");for(const s of this._chunks.values())s.invalidate()}takeOverrideUpdate(){return this._overrides.takeOverrideUpdate()}refresh(){this.events.emit("refresh")}forEach(e){const s=new Set;for(const t of this.chunks()){const r=t.reader.getCursor();for(;r.next();){const t=r.getObjectId();s.has(t)||(e(r.copy()),s.add(t))}}}forEachUnsafe(e){const s=new Set;for(const t of this.chunks()){const r=t.reader.getCursor();for(;r.next();){const t=r.getObjectId();s.has(t)||(e(r),s.add(t))}}}mapObjectIdsFromGlobalIds(e,s){const t=new Map,r=new Set(e);return this._overrides.putWeakObjectIdsFromGlobalIds(t,r,s),this._forEachUnsafeIgnoreOverrides(e=>{const o=e.readAttribute(s);if(o&&r.has(o)&&!t.has(o)){const s=e.getObjectId();t.set(o,s)}}),t}forEachInBounds(e,s){const t=new Set;for(const r of this.chunks()){const o=r.queryFeaturesInBounds(e);for(;o.next();){const e=o.getObjectId();t.has(e)||(s(o.copy()),t.add(e))}}}forEachBounds(e,t){const r=s();for(const s of e){s.getBounds(r)&&t(r)}}_forEachUnsafeIgnoreOverrides(e){const s=new Set;for(const t of this._chunks.values()){const r=t.reader.withoutOverrides().getCursor();for(;r.next();){const t=r.getObjectId();s.has(t)||(e(r),s.add(t))}}}}export{o as FeatureSourceChunkStore};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import has from"../../../../core/has.js";import{property as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../Color.js";import has from"../../../../core/has.js";import{numberMaxFloat32 as r}from"../../../../core/mathUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{isFunctionRaster as o}from"../../../../layers/support/rasterDatasets/datasetUtils.js";import{getBytesPerPixel as n}from"../../../../layers/support/rasterFormats/pixelRangeUtils.js";import{convertGeometryToMask as a}from"../../../../layers/support/rasterFunctions/clipUtils.js";import{maxMapSizeGpu as l}from"../../../../layers/support/rasterFunctions/pixelUtils.js";import{RasterTileContainer as c}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as p}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as u}from"../support/util.js";import{defaultColor as h}from"../../../support/HighlightDefaults.js";let d=class extends p{constructor(){super(...arguments),this.type="raster"}get canUseWebGLForProcessing(){const{loaded:e,symbolizer:t}=this.layer;if(!e||!t)return!1;const r=t.lookup.colormapLut?.indexedColormap,i=r&&r.length>this._maxIndexedColormapSize,s=n(this.layer.serviceRasterInfo);return!(has("ios")&&s>4)&&this.useWebGLForProcessing&&t.canRenderInWebGL&&!i&&!("majority"===this.layer.interpolation&&u(this.layer))}attach(){super.attach(),this.container=new c(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this.updateRasterFunctionParameters()}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}fetchTile(e,t){return this.layer.fetchTile(e.level,e.row,e.col,t)}updateRasterFunctionParameters(){const{raster:e,type:t}=this.layer,{container:r}=this;if("Function"!==e.datasetFormat||"wcs"===t)return r.rasterFunctionChain=null,r.children.forEach(e=>{const{bitmap:t}=e;t&&(t.suspended=!0,t.processed=!1,t.projected&&(t.invalidateTexture(),t.rasterTexture=null))}),void(this._rasterFunctionState="na");const i=this._rasterFunctionState,{rasterFunction:s,primaryRasters:o}=e,n=s.supportsGPU&&(!o||o.rasters.length<=1),a=n?s.flatWebGLFunctionChain:null,{renderer:l}=this.layer,c=!n||!a?.functions.length||"raster-stretch"===l?.type&&l.dynamicRangeAdjustment||!this.canUseWebGLForProcessing;r.rasterFunctionChain=c?null:this._addProjection(a);const p=null==s?"na":r.rasterFunctionChain?"gpu":"cpu",u=i===p||"na"===i&&"cpu"===p&&0===a?.functions?.length;r.children.forEach(e=>{const{bitmap:t}=e;t&&(t.suspended=!u,t.processed=!1,t.processedTexture=null)}),this._rasterFunctionState=p}async updateTileSource(e,t){const r=this._getBandIds(),i=this._getLayerInterpolation(),{canUseWebGLForProcessing:s}=this,{source:n,globalSymbolizerParams:l,suspended:c,coords:p,resolution:u}=t,h=this.layerView.hasTilingEffects?l:t.symbolizerParams,{bitmap:d}=e;if([d.x,d.y]=p,d.resolution=u,null!=n?.pixelBlock){const e={extent:n.extent,pixelBlock:n.pixelBlock,srcPixelSize:n.srcTilePixelSize};if(d.rawPixelData=e,s)d.source=n.pixelBlock,d.isRendereredSource=!1;else{const t=await this.layer.applyRenderer(e,"stretch"===l?.type?l:void 0);d.source=t,d.isRendereredSource=!0}d.symbolizerParameters=s?h:null,d.transformGrid=s?n.transformGrid:null}else{const e=this.createEmptyTilePixelBlock();d.source=e,d.symbolizerParameters=s?h:null,d.transformGrid=null}d.bandIds=s?r:null,d.width=this._tileInfoView.tileInfo.size[0],d.height=this._tileInfoView.tileInfo.size[1],d.interpolation=i,d.suspended=c;const{raster:m}=this.layer;if(o(m)){const t=m.getClippingGeometry(this.layerView.view.spatialReference);if(t){const r=m.getTileExtentFromTileInfo(e.key.level,e.key.row,e.key.col,this._tileInfoView.tileInfo);d.mask=a({srcExtent:r,geometry:t,size:[d.width,d.height]})}}d.invalidateTexture()}async updateTileSymbolizerParameters(e,t){const{local:r,global:i}=t,s=this._getBandIds(),o=this._getLayerInterpolation(),{canUseWebGLForProcessing:n}=this,{bitmap:a}=e,{rawPixelData:l}=a;n||null==l?(a.isRendereredSource&&null!=l&&(a.source=l.pixelBlock),a.isRendereredSource=!1):(a.source=await this.layer.applyRenderer(l,"stretch"===i?.type?i:void 0),a.isRendereredSource=!0),a.symbolizerParameters=n?this.layerView.hasTilingEffects?i:r:null,a.bandIds=n?s:null,a.interpolation=o,a.suspended=!1}updateHighlightOptions(e,i){if(e){const{ranges:s}=e,o=Array.from({length:2*l},()=>0);for(let e=0;e<s.length;e++)o[2*e]=s[e][0],o[2*e+1]=s[e][1];for(let e=s.length;e<l;e++)o[2*e]=r,o[2*e+1]=-r;const n=e.bandId??0,a=t.toUnitRGBA(i??h);this.container.pixelHighlightOptions={ranges:o,color:a,bandId:n}}else this.container.pixelHighlightOptions=void 0}_getLayerInterpolation(){const{interpolation:e,renderer:t}=this.layer;if(!t)return e;const r=t.type;return"raster-colormap"===r||"unique-value"===r?"nearest":"raster-stretch"===t.type&&null!=t.colorRamp?"bilinear"===e||"cubic"===e?"bilinear":"nearest":e}_addProjection(e){return e?.functions?.length&&!e.hasFocalFunction&&e.functions.unshift({name:"Reproject",parameters:{targetImageSize:this._tileInfoView.tileInfo.size,requireNNEdge:e.isSourceSingleBand},pixelType:"f32",id:0,isNoopProcess:!1}),e}};e([i()],d.prototype,"canUseWebGLForProcessing",null),e([i()],d.prototype,"container",void 0),e([i()],d.prototype,"layer",void 0),e([i()],d.prototype,"type",void 0),d=e([s("esri.views.2d.layers.imagery.ImageryTileView2D")],d);export{d as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Graphic.js";import{isSome as r}from"../../../core/arrayUtils.js";import{isIterable as
|
|
5
|
+
import e from"../../../Graphic.js";import{isSome as r}from"../../../core/arrayUtils.js";import{isIterable as t}from"../../../core/iteratorUtils.js";import{clipContainsPoint as i}from"./clippingUtils.js";import{isSupportedScreenPointEvent as a,createScreenPointFromSupportedEvent as l}from"../../support/screenUtils.js";async function s(e,t,s){const f=a(t)?l(e,t):t;if(!e.ready||isNaN(f.x)||isNaN(f.y))return{screenPoint:f,results:[]};let d=new Set;const y=new Set;let u=!1,h=null,g=null;s?.include?o(s.include,n(e,e=>{d.add(e),p(e,e=>y.add(e))},(e,r)=>{y.add(e),d.add(r)},e=>{h||(h=new Set),h.add(e)},e=>d.add(e),()=>u=!0)):(u=!0,d=new Set(e.allLayerViews),d.forEach(e=>{p(e,e=>y.add(e))})),s?.exclude&&o(s.exclude,n(e,e=>{d.delete(e),p(e,e=>y.delete(e))},e=>y.delete(e),e=>{g||(g=new Set),g.add(e)}));const m=e.toMap(f),w=e.allLayerViews.filter(r=>!r.suspended&&d.has(r)&&r.clips.every(r=>i(e,r,f,m))).reverse();let V=[...u?e.graphicsView.hitTest(m).map(e=>({type:"graphic",graphic:e,layer:null,mapPoint:m})):[],...await Promise.all(w.map(e=>e.hitTest(m,f)).toArray())].filter(r).flat().filter(r);return V=V.filter(e=>"graphic"!==e.type||"subtype-group"!==e.layer?.type||y.has(e.graphic.layer)),h&&(V=V.filter(e=>!("graphic"in e)||!e.graphic||h?.has(c(e.graphic)))),g&&(V=V.filter(e=>!("graphic"in e)||!e.graphic||!g?.has(c(e.graphic)))),{screenPoint:f,results:V}}function n(r,t,i,a,l,s){return n=>{if(n instanceof e){if(n.layer===r)s?.();else{const e=r.allLayerViews.find(e=>e.layer===n.layer);e&&l?.(e)}a(c(n))}else if("layer"in n&&"element"in n);else if("subtype-sublayer"===n.type){const e=r.allLayerViews.find(e=>e.layer===n.parent);e&&i(n,e)}else{const e=r.allLayerViews.find(e=>e.layer===n);e&&t(e)}}}function o(e,r){if(e)if(t(e))for(const i of e)if(t(i))for(const e of i)r(e);else r(i);else r(e)}function c(e){const r=e.getObjectId();return r?`${e.layer?.uid??e.sourceLayer?.uid??"MapView"}/${r}`:`"MapView/${e.uid}`}function p(e,r){const t=e.layer;"subtype-group"===t?.type&&t.sublayers.forEach(e=>{r(e)})}export{s as hitTest};
|