qa-prevention-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/VectorWorker.js

2 lines
3.2 KiB
JavaScript

define(["./createTaskProcessorWorker","./Transforms-5b829630","./Resource-8ae1a924","./Cartesian2-bd414876","./Cartesian3-e0307675","./VectorDrawer","./snappyJs","./point-766425d1","./ColorUtil","./defaultValue-81eec7ed","./when-422ea0ae","./Matrix4-4c545f70","./Check-741c5f3c","./Math-e73894ab","./RuntimeError-26acdd3b","./combine-3c023bda"],(function(e,t,r,l,n,i,a,o,f,s,u,c,h,y,p,d){"use strict";let g,b=512,k="";function w(e){let t=[],r=0,l=0;for(;r<e.length;){let n=e[r++];if(n<128)t[l++]=n;else if(n>191&&n<224){let i=e[r++];t[l++]=(31&n)<<6|63&i}else if(n>239&&n<365){let i=((7&n)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[l++]=55296+(i>>10),t[l++]=56320+(1023&i)}else{let i=e[r++],a=e[r++];t[l++]=(15&n)<<12|(63&i)<<6|63&a}}let n=[],i=0,a=0,o=0,f=5e4,s=t.length/f-1;for(i=0;i<s;i++)a=i*f,o=(i+1)*f,n.push(String.fromCharCode.apply({},t.slice(a,o)));return a=i*f,o=t.length,n.push(String.fromCharCode.apply({},t.slice(a,o))),n=n.join(""),n}function C(e,t){if(e&&e.layer){(function(e,t){for(let r in e){let l=e[r].features;l||(l=e[r].datas);for(let e=0;e<l.length;e++)F(l[e][2],t)}})(e=e.layer,t.needDecode);let r={},l=new i([e],t.level,r,t.controlVector,t.highLightVector,t.filterLayerId);return g.call({},l,t.level),r}return{}}function F(e,t){if("F"!=e[0])if(Array.isArray(e[0])){let r=e.length;for(let l=0;l<r;l++){F(e[l],t)}}else t&&function(e){let t=[e[0],e[1]];for(let r=2;r<e.length;r++){let l=t[0]+e[r],n=t[1]+e[r+1];e[r]=l,e[r+1]=n,t=[l,n],r++}}(e);else e[0]=[.05*-b,.05*-b,1.05*b,.05*-b,1.05*b,1.05*b,.05*-b,1.05*b]}function S(e,t){let r=[];for(let l=0;l<e.keyArr.length;l++){let n=e[e.keyArr[l]],i=n.style;if(A(i),n.lineFeatues.length>0){let e=new o.LineBucket({style:i,type:"line",tileSize:b});for(let t of n.lineFeatues){m(t,i);let r=z(t);e.addFeature(r)}e=e.serialize(t),r.push(e)}else if(n.fillFeatures.length>0){let e=new o.FillBucket({style:i,type:"fill",tileSize:b}),l=new o.LineBucket({style:i,type:"line",tileSize:b});for(let t of n.fillFeatures){m(t,i);let r=z(t);e.addFeature(r),i.stroke&&l.addFeature(r)}e=e.serialize(t),r.push(e),i.stroke&&(l=l.serialize(t),r.push(l))}}return r}function m(e,t,r){if(!t.sparsity)return;let l=parseFloat(t.sparsity);for(let t=0;t<e.data.length;t++){let r=e.data[t];null==l&&1==l||(e.data[t]=o.simplify(r,l/4,!0))}}function z(e){let t=256/b*32,r=[];for(let l=0;l<e.data.length;l++){r[l]=[];let n=e.data[l];for(let e=0;e<n.length;e++)if(e%2==0){let i=n[e]*t,a=n[e+1]*t;r[l].push(new o.Point(i,a))}}return r}function A(e){let t=new f;if(e.fillColor){t.fromHex(e.fillColor);let r=[t.rgb[0]/255,t.rgb[1]/255,t.rgb[2]/255,1];e.fillColor=r}if(e.strokeColor){t=new f,t.fromHex(e.strokeColor);let r=[t.rgb[0]/255,t.rgb[1]/255,t.rgb[2]/255,1];e.strokeColor=r}}return e((function(e,t){if(1==e.init)return g=new Function("drawer","level",e.styleStr),b=e.tileSize,k=e.return_type,!0;if(1==e.changeStyle){let r=w(new Uint8Array(e.tileData));return S(C(JSON.parse(r),e),t)}var l,n=e.url,i=new r.Resource({url:n});return i.request.throttle=!1,i.request.throttleByServer=!0,i.request.type=1,!(l="stream_snappy"==k?i.fetchArrayBuffer():i.fetchJson())||l.then((function(r){let l=null;if("stream_snappy"==k){r=a(r),t.push(r);let e=new Uint8Array(r);l=e.buffer;let n=w(e);r=JSON.parse(n)}return{tileData:l,buckets:S(C(r,e),t)}}))}))}));