import{_ as z,r as m,aa as J,ae as Y,al as j,C as H,ad as q,e as h,o as k,c as D,F as $,K,m as x,f as L,w as B,G as X,H as Q,h as v,l as Z,p as U,z as ee,ab as V,aq as ae,ar as G,B as te}from"./index.82404a61.js";const oe={id:"map"},ne={class:"tool-causure flex flex-v"},re={class:"flex flex-r flex-justcontent-end"},le={id:"nf-address-search-input"},se={__name:"index",props:{isShowTool:{type:Boolean,default:!0},isShowSearch:{type:Boolean,default:!1},isSelectAddress:{type:Boolean,default:!1},sectionType:{type:Object,default:{}},isEdit:{type:Boolean,default:!1},bufferScope:{type:[Number,String],default:""},mapId:{type:String,default:"map"},count:{type:Number,default:0},isReloadTDT:{type:Boolean,default:!0}},emits:["endDraw","clickMap","getPlace"],setup(_,{expose:A,emit:f}){const d=_,c=m(""),g=m(""),N=m([]),y=m(""),S=m([]),I=m([]),P=J({mapConfig:{container:"map",options:{terrain:!1,baseMap:[],skyBox:NewFiberMap.Enum.SkyBox.BLUE},center:{lat:26.641768,lng:118.177708,heading:2.281299097855777,zoom:958.12942752382,pitch:-87.2508969308367,roll:.005453465256790101}},mapTools:[{key:0,name:"\u753B\u70B9",sectionType:"point"},{key:1,name:"\u753B\u7EBF",sectionType:"line"},{key:2,name:"\u753B\u9762",sectionType:"area"}],baseMap:[{id:"1",name:"\u5F71\u50CF\u56FE",url:"http://192.168.1.34:8090/iserver/services/map-arcgis-15/rest/maps/\u56FE\u5C42"},{id:"2",name:"\u6CE8\u8BB0",url:"http://192.168.1.34:8090/iserver/services/map-arcgis-3/rest/maps/\u56FE\u5C42"}]}),{mapConfig:F,mapTools:O}=Y(P);j(()=>d.sectionType,(o,n)=>{c.value=d.sectionType}),j(()=>d.inputText,(o,n)=>{g.value=d.inputText});async function R(){console.log("\u521D\u59CB\u5316");const{container:o,options:n,center:s}=F.value;window.newfiberMap=new NewFiberMap(o,n),console.log(window.newfiberMap),newfiberMap.registerMouseMove((r,t,l)=>{newfiberMap.getMap().container.style.cursor=l?"pointer":""}),newfiberMap.registerLeftClickEvt((r,t,l)=>{console.log("feature",l),d.isSelectAddress&&t.length&&(newfiberMap.removeByIds(["addressSearch"]),b(...NewFiberMap.CoordTransform.wgs84togcj02(t[0],t[1])).then(a=>{console.log(a),g.value=a.formatted_address,newfiberMap.geojsonToMap(NewFiberMap.Data.ToGeoJSON.beansWktToGeoJson([{id:"addressSearch",name:a.formatted_address,geometrys:`POINT(${t.join(" ")})`,type:NewFiberMap.Enum.VectorType.ICON,style:{url:NewFiberMapConfig.SDK_INIT_SRC_PREFIX+"/static/images/running_path/marker.png",width:50,height:50},labelOptions:{font:"13px HarmonyOS Sans SC-Bold, HarmonyOS Sans SC",color:"rgb(255,255,255,1)",pixelOffset:[0,-38],backgroundColor:"rgba(64,158,255,1)",showBackground:!0,distanceDisplayCondition:[Number.MIN_VALUE,55e3]}}])),f("getPlace",{caseAddress:a.formatted_address,lonLat:t})})),l?f("clickMap",l,t):f("clickMap",1111)}),P.baseMap.forEach(r=>{let t=newfiberMap.getMap().imageryLayers.addImageryProvider(new SuperMap3D.SuperMapImageryProvider({url:r.url}));t.alpha=1,newfiberMap.getMap().zoomTo(t)}),newfiberMap.setView(s),d.formData&&intData(d.formData),d.isEdit,new NewFiberMap.AddressLocation({id:"nf-address-search-input",callback:({item:r})=>{g.value=r.name;let t="addressSearch";newfiberMap.removeByIds([t]);let l=[r.location.lng,r.location.lat];var a=NewFiberMap.CoordTransform.gcj02towgs84(...l);b(...NewFiberMap.CoordTransform.wgs84togcj02(a[0],a[1])).then(e=>{g.value=e.formatted_address,newfiberMap.geojsonToMap(NewFiberMap.Data.ToGeoJSON.beansWktToGeoJson([{id:"addressSearch",name:e.formatted_address,geometrys:`POINT(${a.join(" ")})`,type:NewFiberMap.Enum.VectorType.ICON,style:{url:NewFiberMapConfig.SDK_INIT_SRC_PREFIX+"/static/images/running_path/marker.png",width:50,height:50},labelOptions:{font:"13px HarmonyOS Sans SC-Bold, HarmonyOS Sans SC",color:"rgb(255,255,255,1)",pixelOffset:[0,-38],backgroundColor:"rgba(64,158,255,1)",showBackground:!0,distanceDisplayCondition:[Number.MIN_VALUE,55e3]}}])),f("getPlace",{caseAddress:e.formatted_address,lonLat:a})}),newfiberMap.setCenter({heading:2.2884260179562874,zoom:460.20806868265635,lat:a[1],lng:a[0],pitch:-85.10790868439727,roll:.00837650255587307})}})}function C(o){var n=["bufferToPoint","bufferToPolyline","polygon"][G(o,"sectionType",O.value).key],s,r,t,l;f("endDraw",{areaKM:s,lengthKM:r,currentTool:c.value,geometry:t,geometryBuffer:null}),n!=y.value&&(newfiberMap.removeByIds(N.value),S.value=[],I.value=[]),window.drawUtils=new Cesium.DrawUtils(newfiberMap.getMap()),drawUtils.destroy(),y.value=["bufferToPoint","bufferToPolyline","polygon"][G(o,"sectionType",O.value).key],y.value&&window.drawUtils[y.value]({scope:d.bufferScope/1e3,option:{width:5,material:"rgba(255,0,0,1)",color:"rgba(255,0,0,1)",pixelSize:10},callback:(a="",e=[],i=[])=>{N.value.push(a);let p=e.map(u=>JSON.stringify(u)),T=i.map(u=>JSON.stringify(u));if(p.length==1&&(S.value.push(e),I.value.push(i),t=w(NewFiberMap.Enum.WKTType.MULTIPOINT,S.value),C(c.value)),p.length!=1&&p[0]!=p[p.length-1]){r=turf.length(turf.lineString(e.map(M=>[M.lng,M.lat]))).toFixed(2);let u=[b(...NewFiberMap.CoordTransform.wgs84togcj02(e[0].lng,e[0].lat)),b(...NewFiberMap.CoordTransform.wgs84togcj02(e[e.length-1].lng,e[e.length-1].lat))];Promise.all(u).then(M=>{f("getPlace",M)}),t=w(NewFiberMap.Enum.WKTType.LINESTRING,e)}T.length>1&&T[0]==T[T.length-1]&&(s=turf.length(turf.lineString(i.map(u=>[u.lng,u.lat])))),p.length!=1&&p[0]==p[p.length-1]&&(s=turf.length(turf.polygon([e.map(u=>[u.lng,u.lat])])),t=w(NewFiberMap.Enum.WKTType.POLYGON,e)),i.length?l=o=="point"?w(NewFiberMap.Enum.WKTType.MULTIPOLYGON,I.value):w(NewFiberMap.Enum.WKTType.POLYGON,i):l=null,f("endDraw",{areaKM:s,lengthKM:r,currentTool:c.value,geometry:t,geometryBuffer:l})}})}const b=async(o,n)=>{let s=await te({url:"/amap/v3/geocode/regeo",method:"GET",params:{location:`${o},${n}`,key:"76eac14980622704ba95c1bf080f3b4c",radius:1e3,extensions:"all",output:"json"}});if(s.info==="OK")return s.regeocode};function w(o,n){let{POINT:s,LINESTRING:r,POLYGON:t,MULTIPOINT:l,MULTIPOLYGON:a}=NewFiberMap.Enum.WKTType;var e;return o=="MULTIPOINT"?e=n.map(i=>`(${[i[0].lng,i[0].lat].join(" ")})`).join(","):o=="MULTIPOLYGON"?e=n.map(i=>`((${i.map(p=>[p.lng,p.lat].join(" ")).join(",")}))`).join(","):e=n.map(i=>[i.lng,i.lat].join(" ")).join(","),{[s]:`${s}(${e})`,[r]:`${r}(${e})`,[t]:`${t}((${e}))`,[l]:`${l}(${e})`,[a]:`${a}(${e})`}[o]}function E(){let o=[...N.value,"point","line","area","geometryBuffer"];newfiberMap.removeByIds(o),C(c.value),f("endDraw",{areaKM:"",lengthKM:"",currentTool:c.value,geometry:"",geometryBuffer:""})}function W(){const{center:o}=F.value;newfiberMap.setView(o)}return H(()=>{q(()=>{R()})}),A({clear:E,orientationCenter:W}),(o,n)=>{const s=h("el-radio"),r=h("el-radio-group"),t=h("el-button"),l=h("el-input");return k(),D("div",oe,[$(x("div",ne,[L(r,{modelValue:v(c),"onUpdate:modelValue":n[0]||(n[0]=a=>V(c)?c.value=a:null),onChange:C},{default:B(()=>[(k(!0),D(X,null,Q(v(O),a=>(k(),Z(s,{label:a.sectionType,key:a.sectionType},{default:B(()=>[U(ee(a.name),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"]),x("div",re,[L(t,{size:"small",round:"",onClick:E},{default:B(()=>[U("\u6E05\u9664")]),_:1})])],512),[[K,_.isShowTool]]),$(x("div",le,[L(l,{id:"pickerInput",placeholder:"\u8BF7\u8F93\u5165",modelValue:v(g),"onUpdate:modelValue":n[1]||(n[1]=a=>V(g)?g.value=a:null),"prefix-icon":v(ae)},null,8,["modelValue","prefix-icon"])],512),[[K,_.isShowSearch]])])}}},pe=z(se,[["__scopeId","data-v-fb6202e5"]]);export{pe as m};