@arcgis/core 4.33.0-next.20250328 → 4.33.0-next.20250330
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/applications/Components/reactiveUtils.d.ts +4 -0
- package/applications/Components/reactiveUtils.js +1 -1
- package/applications/MapViewer/templateUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{5269793822e41dd07fe1.js → 0b6ceb0194a07bbc3433.js} +1 -1
- package/assets/esri/core/workers/chunks/{458f4c6c8820c1f62f69.js → 1322096a72e910f23167.js} +1 -1
- package/assets/esri/core/workers/chunks/1cd9b5ef62582b25df9b.js +1 -0
- package/assets/esri/core/workers/chunks/1cf8a431e5da946c7d27.js +1 -0
- package/assets/esri/core/workers/chunks/{add0770399a63b7635b5.js → 1df34b7fd68f5ab55bd3.js} +1 -1
- package/assets/esri/core/workers/chunks/{e1b42fc5c1d89333e834.js → 239821543abbd63c5787.js} +2 -2
- package/assets/esri/core/workers/chunks/2a654d8de99be40dd0e6.js +1 -0
- package/assets/esri/core/workers/chunks/{fdc9bd8f309af610fa62.js → 48ad7beb48dcc2693cc3.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e631e34ee495eb0e76e.js → 49ed3ab9bd6d7c52e864.js} +1 -1
- package/assets/esri/core/workers/chunks/5e79642851e888eddfe4.js +1 -0
- package/assets/esri/core/workers/chunks/738e4f46feb3758456e0.js +1 -0
- package/assets/esri/core/workers/chunks/77660e18ea793ae85f83.js +1 -0
- package/assets/esri/core/workers/chunks/{4d02e211967384994e5e.js → 82493f51a2182f76dd2f.js} +1 -1
- package/assets/esri/core/workers/chunks/879d672d12f9ef2e1b50.js +1 -0
- package/assets/esri/core/workers/chunks/921b41b101957cfc1cfd.js +1 -0
- package/assets/esri/core/workers/chunks/{f128d3431da86e484117.js → 94292c7afff18694d55e.js} +1 -1
- package/assets/esri/core/workers/chunks/{c0400c25c53fd90fc90e.js → 9e156e135f34f9b06032.js} +1 -1
- package/assets/esri/core/workers/chunks/9f18de17fbcad0e5c140.js +1 -0
- package/assets/esri/core/workers/chunks/{4eb1a2433f675bde12ad.js → a01c86910fe4984eb788.js} +1 -1
- package/assets/esri/core/workers/chunks/ba4d91816f6a0bf0d812.js +1 -0
- package/assets/esri/core/workers/chunks/da8a002d18544def5383.js +1 -0
- package/assets/esri/core/workers/chunks/dde03a893f9cef8e0f45.js +1 -0
- package/assets/esri/core/workers/chunks/{fc7ce48c7b31a4665a9b.js → e792603b7cc3ddd133f3.js} +1 -1
- package/assets/esri/core/workers/chunks/{0c9e933b392616460e62.js → f0c864425f000ab87a7b.js} +1 -1
- package/assets/esri/core/workers/chunks/fc5ca7b08915177c5e33.js +1 -0
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_en.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_en.json +1 -1
- package/assets/esri/widgets/LayerList/t9n/LayerList.json +1 -1
- package/assets/esri/widgets/LayerList/t9n/LayerList_en.json +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/polygonOverlayOperator.js +1 -1
- package/interfaces.d.ts +114 -13
- package/intl/locale.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/sources/WFSSourceWorker.js +1 -1
- package/layers/support/commonProperties.js +1 -1
- package/networks/RulesTable.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/networks/support/utils.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/portal/schemas/sceneLayerItem.js +1 -1
- package/support/actions/actionUtils.js +1 -1
- package/support/revision.js +1 -1
- package/tables/AttributeTableTemplate.js +1 -1
- package/tables/elements/AttributeTableAttachmentElement.js +1 -1
- package/tables/elements/AttributeTableFieldElement.js +1 -1
- package/tables/elements/AttributeTableGroupElement.js +1 -1
- package/tables/elements/AttributeTableRelationshipElement.js +1 -1
- package/tables/support/FieldOrder.js +5 -0
- package/tables/support/tablesUtils.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesDrillIn.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/LayerList/LayerListItem.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/support/tests.js +1 -1
- package/assets/esri/core/workers/chunks/08ea652b7896c1da022d.js +0 -1
- package/assets/esri/core/workers/chunks/09ca64184bed6abafcd9.js +0 -1
- package/assets/esri/core/workers/chunks/18d0fe269531b951e309.js +0 -1
- package/assets/esri/core/workers/chunks/2bb508701ad8ccc3d6ab.js +0 -1
- package/assets/esri/core/workers/chunks/2ce80c764cca9e6a20cd.js +0 -1
- package/assets/esri/core/workers/chunks/2f23fc27d005ffa18f47.js +0 -1
- package/assets/esri/core/workers/chunks/2fcfc21ba38d9919730a.js +0 -1
- package/assets/esri/core/workers/chunks/74541f1a6d4228275c52.js +0 -1
- package/assets/esri/core/workers/chunks/75ec4d2ae9d427a1434f.js +0 -1
- package/assets/esri/core/workers/chunks/85a9025c2990a8bbd61b.js +0 -1
- package/assets/esri/core/workers/chunks/90afead317186b31b2f9.js +0 -1
- package/assets/esri/core/workers/chunks/aa404aaec843a4f46ab6.js +0 -1
- package/assets/esri/core/workers/chunks/aff7c4477e1f0c31fffa.js +0 -1
- /package/assets/esri/core/workers/chunks/{e1b42fc5c1d89333e834.js.LICENSE.txt → 239821543abbd63c5787.js.LICENSE.txt} +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import{clone as i}from"../core/lang.js";import{setDeepValue as r}from"../core/object.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import n from"./FeatureLayer.js";import{useViewTimeProperty as s}from"./mixins/TemporalLayer.js";import{orientedImageryTypeMap as p,timeIntervalUnitTypeMap as m,verticalMeasurementTypeMap as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import{clone as i}from"../core/lang.js";import{setDeepValue as r}from"../core/object.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import n from"./FeatureLayer.js";import{useViewTimeProperty as s}from"./mixins/TemporalLayer.js";import{orientedImageryTypeMap as p,timeIntervalUnitTypeMap as m,verticalMeasurementTypeMap as l,getEffectiveElevationSource as y,isOrientationAccuracy as d}from"./orientedImagery/core/utils.js";import u from"../tables/AttributeTableTemplate.js";import c from"../time/TimeExtent.js";import{SaveOperationType as h}from"../webdoc/interfaces.js";const g=new Set(["demPathPrefix","demPathSuffix","depthImagePathPrefix","depthImagePathSuffix","elevationSource","horizontalMeasurementUnit","imageGeometryField","imageReferenceField","verticalMeasurementUnit","videoPathPrefix","videoPathSuffix","timeAnimation","visibilityTimeExtent"]),f=(e,t)=>!g.has(t)&&e,v=(e,t,i)=>{const r=`orientedImageryProperties.${e}`;return{name:r,write:t?{ignoreOrigin:!0,target:r,writer:t}:{ignoreOrigin:!0},read:i?{ignoreOrigin:!0,source:r,reader:i}:{ignoreOrigin:!0}}};function j(e){return e.json?(e.json.origins=e.json.origins??{},e.json.origins["web-scene"]={write:!1,read:!1},e):e}function P(e,t,i,r){const{name:o,write:a,read:n}=v(e,t,i),s={name:o,write:a,read:n,origins:{service:{name:`orientedImageryInfo.${o}`,write:t,read:i},"web-scene":{name:o,write:f(a,e),read:f(n,e)},"web-map":{name:o,write:a,read:n}}};return r&&s.origins?(s.type=r,s.origins["web-map"].type=r,s.origins["web-scene"].type=r,s):s}let S=class extends n{constructor(){super(...arguments),this.attributeTableTemplate=null,this.cameraHeading=null,this.cameraHeight=null,this.cameraPitch=null,this.cameraRoll=null,this.coveragePercent=null,this.demPathPrefix=null,this.demPathSuffix=null,this.depthImagePathPrefix=null,this.depthImagePathSuffix=null,this.elevationSource=null,this.farDistance=null,this.geometryType="point",this.horizontalFieldOfView=null,this.horizontalMeasurementUnit=null,this.imageGeometryField="ImageGeometry",this.imagePathPrefix=null,this.imagePathSuffix=null,this.imageReferenceField="OIObjectID",this.imageRotation=null,this.maximumDistance=null,this.nearDistance=null,this.operationalLayerType="OrientedImageryLayer",this.orientationAccuracy=null,this.orientedImageryType=null,this.supportedSourceTypes=new Set(["Oriented Imagery Layer"]),this.type="oriented-imagery",this.timeIntervalUnit="days",this.useViewTime=!0,this.verticalFieldOfView=null,this.verticalMeasurementUnit=null,this.videoPathPrefix=null,this.videoPathSuffix=null,this.visibilityTimeExtent=null}get effectiveElevationSource(){const{elevationSource:e,demPathPrefix:t,demPathSuffix:i}=this;return y(e,t,i)}async save(e){return this._debouncedSaveOperations(h.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(h.SAVE_AS,t,e)}findFirstValidLayerId(e){return e.layers?.find((e=>this.supportedSourceTypes.has(e.type)))?.id}_verifySource(){if(super._verifySource(),"point"!==this.geometryType)throw new t("oriented-imagery-layer:invalid-geometry-type","OrientedImageryLayer only supports point geometry type")}};e([o({type:u,json:{write:!1,read:!1}})],S.prototype,"attributeTableTemplate",void 0),e([o({type:Number,json:P("cameraHeading")})],S.prototype,"cameraHeading",void 0),e([o({type:Number,json:P("cameraHeight")})],S.prototype,"cameraHeight",void 0),e([o({type:Number,json:P("cameraPitch")})],S.prototype,"cameraPitch",void 0),e([o({type:Number,json:P("cameraRoll")})],S.prototype,"cameraRoll",void 0),e([o({type:Number,json:P("coveragePercent")})],S.prototype,"coveragePercent",void 0),e([o({type:String,json:P("demPathPrefix")})],S.prototype,"demPathPrefix",void 0),e([o({type:String,json:P("demPathSuffix")})],S.prototype,"demPathSuffix",void 0),e([o({type:String,json:P("depthImagePathPrefix")})],S.prototype,"depthImagePathPrefix",void 0),e([o({type:String,json:P("depthImagePathSuffix")})],S.prototype,"depthImagePathSuffix",void 0),e([o({type:Object,json:P("elevationSource")})],S.prototype,"elevationSource",void 0),e([o({readOnly:!0})],S.prototype,"effectiveElevationSource",null),e([o({type:Number,json:P("farDistance")})],S.prototype,"farDistance",void 0),e([o()],S.prototype,"geometryType",void 0),e([o({type:Number,json:P("horizontalFieldOfView")})],S.prototype,"horizontalFieldOfView",void 0),e([o({type:String,json:P("horizontalMeasurementUnit")})],S.prototype,"horizontalMeasurementUnit",void 0),e([o({type:String,json:{...P("imageGeometryField"),default:"ImageGeometry"}})],S.prototype,"imageGeometryField",void 0),e([o({type:String,json:P("imagePathPrefix")})],S.prototype,"imagePathPrefix",void 0),e([o({type:String,json:P("imagePathSuffix")})],S.prototype,"imagePathSuffix",void 0),e([o({type:String,json:{...P("imageReferenceField"),default:"OIObjectID"}})],S.prototype,"imageReferenceField",void 0),e([o({type:Number,json:P("imageRotation")})],S.prototype,"imageRotation",void 0),e([o({type:Number,json:P("maximumDistance")})],S.prototype,"maximumDistance",void 0),e([o({type:Number,json:P("nearDistance")})],S.prototype,"nearDistance",void 0),e([o({type:["OrientedImageryLayer"],json:{origins:{"portal-item":{name:"layerType",write:{enabled:!0,ignoreOrigin:!0}}}}})],S.prototype,"operationalLayerType",void 0),e([o({json:{...P("orientationAccuracy",((e,t,i)=>{r(i,e.join(";"),t)}),(e=>{const t=e?.split(";")?.map(Number);return d(t)?t:[0,0,0,0,0,0,0,0,0]}),String)}})],S.prototype,"orientationAccuracy",void 0),e([o({json:{...P("orientedImageryType",p.write,p.read,p.jsonValues.slice(1))}})],S.prototype,"orientedImageryType",void 0),e([o({json:{read:!1},value:"oriented-imagery",readOnly:!0})],S.prototype,"type",void 0),e([o({type:m.apiValues,json:{...P("timeIntervalUnit",m.write,m.read,m.jsonValues)}})],S.prototype,"timeIntervalUnit",void 0),e([o(j(i(s)))],S.prototype,"useViewTime",void 0),e([o({type:Number,json:P("verticalFieldOfView")})],S.prototype,"verticalFieldOfView",void 0),e([o({type:l.apiValues,json:{...P("verticalMeasurementUnit",l.write,l.read,l.jsonValues)}})],S.prototype,"verticalMeasurementUnit",void 0),e([o({type:String,json:P("videoPathPrefix")})],S.prototype,"videoPathPrefix",void 0),e([o({type:String,json:P("videoPathSuffix")})],S.prototype,"videoPathSuffix",void 0),e([o({type:c,json:{origins:{"web-scene":{write:!1,read:!1}}}})],S.prototype,"visibilityTimeExtent",void 0),S=e([a("esri.layers.OrientedImageryLayer")],S);const x=S;export{x as default};
|
package/layers/SceneLayer.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import r from"../PopupTemplate.js";import i from"../core/Clonable.js";import s from"../core/Collection.js";import o from"../core/Error.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as p,isAbortError as d}from"../core/promiseUtils.js";import{whenOnce as u}from"../core/reactiveUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{getProperties as c}from"../core/accessorSupport/utils.js";import{reader as h}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as m}from"../core/accessorSupport/PropertyOrigin.js";import g from"../geometry/Point.js";import v from"./Layer.js";import{NoModelError as b,MultipleModelsError as w}from"./graphics/sources/support/uploadAssetErrors.js";import{APIKeyMixin as I}from"./mixins/APIKeyMixin.js";import{ArcGISService as L}from"./mixins/ArcGISService.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as F}from"./mixins/EditBusLayer.js";import{OperationalLayer as S}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as A}from"./mixins/ScaleRangeLayer.js";import{SceneService as O,SaveOperationType as P}from"./mixins/SceneService.js";import{useViewTimeProperty as E}from"./mixins/TemporalLayer.js";import{TemporalSceneLayer as T}from"./mixins/TemporalSceneLayer.js";import{isHostedAgolService as x}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as D}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as U}from"./support/capabilities.js";import{elevationInfo as R,labelsVisible as q,legendEnabled as C,popupEnabled as G,screenSizePerspectiveEnabled as N}from"./support/commonProperties.js";import{getFieldDomain as Q,computeEffectiveEditingEnabled as V,getGlobalIdToObjectIdMap as M}from"./support/featureLayerUtils.js";import{FeatureReduction as k}from"./support/FeatureReduction.js";import K from"./support/FeatureReductionSelection.js";import{defineFieldProperties as $}from"./support/fieldProperties.js";import H from"./support/FieldsIndex.js";import{fixRendererFields as z,unpackFieldNames as W}from"./support/fieldUtils.js";import{I3SNodePageDefinition as Z,I3SMaterialDefinition as B,I3STextureSetDefinition as J,I3SGeometryDefinition as X}from"./support/I3SLayerDefinitions.js";import{isFileEditFormat as Y,isFileSupported as ee}from"./support/infoFor3D.js";import te from"./support/LabelClass.js";import{reader as re}from"./support/labelingInfo.js";import ie from"./support/LayerFloorInfo.js";import{layerLookupMap as se}from"./support/lazyLayerLoader.js";import{getMeshTransformForMetersToSpatialReference as oe}from"./support/meshSpatialReferenceScaleUtils.js";import{RangeInfo as ae}from"./support/RangeInfo.js";import ne from"./support/SceneFilter.js";import{cacheIsOutOfSync as le}from"./support/sceneLayerCacheUtils.js";import{fetchStatistics as pe}from"./support/sceneLayerStatistics.js";import{loadStyleRenderer as de}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as ue}from"../renderers/support/typeUtils.js";import ye from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as ce,elevationModeUnsupportedMessage as he,featureExpressionUnsupportedMessage as fe}from"../support/elevationInfoUtils.js";import{createPopupTemplate as me}from"../support/popupUtils.js";import{extractZipFiles as ge}from"../support/zipUtils.js";import{queryAttributesFromCachedAttributesId as ve}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as be,getFetchPopupTemplate as we}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as Ie}from"../webdoc/support/opacityUtils.js";const Le=new Set(["3DObject","Point"]),je=$();let Fe=class extends(T(F(O(L(S(_(A(l(j(I(i.ClonableMixin(v)))))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new s,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._set("renderer",null),this.associatedLayer=n(this.associatedLayer)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getField(e)?.domain??null;return this.associatedLayer?Q(this.associatedLayer,e,t,r):r}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get attributeTableTemplate(){return this.associatedLayer?.attributeTableTemplate??null}get fieldsIndex(){return new H(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:Z.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return null!=this.associatedLayer&&V(this.associatedLayer)}get geometryType(){return _e[this.profile]||"mesh"}set renderer(e){z(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e=null!=e?e:U;const{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:a,supportsReturnServiceEditsInSourceSpatialReference:n},data:{supportsZ:l,supportsM:p,isVersioned:d,supportsAttachment:u},operations:{supportsEditing:y,supportsAdd:c,supportsUpdate:h,supportsDelete:f,supportsQuery:m,supportsQueryAttachments:g,supportsAsyncConvert3D:v}}=e,b=e.operations.supportsChangeTracking,w=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsReturnServiceEditsInSourceSpatialReference:n,supportsRollbackOnFailure:s,supportsGeometryUpdate:w&&a,supportsUploadWithItemId:o},data:{supportsAttachment:u,supportsZ:l,supportsM:p,isVersioned:d},operations:{supportsQuery:m,supportsQueryAttachments:g,supportsEditing:y&&b,supportsAdd:w&&c&&b,supportsDelete:w&&f&&b,supportsUpdate:h&&b,supportsAsyncConvert3D:v}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e))),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e))),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&Se[r]?Se[r]:(a.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override("useViewTime",e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const t=null!=e?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(p),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await de(this,{origin:"service"},t),z(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){a.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new ye;return"mesh"===this.geometryType?this.capabilities.query.supportsReturnMesh&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e}))}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){const r=W(this.fieldsIndex,await be(this,we(this)));return ve(this.parsedUrl?.path??"",this.attributeStorageInfo??[],e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,r){const i=await this.queryCachedAttributes(e,[r]);if(!i||0===i.length)throw new o("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const s=new t;return s.attributes=i[0],s.layer=this,s.sourceLayer=this,s}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryObjectIds(e||this.createQuery(),t)))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryAttachments(e,t)))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(a.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return me(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new o("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some((t=>t.name===e))}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(P.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(P.SAVE,e)}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");let i=t;await this.load();const s=this.associatedLayer;if(!s)throw new o(`${this.type}-layer:not-editable`,"Service is not editable");await s.load();const{globalIdField:a}=s,n=!!s.infoFor3D,l=i?.globalIdUsed??!0;if(n&&null==a)throw new o(`${this.type}-layer:not-editable`,"Valid globalIdField expected on editable SceneLayer");if(n&&!l)throw new o(`${this.type}-layer:globalid-required`,"globalIdUsed must not be false for SceneLayer editing as globalIds are required.");return x(s.url)&&n&&null!=e.deleteFeatures&&null!=a&&(i={...i,globalIdToObjectId:await M(s,e.deleteFeatures,a)}),r(this,s.source,e,i)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new o(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}on(e,t){return super.on(e,t)}async convertMesh(e,t){t??={};const r=e=>{throw a.getLogger(this).error(".convertMesh()",e.message),e};await this.load(),this.infoFor3D||r(new o("invalid:layer","SceneLayer has no capability for mesh conversion"));const i=await this.extractAndFilterFiles(e),s=i.reduce(((e,t)=>Y(this.infoFor3D,t)?e+1:e),0);0===s&&r(new b),s>1&&r(new w);const n=this.spatialReference,l=t.location??new g({x:0,y:0,z:0,spatialReference:n}),p=l.spatialReference.isGeographic?"local":"georeferenced",{default:d}=await import("../geometry/Mesh.js"),u=d.createWithExternalSource(l,i,{vertexSpace:p,transform:oe(l.spatialReference),unitConversionDisabled:!0}),[y]=await this.uploadAssets([u],{...t,useAssetOrigin:!t.location});return y}async extractAndFilterFiles(e){await this.load();const t=this.infoFor3D;if(!t)return e;return(await ge(e)).filter((e=>ee(t,e)))}validateLayer(e){if(e.layerType&&!Le.has(e.layerType))throw new o("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new o("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new o("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});function t(e,t){let r=!1,i=!1;if(null==e)r=!0,i=!0;else{const s=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,i=s;break;case"vertex-reference-frame":r=!0,i=!s;break;default:r=!1}}if(!r)throw new o("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!i)throw new o("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}t(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new o("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!!this.attributeStorageInfo?.some((t=>t.name===e.name)),r=!!this.associatedLayer?.fields?.some((t=>t&&e.name===t.name)),i={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=i}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPopupOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPopupOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled"],t=c(this);for(let r=0;r<e.length;r++){const i=e[r],s=this.originIdOf(i),o=this.associatedLayer.originIdOf(i);s<o&&(o===m.SERVICE||o===m.PORTAL_ITEM)&&t.setAtOrigin(i,this.associatedLayer[i],o)}}_applyAssociatedLayerExtentOverride(){const e=this.associatedLayer?.getAtOrigin("fullExtent","service");if(null==this.associatedLayer?.infoFor3D||!e||!x(this.associatedLayer?.url)||!le(this))return;c(this).setAtOrigin("fullExtent",e.clone(),m.SERVICE)}_applyAssociatedLayerPrivileges(){const e=this.associatedLayer;e&&(this._set("userHasEditingPrivileges",e.userHasEditingPrivileges),this._set("userHasFullEditingPrivileges",e.userHasFullEditingPrivileges),this._set("userHasUpdateItemPrivileges",e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if(["mesh-pyramids","points"].includes(this.profile))try{const{serverUrl:t,layerId:r,portalItem:i}=await D(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),s=await se.FeatureLayer();this.associatedLayer=new s({url:t,customParameters:this.customParameters,layerId:r,portalItem:i}),await this.associatedLayer.load()}catch(t){d(t)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){await u((()=>this.popupEnabled&&null!=this.popupTemplate));const e=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?a.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):a.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${e}`)}_validateElevationInfo(){const e=this.elevationInfo;"mesh-pyramids"===this.profile&&ce(a.getLogger(this),he("Mesh scene layers","relative-to-scene",e)),ce(a.getLogger(this),fe("Scene layers",e))}async fetchStatistics(e,t){return await pe({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:"scenelayer",fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??"",customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}};e([y({types:{key:"type",base:k,typeMap:{selection:K}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],Fe.prototype,"featureReduction",void 0),e([y({type:[ae],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],Fe.prototype,"rangeInfos",void 0),e([y({json:{read:!1}})],Fe.prototype,"associatedLayer",void 0),e([y({type:["show","hide"]})],Fe.prototype,"listMode",void 0),e([y({type:["ArcGISSceneServiceLayer"]})],Fe.prototype,"operationalLayerType",void 0),e([y({json:{read:!1},readOnly:!0})],Fe.prototype,"type",void 0),e([y({...je.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Fe.prototype,"fields",void 0),e([y()],Fe.prototype,"types",null),e([y()],Fe.prototype,"typeIdField",null),e([y()],Fe.prototype,"templates",null),e([y()],Fe.prototype,"formTemplate",null),e([y()],Fe.prototype,"attributeTableTemplate",null),e([y({readOnly:!0,clonable:!1})],Fe.prototype,"fieldsIndex",null),e([y({type:ie,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],Fe.prototype,"floorInfo",void 0),e([y(je.outFields)],Fe.prototype,"outFields",void 0),e([y({type:Z,readOnly:!0,json:{read:!1}})],Fe.prototype,"nodePages",void 0),e([h("service","nodePages",["nodePages","pointNodePages"])],Fe.prototype,"readNodePages",null),e([y({type:[B],readOnly:!0})],Fe.prototype,"materialDefinitions",void 0),e([y({type:[J],readOnly:!0})],Fe.prototype,"textureSetDefinitions",void 0),e([y({type:[X],readOnly:!0})],Fe.prototype,"geometryDefinitions",void 0),e([y({readOnly:!0})],Fe.prototype,"serviceUpdateTimeStamp",void 0),e([y({readOnly:!0})],Fe.prototype,"attributeStorageInfo",void 0),e([y({readOnly:!0})],Fe.prototype,"statisticsInfo",void 0),e([y({type:s.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],Fe.prototype,"excludeObjectIds",void 0),e([y({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],Fe.prototype,"definitionExpression",void 0),e([y({type:ne,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],Fe.prototype,"filter",void 0),e([y({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Fe.prototype,"path",void 0),e([y(R)],Fe.prototype,"elevationInfo",null),e([y({readOnly:!0,json:{read:!1}})],Fe.prototype,"effectiveCapabilities",null),e([y({readOnly:!0})],Fe.prototype,"effectiveEditingEnabled",null),e([y({type:String})],Fe.prototype,"geometryType",null),e([y(q)],Fe.prototype,"labelsVisible",void 0),e([y({type:[te],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:re},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:re},write:!0}})],Fe.prototype,"labelingInfo",void 0),e([y(C)],Fe.prototype,"legendEnabled",void 0),e([y({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?Ie(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],Fe.prototype,"opacity",void 0),e([y({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Fe.prototype,"priority",void 0),e([y({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Fe.prototype,"semantic",void 0),e([y({types:ue,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],Fe.prototype,"renderer",null),e([y({json:{read:!1}})],Fe.prototype,"cachedDrawingInfo",void 0),e([h("service","cachedDrawingInfo")],Fe.prototype,"readCachedDrawingInfo",null),e([y({readOnly:!0,json:{read:!1}})],Fe.prototype,"capabilities",null),e([y({type:Boolean,json:{read:!1}})],Fe.prototype,"editingEnabled",null),e([y({readOnly:!0,json:{write:!1,read:!1}})],Fe.prototype,"infoFor3D",null),e([y({readOnly:!0,json:{write:!1,read:!1}})],Fe.prototype,"relationships",null),e([y(G)],Fe.prototype,"popupEnabled",void 0),e([y({type:r,json:{name:"popupInfo",write:!0}})],Fe.prototype,"popupTemplate",void 0),e([y({readOnly:!0,json:{read:!1}})],Fe.prototype,"defaultPopupTemplate",null),e([y({type:String,json:{read:!1}})],Fe.prototype,"objectIdField",void 0),e([h("service","objectIdField",["objectIdField","fields"])],Fe.prototype,"readObjectIdField",null),e([y({type:String,json:{read:!1}})],Fe.prototype,"globalIdField",void 0),e([h("service","globalIdField",["globalIdField","fields"])],Fe.prototype,"readGlobalIdField",null),e([y({readOnly:!0,type:String,json:{read:!1}})],Fe.prototype,"displayField",null),e([y({type:String,json:{read:!1}})],Fe.prototype,"profile",void 0),e([h("service","profile",["store.profile"])],Fe.prototype,"readProfile",null),e([y({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],Fe.prototype,"normalReferenceFrame",void 0),e([y(N)],Fe.prototype,"screenSizePerspectiveEnabled",void 0),e([y({json:{read:!1,origins:{service:{read:!0}}}})],Fe.prototype,"serviceItemId",void 0),e([y(E)],Fe.prototype,"useViewTime",null),Fe=e([f("esri.layers.SceneLayer")],Fe);const Se={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},_e={"mesh-pyramids":"mesh",points:"point"},Ae=Fe;export{Ae as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import r from"../PopupTemplate.js";import i from"../core/Clonable.js";import s from"../core/Collection.js";import o from"../core/Error.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as p,isAbortError as d}from"../core/promiseUtils.js";import{whenOnce as y}from"../core/reactiveUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{getProperties as c}from"../core/accessorSupport/utils.js";import{reader as h}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as m}from"../core/accessorSupport/PropertyOrigin.js";import g from"../geometry/Point.js";import v from"./Layer.js";import{NoModelError as b,MultipleModelsError as w}from"./graphics/sources/support/uploadAssetErrors.js";import{APIKeyMixin as I}from"./mixins/APIKeyMixin.js";import{ArcGISService as L}from"./mixins/ArcGISService.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as F}from"./mixins/EditBusLayer.js";import{OperationalLayer as S}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as A}from"./mixins/ScaleRangeLayer.js";import{SceneService as O,SaveOperationType as P}from"./mixins/SceneService.js";import{useViewTimeProperty as E}from"./mixins/TemporalLayer.js";import{TemporalSceneLayer as T}from"./mixins/TemporalSceneLayer.js";import{isHostedAgolService as x}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as D}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as U}from"./support/capabilities.js";import{elevationInfo as R,labelsVisible as q,legendEnabled as C,popupEnabled as G,attributeTableTemplate as N,screenSizePerspectiveEnabled as Q}from"./support/commonProperties.js";import{getFieldDomain as V,computeEffectiveEditingEnabled as M,getGlobalIdToObjectIdMap as k}from"./support/featureLayerUtils.js";import{FeatureReduction as K}from"./support/FeatureReduction.js";import $ from"./support/FeatureReductionSelection.js";import{defineFieldProperties as H}from"./support/fieldProperties.js";import z from"./support/FieldsIndex.js";import{fixRendererFields as W,unpackFieldNames as Z}from"./support/fieldUtils.js";import{I3SNodePageDefinition as B,I3SMaterialDefinition as J,I3STextureSetDefinition as X,I3SGeometryDefinition as Y}from"./support/I3SLayerDefinitions.js";import{isFileEditFormat as ee,isFileSupported as te}from"./support/infoFor3D.js";import re from"./support/LabelClass.js";import{reader as ie}from"./support/labelingInfo.js";import se from"./support/LayerFloorInfo.js";import{layerLookupMap as oe}from"./support/lazyLayerLoader.js";import{getMeshTransformForMetersToSpatialReference as ae}from"./support/meshSpatialReferenceScaleUtils.js";import{RangeInfo as ne}from"./support/RangeInfo.js";import le from"./support/SceneFilter.js";import{cacheIsOutOfSync as pe}from"./support/sceneLayerCacheUtils.js";import{fetchStatistics as de}from"./support/sceneLayerStatistics.js";import{loadStyleRenderer as ye}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as ue}from"../renderers/support/typeUtils.js";import ce from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as he,elevationModeUnsupportedMessage as fe,featureExpressionUnsupportedMessage as me}from"../support/elevationInfoUtils.js";import{createPopupTemplate as ge}from"../support/popupUtils.js";import{extractZipFiles as ve}from"../support/zipUtils.js";import{queryAttributesFromCachedAttributesId as be}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as we,getFetchPopupTemplate as Ie}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as Le}from"../webdoc/support/opacityUtils.js";const je=new Set(["3DObject","Point"]),Fe=H();let Se=class extends(T(F(O(L(S(_(A(l(j(I(i.ClonableMixin(v)))))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new s,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.attributeTableTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._set("renderer",null),this.associatedLayer=n(this.associatedLayer)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getField(e)?.domain??null;return this.associatedLayer?V(this.associatedLayer,e,t,r):r}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new z(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:B.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return null!=this.associatedLayer&&M(this.associatedLayer)}get geometryType(){return Ae[this.profile]||"mesh"}set renderer(e){W(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e=null!=e?e:U;const{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:a,supportsReturnServiceEditsInSourceSpatialReference:n},data:{supportsZ:l,supportsM:p,isVersioned:d,supportsAttachment:y},operations:{supportsEditing:u,supportsAdd:c,supportsUpdate:h,supportsDelete:f,supportsQuery:m,supportsQueryAttachments:g,supportsAsyncConvert3D:v}}=e,b=e.operations.supportsChangeTracking,w=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsReturnServiceEditsInSourceSpatialReference:n,supportsRollbackOnFailure:s,supportsGeometryUpdate:w&&a,supportsUploadWithItemId:o},data:{supportsAttachment:y,supportsZ:l,supportsM:p,isVersioned:d},operations:{supportsQuery:m,supportsQueryAttachments:g,supportsEditing:u&&b,supportsAdd:w&&c&&b,supportsDelete:w&&f&&b,supportsUpdate:h&&b,supportsAsyncConvert3D:v}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e))),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e))),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&_e[r]?_e[r]:(a.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override("useViewTime",e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const t=null!=e?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(p),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await ye(this,{origin:"service"},t),W(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){a.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new ce;return"mesh"===this.geometryType?this.capabilities.query.supportsReturnMesh&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e}))}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){const r=Z(this.fieldsIndex,await we(this,Ie(this)));return be(this.parsedUrl?.path??"",this.attributeStorageInfo??[],e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,r){const i=await this.queryCachedAttributes(e,[r]);if(!i||0===i.length)throw new o("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const s=new t;return s.attributes=i[0],s.layer=this,s.sourceLayer=this,s}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryObjectIds(e||this.createQuery(),t)))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryAttachments(e,t)))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(a.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return ge(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new o("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some((t=>t.name===e))}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(P.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(P.SAVE,e)}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");let i=t;await this.load();const s=this.associatedLayer;if(!s)throw new o(`${this.type}-layer:not-editable`,"Service is not editable");await s.load();const{globalIdField:a}=s,n=!!s.infoFor3D,l=i?.globalIdUsed??!0;if(n&&null==a)throw new o(`${this.type}-layer:not-editable`,"Valid globalIdField expected on editable SceneLayer");if(n&&!l)throw new o(`${this.type}-layer:globalid-required`,"globalIdUsed must not be false for SceneLayer editing as globalIds are required.");return x(s.url)&&n&&null!=e.deleteFeatures&&null!=a&&(i={...i,globalIdToObjectId:await k(s,e.deleteFeatures,a)}),r(this,s.source,e,i)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new o(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}on(e,t){return super.on(e,t)}async convertMesh(e,t){t??={};const r=e=>{throw a.getLogger(this).error(".convertMesh()",e.message),e};await this.load(),this.infoFor3D||r(new o("invalid:layer","SceneLayer has no capability for mesh conversion"));const i=await this.extractAndFilterFiles(e),s=i.reduce(((e,t)=>ee(this.infoFor3D,t)?e+1:e),0);0===s&&r(new b),s>1&&r(new w);const n=this.spatialReference,l=t.location??new g({x:0,y:0,z:0,spatialReference:n}),p=l.spatialReference.isGeographic?"local":"georeferenced",{default:d}=await import("../geometry/Mesh.js"),y=d.createWithExternalSource(l,i,{vertexSpace:p,transform:ae(l.spatialReference),unitConversionDisabled:!0}),[u]=await this.uploadAssets([y],{...t,useAssetOrigin:!t.location});return u}async extractAndFilterFiles(e){await this.load();const t=this.infoFor3D;if(!t)return e;return(await ve(e)).filter((e=>te(t,e)))}validateLayer(e){if(e.layerType&&!je.has(e.layerType))throw new o("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new o("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new o("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});function t(e,t){let r=!1,i=!1;if(null==e)r=!0,i=!0;else{const s=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,i=s;break;case"vertex-reference-frame":r=!0,i=!s;break;default:r=!1}}if(!r)throw new o("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!i)throw new o("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}t(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new o("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!!this.attributeStorageInfo?.some((t=>t.name===e.name)),r=!!this.associatedLayer?.fields?.some((t=>t&&e.name===t.name)),i={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=i}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPropertyOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPropertyOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled","attributeTableTemplate"],t=c(this);for(let r=0;r<e.length;r++){const i=e[r],s=this.originIdOf(i),o=this.associatedLayer.originIdOf(i);s<o&&(o===m.SERVICE||o===m.PORTAL_ITEM)&&t.setAtOrigin(i,this.associatedLayer[i],o)}}_applyAssociatedLayerExtentOverride(){const e=this.associatedLayer?.getAtOrigin("fullExtent","service");if(null==this.associatedLayer?.infoFor3D||!e||!x(this.associatedLayer?.url)||!pe(this))return;c(this).setAtOrigin("fullExtent",e.clone(),m.SERVICE)}_applyAssociatedLayerPrivileges(){const e=this.associatedLayer;e&&(this._set("userHasEditingPrivileges",e.userHasEditingPrivileges),this._set("userHasFullEditingPrivileges",e.userHasFullEditingPrivileges),this._set("userHasUpdateItemPrivileges",e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if(["mesh-pyramids","points"].includes(this.profile))try{const{serverUrl:t,layerId:r,portalItem:i}=await D(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),s=await oe.FeatureLayer();this.associatedLayer=new s({url:t,customParameters:this.customParameters,layerId:r,portalItem:i}),await this.associatedLayer.load()}catch(t){d(t)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){await y((()=>this.popupEnabled&&null!=this.popupTemplate));const e=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?a.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):a.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${e}`)}_validateElevationInfo(){const e=this.elevationInfo;"mesh-pyramids"===this.profile&&he(a.getLogger(this),fe("Mesh scene layers","relative-to-scene",e)),he(a.getLogger(this),me("Scene layers",e))}async fetchStatistics(e,t){return await de({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:"scenelayer",fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??"",customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}};e([u({types:{key:"type",base:K,typeMap:{selection:$}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],Se.prototype,"featureReduction",void 0),e([u({type:[ne],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],Se.prototype,"rangeInfos",void 0),e([u({json:{read:!1}})],Se.prototype,"associatedLayer",void 0),e([u({type:["show","hide"]})],Se.prototype,"listMode",void 0),e([u({type:["ArcGISSceneServiceLayer"]})],Se.prototype,"operationalLayerType",void 0),e([u({json:{read:!1},readOnly:!0})],Se.prototype,"type",void 0),e([u({...Fe.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Se.prototype,"fields",void 0),e([u()],Se.prototype,"types",null),e([u()],Se.prototype,"typeIdField",null),e([u()],Se.prototype,"templates",null),e([u()],Se.prototype,"formTemplate",null),e([u({readOnly:!0,clonable:!1})],Se.prototype,"fieldsIndex",null),e([u({type:se,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],Se.prototype,"floorInfo",void 0),e([u(Fe.outFields)],Se.prototype,"outFields",void 0),e([u({type:B,readOnly:!0,json:{read:!1}})],Se.prototype,"nodePages",void 0),e([h("service","nodePages",["nodePages","pointNodePages"])],Se.prototype,"readNodePages",null),e([u({type:[J],readOnly:!0})],Se.prototype,"materialDefinitions",void 0),e([u({type:[X],readOnly:!0})],Se.prototype,"textureSetDefinitions",void 0),e([u({type:[Y],readOnly:!0})],Se.prototype,"geometryDefinitions",void 0),e([u({readOnly:!0})],Se.prototype,"serviceUpdateTimeStamp",void 0),e([u({readOnly:!0})],Se.prototype,"attributeStorageInfo",void 0),e([u({readOnly:!0})],Se.prototype,"statisticsInfo",void 0),e([u({type:s.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],Se.prototype,"excludeObjectIds",void 0),e([u({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],Se.prototype,"definitionExpression",void 0),e([u({type:le,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],Se.prototype,"filter",void 0),e([u({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Se.prototype,"path",void 0),e([u(R)],Se.prototype,"elevationInfo",null),e([u({readOnly:!0,json:{read:!1}})],Se.prototype,"effectiveCapabilities",null),e([u({readOnly:!0})],Se.prototype,"effectiveEditingEnabled",null),e([u({type:String})],Se.prototype,"geometryType",null),e([u(q)],Se.prototype,"labelsVisible",void 0),e([u({type:[re],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:ie},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:ie},write:!0}})],Se.prototype,"labelingInfo",void 0),e([u(C)],Se.prototype,"legendEnabled",void 0),e([u({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?Le(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],Se.prototype,"opacity",void 0),e([u({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Se.prototype,"priority",void 0),e([u({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Se.prototype,"semantic",void 0),e([u({types:ue,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],Se.prototype,"renderer",null),e([u({json:{read:!1}})],Se.prototype,"cachedDrawingInfo",void 0),e([h("service","cachedDrawingInfo")],Se.prototype,"readCachedDrawingInfo",null),e([u({readOnly:!0,json:{read:!1}})],Se.prototype,"capabilities",null),e([u({type:Boolean,json:{read:!1}})],Se.prototype,"editingEnabled",null),e([u({readOnly:!0,json:{write:!1,read:!1}})],Se.prototype,"infoFor3D",null),e([u({readOnly:!0,json:{write:!1,read:!1}})],Se.prototype,"relationships",null),e([u(G)],Se.prototype,"popupEnabled",void 0),e([u({type:r,json:{name:"popupInfo",write:!0}})],Se.prototype,"popupTemplate",void 0),e([u({readOnly:!0,json:{read:!1}})],Se.prototype,"defaultPopupTemplate",null),e([u(N)],Se.prototype,"attributeTableTemplate",void 0),e([u({type:String,json:{read:!1}})],Se.prototype,"objectIdField",void 0),e([h("service","objectIdField",["objectIdField","fields"])],Se.prototype,"readObjectIdField",null),e([u({type:String,json:{read:!1}})],Se.prototype,"globalIdField",void 0),e([h("service","globalIdField",["globalIdField","fields"])],Se.prototype,"readGlobalIdField",null),e([u({readOnly:!0,type:String,json:{read:!1}})],Se.prototype,"displayField",null),e([u({type:String,json:{read:!1}})],Se.prototype,"profile",void 0),e([h("service","profile",["store.profile"])],Se.prototype,"readProfile",null),e([u({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],Se.prototype,"normalReferenceFrame",void 0),e([u(Q)],Se.prototype,"screenSizePerspectiveEnabled",void 0),e([u({json:{read:!1,origins:{service:{read:!0}}}})],Se.prototype,"serviceItemId",void 0),e([u(E)],Se.prototype,"useViewTime",null),Se=e([f("esri.layers.SceneLayer")],Se);const _e={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},Ae={"mesh-pyramids":"mesh",points:"point"},Oe=Se;export{Oe 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{createTask as e}from"../../../core/asyncUtils.js";import t from"../../../core/Error.js";import r from"../../../core/Logger.js";import{throwIfAborted as
|
|
5
|
+
import{createTask as e}from"../../../core/asyncUtils.js";import t from"../../../core/Error.js";import r from"../../../core/Logger.js";import{clamp as a}from"../../../core/mathUtils.js";import{throwIfAborted as s,isAbortError as o}from"../../../core/promiseUtils.js";import n from"../../../core/Warning.js";import{equals as i}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as u,convertToGeometry as l}from"../featureConversionUtils.js";import{executeQueryForSnapping as c}from"../data/executeQueryForSnapping.js";import h from"../data/FeatureStore.js";import{checkProjectionSupport as m,project as p}from"../data/projectionSupport.js";import{QueryEngine as d}from"../data/QueryEngine.js";import{validateGeoJSON as g,createOptimizedFeatures as f}from"./geojson/geojson.js";import{mixAttributes as y}from"./support/sourceUtils.js";import{getGetFeatureSpatialReference as _,getFeatureCount as x,getFeature as C}from"../../ogc/wfsUtils.js";import w from"../../support/FieldsIndex.js";import{isNumber as R}from"../../../support/guards.js";import{utc as F}from"../../../time/constants.js";const S="esri.layers.WFSLayer";class j{constructor(){this._customParameters=null,this._queryEngine=null,this._supportsPagination=!0}destroy(){this._queryEngine?.destroy(),this._queryEngine=null}async load(e,r={}){const{getFeatureUrl:a,getFeatureOutputFormat:o,fields:n,geometryType:i,featureType:u,maxRecordCount:l,maxTotalRecordCount:c,maxPageCount:p,objectIdField:g,customParameters:f}=e,{spatialReference:y,getFeatureSpatialReference:x}=_(a,u,e.spatialReference);try{await m(x,y)}catch{throw new t("unsupported-projection","Projection not supported",{inSpatialReference:x,outSpatialReference:y})}s(r),this._customParameters=f,this._featureType=u,this._fieldsIndex=w.fromLayerJSON({fields:n,dateFieldsTimeReference:n.some((e=>"esriFieldTypeDate"===e.type))?{timeZoneIANA:F}:null}),this._geometryType=i,this._getFeatureUrl=a,this._getFeatureOutputFormat=o,this._getFeatureSpatialReference=x,this._maxRecordCount=l,this._maxTotalRecordCount=c,this._maxPageCount=p,this._objectIdField=g,this._spatialReference=y;let C=await this._snapshotFeatures(r);if(C.errors.length>0&&(this._supportsPagination=!1,C=await this._snapshotFeatures(r),C.errors.length>0))throw C.errors[0];return this._queryEngine=new d({fieldsIndex:this._fieldsIndex,geometryType:i,hasM:!1,hasZ:!1,objectIdField:g,spatialReference:y,timeInfo:null,featureStore:new h({geometryType:i,hasM:!1,hasZ:!1})}),this._queryEngine.featureStore.addMany(C.features),{warnings:q(C),extent:(await this._queryEngine.fetchRecomputedExtents()).fullExtent}}async applyEdits(){throw new t("wfs-source:editing-not-supported","applyEdits() is not supported on WFSLayer")}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){await this._waitSnapshotComplete();return(await this._queryEngine.executeQueryForIds(e,t.signal)).filter(R)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),c(this._queryEngine,e,t.signal)}async queryAttributeBins(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeAttributeBinsQuery(e,t.signal)}async refresh(t){return this._customParameters=t.customParameters,this._maxRecordCount=t.maxRecordCount,this._maxTotalRecordCount=t.maxTotalRecordCount,this._maxPageCount=t.maxPageCount,this._snapshotTask?.abort(),this._snapshotTask=e((e=>this._snapshotFeatures({signal:e}))),this._snapshotTask.promise.then((e=>{this._queryEngine.featureStore.clear(),this._queryEngine.featureStore.addMany(e.features);for(const t of q(e))r.getLogger(S).warn(new n("wfs-layer:refresh-warning",t.message,t.details));e.errors?.length&&r.getLogger(S).warn(new n("wfs-layer:refresh-error","Refresh completed with errors",{errors:e.errors}))}),(()=>{this._queryEngine.featureStore.clear()})),await this._waitSnapshotComplete(),{extent:(await this._queryEngine.fetchRecomputedExtents()).fullExtent}}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _snapshotFeatures(e){const t=e?.signal,r=this._maxTotalRecordCount,n=this._maxPageCount,i=this._supportsPagination&&n>1?await x(this._getFeatureUrl,this._featureType.typeName,{customParameters:this._customParameters,signal:t}):void 0;let u=[];const l=[];if(null==i)try{u=await this._singleQuery(t)}catch(c){o(c)||l.push(c)}else{const e=Math.min(i,r),s=T(this,a(Math.ceil(e/this._maxRecordCount),1,n),t);await Promise.allSettled(Array.from({length:10}).map((()=>E(s,u,l))))}return s(t),{features:u,totalRecordCount:i,maxTotalRecordCount:r,maxPageCount:n,errors:l}}async _singleQuery(e){const t=Number.isFinite(this._maxRecordCount)&&this._maxRecordCount>0?this._maxRecordCount:void 0,r=await C(this._getFeatureUrl,this._featureType.typeName,this._getFeatureSpatialReference,this._getFeatureOutputFormat,{customParameters:this._customParameters,count:t,signal:e});return this._processGeoJSON(r,{signal:e})}async _pageQuery(e,t){const r=e*this._maxRecordCount,a=await C(this._getFeatureUrl,this._featureType.typeName,this._getFeatureSpatialReference,this._getFeatureOutputFormat,{customParameters:this._customParameters,startIndex:r,count:this._maxRecordCount,signal:t});return this._processGeoJSON(a,{startIndex:r,signal:t})}_processGeoJSON(e,t){g(e,this._getFeatureSpatialReference.wkid);const{startIndex:r,signal:a}=t;s(a);const o=f(e,{geometryType:this._geometryType,hasZ:!1,objectIdField:this._objectIdField});if(!i(this._spatialReference,this._getFeatureSpatialReference))for(const s of o)null!=s.geometry&&(s.geometry=u(p(l(s.geometry,this._geometryType,!1,!1),this._getFeatureSpatialReference,this._spatialReference)));let n=r??1;for(const s of o){const e={};y(this._fieldsIndex,e,s.attributes,!0),s.attributes=e,null==e[this._objectIdField]&&(s.objectId=e[this._objectIdField]=n++)}return o}}function*T(e,t,r){for(let a=0;a<t;a++)yield e._pageQuery(a,r)}async function E(e,t,r){let a=e.next();for(;!a.done;){try{const e=await a.value;t.push(...e)}catch(s){o(s)||r.push(s)}a=e.next()}}function q(e){const t=[];return null!=e.totalRecordCount&&(e.features.length<e.totalRecordCount&&t.push({name:"wfs-layer:maxRecordCount-too-low",message:`Could only fetch ${e.features.length} of ${e.totalRecordCount} in ${e.maxPageCount} queries. Try increasing the value of WFSLayer.maxRecordCount.`,details:{recordCount:e.features.length,totalRecordCount:e.totalRecordCount}}),e.totalRecordCount>e.maxTotalRecordCount&&t.push({name:"wfs-layer:large-dataset",message:`The number of ${e.totalRecordCount} features exceeds the maximum allowed of ${e.maxTotalRecordCount}.`,details:{recordCount:e.features.length,totalRecordCount:e.totalRecordCount,maxTotalRecordCount:e.maxTotalRecordCount}})),t}export{j as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{excludeTables as e}from"../../core/accessorSupport/layerContainerType.js";import r from"../../geometry/Extent.js";import n from"../../geometry/SpatialReference.js";import{w as i}from"../../chunks/persistableUrlUtils.js";import a from"../../symbols/support/ElevationInfo.js";import o from"../../tables/AttributeTableTemplate.js";import{transparencyToOpacity as t}from"../../webdoc/support/opacityUtils.js";const s={type:Boolean,value:!0,json:{origins:{service:{read:!1,write:!1},"web-map":{read:!1,write:!1}},name:"screenSizePerspective",write:{enabled:!0,layerContainerTypes:e}}},l={type:Boolean,value:!0,json:{name:"disablePopup",read:{reader:(e,r)=>!r.disablePopup},write:{enabled:!0,writer(e,r,n){r[n]=!e}}}},p={type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",write:{enabled:!0,layerContainerTypes:e}}},y={type:String,json:{origins:{"portal-item":{write:!1}},write:{isRequired:!0,ignoreOrigin:!0,writer:i}}},d={type:Boolean,value:!0,nonNullable:!0,json:{origins:{service:{read:{enabled:!1}}},name:"showLegend",write:{enabled:!0,layerContainerTypes:e}}},
|
|
5
|
+
import{excludeTables as e}from"../../core/accessorSupport/layerContainerType.js";import r from"../../geometry/Extent.js";import n from"../../geometry/SpatialReference.js";import{w as i}from"../../chunks/persistableUrlUtils.js";import a from"../../symbols/support/ElevationInfo.js";import o from"../../tables/AttributeTableTemplate.js";import{transparencyToOpacity as t}from"../../webdoc/support/opacityUtils.js";const s={type:Boolean,value:!0,json:{origins:{service:{read:!1,write:!1},"web-map":{read:!1,write:!1}},name:"screenSizePerspective",write:{enabled:!0,layerContainerTypes:e}}},l={type:Boolean,value:!0,json:{name:"disablePopup",read:{reader:(e,r)=>!r.disablePopup},write:{enabled:!0,writer(e,r,n){r[n]=!e}}}},p={type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",write:{enabled:!0,layerContainerTypes:e}}},y={type:String,json:{origins:{"portal-item":{write:!1}},write:{isRequired:!0,ignoreOrigin:!0,writer:i}}},d={type:Boolean,value:!0,nonNullable:!0,json:{origins:{service:{read:{enabled:!1}}},name:"showLegend",write:{enabled:!0,layerContainerTypes:e}}},m={value:null,type:a,json:{origins:{service:{name:"elevationInfo",write:!0}},name:"layerDefinition.elevationInfo",write:{enabled:!0,layerContainerTypes:e}}};function c(e){return{type:e,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}}}const f={write:{enabled:!0,layerContainerTypes:e},read:!0},w={type:Number,json:{origins:{"web-document":f,"portal-item":{write:{layerContainerTypes:e}}}}},b={...w,json:{...w.json,origins:{"web-document":{...f,write:{enabled:!0,layerContainerTypes:e,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}}}},read:{source:["layerDefinition.drawingInfo.transparency","drawingInfo.transparency"],reader:(e,r,n)=>n&&"service"!==n.origin||!r.drawingInfo||void 0===r.drawingInfo.transparency?r.layerDefinition?.drawingInfo&&void 0!==r.layerDefinition.drawingInfo.transparency?t(r.layerDefinition.drawingInfo.transparency):void 0:t(r.drawingInfo.transparency)}}},g={type:r,readOnly:!0,json:{origins:{service:{read:{source:["fullExtent","spatialReference"],reader:(e,i)=>{const a=r.fromJSON(e);return null!=i.spatialReference&&"object"==typeof i.spatialReference&&(a.spatialReference=n.fromJSON(i.spatialReference)),a}}}},read:!1}},u={type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}}}},j={type:Number,json:{origins:{service:{write:{enabled:!1}}},name:"layerDefinition.minScale",write:{layerContainerTypes:e}}},v={type:Number,json:{origins:{service:{write:{enabled:!1}}},name:"layerDefinition.maxScale",write:{layerContainerTypes:e}}},T={json:{write:{ignoreOrigin:!0,layerContainerTypes:e},origins:{"web-map":{read:!1,write:!1}}}},I={type:o,json:{name:"attributeTableInfo",write:!0}};export{I as attributeTableTemplate,m as elevationInfo,u as id,p as labelsVisible,d as legendEnabled,T as listMode,v as maxScale,j as minScale,w as opacity,b as opacityDrawingInfo,l as popupEnabled,c as readOnlyService,g as sceneLayerFullExtent,s as screenSizePerspectiveEnabled,y as url};
|
package/networks/RulesTable.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/JSONSupport.js";import o from"../core/Loadable.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 u}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as a,isFeatureLayer as n}from"../layers/support/layerUtils.js";import{RuleType as i}from"./support/typeUtils.js";let d=class extends(t.JSONSupportMixin(o)){constructor(e){super(e),this.rulesCategorized={attachment:[],containment:[],connectivity:[]},this.request=r}initialize(){}async load(e){const r=this.rulesLayer.load(e).then((()=>this._initializeRulesTable()));return this.addResolvingPromise(r),this}getFeaturesCanAssociateWithClause(e,r,t){return this._getWhereClauseForCompatibleFeatures(e,r,t)}getFeaturesCanAssociateWith(e,r,t){return null==this._getFeatureSourceLayerId(e)?[]:r.filter((r=>this.canAssociateFeatures(e,r,t)))}canAssociateFeatures(e,r,t){const[o,s]=this._getFeatureAssetCodes(e),u=this._getFeatureSourceLayerId(e),[a,n]=this._getFeatureAssetCodes(r),i=this._getFeatureSourceLayerId(r);return null!=u&&null!=i&&t.some((e=>{const{type:r,direction:t}=e;return this._getRulesForAssociationType(r).some((e=>{const d=this._getRuleFieldValuesForAssociation(e,r,t);return d?.some((e=>u===e?.ruleLayerIdForSource&&o===e?.ruleAssetGroupCodeForSource&&s===e?.ruleAssetTypeCodeForSource&&i===e?.ruleLayerIdForTarget&&a===e?.ruleAssetGroupCodeForTarget&&n===e?.ruleAssetTypeCodeForTarget))}))}))}getLayersCanAssociateWith(e,r,t){return null==this._getFeatureSourceLayerId(e)?[]:r.filter((r=>this.canAssociateFeatureToLayer(e,r,t)))}canAssociateFeatureToLayer(e,r,t){const o=a(r)?r.parent:r;if(!o)return!1;const s=o.layerId,u=a(r)?r.subtypeCode:null,[n,i]=this._getFeatureAssetCodes(e),d=this._getFeatureSourceLayerId(e);return null!=d&&t.some((e=>{const{type:r,direction:t}=e;return this._getRulesForAssociationType(r).some((e=>{const o=this._getRuleFieldValuesForAssociation(e,r,t);return o?.some((e=>d===e?.ruleLayerIdForSource&&n===e?.ruleAssetGroupCodeForSource&&i===e?.ruleAssetTypeCodeForSource&&s===e?.ruleLayerIdForTarget&&(null==u||u===e?.ruleAssetGroupCodeForTarget)))}))}))}getFeatureSQL(e,r){const t=e.layerId.toString(),o=e.fieldsIndex?.normalizeFieldName("assetGroup"),s=e.fieldsIndex?.normalizeFieldName("assetType"),u=o?r.attributes[o]:null,a=s?r.attributes[s]:null,n=this.rulesHash[t];if(n){const e=n.assetGroupHash[u];if(e){return e.assetTypeHash[a]||null}}return null}async _initializeRulesTable(){const e={};let r;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(r||(r={}));const t=[{networkSourceId:"fromNetworkSource",assetGroupId:"fromAssetGroup",assetTypeId:"fromAssetType"},{networkSourceId:"toNetworkSource",assetGroupId:"toAssetGroup",assetTypeId:"toAssetType"},{networkSourceId:"viaNetworkSource",assetGroupId:"viaAssetGroup",assetTypeId:"viaAssetType"}];this.rulesCategorized={attachment:[],containment:[],connectivity:[]};for(const o of this.rules){if(o.ruleType===i.RTAttachment){this.rulesCategorized.attachment.push(o);continue}if(o.ruleType===i.RTContainment){this.rulesCategorized.containment.push(o);continue}if(o.ruleType===i.RTJunctionJunctionConnectivity){this.rulesCategorized.connectivity.push(o);continue}this.rulesCategorized.connectivity.push(o);let s=[[r.from,r.to],[r.to,r.from]];o.ruleType===i.RTEdgeJunctionEdgeConnectivity&&(s=[[r.from,r.via],[r.via,r.from],[r.to,r.via],[r.via,r.to]]);for(const u of s){const s=u.shift(),a=u.shift();let n=!1;switch(o.ruleType){case i.RTEdgeJunctionEdgeConnectivity:n=s===r.from||s===r.to;break;case i.RTJunctionEdgeConnectivity:n=s===r.to}const d=t[s],c=o[d.networkSourceId]?.layerId.toString()??"",l=o[d.assetGroupId]?.assetGroupCode?.toString(),p=o[d.assetTypeId],y=p?.assetTypeCode?.toString(),T=t[a],C=o[T.networkSourceId]?.layerId.toString()??"",A=o[T.assetGroupId]?.assetGroupCode?.toString(),F=o[T.assetTypeId],g=F?.assetTypeCode?.toString(),m=e[c]??{assetGroupHash:{}};if(!(l&&y&&A&&g))continue;const S=m.assetGroupHash[l]??{assetTypeHash:{}},f=S.assetTypeHash[y]??{};if(f[C]=f[C]??{},n){f[c]=f[c]??{};const e=`(assetgroup = ${l} AND assettype = ${y})`;"esriNECPEndVertex"===F?.connectivityPolicy?f[c].endVertex=f[c]?.endVertex?`${f[c].endVertex}`:`${e}`:f[c].anyVertex=f[c].anyVertex?`${f[c].anyVertex}`:`${e}`}const G=`(assetgroup = ${A} AND assettype = ${g})`;"esriNECPEndVertex"===F?.connectivityPolicy?f[C].endVertex=f[C]?.endVertex?`${f[C].endVertex} OR ${G}`:`${G}`:f[C].anyVertex=f[C]?.anyVertex?`${f[C].anyVertex} OR ${G}`:`${G}`,S.assetTypeHash[y]=f,m.assetGroupHash[l]=S,e[c]=m}}this._set("rulesHash",e)}_getRuleFieldValuesForAssociation(e,r,t="from"){switch(r){case"attachment":case"containment":return"from"===t?[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode}]:[{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];case"connectivity":case"junction-junction-connectivity":return[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":return e.ruleType===i.RTEdgeJunctionEdgeConnectivity?[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.viaAssetType?.assetTypeCode},{ruleLayerIdForSource:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.viaAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.viaAssetType?.assetTypeCode},{ruleLayerIdForSource:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.viaAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode}]:[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];default:return[]}}_getWhereClauseForCompatibleFeatures(e,r,t){const o=new Map,[s,u]=this._getAssetFieldNames(e.sourceLayer),[n,i]=this._getFeatureAssetCodes(e),d=this._getFeatureSourceLayerId(e),c=a(r)?r.parent:r,l=a(r)?r.subtypeCode:null;t.forEach((e=>{const{type:r,direction:t}=e;this._getRulesForAssociationType(r).forEach((e=>{this._getRuleFieldValuesForAssociation(e,r,t).forEach((e=>{if(null!=e.ruleAssetGroupCodeForTarget&&null!=e.ruleAssetTypeCodeForTarget&&d===e?.ruleLayerIdForSource&&n===e?.ruleAssetGroupCodeForSource&&i===e?.ruleAssetTypeCodeForSource&&c.layerId===e?.ruleLayerIdForTarget&&(null==l||l===e?.ruleAssetGroupCodeForTarget)){const r=o.get(e.ruleAssetGroupCodeForTarget)??new Set;r.add(e.ruleAssetTypeCodeForTarget),o.set(e.ruleAssetGroupCodeForTarget,r)}}))}))}));let p=[];return this._mergeAssetCodes(o).forEach(((e,r)=>p.push(`${s} IN (${r}) AND ${u} IN (${Array.from(e).sort().join(", ")})`))),p.length>1&&(p=p.map((e=>`(${e})`))),p.join(" OR ")}_getRulesForAssociationType(e){const{rulesCategorized:r}=this;switch(e){case"attachment":return r.attachment;case"containment":return r.containment;case"connectivity":case"junction-junction-connectivity":return r.connectivity.filter((e=>e.ruleType===i.RTJunctionJunctionConnectivity));case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":return r.connectivity.filter((e=>e.ruleType===i.RTJunctionEdgeConnectivity||e.ruleType===i.RTEdgeJunctionEdgeConnectivity));default:return[]}}_getFeatureSourceLayerId(e){const{sourceLayer:r}=e;let t;return n(r)?t=r.layerId:a(r)&&(t=r.parent?.layerId),t??null}_getAssetFieldNames(e){if(!e||!("fieldsIndex"in e))return[null,null];return[e.fieldsIndex.normalizeFieldName("assetGroup")??null,e.fieldsIndex.normalizeFieldName("assetType")??null]}_getFeatureAssetCodes(e){const[r,t]=this._getAssetFieldNames(e.sourceLayer);return[r?e.attributes[r]:null,t?e.attributes[t]:null]}_areSetsEqual(e,r){if(e.size!==r.size)return!1;for(const t of e)if(!r.has(t))return!1;return!0}_mergeAssetCodes(e){const r=new Map,t=new Set;for(const[o,s]of e){const u=new Set([o]);for(const[r,n]of e)o!==r&&!t.has(r)&&this._areSetsEqual(s,n)&&(u.add(r),t.add(r));const a=Array.from(u).sort().join(", ");r.set(a,s)}return r}};e([s({constructOnly:!0})],d.prototype,"rulesLayer",void 0),e([s({constructOnly:!0})],d.prototype,"rules",void 0),e([s({readOnly:!0})],d.prototype,"rulesHash",void 0),e([s()],d.prototype,"rulesCategorized",void 0),e([s({constructOnly:!0})],d.prototype,"request",void 0),d=e([u("esri.networks.RulesTable")],d);const c=d;export{c as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import s from"../core/JSONSupport.js";import o from"../core/Loadable.js";import{sqlIn as r,sqlOr as n,sqlAnd as i}from"../core/sql.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 c}from"../core/accessorSupport/decorators/subclass.js";import{RuleType as u}from"./support/typeUtils.js";import{getAssetFieldNames as p,getRuleValues as l,getCompatibleRuleElements as d,getFeatureSourceLayerId as y,doesRuleAllowAssociation as h}from"./support/utils.js";import{isGraphic as f}from"../support/guards.js";let m=class extends(s.JSONSupportMixin(o)){constructor(e){super(e),this.rulesCategorized={attachment:[],containment:[],connectivity:[]},this.request=t}initialize(){}async load(e){const t=this.rulesLayer.load(e).then((()=>this._initializeRulesTable()));return this.addResolvingPromise(t),this}getFeaturesCanAssociateWithClause(e,t,s){const o=new Map,[n,a]=p(e.sourceLayer);if(!n||!a)return"";const c=l(e),u=l(t);s.forEach((e=>{const{type:t,direction:s}=e;this._getRulesForAssociationType(t).forEach((e=>{d(e,c,s).filter((e=>e.networkSource?.layerId===u.layerId)).forEach((e=>{const t=e.assetGroup?.assetGroupCode,s=e.assetType?.assetTypeCode;if(null!=t&&null!=s){const e=o.get(t)??new Set;e.add(s),o.set(t,e)}}))}))}));let y=[];return this._mergeAssetCodes(o).forEach(((e,t)=>{const s=`${n} IN (${t})`,o=r(a,[...e]);s&&o&&y.push(i(s,o))})),y.length>1&&(y=y.map((e=>`(${e})`))),y.join(" OR ")}getFeaturesCanAssociateWith(e,t,s){return null==y(e)?[]:t.filter((t=>this.canAssociateFeatures(e,t,s)))}canAssociateFeatures(e,t,s){if(!this._canSupportAssociations([e,t]))return!1;const o=l(e),r=l(t);return s.some((e=>{const{type:t,direction:s}=e;return this._getRulesForAssociationType(t).some((e=>"to"===s?h(e,r,o):h(e,o,r)))}))}getLayersCanAssociateWith(e,t,s){return null==y(e)?[]:t.filter((t=>this.canAssociateFeatureToLayer(e,t,s)))}canAssociateFeatureToLayer(e,t,s){if(!this._canSupportAssociations([e,t]))return!1;const o=l(e),r=l(t);return s.some((e=>{const{type:t,direction:s}=e;return this._getRulesForAssociationType(t).some((e=>"to"===s?h(e,r,o):h(e,o,r)))}))}getFeatureSQL(e,t){const s=e.layerId.toString(),o=e.fieldsIndex?.normalizeFieldName("assetGroup"),r=e.fieldsIndex?.normalizeFieldName("assetType"),n=o?t.attributes[o]:null,i=r?t.attributes[r]:null,a=this.rulesHash[s];if(a){const e=a.assetGroupHash[n];if(e){return e.assetTypeHash[i]||null}}return null}async _initializeRulesTable(){const e={};let t;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(t||(t={}));const s=[{networkSourceId:"fromNetworkSource",assetGroupId:"fromAssetGroup",assetTypeId:"fromAssetType"},{networkSourceId:"toNetworkSource",assetGroupId:"toAssetGroup",assetTypeId:"toAssetType"},{networkSourceId:"viaNetworkSource",assetGroupId:"viaAssetGroup",assetTypeId:"viaAssetType"}];this.rulesCategorized={attachment:[],containment:[],connectivity:[]};for(const o of this.rules){if(o.ruleType===u.RTAttachment){this.rulesCategorized.attachment.push(o);continue}if(o.ruleType===u.RTContainment){this.rulesCategorized.containment.push(o);continue}if(o.ruleType===u.RTJunctionJunctionConnectivity){this.rulesCategorized.connectivity.push(o);continue}this.rulesCategorized.connectivity.push(o);let r=[[t.from,t.to],[t.to,t.from]];o.ruleType===u.RTEdgeJunctionEdgeConnectivity&&(r=[[t.from,t.via],[t.via,t.from],[t.to,t.via],[t.via,t.to]]);for(const a of r){const r=a.shift(),c=a.shift();let p=!1;switch(o.ruleType){case u.RTEdgeJunctionEdgeConnectivity:p=r===t.from||r===t.to;break;case u.RTJunctionEdgeConnectivity:p=r===t.to}const l=s[r],d=o[l.networkSourceId]?.layerId.toString()??"",y=o[l.assetGroupId]?.assetGroupCode?.toString(),h=o[l.assetTypeId],f=h?.assetTypeCode?.toString(),m=s[c],g=o[m.networkSourceId]?.layerId.toString()??"",T=o[m.assetGroupId]?.assetGroupCode?.toString(),v=o[m.assetTypeId],C=v?.assetTypeCode?.toString(),S=e[d]??{assetGroupHash:{}};if(!(y&&f&&T&&C))continue;const A=S.assetGroupHash[y]??{assetTypeHash:{}},I=A.assetTypeHash[f]??{};if(I[g]=I[g]??{},p){I[d]=I[d]??{};const e=i(`assetgroup = ${y}`,`assettype = ${f}`);"esriNECPEndVertex"===v?.connectivityPolicy?I[d].endVertex=I[d]?.endVertex?`${I[d].endVertex}`:`(${e})`:I[d].anyVertex=I[d].anyVertex?`${I[d].anyVertex}`:`(${e})`}const j=i(`assetgroup = ${T}`,`assettype = ${C}`);"esriNECPEndVertex"===v?.connectivityPolicy?I[g].endVertex=I[g]?.endVertex?n(I[g].endVertex,j):`(${j})`:I[g].anyVertex=I[g]?.anyVertex?n(I[g].anyVertex,j):`(${j})`,A.assetTypeHash[f]=I,S.assetGroupHash[y]=A,e[d]=S}}this._set("rulesHash",e)}_getRulesForAssociationType(e){const{rulesCategorized:t}=this;switch(e){case"attachment":return t.attachment;case"containment":return t.containment;case"connectivity":case"junction-junction-connectivity":return t.connectivity.filter((e=>e.ruleType===u.RTJunctionJunctionConnectivity));case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":return t.connectivity.filter((e=>e.ruleType===u.RTJunctionEdgeConnectivity||e.ruleType===u.RTEdgeJunctionEdgeConnectivity));default:return[]}}_areSetsEqual(e,t){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}_mergeAssetCodes(e){const t=new Map,s=new Set;for(const[o,r]of e){const n=new Set([o]);for(const[t,a]of e)o!==t&&!s.has(t)&&this._areSetsEqual(r,a)&&(n.add(t),s.add(t));const i=Array.from(n).sort().join(",");t.set(i,r)}return t}_canSupportAssociations(e){return e.every((e=>{const t=f(e)?e.sourceLayer:e,[s,o]=p(t);return null!=s&&null!=o}))}};e([a({constructOnly:!0})],m.prototype,"rulesLayer",void 0),e([a({constructOnly:!0})],m.prototype,"rules",void 0),e([a({readOnly:!0})],m.prototype,"rulesHash",void 0),e([a()],m.prototype,"rulesCategorized",void 0),e([a({constructOnly:!0})],m.prototype,"request",void 0),m=e([c("esri.networks.RulesTable")],m);const g=m;export{g 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import i from"./Network.js";import n from"./RulesTable.js";import l from"./support/NamedTraceConfiguration.js";import{getAssociationsTableFields as u}from"./support/networkFieldUtils.js";import m from"./support/NetworkSystemLayers.js";import d from"./support/TerminalConfiguration.js";import c from"./support/TraceJobInfo.js";import{RuleType as y,AssociationTypeEnum as p}from"./support/typeUtils.js";import f from"../rest/support/Query.js";let I=class extends i{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._terminalById=new Map}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=>d.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t?.edgeSources?.map((({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}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const a=e.attributes;if(null==a)return null;for(const l of Object.keys(a))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let i=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find((e=>e.layerId===o));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){i=e.terminalConfigurationId;break}}}}if(null!=i){const e=this.dataElement.terminalConfigurations,t=e?.find((e=>e.terminalConfigurationId===i));return t?d.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(){return this._sharedRulesTable||(this._sharedRulesTable=this._createRulesTable()),await this._sharedRulesTable}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")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,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 o=await t(this.networkServiceUrl,s);return new c({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;await t.load();const r=(e,t)=>e?1===e.terminalId?!t?.terminalId||t?.terminalId===e.terminalId:e.terminalId===t?.terminalId:!t?.terminalId,s=e=>({fromRuleElement:{networkSource:e.fromNetworkSource,assetGroup:e.fromAssetGroup,assetType:e.fromAssetType,terminal:e.fromTerminal},viaRuleElement:e.viaNetworkSource?{networkSource:e.viaNetworkSource,assetGroup:e.viaAssetGroup,assetType:e.viaAssetType,terminal:e.viaTerminal}:void 0,toRuleElement:{networkSource:e.toNetworkSource,assetGroup:e.toAssetGroup,assetType:e.toAssetType,terminal:e.toTerminal}}),o=(e,t,s=!0)=>e.networkSource?.sourceId===t.networkSourceId&&e.assetGroup?.assetGroupCode===t.assetGroupCode&&e.assetType?.assetTypeCode===t.assetTypeCode&&(!s||r(e.terminal,t)),a=(e,t)=>{const{fromRuleElement:r,toRuleElement:a}=s(e);return o(r,t.fromNetworkElement,!1)&&o(a,t.toNetworkElement,!1)},i=(e,t)=>{const{fromRuleElement:r,toRuleElement:a}=s(e);return o(r,t.fromNetworkElement)&&o(a,t.toNetworkElement)||o(r,t.toNetworkElement)&&o(a,t.fromNetworkElement)},n=(e,t)=>{const{fromRuleElement:r,toRuleElement:a,viaRuleElement:i}=s(e);return o(r,t.fromNetworkElement)&&o(i,t.toNetworkElement)||o(r,t.toNetworkElement)&&o(i,t.fromNetworkElement)||o(i,t.fromNetworkElement)&&o(a,t.toNetworkElement)||o(i,t.toNetworkElement)&&o(a,t.fromNetworkElement)};if("containment"===e.associationType){return t.rulesCategorized.containment.some((t=>a(t,e)))}if("attachment"===e.associationType){return t.rulesCategorized.attachment.some((t=>a(t,e)))}return t.rulesCategorized.connectivity.some((t=>t.ruleType===y.RTEdgeJunctionEdgeConnectivity?n(t,e):i(t,e)))}generateAddAssociations(e){const{associationsTable:r}=this.networkSystemLayers,{fromNetworkSourceId:s,fromGlobalId:o,fromTerminalId:a,toNetworkSourceId:i,toGlobalId:n,toTerminalId:l,associationType:m,isContentVisible:d,percentAlong:c,globalId:y}=u(r);return{addFeatures:e.map((e=>new t({attributes:{[s]:e.fromNetworkElement?.networkSourceId,[o]:e.fromNetworkElement?.globalId,[a]:e.fromNetworkElement?.terminalId,[i]:e.toNetworkElement?.networkSourceId,[n]:e.toNetworkElement?.globalId,[l]:e.toNetworkElement?.terminalId,[m]:p[e.associationType],[d]: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"})}}}async _createRulesTable(){const e=this.networkSystemLayers.rulesTableUrl,t=new o({url:e});await t.load();const r=this.dataElement?.domainNetworks;if(!r)return null;const s=r.flatMap((e=>[...e.edgeSources||[],...e.junctionSources||[]])),a=(await T(t)).map((e=>this._hydrateRuleInfo(t,s,e)));return new n({rulesLayer:t,rules:a})}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),a=s.get("CREATIONDATE"),i=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),m=s.get("TONETWORKSOURCEID"),d=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),p=s.get("TOTERMINALID"),f=s.get("VIANETWORKSOURCEID"),I=s.get("VIAASSETGROUP"),T=s.get("VIAASSETTYPE"),h=s.get("VIATERMINALID"),w=r.attributes[o.name],b=new Date(r.attributes[a.name]),g=[{networkSourceId:r.attributes[i.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[m.name],assetGroupId:r.attributes[d.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[p.name]},{networkSourceId:r.attributes[f.name],assetGroupId:r.attributes[I.name],assetTypeId:r.attributes[T.name],terminalId:r.attributes[h.name]}];let k;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(k||(k={}));const S={ruleType:w,creationDate:b};for(const N of[k.from,k.to,k.via]){if(w!==y.RTEdgeJunctionEdgeConnectivity&&N===k.via)continue;const e=g[N],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),o=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId)),a=this._getTerminal(o,e);let i="";switch(N){case k.from:i="from";break;case k.to:i="to";break;case k.via:i="via"}S[`${i}NetworkSource`]=r,S[`${i}AssetGroup`]=s,S[`${i}AssetType`]=o,S[`${i}Terminal`]=a?.toJSON()}return S}_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 function T(e){const t=new f({where:"1=1",outFields:["*"]});return(await a(e,t)).features}e([r({type:[l],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],I.prototype,"sharedNamedTraceConfigurations",void 0),e([r({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],I.prototype,"type",void 0),e([r({readOnly:!0})],I.prototype,"serviceTerritoryFeatureLayerId",null),e([r({readOnly:!0})],I.prototype,"networkSystemLayers",null),e([r({readOnly:!0})],I.prototype,"terminalConfigurations",null),e([r({readOnly:!0})],I.prototype,"domainNetworkNames",null),I=e([s("esri.networks.UtilityNetwork")],I);const h=I;export{h as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import i from"./Network.js";import n from"./RulesTable.js";import l from"./support/NamedTraceConfiguration.js";import{getAssociationsTableFields as u}from"./support/networkFieldUtils.js";import d from"./support/NetworkSystemLayers.js";import m from"./support/TerminalConfiguration.js";import c from"./support/TraceJobInfo.js";import{AssociationTypeEnum as y,RuleType as p}from"./support/typeUtils.js";import{doesRuleAllowAssociation as f}from"./support/utils.js";import h from"../rest/support/Query.js";let I=class extends i{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._terminalById=new Map}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new d({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=>m.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t?.edgeSources?.map((({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}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const a=e.attributes;if(null==a)return null;for(const l of Object.keys(a))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let i=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find((e=>e.layerId===o));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){i=e.terminalConfigurationId;break}}}}if(null!=i){const e=this.dataElement.terminalConfigurations,t=e?.find((e=>e.terminalConfigurationId===i));return t?m.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(){return this._sharedRulesTable||(this._sharedRulesTable=this._createRulesTable()),await this._sharedRulesTable}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")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,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 o=await t(this.networkServiceUrl,s);return new c({statusUrl:o})}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 o=null;switch(e.associationType){case"containment":o=t.rulesCategorized.containment;break;case"attachment":o=t.rulesCategorized.attachment;break;default:o=t.rulesCategorized.connectivity}return o.some((e=>f(e,r,s)))}generateAddAssociations(e){const{associationsTable:r}=this.networkSystemLayers,{fromNetworkSourceId:s,fromGlobalId:o,fromTerminalId:a,toNetworkSourceId:i,toGlobalId:n,toTerminalId:l,associationType:d,isContentVisible:m,percentAlong:c,globalId:p}=u(r);return{addFeatures:e.map((e=>new t({attributes:{[s]:e.fromNetworkElement?.networkSourceId,[o]:e.fromNetworkElement?.globalId,[a]:e.fromNetworkElement?.terminalId,[i]:e.toNetworkElement?.networkSourceId,[n]:e.toNetworkElement?.globalId,[l]:e.toNetworkElement?.terminalId,[d]:y[e.associationType],[m]:null==e.isContentVisible?void 0:e.isContentVisible?1:0,[c]:e.percentAlong,[p]: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"})}}}async _createRulesTable(){const e=this.networkSystemLayers.rulesTableUrl,t=new o({url:e});await t.load();const r=this.dataElement?.domainNetworks;if(!r)return null;const s=r.flatMap((e=>[...e.edgeSources||[],...e.junctionSources||[]])),a=(await b(t)).map((e=>this._hydrateRuleInfo(t,s,e)));return new n({rulesLayer:t,rules:a})}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),a=s.get("CREATIONDATE"),i=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"),f=s.get("VIANETWORKSOURCEID"),h=s.get("VIAASSETGROUP"),I=s.get("VIAASSETTYPE"),b=s.get("VIATERMINALID"),g=r.attributes[o.name],T=new Date(r.attributes[a.name]),w=[{networkSourceId:r.attributes[i.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[f.name],assetGroupId:r.attributes[h.name],assetTypeId:r.attributes[I.name],terminalId:r.attributes[b.name]}];let S;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(S||(S={}));const k={ruleType:g,creationDate:T};for(const N of[S.from,S.to,S.via]){if(g!==p.RTEdgeJunctionEdgeConnectivity&&N===S.via)continue;const e=w[N],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),o=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId)),a=this._getTerminal(o,e);let i="";switch(N){case S.from:i="from";break;case S.to:i="to";break;case S.via:i="via"}k[`${i}NetworkSource`]=r,k[`${i}AssetGroup`]=s,k[`${i}AssetType`]=o,k[`${i}Terminal`]=a?.toJSON()}return k}_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 function b(e){const t=new h({where:"1=1",outFields:["*"]});return(await a(e,t)).features}e([r({type:[l],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],I.prototype,"sharedNamedTraceConfigurations",void 0),e([r({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],I.prototype,"type",void 0),e([r({readOnly:!0})],I.prototype,"serviceTerritoryFeatureLayerId",null),e([r({readOnly:!0})],I.prototype,"networkSystemLayers",null),e([r({readOnly:!0})],I.prototype,"terminalConfigurations",null),e([r({readOnly:!0})],I.prototype,"domainNetworkNames",null),I=e([s("esri.networks.UtilityNetwork")],I);const g=I;export{g 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../request.js";import t from"../../core/Error.js";import{queryAllJSON as r}from"../../layers/support/featureQueryAll.js";import a from"../../portal/PortalItem.js";import
|
|
5
|
+
import e from"../../request.js";import t from"../../core/Error.js";import{queryAllJSON as r}from"../../layers/support/featureQueryAll.js";import{isSubtypeSublayer as n,isFeatureLayer as o}from"../../layers/support/layerUtils.js";import{RuleType as a}from"./typeUtils.js";import s from"../../portal/PortalItem.js";import u from"../../rest/support/FeatureSet.js";import{isGraphic as l}from"../../support/guards.js";function i(e,t,r="from"){const{fromRuleElement:n,viaRuleElement:o,toRuleElement:s}=f(e),u=[];switch(e.ruleType){case a.RTContainment:case a.RTAttachment:"from"===r&&y(t,n,!1)?u.push(s):"to"===r&&y(t,s,!1)&&u.push(n);break;case a.RTJunctionEdgeConnectivity:case a.RTJunctionJunctionConnectivity:y(t,n,!0)?u.push(s):y(t,s,!0)&&u.push(n);break;case a.RTEdgeJunctionEdgeConnectivity:o&&(y(t,o,!0)?(u.push(n),u.push(s)):(y(t,n,!0)||y(t,s,!0))&&u.push(o));break;default:return[]}return u}function c(e,t,r){const{fromRuleElement:n,viaRuleElement:o,toRuleElement:s}=f(e);switch(e.ruleType){case a.RTContainment:case a.RTAttachment:return p(t,r,n,s,!1,!1);case a.RTJunctionEdgeConnectivity:case a.RTJunctionJunctionConnectivity:return p(t,r,n,s,!0,!0);case a.RTEdgeJunctionEdgeConnectivity:return p(t,r,n,o,!0,!0)||p(t,r,s,o,!0,!0);default:return!1}}function p(e,t,r,n,o,a){if(!r||!n)return!1;const s=y(e,r,a),u=y(t,n,a);if(o){const o=y(e,n,a),l=y(t,r,a);return s&&u||o&&l}return s&&u}function m(e,t){const r=e.terminal?.terminalId,n=t.terminalId;return null==r&&null==n||(1===r?null==n||1===n:r===n)}function y(e,t,r){const{assetGroupCode:n,assetTypeCode:o}=e;return("layerId"in e?e.layerId===t.networkSource?.layerId:e.networkSourceId===t.networkSource?.sourceId)&&(null==n||n===t.assetGroup?.assetGroupCode)&&(null==o||o===t.assetType?.assetTypeCode)&&(!r||!("terminalId"in e)||m(t,e))}function f(e){return{fromRuleElement:{networkSource:e.fromNetworkSource,assetGroup:e.fromAssetGroup,assetType:e.fromAssetType,terminal:e.fromTerminal},viaRuleElement:e.viaNetworkSource?{networkSource:e.viaNetworkSource,assetGroup:e.viaAssetGroup,assetType:e.viaAssetType,terminal:e.viaTerminal}:void 0,toRuleElement:{networkSource:e.toNetworkSource,assetGroup:e.toAssetGroup,assetType:e.toAssetType,terminal:e.toTerminal}}}function d(e){let t=null,r=null,o=null;if(l(e))t=w(e),[r,o]=I(e);else if(n(e)){t=e.parent?.layerId??null;const[n]=T(e);n===e.subtypeField&&(r=e.subtypeCode)}else t=e.layerId??null;return{layerId:t,assetGroupCode:r,assetTypeCode:o}}function w(e){const{sourceLayer:t}=e;let r;return o(t)?r=t.layerId:n(t)&&(r=t.parent?.layerId),r??null}function I(e){const[t,r]=T(e.sourceLayer);return[t?e.attributes[t]:null,r?e.attributes[r]:null]}function T(e){if(!e||!("fieldsIndex"in e))return[null,null];return[e.fieldsIndex.normalizeFieldName("assetGroup")??null,e.fieldsIndex.normalizeFieldName("assetType")??null]}async function R(e,t){const n=e.layers,o=e.layerInfos,a=e.returnGeometry||!1,s=e.outSpatialReference;await Promise.all(n.map((async e=>{await e.load()})));return(await Promise.all(n.map((async e=>{const n=o.find((t=>t.layerUrl===e.parsedUrl?.path));if(!n?.objectIds?.length)return{layer:e,featureSet:void 0};const l=e.createQuery();l.returnGeometry=a,l.outFields=n.outFields||["*"],l.outSpatialReference=s,l.gdbVersion=e.gdbVersion,l.objectIds=n.objectIds,t&&(l.where="1=1");const i=u.fromJSON(await r(e,l));return i.features.forEach((t=>{t.layer=e})),{layer:e,featureSet:i}})))).filter((e=>void 0!==e.featureSet))}async function k(e,t){if("Utility Network Layer"===e){const{default:e}=await import("../UtilityNetwork.js");return new e({layerUrl:t})}return null}async function v(r){let n="portalItem"in r?r:{portalItem:r};!n.portalItem||n.portalItem instanceof s||(n={...n,portalItem:new s(n.portalItem)});const o=n.portalItem;if(await o.load(),"Feature Service"!==o.type)throw new t("portal:unknown-item-type","Unknown item type '${type}'",{type:o.type});const a=o.url,u=await e(a,{responseType:"json",query:{f:"json"}}),l="Network Layer";if(u.data.type?.includes(l))return k(u.data.type,a);if(u.data.layers){const e=u.data.layers.find((e=>e.type.includes(l)));if(e){const t=`${a}/${e.id}`;return k(e.type,t)}}return null}export{p as doElementsMatchRule,c as doesRuleAllowAssociation,T as getAssetFieldNames,i as getCompatibleRuleElements,f as getElementsFromRule,I as getFeatureAssetCodes,w as getFeatureSourceLayerId,R as getFeaturesFromLayers,d as getRuleValues,y as isRuleElementMatch,m as isTerminalMatch,v as networkFromPortalItem};
|
package/package.json
CHANGED