@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.54 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import e from"./DebugOverlay.js";function t(t,r){t.container.addChild(new e({getMesh:e=>o(t,e,r),getColors:s,getOpacities:n}))}const o=(t,o,s)=>{const{pixelRatio:n}=o.state;let r=0;const c=[],a=[];for(const l of t._vectorTileContainer.children)if(l.symbols)for(const t of l.symbols.values())for(const o of t)for(const t of o.colliders){const i=(t.xScreen+t.dxScreen)*n,l=(t.yScreen+t.dyScreen)*n,u=t.width*n,f=t.height*n,p=o.unique.parts[t.partIndex].targetOpacity>.5;if(!p&&"all"!==s)continue;const h=3,d=1,g=3,y=0,m=p?2:0,x=p?3:0,v=e.makeFlags(m,x);c.push(i,l,v,i+u,l,v,i,l+f,v,i+u,l+f,v),a.push(r,r+1,r+2,r+1,r+3,r+2),r+=4;const b=p?h:d,w=p?g:y,C=e.makeFlags(b,w);c.push(i,l,C,i+u,l,C,i,l+1,C,i+u,l+1,C),a.push(r,r+1,r+2,r+1,r+3,r+2),r+=4,c.push(i,l+f-1,C,i+u,l+f-1,C,i,l+f,C,i+u,l+f,C),a.push(r,r+1,r+2,r+1,r+3,r+2),r+=4,c.push(i,l,C,i+1,l,C,i,l+f,C,i+1,l+f,C),a.push(r,r+1,r+2,r+1,r+3,r+2),r+=4,c.push(i+u-1,l,C,i+u,l,C,i+u-1,l+f,C,i+u,l+f,C),a.push(r,r+1,r+2,r+1,r+3,r+2),r+=4}const{symbolFader:i}=t._vectorTileContainer;if(i){const[t,o]=i.decluttererOffset,s=e.makeFlags(2,3),n=256,l=256,u=n+t,f=l+o;for(const e of[-3,3])for(const t of[-3,3])c.push(n,l,s,n+e,l+t,s,u,f,s,u+e,f+t,s),a.push(r,r+1,r+2,r+1,r+3,r+2),r+=4}return{vertexData:new Int16Array(c),indexData:new Uint32Array(a)}},s=()=>[1,.5,0,1,1,0,0,1,0,1,.5,1,0,.5,0,1],n=()=>[.05,.01,.15,.2];export{t as showCollisionBoxes};