2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
import{_ as ge,r as p,B as ve,C as _e,D as ye,F as O,d as U,o as h,c as C,l as o,e as L,w as W,f as g,g as T,x as k,G as he,H as Ce,y as be,p as we,q as xe}from"./index.75ecb6e9.js";import{_ as A}from"./close1.45635d81.js";import{i as Me,g as De,a as Se,b as Ie,_ as Le,c as Te,d as ke,e as Pe,f as Fe,h as Xe}from"./linesGL.c51488ff.js";import"./index.7fec779c.js";const N=P=>(we("data-v-21cafe5e"),P=P(),xe(),P),Ze={class:"center"},Ee=N(()=>o("div",{style:{width:"100%",height:"100%"},id:"cesiumContainer"},null,-1)),We={class:"leftWra"},Ae={class:"leftTop"},Ne=N(()=>o("div",{class:"title"},[o("span",null,"\u6444\u50CF\u5934\u9009\u62E9")],-1)),Re={class:"search"},ze={key:0,src:A,alt:""},Be={key:0,class:"imgrotate",src:A,alt:""},Oe={class:"rightWra"},Qe=N(()=>o("div",{class:"rightTop"},[o("div",{class:"title"},[o("span",null,"\u89C6\u9891\u76D1\u63A7")])],-1)),qe={key:0,src:A,alt:""},Ge={key:0,class:"imgrotate",src:A,alt:""},Je=be('<div class="tool" data-v-21cafe5e><span data-v-21cafe5e><img src="'+Le+'" alt="" data-v-21cafe5e></span><span data-v-21cafe5e><img src="'+Te+'" alt="" data-v-21cafe5e></span><span data-v-21cafe5e><img src="'+ke+'" alt="" data-v-21cafe5e></span><span data-v-21cafe5e><img src="'+Pe+'" alt="" data-v-21cafe5e></span><span data-v-21cafe5e><img src="'+Fe+'" alt="" data-v-21cafe5e></span><span data-v-21cafe5e><img src="'+Xe+'" alt="" data-v-21cafe5e></span></div>',1),Ve={id:"popup"},Ue={id:"pop"},Ye={key:0},je=N(()=>o("div",null,"\u6751\u540D\uFF1A",-1)),He={__name:"index",setup(P){let i=p(null);p(null),p(null);const Y=p("370211");p(null);let M=ve({arr:[],brr:[],crr:[]});const Q=p({name:"",value:""}),j=p([]),H=p(!1);let b=p(!0),w=p(!0);_e(()=>M.arr,e=>{console.log("val:",e)});var q={title:[]};let R={\u5C0F\u9EA6:[],\u7389\u7C73:[],\u5927\u8C46:[],\u5730\u74DC:[],\u82B1\u751F:[],\u84DD\u8393:[],\u8336\u53F6:[],\u9A6C\u94C3\u85AF:[],\u767D\u83DC\u548C\u841D\u535C:[],\u5176\u4ED6:[]};ye(()=>{ne(),ue(),le(),ce(),K(),te()});const $={url:"http://{s}.tianditu.gov.cn/img_c/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=c&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=31091965e263284a501a723b8909f405",layer:"tdtCva",style:"default",format:"tiles",tileMatrixSetID:"c",subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"],tilingScheme:new Cesium.GeographicTilingScheme,tileMatrixLabels:["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],maximumLevel:18};Cesium.Ion.defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiYzcwZmJmNi02MzQ5LTQ1MGEtODgzMy0yZTZiZGExY2MzMGMiLCJpZCI6MTAxOTgsInNjb3BlcyI6WyJhc2wiLCJhc3IiLCJnYyJdLCJpYXQiOjE1ODEzMDgxNTR9.NeJU4yfUi-SnLrNDOBYsQgmiSh3B4axCTi1m84Qw99c";function K(){i=new Cesium.Viewer("cesiumContainer",{baseLayerPicker:!1,shouldAnimate:!0,infoBox:!1,animation:!1,timeline:!1,geocoder:!1,homeButton:!1,navigationHelpButton:!1,selectionIndicator:!1,fullscreenButton:!1,terrainProvider:new Cesium.EllipsoidTerrainProvider({}),sceneModePicker:!1,contextOptions:{webgl:{alpha:!0}},imageryProvider:new Cesium.WebMapTileServiceImageryProvider({...$})}),i.cesiumWidget.creditContainer.style.display="none",de("shuzisannong:huangdaoqu_town","tl"),i.camera.flyTo({destination:Cesium.Rectangle.fromDegrees(119.5091,35.5671,120.3285,36.1455),duration:0}),ae(),fe()}function G(e,t,r){e.forEach(a=>{let s=[];a[0].forEach(l=>{s.push(l[0]),s.push(l[1])}),i.entities.add({name:t,polyline:{positions:Cesium.Cartesian3.fromDegreesArray(s),width:6,material:new Cesium.PolylineGlowMaterialProperty({glowPower:.2,color:r?Cesium.Color.fromCssColorString(r):Cesium.Color.fromBytes(250,128,114)}),clampToGround:!0}})})}function ee(e){return e>48e6?0:e>24e6?1:e>12e6?2:e>6e6?3:e>3e6?4:e>15e5?5:e>75e4?6:e>375e3?7:e>187500?8:e>93750?9:e>46875?10:e>23437.5?11:e>11718.75?12:e>5859.38?13:e>2929.69?14:e>1464.84?15:e>732.42?16:e>366.21?17:18}function te(){O({url:serverAPI.geoserverUrl+"/shuzisannong/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shuzisannong%3Afarmland&maxFeatures=50&outputFormat=application%2Fjson",method:"get"}).then(e=>{console.log("\u519C\u7530\uFF1A",e),j.value=e.data.features}).catch(e=>{})}let f=p({label:[]}),F="";function ae(){var e=new Cesium.ScreenSpaceEventHandler(i.canvas);e.setInputAction(function(t){var r=i.camera.getPickRay(t.position),a=i.scene.globe.pick(r,i.scene);if(a){let s=Cesium.Cartographic.fromCartesian(a);if(s){let l=new Cesium.Cartesian2,d=i.camera.positionCartographic.height,u=ee(d);const m=i.imageryLayers._layers,_=m.findIndex(n=>n._imageryProvider._layers&&n._imageryProvider._layers==="shuzisannong:huangdaoqu_town");if(_>-1){const n=m[_];let c=n._imageryProvider;if(c&&c.ready&&c._layers&&n.show===!0){l=c.tilingScheme.positionToTileXY(s,u,l);let S=c.pickFeatures(l.x,l.y,u,s.longitude,s.latitude);S&&S.then(I=>{if(I.length>0){let v=I[0];if(v.properties&&v.properties.XZDM)if(console.log("XZDM:",F),console.log("newData.properties.XZDM:",v.properties.XZDM),F!==v.properties.XZDM){H.value=!0,F=v.properties.XZDM,Y.value=F;let y=v.data;i.camera.flyTo({destination:Cesium.Rectangle.fromDegrees(y.bbox[0],y.bbox[1],y.bbox[2],y.bbox[3]),duration:2}),D("townLine"),G(y.geometry&&y.geometry.coordinates,"townLine","yellow"),Z(["village_CQL"]),se(`XZDM=${v.properties.XZDM}`,"village_CQL");let E=i.entities._entities._array;for(var x=E.length-1;x>=0;x--)if(E[x]._name&&E[x]._name==="point"+v.properties.XZDM){let me=E[x]._info;f.value=me,console.log(f.value,"------------------"),V(t.position),i.scene.postRender.addEventListener(z)}D("villageLine"),X=""}else re(m,l,u,s,t);else Z(["village_CQL"]),B()}})}}}}},Cesium.ScreenSpaceEventType.LEFT_CLICK)}let X="";function re(e,t,r,a,s){const l=e.findIndex(d=>d._imageryProvider._layers&&d._imageryProvider._layers==="shuzisannong:huangdaoqu_village");if(l>-1){const d=e[l];let u=d._imageryProvider;if(u&&u.ready&&u._layers&&d.show===!0){t=u.tilingScheme.positionToTileXY(a,r,t);let m=u.pickFeatures(t.x,t.y,r,a.longitude,a.latitude);m&&m.then(_=>{if(_.length>0){let n=_[0];if(console.log(n),i.camera.flyTo({destination:Cesium.Rectangle.fromDegrees(n.data.bbox[0],n.data.bbox[1],n.data.bbox[2],n.data.bbox[3]),duration:2}),n.properties&&n.properties.XZQDM&&X!==n.properties.XZQDM){X=n.properties.XZQDM;let c=n.data;if(D("villageLine"),G(c.geometry&&c.geometry.coordinates,"villageLine","yellow"),n.properties.XZQDM==="370211104217"){const S=Cesium.Rectangle.fromDegrees(c.bbox[0],c.bbox[1],c.bbox[2],c.bbox[3]),I=Cesium.Rectangle.center(S);let x=Cesium.Math.toDegrees(I.longitude),v=Cesium.Math.toDegrees(I.latitude),y={lon:x,lat:v,...c.properties,label:[{crop:"\u8336\u53F6",Shape_Area:2820},{crop:"\u5927\u8C46",Shape_Area:2767},{crop:"\u82B1\u751F",Shape_Area:62356},{crop:"\u84DD\u8393",Shape_Area:5443},{crop:"\u5730\u74DC",Shape_Area:897},{crop:"\u5C0F\u9EA6",Shape_Area:20111}]};f.value=y,V(s.position),i.scene.postRender.addEventListener(z)}}}})}}}function se(e,t){let r=new Cesium.WebMapServiceImageryProvider({url:"http://121.36.229.60:9080/geoserver/shuzisannong/wms",layers:"shuzisannong:huangdaoqu_village",parameters:{service:"WMS",format:"image/png",transparent:!0,CQL_FILTER:e}});r.customName=t,i.imageryLayers.addImageryProvider(r)}function Z(e,t){if(i){const r=i.imageryLayers._layers;for(let a=r.length-1;a>=0;a--)e.forEach(s=>{r[a]._imageryProvider&&r[a]._imageryProvider.customName&&(t?r[a]._imageryProvider.customName.indexOf(s)>-1&&i.imageryLayers.remove(r[a]):r[a]._imageryProvider.customName===s&&i.imageryLayers.remove(r[a]))})}}function D(e){if(i){let r=i.entities._entities._array;for(var t=r.length-1;t>=0;t--)r[t]._name&&r[t]._name===e&&i.entities.remove(r[t])}}function ie(){if(b.value=!b.value,b.value){let e=document.querySelector(".leftWra");e&&(e.style.transform="translate(0,0)")}else{let e=document.querySelector(".leftWra");e&&(e.style.transform="translate(-107%,0)")}}function oe(){if(w.value=!w.value,w.value){let e=document.querySelector(".rightWra");e.style.transform="translate(0,0)"}else{let e=document.querySelector(".rightWra");e.style.transform="translate(107%,0)"}}const ne=()=>{Me({time:"2023-04-25",subregion:"1",parent:"\u9EC4\u5C9B\u533A"}).then(e=>{console.log(e)})},le=()=>{De().then(e=>{M.arr=e.features,M.arr.unshift({bbox:[119.5091,35.5671,120.3285,36.1455],properties:{XZDM:"370211",XZMC:"\u5168\u90E8"}});let t=[...e.features],r=[];t.splice(0,1),t.forEach(a=>{r.push(a.properties.XZMC)}),q.title=[...Object.values(r)]})},ce=()=>{Se().then(e=>{M.brr=e.features})},ue=()=>{Ie().then(e=>{M.crr=e.features,q.title.forEach((t,r)=>{let a=e.features.map(s=>{if(t===s.properties.town)return s.properties});Object.keys(R).forEach(s=>{const l=a.findIndex(d=>d&&d.crop===s);l>-1?R[s].push(a[l].Shape_Area):R[s].push(null)})})})};function de(e,t){let r=new Cesium.WebMapServiceImageryProvider({url:serverAPI.geoserverUrl+"/shuzisannong/wms?",layers:e,parameters:{service:"WMS",format:"image/png",transparent:!0}});r.customName=t;let a=i.imageryLayers.addImageryProvider(r);t.indexOf("gbznt")>-1&&(i.imageryLayers.lowerToBottom(a),i.imageryLayers.raise(a))}function pe(){let e=J.value;console.log("fl:",e),O({url:serverAPI.geoserverUrl+"/shuzisannong/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shuzisannong%3Ahuangdaoqu_town&maxFeatures=50&outputFormat=application%2Fjson"}).then(t=>{console.log("res1111:",t),t.data.features.forEach((a,s)=>{const l=Cesium.Rectangle.fromDegrees(a.bbox[0],a.bbox[1],a.bbox[2],a.bbox[3]),d=Cesium.Rectangle.center(l);let u=Cesium.Math.toDegrees(d.longitude),m=Cesium.Math.toDegrees(d.latitude);a.properties.XZDM==="370211011"?(u=120.0863,m=35.941):a.properties.XZDM==="370211003"&&(u=120.243682,m=35.97123201);const _=e[a.properties.XZMC];let n=[];_&&(n=_.map((c,S)=>c.properties)),i.entities.add({name:"point"+a.properties.XZDM,position:Cesium.Cartesian3.fromDegrees(u,m),point:new Cesium.PointGraphics({show:!0,pixelSize:10,color:Cesium.Color.fromCssColorString("rgba(255, 255, 26, 1)"),outlineColor:new Cesium.Color(0,0,0,0),outlineWidth:0,disableDepthTestDistance:Number.POSITIVE_INFINITY,heightReference:Cesium.HeightReference.CLAMP_TO_GROUND}),info:{label:n,...a.properties,lon:u,lat:m}})})}).catch(t=>{})}let J=p({});function fe(){O({url:serverAPI.geoserverUrl+"/shuzisannong/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shuzisannong%3Afenlei&maxFeatures=137&outputFormat=application%2Fjson"}).then(e=>{let t=e.data.features,r={};t.forEach(a=>{let s=a.properties.town;r[s]?r[s].push(a):r[s]=[a]}),J.value=r,pe()}).catch(e=>{})}function z(){if(f.value&&f.value.lon&&f.value.lat){const t=Cesium.Cartesian3.fromDegrees(Number(f.value.lon),Number(f.value.lat),0);var e=Cesium.SceneTransforms.wgs84ToWindowCoordinates(i.scene,t);if(Cesium.defined(e)){const r=document.getElementById("pop");r.style.top=e.y-10+"px",r.style.left=e.x+10+"px"}}}function B(){X="",Z(["village_CQL"]),D("villageLine"),D("townLine");const e=document.getElementById("pop");e.style.display="none",i.scene.postRender.removeEventListener(z),Z(["gbznt"],!0)}function V(e){console.log(e);const t=document.getElementById("pop");t.style.display="block",t.style.position="absolute",t.style.top=e.y-10+"px",t.style.left=e.x+10+"px",t.style.zIndex=99}return(e,t)=>{const r=U("el-input"),a=U("el-tooltip");return h(),C("div",Ze,[Ee,o("div",We,[o("div",Ae,[Ne,o("div",Re,[L(r,{class:"seach_input",modelValue:e.input,"onUpdate:modelValue":t[0]||(t[0]=s=>e.input=s),placeholder:"\u8BF7\u8F93\u5165\u8981\u7B5B\u9009\u6444\u50CF\u5934\u540D",clearable:""},null,8,["modelValue"])])]),o("div",{class:"leftFoldDiv",onClick:t[1]||(t[1]=s=>ie())},[L(a,{class:"box-item","show-arrow":!1,disabled:g(b),"hide-after":"0","show-after":"200",effect:"dark",content:"\u5C55\u5F00",placement:"top"},{default:W(()=>[g(b)?T("v-if",!0):(h(),C("img",ze))]),_:1},8,["disabled"]),L(a,{disabled:!g(b),"show-arrow":!1,class:"box-item","show-after":"200","hide-after":"0",effect:"dark",content:"\u6536\u8D77",placement:"top"},{default:W(()=>[g(b)?(h(),C("img",Be)):T("v-if",!0)]),_:1},8,["disabled"])])]),o("div",Oe,[Qe,o("div",{class:"rightFoldDiv",onClick:t[2]||(t[2]=s=>oe())},[L(a,{disabled:!g(w),"show-arrow":!1,"hide-after":"0","show-after":"200",class:"box-item",effect:"dark",content:"\u6536\u8D77",placement:"top"},{default:W(()=>[g(w)?(h(),C("img",qe)):T("v-if",!0)]),_:1},8,["disabled"]),L(a,{disabled:g(w),"show-arrow":!1,"hide-after":"0","show-after":"200",class:"box-item",effect:"dark",content:"\u5C55\u5F00",placement:"top"},{default:W(()=>[g(w)?T("v-if",!0):(h(),C("img",Ge))]),_:1},8,["disabled"])])]),Je,o("div",Ve,[o("div",null,k(Q.value.name)+"\uFF1A",1),o("div",null,k(Q.value.value)+"\u4EA9",1),o("div",{class:"cancel",onClick:B},"X")]),o("div",Ue,[(h(!0),C(he,null,Ce(g(f).label,(s,l)=>(h(),C("div",{key:l},[o("div",null,k(s.crop)+"\uFF1A",1),o("div",null,k((s.Shape_Area/666.67).toFixed(2))+" \u4EA9",1)]))),128)),g(f).XZQMC?(h(),C("div",Ye,[je,o("div",null,k(g(f).XZQMC),1)])):T("v-if",!0),o("div",{class:"cancel",onClick:B},"X")])])}}},at=ge(He,[["__scopeId","data-v-21cafe5e"],["__file","/Users/luce/Desktop/\u6570\u5B57\u4E09\u519C/Agriculture-front-end/src/views/plough/VideoSurveillance/index.vue"]]);export{at as default};
|