bimland/dist/Cesium/Workers/MVTWorker.js

2 lines
149 KiB
JavaScript
Raw Normal View History

2023-07-26 17:04:38 +08:00
define(["./createTaskProcessorWorker","./Color-5008547b","./when-b60132fc","./Check-7b2a090c","./pbf-2b242707","./FeatureDetection-c3b71206","./Math-119be1a3"],(function(t,e,n,i,r,o,s){"use strict";function a(){}function l(t){var e=null,n=null,i=null;return h(t[0])?(i=t[0],t.length>1&&"$"===(n=t[1])[0]?null:(t.length>2&&(e=t[2]),{filterOperator:i,filterFieldName:n,filterCompareValue:e})):null}function h(t){return-1!==["==","===",">=","<=",">","<","!=","has"].indexOf(t)}function c(t,e,n){return t[e]==n}a.parseLayerFilter=function(t){if(!(n.defined(t)&&t instanceof Array))return null;var e,i=[];if(h(t[0]))e=l(t),n.defined(e)&&i.push(e);else for(var r=0;r<t.length;r++)if(t[r]instanceof Array)if(3!==t[r].length)for(var o=0;o<t[r].length;o++)t[r][o]instanceof Array&&3===t[r][o].length&&(e=l(t[r][o]),n.defined(e)&&i.push(e));else e=l(t[r]),n.defined(e)&&i.push(e);return i},a.filterTest=function(t,e){for(var n=0,i=e.length;n<i;n++){var r=e[n];if(!u[r.filterOperator](t,r.filterFieldName,r.filterCompareValue))return!1}return!0};var u={"==":c,"===":c,">":function(t,e,n){return t[e]>n},"<":function(t,e,n){return t[e]<n},">=":function(t,e,n){return t[e]>=n},"<=":function(t,e,n){return t[e]<=n},"!=":function(t,e,n){return t[e]!=n},has:function(t,e){return n.defined(t[e])}};function d(t,e){if(!t)throw new i.DeveloperError("need include ol-debug.js");this._useOffscreen=e,this._openlayer=t}function f(t){var e=t.substring(t.indexOf("(")+1,t.indexOf(")"));e=e.split(",");var n=[];return n.push(parseFloat(e[0])),n.push(parseFloat(e[1])),n.push(parseFloat(e[2])),n.push(parseFloat(e[3])),n}function g(t,e){if(t&&void 0!==e){var n={color:[255*t[0]/t[3],255*t[1]/t[3],255*t[2]/t[3],t[3]],opacity:t[3]};(t=n.color)[3]=n.opacity*e,0===t[3]&&(t=void 0)}return t}Object.defineProperties(d.prototype,{proxy:{get:function(){}}}),d.prototype.getStyle=function(){var t=this._openlayer,e=new t.style.Fill({color:""});e.setColor("#ffffff");var n=new t.style.Stroke({color:"",width:1});return n.setWidth(1),n.setColor("#000000"),new t.style.Style({fill:e,stroke:n})},d.prototype.getStyleByMapboxStyle=function(t){var e=this._openlayer,i=t.type,r=t.paint,o=t.layout;if(!n.defined(i)||!n.defined(r))return this.getStyle();if("fill"==i){var s=new e.style.Style({}),a=new e.style.Fill({color:"[255,255,255,1]"});s.setFill(a);var l=r["fill-opacity"];if(n.defined(r["fill-color"])){var h=f(r["fill-color"]);n.defined(l)&&(h[3]*=l),a.setColor(h)}if(n.defined(r["fill-outline-color"])){var c=new e.style.Stroke({color:"",width:1});c.setColor(r["fill-outline-color"]),s.setStroke(c)}return n.defined(r["fill-pattern"])&&(s.fillPatternName=r["fill-pattern"]),s}if("line"==i){var u=new e.style.Style({}),d=new e.style.Stroke({color:"#000000",width:1});u.setStroke(d);var p=r["line-opacity"];if(n.defined(r["line-color"])){var y=f(r["line-color"]);n.defined(p)&&(y[3]*=p)}if(n.defined(r["line-width"])){var m=r["line-width"];d.setWidth(m)}if(n.defined(r["line-dasharray"])){var v=r["line-dasharray"];d.setLineDash(v)}if(n.defined(o)){if(n.defined(o["line-cap"])){var _=o["line-cap"];d.setLineCap(_)}if(n.defined(o["line-join"])){var S=o["line-join"];d.setLineJoin(S)}if(n.defined(o["line-miter-limit"])){var x=o["line-miter-limit"];d.setMiterLimit(x)}}return d.setColor(y),u}if("symbol"==i){var I=new e.style.Style({});return n.defined(o)&&n.defined(o["icon-image"])&&(I.hasIconImage=!0),n.defined(o)&&n.defined(o["text-field"])&&(I.hasTextStyle=!0),I}if("circle"==i){var C=r["circle-radius"],T=r["circle-color"],R=r["circle-stroke-color"],L=r["circle-opacity"],E=r["circle-stroke-opacity"],O=r["circle-stroke-width"],G=new e.style.Circle({radius:C,stroke:0===O?void 0:new e.style.Stroke({width:O,color:g(R,E)}),fill:new e.style.Fill({color:g(T,L)})}),M=new e.style.Style({});return M.setImage(G),M}return this.getStyle()};var p=new e.Color;d.prototype.getIDColorStyle=function(t,e,i,r,o,s){var a=this._openlayer,l=function(t,e){var n=Math.floor(t/65536),i=t-65536*n,r=Math.floor(i/256),o=i-256*r;return p.red=o/256,p.green=r/256,p.blue=n/256,p.alpha=1,p}(e),h=l.toCssColorString();if("LineString"==t||"LinearRing"=