@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.72 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{debugFlags as e}from"../../support/debugFlags.js";let t,n,l=!1,i=!1,o=!1,s=!1,r=null;function a(e){const t=i?e():null;if(!t?.bins)return;c();const l=n;let o=0;for(let n=0;n<t.numX;n++)for(let e=0;e<t.numY;e++){const i=t.bins[n][t.numY-1-e];o+=i.length;const s=n*t.sizeX,r=(n+1)*t.sizeX,a=e*t.sizeY,u=(e+1)*t.sizeY;l.fillText(i.length.toFixed(),s+5,a+15),d(s,r,a,u,"blue")}l.fillText("total totalShownLabels: "+o,70,40),l.fillText("total visible labels: "+t.numVisible,70,50),l.fillText("total numTests: "+t.numTests,70,30)}function u(a){o=e.DECONFLICTOR_SHOW_VISIBLE,s=e.DECONFLICTOR_SHOW_INVISIBLE,l=o||s,i=e.DECONFLICTOR_SHOW_GRID,r=null,l||i?(n&&t&&n.clearRect(0,0,t.width,t.height),r=()=>h(a)):t&&(t.parentElement.removeChild(t),t=null)}function c(){r&&(r(),r=null)}function h(e){null==t&&(t=document.createElement("canvas"),t.setAttribute("id","debugCanvas2d"),e.surface.parentElement.style.position="relative",e.surface.parentElement.appendChild(t),t.style.position="absolute",t.style.width="100%",t.style.height="100%",t.style.display="block",t.style.pointerEvents="none",n=t.getContext("2d"),n.font="12px Arial");const{width:l,height:i}=e.state.camera;t.width=l,t.height=i}function d(e,l,i,o,s){c();const r=t.height,a=n;a.beginPath(),a.lineWidth=1,a.strokeStyle=s,a.moveTo(e,r-i),a.lineTo(l,r-i),a.stroke(),a.lineTo(l,r-o),a.stroke(),a.lineTo(e,r-o),a.stroke(),a.lineTo(e,r-i),a.stroke(),a.closePath()}function f(e,t,n=!1){l&&(t&&o||!t&&s)&&d(e[0],e[2],e[1],e[3],n?t?"pink":"grey":t?"green":"red")}export{a as drawAccelerationStruct,f as drawPoly,u as prepare};