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.
 
 

14 lines
5.8 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 ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../../chunks/earcut ../../../geometry/support/aaBoundingRect ../../../geometry/support/coordsUtils ../../../geometry/support/normalizeUtilsSync ../../../geometry/support/spatialReferenceUtils ../../../layers/graphics/data/projectionSupport ../tiling/TileInfoView ../tiling/TileKey ../tiling/TileQueue ../tiling/TileStrategy ../engine/webgl/definitions ../engine/webgl/TurboLine ./LayerView2D ./support/DisplayGL ./support/util ../../layers/LayerView ../../layers/RefreshableLayerView".split(" "),
function(n,r,l,P,Q,x,y,z,A,B,C,u,D,R,S,T,E,F,G,H,v,I,J){const t=new Set,p=[],q=[];class K{constructor(a,b,d,c,g,e,f,h=[0,0],k=z.create()){this.id=a;this.level=b;this.row=d;this.col=c;this.world=g;this.resolution=e;this.scale=f;this.coords=h;this.bounds=k}}l=class extends J(G.LayerView2DMixin(I)){constructor(a){super(a);this._tileMap=new Map;this.container=new H(this);this.layer=null;this.tiles=[];this._renderTarget={framebuffer:null,viewport:[0,0,0,0]}}get _tileInfoView(){const a=this.layer?.tileInfo;
return a?new D(a):null}get context(){return this.view.stage.context.gl}attach(){}detach(){}requestRender(){this.container.requestRender()}tilesChanged(a,b){}supportsSpatialReference(a){const b=this.layer?.tileInfo;return b?C.equals(b.spatialReference,a):!0}async doRefresh(){}isUpdating(){return!1}update(a){var b=this._tileInfoView;const d=this.tiles;if(b){a=b.getTileCoverage(a.state,0);var c=a?.spans;a=a?.lodInfo;if(c?.length&&a){b=a.level;for(const {row:e,colFrom:f,colTo:h}of c)for(c=f;c<=h;c++){var g=
a.normalizeCol(c);const k=a.getWorldForColumn(c),m=`${b}/${e}/${g}/${k}`;this._tileMap.has(m)||(g=new K(m,b,e,g,k,a.resolution,a.scale),a.getTileCoords(g.coords,g,!1),a.getTileBounds(g.bounds,g,!0),this._tileMap.set(m,g),d.push(g),p.push(g));t.add(m)}}}for(a=d.length-1;0<=a;a--)b=d[a],t.has(b.id)||(d.splice(a,1),q.push(b),this._tileMap.delete(b.id));if(p.length||q.length)this.tilesChanged(p,q),p.length=q.length=0;t.clear();this.requestRender()}viewChange(){this.requestUpdate()}moveEnd(){}bindRenderTarget(){this.context.bindFramebuffer(this.context.FRAMEBUFFER,
this._renderTarget.framebuffer);this.context.viewport(this._renderTarget.viewport[0],this._renderTarget.viewport[1],this._renderTarget.viewport[2],this._renderTarget.viewport[3])}getRenderTarget(){return this._renderTarget}async tessellateExtent(a){const b={vertices:[],indices:[]};a=await this._projectAndNormalizeGeometry(a);const d=b.vertices.length;b.vertices.push({x:a.xmin,y:a.ymin,xOffset:0,yOffset:0,uTexcoord:0,vTexcoord:0,distance:0});b.vertices.push({x:a.xmax,y:a.ymin,xOffset:0,yOffset:0,uTexcoord:1,
vTexcoord:0,distance:0});b.vertices.push({x:a.xmin,y:a.ymax,xOffset:0,yOffset:0,uTexcoord:0,vTexcoord:1,distance:0});b.vertices.push({x:a.xmax,y:a.ymax,xOffset:0,yOffset:0,uTexcoord:1,vTexcoord:1,distance:0});b.indices.push(d,d+1,d+2,d+1,d+3,d+2);return b}async tessellatePoint(a,b){a=await this._projectAndNormalizeGeometry(a);return this._tessellatePoints([a],b)}async tessellateMultipoint(a,b){const d=await this._projectAndNormalizeGeometry(a);a=d.points.map(c=>({x:c[0],y:c[1],spatialReference:d.spatialReference}));
return this._tessellatePoints(a,b)}async _tessellatePoints(a,b){const d={vertices:[],indices:[]};for(const c of a)a=d.vertices.length,d.vertices.push({x:c.x,y:c.y,xOffset:b.x,yOffset:b.y+b.height,uTexcoord:0,vTexcoord:0,distance:0}),d.vertices.push({x:c.x,y:c.y,xOffset:b.x+b.width,yOffset:b.y+b.height,uTexcoord:1,vTexcoord:0,distance:0}),d.vertices.push({x:c.x,y:c.y,xOffset:b.x,yOffset:b.y,uTexcoord:0,vTexcoord:1,distance:0}),d.vertices.push({x:c.x,y:c.y,xOffset:b.x+b.width,yOffset:b.y,uTexcoord:1,
vTexcoord:1,distance:0}),d.indices.push(a,a+1,a+2,a+1,a+3,a+2);return d}async tessellatePolyline(a,b){const d={vertices:[],indices:[]};var c=(await this._projectAndNormalizeGeometry(a)).paths;if(!c?.length)return d;let g;a=new F.LineTessellation((e,f,h,k,m,U,L,M,V,N,w)=>{h=d.vertices.length;d.vertices.push({x:e,y:-f,xOffset:L*b/2,yOffset:M*b/2,uTexcoord:w/g,vTexcoord:(N+1)/2,distance:w});return h},(e,f,h)=>{d.indices.push(e,f,h)},!0);for(const e of c){g=0;for(c=1;c<e.length;++c){const f=e[c][0]-e[c-
1][0],h=e[c][1]-e[c-1][1];g+=Math.sqrt(f*f+h*h)}c=e.map(f=>({x:f[0],y:-f[1]}));a.tessellate(c,O)}return d}async tessellatePolygon(a){const b={vertices:[],indices:[]};a=await this._projectAndNormalizeGeometry(a);if(!a.rings?.length)return b;A.closeRings(a);for(const f of a.rings)for(const h of f)h[1]=-h[1];let d=Infinity,c=Infinity,g=-Infinity,e=-Infinity;v.analyzeRings(a.rings,()=>{},(f,h,k)=>{for(;f<h;f+=2)d=Math.min(d,k[f]),c=Math.min(c,k[f+1]),g=Math.max(g,k[f]),e=Math.max(e,k[f+1])});v.analyzeRings(a.rings,
()=>{},(f,h,k,m)=>{this._invokeEarcut(b,f,h,k,m,[d,c,g,e])});return b}_invokeEarcut(a,b,d,c,g,e){b=c.slice(b,d);g=y.earcut(b,g,2);d=a.vertices.length;for(c=0;c<b.length;c+=2){const f=b[c],h=b[c+1];a.vertices.push({x:f,y:-h,xOffset:0,yOffset:0,uTexcoord:(f-e[0])/(e[2]-e[0]),vTexcoord:1-(h-e[1])/(e[3]-e[1]),distance:0})}for(e=0;e<g.length;++e)a.indices.push(d+g[e])}async _projectAndNormalizeGeometry(a){await u.checkProjectionSupport(a.spatialReference,this.view.spatialReference);const b=B.normalizeCentralMeridianForDisplay(a);
return u.project(b,a.spatialReference,this.view.spatialReference)}};n.__decorate([r.property()],l.prototype,"_tileInfoView",null);n.__decorate([r.property()],l.prototype,"layer",void 0);n.__decorate([r.property()],l.prototype,"context",null);l=n.__decorate([x.subclass("esri.views.2d.layers.BaseLayerViewGL2D")],l);const O={pixelCoordRatio:1,wrapDistance:1E11,halfWidth:E.thinLineHalfWidthThreshold+1,initialDistance:0,textured:!0,offset:0};return l});