From 97b43e070fa41184e53fdfca4bc7e1a0fa626005 Mon Sep 17 00:00:00 2001 From: fangjiakai <450850793@qq.com> Date: Mon, 26 Feb 2024 08:47:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E8=B7=AF=E5=BE=84=E5=92=8C?= =?UTF-8?q?=E7=BB=98=E5=88=B6=E7=94=B5=E5=AD=90=E5=9B=B4=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/lib/Cesium/CustomCesium.js | 1416 ++++++++++++++++- src/components/map_tools/index.vue | 79 + src/components/map_tools/loadglb.js | 167 ++ src/components/map_tools/map.js | 228 +++ src/request/map.js | 4 + src/request/map_settings.js | 2 + src/request/positioning.js | 1 - src/views/BI/components/bottom_options.vue | 22 +- .../historical_trajectory_options.vue | 118 +- src/views/BI/index.vue | 13 +- src/views/BI/js/history_trajectory.js | 133 ++ src/views/BI/js/map.js | 15 +- src/views/BI/js/trajectory.js | 104 +- .../components/video_center.vue | 9 +- .../components/selecting_points.vue | 15 + .../assignment_ticket_area_settings/index.vue | 1 + .../risk_control/identifying_parts/index.vue | 41 +- src/views/risk_control/ledger/index.vue | 4 +- 18 files changed, 2258 insertions(+), 114 deletions(-) create mode 100644 src/components/map_tools/index.vue create mode 100644 src/components/map_tools/loadglb.js create mode 100644 src/components/map_tools/map.js create mode 100644 src/views/BI/js/history_trajectory.js diff --git a/public/lib/Cesium/CustomCesium.js b/public/lib/Cesium/CustomCesium.js index c8f8723..9522293 100644 --- a/public/lib/Cesium/CustomCesium.js +++ b/public/lib/Cesium/CustomCesium.js @@ -1 +1,1415 @@ -var CustomCesium;(()=>{"use strict";var e={d:(t,i)=>{for(var r in i)e.o(i,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:i[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{BulletinBoard:()=>L,Carmer:()=>s,EditGltf:()=>O,Enclosure:()=>A,GroupModel:()=>P,HumanModel:()=>b,Line:()=>F,Model:()=>x,ModelDrag:()=>T,Mouse:()=>o,Radar:()=>z,Scene:()=>n,Tiles3D:()=>a});class i{constructor(e){this._definitionChanged=new Cesium.Event,this._color=void 0,this.color=e.color}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(e){return Cesium.Material.WallDiffuseMaterialType}getValue(e,t){return Cesium.defined(t)||(t={}),t.color=Cesium.Property.getValueOrDefault(this._color,e,Cesium.Color.RED,t.color),t}equals(e){return this===e||e instanceof i&&Cesium.Property.equals(this._color,e._color)}}class r{constructor(){}static tileXYToQuadKey(e,t,i){for(var r="",n=i;n>=0;--n){var s=1<{e+=5,this.icy.viewer.scene.camera.moveDown(5),e>=2e3&&(clearInterval(t),setTimeout((()=>{this.icy.viewer.scene.camera.flyTo({destination:this.icy.viewer.scene.camera.positionWC,orientation:{heading:this.icy.viewer.scene.camera.heading,pitch:Cesium.Math.toRadians(-45),roll:0}})}),100))}));this.icy.viewer.scene.screenSpaceCameraController.enableTilt=!0}}getCenterPoint(e){let t=e.camera.pickEllipsoid(new Cesium.Cartesian2(e.canvas.clientWidth/2,e.canvas.clientHeight/2)),i=Cesium.Ellipsoid.WGS84.cartesianToCartographic(t);return[180*i.longitude/Math.PI,180*i.latitude/Math.PI]}getBottomCenterPoint(e){let t=e.camera.pickEllipsoid(new Cesium.Cartesian2(e.canvas.clientWidth/2,e.canvas.clientHeight)),i=Cesium.Ellipsoid.WGS84.cartesianToCartographic(t);return[180*i.longitude/Math.PI,180*i.latitude/Math.PI]}}class a{constructor(e,t,i=0){this.icy=e,this.tileset=e.viewer.scene.primitives.add(new Cesium.Cesium3DTileset({url:t,show:!0})),this.tileset.readyPromise.then((e=>{this.tileset=e,this.setHeight(i)}))}show(e){this.tileset.show=e}setHeight(e=0){const t=this.tileset.boundingSphere,i=Cesium.Cartographic.fromCartesian(t.center),r=Cesium.Cartesian3.fromRadians(i.longitude,i.latitude,0),n=Cesium.Cartesian3.fromRadians(i.longitude,i.latitude,e),s=Cesium.Cartesian3.subtract(n,r,new Cesium.Cartesian3);this.tileset.modelMatrix=Cesium.Matrix4.fromTranslation(s)}look(){this.icy.viewer.zoomTo(this.tileset)}destroy(){this.tileset.destroy(),this.tileset=void 0}}class o{constructor(e){this.icy=e,this.billboard=void 0}mouseMOVE(e){new Cesium.ScreenSpaceEventHandler(this.icy.viewer.scene.canvas).setInputAction((t=>{if(!this.icy.viewer.scene.pick(t.endPosition))return this.billboard&&(this.icy.viewer.canvas.style.cursor="default",this.billboard.scale=void 0,this.billboard=void 0),void e(!1)}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)}mouseLeft(e){new Cesium.ScreenSpaceEventHandler(this.icy.viewer.scene.canvas).setInputAction((t=>{let i=this.icy.viewer.camera.getPickRay(t.position),r=this.icy.viewer.scene.globe.pick(i,this.icy.viewer.scene),n=Cesium.Cartographic.fromCartesian(r),s=Cesium.Math.toDegrees(n.longitude),a=Cesium.Math.toDegrees(n.latitude),o=n.height,l={longitude:Number(s.toFixed(8)),latitude:Number(a.toFixed(8)),altitude:Number(o.toFixed(5))};console.log("鼠标获取经纬高",s,a,o,l);let u=this.icy.viewer.scene.pick(t.position);if(console.log(u),!u)return console.log("pick为空"),this.icy.viewer.scene.globe.translucency.enabled=!0,void(this.icy.viewer.scene.globe.translucency.frontFaceAlpha=1);e(u.id)}),Cesium.ScreenSpaceEventType.LEFT_CLICK)}mouseLeftDouble(e){new Cesium.ScreenSpaceEventHandler(this.icy.viewer.scene.canvas).setInputAction((t=>{let i=this.icy.viewer.camera.getPickRay(t.position),r=this.icy.viewer.scene.globe.pick(i,this.icy.viewer.scene),n=Cesium.Cartographic.fromCartesian(r),s=Cesium.Math.toDegrees(n.longitude),a=Cesium.Math.toDegrees(n.latitude),o=n.height;e(s,a,o)}),Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}}var l,u=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return this.None(e)},Out:function(e){return this.None(e)},InOut:function(e){return this.None(e)}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}}),Back:Object.freeze({In:function(e){var t=1.70158;return 1===e?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return 0===e?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-u.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*u.Bounce.In(2*e):.5*u.Bounce.Out(2*e-1)+.5}}),generatePow:function(e){return void 0===e&&(e=4),e=(e=e1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(2*t,e)/2:(1-Math.pow(2-2*t,e))/2+.5}}}}),h="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},c=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=h()),void 0===t&&(t=!1);var i=Object.keys(this._tweens);if(0===i.length)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r1?s(e[i],e[i-1],i-r):s(e[n],e[n+1>i?i:n+1],r-n)},Bezier:function(e,t){for(var i=0,r=e.length-1,n=Math.pow,s=m.Utils.Bernstein,a=0;a<=r;a++)i+=n(1-t,r-a)*n(t,a)*e[a]*s(r,a);return i},CatmullRom:function(e,t){var i=e.length-1,r=i*t,n=Math.floor(r),s=m.Utils.CatmullRom;return e[0]===e[i]?(t<0&&(n=Math.floor(r=i*(1+t))),s(e[(n-1+i)%i],e[n],e[(n+1)%i],e[(n+2)%i],r-n)):t<0?e[0]-(s(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[i]-(s(e[i],e[i],e[i-1],e[i-1],r-i)-e[i]):s(e[n?n-1:0],e[n],e[i1;i--)t*=i;return l[e]=t,t}),CatmullRom:function(e,t,i,r,n){var s=.5*(i-e),a=.5*(r-t),o=n*n;return(2*t-2*i+s+a)*(n*o)+(-3*t+3*i-2*s-a)*o+s*n+t}}},d=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),p=new c,C=function(){function e(e,t){void 0===t&&(t=p),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=u.Linear.None,this._interpolationFunction=m.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=d.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),void 0!==t&&(this._duration=t),this},e.prototype.duration=function(e){return void 0===e&&(e=1e3),this._duration=e,this},e.prototype.start=function(e,t){if(void 0===e&&(e=h()),void 0===t&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var i in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t),this},e.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},e.prototype._setupProperties=function(e,t,i,r,n){for(var s in i){var a=e[s],o=Array.isArray(a),l=o?"array":typeof a,u=!o&&Array.isArray(i[s]);if("undefined"!==l&&"function"!==l){if(u){var h=i[s];if(0===h.length)continue;h=h.map(this._handleRelativeValue.bind(this,a)),void 0===t[s]&&(i[s]=[a].concat(h))}if("object"!==l&&!o||!a||u)(void 0===t[s]||n)&&(t[s]=a),o||(t[s]*=1),r[s]=u?i[s].slice().reverse():t[s]||0;else{for(var c in t[s]=o?[]:{},a)t[s][c]=a[c];r[s]=o?[]:{},this._setupProperties(a,t[s],i[s],r[s],n)}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=h()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=h()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;en)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e1?1:r;var s=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,s),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),1===r){if(this._repeat>0){for(i in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[i]||(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,o=this._chainedTweens.length;a{e.show(t)}))}static{function e(){S.update(),requestAnimationFrame(e)}e()}constructor(e,{url:t,height:i,lon:r,lat:n,id:s,name:a,scale:o,angle:l},u){if(this.icy=e,!t&&!u)return console.error("传参有问题");o=o||1,i=i||0,r=r||116.28678152222574,n=n||40.05185885026265;let h=Cesium.Cartesian3.fromDegrees(r,n,i),c=Cesium.Math.toRadians(l[0]),m=Cesium.Math.toRadians(l[1]),d=Cesium.Math.toRadians(l[2]),p=new Cesium.HeadingPitchRoll(c,m,d),C=Cesium.Transforms.headingPitchRollQuaternion(h,p);this.entity=t?e.viewer.entities.add({id:s,name:a,position:h,orientation:C,model:{uri:t,scale:o,color:new Cesium.Color(1,1,1,1)},runAnimations:!1,incrementallyLoadTextures:!1,colorBlendMode:Cesium.ColorBlendMode.MIX,colorBlendAmount:.1,_icy:{lon:r,lat:n,height:i}}):e.viewer.entities.add({id:s,name:a,position:h,orientation:C,model:u,runAnimations:!1,incrementallyLoadTextures:!1,colorBlendMode:Cesium.ColorBlendMode.MIX,colorBlendAmount:.1,_icy:{lon:r,lat:n,height:i}})}show(e){this.entity.show=e}move({lon:e,lat:t,height:i,angle:r}){let n=Cesium.Cartesian3.fromDegrees(e,t,i),s=Cesium.Math.toRadians(r[0]),a=Cesium.Math.toRadians(r[1]),o=Cesium.Math.toRadians(r[2]),l=new Cesium.HeadingPitchRoll(s,a,o),u=Cesium.Transforms.headingPitchRollQuaternion(n,l);this.entity.position=n,this.entity.orientation=u}updateAngle(e){let t=new Cesium.Cartesian3(this.entity.position._value.x,this.entity.position._value.y,this.entity.position._value.z),i=Cesium.Math.toRadians(e[0]),r=e[1],n=e[2],s=new Cesium.HeadingPitchRoll(i,r,n),a=Cesium.Transforms.headingPitchRollQuaternion(t,s);this.entity.orientation=a}animationMove(e,t,i,n,s){if(!this.entity)throw"还没有对象呢!!";let a=this.entity.position,o=Cesium.Cartesian3.fromDegrees(e,t,i),l=new S.Tween({x:a._value.x,y:a._value.y,z:a._value.z});l.to({x:o.x,y:o.y,z:o.z},n),l.onUpdate((({x:e,y:t,z:i})=>{let n=new Cesium.Cartesian3(e,t,i);this.entity.position=n;let a=r.Cartesian3ToWGS84(this.icy.viewer,n);s(a)})),l.start()}lineColor(e){this.entity.model.silhouetteSize=e?2:0}getEntity(){return this.entity}getPosition(){return this.entity.modelMatrix}clone(e){return Cesium.clone(this.entity.model)}destroy(){this.icy.viewer.entities.remove(this.entity),this.entity=void 0}}class T{static FileUrl="../public/models/huaxing/glb/";constructor(e,{url:t,height:i,lon:r,lat:n,id:s,name:a,scale:o,angle:l},u){if(this.icy=e,!t&&!u)return console.error("传参有问题");o=o||1,i=i||0,r=r||116.28678152222574,n=n||40.05185885026265;let h=Cesium.Cartesian3.fromDegrees(r,n,i);var c=Cesium.Math.toRadians(l[0]),m=Cesium.Math.toRadians(l[1]),d=Cesium.Math.toRadians(l[2]),p=new Cesium.HeadingPitchRoll(c,m,d);let C=Cesium.Transforms.headingPitchRollToFixedFrame(h,p,Cesium.Ellipsoid.WGS84,Cesium.Transforms.eastNorthUpToFixedFrame,new Cesium.Matrix4);this.entity=e.viewer.scene.primitives.add(Cesium.Model.fromGltf({url:t,color:Cesium.Color.WHITE,modelMatrix:C,scale:o}))}show(e){this.entity.show=e}getEntity(){return this.entity}getState(){let e=this.entity.modelMatrix;const t=Cesium.Matrix4.getTranslation(e,new Cesium.Cartesian3);var i=this.icy.viewer.scene.globe.ellipsoid.cartesianToCartographic(t),r=Cesium.Math.toDegrees(i.latitude),n=Cesium.Math.toDegrees(i.longitude),s=i.height;let a=e;var o=Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Matrix4.getTranslation(a,new Cesium.Cartesian3),Cesium.Ellipsoid.WGS84,new Cesium.Matrix4),l=Cesium.Matrix4.multiply(Cesium.Matrix4.inverse(o,new Cesium.Matrix4),a,new Cesium.Matrix4),u=Cesium.Matrix4.getMatrix3(l,new Cesium.Matrix3),h=Cesium.Quaternion.fromRotationMatrix(u),c=Cesium.HeadingPitchRoll.fromQuaternion(h);return{lng:n,lat:r,alt:s,angle:[Cesium.Math.toDegrees(c.heading),Cesium.Math.toDegrees(c.pitch),Cesium.Math.toDegrees(c.roll)]}}getPosition(){return this.entity.modelMatrix}destroy(){this.icy.viewer.entities.remove(this.entity),this.entity=void 0}}class P{constructor(e){this.name=e,this.children=[]}add(e){if(!e.entity)throw"请传入模型";this.children.push(e)}show(e){this.children.forEach((t=>{t.show(e)}))}move(){this.children.map((e=>{e.entity.position._value.x-=1}))}destroy(e){this.children.forEach((t=>{e.viewer.entities.remove(t.entity)}))}}class b extends x{static PERSON_BLUE={url:x.FileUrl+"person_000002_blue.gltf"};static PERSON_BLUE_FAT={url:x.FileUrl+"person_000002_blue_fat.gltf"};static PERSON_GREEN={url:x.FileUrl+"person_000002_green.gltf"};static PERSON_GREEN_FAT={url:x.FileUrl+"person_000002_green_fat.gltf"};static PERSON_RED={url:x.FileUrl+"person_000002_red.gltf"};static PERSON_RED_FAT={url:x.FileUrl+"person_000002_red_fat.gltf"};static PERSON_WHITE={url:x.FileUrl+"person_000002_white.gltf"};static PERSON_WHITE_FAT={url:x.FileUrl+"person_000002_white_fat.gltf"};static PERSON_YELLOW={url:x.FileUrl+"person_000002_yellow.gltf"};static PERSON_YELLOW_FAT={url:x.FileUrl+"person_000002_yellow_fat.gltf"};constructor(e,t,{lon:i,lat:r,id:n,name:s,scale:a,angle:o,height:l}){super(e,{url:t.url,height:l,lon:i,lat:r,id:n,name:s,scale:a,angle:o})}destroy(){}}const E=window.Cesium,R=52.35987755982988,I=3.141592653589793,D=class{static BD09ToGCJ02(e,t){let i=+e-.0065,r=+t-.006,n=Math.sqrt(i*i+r*r)-2e-5*Math.sin(r*R),s=Math.atan2(r,i)-3e-6*Math.cos(i*R);return[n*Math.cos(s),n*Math.sin(s)]}static GCJ02ToBD09(e,t){t=+t,e=+e;let i=Math.sqrt(e*e+t*t)+2e-5*Math.sin(t*R),r=Math.atan2(t,e)+3e-6*Math.cos(e*R);return[i*Math.cos(r)+.0065,i*Math.sin(r)+.006]}static WGS84ToGCJ02(e,t){if(t=+t,e=+e,this.out_of_china(e,t))return[e,t];{let i=this.delta(e,t);return[e+i[0],t+i[1]]}}static GCJ02ToWGS84(e,t){if(t=+t,e=+e,this.out_of_china(e,t))return[e,t];{let i=this.delta(e,t);return[2*e-(e+i[0]),2*t-(t+i[1])]}}static delta(e,t){let i=this.transformLng(e-105,t-35),r=this.transformLat(e-105,t-35);const n=t/180*I;let s=Math.sin(n);s=1-.006693421622965943*s*s;const a=Math.sqrt(s);return i=180*i/(6378245/a*Math.cos(n)*I),r=180*r/(6335552.717000426/(s*a)*I),[i,r]}static transformLng(e,t){let i=300+(e=+e)+2*(t=+t)+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*I)+20*Math.sin(2*e*I))/3,i+=2*(20*Math.sin(e*I)+40*Math.sin(e/3*I))/3,i+=2*(150*Math.sin(e/12*I)+300*Math.sin(e/30*I))/3,i}static transformLat(e,t){let i=2*(e=+e)-100+3*(t=+t)+.2*t*t+.1*e*t+.2*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*I)+20*Math.sin(2*e*I))/3,i+=2*(20*Math.sin(t*I)+40*Math.sin(t/3*I))/3,i+=2*(160*Math.sin(t/12*I)+320*Math.sin(t*I/30))/3,i}static out_of_china(e,t){return t=+t,!((e=+e)>73.66&&e<135.05&&t>3.86&&t<53.55)}static transformWGS84ToCartesian(e,t,i){return t?E.Cartesian3.fromDegrees(t.lng||t.lon,t.lat,t.alt=i||t.alt,E.Ellipsoid.WGS84):E.Cartesian3.ZERO}static transformCartesianToWGS84(e,t){let i=E.Ellipsoid.WGS84.cartesianToCartographic(t);return{lng:E.Math.toDegrees(i.longitude),lat:E.Math.toDegrees(i.latitude),alt:i.height}}},O=class{constructor(e,t,i,r){if(!e)throw new Error("viewer is required!");this._viewer=e,this._gltf=t,this._handler=void 0,this._defaultWidth=15,this._currentPick=void 0,this._dStep=i,this._rStep=r,this._params={tx:0,ty:0,tz:0,heading:0,pitch:0,roll:0,scale:1},this._coordArrows=void 0,this._coordCircle=[],this.initEvent()}get params(){return this._params}initParam(){this.removeAllTools();let e=this._gltf;this._viewer;const t=this.returnGltfCentorDegree(e),i=this.returnGltfRotation(e);return this._params.tx=t.lng,this._params.ty=t.lat,this._params.tz=t.alt,this._params.heading=i.heading,this._params.pitch=i.pitch,this._params.roll=i.roll,{originDegree:t,length:50}}returnGltfRotation(e){let t=e.modelMatrix,i=Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Matrix4.getTranslation(t,new Cesium.Cartesian3),Cesium.Ellipsoid.WGS84,new Cesium.Matrix4),r=Cesium.Matrix4.multiply(Cesium.Matrix4.inverse(i,new Cesium.Matrix4),t,new Cesium.Matrix4),n=Cesium.Matrix4.getMatrix3(r,new Cesium.Matrix3),s=Cesium.Quaternion.fromRotationMatrix(n);return Cesium.HeadingPitchRoll.fromQuaternion(s)}returnGltfCentor(e){let t=e.modelMatrix;return new Cesium.Cartesian3(t[12],t[13],t[14])}returnGltfCentorDegree(e){let t=this.returnGltfCentor(e);return D.transformCartesianToWGS84(this._viewer,t)}editRtation(){const e=this.initParam();this.createCircle(e.originDegree.lng,e.originDegree.lat,e.originDegree.alt,e.length)}createCircle(e,t,i,r){const n=[];for(let e=0;e<=360;e+=3){const t=Math.sin(Cesium.Math.toRadians(e)),i=r*Math.cos(Cesium.Math.toRadians(e)),s=r*t;n.push(new Cesium.Cartesian3(i,s,0))}const s=Cesium.Transforms.eastNorthUpToFixedFrame(new Cesium.Cartesian3.fromDegrees(e,t,i)),a=this.createAxisSphere("model_edit_zCircle",n,s,Cesium.Color.RED);this._viewer.scene.primitives.add(a);const o=this.createAxisSphere("model_edit_yCircle",n,s,Cesium.Color.BLUE);this._viewer.scene.primitives.add(o);let l=Cesium.Matrix3.fromRotationY(Cesium.Math.toRadians(90)),u=Cesium.Matrix4.fromRotationTranslation(l);Cesium.Matrix4.multiply(o.geometryInstances.modelMatrix,u,o.geometryInstances.modelMatrix);const h=this.createAxisSphere("model_edit_xCircle",n,s,Cesium.Color.GREEN);this._viewer.scene.primitives.add(h);let c=Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(90)),m=Cesium.Matrix4.fromRotationTranslation(c);Cesium.Matrix4.multiply(h.geometryInstances.modelMatrix,m,h.geometryInstances.modelMatrix)}createAxisSphere(e,t,i,r){let n=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({id:e,geometry:new Cesium.PolylineGeometry({positions:t,width:5}),attributes:{color:Cesium.ColorGeometryInstanceAttribute.fromColor(r)}}),releaseGeometryInstances:!1,appearance:new Cesium.PolylineColorAppearance({translucent:!1}),modelMatrix:i});return n._name=e,this._coordCircle.push(n),n}onEdit(e){this._gltf.color=this._gltf.color.withAlpha(e?.5:1),this._gltf._allowPicking=!e}editTranslation(){const e=this.initParam();this.onEdit(!0);const t=e.length;let i=new Cesium.Cartesian3(t,t,t),r=this.returnGltfCentor(this._gltf),n=this.getTransPostion(r,i);this.initLineArrow(e.originDegree,n,t)}updateLineArrow(e,t){this.removeCoordArrows(),this._viewer;const i=e.scale*e._boundingSphere.radius/.8;let r=new Cesium.Cartesian3(i,i,i),n=this.returnGltfCentor(this._gltf),s=this.getTransPostion(n,r);this.initLineArrow(t,s,i)}initEvent(){const e=this,t=this._viewer;e._handler=new Cesium.ScreenSpaceEventHandler(t.scene.canvas),e._handler.setInputAction((function(i){let r=t.scene.pick(i.position);if(r&&r.primitive&&r.primitive._name&&-1!=r.primitive._name.indexOf("model_edit")){t.scene.screenSpaceCameraController.enableRotate=!1,e._currentPick=r.primitive,e._currentPick.width=25;let n=t.scene.camera.pickEllipsoid(i.position,t.scene.globe.ellipsoid),s=JSON.parse(JSON.stringify(e._gltf.modelMatrix)),a=0,o=0,l=0,u=0,h=0,c=0;if(n&&Cesium.defined(n)){a=0,o=0,l=0,u=0,h=0,c=0;const r=D.transformCartesianToWGS84(t,n);e._handler.setInputAction((function(n){let m=t.scene.camera.pickEllipsoid(n.endPosition,t.scene.globe.ellipsoid);const d=D.transformCartesianToWGS84(t,m),p=n.endPosition.y-i.position.y,C=n.endPosition.x-i.position.x;switch(e._currentPick._name){case"model_edit_xArrow":a=d.lng-r.lng;break;case"model_edit_yArrow":o=d.lat-r.lat;break;case"model_edit_zArrow":l=-e._dStep*p;break;case"model_edit_xCircle":u=e._rStep*p;break;case"model_edit_yCircle":h=e._rStep*C;break;case"model_edit_zCircle":c=e._rStep*C}e.updateModel(e._params,a,o,l,u,h,c,s)}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)}e._handler.setInputAction((function(i){t.scene.screenSpaceCameraController.enableRotate=!0,e._currentPick.width=e._defaultWidth,e._currentPick=void 0,e._params.tx+=a,e._params.ty+=o,e._params.tz+=l;let r=e.returnGltfRotation(e._gltf);e._params.heading=r.heading,e._params.pitch=r.pitch,e._params.roll=r.roll,e._handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE),e._handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP)}),Cesium.ScreenSpaceEventType.LEFT_UP)}}),Cesium.ScreenSpaceEventType.LEFT_DOWN)}updateModel(e,t,i,r,n,s,a,o){if(this._coordArrows){let n=new Cesium.HeadingPitchRoll(e.heading,e.pitch,e.roll),s=new Cesium.Cartesian3.fromDegrees(e.tx+t,e.ty+i,e.tz+r),a=Cesium.Transforms.headingPitchRollToFixedFrame(s,n,Cesium.Ellipsoid.WGS84,Cesium.Transforms.eastNorthUpToFixedFrame,new Cesium.Matrix4);this._gltf.modelMatrix=a,this.updateLineArrow(this._gltf,{lng:e.tx+t,lat:e.ty+i,alt:e.tz+r})}if(this._coordCircle){let e;0!=n?e=Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(n)):0!=s?e=Cesium.Matrix3.fromRotationY(Cesium.Math.toRadians(s)):0!=a&&(e=Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(a))),this._gltf.modelMatrix=e?Cesium.Matrix4.multiplyByMatrix3(o,e,new Cesium.Matrix4):this._gltf.modelMatrix}}initLineArrow(e,t,i){const r=new Cesium.PolylineCollection,n=[e.lng,e.lat,e.alt,t.lng,e.lat,e.alt],s=(this.darwArrow(r,"model_edit_xArrow",n,Cesium.Color.GREEN),[e.lng,e.lat,e.alt,e.lng,t.lat,e.alt]),a=(this.darwArrow(r,"model_edit_yArrow",s,Cesium.Color.BLUE),[e.lng,e.lat,e.alt,e.lng,e.lat,t.alt]);this.darwArrow(r,"model_edit_zArrow",a,Cesium.Color.RED),this._coordArrows=this._viewer.scene.primitives.add(r),this._coordArrows._name="CoordAxis"}darwArrow(e,t,i,r){e.add({positions:Cesium.Cartesian3.fromDegreesArrayHeights(i),width:this._defaultWidth,material:Cesium.Material.fromType(Cesium.Material.PolylineArrowType,{color:r})})._name=t}getTransPostion(e,t){let i=Cesium.Transforms.eastNorthUpToFixedFrame(e),r=new Cesium.Matrix4;Cesium.Matrix4.setTranslation(Cesium.Matrix4.IDENTITY,t,r);let n=Cesium.Matrix4.multiply(i,r,i);return Cesium.Matrix4.getTranslation(n,e),D.transformCartesianToWGS84(this._viewer,e)}removeCoordArrows(){this._coordArrows&&(this._viewer.scene.primitives.remove(this._coordArrows),this._coordArrows=void 0)}removeCoordCircle(){this._coordCircle.forEach((e=>{this._viewer.scene.primitives.remove(e)})),this._coordCircle=[]}removeAllTools(){this.removeCoordArrows(),this.removeCoordCircle()}destroy(){this._gltf.currentPosition=[this._params.tx,this._params.ty,this._params.tz],this.removeAllTools(),this._handler.destroy(),this.onEdit(!1)}};class A{constructor(e){this.icy=e,this.fenceList=[],this.currentFence=[],this.currentEntity=[],this.currentState=!1,this.currentPolyline,this.currentPolygon}start(){this.currentState=!0;let e=this.icy.viewer.canvas.parentNode,t=document.createElement("div");t.id="menu",t.style="width:100px;position:fixed;left:20px;top:30px;z-index:99";let i=document.createElement("button");i.innerHTML="完成绘制",i.addEventListener("click",(()=>{this.sout(),this.finish()})),t.appendChild(i),e.appendChild(t)}add(e,t,i=0){if(!this.currentState)throw"绘制电子围栏请先调用start函数";let r;if(this.currentFence.push([e,t,i]),r=this.addPoint(e,t,i),this.currentFence.length>1){let e=Cesium.Cartesian3.fromDegreesArrayHeights(this.currentFence.flat());this.currentPolyline?this.currentPolyline.polyline.positions=e:this.currentPolyline=this.icy.viewer.entities.add({polyline:{positions:e,width:5,material:Cesium.Color.RED,clampToGround:!0}})}if(this.currentFence.length>2){let e=Cesium.Cartesian3.fromDegreesArrayHeights(this.currentFence.flat());this.currentPolygon?this.currentPolygon.polygon.hierarchy=e:this.currentPolygon=this.icy.viewer.entities.add({polygon:{hierarchy:e,material:Cesium.Color.GREEN}})}this.currentEntity.push(r)}back(){if(!this.currentState)throw"请先调用start函数";this.currentFence.length=this.currentFence.length-1,this.icy.viewer.entities.remove(this.currentEntity[this.currentEntity.length-1]),this.currentEntity.length=this.currentEntity.length-1,this.update_Polygon(),this.update_Polyline()}stop(){this.currentState?(this.currentState=!1,0!=this.currentFence.length&&this.fenceList.push(this.currentFence),this.currentFence=[]):console.error("状态已经是停止状态")}finish(){this.currentEntity.forEach((e=>this.icy.viewer.entities.remove(e))),this.currentEntity=[],this.icy.viewer.entities.remove(this.currentPolygon),this.currentPolygon=void 0,this.icy.viewer.entities.remove(this.currentPolyline),this.currentPolyline=void 0;let e=this.currentFence.flat();e.push(...this.currentFence[0]);let t=this.icy.viewer.entities.add({wall:{positions:Cesium.Cartesian3.fromDegreesArrayHeights(e),maximumHeights:new Array(e.length).fill(60),minimunHeights:new Array(e.length).fill(10),material:new Cesium.WallDiffuseMaterialProperty({color:new Cesium.Color(1,1,0,1)})}});this.currentFence.length=0,this.fenceList.push(t)}addPoint(e,t,i){let r;return r=this.icy.viewer.entities.add({position:Cesium.Cartesian3.fromDegrees(e,t,i),point:{pixelSize:10,color:Cesium.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),r}update_Polygon(){this.currentEntity.length<3?(this.icy.viewer.entities.remove(this.currentPolygon),this.currentPolygon=void 0):this.currentPolygon.polygon.hierarchy=Cesium.Cartesian3.fromDegreesArrayHeights(this.currentFence.flat())}update_Polyline(){if(this.currentEntity.length<2)this.icy.viewer.entities.remove(this.currentPolyline),this.currentPolyline=void 0;else{let e=this.currentFence.flat();this.currentPolyline.polyline.positions=Cesium.Cartesian3.fromDegreesArrayHeights(e)}}clear(){try{this.finish()}catch(e){}this.fenceList.map((e=>{this.icy.viewer.entities.remove(e)})),this.fenceList=[]}showDataSource(e,t=100,i="yellow"){let r=e.flat();r.push(...e[0]),this.qiang=this.icy.viewer.entities.add({wall:{positions:Cesium.Cartesian3.fromDegreesArrayHeights(r),maximumHeights:new Array(r.length).fill(t),minimunHeights:new Array(r.length).fill(10),material:new Cesium.WallDiffuseMaterialProperty({color:new Cesium.Color.fromCssColorString(i)})}})}show(e){this.qiang.show=e}destroy(){this.icy.viewer.entities.remove(this.qiang),this.qiang=void 0}sout(){console.log("本次您绘制的区域经纬度为"),console.log(JSON.stringify(this.currentFence))}}class F{constructor(e,{name:t=null,width:i=1,positions:r,color:n}){this.icy=e,this.positions=r,this.entity=e.viewer.entities.add({name:t,polyline:{positions:Cesium.Cartesian3.fromDegreesArrayHeights(r.flat()),width:i,material:Cesium.Color.fromCssColorString(n),clampToGround:!1}})}setCurrentIndex(e){let t=[];for(let i=0;iCesium.Cartesian3.fromDegreesArrayHeights(t.flat())),!1)}show(e){this.entity.show=e}destroy(){this.icy.viewer.entities.remove(this.entity),this.entity=void 0}}class z{constructor(e){this.viewer=e.viewer,this.lastStageList=[]}add(e,t,i,r){this.lastStageList.push(this.showCircleScan(e,t,i,r))}clear(){this.lastStageList.forEach((e=>{this.clearScanEffects(e)})),this.lastStageList=[]}showCircleScan(e,t,i,r){const n=new Cesium.Cartographic(Cesium.Math.toRadians(e[0]),Cesium.Math.toRadians(e[1]),e[2]);return t=new Cesium.Color.fromCssColorString(t),this._addCircleScanPostStage(n,i,t,r)}_addCircleScanPostStage(e,t,i,r){const n=Cesium.Cartographic.toCartesian(e),s=new Cesium.Cartesian4(n.x,n.y,n.z,1),a=new Cesium.Cartographic(e.longitude,e.latitude,e.height+500),o=Cesium.Cartographic.toCartesian(a),l=new Cesium.Cartesian4(o.x,o.y,o.z,1),u=(new Date).getTime(),h=new Cesium.Cartesian4,c=new Cesium.Cartesian4,m=new Cesium.Cartesian3,d=this,p=new Cesium.PostProcessStage({fragmentShader:d._getScanSegmentShader(),uniforms:{u_scanCenterEC:function(){return Cesium.Matrix4.multiplyByVector(d.viewer.camera._viewMatrix,s,h)},u_scanPlaneNormalEC:function(){const e=Cesium.Matrix4.multiplyByVector(d.viewer.camera._viewMatrix,s,h),t=Cesium.Matrix4.multiplyByVector(d.viewer.camera._viewMatrix,l,c);return m.x=t.x-e.x,m.y=t.y-e.y,m.z=t.z-e.z,Cesium.Cartesian3.normalize(m,m),m},u_radius:function(){return t*(((new Date).getTime()-u)%r)/r},u_scanColor:i}});return this.viewer.scene.postProcessStages.add(p),p}_getScanSegmentShader(){return" uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n varying vec2 v_textureCoordinates;\n uniform vec4 u_scanCenterEC;\n uniform vec3 u_scanPlaneNormalEC;\n uniform float u_radius;\n uniform vec4 u_scanColor;\n vec4 toEye(in vec2 uv, in float depth){\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\n vec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0);\n posInCamera =posInCamera / posInCamera.w;\n return posInCamera;\n }\n vec3 pointProjectOnPlane(in vec3 planeNormal, in vec3 planeOrigin, in vec3 point){\n vec3 v01 = point - planeOrigin;\n float d = dot(planeNormal, v01) ;\n return (point - planeNormal * d);\n }\n float getDepth(in vec4 depth){\n float z_window = czm_unpackDepth(depth);\n z_window = czm_reverseLogDepth(z_window);\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n }\n void main(){\n gl_FragColor = texture2D(colorTexture, v_textureCoordinates);\n float depth = getDepth(texture2D(depthTexture, v_textureCoordinates));\n vec4 viewPos = toEye(v_textureCoordinates, depth);\n vec3 prjOnPlane = pointProjectOnPlane(u_scanPlaneNormalEC.xyz, u_scanCenterEC.xyz, viewPos.xyz);\n float dis = length(prjOnPlane.xyz - u_scanCenterEC.xyz);\n if(dis < u_radius){\n float f = 1.0 - abs(u_radius - dis) / u_radius;\n f = pow(f, float(18));\n gl_FragColor = mix(gl_FragColor,u_scanColor,f);\n }\n gl_FragColor.a = gl_FragColor.a / 2.0;\n }\n "}clearScanEffects(e){this.viewer.scene.postProcessStages.remove(e)}}class L{static{function e(){S.update(),requestAnimationFrame(e)}e()}constructor(e){this.icy=e,this.entity}loadCanvas(e,{lon:t,lat:i,height:r,id:n,name:s}){let a=new Image;a.src=e.toDataURL("image/jpg"),this.entity=this.icy.viewer.entities.add({name:s,id:n,position:Cesium.Cartesian3.fromDegrees(t,i,r),billboard:{image:a,disableDepthTestDistance:Number.POSITIVE_INFINITY,horizontalOrigin:Cesium.HorizontalOrigin.CENTER,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,scale:1}})}uopdateImg(e){let t=new Image;t.src=e.toDataURL("image/jpg"),this.entity.billboard.image=t}move(e,t,i){this.entity.position=Cesium.Cartesian3.fromDegrees(e,t,i)}animationMove(e,t,i,r){if(!this.entity)throw"还没有对象呢!!";let n=this.entity.position,s=Cesium.Cartesian3.fromDegrees(e,t,i),a=new S.Tween({x:n._value.x,y:n._value.y,z:n._value.z});a.to({x:s.x,y:s.y,z:s.z},r),a.onUpdate((({x:e,y:t,z:i})=>{let r=new Cesium.Cartesian3(e,t,i);this.entity.position=r})),a.start()}show(e){this.entity.show=e}animate(){this.entity.billboard.scale>1.2?this.entity.billboard.scale=1:this.entity.billboard.scale+=.002}destroy(){this.icy.viewer.entities.remove(this.entity),this.entity=void 0}}Cesium.Ion.defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIzNzFlNTg1MC0wOTA0LTQzYzYtOTBjZi05MjIzZjU2NTkzZGQiLCJpZCI6MTE4ODE3LCJpYXQiOjE2NzE1MDY2NjF9.yGR3CbS6VQp2s6Y9NHWOIKq8qKL0sWLZZBZ9eP02Ags",CustomCesium=t})(); \ No newline at end of file +var CustomCesium; +(() => { + "use strict"; + var e = { + d: (t, i) => { + for (var r in i) e.o(i, r) && !e.o(t, r) && Object.defineProperty(t, r, {enumerable: !0, get: i[r]}) + }, o: (e, t) => Object.prototype.hasOwnProperty.call(e, t), r: e => { + "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {value: "Module"}), Object.defineProperty(e, "__esModule", {value: !0}) + } + }, t = {}; + e.r(t), e.d(t, { + BulletinBoard: () => k, + Carmer: () => s, + EarlyWarning: () => z, + EditGltf: () => A, + Enclosure: () => O, + GroupModel: () => T, + HumanModel: () => P, + Line: () => F, + Model: () => E, + ModelDrag: () => x, + Mouse: () => o, + Radar: () => L, + Scene: () => n, + Tiles3D: () => a + }); + + class i { + constructor(e) { + this._definitionChanged = new Cesium.Event, this._color = void 0, this.color = e.color + } + + get isConstant() { + return !1 + } + + get definitionChanged() { + return this._definitionChanged + } + + getType(e) { + return Cesium.Material.WallDiffuseMaterialType + } + + getValue(e, t) { + return Cesium.defined(t) || (t = {}), t.color = Cesium.Property.getValueOrDefault(this._color, e, Cesium.Color.RED, t.color), t + } + + equals(e) { + return this === e || e instanceof i && Cesium.Property.equals(this._color, e._color) + } + } + + class r { + constructor() { + } + + static tileXYToQuadKey(e, t, i) { + for (var r = "", n = i; n >= 0; --n) { + var s = 1 << n, a = 0; + 0 != (e & s) && (a |= 1), 0 != (t & s) && (a |= 2), r += a + } + return "0" === r[0] && (r = r.substr(1)), r + } + + static Cartesian3ToWGS84(e, t) { + var i = e.scene.globe.ellipsoid.cartesianToCartographic(t); + return [Cesium.Math.toDegrees(i.longitude), Cesium.Math.toDegrees(i.latitude), i.height] + } + + static + } + + Cesium.WebMercatorTilingScheme; + + class n { + static google_mapResources = new Cesium.UrlTemplateImageryProvider({ + url: "https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}", + credit: "谷歌影像服务" + }); + static tiandi_mapResources = new Cesium.UrlTemplateImageryProvider({ + url: "https://ecn.t{s}.tiles.virtualearth.net/tiles/a{q}.jpeg?n=z&g=11404", + subdomains: ["0", "1", "2", "3"], + tilingScheme: new Cesium.WebMercatorTilingScheme, + customTags: { + q: function (e, t, i, n) { + return r.tileXYToQuadKey(t, i, n) + } + }, + minimumLevel: 3, + maximumLevel: 19 + }); + static gaode_mapResources = new Cesium.UrlTemplateImageryProvider({ + url: "https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}", + minimumLevel: 3, + maximumLevel: 18 + }); + + constructor(e, t, i, r) { + if (this.icy = {viewer: void 0, name: t}, 1 == i) { + let t = new Cesium.UrlTemplateImageryProvider({ + url: r, + fileExtension: "png", + minimumLevel: 0, + maximumLevel: 19, + tilingScheme: new Cesium.WebMercatorTilingScheme + }); + this.init(e, t, 50) + } + 2 == i && this.init(e, n.google_mapResources, 50), 3 == i && this.init(e, n.tiandi_mapResources, 50), 4 == i && this.init(e, n.gaode_mapResources, 50), 5 == i && this.init(e, void 0, 50) + } + + getIcy() { + return this.icy + } + + init(e, t, i = 50) { + this.icy.viewer = new Cesium.Viewer(e, { + targetFrameRate: i, + imageryProvider: t, + animation: !1, + timeline: !1, + geocoder: !1, + homeButton: !1, + sceneModePicker: !1, + baseLayerPicker: !1, + navigationHelpButton: !1, + fullscreenButton: !1 + }), this.icy.viewer.scene.mode, Cesium.SceneMode.COLUMBUS_VIEW, this.icy.viewer.scene.screenSpaceCameraController.enableTilt = !0, this.icy.viewer._cesiumWidget._creditContainer.style.display = "none", this.icy.viewer.scene.globe.depthTestAgainstTerrain = !0, this.icy.viewer.scene.sampleHeightSupported || window.alert("浏览器不支持 sampleHeight."), this.icy.viewer.scene.pickPositionSupported || window.alert("不支持深度纹理,无法绘制多边形,地形开挖功能无法使用!"), this.icy.viewer.scene.globe.enableLighting = !1, this.icy.viewer.shadows = !1, this.icy.viewer.scene.globe.fillHighlightColor = 1, this.icy.viewer.scene.postProcessStages.fxaa.enabled = !0, this.fPSShow(!0), this.initMaterial(); + var r = document.createElement("canvas"), n = r.getContext("2d"); + let s = "@%E5%BE%97%E7%91%9E%E7%B4%AB%E8%9C%82"; + r.width = 12 * decodeURIComponent(s).length, r.height = 18, n.fillStyle = "#ffffff00", n.fillRect(0, 0, r.width, r.height), n.fillStyle = "#8500ff20", n.font = "bold 11px Arial", n.textAlign = "right", n.textBaseline = "bottom"; + var a = decodeURIComponent(s); + n.fillText(a, r.width - 2, r.height - 2); + var o = r.toDataURL(), l = document.createElement("img"); + l.src = o, l.style = "position:fixed;z-index:9999999;bottom: 5px;left: 5px", document.body.appendChild(l), window.copyright = decodeURIComponent("%E6%9C%ACSDK%E5%9F%BA%E4%BA%8ECesiumJS%EF%BC%8C%E7%94%B1%EF%BC%9A%E5%8C%97%E4%BA%AC%E5%BE%97%E7%91%9E%E7%B4%AB%E8%9C%82%E7%A7%91%E6%8A%80%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8%20-%20%E5%86%AF~~%20%E5%B0%81%E8%A3%85") + } + + fPSShow(e) { + this.icy.viewer.scene.debugShowFramesPerSecond = e + } + + destroy() { + this.icy.iewer.destroy(), this.icy = void 0 + } + + initMaterial() { + Cesium.WallDiffuseMaterialProperty || (Object.defineProperties(i.prototype, {color: Cesium.createPropertyDescriptor("color")}), Cesium.WallDiffuseMaterialProperty = i, Cesium.Material.WallDiffuseMaterialProperty = "WallDiffuseMaterialProperty", Cesium.Material.WallDiffuseMaterialType = "WallDiffuseMaterialType", Cesium.Material.WallDiffuseMaterialSource = "\n uniform vec4 color;\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n material.diffuse = color.rgb * 2.0;\n material.alpha = color.a * (1.0 - fract(st.t)) * 0.8;\n return material;\n } \n ", Cesium.Material._materialCache.addMaterial(Cesium.Material.WallDiffuseMaterialType, { + fabric: { + type: Cesium.Material.WallDiffuseMaterialType, + uniforms: {color: new Cesium.Color(1, 0, 0, 1)}, + source: Cesium.Material.WallDiffuseMaterialSource + }, translucent: function (e) { + return !0 + } + })) + } + } + + class s { + constructor(e) { + this.icy = e + } + + flyTo({maxHeight: e, time: t, position: i, angle: r}) { + 3 == i.length ? (e || (e = 10), t && 0 != t || (t = 3), this.icy.viewer.camera.flyTo({ + destination: Cesium.Cartesian3.fromDegrees(i[0], i[1], i[2]), + duration: t, + maximumHeight: e, + orientation: { + heading: Cesium.Math.toRadians(r[0]), + pitch: Cesium.Math.toRadians(r[1]), + roll: Cesium.Math.toRadians(r[2]) + } + })) : console.log("相机飞行请传入经纬高") + } + + flyToInfo({maxHeight: e, time: t, position: i, angle: r}) { + 3 == i.length ? (e || (e = 10), t && 0 != t || (t = 3), this.icy.viewer.camera.flyTo({ + destination: new Cesium.Cartesian3(i[0], i[1], i[2]), + duration: t, + maximumHeight: e, + orientation: {heading: r.heading, pitch: r.pitch, roll: r.roll} + })) : console.log("相机飞行请传入经纬高") + } + + teleporting(e) { + if (6 != e.length) throw"相机跳转参数错误,请检查传入参数"; + icy.viewer.camera.setView({ + destination: {x: e[0], y: e[1], z: e[2]}, + orientation: {heading: e[3], pitch: e[4], roll: e[5]} + }) + } + + follow({angle: e, targetPoint: t, distance: i}, r) { + let n = turf.point([t[0], t[1]]), s = -e[0], a = turf.rhumbDestination(n, i, s, {units: "kilometers"}); + this.flyTo({ + maxHeight: 20, + time: r, + position: [a.geometry.coordinates[0], a.geometry.coordinates[1], t[2]], + angle: e + }) + } + + getgGsture() { + console.log("当前相机姿态输出"); + let e = this.icy.viewer.camera.heading, t = this.icy.viewer.camera.pitch, i = this.icy.viewer.camera.roll, + r = this.icy.viewer.camera.positionWC; + console.log(`destination:{x:${r.x},y:${r.y},z:${r.z}},orientation:{heading:${e},pitch:${t},roll:${i}}`) + } + + changeView(e) { + if ("2D" == e) { + let e = this.getCenterPoint(this.icy.viewer); + this.icy.viewer.scene.camera.flyTo({ + destination: Cesium.Cartesian3.fromDegrees(e[0], e[1], 2e3), + orientation: { + heading: this.icy.viewer.scene.camera.heading, + pitch: Cesium.Math.toRadians(-90), + roll: 0 + } + }), this.icy.viewer.scene.screenSpaceCameraController.enableTilt = !1 + } + if ("3D" == e) { + let e = 0, t = setInterval((() => { + e += 5, this.icy.viewer.scene.camera.moveDown(5), e >= 2e3 && (clearInterval(t), setTimeout((() => { + this.icy.viewer.scene.camera.flyTo({ + destination: this.icy.viewer.scene.camera.positionWC, + orientation: { + heading: this.icy.viewer.scene.camera.heading, + pitch: Cesium.Math.toRadians(-45), + roll: 0 + } + }) + }), 100)) + })); + this.icy.viewer.scene.screenSpaceCameraController.enableTilt = !0 + } + } + + getCenterPoint(e) { + let t = e.camera.pickEllipsoid(new Cesium.Cartesian2(e.canvas.clientWidth / 2, e.canvas.clientHeight / 2)), + i = Cesium.Ellipsoid.WGS84.cartesianToCartographic(t); + return [180 * i.longitude / Math.PI, 180 * i.latitude / Math.PI] + } + + getBottomCenterPoint(e) { + let t = e.camera.pickEllipsoid(new Cesium.Cartesian2(e.canvas.clientWidth / 2, e.canvas.clientHeight)), + i = Cesium.Ellipsoid.WGS84.cartesianToCartographic(t); + return [180 * i.longitude / Math.PI, 180 * i.latitude / Math.PI] + } + } + + class a { + constructor(e, t, i = 0) { + this.icy = e, this.tileset = e.viewer.scene.primitives.add(new Cesium.Cesium3DTileset({ + url: t, + show: !0 + })), this.tileset.readyPromise.then((e => { + this.tileset = e, this.setHeight(i) + })) + } + + show(e) { + this.tileset.show = e + } + + setHeight(e = 0) { + const t = this.tileset.boundingSphere, i = Cesium.Cartographic.fromCartesian(t.center), + r = Cesium.Cartesian3.fromRadians(i.longitude, i.latitude, 0), + n = Cesium.Cartesian3.fromRadians(i.longitude, i.latitude, e), + s = Cesium.Cartesian3.subtract(n, r, new Cesium.Cartesian3); + this.tileset.modelMatrix = Cesium.Matrix4.fromTranslation(s) + } + + look() { + this.icy.viewer.zoomTo(this.tileset) + } + + destroy() { + this.tileset.destroy(), this.tileset = void 0 + } + } + + class o { + constructor(e) { + this.icy = e, this.billboard = void 0 + } + + mouseMOVE(e) { + new Cesium.ScreenSpaceEventHandler(this.icy.viewer.scene.canvas).setInputAction((t => { + if (!this.icy.viewer.scene.pick(t.endPosition)) return this.billboard && (this.icy.viewer.canvas.style.cursor = "default", this.billboard.scale = void 0, this.billboard = void 0), void e(!1) + }), Cesium.ScreenSpaceEventType.MOUSE_MOVE) + } + + mouseLeft(e) { + new Cesium.ScreenSpaceEventHandler(this.icy.viewer.scene.canvas).setInputAction((t => { + let i = this.icy.viewer.camera.getPickRay(t.position), + r = this.icy.viewer.scene.globe.pick(i, this.icy.viewer.scene), + n = Cesium.Cartographic.fromCartesian(r), s = Cesium.Math.toDegrees(n.longitude), + a = Cesium.Math.toDegrees(n.latitude), o = n.height, l = { + longitude: Number(s.toFixed(8)), + latitude: Number(a.toFixed(8)), + altitude: Number(o.toFixed(5)) + }; + console.log("鼠标获取经纬高", s, a, o, l); + let h = this.icy.viewer.scene.pick(t.position); + if (console.log(h), !h) return console.log("pick为空"), this.icy.viewer.scene.globe.translucency.enabled = !0, void (this.icy.viewer.scene.globe.translucency.frontFaceAlpha = 1); + e(h.id) + }), Cesium.ScreenSpaceEventType.LEFT_CLICK) + } + + mouseRight(e) { + let t = new Cesium.ScreenSpaceEventHandler(this.icy.viewer.scene.canvas), i = this; + t.setInputAction((t => { + let r = (n = i.icy.viewer.scene.pickPosition(t.position), s = new Cesium.Cartesian3(n.x, n.y, n.z), a = Cesium.Cartographic.fromCartesian(s), o = Cesium.Math.toDegrees(a.latitude), { + lng: Cesium.Math.toDegrees(a.longitude), + lat: o, + alt: a.height + }); + var n, s, a, o; + e(r) + }), Cesium.ScreenSpaceEventType.RIGHT_CLICK) + } + + mouseLeftDouble(e) { + new Cesium.ScreenSpaceEventHandler(this.icy.viewer.scene.canvas).setInputAction((t => { + let i = this.icy.viewer.camera.getPickRay(t.position), + r = this.icy.viewer.scene.globe.pick(i, this.icy.viewer.scene), + n = Cesium.Cartographic.fromCartesian(r), s = Cesium.Math.toDegrees(n.longitude), + a = Cesium.Math.toDegrees(n.latitude), o = n.height; + e(s, a, o) + }), Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK) + } + } + + var l, h = Object.freeze({ + Linear: Object.freeze({ + None: function (e) { + return e + }, In: function (e) { + return this.None(e) + }, Out: function (e) { + return this.None(e) + }, InOut: function (e) { + return this.None(e) + } + }), Quadratic: Object.freeze({ + In: function (e) { + return e * e + }, Out: function (e) { + return e * (2 - e) + }, InOut: function (e) { + return (e *= 2) < 1 ? .5 * e * e : -.5 * (--e * (e - 2) - 1) + } + }), Cubic: Object.freeze({ + In: function (e) { + return e * e * e + }, Out: function (e) { + return --e * e * e + 1 + }, InOut: function (e) { + return (e *= 2) < 1 ? .5 * e * e * e : .5 * ((e -= 2) * e * e + 2) + } + }), Quartic: Object.freeze({ + In: function (e) { + return e * e * e * e + }, Out: function (e) { + return 1 - --e * e * e * e + }, InOut: function (e) { + return (e *= 2) < 1 ? .5 * e * e * e * e : -.5 * ((e -= 2) * e * e * e - 2) + } + }), Quintic: Object.freeze({ + In: function (e) { + return e * e * e * e * e + }, Out: function (e) { + return --e * e * e * e * e + 1 + }, InOut: function (e) { + return (e *= 2) < 1 ? .5 * e * e * e * e * e : .5 * ((e -= 2) * e * e * e * e + 2) + } + }), Sinusoidal: Object.freeze({ + In: function (e) { + return 1 - Math.sin((1 - e) * Math.PI / 2) + }, Out: function (e) { + return Math.sin(e * Math.PI / 2) + }, InOut: function (e) { + return .5 * (1 - Math.sin(Math.PI * (.5 - e))) + } + }), Exponential: Object.freeze({ + In: function (e) { + return 0 === e ? 0 : Math.pow(1024, e - 1) + }, Out: function (e) { + return 1 === e ? 1 : 1 - Math.pow(2, -10 * e) + }, InOut: function (e) { + return 0 === e ? 0 : 1 === e ? 1 : (e *= 2) < 1 ? .5 * Math.pow(1024, e - 1) : .5 * (2 - Math.pow(2, -10 * (e - 1))) + } + }), Circular: Object.freeze({ + In: function (e) { + return 1 - Math.sqrt(1 - e * e) + }, Out: function (e) { + return Math.sqrt(1 - --e * e) + }, InOut: function (e) { + return (e *= 2) < 1 ? -.5 * (Math.sqrt(1 - e * e) - 1) : .5 * (Math.sqrt(1 - (e -= 2) * e) + 1) + } + }), Elastic: Object.freeze({ + In: function (e) { + return 0 === e ? 0 : 1 === e ? 1 : -Math.pow(2, 10 * (e - 1)) * Math.sin(5 * (e - 1.1) * Math.PI) + }, Out: function (e) { + return 0 === e ? 0 : 1 === e ? 1 : Math.pow(2, -10 * e) * Math.sin(5 * (e - .1) * Math.PI) + 1 + }, InOut: function (e) { + return 0 === e ? 0 : 1 === e ? 1 : (e *= 2) < 1 ? -.5 * Math.pow(2, 10 * (e - 1)) * Math.sin(5 * (e - 1.1) * Math.PI) : .5 * Math.pow(2, -10 * (e - 1)) * Math.sin(5 * (e - 1.1) * Math.PI) + 1 + } + }), Back: Object.freeze({ + In: function (e) { + var t = 1.70158; + return 1 === e ? 1 : e * e * ((t + 1) * e - t) + }, Out: function (e) { + var t = 1.70158; + return 0 === e ? 0 : --e * e * ((t + 1) * e + t) + 1 + }, InOut: function (e) { + var t = 2.5949095; + return (e *= 2) < 1 ? e * e * ((t + 1) * e - t) * .5 : .5 * ((e -= 2) * e * ((t + 1) * e + t) + 2) + } + }), Bounce: Object.freeze({ + In: function (e) { + return 1 - h.Bounce.Out(1 - e) + }, Out: function (e) { + return e < 1 / 2.75 ? 7.5625 * e * e : e < 2 / 2.75 ? 7.5625 * (e -= 1.5 / 2.75) * e + .75 : e < 2.5 / 2.75 ? 7.5625 * (e -= 2.25 / 2.75) * e + .9375 : 7.5625 * (e -= 2.625 / 2.75) * e + .984375 + }, InOut: function (e) { + return e < .5 ? .5 * h.Bounce.In(2 * e) : .5 * h.Bounce.Out(2 * e - 1) + .5 + } + }), generatePow: function (e) { + return void 0 === e && (e = 4), e = (e = e < Number.EPSILON ? Number.EPSILON : e) > 1e4 ? 1e4 : e, { + In: function (t) { + return Math.pow(t, e) + }, Out: function (t) { + return 1 - Math.pow(1 - t, e) + }, InOut: function (t) { + return t < .5 ? Math.pow(2 * t, e) / 2 : (1 - Math.pow(2 - 2 * t, e)) / 2 + .5 + } + } + } + }), u = "undefined" == typeof self && "undefined" != typeof process && process.hrtime ? function () { + var e = process.hrtime(); + return 1e3 * e[0] + e[1] / 1e6 + } : "undefined" != typeof self && void 0 !== self.performance && void 0 !== self.performance.now ? self.performance.now.bind(self.performance) : void 0 !== Date.now ? Date.now : function () { + return (new Date).getTime() + }, c = function () { + function e() { + this._tweens = {}, this._tweensAddedDuringUpdate = {} + } + + return e.prototype.getAll = function () { + var e = this; + return Object.keys(this._tweens).map((function (t) { + return e._tweens[t] + })) + }, e.prototype.removeAll = function () { + this._tweens = {} + }, e.prototype.add = function (e) { + this._tweens[e.getId()] = e, this._tweensAddedDuringUpdate[e.getId()] = e + }, e.prototype.remove = function (e) { + delete this._tweens[e.getId()], delete this._tweensAddedDuringUpdate[e.getId()] + }, e.prototype.update = function (e, t) { + void 0 === e && (e = u()), void 0 === t && (t = !1); + var i = Object.keys(this._tweens); + if (0 === i.length) return !1; + for (; i.length > 0;) { + this._tweensAddedDuringUpdate = {}; + for (var r = 0; r < i.length; r++) { + var n = this._tweens[i[r]], s = !t; + n && !1 === n.update(e, s) && !t && delete this._tweens[i[r]] + } + i = Object.keys(this._tweensAddedDuringUpdate) + } + return !0 + }, e + }(), m = { + Linear: function (e, t) { + var i = e.length - 1, r = i * t, n = Math.floor(r), s = m.Utils.Linear; + return t < 0 ? s(e[0], e[1], r) : t > 1 ? s(e[i], e[i - 1], i - r) : s(e[n], e[n + 1 > i ? i : n + 1], r - n) + }, Bezier: function (e, t) { + for (var i = 0, r = e.length - 1, n = Math.pow, s = m.Utils.Bernstein, a = 0; a <= r; a++) i += n(1 - t, r - a) * n(t, a) * e[a] * s(r, a); + return i + }, CatmullRom: function (e, t) { + var i = e.length - 1, r = i * t, n = Math.floor(r), s = m.Utils.CatmullRom; + return e[0] === e[i] ? (t < 0 && (n = Math.floor(r = i * (1 + t))), s(e[(n - 1 + i) % i], e[n], e[(n + 1) % i], e[(n + 2) % i], r - n)) : t < 0 ? e[0] - (s(e[0], e[0], e[1], e[1], -r) - e[0]) : t > 1 ? e[i] - (s(e[i], e[i], e[i - 1], e[i - 1], r - i) - e[i]) : s(e[n ? n - 1 : 0], e[n], e[i < n + 1 ? i : n + 1], e[i < n + 2 ? i : n + 2], r - n) + }, Utils: { + Linear: function (e, t, i) { + return (t - e) * i + e + }, Bernstein: function (e, t) { + var i = m.Utils.Factorial; + return i(e) / i(t) / i(e - t) + }, Factorial: (l = [1], function (e) { + var t = 1; + if (l[e]) return l[e]; + for (var i = e; i > 1; i--) t *= i; + return l[e] = t, t + }), CatmullRom: function (e, t, i, r, n) { + var s = .5 * (i - e), a = .5 * (r - t), o = n * n; + return (2 * t - 2 * i + s + a) * (n * o) + (-3 * t + 3 * i - 2 * s - a) * o + s * n + t + } + } + }, d = function () { + function e() { + } + + return e.nextId = function () { + return e._nextId++ + }, e._nextId = 0, e + }(), p = new c, C = function () { + function e(e, t) { + void 0 === t && (t = p), this._object = e, this._group = t, this._isPaused = !1, this._pauseStart = 0, this._valuesStart = {}, this._valuesEnd = {}, this._valuesStartRepeat = {}, this._duration = 1e3, this._initialRepeat = 0, this._repeat = 0, this._yoyo = !1, this._isPlaying = !1, this._reversed = !1, this._delayTime = 0, this._startTime = 0, this._easingFunction = h.Linear.None, this._interpolationFunction = m.Linear, this._chainedTweens = [], this._onStartCallbackFired = !1, this._onEveryStartCallbackFired = !1, this._id = d.nextId(), this._isChainStopped = !1, this._goToEnd = !1 + } + + return e.prototype.getId = function () { + return this._id + }, e.prototype.isPlaying = function () { + return this._isPlaying + }, e.prototype.isPaused = function () { + return this._isPaused + }, e.prototype.to = function (e, t) { + return this._valuesEnd = Object.create(e), void 0 !== t && (this._duration = t), this + }, e.prototype.duration = function (e) { + return void 0 === e && (e = 1e3), this._duration = e, this + }, e.prototype.start = function (e, t) { + if (void 0 === e && (e = u()), void 0 === t && (t = !1), this._isPlaying) return this; + if (this._group && this._group.add(this), this._repeat = this._initialRepeat, this._reversed) for (var i in this._reversed = !1, this._valuesStartRepeat) this._swapEndStartRepeatValues(i), this._valuesStart[i] = this._valuesStartRepeat[i]; + return this._isPlaying = !0, this._isPaused = !1, this._onStartCallbackFired = !1, this._onEveryStartCallbackFired = !1, this._isChainStopped = !1, this._startTime = e, this._startTime += this._delayTime, this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, t), this + }, e.prototype.startFromCurrentValues = function (e) { + return this.start(e, !0) + }, e.prototype._setupProperties = function (e, t, i, r, n) { + for (var s in i) { + var a = e[s], o = Array.isArray(a), l = o ? "array" : typeof a, h = !o && Array.isArray(i[s]); + if ("undefined" !== l && "function" !== l) { + if (h) { + var u = i[s]; + if (0 === u.length) continue; + u = u.map(this._handleRelativeValue.bind(this, a)), void 0 === t[s] && (i[s] = [a].concat(u)) + } + if ("object" !== l && !o || !a || h) (void 0 === t[s] || n) && (t[s] = a), o || (t[s] *= 1), r[s] = h ? i[s].slice().reverse() : t[s] || 0; else { + for (var c in t[s] = o ? [] : {}, a) t[s][c] = a[c]; + r[s] = o ? [] : {}, this._setupProperties(a, t[s], i[s], r[s], n) + } + } + } + }, e.prototype.stop = function () { + return this._isChainStopped || (this._isChainStopped = !0, this.stopChainedTweens()), this._isPlaying ? (this._group && this._group.remove(this), this._isPlaying = !1, this._isPaused = !1, this._onStopCallback && this._onStopCallback(this._object), this) : this + }, e.prototype.end = function () { + return this._goToEnd = !0, this.update(1 / 0), this + }, e.prototype.pause = function (e) { + return void 0 === e && (e = u()), this._isPaused || !this._isPlaying || (this._isPaused = !0, this._pauseStart = e, this._group && this._group.remove(this)), this + }, e.prototype.resume = function (e) { + return void 0 === e && (e = u()), this._isPaused && this._isPlaying ? (this._isPaused = !1, this._startTime += e - this._pauseStart, this._pauseStart = 0, this._group && this._group.add(this), this) : this + }, e.prototype.stopChainedTweens = function () { + for (var e = 0, t = this._chainedTweens.length; e < t; e++) this._chainedTweens[e].stop(); + return this + }, e.prototype.group = function (e) { + return void 0 === e && (e = p), this._group = e, this + }, e.prototype.delay = function (e) { + return void 0 === e && (e = 0), this._delayTime = e, this + }, e.prototype.repeat = function (e) { + return void 0 === e && (e = 0), this._initialRepeat = e, this._repeat = e, this + }, e.prototype.repeatDelay = function (e) { + return this._repeatDelayTime = e, this + }, e.prototype.yoyo = function (e) { + return void 0 === e && (e = !1), this._yoyo = e, this + }, e.prototype.easing = function (e) { + return void 0 === e && (e = h.Linear.None), this._easingFunction = e, this + }, e.prototype.interpolation = function (e) { + return void 0 === e && (e = m.Linear), this._interpolationFunction = e, this + }, e.prototype.chain = function () { + for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t]; + return this._chainedTweens = e, this + }, e.prototype.onStart = function (e) { + return this._onStartCallback = e, this + }, e.prototype.onEveryStart = function (e) { + return this._onEveryStartCallback = e, this + }, e.prototype.onUpdate = function (e) { + return this._onUpdateCallback = e, this + }, e.prototype.onRepeat = function (e) { + return this._onRepeatCallback = e, this + }, e.prototype.onComplete = function (e) { + return this._onCompleteCallback = e, this + }, e.prototype.onStop = function (e) { + return this._onStopCallback = e, this + }, e.prototype.update = function (e, t) { + if (void 0 === e && (e = u()), void 0 === t && (t = !0), this._isPaused) return !0; + var i, r, n = this._startTime + this._duration; + if (!this._goToEnd && !this._isPlaying) { + if (e > n) return !1; + t && this.start(e, !0) + } + if (this._goToEnd = !1, e < this._startTime) return !0; + !1 === this._onStartCallbackFired && (this._onStartCallback && this._onStartCallback(this._object), this._onStartCallbackFired = !0), !1 === this._onEveryStartCallbackFired && (this._onEveryStartCallback && this._onEveryStartCallback(this._object), this._onEveryStartCallbackFired = !0), r = (e - this._startTime) / this._duration, r = 0 === this._duration || r > 1 ? 1 : r; + var s = this._easingFunction(r); + if (this._updateProperties(this._object, this._valuesStart, this._valuesEnd, s), this._onUpdateCallback && this._onUpdateCallback(this._object, r), 1 === r) { + if (this._repeat > 0) { + for (i in isFinite(this._repeat) && this._repeat--, this._valuesStartRepeat) this._yoyo || "string" != typeof this._valuesEnd[i] || (this._valuesStartRepeat[i] = this._valuesStartRepeat[i] + parseFloat(this._valuesEnd[i])), this._yoyo && this._swapEndStartRepeatValues(i), this._valuesStart[i] = this._valuesStartRepeat[i]; + return this._yoyo && (this._reversed = !this._reversed), void 0 !== this._repeatDelayTime ? this._startTime = e + this._repeatDelayTime : this._startTime = e + this._delayTime, this._onRepeatCallback && this._onRepeatCallback(this._object), this._onEveryStartCallbackFired = !1, !0 + } + this._onCompleteCallback && this._onCompleteCallback(this._object); + for (var a = 0, o = this._chainedTweens.length; a < o; a++) this._chainedTweens[a].start(this._startTime + this._duration, !1); + return this._isPlaying = !1, !1 + } + return !0 + }, e.prototype._updateProperties = function (e, t, i, r) { + for (var n in i) if (void 0 !== t[n]) { + var s = t[n] || 0, a = i[n], o = Array.isArray(e[n]), l = Array.isArray(a); + !o && l ? e[n] = this._interpolationFunction(a, r) : "object" == typeof a && a ? this._updateProperties(e[n], s, a, r) : "number" == typeof (a = this._handleRelativeValue(s, a)) && (e[n] = s + (a - s) * r) + } + }, e.prototype._handleRelativeValue = function (e, t) { + return "string" != typeof t ? t : "+" === t.charAt(0) || "-" === t.charAt(0) ? e + parseFloat(t) : parseFloat(t) + }, e.prototype._swapEndStartRepeatValues = function (e) { + var t = this._valuesStartRepeat[e], i = this._valuesEnd[e]; + this._valuesStartRepeat[e] = "string" == typeof i ? this._valuesStartRepeat[e] + parseFloat(i) : this._valuesEnd[e], this._valuesEnd[e] = t + }, e + }(), g = d.nextId, f = p, y = f.getAll.bind(f), _ = f.removeAll.bind(f), v = f.add.bind(f), w = f.remove.bind(f), + M = f.update.bind(f); + const S = { + Easing: h, + Group: c, + Interpolation: m, + now: u, + Sequence: d, + nextId: g, + Tween: C, + VERSION: "19.0.0", + getAll: y, + removeAll: _, + add: v, + remove: w, + update: M + }; + + class E { + static FileUrl = "../public/models/huaxing/glb/"; + + static nameShow(e, t) { + e.map((e => { + e.show(t) + })) + } + + static { + function e() { + S.update(), requestAnimationFrame(e) + } + + e() + } + + constructor(e, {url: t, height: i, lon: r, lat: n, id: s, name: a, scale: o, angle: l}, h) { + if (this.icy = e, !t && !h) return console.error("传参有问题"); + o = o || 1, i = i || 0, r = r || 116.28678152222574, n = n || 40.05185885026265; + let u = Cesium.Cartesian3.fromDegrees(r, n, i), c = Cesium.Math.toRadians(l[0]), + m = Cesium.Math.toRadians(l[1]), d = Cesium.Math.toRadians(l[2]), + p = new Cesium.HeadingPitchRoll(c, m, d), C = Cesium.Transforms.headingPitchRollQuaternion(u, p); + this.entity = t ? e.viewer.entities.add({ + id: s, + name: a, + position: u, + orientation: C, + model: {uri: t, scale: o, color: new Cesium.Color(1, 1, 1, 1)}, + runAnimations: !1, + incrementallyLoadTextures: !1, + colorBlendMode: Cesium.ColorBlendMode.MIX, + colorBlendAmount: .1, + _icy: {lon: r, lat: n, height: i} + }) : e.viewer.entities.add({ + id: s, + name: a, + position: u, + orientation: C, + model: h, + runAnimations: !1, + incrementallyLoadTextures: !1, + colorBlendMode: Cesium.ColorBlendMode.MIX, + colorBlendAmount: .1, + _icy: {lon: r, lat: n, height: i} + }) + } + + show(e) { + this.entity.show = e + } + + move({lon: e, lat: t, height: i, angle: r}) { + let n = Cesium.Cartesian3.fromDegrees(e, t, i), s = Cesium.Math.toRadians(r[0]), + a = Cesium.Math.toRadians(r[1]), o = Cesium.Math.toRadians(r[2]), + l = new Cesium.HeadingPitchRoll(s, a, o), h = Cesium.Transforms.headingPitchRollQuaternion(n, l); + this.entity.position = n, this.entity.orientation = h + } + + updateAngle(e) { + let t = new Cesium.Cartesian3(this.entity.position._value.x, this.entity.position._value.y, this.entity.position._value.z), + i = Cesium.Math.toRadians(e[0]), r = e[1], n = e[2], s = new Cesium.HeadingPitchRoll(i, r, n), + a = Cesium.Transforms.headingPitchRollQuaternion(t, s); + this.entity.orientation = a + } + + animationMove(e, t, i, n, s) { + if (!this.entity) throw"还没有对象呢!!"; + let a = this.entity.position, o = Cesium.Cartesian3.fromDegrees(e, t, i), + l = new S.Tween({x: a._value.x, y: a._value.y, z: a._value.z}); + l.to({x: o.x, y: o.y, z: o.z}, n), l.onUpdate((({x: e, y: t, z: i}) => { + let n = new Cesium.Cartesian3(e, t, i); + this.entity.position = n; + let a = r.Cartesian3ToWGS84(this.icy.viewer, n); + s(a) + })), l.start() + } + + lineColor(e) { + this.entity.model.silhouetteSize = e ? 2 : 0 + } + + getEntity() { + return this.entity + } + + getPosition() { + return this.entity.modelMatrix + } + + clone(e) { + return Cesium.clone(this.entity.model) + } + + destroy() { + this.icy.viewer.entities.remove(this.entity), this.entity = void 0 + } + } + + class x { + static FileUrl = "../public/models/huaxing/glb/"; + + constructor(e, {url: t, height: i, lon: r, lat: n, id: s, name: a, scale: o, angle: l}, h) { + if (this.icy = e, !t && !h) return console.error("传参有问题"); + o = o || 1, i = i || 0, r = r || 116.28678152222574, n = n || 40.05185885026265; + let u = Cesium.Cartesian3.fromDegrees(r, n, i); + var c = Cesium.Math.toRadians(l[0]), m = Cesium.Math.toRadians(l[1]), d = Cesium.Math.toRadians(l[2]), + p = new Cesium.HeadingPitchRoll(c, m, d); + let C = Cesium.Transforms.headingPitchRollToFixedFrame(u, p, Cesium.Ellipsoid.WGS84, Cesium.Transforms.eastNorthUpToFixedFrame, new Cesium.Matrix4); + this.entity = e.viewer.scene.primitives.add(Cesium.Model.fromGltf({ + url: t, + color: Cesium.Color.WHITE, + modelMatrix: C, + scale: o + })) + } + + show(e) { + this.entity.show = e + } + + getEntity() { + return this.entity + } + + getState() { + let e = this.entity.modelMatrix; + const t = Cesium.Matrix4.getTranslation(e, new Cesium.Cartesian3); + var i = this.icy.viewer.scene.globe.ellipsoid.cartesianToCartographic(t), + r = Cesium.Math.toDegrees(i.latitude), n = Cesium.Math.toDegrees(i.longitude), s = i.height; + let a = e; + var o = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Matrix4.getTranslation(a, new Cesium.Cartesian3), Cesium.Ellipsoid.WGS84, new Cesium.Matrix4), + l = Cesium.Matrix4.multiply(Cesium.Matrix4.inverse(o, new Cesium.Matrix4), a, new Cesium.Matrix4), + h = Cesium.Matrix4.getMatrix3(l, new Cesium.Matrix3), u = Cesium.Quaternion.fromRotationMatrix(h), + c = Cesium.HeadingPitchRoll.fromQuaternion(u); + return { + lng: n, + lat: r, + alt: s, + angle: [Cesium.Math.toDegrees(c.heading), Cesium.Math.toDegrees(c.pitch), Cesium.Math.toDegrees(c.roll)] + } + } + + getPosition() { + return this.entity.modelMatrix + } + + destroy() { + this.icy.viewer.entities.remove(this.entity), this.entity = void 0 + } + } + + class T { + constructor(e) { + this.name = e, this.children = [] + } + + add(e) { + if (!e.entity) throw"请传入模型"; + this.children.push(e) + } + + show(e) { + this.children.forEach((t => { + t.show(e) + })) + } + + move() { + this.children.map((e => { + e.entity.position._value.x -= 1 + })) + } + + destroy(e) { + this.children.forEach((t => { + e.viewer.entities.remove(t.entity) + })) + } + } + + class P extends E { + static PERSON_BLUE = {url: E.FileUrl + "person_000002_blue.gltf"}; + static PERSON_BLUE_FAT = {url: E.FileUrl + "person_000002_blue_fat.gltf"}; + static PERSON_GREEN = {url: E.FileUrl + "person_000002_green.gltf"}; + static PERSON_GREEN_FAT = {url: E.FileUrl + "person_000002_green_fat.gltf"}; + static PERSON_RED = {url: E.FileUrl + "person_000002_red.gltf"}; + static PERSON_RED_FAT = {url: E.FileUrl + "person_000002_red_fat.gltf"}; + static PERSON_WHITE = {url: E.FileUrl + "person_000002_white.gltf"}; + static PERSON_WHITE_FAT = {url: E.FileUrl + "person_000002_white_fat.gltf"}; + static PERSON_YELLOW = {url: E.FileUrl + "person_000002_yellow.gltf"}; + static PERSON_YELLOW_FAT = {url: E.FileUrl + "person_000002_yellow_fat.gltf"}; + + constructor(e, t, {lon: i, lat: r, id: n, name: s, scale: a, angle: o, height: l}) { + super(e, {url: t.url, height: l, lon: i, lat: r, id: n, name: s, scale: a, angle: o}) + } + + destroy() { + } + } + + const b = window.Cesium, I = 52.35987755982988, R = 3.141592653589793, D = class { + static BD09ToGCJ02(e, t) { + let i = +e - .0065, r = +t - .006, n = Math.sqrt(i * i + r * r) - 2e-5 * Math.sin(r * I), + s = Math.atan2(r, i) - 3e-6 * Math.cos(i * I); + return [n * Math.cos(s), n * Math.sin(s)] + } + + static GCJ02ToBD09(e, t) { + t = +t, e = +e; + let i = Math.sqrt(e * e + t * t) + 2e-5 * Math.sin(t * I), r = Math.atan2(t, e) + 3e-6 * Math.cos(e * I); + return [i * Math.cos(r) + .0065, i * Math.sin(r) + .006] + } + + static WGS84ToGCJ02(e, t) { + if (t = +t, e = +e, this.out_of_china(e, t)) return [e, t]; + { + let i = this.delta(e, t); + return [e + i[0], t + i[1]] + } + } + + static GCJ02ToWGS84(e, t) { + if (t = +t, e = +e, this.out_of_china(e, t)) return [e, t]; + { + let i = this.delta(e, t); + return [2 * e - (e + i[0]), 2 * t - (t + i[1])] + } + } + + static delta(e, t) { + let i = this.transformLng(e - 105, t - 35), r = this.transformLat(e - 105, t - 35); + const n = t / 180 * R; + let s = Math.sin(n); + s = 1 - .006693421622965943 * s * s; + const a = Math.sqrt(s); + return i = 180 * i / (6378245 / a * Math.cos(n) * R), r = 180 * r / (6335552.717000426 / (s * a) * R), [i, r] + } + + static transformLng(e, t) { + let i = 300 + (e = +e) + 2 * (t = +t) + .1 * e * e + .1 * e * t + .1 * Math.sqrt(Math.abs(e)); + return i += 2 * (20 * Math.sin(6 * e * R) + 20 * Math.sin(2 * e * R)) / 3, i += 2 * (20 * Math.sin(e * R) + 40 * Math.sin(e / 3 * R)) / 3, i += 2 * (150 * Math.sin(e / 12 * R) + 300 * Math.sin(e / 30 * R)) / 3, i + } + + static transformLat(e, t) { + let i = 2 * (e = +e) - 100 + 3 * (t = +t) + .2 * t * t + .1 * e * t + .2 * Math.sqrt(Math.abs(e)); + return i += 2 * (20 * Math.sin(6 * e * R) + 20 * Math.sin(2 * e * R)) / 3, i += 2 * (20 * Math.sin(t * R) + 40 * Math.sin(t / 3 * R)) / 3, i += 2 * (160 * Math.sin(t / 12 * R) + 320 * Math.sin(t * R / 30)) / 3, i + } + + static out_of_china(e, t) { + return t = +t, !((e = +e) > 73.66 && e < 135.05 && t > 3.86 && t < 53.55) + } + + static transformWGS84ToCartesian(e, t, i) { + return t ? b.Cartesian3.fromDegrees(t.lng || t.lon, t.lat, t.alt = i || t.alt, b.Ellipsoid.WGS84) : b.Cartesian3.ZERO + } + + static transformCartesianToWGS84(e, t) { + let i = b.Ellipsoid.WGS84.cartesianToCartographic(t); + return {lng: b.Math.toDegrees(i.longitude), lat: b.Math.toDegrees(i.latitude), alt: i.height} + } + }, A = class { + constructor(e, t, i, r) { + if (!e) throw new Error("viewer is required!"); + this._viewer = e, this._gltf = t, this._handler = void 0, this._defaultWidth = 15, this._currentPick = void 0, this._dStep = i, this._rStep = r, this._params = { + tx: 0, + ty: 0, + tz: 0, + heading: 0, + pitch: 0, + roll: 0, + scale: 1 + }, this._coordArrows = void 0, this._coordCircle = [], this.initEvent() + } + + get params() { + return this._params + } + + initParam() { + this.removeAllTools(); + let e = this._gltf; + this._viewer; + const t = this.returnGltfCentorDegree(e), i = this.returnGltfRotation(e); + return this._params.tx = t.lng, this._params.ty = t.lat, this._params.tz = t.alt, this._params.heading = i.heading, this._params.pitch = i.pitch, this._params.roll = i.roll, { + originDegree: t, + length: 50 + } + } + + returnGltfRotation(e) { + let t = e.modelMatrix, + i = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Matrix4.getTranslation(t, new Cesium.Cartesian3), Cesium.Ellipsoid.WGS84, new Cesium.Matrix4), + r = Cesium.Matrix4.multiply(Cesium.Matrix4.inverse(i, new Cesium.Matrix4), t, new Cesium.Matrix4), + n = Cesium.Matrix4.getMatrix3(r, new Cesium.Matrix3), s = Cesium.Quaternion.fromRotationMatrix(n); + return Cesium.HeadingPitchRoll.fromQuaternion(s) + } + + returnGltfCentor(e) { + let t = e.modelMatrix; + return new Cesium.Cartesian3(t[12], t[13], t[14]) + } + + returnGltfCentorDegree(e) { + let t = this.returnGltfCentor(e); + return D.transformCartesianToWGS84(this._viewer, t) + } + + editRtation() { + const e = this.initParam(); + this.createCircle(e.originDegree.lng, e.originDegree.lat, e.originDegree.alt, e.length) + } + + createCircle(e, t, i, r) { + const n = []; + for (let e = 0; e <= 360; e += 3) { + const t = Math.sin(Cesium.Math.toRadians(e)), i = r * Math.cos(Cesium.Math.toRadians(e)), s = r * t; + n.push(new Cesium.Cartesian3(i, s, 0)) + } + const s = Cesium.Transforms.eastNorthUpToFixedFrame(new Cesium.Cartesian3.fromDegrees(e, t, i)), + a = this.createAxisSphere("model_edit_zCircle", n, s, Cesium.Color.RED); + this._viewer.scene.primitives.add(a); + const o = this.createAxisSphere("model_edit_yCircle", n, s, Cesium.Color.BLUE); + this._viewer.scene.primitives.add(o); + let l = Cesium.Matrix3.fromRotationY(Cesium.Math.toRadians(90)), + h = Cesium.Matrix4.fromRotationTranslation(l); + Cesium.Matrix4.multiply(o.geometryInstances.modelMatrix, h, o.geometryInstances.modelMatrix); + const u = this.createAxisSphere("model_edit_xCircle", n, s, Cesium.Color.GREEN); + this._viewer.scene.primitives.add(u); + let c = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(90)), + m = Cesium.Matrix4.fromRotationTranslation(c); + Cesium.Matrix4.multiply(u.geometryInstances.modelMatrix, m, u.geometryInstances.modelMatrix) + } + + createAxisSphere(e, t, i, r) { + let n = new Cesium.Primitive({ + geometryInstances: new Cesium.GeometryInstance({ + id: e, + geometry: new Cesium.PolylineGeometry({positions: t, width: 5}), + attributes: {color: Cesium.ColorGeometryInstanceAttribute.fromColor(r)} + }), + releaseGeometryInstances: !1, + appearance: new Cesium.PolylineColorAppearance({translucent: !1}), + modelMatrix: i + }); + return n._name = e, this._coordCircle.push(n), n + } + + onEdit(e) { + this._gltf.color = this._gltf.color.withAlpha(e ? .5 : 1), this._gltf._allowPicking = !e + } + + editTranslation() { + const e = this.initParam(); + this.onEdit(!0); + const t = e.length; + let i = new Cesium.Cartesian3(t, t, t), r = this.returnGltfCentor(this._gltf), + n = this.getTransPostion(r, i); + this.initLineArrow(e.originDegree, n, t) + } + + updateLineArrow(e, t) { + this.removeCoordArrows(), this._viewer; + const i = e.scale * e._boundingSphere.radius / .8; + let r = new Cesium.Cartesian3(i, i, i), n = this.returnGltfCentor(this._gltf), + s = this.getTransPostion(n, r); + this.initLineArrow(t, s, i) + } + + initEvent() { + const e = this, t = this._viewer; + e._handler = new Cesium.ScreenSpaceEventHandler(t.scene.canvas), e._handler.setInputAction((function (i) { + let r = t.scene.pick(i.position); + if (r && r.primitive && r.primitive._name && -1 != r.primitive._name.indexOf("model_edit")) { + t.scene.screenSpaceCameraController.enableRotate = !1, e._currentPick = r.primitive, e._currentPick.width = 25; + let n = t.scene.camera.pickEllipsoid(i.position, t.scene.globe.ellipsoid), + s = JSON.parse(JSON.stringify(e._gltf.modelMatrix)), a = 0, o = 0, l = 0, h = 0, u = 0, c = 0; + if (n && Cesium.defined(n)) { + a = 0, o = 0, l = 0, h = 0, u = 0, c = 0; + const r = D.transformCartesianToWGS84(t, n); + e._handler.setInputAction((function (n) { + let m = t.scene.camera.pickEllipsoid(n.endPosition, t.scene.globe.ellipsoid); + const d = D.transformCartesianToWGS84(t, m), p = n.endPosition.y - i.position.y, + C = n.endPosition.x - i.position.x; + switch (e._currentPick._name) { + case"model_edit_xArrow": + a = d.lng - r.lng; + break; + case"model_edit_yArrow": + o = d.lat - r.lat; + break; + case"model_edit_zArrow": + l = -e._dStep * p; + break; + case"model_edit_xCircle": + h = e._rStep * p; + break; + case"model_edit_yCircle": + u = e._rStep * C; + break; + case"model_edit_zCircle": + c = e._rStep * C + } + e.updateModel(e._params, a, o, l, h, u, c, s) + }), Cesium.ScreenSpaceEventType.MOUSE_MOVE) + } + e._handler.setInputAction((function (i) { + t.scene.screenSpaceCameraController.enableRotate = !0, e._currentPick.width = e._defaultWidth, e._currentPick = void 0, e._params.tx += a, e._params.ty += o, e._params.tz += l; + let r = e.returnGltfRotation(e._gltf); + e._params.heading = r.heading, e._params.pitch = r.pitch, e._params.roll = r.roll, e._handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE), e._handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP) + }), Cesium.ScreenSpaceEventType.LEFT_UP) + } + }), Cesium.ScreenSpaceEventType.LEFT_DOWN) + } + + updateModel(e, t, i, r, n, s, a, o) { + if (this._coordArrows) { + let n = new Cesium.HeadingPitchRoll(e.heading, e.pitch, e.roll), + s = new Cesium.Cartesian3.fromDegrees(e.tx + t, e.ty + i, e.tz + r), + a = Cesium.Transforms.headingPitchRollToFixedFrame(s, n, Cesium.Ellipsoid.WGS84, Cesium.Transforms.eastNorthUpToFixedFrame, new Cesium.Matrix4); + this._gltf.modelMatrix = a, this.updateLineArrow(this._gltf, { + lng: e.tx + t, + lat: e.ty + i, + alt: e.tz + r + }) + } + if (this._coordCircle) { + let e; + 0 != n ? e = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(n)) : 0 != s ? e = Cesium.Matrix3.fromRotationY(Cesium.Math.toRadians(s)) : 0 != a && (e = Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(a))), this._gltf.modelMatrix = e ? Cesium.Matrix4.multiplyByMatrix3(o, e, new Cesium.Matrix4) : this._gltf.modelMatrix + } + } + + initLineArrow(e, t, i) { + const r = new Cesium.PolylineCollection, n = [e.lng, e.lat, e.alt, t.lng, e.lat, e.alt], + s = (this.darwArrow(r, "model_edit_xArrow", n, Cesium.Color.GREEN), [e.lng, e.lat, e.alt, e.lng, t.lat, e.alt]), + a = (this.darwArrow(r, "model_edit_yArrow", s, Cesium.Color.BLUE), [e.lng, e.lat, e.alt, e.lng, e.lat, t.alt]); + this.darwArrow(r, "model_edit_zArrow", a, Cesium.Color.RED), this._coordArrows = this._viewer.scene.primitives.add(r), this._coordArrows._name = "CoordAxis" + } + + darwArrow(e, t, i, r) { + e.add({ + positions: Cesium.Cartesian3.fromDegreesArrayHeights(i), + width: this._defaultWidth, + material: Cesium.Material.fromType(Cesium.Material.PolylineArrowType, {color: r}) + })._name = t + } + + getTransPostion(e, t) { + let i = Cesium.Transforms.eastNorthUpToFixedFrame(e), r = new Cesium.Matrix4; + Cesium.Matrix4.setTranslation(Cesium.Matrix4.IDENTITY, t, r); + let n = Cesium.Matrix4.multiply(i, r, i); + return Cesium.Matrix4.getTranslation(n, e), D.transformCartesianToWGS84(this._viewer, e) + } + + removeCoordArrows() { + this._coordArrows && (this._viewer.scene.primitives.remove(this._coordArrows), this._coordArrows = void 0) + } + + removeCoordCircle() { + this._coordCircle.forEach((e => { + this._viewer.scene.primitives.remove(e) + })), this._coordCircle = [] + } + + removeAllTools() { + this.removeCoordArrows(), this.removeCoordCircle() + } + + destroy() { + this._gltf.currentPosition = [this._params.tx, this._params.ty, this._params.tz], this.removeAllTools(), this._handler.destroy(), this.onEdit(!1) + } + }; + + class O { + constructor(e) { + this.icy = e, this.fenceList = [], this.currentFence = [], this.currentEntity = [], this.currentState = !1, this.currentPolyline, this.currentPolygon + } + + start() { + this.currentState = !0; + let e = this.icy.viewer.canvas.parentNode, t = document.createElement("div"); + t.id = "menu", t.style = "width:100px;position:fixed;left:20px;top:30px;z-index:99"; + let i = document.createElement("button"); + i.innerHTML = "完成绘制", i.addEventListener("click", (() => { + this.sout(), this.finish() + })), t.appendChild(i), e.appendChild(t) + } + + add(e, t, i = 0) { + if (!this.currentState) throw"绘制电子围栏请先调用start函数"; + let r; + if (this.currentFence.push([e, t, i]), r = this.addPoint(e, t, i), this.currentFence.length > 1) { + let e = Cesium.Cartesian3.fromDegreesArrayHeights(this.currentFence.flat()); + this.currentPolyline ? this.currentPolyline.polyline.positions = e : this.currentPolyline = this.icy.viewer.entities.add({ + polyline: { + positions: e, + width: 5, + material: new Cesium.Color.fromCssColorString("#00fffb"), + clampToGround: !1 + } + }) + } + if (this.currentFence.length > 2) { + let e = Cesium.Cartesian3.fromDegreesArrayHeights(this.currentFence.flat()); + this.currentPolygon ? this.currentPolygon.polygon.hierarchy = e : this.currentPolygon = this.icy.viewer.entities.add({ + polygon: { + hierarchy: e, + material: new Cesium.Color.fromCssColorString("red").withAlpha(.5), + extrudedHeight: i, + height: Number(i + .1) + } + }) + } + this.currentEntity.push(r) + } + + back() { + if (!this.currentState) throw"请先调用start函数"; + this.currentFence.length = this.currentFence.length - 1, this.icy.viewer.entities.remove(this.currentEntity[this.currentEntity.length - 1]), this.currentEntity.length = this.currentEntity.length - 1, this.update_Polygon(), this.update_Polyline() + } + + stop() { + this.currentState ? (this.currentState = !1, 0 != this.currentFence.length && this.fenceList.push(this.currentFence), this.currentFence = []) : console.error("状态已经是停止状态") + } + + finish() { + this.currentEntity.forEach((e => this.icy.viewer.entities.remove(e))), this.currentEntity = [], this.icy.viewer.entities.remove(this.currentPolygon), this.currentPolygon = void 0, this.icy.viewer.entities.remove(this.currentPolyline), this.currentPolyline = void 0; + let e = this.currentFence.flat(); + e.push(...this.currentFence[0]); + // let t = this.icy.viewer.entities.add({ + // wall: { + // positions: Cesium.Cartesian3.fromDegreesArrayHeights(e), + // maximumHeights: new Array(e.length).fill(60), + // minimunHeights: new Array(e.length).fill(10), + // material: new Cesium.WallDiffuseMaterialProperty({color: new Cesium.Color(1, 1, 0, 1)}) + // } + // }); + this.currentFence.length = 0, this.fenceList.push(t) + } + + addPoint(e, t, i) { + let r; + return r = this.icy.viewer.entities.add({ + position: Cesium.Cartesian3.fromDegrees(e, t, i), + point: {pixelSize: 10, color: Cesium.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY} + }), r + } + + update_Polygon() { + this.currentEntity.length < 3 ? (this.icy.viewer.entities.remove(this.currentPolygon), this.currentPolygon = void 0) : this.currentPolygon.polygon.hierarchy = Cesium.Cartesian3.fromDegreesArrayHeights(this.currentFence.flat()) + } + + update_Polyline() { + if (this.currentEntity.length < 2) this.icy.viewer.entities.remove(this.currentPolyline), this.currentPolyline = void 0; else { + let e = this.currentFence.flat(); + this.currentPolyline.polyline.positions = Cesium.Cartesian3.fromDegreesArrayHeights(e) + } + } + + clear() { + try { + this.finish() + } catch (e) { + } + this.fenceList.map((e => { + this.icy.viewer.entities.remove(e) + })), this.fenceList = [] + } + + showDataSource(e, t = 100, i = "yellow") { + let r = e.flat(); + r.push(...e[0]), this.qiang = this.icy.viewer.entities.add({ + wall: { + positions: Cesium.Cartesian3.fromDegreesArrayHeights(r), + maximumHeights: new Array(r.length).fill(t), + minimunHeights: new Array(r.length).fill(10), + material: new Cesium.WallDiffuseMaterialProperty({color: new Cesium.Color.fromCssColorString(i)}) + } + }) + } + + show(e) { + this.qiang.show = e + } + + destroy() { + this.icy.viewer.entities.remove(this.qiang), this.qiang = void 0 + } + + sout() { + console.log("本次您绘制的区域经纬度为"), console.log(JSON.stringify(this.currentFence)) + } + } + + class F { + constructor(e, {name: t = null, width: i = 1, positions: r, color: n}) { + this.icy = e, this.positions = r, this.entity = e.viewer.entities.add({ + name: t, + polyline: { + positions: Cesium.Cartesian3.fromDegreesArrayHeights(r.flat()), + width: i, + material: Cesium.Color.fromCssColorString(n), + clampToGround: !1 + } + }) + } + + setCurrentIndex(e) { + let t = []; + for (let i = 0; i < e; i++) t.push(this.positions[i]); + this.entity.polyline.positions = new Cesium.CallbackProperty((() => Cesium.Cartesian3.fromDegreesArrayHeights(t.flat())), !1) + } + + show(e) { + this.entity.show = e + } + + destroy() { + this.icy.viewer.entities.remove(this.entity), this.entity = void 0 + } + } + + class z { + constructor(e, {id: t, positions: i, color: r = "red", height: n = 30, name: s = "四色图"}, a) { + this.icy = e, this.entity = e.viewer.entities.add({ + name: s, + id: t, + polygon: { + hierarchy: Cesium.Cartesian3.fromDegreesArrayHeights(i.flat()), + material: Cesium.Color.fromCssColorString(r).withAlpha(.5), + extrudedHeight: n, + outline: !0, + outlineColor: Cesium.Color.fromCssColorString("#ffffff") + } + }); + var o = this.entity.polygon.hierarchy.getValue(Cesium.JulianDate.now()).positions, + l = Cesium.BoundingSphere.fromPoints(o).center; + let h = (u = l, c = new Cesium.Cartesian3(u.x, u.y, u.z), m = Cesium.Cartographic.fromCartesian(c), d = Cesium.Math.toDegrees(m.latitude), { + lng: Cesium.Math.toDegrees(m.longitude), + lat: d, + alt: m.height + }); + var u, c, m, d; + if (h.alt = n, l = function (e) { + var t = Cesium.Cartesian3.fromDegrees(e.lng, e.lat, e.alt); + return {x: t.x, y: t.y, z: t.z} + }(h), this.entity.position = l, a) { + let e = new Image; + e.src = a.toDataURL("image/jpg"), this.entity.billboard = { + image: e, + disableDepthTestDistance: Number.POSITIVE_INFINITY, + horizontalOrigin: Cesium.HorizontalOrigin.CENTER, + verticalOrigin: Cesium.VerticalOrigin.BOTTOM, + scale: 1 + } + } + } + + show(e) { + this.entity.show = e + } + + destroy() { + this.icy.viewer.entities.remove(this.entity), this.entity = void 0 + } + } + + class L { + constructor(e) { + this.viewer = e.viewer, this.lastStageList = [] + } + + add(e, t, i, r) { + this.lastStageList.push(this.showCircleScan(e, t, i, r)) + } + + clear() { + this.lastStageList.forEach((e => { + this.clearScanEffects(e) + })), this.lastStageList = [] + } + + showCircleScan(e, t, i, r) { + const n = new Cesium.Cartographic(Cesium.Math.toRadians(e[0]), Cesium.Math.toRadians(e[1]), e[2]); + return t = new Cesium.Color.fromCssColorString(t), this._addCircleScanPostStage(n, i, t, r) + } + + _addCircleScanPostStage(e, t, i, r) { + const n = Cesium.Cartographic.toCartesian(e), s = new Cesium.Cartesian4(n.x, n.y, n.z, 1), + a = new Cesium.Cartographic(e.longitude, e.latitude, e.height + 500), + o = Cesium.Cartographic.toCartesian(a), l = new Cesium.Cartesian4(o.x, o.y, o.z, 1), + h = (new Date).getTime(), u = new Cesium.Cartesian4, c = new Cesium.Cartesian4, + m = new Cesium.Cartesian3, d = this, p = new Cesium.PostProcessStage({ + fragmentShader: d._getScanSegmentShader(), + uniforms: { + u_scanCenterEC: function () { + return Cesium.Matrix4.multiplyByVector(d.viewer.camera._viewMatrix, s, u) + }, u_scanPlaneNormalEC: function () { + const e = Cesium.Matrix4.multiplyByVector(d.viewer.camera._viewMatrix, s, u), + t = Cesium.Matrix4.multiplyByVector(d.viewer.camera._viewMatrix, l, c); + return m.x = t.x - e.x, m.y = t.y - e.y, m.z = t.z - e.z, Cesium.Cartesian3.normalize(m, m), m + }, u_radius: function () { + return t * (((new Date).getTime() - h) % r) / r + }, u_scanColor: i + } + }); + return this.viewer.scene.postProcessStages.add(p), p + } + + _getScanSegmentShader() { + return " uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n varying vec2 v_textureCoordinates;\n uniform vec4 u_scanCenterEC;\n uniform vec3 u_scanPlaneNormalEC;\n uniform float u_radius;\n uniform vec4 u_scanColor;\n vec4 toEye(in vec2 uv, in float depth){\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\n vec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0);\n posInCamera =posInCamera / posInCamera.w;\n return posInCamera;\n }\n vec3 pointProjectOnPlane(in vec3 planeNormal, in vec3 planeOrigin, in vec3 point){\n vec3 v01 = point - planeOrigin;\n float d = dot(planeNormal, v01) ;\n return (point - planeNormal * d);\n }\n float getDepth(in vec4 depth){\n float z_window = czm_unpackDepth(depth);\n z_window = czm_reverseLogDepth(z_window);\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n }\n void main(){\n gl_FragColor = texture2D(colorTexture, v_textureCoordinates);\n float depth = getDepth(texture2D(depthTexture, v_textureCoordinates));\n vec4 viewPos = toEye(v_textureCoordinates, depth);\n vec3 prjOnPlane = pointProjectOnPlane(u_scanPlaneNormalEC.xyz, u_scanCenterEC.xyz, viewPos.xyz);\n float dis = length(prjOnPlane.xyz - u_scanCenterEC.xyz);\n if(dis < u_radius){\n float f = 1.0 - abs(u_radius - dis) / u_radius;\n f = pow(f, float(18));\n gl_FragColor = mix(gl_FragColor,u_scanColor,f);\n }\n gl_FragColor.a = gl_FragColor.a / 2.0;\n }\n " + } + + clearScanEffects(e) { + this.viewer.scene.postProcessStages.remove(e) + } + } + + class k { + static { + function e() { + S.update(), requestAnimationFrame(e) + } + + e() + } + + constructor(e) { + this.icy = e, this.entity + } + + loadCanvas(e, {lon: t, lat: i, height: r, id: n, name: s}) { + let a = new Image; + a.src = e.toDataURL("image/jpg"), this.entity = this.icy.viewer.entities.add({ + name: s, + id: n, + position: Cesium.Cartesian3.fromDegrees(t, i, r), + billboard: { + image: a, + disableDepthTestDistance: Number.POSITIVE_INFINITY, + horizontalOrigin: Cesium.HorizontalOrigin.CENTER, + verticalOrigin: Cesium.VerticalOrigin.BOTTOM, + scale: 1 + } + }) + } + + uopdateImg(e) { + let t = new Image; + t.src = e.toDataURL("image/jpg"), this.entity.billboard.image = t + } + + move(e, t, i) { + this.entity.position = Cesium.Cartesian3.fromDegrees(e, t, i) + } + + animationMove(e, t, i, r) { + if (!this.entity) throw"还没有对象呢!!"; + let n = this.entity.position, s = Cesium.Cartesian3.fromDegrees(e, t, i), + a = new S.Tween({x: n._value.x, y: n._value.y, z: n._value.z}); + a.to({x: s.x, y: s.y, z: s.z}, r), a.onUpdate((({x: e, y: t, z: i}) => { + let r = new Cesium.Cartesian3(e, t, i); + this.entity.position = r + })), a.start() + } + + show(e) { + this.entity.show = e + } + + animate() { + this.entity.billboard.scale > 1.2 ? this.entity.billboard.scale = 1 : this.entity.billboard.scale += .002 + } + + destroy() { + this.icy.viewer.entities.remove(this.entity), this.entity = void 0 + } + } + + Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIzNzFlNTg1MC0wOTA0LTQzYzYtOTBjZi05MjIzZjU2NTkzZGQiLCJpZCI6MTE4ODE3LCJpYXQiOjE2NzE1MDY2NjF9.yGR3CbS6VQp2s6Y9NHWOIKq8qKL0sWLZZBZ9eP02Ags", CustomCesium = t +})(); diff --git a/src/components/map_tools/index.vue b/src/components/map_tools/index.vue new file mode 100644 index 0000000..7d9e494 --- /dev/null +++ b/src/components/map_tools/index.vue @@ -0,0 +1,79 @@ + + + + diff --git a/src/components/map_tools/loadglb.js b/src/components/map_tools/loadglb.js new file mode 100644 index 0000000..dd19449 --- /dev/null +++ b/src/components/map_tools/loadglb.js @@ -0,0 +1,167 @@ +import axios from "axios"; +import { useUserStore } from "@/pinia/user"; +import pinia from "@/pinia"; + +const userStore = useUserStore(pinia); +const pls_ip = userStore.getUserInfo.POST_URL; +const url = pls_ip.replace("8084", "9000") + "/buildr/public/models/glb/"; +export class Loadglb { + static modelMap = {}; + constructor(icy) { + this.icy = icy; + this.model_def_group = null; + this.scene = null; + this.idList = []; + this.entityList = []; + this.number = 0; + this.building_group = null; + this.groundHeight = 0.2; // 设置地面的高度 + } + + async fetchData() { + try { + const response = await axios.get( + pls_ip.replace("8084", "9000") + + "/buildr/public/models/scene_000001.json" + ); + // 将获取的数据保存到实例的属性中 + this.scene = response.data.scene; + this.model_def_group = response.data.scene.model_def_group; + + const map = new Map(); + this.model_def_group.forEach((i) => { + map.set(i.guid.split("-")[3], { name: i.name, id: i.guid }); + }); + this.scene.building_group.forEach((i) => { + i.layer_group.forEach((a) => { + a.modelName = map.get(a.guid[0].split("-")[3]); + }); + }); + this.building_group = this.scene.building_group; + // console.log(this.building_group); + } catch (error) { + // 处理可能错误 + console.error(error); + } + } + + async model(Model) { + try { + // 执行 axios 请求并等待 fetchData 函数的异步操作完成 + await this.fetchData(); + const modelList = {}; + this.scene.model_def_group.forEach((item) => { + modelList[item.guid] = item.name; + }); + const modelTotal = this.scene.building_group.length; + this.createModel(Model, modelList, modelTotal); + this.scene.ground_group.forEach((ground) => { + const lon = ground.transform.translate.x; + const lat = ground.transform.translate.y; + const scale = ground.transform.scale; + ground.model_ref_group.forEach((layer) => { + // console.log(layer,'111'); + const height = this.groundHeight; + const unit = { + lon, + lat, + scale, + id: layer.model_def_guid, + }; + this.logNum([layer], height, unit, modelList, Model); + }); + }); + } catch (error) { + // 处理可能的错误 + console.error(error); + } + } + + createModel(Model, modelList, modelTotal) { + this.scene.building_group.forEach((building, index) => { + if ( + Number(this.number * 2) <= index && + index < Number((this.number + 1) * 2) + ) { + const lon = building.transform.translate.x; + const lat = building.transform.translate.y; + const scale = building.transform.scale; + building.layer_group.forEach((layer) => { + // console.log(layer,'111'); + const height = Number(layer.height[0] + this.groundHeight); + const unit = { + lon, + lat, + scale, + id: layer.guid[0], + }; + this.logNum(layer.model_ref_group, height, unit, modelList, Model); + }); + } + }); + if (this.number * 2 < modelTotal) { + const throttle = setTimeout(() => { + this.number++; + this.createModel(Model, modelList, modelTotal); + sessionStorage.setItem("loading", (this.number * 2) / modelTotal); + clearTimeout(throttle); + }, 20); + if ( + (this.number * 2) / modelTotal >= 0.5 && + (this.number * 2) / modelTotal < 0.8 + ) { + sessionStorage.setItem("loadModel", "过半"); + } else if ((this.number * 2) / modelTotal >= 0.8) { + sessionStorage.setItem("loadModel", "临底"); + } + } else { + console.log( + "加载完成 ,此次加载:" + + modelTotal + + "栋建筑,共:" + + this.model_def_group.length + + "个模型" + ); + sessionStorage.setItem("loadModel", "完成"); + } + } + + logNum(red, height, unit, modelList, Model) { + red.forEach((item) => { + if (this.idList.indexOf(item.model_def_guid) !== -1) { + return; + } + this.idList.push(item.model_def_guid); + if ( + Object.prototype.hasOwnProperty.call( + Loadglb.modelMap, + `${unit.id.split("-")[3].slice(0, unit.id.split("-")[3].length - 2)}` + ) + ) { + Loadglb.modelMap[ + `${unit.id.split("-")[3].slice(0, unit.id.split("-")[3].length - 2)}` + ].push(item.model_def_guid); + } else { + Loadglb.modelMap[ + `${unit.id.split("-")[3].slice(0, unit.id.split("-")[3].length - 2)}` + ] = [item.model_def_guid]; + } + const m = new Model(this.icy, { + id: item.model_def_guid, + name: "建筑", + url: `${url}${modelList[item.model_def_guid]}.gltf`, + height, + lon: unit.lon, + lat: unit.lat, + scale: unit.scale, + angle: [90, 0, 0], + // angle: [97.4843053, 0, 0] + }); + this.entityList.push(m); + }); + } + + getArr() { + return this.building_group; + } +} diff --git a/src/components/map_tools/map.js b/src/components/map_tools/map.js new file mode 100644 index 0000000..2ca1a01 --- /dev/null +++ b/src/components/map_tools/map.js @@ -0,0 +1,228 @@ +import { Loadglb } from "./loadglb.js"; + +const loadMap = 3; +let $entityTransparent = []; +const clickModel = new Map(); + +let enclosure = null; +export const initMap = (corp) => { + window.$scene = new window.CustomCesium.Scene( + "map", + corp.CORP_NAME, + Number(loadMap) + ); + window.$icy = window.$scene.getIcy(); + window.$carmer = new window.CustomCesium.Carmer(window.$icy); + window.$icy.viewer.targetFrameRate = "30"; + window.$icy.viewer.scene.light = new window.Cesium.DirectionalLight({ + // 去除时间原因影响模型颜色 + direction: new window.Cesium.Cartesian3( + 0.35492591601301104, + -0.8909182691839401, + -0.2833588392420772 + ), + }); + const [wgsLat, wgsLon] = bd09ToWgs84(corp.LATITUDE, corp.LONGITUDE); + console.log(corp.LATITUDE, corp.LONGITUDE); + flyTo(wgsLon, wgsLat); + // 亮度设置 + const stages = window.$icy.viewer.scene.postProcessStages; + window.$icy.viewer.scene.brightness = + window.$icy.viewer.scene.brightness || + stages.add(window.Cesium.PostProcessStageLibrary.createBrightnessStage()); + window.$icy.viewer.scene.brightness.enabled = true; + window.$icy.viewer.scene.brightness.uniforms.brightness = Number(1.05); // 此处亮度值为倍数 + createGlb(); // 加载glb +}; + +const bd09ToWgs84 = (bdLat, bdLon) => { + const pi = Math.PI; + const x_pi = (pi * 3000.0) / 180.0; + const x = bdLon - 0.0065; + const y = bdLat - 0.006; + const z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi); + const theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi); + const wgsLon = z * Math.cos(theta); + const wgsLat = z * Math.sin(theta); + return [wgsLat, wgsLon]; +}; + +// eslint-disable-next-line no-unused-vars +const flyTo = (lng, lat) => { + window.$carmer.flyTo({ + // 视角飞入 + maxHeight: 1500, + time: 1, + position: [lng, lat, 200], + angle: [0, -60, 0], + }); +}; + +const createGlb = () => { + // 加载glb(建筑模型) + const loadGlb = new Loadglb(window.$icy); + loadGlb.model(window.CustomCesium.Model); +}; + +// eslint-disable-next-line no-unused-vars +export const handleMouseClick = (model_id) => { + // 加载鼠标拾取 + const $mouse = new window.CustomCesium.Mouse(window.$icy); + // 隐藏逻辑 + $mouse.mouseLeft((model) => { + if (model._name === "建筑") { + model_id.value = model._id; + console.log(model_id); + clickBuilding(model); + } + }); +}; + +const clickBuilding = (model) => { + if ( + Loadglb.modelMap[ + `${model._id.split("-")[3].slice(0, model._id.split("-")[3].length - 2)}` + ] + ) { + if ( + clickModel.get( + `${model._id + .split("-")[3] + .slice(0, model._id.split("-")[3].length - 2)}` + ) === undefined + ) { + // 如果这个模型是第一次点击 + const m = + Loadglb.modelMap[ + `${model._id + .split("-")[3] + .slice(0, model._id.split("-")[3].length - 2)}` + ]; // 整栋楼的id集合 + // console.log(m, '整栋楼id'); + if (m.length > 1) { + // 当前点击这建筑是否有多层 + m.forEach((id) => { + const entity = window.$icy.viewer.entities.getById(id); + if (model.id !== id) { + // 排除当前点击楼层 + if (entity._icy.height > model._icy.height) { + if ( + $entityTransparent.map((a) => a._id).indexOf(entity._id) === -1 + ) { + $entityTransparent.push(entity); + } + // console.log(this.$entityTransparent, '被隐藏的模型楼层集合'); + entity.model.show = false; + } + } else { + clickModel.set( + `${model._id + .split("-")[3] + .slice(0, model._id.split("-")[3].length - 2)}`, + model._icy.height + ); // 存储这个模型数据 + } + }); + } + } else { + // 如果点击过这个模型 + const m = + Loadglb.modelMap[ + `${model._id + .split("-")[3] + .slice(0, model._id.split("-")[3].length - 2)}` + ]; // 整栋楼的id集合 + // console.log(m, '整栋楼id'); + if (m.length > 1) { + // 当前点击这建筑是否有多层 + if ( + model._icy.height === + clickModel.get( + `${model._id + .split("-")[3] + .slice(0, model._id.split("-")[3].length - 2)}` + ) + ) { + m.forEach((id) => { + const entity = window.$icy.viewer.entities.getById(id); + entity.model.show = true; + clickModel.delete( + `${model._id + .split("-")[3] + .slice(0, model._id.split("-")[3].length - 2)}` + ); + }); + } else { + m.forEach((id) => { + const entity = window.$icy.viewer.entities.getById(id); + if (model.id !== id) { + // 排除当前点击楼层 + if (entity._icy.height > model._icy.height) { + if ( + $entityTransparent.map((a) => a._id).indexOf(entity._id) === + -1 + ) { + $entityTransparent.push(entity); + } + // console.log(this.$entityTransparent, '被隐藏的模型楼层集合'); + entity.model.show = false; + } + } else { + clickModel.set( + `${model._id + .split("-")[3] + .slice(0, model._id.split("-")[3].length - 2)}`, + model._icy.height + ); // 存储这个模型数据 + } + }); + } + } + } + // model.model.color = new Cesium.Color(1, 1, 1, 0.6); + } +}; + +// 还原建筑物 +export const reduction = () => { + // 揭盖一键还原 + if ($entityTransparent.length !== 0) { + $entityTransparent = $entityTransparent.forEach((item) => { + item.model.color = new window.Cesium.Color(1, 1, 1, 1); + item.model.show = true; + }); + $entityTransparent = []; + } +}; + +export const handleEnclosure = (positions) => { + const $mouse = new window.CustomCesium.Mouse(window.$icy); + enclosure = new window.CustomCesium.Enclosure(window.$icy); + // 编辑围栏使用鼠标控件参照demo.html + enclosure.start(); + $mouse.mouseRight((e) => { + enclosure.add(e.lng, e.lat, e.alt); + positions.push([e.lng, e.lat, e.alt]); + }); +}; + +export const clearEnclosure = () => { + if (enclosure) { + try { + enclosure.show(false); + } catch (e) {} + enclosure.clear(); + enclosure = new window.CustomCesium.Enclosure(window.$icy); + enclosure.start(); + } +}; + +export const showEnclosure = (positions) => { + enclosure.finish(); + enclosure.showDataSource( + positions, // 数据 + 30, // 高度 + "yellow" // 颜色默认黄色 + ); + enclosure.show(true); +}; diff --git a/src/request/map.js b/src/request/map.js index 5487198..42446b0 100644 --- a/src/request/map.js +++ b/src/request/map.js @@ -2,7 +2,11 @@ import { post } from "./axios"; export const getRealTimeList = (params) => post("/map/getRealTimeList", params); // 获取在线人员列表 export const getFenceList = (params) => post("/map/getFenceList", params); // 获取围栏列表 +export const getPersonnelTrajectories = (params) => + post("/map/getPersonnelTrajectories", params); // 获取拥有历史轨迹的全部角色 +export const getCharacterTrajectories = (params) => + post("/map/getCharacterTrajectories", params); // 获取轨迹 export const getUserByCardNo = (params) => post("/user/getUserByCardNo", params); diff --git a/src/request/map_settings.js b/src/request/map_settings.js index 13a8e61..7349c7a 100644 --- a/src/request/map_settings.js +++ b/src/request/map_settings.js @@ -23,6 +23,8 @@ export const setAssignmentTicketAreaSettingsDeactivateOrEnable = (params) => post("/positAlarm/otherRegion/editStatus", params); // 作业票区域设置停用启用 export const setAssignmentTicketAreaSettingsDelete = (params) => post("/positAlarm/otherRegion/regionDelete", params); // 作业票区域设置删除 +export const setPosition = (params) => + post("/positAlarm/otherRegion/redrawTheArea", params); // 区域选点 // TODO 接口不对 export const getPathPlanningList = (params) => post("/positAlarm/coordinateLine/addCoordinateLine", params); // 路径规划列表 diff --git a/src/request/positioning.js b/src/request/positioning.js index 8caaaa6..4203d6d 100644 --- a/src/request/positioning.js +++ b/src/request/positioning.js @@ -17,5 +17,4 @@ export const setUnbindingDeployCardData = (params) => export const getNotBindTheCardData = (params) => post("/deploy/card/thePersonWhoDidNotBindTheCard", params); // 批量解绑 - // 设备管理 ==== diff --git a/src/views/BI/components/bottom_options.vue b/src/views/BI/components/bottom_options.vue index 9720bf9..be191ee 100644 --- a/src/views/BI/components/bottom_options.vue +++ b/src/views/BI/components/bottom_options.vue @@ -102,17 +102,17 @@ const bottomOptionsList = [ check: false, action: handleTrajectory, }, - { - img: new URL("/src/assets/images/map/bottom/ico2.png", import.meta.url) - .href, - imgSelect: new URL( - "/src/assets/images/map/bottom/ico2_on.png", - import.meta.url - ).href, - title: "视频", - type: "video", - check: false, - }, + // { + // img: new URL("/src/assets/images/map/bottom/ico2.png", import.meta.url) + // .href, + // imgSelect: new URL( + // "/src/assets/images/map/bottom/ico2_on.png", + // import.meta.url + // ).href, + // title: "视频", + // type: "video", + // check: false, + // }, { img: new URL("/src/assets/images/map/bottom/ico3.png", import.meta.url) .href, diff --git a/src/views/BI/components/historical_trajectory_options.vue b/src/views/BI/components/historical_trajectory_options.vue index 2dc9296..cdde126 100644 --- a/src/views/BI/components/historical_trajectory_options.vue +++ b/src/views/BI/components/historical_trajectory_options.vue @@ -11,7 +11,12 @@ - + @@ -46,9 +51,6 @@
{{ data.time }} - - 当前所在图层:{{ data.position }} -
@@ -68,10 +70,21 @@