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.
 
 

29 lines
14 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("../chunks/tslib.es6 ../PopupTemplate ../TimeExtent ../TimeInterval ../core/Collection ../core/Error ../core/Logger ../core/MultiOriginJSONSupport ../core/promiseUtils ../core/accessorSupport/decorators/property ../core/accessorSupport/ensureType ../core/RandomLCG ../core/has ../core/accessorSupport/decorators/reader ../core/accessorSupport/decorators/subclass ../chunks/vec32 ../core/libs/gl-matrix-2/factories/vec3f64 ../geometry/Extent ./Layer ./mixins/APIKeyMixin ./mixins/ArcGISService ./mixins/CustomParametersMixin ./mixins/OperationalLayer ./mixins/PortalLayer ./mixins/ScaleRangeLayer ./mixins/SceneService ./support/arcgisLayerUrl ./support/commonProperties ./support/Field ./support/TimeInfo ./voxel/VoxelSection ./voxel/VoxelSimpleShading ./voxel/VoxelVariable ./voxel/VoxelVariableStyle ./voxel/VoxelVolume ./voxel/VoxelVolumeIndex ./voxel/VoxelVolumeStyle ../support/popupUtils".split(" "),
function(e,B,r,C,k,n,l,d,D,f,E,U,V,t,F,G,H,u,I,J,K,L,M,N,O,P,Q,v,m,w,p,x,R,y,z,S,A,T){d=class extends P.SceneService(K.ArcGISService(M.OperationalLayer(N.PortalLayer(O.ScaleRangeLayer(d.MultiOriginJSONMixin(L.CustomParametersMixin(J.APIKeyMixin(I)))))))){constructor(a){super(a);this.serviceRoot="";this.operationalLayerType="Voxel";this.legendEnabled=!0;this.sections=this.title=null;this.currentVariableId=0;this.volumeStyles=null;this.renderMode="volume";this.variableStyles=null;this.enableIsosurfaces=
this.enableDynamicSections=this.enableSections=this.enableSlices=!0;this.shading=new x;this.opacity=1;this.variables=new k;this.volumes=new k;this.index=null;this.maxScale=this.minScale=0;this.type="voxel";this.version={major:Number.NaN,minor:Number.NaN,versionString:""};this.fullExtent=null;this.popupEnabled=!1;this.timeOffset=this.timeExtent=this.test=null;this.useViewTime=!0;this.volumeStyles=new (k.ofType(A));this.variableStyles=new (k.ofType(y));this.sections=new (k.ofType(p))}normalizeCtorArgs(a){a?.constantUpscaling&&
(this.test={constantUpscaling:!0},delete a.constantUpscaling);return a}set url(a){this._set("url",Q.sanitizeUrl(a,l.getLogger(this)))}load(a){const b=null!=a?a.signal:null;a=this.loadFromPortal({supportedTypes:["Scene Service"]},a).catch(D.throwIfAbortError).then(()=>this._fetchService(b)).then(()=>this.serviceRoot=this.url);this.addResolvingPromise(a);return Promise.resolve(this)}read(a,b){super.read(a,b);for(const c of this.volumes)c.spatialReference=this.spatialReference}readVersion(a,b){return super.parseVersionString(a)}validateLayer(a){if(a.layerType&&
a.layerType!==this.operationalLayerType)throw new n("voxel-layer:layer-type-not-supported","VoxelLayer does not support this layer type",{layerType:a.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor)||3>this.version.major)throw new n("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"3.x"});if(3<this.version.major)throw new n("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,
supportedVersions:"3.x"});}readFullExtent(a,b,c){if(null!=a&&"object"===typeof a){a=u.fromJSON(a,c);if(0===a.zmin&&0===a.zmax&&Array.isArray(b.volumes)&&(b=z.fromJSON(b.volumes[0]),b.isValid&&"xyt"!==b.volumeType&&(c=b.dimensions[2],c.isRegular))){b=c.regularSpacing.offset;c=c.regularSpacing.offset+c.regularSpacing.scale*(c.size-1);if(b>c){const g=b;b=c;c=g}a.zmin=b;a.zmax=c}return a}return null}get voxelFields(){var a=new m({name:"Voxel.ServiceValue",alias:"Value",domain:null,editable:!1,length:128,
type:"string"}),b=new m({name:"Voxel.ServiceVariableLabel",alias:"Variable",domain:null,editable:!1,length:128,type:"string"}),c=new m({name:"Voxel.Position",alias:"Voxel Position",domain:null,editable:!1,length:128,type:"string"});a=[a,b,c];b=this.getVolume(null);if(null!=b){if("xyzt"===b.volumeType||"xyt"===b.volumeType)c=new m({name:"Voxel.ServiceLocalTime",alias:"Local Time",domain:null,editable:!1,length:128,type:"string"}),a.push(c),c=new m({name:"Voxel.ServiceNativeTime",alias:"Native Time",
domain:null,editable:!1,length:128,type:"string"}),a.push(c);"xyt"!==b.volumeType&&(b=new m({name:"Voxel.ServiceDepth",alias:"Depth",domain:null,editable:!1,length:128,type:"string"}),a.push(b))}return a}get popupTemplate(){return this.loaded?this.createPopupTemplate():null}get defaultPopupTemplate(){return this.createPopupTemplate()}createPopupTemplate(a){return T.createPopupTemplate({fields:this.voxelFields,title:this.title},a)}getConfiguration(){const a={layerType:this.operationalLayerType,version:this.version.versionString,
name:this.title,spatialReference:this.spatialReference,fullExtent:this.fullExtent,volumes:this.volumes.toJSON(),variables:this.variables.toJSON(),index:this.index?.toJSON(),sections:this.getSections(),style:{volumeStyles:this.getVolumeStyles(),currentVariableId:this.currentVariableId,renderMode:this.renderMode,variableStyles:this.getVariableStyles(),enableSections:this.enableSections,enableDynamicSections:this.enableDynamicSections,enableIsosurfaces:this.enableIsosurfaces,enableSlices:this.enableSlices,
shading:this.shading}};return a.index&&this.index?.isValid()?JSON.stringify(a):""}getVariableStyle(a){let b=-1;b=null!=a?a:this.currentVariableId;if(!this.variableStyles||-1===b)return null;a=this.variableStyles.findIndex(c=>c.variableId===b);return 0>a?null:this.variableStyles.at(a)}getVariable(a){let b=-1;b=null!=a?a:this.currentVariableId;if(!this.variables||-1===b)return null;a=this.variables.findIndex(c=>c.id===b);return 0>a?null:this.variables.at(a)}getVolume(a){const b=this.getVariable(a);
return null!=b?this.volumes.find(({id:c})=>c===b.volumeId):null}get timeInfo(){var a=this.getVolume(null);if("xyzt"!==a?.volumeType)return null;a=a.timeStops;if(!a?.length)return null;const b=new r({start:a[0],end:a.at(-1)});return new w({fullTimeExtent:b,stops:a})}getVolumeStyle(a){const b=this.getVariable(a);return null!=b?this.volumeStyles.find(({volumeId:c})=>c===b.volumeId):null}getColorForContinuousDataValue(a,b,c){var g=this.getVariable(a);if(null==g||"continuous"!==g.renderingFormat?.continuity||
!this.variableStyles)return null;g=this.variableStyles.findIndex(h=>h.variableId===a);if(0>g)return null;g=this.variableStyles.at(g);return g?.transferFunction?g.transferFunction.getColorForContinuousDataValue(b,c):null}getSections(){const a=[];for(const b of this.sections)a.push(new p({enabled:b.enabled,href:b.href,id:b.id,label:b.label,normal:b.normal,point:b.point,sizeInPixel:b.sizeInPixel,slices:b.slices,timeId:b.timeId,variableId:b.variableId}));return a}getVariableStyles(){const a=[];for(const b of this.variableStyles){const c=
this._getVariable(b);if(null!=c){const g=b.clone();4<g.isosurfaces.length&&(g.isosurfaces=g.isosurfaces.slice(0,3),l.getLogger(this).error("A maximum of 4 isosurfaces are supported for Voxel Layers."));for(const h of g.isosurfaces)if(!h.colorLocked){const q=this.getColorForContinuousDataValue(g.variableId,h.value,!1);null===q||q.equals(h.color)||(h.color=q)}if("continuous"===c.renderingFormat.continuity)(null===g.transferFunction||2>g.transferFunction.colorStops.length)&&l.getLogger(this).error(`VoxelVariableStyle for variable ${c.id} is invalid. At least 2 color stops are required in the transferFunction for continuous Voxel Layer variables.`),
null===g.transferFunction||Array.isArray(g.transferFunction.stretchRange)&&2===g.transferFunction.stretchRange.length||(l.getLogger(this).error(`VoxelVariableStyle for variable ${c.id} is invalid. The stretchRange of the transferFunction for continuous Voxel Layer variables must be of the form [minimumDataValue, maximumDataValue].`),g.transferFunction.stretchRange=[0,1],g.transferFunction.colorStops.removeAll());else if("discrete"===c.renderingFormat.continuity)if(0===b.uniqueValues.length)l.getLogger(this).error(`VoxelVariableStyle for variable ${c.id} is invalid. Unique values are required for discrete Voxel Layer variables.`);
else for(const h of b.uniqueValues)null!==h.label&&void 0!==h.label||null===h.value||void 0===h.value||(h.label=h.value.toString());a.push(g)}else l.getLogger(this).error(`VoxelVariable ID=${b.variableId} doesn't exist, VoxelVariableStyle for this VoxelVariable will be ignored.`)}return a}getVolumeStyles(){const a=[];for(const b of this.volumeStyles){const c=this._getVolumeFromVolumeId(b.volumeId);if(null!=c){const g=b.clone();for(const h of g.slices)this._isPlaneValid(h,[0,1,c.zDimension],c.dimensions)||
(h.enabled=!1,h.label="invalid");for(const h of g.dynamicSections)this._isPlaneValid(h,[0,1,c.zDimension],c.dimensions)||(h.enabled=!1,h.label="invalid");a.push(g)}else l.getLogger(this).error(`VoxelVolume ID=${b.volumeId} doesn't exist, VoxelVolumeStyle for this VoxelVolume will be ignored.`)}return a}_getVariable(a){a=a.variableId;for(const b of this.variables)if(b.id===a)return b;return null}_getVolumeFromVolumeId(a){for(const b of this.volumes)if(b.id===a)return b;return null}_isPlaneValid(a,
b,c){if(!(a.point&&Array.isArray(a.point)&&3===a.point.length&&a.normal&&Array.isArray(a.normal)&&3===a.normal.length))return!1;b=H.fromValues(a.normal[0],a.normal[1],a.normal[2]);G.normalize(b,b);if(1E-6>Math.abs(b[0])+Math.abs(b[1])+Math.abs(b[2]))return!1;a.normal[0]=b[0];a.normal[1]=b[1];a.normal[2]=b[2];return!0}};e.__decorate([f.property({type:["Voxel"]})],d.prototype,"operationalLayerType",void 0);e.__decorate([f.property(v.legendEnabled)],d.prototype,"legendEnabled",void 0);e.__decorate([f.property({json:{write:!0}})],
d.prototype,"title",void 0);e.__decorate([f.property(v.url)],d.prototype,"url",null);e.__decorate([f.property({type:k.ofType(p),json:{origins:{"web-scene":{name:"layerDefinition.sections",write:!0}}}})],d.prototype,"sections",void 0);e.__decorate([f.property({type:E.Integer,json:{origins:{"web-scene":{name:"layerDefinition.style.currentVariableId",write:{enabled:!0,isRequired:!0,ignoreOrigin:!0}},service:{name:"style.currentVariableId"}}}})],d.prototype,"currentVariableId",void 0);e.__decorate([f.property({type:k.ofType(A),
json:{origins:{"web-scene":{name:"layerDefinition.style.volumeStyles",write:!0},service:{name:"style.volumeStyles"}}}})],d.prototype,"volumeStyles",void 0);e.__decorate([f.property({type:["volume","surfaces"],json:{origins:{"web-scene":{name:"layerDefinition.style.renderMode",write:!0},service:{name:"style.renderMode"}}}})],d.prototype,"renderMode",void 0);e.__decorate([f.property({type:k.ofType(y),json:{origins:{"web-scene":{name:"layerDefinition.style.variableStyles",write:!0},service:{name:"style.variableStyles"}}}})],
d.prototype,"variableStyles",void 0);e.__decorate([f.property({type:Boolean,json:{origins:{"web-scene":{name:"layerDefinition.style.enableSlices",write:!0},service:{name:"style.enableSlices"}}}})],d.prototype,"enableSlices",void 0);e.__decorate([f.property({type:Boolean,json:{origins:{"web-scene":{name:"layerDefinition.style.enableSections",write:!0},service:{name:"style.enableSections"}}}})],d.prototype,"enableSections",void 0);e.__decorate([f.property({type:Boolean,json:{origins:{"web-scene":{name:"layerDefinition.style.enableDynamicSections",
write:!0},service:{name:"style.enableDynamicSections"}}}})],d.prototype,"enableDynamicSections",void 0);e.__decorate([f.property({type:Boolean,json:{origins:{"web-scene":{name:"layerDefinition.style.enableIsosurfaces",write:!0},service:{name:"style.enableIsosurfaces"}}}})],d.prototype,"enableIsosurfaces",void 0);e.__decorate([f.property({type:x,json:{origins:{"web-scene":{name:"layerDefinition.style.shading",write:!0},service:{name:"style.shading"}}}})],d.prototype,"shading",void 0);e.__decorate([f.property({type:["show",
"hide"]})],d.prototype,"listMode",void 0);e.__decorate([f.property({type:Number,range:{min:0,max:1},nonNullable:!0,json:{read:!1,write:!1,origins:{"web-scene":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],d.prototype,"opacity",void 0);e.__decorate([f.property({type:k.ofType(R)})],d.prototype,"variables",void 0);e.__decorate([f.property({type:k.ofType(z)})],d.prototype,"volumes",void 0);e.__decorate([f.property({type:S})],d.prototype,"index",void 0);e.__decorate([f.property({type:Number,
json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:!1,write:!1}}}})],d.prototype,"minScale",void 0);e.__decorate([f.property({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:!1,write:!1}}}})],d.prototype,"maxScale",void 0);e.__decorate([f.property({json:{read:!1},readOnly:!0})],d.prototype,"type",void 0);e.__decorate([f.property({readOnly:!0,json:{name:"serviceVersion"}})],d.prototype,"version",void 0);e.__decorate([t.reader("service","version")],
d.prototype,"readVersion",null);e.__decorate([f.property({type:u})],d.prototype,"fullExtent",void 0);e.__decorate([t.reader("service","fullExtent",["fullExtent"])],d.prototype,"readFullExtent",null);e.__decorate([f.property({readOnly:!0,clonable:!1,json:{read:!1}})],d.prototype,"voxelFields",null);e.__decorate([f.property({type:Boolean,json:{name:"disablePopup",read:{reader(a,b){return!b.disablePopup}},write:{enabled:!0,ignoreOrigin:!0,writer(a,b,c){b[c]=!a}},origins:{"portal-item":{default:!0},"web-scene":{default:!0}}}})],
d.prototype,"popupEnabled",void 0);e.__decorate([f.property({type:B,json:{read:!1}})],d.prototype,"popupTemplate",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"defaultPopupTemplate",null);e.__decorate([f.property({type:w,readOnly:!0,json:{read:!1}})],d.prototype,"timeInfo",null);e.__decorate([f.property({type:r,json:{read:!1}})],d.prototype,"timeExtent",void 0);e.__decorate([f.property({type:C,json:{read:!1}})],d.prototype,"timeOffset",void 0);e.__decorate([f.property({type:Boolean,
nonNullable:!0,json:{origins:{"web-scene":{name:"timeAnimation",write:!0},service:{read:!1}}}})],d.prototype,"useViewTime",void 0);return d=e.__decorate([F.subclass("esri.layers.VoxelLayer")],d)});