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.
10 lines
3.3 KiB
10 lines
3.3 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 ../../geometry ../../core/has ../../core/handleUtils ../../core/Logger ../../core/unitUtils ../../geometry/support/aaBoundingRect ../../geometry/support/webMercatorUtils ../../geometry/Point".split(" "),function(h,C,D,w,x,y,k,z,A){function r(a,b){const c=t(a,b.spatialReference);if(!c)return null;switch(a.type){case "point":a.z=b.elevationAt(c.x,c.y);break;case "polyline":f.spatialReference=c.spatialReference;var e=a.hasM&&!a.hasZ;for(var d=0;d<a.paths.length;d++){var g=a.paths[d], |
|
l=c.paths[d];for(let m=0;m<g.length;m++){const n=g[m],u=l[m];f.x=u[0];f.y=u[1];e&&(n[3]=n[2]);n[2]=b.elevationAt(f.x,f.y)}}a.hasZ=!0;break;case "multipoint":f.spatialReference=c.spatialReference;e=a.hasM&&!a.hasZ;for(d=0;d<a.points.length;d++)g=a.points[d],l=c.points[d],f.x=l[0],f.y=l[1],e&&(g[3]=g[2]),g[2]=b.elevationAt(f.x,f.y);a.hasZ=!0}return a}function t(a,b){if(null==a)return null;const c=a.spatialReference;if(c.equals(b))return a;(a=z.project(a,b))||p().error(`Cannot project geometry spatial reference (wkid:${c.wkid}) to elevation sampler spatial reference (wkid:${b.wkid})`); |
|
return a}const p=()=>x.getLogger("esri.layers.support.ElevationSampler");class q{queryElevation(a){return r(a.clone(),this)}on(){return w.makeHandle()}projectIfRequired(a,b){return t(a,b)}}class v extends q{get spatialReference(){return this.extent.spatialReference}constructor(a,b,c){super();this.tile=a;this.noDataValue=c;c=a.tile.extent;this.extent=k.toExtent(c,b.spatialReference);this.extent.zmin=a.zmin;this.extent.zmax=a.zmax;this._aaExtent=c;c=y.getMetersPerUnitForSR(b.spatialReference);a=b.lodAt(a.tile.level).resolution* |
|
c;this.demResolution={min:a,max:a}}contains(a){a=this.projectIfRequired(a,this.spatialReference);return null==a?!1:this.containsAt(a.x,a.y)}containsAt(a,b){return k.containsXY(this._aaExtent,a,b)}elevationAt(a,b){if(!this.containsAt(a,b)){var c=this.extent;c=`${c.xmin}, ${c.ymin}, ${c.xmax}, ${c.ymax}`;p().warn("#elevationAt()",`Point used to sample elevation (${a}, ${b}) is outside of the sampler extent (${c})`);return this.noDataValue}return this.tile.sample(a,b)??this.noDataValue}}class B extends q{get spatialReference(){return this.extent.spatialReference}constructor(a, |
|
b,c){super();let e;"number"===typeof b?(this.noDataValue=b,e=null):(e=b,this.noDataValue=c);this.samplers=e?a.map(d=>new v(d,e,this.noDataValue)):a;if(a=this.samplers[0]){this.extent=a.extent.clone();const {min:d,max:g}=a.demResolution;this.demResolution={min:d,max:g};for(a=1;a<this.samplers.length;a++)b=this.samplers[a],this.extent.union(b.extent),this.demResolution.min=Math.min(this.demResolution.min,b.demResolution.min),this.demResolution.max=Math.max(this.demResolution.max,b.demResolution.max)}else this.extent= |
|
k.toExtent(k.create(),e.spatialReference),this.demResolution={min:0,max:0}}elevationAt(a,b){let c,e=!1;for(const d of this.samplers)if(d.containsAt(a,b)&&(e=!0,c=d.elevationAt(a,b),c!==d.noDataValue))return c;if(null!=c)return c;e||p().warn("#elevationAt()",`Point used to sample elevation (${a}, ${b}) is outside of the sampler`);return this.noDataValue}}const f=new A;h.ElevationSamplerBase=q;h.MultiTileElevationSampler=B;h.TileElevationSampler=v;h.updateGeometryElevation=r;Object.defineProperty(h, |
|
Symbol.toStringTag,{value:"Module"})}); |