qa-regulatory-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/ScanLine.js

2 lines
1.8 KiB
JavaScript
Raw Permalink Normal View History

2023-11-07 10:04:37 +08:00
define((function(){"use strict";let i,t=new Array,r=0,n=new Array,e=-1,o=[],a=0,y=0,x=256;function f(i){for(var r=e;-1!=e&&t[e].ymax==i;)t[e].isIn=!1,e=n[e],n[r]=-1,r=e;if(-1!=e)for(var o=n[e],a=o;-1!=a;a=o)o=n[a],t[a].ymax==i?(n[r]=n[a],t[a].isIn=!1,n[a]=-1):r=a}function h(){for(var i=e;-1!=i;i=n[i])t[i].xi+=Math.round(t[i].dx);if(-1!=e&&-1!=n[e]){var r=e;t[e].xi>t[n[e]].xi&&(e=n[e],n[r]=n[e],n[e]=r,r=e);var o=n[e];for(i=o;-1!=i&&-1!=(o=n[i]);i=o)t[i].xi>t[n[i]].xi?(n[r]=n[i],n[i]=n[n[i]],n[o]=i):r=i}}function u(i){for(var r=0;r<o[i].length;r++){var a=o[i][r];if(0==a.ymax&&0==a.dx)break;if(-1==e)e=a.id;else if(a.xi<t[e].xi)n[a.id]=e,e=a.id;else for(var y=e,x=n[e];;x=n[x]){if(-1==x||a.xi<t[x].xi){n[y]=a.id,n[a.id]=x;break}y=x}a.isIn=!0}}function d(){this.xi=0,this.dx=0,this.ymax=0,this.id=0,this.isIn=!1}return function(l,s,c,g,m){i=l,a=g,y=m,x=c,t=new Array,r=0,n=new Array,e=-1,o=new Array(a-y+1);for(let i=0;i<o.length;i++)o[i]=[];return function(i){for(let n=0;n<i.geometrys.length;n++){let e=i.geometrys[n],a=.5*e.length;for(let n=0;n<a;n++){let x=2*n,f={x:Math.round(e[x]),y:Math.round(e[x+1])},h=(n+1)%a*2,u={x:Math.round(e[h]),y:Math.round(e[h+1])},l=(n-1+a)%a*2,s={x:Math.round(e[l]),y:Math.round(e[l+1])},c=(n+2)%a*2,g={x:Math.round(e[c]),y:Math.round(e[c+1])};if(u.y!=f.y){let n=new d;n.totalHeight=i.totalHeight,n.id=r++,n.isIn=!1,n.dx=(u.x-f.x)/(u.y-f.y),u.y>f.y?(n.xi=f.x,g.y>=u.y?n.ymax=u.y-1:n.ymax=u.y,o[f.y-y].push(n)):(n.xi=u.x,s.y>=f.y?n.ymax=f.y-1:n.ymax=f.y,o[u.y-y].push(n)),t.push(n)}}}}(s),function(){e=-1;for(let i=0;i<t.length;i++)n[i]=-1;for(let r=y;r<=a;r++){u(r-y);for(let o=e;-1!=o&&void 0!==o;o=n[n[o]])if(-1!=n[o])for(let e=t[o].xi;e<=t[n[o]].xi;e++){if(e<0||e>x-1||r<0||r>x-1)continue;e=e==x?x-1:e,r=r==x?x-1:r,i[r*x+e]=t[o].totalHeight}f(r),h()}return i}()}}));