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

2 lines
3.9 KiB
JavaScript
Raw Normal View History

2023-11-07 10:04:37 +08:00
define(["./createTaskProcessorWorker","./Resource-8ae1a924","./Cartesian3-e0307675","./ModelPointDrawer","./snappyJs","./when-422ea0ae","./ScanLine","./ElevationTool","./Cache","./defaultValue-81eec7ed","./Check-741c5f3c","./combine-3c023bda","./Math-e73894ab","./RuntimeError-26acdd3b","./LinkedQueue"],(function(e,t,r,n,l,o,i,a,f,h,s,u,c,g,p){"use strict";let y,d,m,w=512,v="",S={},b={},x=new f(1e5);function C(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 A(e,t){let n=t.rectangle;for(var l=[],o=0;o<e.length;o++){var i=M(e[o],e[o+1],n),a=r.Cartesian3.fromDegrees(i[0],i[1]);l.push(a),o++}return l}function M(e,t,r){var n=P(r.west+r.width/w*e),l=P(r.north-r.height/w*t);return[n=Number(n.toFixed(6)),l=Number(l.toFixed(6))]}function P(e){return 180*e/Math.PI}function D(e,t){if(Array.isArray(t[0])){let r=t.length;for(let n=0;n<r;n++){D(e,t[n])}}else e.push(t)}function F(e,t){if("F"!=e[0])if(Array.isArray(e[0])){let r=e.length;for(let n=0;n<r;n++){F(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*-w,.05*-w,1.05*w,.05*-w,1.05*w,1.05*w,.05*-w,1.05*w]}return e((function(e,r){if(1==e.init)return function(e){return y=new Function("drawer","level",e.styleStr),w=e.tileSize,v=e.return_type,S=e,d=e.indexDbNames,m=e.indexDbName,a.getDBMap(d,b)}(e);var f,h=e.url,s=new t.Resource({url:h});if(s.request.throttle=!1,s.request.throttleByServer=!0,s.request.type=1,!(f="stream_snappy"==v?s.fetchArrayBuffer():s.fetchJson()))return!0;let u=[];u.push(f);let c=d.slice(0,d.length-1);u.push(a.getElevation(b,c,e.xyz));let g=o.when.defer();return o.when.all(u,(function(t){let r=t[0];if(r||(r={}),"stream_snappy"==v){r=l(r);let e=function(e){let t=[],r=0,n=0;for(;r<e.length;){let l=e[r++];if(l<128)t[n++]=l;else if(l>191&&l<224){let o=e[r++];t[n++]=(31&l)<<6|63&o}else if(l>239&&l<365){let o=((7&l)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[n++]=55296+(o>>10),t[n++]=56320+(1023&o)}else{let o=e[r++],i=e[r++];t[n++]=(15&l)<<12|(63&o)<<6|63&i}}let l=[],o=0,i=0,a=0,f=5e4,h=t.length/f-1;for(o=0;o<h;o++)i=o*f,a=(o+1)*f,l.push(String.fromCharCode.apply({},t.slice(i,a)));return i=o*f,a=t.length,l.push(String.fromCharCode.apply({},t.slice(i,a))),l=l.join(""),l}(new Uint8Array(r));r=JSON.parse(e)}let o=function(e,t){if(e&&e.layer){(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++)F(n[e][2],t)}})(e=e.layer,t.needDecode);let r={},l=new n([e],t.level,r,t.controlVector,t.highLightVector,t.filterLayerId);return y.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=[];D(n,t.data),delete t.data,t.geometrys=n;let l=0;if(S.hasOwnProperty("heightProperty")){let e=S.heightProperty;l=t.properties[e],S.hasOwnProperty("heightScale")&&(l*=parseFloat(S.heightScale))}t.height=l,t.totalHeight=l}}}(r),r}return{}}(r,e);S.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=x.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>w-1||a<0||a>w-1)continue;let f=a*w+l,h=0;for(let e in t){h+=t[e].data[f]}h>i&&(i=h)}}-2e4==i&&(i=0),x.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=C(n.geometrys);i(r,n,t,o.ymax,o.ymin)}}return r}(o,w);!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=A(r.geometrys[e],t);r.points.push(n)}delete r.geometrys}}}(o,e),a.updateElevation(b[m],m,e.xyz,f).promise.always((function(e){g.resolve(o)}))}),(function(e){g.reject(e)})),g.promise}))}));