chunk-7f661caa.3c0793c5.js 10 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-7f661caa"],{"0584":function(t,a,i){t.exports=i.p+"img/weijiaqiao.0d0a2e7a.jpg"},"0c25":function(t,a,i){t.exports=i.p+"img/luzhou.2588de15.jpg"},3433:function(t,a,i){"use strict";i.r(a);var e=function(){var t=this,a=t._self._c;return a("div",{ref:"canvasBox",style:{width:"100%",height:"100%",overflow:"hidden",position:"relative"}},[a("canvas",{ref:"mapCanvas",style:{width:"100%",height:"100%"}})])},n=[],h=i("40e1");function o(t,a){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);a&&(e=e.filter((function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable}))),i.push.apply(i,e)}return i}function l(t){for(var a=1;a<arguments.length;a++){var i=null!=arguments[a]?arguments[a]:{};a%2?o(Object(i),!0).forEach((function(a){r(t,a,i[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):o(Object(i)).forEach((function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(i,a))}))}return t}function r(t,a,i){return a in t?Object.defineProperty(t,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[a]=i,t}var s={props:{leader:Boolean},data:function(){return{offsetVal:50,width:0,height:0,ctx:null,lonlatScale:{},imageData:{},origin:{},canvasImg:"",leaderCanvasData:[],pilotCanvasData:[],scale:1,lineCanvas:{width:0,height:0}}},mounted:function(){var t=this;this.mapCanvas=this.$refs.mapCanvas,window.addEventListener("resize",(function(){t.resize()}),!1),this.resize()},methods:{resize:function(){var t=this.$refs.canvasBox,a=this.$refs.mapCanvas,i=this;this.$nextTick((function(){var e=t.clientWidth,n=t.clientHeight;a.width=e,a.height=n,i.width=e,i.height=n,i.render()}))},render:function(){if(this.cacheCanvas){var t=this.mapCanvas.getContext("2d");t.fillStyle="#1d4148",t.fillRect(0,0,this.width,this.height);var a=l({},this.wrapbox),i=this.imageData.width,e=this.imageData.height;d(150);var n=(a.maxY-a.minY)/(a.maxX-a.minX),h=this.height/this.width;if(h>n){var o=h*a.width,r=(o-a.height)/2,s=a.minY-r;s<0&&(s=0);a.maxY;t.drawImage(this.cacheCanvas,a.minX,s,a.width,o,0,0,this.width,this.height)}else{var g=a.height/h,m=(g-a.width)/2,c=a.minX-m;t.drawImage(this.cacheCanvas,c,a.minY,g,a.height,0,0,this.width,this.height)}}function d(t){if(!(a.width>t||a.height>t)){var n=a.height/a.width,h=a.width,o=a.height;if(n>1){var l=t/a.height;h=l*a.width,o=t}else{var r=t/a.width;h=t,o=r*a.height}var s=(h-a.width)/2;a.minX-=s;var g=!1;a.minX<0&&(a.minX=0,a.maxX=h,g=!0),g||(a.maxX+=s,a.maxX>i&&(a.maxX=i,a.minX=a.maxX-h));var m=(o-a.height)/2;a.minY-=m,g=!1,a.minY<0&&(a.minY=0,a.maxY=o,g=!0),g||(a.maxY+=m,a.maxY>e&&(a.maxY=e,a.minY=a.maxY-o)),a.width=h,a.height=o}}},renderToCache:function(t){this.cacheCanvas||(this.cacheCanvas=document.createElement("canvas"));var a=this.cacheCanvas,i=this.imageData.width,e=this.imageData.height;a.width=i,a.height=e;var n=a.getContext("2d");n.fillStyle="green",n.fillRect(0,0,i,e),this.canvasImg&&n.drawImage(this.canvasImg,0,0,i,e);var h={minX:i,maxX:0,minY:e,maxY:0};if(0==this.mapLeaderData.length&&0==this.mapPilotData.length&&!this.leader||this.leader&&0==this.mapLeaderData.length)return h.minX=h.minY=0,h.maxX=h.minX+i,h.maxY=h.minY+e,h.width=i,h.height=e,void(this.wrapbox=h);var o=this;function l(t,a){n.lineWidth=2,n.beginPath(),n.strokeStyle=a,t.map((function(t,a){var l=!0;t.forEach((function(t,a){var r=o.longtitude2px(t.longtitude),s=o.latitude2px(t.latitude);r<0||r>i||s<0||s>e||(r<h.minX&&(h.minX=r),r>h.maxX&&(h.maxX=r),s<h.minY&&(h.minY=s),s>h.maxY&&(h.maxY=s),l?(n.moveTo(r,s),l=!1):n.lineTo(r,s))})),n.stroke()}))}l(this.mapLeaderData,"#2cfefe"),l(this.mapPilotData,"#3aa1fc"),h.width=h.maxX-h.minX,h.height=h.maxY-h.minY,h.width<4&&h.height<4&&(h.minX=h.minY=0,h.maxX=h.minX+i,h.maxY=h.minY+e,h.width=i,h.height=e),this.wrapbox=h},updateLeader:function(t,a){var i=this;this.mapID=t,this.mapLeaderData=a||[],this.mapPilotData=[];var e=h["a"].filter((function(t){return t.id==i.mapID}));if(this.imageData=e[0],this.imageData){this.initlonlatScale();var n=new Image,o=this;n.onload=function(){o.renderToCache(!0),o.render()},n.src=this.imageData.url,this.canvasImg=n}else alert("找不到场景ID:".concat(this.mapID,"的配置"))},update:function(t,a,i){var e=this;this.mapID=t,this.mapLeaderData=a||[],this.mapPilotData=i||[];var n=h["a"].filter((function(t){return t.id==e.mapID}));if(this.imageData=n[0],this.imageData){this.initlonlatScale();var o=new Image,l=this;o.onload=function(){l.renderToCache(),l.render()},o.src=this.imageData.url,this.canvasImg=o,this.renderToCache()}else alert("找不到场景ID:".concat(this.mapID,"的配置"))},initlonlatScale:function(){var t=this.imageData,a=t.rightTop.lon-t.leftBottom.lon,i=t.rightTop.lat-t.leftBottom.lat;a=t.width/a,i=t.height/i,this.lonlatScale={wScale:a,hScale:i}},formatAllData:function(){var t=this,a=this.origin,i=this.scale,e=this.mapLeaderData,n=this.mapPilotData;e.length>0&&e.map((function(e,n){e.forEach((function(e){var n=t.lonlatToPX(e.longtitude,"lon"),h=t.lonlatToPX(e.latitude,"lat");n=Math.abs(n-a.x)*i.scaleX,h=Math.abs(h-a.y)*i.scaleY,e.x=n,e.y=h}))})),this.leaderCanvasData=e,n.length>0&&(n.map((function(e,n){e.forEach((function(e){var n=t.lonlatToPX(e.longtitude,"lon"),h=t.lonlatToPX(e.latitude,"lat");n=Math.abs(n-a.x)*i.scaleX,h=Math.abs(h-a.y)*i.scaleY,e.x=n,e.y=h}))})),this.pilotCanvasData=n),this.drawLineCanvas()},drawLineCanvas:function(){var t=this.$refs.mapCanvas;t.width=this.width,t.height=this.height,t=t.getContext("2d");var a=this.leaderCanvasData,i=this.pilotCanvasData;0==a.length&&0==i.length?t.drawImage(this.canvasImg,0,0,this.imageData.width,this.imageData.height,0,0,this.width,this.height):t.drawImage(this.canvasImg,this.origin.x,this.origin.y,this.lineCanvas.width,this.lineCanvas.height,0,0,this.width,this.height),t.lineWidth=2,a.length>0&&(t.beginPath(),t.strokeStyle="#2cfefe",a.map((function(a,i){a.map((function(a,i){0==i?t.moveTo(a.x,a.y):t.lineTo(a.x,a.y)}))})),t.stroke()),i.length>0&&(t.beginPath(),t.strokeStyle="#3aa1fc",i.map((function(a,i){a.map((function(a,i){0==i?t.moveTo(a.x,a.y):t.lineTo(a.x,a.y)}))})),t.stroke())},getSortArrData:function(t){var a=-180,i=-180,e=180,n=180;return t.forEach((function(t){t.forEach((function(t){t.longtitude>a&&(a=t.longtitude),t.latitude>i&&(i=t.latitude),t.longtitude<e&&(e=t.longtitude),t.latitude<n&&(n=t.latitude)}))})),{max_lon:a,max_lat:i,min_lon:e,min_lat:n}},longtitude2px:function(t){var a=t-this.imageData.leftBottom.lon;return a*this.lonlatScale.wScale},latitude2px:function(t){var a=this.imageData.rightTop.lat-t;return a*this.lonlatScale.hScale},lonlatToPX:function(t,a){var i={lon:this.imageData.leftBottom.lon,lat:this.imageData.rightTop.lat},e=this.lonlatScale,n=t;return n="lon"==a?(n-i.lon)*e.wScale:(i.lat-n)*e.hScale,n}}},g=s,m=i("2877"),c=Object(m["a"])(g,e,n,!1,null,null,null);a["default"]=c.exports},"40e1":function(t,a,i){"use strict";a["a"]=[{id:0,name:"zhoushan",url:i("80d3"),width:3278,height:2666,leftBottom:{lon:121.7508326,lat:29.58309174},rightTop:{lon:122.87624359,lat:30.49873352}},{id:1,name:"kashi",url:i("dbfa"),width:3638,height:2672,leftBottom:{lon:74.5010376,lat:38.49746704},rightTop:{lon:76.99905396,lat:40.33218384}},{id:2,name:"hongyuan",url:i("6641"),width:3638,height:2664,leftBottom:{lon:101.00143433,lat:31.49780273},rightTop:{lon:103.50082397,lat:33.32977295}},{id:3,name:"taigu",url:i("9e02"),width:3640,height:2666,leftBottom:{lon:111.5020752,lat:36.5020752},rightTop:{lon:114.00032043,lat:38.33267212}},{id:4,name:"boao",url:i("5918"),width:4366,height:3156,leftBottom:{lon:108.50097656,lat:17.99697876},rightTop:{lon:111.49887085,lat:20.164031988}},{id:5,name:"changdu",url:i("e25c"),width:3638,height:2670,leftBottom:{lon:95.74996948,lat:29.66445923},rightTop:{lon:98.25210571,lat:31.49780273}},{id:6,name:"shandong",url:i("9f33"),width:4368,height:2908,leftBottom:{lon:114.75219727,lat:35.33203125},rightTop:{lon:117.75146484,lat:37.33154297}},{id:7,name:"xiangyin",url:i("618c"),width:3636,height:2908,leftBottom:{lon:111.50024414,lat:27.66909738},rightTop:{lon:114.00238237,lat:29.66308594}},{id:8,name:"zhongjiang",url:i("9c74"),width:3640,height:3156,leftBottom:{lon:103.50219727,lat:29.83062744},rightTop:{lon:106.0043335,lat:31.99768066}},{id:9,name:"tonghua",url:i("6137"),width:3640,height:2908,leftBottom:{lon:124.50256348,lat:41.00097156},rightTop:{lon:127.00195312,lat:42.9977417}},{id:10,name:"luzhou",url:i("0c25"),width:3640,height:2664,leftBottom:{lon:104.24926758,lat:28.00140381},rightTop:{lon:106.74865723,lat:29.83062744}},{id:11,name:"linfen",url:i("a5b7"),width:4008,height:3144,leftBottom:{lon:110.24780273,lat:35.00518799},rightTop:{lon:112.99987793,lat:37.16125488}},{id:12,name:"yuncheng",url:i("98d3f"),width:3640,height:2912,leftBottom:{lon:109.99786377,lat:33.99719238},rightTop:{lon:112.5,lat:36.00219727}},{id:13,name:"shuimogou",url:i("f109"),width:4008,height:2908,leftBottom:{lon:86.25091553,lat:42.84118652},rightTop:{lon:89.00024414,lat:44.83520508}},{id:14,name:"weijiaqiao",url:i("0584"),width:3996,height:2908,leftBottom:{lon:105.00457764,lat:37.33703613},rightTop:{lon:107.74841309,lat:39.32556152}},{id:15,name:"beijing",url:i("560a"),width:4004,height:2912,leftBottom:{lon:115.25482178,lat:39.00146484},rightTop:{lon:117.99591064,lat:40.99822998}},{id:16,name:"puer",url:i("4dcc"),width:3272,height:2672,leftBottom:{lon:99.75036621,lat:21.83532715},rightTop:{lon:101.99707031,lat:23.66729736}}]},"4dcc":function(t,a,i){t.exports=i.p+"img/puer.5d1ad707.jpg"},"560a":function(t,a,i){t.exports=i.p+"img/beijing.588b8c74.jpg"},5918:function(t,a,i){t.exports=i.p+"img/boao.c3824ba8.jpg"},6137:function(t,a,i){t.exports=i.p+"img/tonghua.a24b08ad.jpg"},"618c":function(t,a,i){t.exports=i.p+"img/xiangyin.96864562.jpg"},6641:function(t,a,i){t.exports=i.p+"img/hongyuan.1c23c31a.jpg"},"80d3":function(t,a,i){t.exports=i.p+"img/zhoushan.8380e1d6.jpg"},"98d3f":function(t,a,i){t.exports=i.p+"img/yuncheng.69acd0b7.jpg"},"9c74":function(t,a,i){t.exports=i.p+"img/zhongjiang.d46cca4b.jpg"},"9e02":function(t,a,i){t.exports=i.p+"img/taigu.8b1937d7.jpg"},"9f33":function(t,a,i){t.exports=i.p+"img/shandong.d5b69a41.jpg"},a5b7:function(t,a,i){t.exports=i.p+"img/linfen.4a7a7a9b.jpg"},dbfa:function(t,a,i){t.exports=i.p+"img/kashi.15945cbe.jpg"},e25c:function(t,a,i){t.exports=i.p+"img/changdu.f0afedc7.jpg"},f109:function(t,a,i){t.exports=i.p+"img/shuimogou.e7e9d253.jpg"}}]);