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

2 lines
2.2 KiB
JavaScript
Raw Normal View History

2024-01-02 14:12:39 +08:00
define(["./createTaskProcessorWorker","./Resource-8ae1a924","./VectorDrawer","./point-766425d1","./ColorUtil","./ParseBinaryData","./defaultValue-81eec7ed","./when-422ea0ae","./Check-741c5f3c","./combine-3c023bda","./Math-e73894ab","./RuntimeError-26acdd3b","./Buffer","./base64","./ieee754","./isArray","./VarintReader","./snappyJs","./CodeTool","./LayerContentModel","./GisTools"],(function(e,t,r,l,i,n,a,o,u,s,f,c,y,d,h,p,g,k,b,w,F){"use strict";let C,v=512,z={},B={};function S(e,t){if(!e)return{};e=e.layer?e.layer:e;let l={},i=new r([e],t.level,l,t.controlVector,t.highLightVector,t.filterLayerId);return C.call({},i,t.level),l}function m(e,t){let r=[];for(let i=0;i<e.keyArr.length;i++){let n=e[e.keyArr[i]],a=n.style;if(A(a),n.lineFeatues.length>0){let e=new l.LineBucket({style:a,type:"line",tileSize:v});for(let t of n.lineFeatues){L(t,a);let r=V(t);e.addFeature(r)}e=e.serialize(t),r.push(e)}else if(n.fillFeatures.length>0){let e=new l.FillBucket({style:a,type:"fill",tileSize:v}),i=new l.LineBucket({style:a,type:"line",tileSize:v});for(let t of n.fillFeatures){L(t,a);let r=V(t);e.addFeature(r),a.stroke&&i.addFeature(r)}e=e.serialize(t),r.push(e),a.stroke&&(i=i.serialize(t),r.push(i))}}return r}function L(e,t,r){if(!t.sparsity)return;let i=parseFloat(t.sparsity);for(let t=0;t<e.data.length;t++){let r=e.data[t];null==i&&1==i||(e.data[t]=l.simplify(r,i/4,!0))}}function V(e){let t=256/v*32,r=[];for(let i=0;i<e.data.length;i++){r[i]=[];let n=e.data[i];for(let e=0;e<n.length;e++)if(e%2==0){let a=n[e]*t,o=n[e+1]*t;r[i].push(new l.Point(a,o))}}return r}function A(e){let t=new i;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 i,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,r){if(1==e.init)return C=new Function("render","level",e.styleStr),v=e.tileSize,z=e.serverInfo,B=e.layerFieldMap,!0;if(1==e.changeStyle){return m(S(n(e.tileData,B,z),e),r)}var l=e.url,i=new t.Resource({url:l});i.request.throttle=!1,i.request.throttleByServer=!0,i.request.type=1;var a=i.fetchArrayBuffer();return!a||a.then((function(t){return{tileData:t,buckets:m(S(n(t,B,z),e),r)}}))}))}));