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

2 lines
3.5 KiB
JavaScript
Raw Permalink Normal View History

2023-11-07 10:04:37 +08:00
define(["./createTaskProcessorWorker","./Resource-8ae1a924","./Cartesian3-e0307675","./ModelPointDrawer","./ParseBinaryData","./when-422ea0ae","./ScanLine","./ElevationTool","./Cache","./defaultValue-81eec7ed","./Check-741c5f3c","./combine-3c023bda","./Math-e73894ab","./RuntimeError-26acdd3b","./Buffer","./base64","./ieee754","./isArray","./VarintReader","./snappyJs","./CodeTool","./LayerContentModel","./GisTools","./LinkedQueue"],(function(e,t,r,n,l,o,i,a,f,u,s,h,c,g,d,y,p,m,v,w,b,M,x,P){"use strict";let A,D,C,F={},S=512,B={},L={},T={},k=new f(1e5);function E(e,t){if("F"!=e[0])if(Array.isArray(e[0])){let r=e.length;for(let n=0;n<r;n++){E(e[n],t)}}else t&&function(e){let t=[e[0],e[1]];for(let r=2;r<e.length;r++){let n=t[0]+e[r],l=t[1]+e[r+1];e[r]=n,e[r+1]=l,t=[n,l],r++}}(e);else e[0]=[.05*-S,.05*-S,1.05*S,.05*-S,1.05*S,1.05*S,.05*-S,1.05*S]}function I(e){let t=1e3,r=0;for(let n=0;n<e.length;n++){let l=e[n];for(let e=0;e<l.length-1;e++){let n=Math.round(l[e+1]);n<t&&(t=n),n>r&&(r=n),e++}}return{ymax:r,ymin:t}}function N(e,t){if(Array.isArray(t[0])){let r=t.length;for(let n=0;n<r;n++){N(e,t[n])}}else e.push(t)}function R(e,t){let n=t.rectangle;for(var l=[],o=0;o<e.length;o++){var i=V(e[o],e[o+1],n),a=r.Cartesian3.fromDegrees(i[0],i[1]);l.push(a),o++}return l}function V(e,t,r){var n=q(r.west+r.width/S*e),l=q(r.north-r.height/S*t);return[n=Number(n.toFixed(6)),l=Number(l.toFixed(6))]}function q(e){return 180*e/Math.PI}return e((function(e,r){if(1==e.init)return function(e){return C=new Function("render","level",e.styleStr),S=e.tileSize,B=e,A=e.indexDbNames,D=e.indexDbName,L=e.serverInfo,T=e.layerFieldMap,a.getDBMap(A,F)}(e);var f=e.url,u=new t.Resource({url:f});u.request.throttle=!1,u.request.throttleByServer=!0,u.request.type=1;var s=u.fetchArrayBuffer();if(!s)return!0;let h=[];h.push(s);let c=A.slice(0,A.length-1);h.push(a.getElevation(F,c,e.xyz));let g=o.when.defer();return o.when.all(h,(function(t){let r=t[0];if(!r)return void g.resolve({});let o=function(e,t){if(e){!function(e,t){for(let r in e){let n=e[r].features;n||(n=e[r].datas);for(let e=0;e<n.length;e++)E(n[e][2],t)}}(e,t.needDecode);let r={},l=new n([e],t.level,r,t.controlVector,t.highLightVector,t.filterLayerId);return C.call({},l,t.level),function(e){for(let t in e){let r=e[t];for(let e=0;e<r.length;e++){let t=r[e],n=[];N(n,t.data),delete t.data,t.geometrys=n;let l=0;if(B.hasOwnProperty("heightProperty")){let e=B.heightProperty;l=t.properties[e],B.hasOwnProperty("heightScale")&&(l*=parseFloat(B.heightScale))}t.height=l,t.totalHeight=l}}}(r),r}return{}}(l(r,T,L),e);B.hasTerrain&&function(e,t){var r=1e3,n=0;for(let l in e){let o=e[l];for(let e=0;e<o.length;e++){let l=o[e],i=-2e4,a=k.get(l.properties.id);if(a)i=a;else{for(let e=0;e<l.geometrys.length;e++){let o=l.geometrys[e];for(let e=0;e<o.length-1;e++){let l=Math.round(o[e]),a=Math.round(o[e+1]);if(a<r&&(r=a),a>n&&(n=a),e++,l<0||l>S-1||a<0||a>S-1)continue;let f=a*S+l,u=0;for(let e in t){u+=t[e].data[f]}u>i&&(i=u)}}-2e4==i&&(i=0),k.set(l.properties.id,i)}l.terrainHeight=i,l.totalHeight=i+l.height}}}(o,t[1]);let f=function(e,t){let r=new Int32Array(t*t);for(let n in e){let l=e[n];for(let e=0;e<l.length;e++){let n=l[e],o=I(n.geometrys);i(r,n,t,o.ymax,o.ymin)}}return r}(o,S);!function(e,t){for(let r in e){let n=e[r];for(let e=0;e<n.length;e++){let r=n[e];r.points=[];for(let e=0;e<r.geometrys.length;e++){let n=R(r.geometrys[e],t);r.points.push(n)}delete r.geometrys}}}(o,e),a.updateElevation(F[D],D,e.xyz,f).promise.always((function(e){g.resolve(o)}))}),(function(e){g.reject(e)})),g.promise}))}));