chbim-plugins 0.0.115 → 0.0.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/chbim-plugins.js CHANGED
@@ -25433,8 +25433,8 @@ class T1 {
25433
25433
  if (this.entityItem.type == "circleP" && Object.keys(u).length == 1 && Object.keys(u)[0] == "radius" && u.radius == this.entityItem.options.style.radius)
25434
25434
  return !1;
25435
25435
  this.entityItem.setStyle({
25436
- ...u
25437
- // horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
25436
+ ...u,
25437
+ horizontalOrigin: Cesium.HorizontalOrigin.CENTER
25438
25438
  });
25439
25439
  }
25440
25440
  }
@@ -2634,7 +2634,7 @@ function print() { __p += __j.call(arguments, '') }
2634
2634
  `)+pe+`return __p
2635
2635
  }`;var Mi=Np(function(){return Fi(ut,Je+"return "+pe).apply(s,yt)});if(Mi.source=pe,cf(Mi))throw Mi;return Mi}function A_(r){return Zi(r).toLowerCase()}function P_(r){return Zi(r).toUpperCase()}function L_(r,h,v){if(r=Zi(r),r&&(v||h===s))return ya(r);if(!r||!(h=Ye(h)))return r;var I=ar(r),Y=ar(h),ut=ts(I,Y),yt=bs(I,Y)+1;return xn(I,ut,yt).join("")}function R_(r,h,v){if(r=Zi(r),r&&(v||h===s))return r.slice(0,_a(r)+1);if(!r||!(h=Ye(h)))return r;var I=ar(r),Y=bs(I,ar(h))+1;return xn(I,0,Y).join("")}function O_(r,h,v){if(r=Zi(r),r&&(v||h===s))return r.replace(lo,"");if(!r||!(h=Ye(h)))return r;var I=ar(r),Y=ts(I,ar(h));return xn(I,Y).join("")}function I_(r,h){var v=ct,I=It;if(wn(h)){var Y="separator"in h?h.separator:Y;v="length"in h?wi(h.length):v,I="omission"in h?Ye(h.omission):I}r=Zi(r);var ut=r.length;if(Ir(r)){var yt=ar(r);ut=yt.length}if(v>=ut)return r;var bt=v-$r(I);if(bt<1)return I;var Nt=yt?xn(yt,0,bt).join(""):r.slice(0,bt);if(Y===s)return Nt+I;if(yt&&(bt+=Nt.length-bt),ff(Y)){if(r.slice(bt).search(Y)){var oe,le=Nt;for(Y.global||(Y=Kn(Y.source,Zi(jl.exec(Y))+"g")),Y.lastIndex=0;oe=Y.exec(le);)var pe=oe.index;Nt=Nt.slice(0,pe===s?bt:pe)}}else if(r.indexOf(Ye(Y),bt)!=bt){var ze=Nt.lastIndexOf(Y);ze>-1&&(Nt=Nt.slice(0,ze))}return Nt+I}function D_(r){return r=Zi(r),r&&qo.test(r)?r.replace(Ao,th):r}var z_=De(function(r,h,v){return r+(v?" ":"")+h.toUpperCase()}),mf=Me("toUpperCase");function Bp(r,h,v){return r=Zi(r),h=v?s:h,h===s?Ls(r)?jc(r):rl(r):r.match(h)||[]}var Np=ae(function(r,h){try{return yr(r,s,h)}catch(v){return cf(v)?v:new ai(v)}}),k_=Vs(function(r,h){return Ji(h,function(v){v=us(v),Bo(r,v,hf(r[v],r))}),r});function B_(r){var h=r==null?0:r.length,v=si();return r=h?Yi(r,function(I){if(typeof I[1]!="function")throw new lr(m);return[v(I[0]),I[1]]}):[],ae(function(I){for(var Y=-1;++Y<h;){var ut=r[Y];if(yr(ut[0],this,I))return yr(ut[1],this,I)}})}function N_(r){return Ra(wr(r,O))}function gf(r){return function(){return r}}function F_(r,h){return r==null||r!==r?h:r}var U_=Ri(),G_=Ri(!0);function Gr(r){return r}function vf(r){return H(typeof r=="function"?r:wr(r,O))}function H_(r){return gt(wr(r,O))}function V_(r,h){return Ct(r,wr(h,O))}var W_=ae(function(r,h){return function(v){return e(v,r,h)}}),j_=ae(function(r,h){return function(v){return e(r,v,h)}});function yf(r,h,v){var I=Jn(h),Y=Us(h,I);v==null&&!(wn(h)&&(Y.length||!I.length))&&(v=h,h=r,r=this,Y=Us(h,Jn(h)));var ut=!(wn(v)&&"chain"in v)||!!v.chain,yt=js(r);return Ji(Y,function(bt){var Nt=h[bt];r[bt]=Nt,yt&&(r.prototype[bt]=function(){var oe=this.__chain__;if(ut||oe){var le=r(this.__wrapped__),pe=le.__actions__=er(this.__actions__);return pe.push({func:Nt,args:arguments,thisArg:r}),le.__chain__=oe,le}return Nt.apply(r,fo([this.value()],arguments))})}),r}function X_(){return gn._===this&&(gn._=Kr),this}function _f(){}function q_(r){return r=wi(r),ae(function(h){return Z(h,r)})}var Y_=Nn(Yi),Z_=Nn(Bh),J_=Nn(Po);function Fp(r){return nf(r)?$o(us(r)):$t(r)}function $_(r){return function(h){return r==null?s:ls(r,h)}}var K_=eu(),Q_=eu(!0);function xf(){return[]}function wf(){return!1}function t1(){return{}}function e1(){return""}function i1(){return!0}function n1(r,h){if(r=wi(r),r<1||r>fe)return[];var v=Ot,I=Vn(r,Ot);h=si(h),r-=Ot;for(var Y=Ro(I,h);++v<r;)h(v);return Y}function r1(r){return vi(r)?Yi(r,us):to(r)?[r]:er(op(Zi(r)))}function o1(r){var h=++ur;return Zi(r)+h}var s1=Tr(function(r,h){return r+h},0),a1=dh("ceil"),l1=Tr(function(r,h){return r/h},1),h1=dh("floor");function u1(r){return r&&r.length?Mo(r,Gr,uh):s}function c1(r,h){return r&&r.length?Mo(r,si(h,2),uh):s}function f1(r){return va(r,Gr)}function d1(r,h){return va(r,si(h,2))}function p1(r){return r&&r.length?Mo(r,Gr,rt):s}function m1(r,h){return r&&r.length?Mo(r,si(h,2),rt):s}var g1=Tr(function(r,h){return r*h},1),v1=dh("round"),y1=Tr(function(r,h){return r-h},0);function _1(r){return r&&r.length?Qo(r,Gr):0}function x1(r,h){return r&&r.length?Qo(r,si(h,2)):0}return it.after=Hv,it.ary=gp,it.assign=Py,it.assignIn=Lp,it.assignInWith=Qu,it.assignWith=Ly,it.at=Ry,it.before=vp,it.bind=hf,it.bindAll=k_,it.bindKey=yp,it.castArray=ty,it.chain=dp,it.chunk=h0,it.compact=u0,it.concat=c0,it.cond=B_,it.conforms=N_,it.constant=gf,it.countBy=_v,it.create=Oy,it.curry=_p,it.curryRight=xp,it.debounce=wp,it.defaults=Iy,it.defaultsDeep=Dy,it.defer=Vv,it.delay=Wv,it.difference=f0,it.differenceBy=d0,it.differenceWith=p0,it.drop=m0,it.dropRight=g0,it.dropRightWhile=v0,it.dropWhile=y0,it.fill=_0,it.filter=wv,it.flatMap=Sv,it.flatMapDeep=Ev,it.flatMapDepth=bv,it.flatten=hp,it.flattenDeep=x0,it.flattenDepth=w0,it.flip=jv,it.flow=U_,it.flowRight=G_,it.fromPairs=T0,it.functions=Gy,it.functionsIn=Hy,it.groupBy=Cv,it.initial=S0,it.intersection=E0,it.intersectionBy=b0,it.intersectionWith=C0,it.invert=Wy,it.invertBy=jy,it.invokeMap=Pv,it.iteratee=vf,it.keyBy=Lv,it.keys=Jn,it.keysIn=Ur,it.map=qu,it.mapKeys=qy,it.mapValues=Yy,it.matches=H_,it.matchesProperty=V_,it.memoize=Zu,it.merge=Zy,it.mergeWith=Rp,it.method=W_,it.methodOf=j_,it.mixin=yf,it.negate=Ju,it.nthArg=q_,it.omit=Jy,it.omitBy=$y,it.once=Xv,it.orderBy=Rv,it.over=Y_,it.overArgs=qv,it.overEvery=Z_,it.overSome=J_,it.partial=uf,it.partialRight=Tp,it.partition=Ov,it.pick=Ky,it.pickBy=Op,it.property=Fp,it.propertyOf=$_,it.pull=R0,it.pullAll=cp,it.pullAllBy=O0,it.pullAllWith=I0,it.pullAt=D0,it.range=K_,it.rangeRight=Q_,it.rearg=Yv,it.reject=zv,it.remove=z0,it.rest=Zv,it.reverse=af,it.sampleSize=Bv,it.set=t_,it.setWith=e_,it.shuffle=Nv,it.slice=k0,it.sortBy=Gv,it.sortedUniq=V0,it.sortedUniqBy=W0,it.split=S_,it.spread=Jv,it.tail=j0,it.take=X0,it.takeRight=q0,it.takeRightWhile=Y0,it.takeWhile=Z0,it.tap=uv,it.throttle=$v,it.thru=Xu,it.toArray=Cp,it.toPairs=Ip,it.toPairsIn=Dp,it.toPath=r1,it.toPlainObject=Pp,it.transform=i_,it.unary=Kv,it.union=J0,it.unionBy=$0,it.unionWith=K0,it.uniq=Q0,it.uniqBy=tv,it.uniqWith=ev,it.unset=n_,it.unzip=lf,it.unzipWith=fp,it.update=r_,it.updateWith=o_,it.values=gh,it.valuesIn=s_,it.without=iv,it.words=Bp,it.wrap=Qv,it.xor=nv,it.xorBy=rv,it.xorWith=ov,it.zip=sv,it.zipObject=av,it.zipObjectDeep=lv,it.zipWith=hv,it.entries=Ip,it.entriesIn=Dp,it.extend=Lp,it.extendWith=Qu,yf(it,it),it.add=s1,it.attempt=Np,it.camelCase=u_,it.capitalize=zp,it.ceil=a1,it.clamp=a_,it.clone=ey,it.cloneDeep=ny,it.cloneDeepWith=ry,it.cloneWith=iy,it.conformsTo=oy,it.deburr=kp,it.defaultTo=F_,it.divide=l1,it.endsWith=c_,it.eq=Uo,it.escape=f_,it.escapeRegExp=d_,it.every=xv,it.find=Tv,it.findIndex=ap,it.findKey=zy,it.findLast=Mv,it.findLastIndex=lp,it.findLastKey=ky,it.floor=h1,it.forEach=pp,it.forEachRight=mp,it.forIn=By,it.forInRight=Ny,it.forOwn=Fy,it.forOwnRight=Uy,it.get=df,it.gt=sy,it.gte=ay,it.has=Vy,it.hasIn=pf,it.head=up,it.identity=Gr,it.includes=Av,it.indexOf=M0,it.inRange=l_,it.invoke=Xy,it.isArguments=Al,it.isArray=vi,it.isArrayBuffer=ly,it.isArrayLike=Fr,it.isArrayLikeObject=Dn,it.isBoolean=hy,it.isBuffer=ka,it.isDate=uy,it.isElement=cy,it.isEmpty=fy,it.isEqual=dy,it.isEqualWith=py,it.isError=cf,it.isFinite=my,it.isFunction=js,it.isInteger=Mp,it.isLength=$u,it.isMap=Sp,it.isMatch=gy,it.isMatchWith=vy,it.isNaN=yy,it.isNative=_y,it.isNil=wy,it.isNull=xy,it.isNumber=Ep,it.isObject=wn,it.isObjectLike=Ln,it.isPlainObject=ou,it.isRegExp=ff,it.isSafeInteger=Ty,it.isSet=bp,it.isString=Ku,it.isSymbol=to,it.isTypedArray=mh,it.isUndefined=My,it.isWeakMap=Sy,it.isWeakSet=Ey,it.join=A0,it.kebabCase=p_,it.last=bo,it.lastIndexOf=P0,it.lowerCase=m_,it.lowerFirst=g_,it.lt=by,it.lte=Cy,it.max=u1,it.maxBy=c1,it.mean=f1,it.meanBy=d1,it.min=p1,it.minBy=m1,it.stubArray=xf,it.stubFalse=wf,it.stubObject=t1,it.stubString=e1,it.stubTrue=i1,it.multiply=g1,it.nth=L0,it.noConflict=X_,it.noop=_f,it.now=Yu,it.pad=v_,it.padEnd=y_,it.padStart=__,it.parseInt=x_,it.random=h_,it.reduce=Iv,it.reduceRight=Dv,it.repeat=w_,it.replace=T_,it.result=Qy,it.round=v1,it.runInContext=Lt,it.sample=kv,it.size=Fv,it.snakeCase=M_,it.some=Uv,it.sortedIndex=B0,it.sortedIndexBy=N0,it.sortedIndexOf=F0,it.sortedLastIndex=U0,it.sortedLastIndexBy=G0,it.sortedLastIndexOf=H0,it.startCase=E_,it.startsWith=b_,it.subtract=y1,it.sum=_1,it.sumBy=x1,it.template=C_,it.times=n1,it.toFinite=Xs,it.toInteger=wi,it.toLength=Ap,it.toLower=A_,it.toNumber=Co,it.toSafeInteger=Ay,it.toString=Zi,it.toUpper=P_,it.trim=L_,it.trimEnd=R_,it.trimStart=O_,it.truncate=I_,it.unescape=D_,it.uniqueId=o1,it.upperCase=z_,it.upperFirst=mf,it.each=pp,it.eachRight=mp,it.first=up,yf(it,function(){var r={};return Nr(it,function(h,v){Ti.call(it.prototype,v)||(r[v]=h)}),r}(),{chain:!1}),it.VERSION=c,Ji(["bind","bindKey","curry","curryRight","partial","partialRight"],function(r){it[r].placeholder=it}),Ji(["drop","take"],function(r,h){_i.prototype[r]=function(v){v=v===s?1:vn(wi(v),0);var I=this.__filtered__&&!h?new _i(this):this.clone();return I.__filtered__?I.__takeCount__=Vn(v,I.__takeCount__):I.__views__.push({size:Vn(v,Ot),type:r+(I.__dir__<0?"Right":"")}),I},_i.prototype[r+"Right"]=function(v){return this.reverse()[r](v).reverse()}}),Ji(["filter","map","takeWhile"],function(r,h){var v=h+1,I=v==G||v==Et;_i.prototype[r]=function(Y){var ut=this.clone();return ut.__iteratees__.push({iteratee:si(Y,3),type:v}),ut.__filtered__=ut.__filtered__||I,ut}}),Ji(["head","last"],function(r,h){var v="take"+(h?"Right":"");_i.prototype[r]=function(){return this[v](1).value()[0]}}),Ji(["initial","tail"],function(r,h){var v="drop"+(h?"":"Right");_i.prototype[r]=function(){return this.__filtered__?new _i(this):this[v](1)}}),_i.prototype.compact=function(){return this.filter(Gr)},_i.prototype.find=function(r){return this.filter(r).head()},_i.prototype.findLast=function(r){return this.reverse().find(r)},_i.prototype.invokeMap=ae(function(r,h){return typeof r=="function"?new _i(this):this.map(function(v){return e(v,r,h)})}),_i.prototype.reject=function(r){return this.filter(Ju(si(r)))},_i.prototype.slice=function(r,h){r=wi(r);var v=this;return v.__filtered__&&(r>0||h<0)?new _i(v):(r<0?v=v.takeRight(-r):r&&(v=v.drop(r)),h!==s&&(h=wi(h),v=h<0?v.dropRight(-h):v.take(h-r)),v)},_i.prototype.takeRightWhile=function(r){return this.reverse().takeWhile(r).reverse()},_i.prototype.toArray=function(){return this.take(Ot)},Nr(_i.prototype,function(r,h){var v=/^(?:filter|find|map|reject)|While$/.test(h),I=/^(?:head|last)$/.test(h),Y=it[I?"take"+(h=="last"?"Right":""):h],ut=I||/^find/.test(h);Y&&(it.prototype[h]=function(){var yt=this.__wrapped__,bt=I?[1]:arguments,Nt=yt instanceof _i,oe=bt[0],le=Nt||vi(yt),pe=function(Pi){var Ui=Y.apply(it,fo([Pi],bt));return I&&ze?Ui[0]:Ui};le&&v&&typeof oe=="function"&&oe.length!=1&&(Nt=le=!1);var ze=this.__chain__,Je=!!this.__actions__.length,hi=ut&&!ze,Mi=Nt&&!Je;if(!ut&&le){yt=Mi?yt:new _i(this);var ui=r.apply(yt,bt);return ui.__actions__.push({func:Xu,args:[pe],thisArg:s}),new qn(ui,ze)}return hi&&Mi?r.apply(this,bt):(ui=this.thru(pe),hi?I?ui.value()[0]:ui.value():ui)})}),Ji(["pop","push","shift","sort","splice","unshift"],function(r){var h=On[r],v=/^(?:push|sort|unshift)$/.test(r)?"tap":"thru",I=/^(?:pop|shift)$/.test(r);it.prototype[r]=function(){var Y=arguments;if(I&&!this.__chain__){var ut=this.value();return h.apply(vi(ut)?ut:[],Y)}return this[v](function(yt){return h.apply(vi(yt)?yt:[],Y)})}}),Nr(_i.prototype,function(r,h){var v=it[h];if(v){var I=v.name+"";Ti.call(rs,I)||(rs[I]=[]),rs[I].push({name:h,func:v})}}),rs[$i(s,T).name]=[{name:"wrapper",func:s}],_i.prototype.clone=ba,_i.prototype.reverse=Ou,_i.prototype.value=Ca,it.prototype.at=cv,it.prototype.chain=fv,it.prototype.commit=dv,it.prototype.next=pv,it.prototype.plant=gv,it.prototype.reverse=vv,it.prototype.toJSON=it.prototype.valueOf=it.prototype.value=yv,it.prototype.first=it.prototype.head,ns&&(it.prototype[ns]=mv),it},es=Xc();Zr?((Zr.exports=es)._=es,Zo._=es):gn._=es}).call(Er)}(lu,lu.exports);var am=lu.exports;const ec=tc(am);class lm{constructor(a=[],s=!1){Pl(this,"simplifyFunc",a=>{try{a=turf.simplify(a,{tolerance:5e-4,highQuality:!1,mutate:!0})}catch{}return a});mars3d?(this.vectorArr=a,this.geoJsonType=new Map([["Point"],["LineString"],["Polygon"],["MultiPoint"],["MultiLineString"],["MultiPolygon"]]),this.avoidanceArr=[],this.editDate={id:""},this.isDynamicMasking=s):console.error("未引入指定插件")}remove(a,s=null){s&&s.isClone=="true"?window.mapClone.mapEx.removeLayer(window.mapClone.mapEx.getLayer(a,"vectorId")):(window.map.removeLayer(window.map.getLayer(a,"vectorId")),window.dynamicMasking&&window.dynamicMasking.remove(a))}add(a,s){return new Promise((c,p)=>{let u,m=s==null?void 0:s.isClone;if(typeof a!="object"){let g=window.map.getLayer(a,"vectorId");if(g)return c(g);u=this.query(a)}else{let g=window.map.getLayer(a.id,"vectorId");if(g)return c(g);u=a}if(u){let{value:g,url:_,id:S,title:C}=u;new Cesium.Resource({url:_}).fetchJson().then(k=>{let{id:D,title:F,shpInfo:E}=u,{attributes:L,geometryType:T,geometryCount:M,pointCount:R}=E;if(L){let{width:b,materialType:U,materialOptions:N,clampToGround:j,distanceDisplayCondition:J,distanceDisplayCondition_near:K,distanceDisplayCondition_far:ct,zIndex:It,label:et,fill:_t,diffHeight:G,outline:Pt,outlineStyle:Et,color:At,pixelSize:fe,outlineColor:re,outlineWidth:Ft,classificationType:Ot}=JSON.parse(L),Bt;switch(this.isDynamicMasking?(et.color=Cesium.Color.fromCssColorString(et.color).withAlpha(0),et.outlineColor=Cesium.Color.fromCssColorString(et.outlineColor).withAlpha(.001),et.backgroundColor=Cesium.Color.fromCssColorString(et.backgroundColor).withAlpha(.001),et.background=!1,et.outline=!1,et.show=!1):(et.color=Cesium.Color.fromCssColorString(et.color),et.outlineColor=Cesium.Color.fromCssColorString(et.outlineColor),et.backgroundColor=Cesium.Color.fromCssColorString(et.backgroundColor)),T){case"LineString":case"MultiLineString":et.backgroundPadding=5,Bt=new mars3d.layer.GeoJsonLayer({data:k,vectorId:D,symbol:{type:"polylineC",styleOptions:{width:b,clampToGround:j,distanceDisplayCondition:J,distanceDisplayCondition_far:ct,distanceDisplayCondition_near:K,materialType:U,materialOptions:N,classificationType:Ot,label:et}},hasZIndex:!0,zIndex:It});break;case"Polygon":case"MultiPolygon":U=="PolyGrass"&&(N={evenColor:new Cesium.Color(.25,.4,.1,1),oddColor:new Cesium.Color(.1,.1,.1,1),frequency:1.5}),Bt=new mars3d.layer.GeoJsonLayer({data:k,vectorId:D,symbol:{type:"polygon",styleOptions:{fill:_t,diffHeight:G,clampToGround:j,materialType:U,materialOptions:N,distanceDisplayCondition:J,distanceDisplayCondition_far:ct,distanceDisplayCondition_near:K,outlineStyle:Et,outline:Pt,classificationType:Ot,label:et}}});break;case"Point":case"MultiPoint":Bt=new mars3d.layer.GeoJsonLayer({data:k,vectorId:D,symbol:{type:"pointP",styleOptions:{color:At,pixelSize:fe,outline:Pt,outlineColor:re,outlineWidth:Ft,visibleDepth:!1,label:et}}});break}m?window.mapClone.mapEx.addLayer(Bt):window.map.addLayer(Bt),Bt.bindPopup(ce=>{let Yt='<div class="bim-map-popup">';return Object.keys(ce.graphic.attr).forEach(($e,Ii)=>{ce.graphic.attr[$e]&&(Yt+=`<p><b>${$e}</b> : ${ce.graphic.attr[$e]}</p>`)}),Yt+="</div>",Yt});let ke=ec.debounce(ce=>{window.dynamicMasking.add(ce,JSON.parse(L))},500);Bt.readyPromise.then(ce=>{window.dynamicMasking&&ke(ce),c(ce)}).catch(ce=>{console.error("测试shp矢量加载失败",ce),c({tite:"【矢量】「"+F+"」无法加载",type:"error",id:D,url:_})})}else c({tite:"【矢量】「"+F+"」无法加载",type:"error",id:D,url:_})}).catch(k=>{console.error("数据有误",k),c({tite:"【矢量】「"+C+"」链接地址有误",type:"error",id:S,url:_})})}else c({tite:"【矢量】ID:「"+a+"」已删除",type:"error",id:a})})}updateData(a){this.vectorArr=a}processingKML(a){let s,c=2e3,p=!0,{kmlInfo:u}=a,{fill:m,areaColor:g,areaSideColor:_,transparency:S,isAreaSideColor:C,minDistinct:O,textDistinct:k,textSize:D,textColor:F,fontStyle:E,outLine:L,sideColor:T,backGround:M,backGroundColor:R,clampToGround:b}=u,U={fill:m,color:g,opacity:S||.5,outline:C,outlineColor:_,outlineWidth:2,clampToGround:b,distanceDisplayCondition:!0,distanceDisplayCondition_far:k||1e6,distanceDisplayCondition_near:O||0,classificationType:s,opacity:String(S)},N={text:"{name}",horizontalOrigin:Cesium.HorizontalOrigin.CENTER,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,pixelOffsetY:-10,font_size:26,color:F||"#ffffff",font_family:E||"黑体",outline:L||!0,outlineColor:T||"#000000",outlineWidth:4,scaleByDistance:!0,distanceDisplayCondition:!0,distanceDisplayCondition_far:k||1e6,distanceDisplayCondition_near:O||0,background:M||!1,backgroundColor:R||"",visibleDepth:p,clampToGround:b||!1,disableDepthTestDistance:c};return{...U,label:N}}selected(a){window.map.getLayer(a,"vectorId")&&window.map.getLayer(a,"vectorId").flyTo()}query(a){return this.vectorArr.length==0?!1:this.vectorArr.find(s=>s.id==a)}queryVector(a){return window.map.getLayer(a,"vectorId")}editVector(a,s,c){let p=window.map.getLayer(a,"vectorId"),u=bf(s,c);p&&(p.eachGraphic(m=>{m.label.show===!1&&(delete m.label.outline,delete m.label.background,delete m.label.outlineColor,delete m.label.backgroundColor),m.setStyle({...u})}),window.dynamicMasking&&dynamicMasking.modify(a,u))}nationalBoundaries(a="/gis/nationalBoundaries.json"){let s=new mars3d.layer.GeoJsonLayer({name:"国界",url:a,vectorId:"border",format:c=>{try{c=turf.simplify(c,{tolerance:1e-5,highQuality:!1,mutate:!0})}catch(p){console.error(p)}return c},symbol:{type:"polylineC",styleOptions:{width:2,materialType:"Color",materialOptions:{color:"#CD9B1D"},distanceDisplayCondition:!0,distanceDisplayCondition_near:1e3,distanceDisplayCondition_far:2e7,clampToGround:!0,classificationType:Cesium.ClassificationType.TERRAIN}}});map.addLayer(s)}switchDynamicMasking(a){this.isDynamicMasking=a}}class hm{constructor(a=[]){mars3d?(this.terrainProviderArr=a,this.terrainProviderId="",this.events={},window.map.on(mars3d.EventType.terrainLoadError,s=>{console.error("地形服务加载失败",s),this.hide()}),window.map.viewer.scene.globe.tileLoadProgressEvent.addEventListener(s=>{window.map.viewer.scene.globe.tilesLoaded&&this.emit("load",s)})):console.error("未引入指定插件")}add(a){let{url:s,id:c}=a;if(this.terrainProviderId==c&&window.map.terrainProvider._layers)return!1;window.map.terrainProvider=mars3d.LayerUtil.createTerrainProvider({imageXyzId:c,type:"xyz",url:s,requestVertexNormals:!0,requestMetadata:!0}),this.terrainProviderId=c}show(){window.map.hasTerrain=!0}hide(){window.map.hasTerrain=!1}on(a,s){a=="load"?this.events[a]?this.events[a].push(s):this.events[a]=[s]:console.log("未开放自定义")}emit(a,...s){this.events[a]!=null&&this.events[a].forEach(c=>c(...s))}off(a,s){this.events[a]=this.events[a].filter(c=>c!==s)}once(a,s){const c=()=>{s(),this.off(a,c)};this.on(a,c)}addClip(a){return new Promise((s,c)=>{window.bimClip?s(bimClip.clipGisAdd(a)):c("挖洞工具未初始化")})}}class um{constructor(a=[],s){mars3d?(this.elevationImageArr=a,this.elevationImageLayer,s?this.gisTkone={Authorization:`Bearer ${s}`}:this.gisTkone={},this.form={brightnessVal:1.3,msaaSamples:4,surfaceOpacity:1,layerOpacity:1,layerBrightness:2,layerContrast:1,layerHue:0,layerSaturation:1,layerGamma:1},this.tdtLayer=null):console.error("未引入指定插件")}pushVector(a){this.elevationImageArr.push(a)}add(a,s=!0,c){let p;if(typeof a!="object"?p=a:p=a.imageXyzId,window.map.getLayer(p,"imageXyzId"))return!1;const{layerOpacity:u,layerBrightness:m,layerContrast:g,layerHue:_,layerSaturation:S,layerGamma:C,surfaceOpacity:O}=this.exposureEnvironmentSettings();return new Promise((k,D)=>{let F,E,L,T,M,R;if(typeof a!="object"){let b=this.query(a);b||D("缺少树结构");let{gisInfo:U}=b;F=U.id,L=U.order,E=b.url,T=U.minLevel,M=U.maxLevel}else F=a.imageXyzId,E=a.url,L=a.zIndex,T=a.minimumLevel,M=a.maximumLevel,R=a.chinaCRS;this.elevationImageLayer=new mars3d.layer.XyzLayer({imageXyzId:F,type:"xyz",url:E,hasZIndex:!0,zIndex:L.toString(),brightness:m,opacity:u,saturation:S,contrast:g,hue:_,gamma:C,alpha:O,show:!0,minimumLevel:T||0,maximumLevel:M||15,chinaCRS:R,headers:s?this.gisTkone:null}),this.elevationImageLayer.on(mars3d.EventType.load,b=>{k(b)}),window.map.addLayer(this.elevationImageLayer),c&&Object.keys(c).forEach(b=>{this.elevationImageLayer.on(fnType.get(b),U=>{c[b](U)})})})}remove(a){console.log(a),window.map.removeLayer(window.map.getLayer(a,"imageXyzId"))}query(a){return this.elevationImageArr.length==0?!1:this.elevationImageArr.find(s=>s.id==a)}initial(){this.elevationImageArr=[],this.elevationImageLayer=null}exposureEnvironmentSettings(){return localStorage.getItem("environmentSettings")?JSON.parse(localStorage.getItem("environmentSettings")):(localStorage.setItem("environmentSettings",JSON.stringify(this.form)),JSON.parse(JSON.stringify(this.form)))}}class cm{constructor(a,...s){Pl(this,"manualFreed",ec.debounce(()=>{let{lng:a,lat:s,alt:c,pitch:p}=window.map.getCameraView(),u;this.modelArray.forEach(m=>{u=m.releasedDistance?m.releasedDistance:1e4,this.disTance([a,s,c],[m.center._lng,m.center._lat,m.center._alt],this.calculateDistance(p,u))?window.map.getLayer(m.id,"modelId")&&this.emit("leave",m):window.map.getLayer(m.id,"modelId")||this.emit("enter",m)})},200));mars3d?(a&&a!=null&&(this.modelArray=a),this.showModelArray=[],this.Cesium=mars3d.Cesium,this.events={}):console.error("未引入指定插件")}on(a,s){a=="enter"||a=="leave"?this.events[a]?this.events[a].push(s):this.events[a]=[s]:console.log("未开放自定义")}emit(a,...s){this.events[a]!=null&&this.events[a].forEach(c=>c(...s))}off(a,s){this.events[a]=this.events[a].filter(c=>c!==s)}once(a,s){const c=()=>{s(),this.off(a,c)};this.on(a,c)}say(a){return this[a]}add(a,s){this[a].push(s)}remove(a,s){this[a]=this[a].filter(function(c){return c!==s})}initial(){this.modelArray=[],this.events={}}updateCustomExcavationDetails(a,s,c,p=[],u={}){let m,g,_;switch(m=this.modelArray.find(S=>S.modelId==a).customize.bimModelExcavationDetails,_=m.find((S,C)=>{if(S.id==s)return g=C,S}),c){case"delete":m.splice(g,1);break;case"update":_.excavationDetails=p;break;case"add":m.push(u);break;case"edit":_.excavationDetails=u.excavationDetails,_.kId=u.kId;break}return m}resourceRelease(){window.map.viewer.camera.moveEnd.addEventListener(()=>{this.freed()})}freed(){let{alt:a}=window.map.getCameraView();a<2e4&&(this.freed=ec.throttle(()=>{let{lng:s,lat:c,alt:p,pitch:u}=window.map.getCameraView();this.modelArray&&this.modelArray.forEach(m=>{let g=m.bimModel.releasedDistance?m.bimModel.releasedDistance:1e4;m.center&&this.disTance([s,c,p],[m.center._lng,m.center._lat,m.center._alt],this.calculateDistance(u,g))?window.map.getLayer(m.id,"modelId")&&this.emit("leave",m):this.showModelArray.indexOf(m.id)>=0&&!window.map.getLayer(m.id,"modelId")&&this.emit("enter",m)})},2e3),this.freed())}findPnodeId(a,s,c="id"){let p;if(a){for(var u=0;u<a.length;u++){let m=a[u];if(m[c]==s)return p=m,p;if(m.children&&m.children.length>0&&(p=this.findPnodeId(m.children,s,c),p))return p}return p}}disTance(a,s,c){let p,u,m;return p=Cesium.Cartesian3.fromDegrees(...a),u=Cesium.Cartesian3.fromDegrees(...s),m=Cesium.Cartesian3.distance(p,u),m>c}calculateDistance(a,s){let c=(a+180)%360-180;c=Math.max(-90,Math.min(c,90));let p=(s-s/5)*(Math.abs(c)/90)+s/5;return Math.round(p)}}class fm{constructor(a=[],s){mars3d?(this.entityArr=a,this.entityLayer=new mars3d.layer.GraphicLayer({entityId:"bimEntity"}),window.map.addLayer(this.entityLayer),this.entityItem=null,this.events={},this.entityCloneLayer):console.error("未引入指定插件")}on(a,s){a=="change"||a=="collection"||a=="collection"?this.events[a]?this.events[a].push(s):this.events[a]=[s]:console.log("未开放自定义")}emit(a,...s){this.events[a]!=null&&this.events[a].forEach(c=>c(...s))}off(a,s){this.events[a]=this.events[a].filter(c=>c!==s)}offAll(){this.events={}}once(a,s){const c=()=>{s(),this.off(a,c)};this.on(a,c)}add(a,s=null,c){return new Promise((p,u)=>{var m;if(this.entityLayer){let g,_,S;if(c==null?void 0:c.isClone)this.entityCloneLayer&&(_=this.query(a),_?(S=JSON.parse(_.bimPlanPainting.graphic),S.attr=S.attr||{},S.attr.entityId=a,this.entityCloneLayer.addGraphic(S)):p({tite:"【标绘】 ID:「"+a+"」已删除",type:"error",id:a}));else{if(typeof a!="object"?(g=this.entityLayer.getGraphicByAttr(a,"entityId"),_=this.query(a),_?(S=JSON.parse(_.bimPlanPainting.graphic),S.attr=S.attr||{},S.attr.entityId=a):p({tite:"【标绘】ID:「"+a+"」已删除",type:"error",id:a})):(g=this.entityLayer.getGraphicByAttr(a.id,"entityId"),S=JSON.parse(JSON.stringify(a)),S.attr=S.attr||{},S.attr.entityId=S.attr.entityId||s,S.attr==null?S.attr={entityId:a.id}:((m=S.attr)==null?void 0:m.entityId)==null&&s&&(S.attr.entityId=s)),g)return p();this.entityLayer.addGraphic(S),p(S)}}else p(),console.error("未初始化标绘实例图层")})}query(a){return this.entityArr.length==0?!1:this.entityArr.find(s=>s.id==a)}queryEntity(a){if(bimEntity.entityLayer)return bimEntity.entityLayer.getGraphicByAttr(a,"entityId")}selected(a,s=null){let c=this.entityLayer.getGraphicByAttr(a,"entityId");s==null||s.isClone,(c.options.type=="div"||c.options.type=="point")&&c._point?c.flyTo({radius:c._point._alt+500<500?5e3:c._point._alt+500}):c.flyTo()}remove(a,s=null){(s==null?void 0:s.isClone)?this.entityCloneLayer&&this.entityCloneLayer.getGraphicByAttr(a,"entityId").remove():this.entityLayer.getGraphicByAttr(a,"entityId")&&(this.entityLayer.getGraphicByAttr(a,"entityId").remove(),this.entityItem&&(this.entityItem._state=="destroy"||this.entityItem.options.attr.entityId==a)&&(this.entityItem=null))}entityCloneLayerInit(){(this.entityCloneLayer==null||this.entityCloneLayer.state=="destroy")&&(this.entityCloneLayer=window.mapClone._mapEx.getLayer("bimEntity","entityId"))}entityCloneLayerRemove(){this.entityCloneLayer.remove(),this.entityCloneLayer=null}removeEntityItem(){this.entityItem=null}updateData(a){this.entityArr=a}startDrawGraphic(a){return new Promise((s,c)=>{let{type:p,style:u}=a;if(a.style.drawShow=!0,p=="div")if(u.html)this.entityLayer.startDraw(a).then(m=>{setTimeout(()=>{this.entityItem=m,this.entityLayer.startEditing(m)},500)});else{let{title:m,divType:g,theme_color:_,font_color:S,scaleByDistance:C,scaleByDistance_far:O,scaleByDistance_farValue:k,scaleByDistance_near:D,scaleByDistance_nearValue:F,distanceDisplayCondition:E,distanceDisplayCondition_far:L,distanceDisplayCondition_near:T,clampToGround:M}=u,R={type:"div",style:{pointerEvents:!0,scaleByDistance:C,scaleByDistance_far:O,scaleByDistance_farValue:k,scaleByDistance_near:D,scaleByDistance_nearValue:F,distanceDisplayCondition:E,distanceDisplayCondition_far:L,distanceDisplayCondition_near:T,clampToGround:M,horizontalOrigin:Cesium.HorizontalOrigin.LEFT,verticalOrigin:Cesium.VerticalOrigin.BOTTOM}};switch(g){case"1":R.style.html=`<div class="entity-div-style entity-div-style1" style="--theme-color1:${_};--theme-font-color1:${S};">
2636
2636
  <div class="title">${m}</div>
2637
- </div>`,R.style.horizontalOrigin=Cesium.HorizontalOrigin.CENTER;break}this.entityLayer.startDraw(R).then(b=>{setTimeout(()=>{this.entityItem=b,this.entityLayer.startEditing(b),s(b)},500)})}else this.entityLayer.startDraw(a).then(m=>{setTimeout(()=>{this.entityItem=m,this.entityLayer.startEditing(m),s(m)},500)})})}stopDraw(a=!0){this.entityLayer&&this.entityLayer.stopDraw(),a&&this.entityItem&&(this.entityItem.stopEditing(),this.entityItem.remove(),this.entityItem=null)}updateEntityItem(a){let s=this.entityLayer.getGraphicByAttr(a,"entityId");s?this.entityItem=s:this.removeEntityItem()}edit(a,s,c,p){let u=bf(s,c);if(s.vectorStyle&&this.entityItem)if(s.vectorStyle.divType==5)this.entityItem.setStyle({...u,horizontalOrigin:Cesium.HorizontalOrigin.LEFT});else{if(this.entityItem.type=="circleP"&&Object.keys(u).length==1&&Object.keys(u)[0]=="radius"&&u.radius==this.entityItem.options.style.radius)return!1;this.entityItem.setStyle({...u})}}enableDragging(a=!0){a?this.entityLayer.startEditing(this.entityItem):(this.entityLayer.stopDraw(),this.entityItem&&this.entityItem.stopEditing())}addRightMenu(){this.entityLayer.bindContextMenu([{text:"编辑对象",callback:a=>{this.emit("change",a)}},{text:"收藏对象",callback:a=>{this.emit("collection",a)}}])}removeRightMenu(){this.entityLayer.hasContextMenu()&&this.entityLayer.unbindContextMenu()}processDivData(a){let s={"--theme-color1":"theme_color","--theme-font-color1":"font_color","--theme-color2":"theme_color2","--theme-color3":"theme_color3"},c={title:"",theme_color:"",font_color:"",content:"",divType:"",divStyle:{},isMirror:!1};const p=document.createElement("div");p.innerHTML=a;const u=p.querySelector(".entity-div-style");return console.log("解耦",u),Object.keys(s).forEach(m=>{m=="--theme-color2"||m=="--theme-color3"?c.divStyle[s[m]]=u.style.getPropertyValue(m)||"#fff":c[s[m]]=u.style.getPropertyValue(m)}),c.title=u.querySelector(".title")?u.querySelector(".title").innerText:"标题",c.content=u.querySelector(".content")?u.querySelector(".content").innerText:"内容",c.divType=u.classList[1]?u.classList[1].replace("entity-div-style",""):"",c.isMirror=u.classList.contains("isMirror"),console.log("解耦",c),c}updateHtml(a,s){let{theme_color:c,font_color:p,title:u,content:m,divStyle:g}=s,{theme_color2:_,theme_color3:S}=g,C="";switch(a){case"1":C=`<div class="entity-div-style entity-div-style1" style="--theme-color1:${c};--theme-font-color1:${p};">
2637
+ </div>`,R.style.horizontalOrigin=Cesium.HorizontalOrigin.CENTER;break}this.entityLayer.startDraw(R).then(b=>{setTimeout(()=>{this.entityItem=b,this.entityLayer.startEditing(b),s(b)},500)})}else this.entityLayer.startDraw(a).then(m=>{setTimeout(()=>{this.entityItem=m,this.entityLayer.startEditing(m),s(m)},500)})})}stopDraw(a=!0){this.entityLayer&&this.entityLayer.stopDraw(),a&&this.entityItem&&(this.entityItem.stopEditing(),this.entityItem.remove(),this.entityItem=null)}updateEntityItem(a){let s=this.entityLayer.getGraphicByAttr(a,"entityId");s?this.entityItem=s:this.removeEntityItem()}edit(a,s,c,p){let u=bf(s,c);if(s.vectorStyle&&this.entityItem)if(s.vectorStyle.divType==5)this.entityItem.setStyle({...u,horizontalOrigin:Cesium.HorizontalOrigin.LEFT});else{if(this.entityItem.type=="circleP"&&Object.keys(u).length==1&&Object.keys(u)[0]=="radius"&&u.radius==this.entityItem.options.style.radius)return!1;this.entityItem.setStyle({...u,horizontalOrigin:Cesium.HorizontalOrigin.CENTER})}}enableDragging(a=!0){a?this.entityLayer.startEditing(this.entityItem):(this.entityLayer.stopDraw(),this.entityItem&&this.entityItem.stopEditing())}addRightMenu(){this.entityLayer.bindContextMenu([{text:"编辑对象",callback:a=>{this.emit("change",a)}},{text:"收藏对象",callback:a=>{this.emit("collection",a)}}])}removeRightMenu(){this.entityLayer.hasContextMenu()&&this.entityLayer.unbindContextMenu()}processDivData(a){let s={"--theme-color1":"theme_color","--theme-font-color1":"font_color","--theme-color2":"theme_color2","--theme-color3":"theme_color3"},c={title:"",theme_color:"",font_color:"",content:"",divType:"",divStyle:{},isMirror:!1};const p=document.createElement("div");p.innerHTML=a;const u=p.querySelector(".entity-div-style");return console.log("解耦",u),Object.keys(s).forEach(m=>{m=="--theme-color2"||m=="--theme-color3"?c.divStyle[s[m]]=u.style.getPropertyValue(m)||"#fff":c[s[m]]=u.style.getPropertyValue(m)}),c.title=u.querySelector(".title")?u.querySelector(".title").innerText:"标题",c.content=u.querySelector(".content")?u.querySelector(".content").innerText:"内容",c.divType=u.classList[1]?u.classList[1].replace("entity-div-style",""):"",c.isMirror=u.classList.contains("isMirror"),console.log("解耦",c),c}updateHtml(a,s){let{theme_color:c,font_color:p,title:u,content:m,divStyle:g}=s,{theme_color2:_,theme_color3:S}=g,C="";switch(a){case"1":C=`<div class="entity-div-style entity-div-style1" style="--theme-color1:${c};--theme-font-color1:${p};">
2638
2638
  <div class="title">${u}</div>
2639
2639
  </div>`;break;case"2":C=`<div class="entity-div-style entity-div-style2" style="--theme-color1:${c};--theme-font-color1:${p};">
2640
2640
  <div class="title">${u}</div>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "chbim-plugins",
3
3
  "private": false,
4
- "version": "0.0.115",
4
+ "version": "0.0.116",
5
5
  "description": "一个简单的组件库",
6
6
  "main": "chbim-plugins.js",
7
7
  "keywords": [