Custom Gis Application with Arcgis Javascript API with modern layouting
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

36 lines
17 KiB

// All material copyright Esri, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.30/esri/copyright.txt for details.
//>>built
define("exports ../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/asyncUtils ../../../core/Collection ../../../core/has ../../../core/Error ../../../core/lang ../../../core/Logger ../../../core/maybe ../../../core/Promise ../../../core/promiseUtils ../../../core/reactiveUtils ../../../core/accessorSupport/decorators/property ../../../core/accessorSupport/decorators/subclass ../../../core/support/UpdatingHandles ../../support/arcgisLayerUrl ../../support/layerUtils ../../../portal/support/geometryServiceUtils ../../../rest/support/StatisticDefinition ../../../views/3d/layers/support/FeatureTileFetcher3D ../../../views/3d/layers/support/FeatureTileFetcher3DDebugger ../../../views/3d/support/debugFlags".split(" "),
function(c,e,A,v,w,x,B,y,r,t,C,q,k,f,D,E,F,G,H,I,J,K,L){function z(a,b){if(!b)return!1;for(const d of b)if(!a.has(d))return!0;return!1}c.FeatureTileController3D=class extends C.EsriPromiseMixin(A){get dataUpdating(){return this._tileFetcher?.dataUpdating??!1}set extent(a){if(null==a||a.spatialReference.equals(this.layerView.view.spatialReference)){var b=this._get("extent");b===a||null!=b&&a&&b.equals(a)||(a=null!=a?a.clone():null,this._set("extent",a))}else r.getLogger(this).error("#extent\x3d","extent needs to be in the same spatial reference as the view")}get updating(){return!!(null!=
this._tileFetcher&&this._tileFetcher.updating||null!=this._fetchDataInfoPromise||"tiles"===this.mode&&this.layerView.view.featureTiles&&this.layerView.view.featureTiles.updating||this._updatingHandles&&this._updatingHandles.updating)}get updatingTotal(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&null!=this._tileFetcher?
this._tileFetcher.expectedFeatureDiff:0}get memoryForUnusedFeatures(){return null!=this._tileFetcher?this._tileFetcher.memoryForUnusedFeatures:0}get maximumNumberOfFeaturesExceeded(){return!(null==this._tileFetcher||!this._tileFetcher.maximumNumberOfFeaturesExceeded)}get maximumNumberOfFeatures(){return this.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(a){a!==this.maximumNumberOfFeatures&&this._overrideIfSome("maximumNumberOfFeatures",a)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden("maximumNumberOfFeatures")}get hasAllFeatures(){return this.serviceDataCount===
c.FeatureTileController3DConstants.noServiceDataCount&&"snapshot"===this.mode&&this.hasAllFeaturesInView||this.serviceDataCount===this.graphics.length}get hasAllFeaturesInView(){return this._tileFetcher?.hasAllFeatures??!1}get hasFullGeometries(){return this._tileFetcher?.hasFullGeometries??!1}get mode(){var a=this.layerView.layer;if("feature"===a.type&&null!=a.infoFor3D)return"snapshot";if("catalog-footprint"===a.type||this._forceTilesMode)return"tiles";var b=this.layerView.view;if(!1===b.qualitySettings?.graphics3D?.snapshotAvailable||
this.serviceDataCount===c.FeatureTileController3DConstants.noServiceDataCount||this._snapshotLimitExceeded||this.maximumNumberOfFeaturesExceeded||1>b.quality)return"tiles";b=(b=b&&b.featureTiles)&&b.tilingScheme;return a&&a.minScale&&this.serviceDataExtent&&b&&(a=this._approximateExtentSizeAtScale(a.minScale,b),(this.serviceDataExtent.width/a+this.serviceDataExtent.height/a)/2>c.FeatureTileController3DConstants.maxSnapshotMinScaleFactor)?"tiles":!this.maximumNumberOfFeatures||this.serviceDataCount<=
this.maximumNumberOfFeatures?"snapshot":"tiles"}get maxTotalSnapshotVertices(){const a=this._get("maxTotalSnapshotVertices")||0;return Math.max(a,"snapshot"===this.mode&&this._tileFetcher?.totalVertices||0)}_approximateExtentSizeAtScale(a,b){const d=this.layerView.view,m=b.levels[0];return(m.tileSize[0]/(m.scale/a)+m.tileSize[1]/(m.scale/a))/2*Math.ceil((d.width/b.pixelSize+d.height/b.pixelSize)/2)}get tileDescriptors(){const a=this.layerView.view.featureTiles;return"snapshot"===this.mode?new w([{id:"dummy-tile-full-extent",
lij:[0,0,0]}]):a?a.tiles:new w}get test(){}constructor(a){super(a);this.type="feature-tile-3d";this._updatingHandles=new E.UpdatingHandles;this.serviceDataExtent=null;this.serviceDataCount=c.FeatureTileController3DConstants.noServiceDataCount;this._snapshotLimitExceeded=!1;this.displayFeatureLimit=null;this._suspended=this._forceTilesMode=!1;this._fetchDataInfoAbortController=this._fetchDataInfoPromise=this._tileFetcher=null;this._lifeCycleAbortController=new AbortController}initialize(){this._updatingHandles.add(()=>
this.displayFeatureLimit,a=>this._updatingHandles.addPromise(this._updateSnapshotLimit(a,null,this._lifeCycleAbortController.signal)));this._updatingHandles.add(()=>this.mode,()=>this._modeChanged(),k.initial);this._updatingHandles.add(()=>this.mode,(a,b)=>{"tiles"===a&&"snapshot"===b&&(this._forceTilesMode=!0)},k.initial);this.addResolvingPromise(Promise.resolve().then(()=>this._verifyCapabilities()).then(()=>this._updatingHandles.addPromise(this._fetchServiceDataInfo())).then(()=>this._initializeTileFetcher()))}_verifyCapabilities(){const a=
this.layerView.layer;if("ogc-feature"!==a.type&&!G.getEffectiveLayerCapabilities(a)?.operations.supportsQuery)throw new B("graphicscontroller:query-capability-required","Service requires query capabilities to be used as a feature layer",{layer:a});}destroy(){this._cancelFetchServiceDataInfo();this._tileFetcher=t.destroyMaybe(this._tileFetcher);this._tilesHandle=t.removeMaybe(this._tilesHandle);this._lifeCycleAbortController=t.abortMaybe(this._lifeCycleAbortController);this._updatingHandles.destroy();
this._set("_updatingHandles",null)}suspend(){this._suspended||(this._suspended=!0,null!=this._tileFetcher&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,null!=this._tileFetcher&&this._tileFetcher.resume())}restart(){const a=()=>{null!=this._tileFetcher&&this._tileFetcher.restart()};this._updatingHandles.addPromise(this._fetchServiceDataInfo().then(a,a))}refetch(){this._refetch({resetForceTilesMode:!1})}getMissingAttributesForFeature(a){return this._tileFetcher?.getMissingAttributesForFeature(a)}_refetch(a){const b=
()=>{null!=this._tileFetcher&&(a.resetForceTilesMode&&(this._forceTilesMode=!1),this._tileFetcher.refetch())};this._updatingHandles.addPromise(this._fetchServiceDataInfo().then(b,b))}_initializeTileFetcher(){const a=this.layerView.view;if(a){var b=k.whenOnce(()=>a.featureTiles?.tilingScheme,this._lifeCycleAbortController.signal);this._updatingHandles.addPromise(b);b.then(()=>{const {layerView:d,tileDescriptors:m}=this,l=d.layer,g=new J.FeatureTileFetcher3D({context:this.context,filterExtent:this.extent,
tileDescriptors:m,features:this.graphics});this._tileFetcher=g;this._suspended?g.suspend():g.resume();const p=this.layerView.view;p&&this.addHandles(k.watch(()=>p.quality,h=>g.memoryFactor=h,k.syncAndInitial));const n="polygon"===this.context.geometryType?"polygonLodFactor":"polyline"===this.context.geometryType?"polylineLodFactor":null;n&&this.addHandles(k.watch(()=>this.layerView.view?.qualitySettings?.graphics3D?.[n],h=>g.lodFactor=h||1,k.initial));"ogc-feature"!==l.type&&this._updatingHandles.add(()=>
l.createQueryVersion,()=>this._dataFilterChanged());this._updatingHandles.add(()=>d.availableFields,(h,u)=>this._availableFieldsChanged(u,h));this._updatingHandles.add(()=>d.requiredFields,(h,u)=>this._requiredFieldsChanged(u,h));"customParameters"in l&&this._updatingHandles.add(()=>l.customParameters,()=>this.restart());this.addHandles([l.on("apply-edits",h=>this._applyEdits(h)),k.watch(()=>this.extent,h=>g.filterExtent=h,k.sync),k.watch(()=>this.tileDescriptors,h=>g.tileDescriptors=h,k.sync),k.watch(()=>
this.maximumNumberOfFeatures,h=>{g.maximumNumberOfFeatures=h;g.useTileCount=this.serviceDataCount>h},k.syncAndInitial),k.watch(()=>this.serviceDataCount,h=>{g.useTileCount=h>this.maximumNumberOfFeatures},k.syncAndInitial),k.watch(()=>L.debugFlags.FEATURE_TILE_FETCH_SHOW_TILES,h=>{h&&g&&!g.debugger?(g.debugger=new K.FeatureTileFetcher3DDebugger(g,p.featureTiles.tilingScheme.toTileInfo(),p),g.debugger.update()):!h&&this._tileFetcher&&g.debugger&&(g.debugger.destroy(),g.debugger=null)},k.syncAndInitial)]);
this._supportsExceedsLimitQuery||this._updatingHandles.add(()=>this.maxTotalSnapshotVertices,()=>this._updatingHandles.addPromise(this._updateSnapshotLimit(this.displayFeatureLimit,null,this._lifeCycleAbortController.signal)))}).catch(()=>{})}}_modeChanged(){switch(this.mode){case "tiles":this._tilesHandle||(this._tilesHandle=this.layerView.view.featureTiles.addClient());break;default:r.getLogger(this).warn("Unhandled feature layer mode "+this.mode);case "snapshot":null!=this._tilesHandle&&(this._tilesHandle.remove(),
this._tilesHandle=null)}}_dataFilterChanged(){this._set("maxTotalSnapshotVertices",0);this.notifyChange("maxTotalSnapshotVertices");this._refetch({resetForceTilesMode:!0})}_applyEdits(a){const b=this.layerView.layer;null!=this._tileFetcher&&this._tileFetcher.applyEdits(a).then(d=>{if(d){if(!this._lifeCycleAbortController)throw q.createAbortError();d.exceededTransferLimit&&"refresh"in b?b.refresh():(d.deletedFeatures.length||d.updatedFeatures.length||d.addedFeatures.length)&&this._updatingHandles.addPromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}}).catch(d=>
{if(!q.isAbortError(d))throw d;})}_availableFieldsChanged(a,b){null!=this._tileFetcher&&z(this._tileFetcher.availableFields,b)&&this._refetch({resetForceTilesMode:!1})}_requiredFieldsChanged(a,b){null!=this._tileFetcher&&z(this._tileFetcher.availableFields,b)&&this.restart()}_createVertexLimitExceededQuery(a){const b=this.layerView.layer,d=b.createQuery();d.returnGeometry=!1;d.outStatistics=[new I({statisticType:"exceedslimit",maxVertexCount:a,outStatisticFieldName:"exceedslimit",maxPointCount:1E8,
maxRecordCount:1E8})];b.capabilities?.query.supportsCacheHint&&(d.cacheHint=!0);return d}_createDataInfoQuery(){const a=this.layerView.layer,b=a.createQuery();b.returnGeometry=!1;b.outSpatialReference=this.layerView.view.spatialReference;a.capabilities?.query.supportsCacheHint&&(b.cacheHint=!0);return b}_fullExtentIsAccurate(){const a=this.layerView.layer;if("definitionExpression"in a&&a.definitionExpression)return!1;switch(a.type){case "feature":case "catalog-footprint":case "oriented-imagery":return F.isHostedAgolService(a.url);
case "csv":case "geojson":case "ogc-feature":case "wfs":return!0}}async _updateServiceDataExtent(a){try{await this._tryUpdateServiceDataExtent(a)}catch(b){q.isAbortError(b)||this._set("serviceDataExtent",y.clone(this.layerView.fullExtentInLocalViewSpatialReference))}}async _tryUpdateServiceDataExtent(a){var b=this.layerView;const d=b.layer,m=d.capabilities?.query.supportsExtent??!1,l=y.clone(b.fullExtentInLocalViewSpatialReference),g=d.fullExtent,p=this._fullExtentIsAccurate(),n=this.serviceDataCount;
m&&n<=c.FeatureTileController3DConstants.maxFeatureCountForExtent&&(!l||!p)&&"queryExtent"in d?(b=this._createDataInfoQuery(),a=await d.queryExtent(b,{timeout:c.FeatureTileController3DConstants.queryExtentTimeout,signal:a}),this._set("serviceDataExtent",a.extent)):l?this._set("serviceDataExtent",l):null!=g?(a=await H.projectGeometry(g,b.view.spatialReference,"portalItem"in d?d.portalItem:null,a),this._set("serviceDataExtent",a)):this._set("serviceDataExtent",null)}async _updateServiceDataCount(a){const b=
this.layerView.layer;if("queryFeatureCount"in b&&x("featurelayer-snapshot-enabled"))if(a=await v.result(b.queryFeatureCount(this._createDataInfoQuery(),{timeout:c.FeatureTileController3DConstants.queryStatisticsTimeout,signal:a})),!0===a.ok)this._set("serviceDataCount",a.value);else{if(q.isAbortError(a.error))throw a.error;this._set("serviceDataCount",c.FeatureTileController3DConstants.noServiceDataCount)}else this._set("serviceDataCount",c.FeatureTileController3DConstants.noServiceDataCount)}get _supportsExceedsLimitQuery(){const a=
this.layerView.layer;return null!=a.capabilities&&a.capabilities.operations&&a.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case "point":return 1;case "multipoint":return 1;case "polygon":return 4;case "polyline":return 2;case "multipatch":case "mesh":return 3;case null:return 0;default:return 0}}async _updateSnapshotLimit(a,b,d){if(null==a?.averageSymbolComplexity)this._snapshotLimitExceeded=!1;else{var {maximumTotalNumberOfVertices:m,
averageSymbolComplexity:l}=a,{verticesPerFeature:g,verticesPerCoordinate:p}=l;a=1<this._minimumNumberOfVerticesForGeometry;if(0>=g||a){0!==g&&null!=b&&await b;var n=Math.min(m,1E6);b=this.serviceDataCount;var h=b!==c.FeatureTileController3DConstants.noServiceDataCount;n=h?Math.ceil((n-b*g)/(p||1)):Math.ceil(n/(p||1));a&&(n=Math.min(n,5E6));if(h&&this._minimumNumberOfVerticesForGeometry*b>n)this._snapshotLimitExceeded=!0;else if(this._supportsExceedsLimitQuery&&x("featurelayer-snapshot-enabled"))if(d=
await v.result(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(n),{timeout:c.FeatureTileController3DConstants.queryStatisticsTimeout,signal:d})),!1===d.ok){if(q.isAbortError(d.error))throw d.error;this._snapshotLimitExceeded=!1}else d=d.value.features[0],this._snapshotLimitExceeded=d?.attributes?!!d.attributes.exceedslimit:!1;else this._snapshotLimitExceeded=this.maxTotalSnapshotVertices>n}else this._snapshotLimitExceeded=!1}}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo();
let a=new AbortController;const b=a.signal;var d=this._updateServiceDataCount(b);d=Promise.allSettled([d,this._updateSnapshotLimit(this.displayFeatureLimit,d,b)]);const m=d.then(()=>this._updateServiceDataExtent(b)).catch(l=>{q.isAbortError(l)||r.getLogger(this).error("#fetchServiceDataInfo()",l)}).then(()=>{m===this._fetchDataInfoPromise&&(this._fetchDataInfoAbortController=this._fetchDataInfoPromise=null);a=null});a&&(this._fetchDataInfoPromise=m);this._fetchDataInfoAbortController=a;return d.then(()=>
{},()=>{})}_cancelFetchServiceDataInfo(){const a=this._fetchDataInfoAbortController;a&&(this._fetchDataInfoPromise=this._fetchDataInfoAbortController=null,a.abort())}get performanceInfo(){return{storedFeatures:this._tileFetcher?.storedFeatures??0,totalFeatures:this._tileFetcher?.totalFeatures??0,totalVertices:this._tileFetcher?.totalVertices??0,missingTiles:this._tileFetcher?.missingTiles??0}}};e.__decorate([f.property({readOnly:!0})],c.FeatureTileController3D.prototype,"type",void 0);e.__decorate([f.property({constructOnly:!0})],
c.FeatureTileController3D.prototype,"graphics",void 0);e.__decorate([f.property({constructOnly:!0})],c.FeatureTileController3D.prototype,"layerView",void 0);e.__decorate([f.property({constructOnly:!0})],c.FeatureTileController3D.prototype,"context",void 0);e.__decorate([f.property({readOnly:!0})],c.FeatureTileController3D.prototype,"dataUpdating",null);e.__decorate([f.property()],c.FeatureTileController3D.prototype,"extent",null);e.__decorate([f.property()],c.FeatureTileController3D.prototype,"updating",
null);e.__decorate([f.property({readOnly:!0})],c.FeatureTileController3D.prototype,"_updatingHandles",void 0);e.__decorate([f.property()],c.FeatureTileController3D.prototype,"updatingTotal",null);e.__decorate([f.property()],c.FeatureTileController3D.prototype,"updatingRemaining",null);e.__decorate([f.property()],c.FeatureTileController3D.prototype,"expectedFeatureDiff",null);e.__decorate([f.property()],c.FeatureTileController3D.prototype,"memoryForUnusedFeatures",null);e.__decorate([f.property()],
c.FeatureTileController3D.prototype,"maximumNumberOfFeaturesExceeded",null);e.__decorate([f.property({readOnly:!0})],c.FeatureTileController3D.prototype,"serviceDataExtent",void 0);e.__decorate([f.property({readOnly:!0})],c.FeatureTileController3D.prototype,"serviceDataCount",void 0);e.__decorate([f.property()],c.FeatureTileController3D.prototype,"_snapshotLimitExceeded",void 0);e.__decorate([f.property()],c.FeatureTileController3D.prototype,"displayFeatureLimit",void 0);e.__decorate([f.property({type:Number})],
c.FeatureTileController3D.prototype,"maximumNumberOfFeatures",null);e.__decorate([f.property({readOnly:!0})],c.FeatureTileController3D.prototype,"hasAllFeatures",null);e.__decorate([f.property({readOnly:!0})],c.FeatureTileController3D.prototype,"hasAllFeaturesInView",null);e.__decorate([f.property({readOnly:!0})],c.FeatureTileController3D.prototype,"hasFullGeometries",null);e.__decorate([f.property()],c.FeatureTileController3D.prototype,"_forceTilesMode",void 0);e.__decorate([f.property({readOnly:!0})],
c.FeatureTileController3D.prototype,"mode",null);e.__decorate([f.property({readOnly:!0})],c.FeatureTileController3D.prototype,"maxTotalSnapshotVertices",null);e.__decorate([f.property({readOnly:!0})],c.FeatureTileController3D.prototype,"tileDescriptors",null);e.__decorate([f.property()],c.FeatureTileController3D.prototype,"_tileFetcher",void 0);e.__decorate([f.property()],c.FeatureTileController3D.prototype,"_fetchDataInfoPromise",void 0);c.FeatureTileController3D=e.__decorate([D.subclass("esri.layers.graphics.controllers.FeatureTileController3D")],
c.FeatureTileController3D);c.FeatureTileController3DConstants=void 0;(function(a){a.noServiceDataCount=Infinity;a.maxSnapshotMinScaleFactor=5;a.reset=function(){a.maxFeatureCountForExtent=1E4;a.queryStatisticsTimeout=12E3;a.queryExtentTimeout=1E4}})(c.FeatureTileController3DConstants||(c.FeatureTileController3DConstants={}));c.FeatureTileController3DConstants.reset();Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});