qy-vue-plugins 1.0.2-beta → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apply-element-plus-theme.cjs +1 -0
- package/dist/apply-element-plus-theme.mjs +22 -0
- package/dist/beijihua-map-icon/hiper-map-icon-1.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-10.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-11.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-12.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-13.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-14.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-15.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-16.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-17.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-18.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-19.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-2.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-20.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-21.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-22.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-23.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-24.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-25.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-26.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-27.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-28.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-29.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-3.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-30.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-31.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-32.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-33.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-34.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-35.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-36.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-37.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-38.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-39.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-4.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-40.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-41.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-42.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-43.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-44.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-45.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-46.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-47.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-48.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-49.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-5.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-50.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-51.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-52.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-53.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-54.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-55.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-56.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-57.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-58.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-59.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-6.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-60.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-61.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-62.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-63.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-64.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-65.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-7.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-8.png +0 -0
- package/dist/beijihua-map-icon/hiper-map-icon-9.png +0 -0
- package/dist/chunks/{EventKeys-1aL9cgT0.js → EventKeys-DZ_Hahro.js} +4 -4
- package/dist/chunks/{MapTools.vue_vue_type_style_index_0_lang-C3__NQXN.js → MapTools.vue_vue_type_style_index_0_lang-C0C9opKY.js} +1 -1
- package/dist/chunks/{MapTools.vue_vue_type_style_index_0_lang-BJi8BdV8.js → MapTools.vue_vue_type_style_index_0_lang-CZ_dEmHg.js} +2 -2
- package/dist/chunks/{ReplaceSpeciesNameDialog.vue_vue_type_script_setup_true_lang-C8wD6gZS.js → ReplaceSpeciesNameDialog.vue_vue_type_script_setup_true_lang-CjJ3e53H.js} +12 -13
- package/dist/chunks/ReplaceSpeciesNameDialog.vue_vue_type_script_setup_true_lang-m9hkScAC.js +1 -0
- package/dist/chunks/apply-element-plus-theme-DdN9KOhk.js +1 -0
- package/dist/chunks/apply-element-plus-theme-UHVxP4VN.js +22 -0
- package/dist/chunks/aria-B5rZ0WFy.js +5 -0
- package/dist/chunks/aria-BEkkcjlH.js +115 -0
- package/dist/chunks/constant-Bq4ASE9Q.js +1 -0
- package/dist/chunks/{constant-BqK1UnfT.js → constant-E83OJqPQ.js} +17 -36
- package/dist/chunks/debounce-CHS-N31c.js +1 -0
- package/dist/chunks/debounce-DBq5TVsN.js +55 -0
- package/dist/chunks/{el-loading-CBXyo6la.js → directive-C-4KkhaM.js} +2 -2
- package/dist/chunks/directive-DRO4tFsQ.js +1 -0
- package/dist/chunks/index-03UF6hCZ.js +14 -0
- package/dist/chunks/index-B6SD5IcP.js +1 -0
- package/dist/chunks/{index-DHO_7w-5.js → index-BCQYbM-I.js} +22 -22
- package/dist/chunks/{el-input-DCpRXscw.js → index-BdloQTv1.js} +171 -175
- package/dist/chunks/{el-overlay-BJQjrf5W.js → index-BeskO4C8.js} +76 -75
- package/dist/chunks/index-BoFuR9-k.js +2 -0
- package/dist/chunks/index-Bs9zhLlD.js +1 -0
- package/dist/chunks/index-C-WIOEu8.js +1 -0
- package/dist/chunks/index-CD-vLVPt.js +1 -0
- package/dist/chunks/index-CD4bijv7.js +1 -0
- package/dist/chunks/index-CHRyd-8X.js +1 -0
- package/dist/chunks/{el-button-Dh7ROB0R.js → index-CgKiWbxR.js} +110 -117
- package/dist/chunks/{el-popper-zUql4Vp-.js → index-Cv_K9rbv.js} +47 -46
- package/dist/chunks/{el-select-Dil0JEvg.js → index-Cyrc4mj-.js} +467 -492
- package/dist/chunks/index-DLBjU25P.js +3 -0
- package/dist/chunks/index-DgwQEHlD.js +12 -0
- package/dist/chunks/index-LWCtnbZP.js +13 -0
- package/dist/chunks/index-OtE8c8y9.js +1 -0
- package/dist/chunks/index-Qzqd5jTh.js +1 -0
- package/dist/chunks/index-VbRYJz2E.js +1 -0
- package/dist/chunks/index-YiSmXvH8.js +975 -0
- package/dist/chunks/{index-Dq3Y5qiS.js → index-_At9ftZd.js} +35 -35
- package/dist/chunks/{index-Cw_w6CLf.js → index-ieQ_IULW.js} +11 -11
- package/dist/chunks/{el-form-item-CXLLocXw.js → index-mDs-Bipv.js} +151 -150
- package/dist/chunks/mapSetting-B1a88k-v.js +635 -0
- package/dist/chunks/mapSetting-Ba76lOJd.js +1 -0
- package/dist/chunks/{base-DfCoKyyG.js → style-COMeMpO8.js} +81 -80
- package/dist/chunks/{base-DK_JFP90.js → style-DiDWGUIe.js} +1 -1
- package/dist/chunks/toNumber-CCcOx5KD.js +1 -0
- package/dist/chunks/toNumber-CDwzVyqL.js +30 -0
- package/dist/chunks/use-form-common-props-BQtZKazE.js +66 -0
- package/dist/chunks/use-form-common-props-SdGVhyVk.js +1 -0
- package/dist/chunks/{use-global-config-DXAWJFeA.js → use-global-config-Ba3i7fKX.js} +18 -17
- package/dist/chunks/use-global-config-PaSl-b_9.js +1 -0
- package/dist/chunks/utils-BJ8Lu8TY.js +516 -0
- package/dist/chunks/utils-CrwGKkIz.js +1 -0
- package/dist/chunks/vnode-CvqQoLhR.js +1 -0
- package/dist/chunks/vnode-DpjFDm4v.js +70 -0
- package/dist/element-plus-style.cjs +1 -0
- package/dist/element-plus-style.mjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +13 -10
- package/dist/manageTable/ReplaceSpeciesNameDialog.cjs +1 -1
- package/dist/manageTable/ReplaceSpeciesNameDialog.mjs +1 -1
- package/dist/manageTable/index.cjs +1 -1
- package/dist/manageTable/index.mjs +10 -8
- package/dist/manageTable/manageTable.cjs +1 -1
- package/dist/manageTable/manageTable.mjs +1 -1
- package/dist/mapbox/components/VideoDialog.cjs +1 -1
- package/dist/mapbox/components/VideoDialog.mjs +16 -17
- package/dist/mapbox/widgets/LayerAttributeDialog.cjs +1 -1
- package/dist/mapbox/widgets/LayerAttributeDialog.mjs +30 -31
- package/dist/mapbox.cjs +1 -1
- package/dist/mapbox.mjs +22 -20
- package/dist/mapboxV2/MapView.cjs +1 -1
- package/dist/mapboxV2/MapView.mjs +3728 -1256
- package/dist/mapboxV2/components/MapLegend.cjs +1 -1
- package/dist/mapboxV2/components/MapLegend.mjs +51 -167
- package/dist/mapboxV2/components/MapTools.cjs +1 -1
- package/dist/mapboxV2/components/MapTools.mjs +1 -1
- package/dist/mapboxV2/components/VideoDialog.cjs +1 -1
- package/dist/mapboxV2/components/VideoDialog.mjs +12 -13
- package/dist/mapboxV2/components/mapSetting.cjs +1 -1
- package/dist/mapboxV2/components/mapSetting.mjs +1 -1
- package/dist/mapboxV2/components/mapTopic.cjs +1 -1
- package/dist/mapboxV2/components/mapTopic.mjs +349 -446
- package/dist/mapboxV2/constant.cjs +1 -1
- package/dist/mapboxV2/constant.mjs +13 -17
- package/dist/mapboxV2/useTif.cjs +1 -1
- package/dist/mapboxV2/useTif.mjs +86 -86
- package/dist/mapboxV2/utils.cjs +1 -1
- package/dist/mapboxV2/utils.mjs +362 -279
- package/dist/mapboxV2/widgets/CustomShapeDialog.cjs +1 -1
- package/dist/mapboxV2/widgets/CustomShapeDialog.mjs +87 -67
- package/dist/mapboxV2/widgets/IconPicker.cjs +1 -1
- package/dist/mapboxV2/widgets/IconPicker.mjs +59 -48
- package/dist/mapboxV2/widgets/LayerAttributeDialog.cjs +1 -1
- package/dist/mapboxV2/widgets/LayerAttributeDialog.mjs +17 -18
- package/dist/mapboxV2/widgets/LayerDialog.cjs +1 -1
- package/dist/mapboxV2/widgets/LayerDialog.mjs +94 -86
- package/dist/mapboxV2/widgets/LegendDialogLine.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendDialogLine.mjs +95 -90
- package/dist/mapboxV2/widgets/LegendDialogPoint.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendDialogPoint.mjs +90 -85
- package/dist/mapboxV2/widgets/LegendLine.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendLine.mjs +28 -61
- package/dist/mapboxV2/widgets/LegendPoint.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendPoint.mjs +52 -66
- package/dist/mapboxV2/widgets/LegendPopInterestPoint.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendPopInterestPoint.mjs +16 -18
- package/dist/mapboxV2/widgets/LegendPopLine.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendPopLine.mjs +72 -73
- package/dist/mapboxV2/widgets/LegendPopPoint.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendPopPoint.mjs +113 -112
- package/dist/mapboxV2/widgets/LegendShape.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendShape.mjs +17 -14
- package/dist/mapboxV2/widgets/LegendSymbol.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendSymbol.mjs +5 -5
- package/dist/mapboxV2/widgets/ShapeDialog.cjs +1 -1
- package/dist/mapboxV2/widgets/ShapeDialog.mjs +1663 -1422
- package/dist/mapboxV2/widgets/TopicItemPop.cjs +1 -1
- package/dist/mapboxV2/widgets/TopicItemPop.mjs +2 -2
- package/dist/mapboxV2/widgets/TopicPop.mjs +1 -1
- package/dist/mapboxV2.cjs +3 -3
- package/dist/mapboxV2.mjs +673 -824
- package/dist/qy-vue-plugins.css +1 -1
- package/dist/types/apply-element-plus-theme.d.ts +1 -0
- package/dist/types/element-plus-style.d.ts +0 -0
- package/dist/types/manageTable/manageTable.vue.d.ts +2 -2
- package/dist/types/mapboxV2/MapView.vue.d.ts +130 -3
- package/dist/types/mapboxV2/components/mapTopic.vue.d.ts +10 -591
- package/dist/types/mapboxV2/types/map-layer.d.ts +185 -3
- package/dist/types/mapboxV2/useTif.d.ts +2 -2
- package/dist/types/mapboxV2/utils/geojsonRenderer.d.ts +123 -0
- package/dist/types/mapboxV2/utils.d.ts +5 -0
- package/dist/types/mapboxV2/widgets/IconPicker.vue.d.ts +8 -10
- package/dist/types/mapboxV2/widgets/index.d.ts +3 -0
- package/dist/types/mapboxV2/widgets/track/TrackImageDialog.vue.d.ts +11 -0
- package/dist/types/mapboxV2/widgets/track/TrackTextDialog.vue.d.ts +11 -0
- package/dist/types/mapboxV2/widgets/track/TrackVoiceDialog.vue.d.ts +11 -0
- package/dist/types/mapboxV2/widgets/track/index.d.ts +3 -0
- package/dist/types/store/mapStore.d.ts +122 -0
- package/dist/types/types/map.d.ts +111 -7
- package/package/apply-element-plus-theme.ts +23 -0
- package/package/css/common.scss +33 -0
- package/package/css/element-plus-theme.scss +30 -0
- package/package/css/map.scss +42 -0
- package/package/element-plus-style.ts +48 -0
- package/package/manageTable/index.ts +5 -0
- package/package/mapbox/index.ts +5 -0
- package/package/mapboxV2/constant.ts +4 -12
- package/package/mapboxV2/index.ts +5 -0
- package/package/mapboxV2/useTif.ts +18 -13
- package/package/mapboxV2/utils.ts +303 -143
- package/package/mapboxV2/widgets/index.ts +5 -0
- package/package/types/map.ts +129 -32
- package/package.json +27 -3
- package/dist/chunks/ReplaceSpeciesNameDialog.vue_vue_type_script_setup_true_lang-DnYed7Kh.js +0 -1
- package/dist/chunks/aria-B-Cm8P6h.js +0 -5
- package/dist/chunks/aria-GiGFrmP1.js +0 -175
- package/dist/chunks/constant-mXEWtcQf.js +0 -1
- package/dist/chunks/el-button-w9UOZkmd.js +0 -3
- package/dist/chunks/el-color-picker-panel-BWjyXHBz.js +0 -1
- package/dist/chunks/el-color-picker-panel-BfOVWDkH.js +0 -1024
- package/dist/chunks/el-form-item-ECXS8pAs.js +0 -12
- package/dist/chunks/el-input-tAiZBp5N.js +0 -1
- package/dist/chunks/el-loading-BDhLUhme.js +0 -1
- package/dist/chunks/el-overlay-BEd31jh6.js +0 -1
- package/dist/chunks/el-popper-C6hJmTeX.js +0 -1
- package/dist/chunks/el-select-BXP0YqqB.js +0 -1
- package/dist/chunks/index-BIPr63lF.js +0 -1
- package/dist/chunks/index-BIaoqnN4.js +0 -1
- package/dist/chunks/index-D9eecDRK.js +0 -2
- package/dist/chunks/mapSetting-BRasGCqk.js +0 -597
- package/dist/chunks/mapSetting-CfE-5SCc.js +0 -1
- package/dist/chunks/use-global-config-y6gk28OO.js +0 -1
- package/dist/chunks/utils-CZxmwfl_.js +0 -1
- package/dist/chunks/utils-n1i0zWzc.js +0 -454
- package/dist/chunks/vnode-CyTnPoXJ.js +0 -47
- package/dist/chunks/vnode-eKMqbqaC.js +0 -1
- package/dist/chunks//346/255/243/344/270/211/350/247/222/345/275/242-BRUTHTNe.js +0 -12
- package/dist/chunks//346/255/243/344/270/211/350/247/222/345/275/242-CksusXxb.js +0 -28
- package/dist/chunks//346/255/243/344/270/211/350/247/222/345/275/242-DchJeGnp.js +0 -1
- package/dist/chunks//346/255/243/344/270/211/350/247/222/345/275/242-yXKDlNvO.js +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const J=require("../chunks/正三角形-BRUTHTNe.js"),L=require("vue"),ae=require("mapbox-gl"),Ee=require("../chunks/mapStore-dFPYwvXT.js");;/* empty css */const Y=require("../chunks/map-CAu4wyVU.js"),g=require("../chunks/utils-CZxmwfl_.js"),H=require("../chunks/EventKeys-BvyQ87Zy.js"),ie=require("../chunks/constant-mXEWtcQf.js"),Oe=require("@turf/turf"),Ce=require("../chunks/ProvideKeys-91lTuLnq.js"),De=require("../chunks/geotiff-OzcRsIeD.js"),ye=require("element-plus"),$e=require("../chunks/_plugin-vue_export-helper-BHFhmbuH.js");function Ae(s){const E=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const $ in s)if($!=="default"){const T=Object.getOwnPropertyDescriptor(s,$);Object.defineProperty(E,$,T.get?T:{enumerable:!0,get:()=>s[$]})}}return E.default=s,Object.freeze(E)}const ne=Ae(Oe);function Be(s){const E=L.ref([]);let $=null,T={min:null,max:null,originalMin:null,originalMax:null,bounds:[]};async function v(F,I=["#000000","#FFFFFF"]){console.log("Adding TIF layer with URL/File:",F,I);const C=`tif-layer-${new Date().getTime()}`;if(F instanceof File){const b=await g.readFileAsArrayBuffer(F);await e(b,I,C),E.value.push(C)}else if(typeof F=="string"){const h=await(await fetch(F)).arrayBuffer();await e(h,I,C),E.value.push(C)}return{tifId:C,dataRange:T}}async function e(F,I=["#000000","#FFFFFF"],C="geotiff-layer"){const h=await(await De.fromArrayBuffer(F)).getImage(),S=h.getWidth(),z=h.getHeight(),w=h.fileDirectory||{};console.log("fileDirectory",w);const M=parseInt(w.GDAL_NODATA);console.log("GDAL_NODATA",typeof M,M);const j=g.calculateBounds(h),N=await h.readRasters();$={image:h,data:N,width:S,height:z},console.log("GeoTIFF data loaded:",$);const Z=Array.isArray(N)?N:[N];let A=1/0,V=-1/0;for(const P of Z)for(const R of P)R>-1e10&&R!=M&&(A=Math.min(A,R),V=Math.max(V,R));(!isFinite(A)||!isFinite(V)||A>=V)&&(console.warn("无效的数据范围,使用默认值"),A=0,V=255),T={min:A,max:V,originalMin:A,originalMax:V,bounds:j},console.log("Data range calculated:",T);const O=Q(N,S,z,I,M);if(!O){console.error("Failed to create image data from GeoTIFF.");return}U(O,S,z,j,C),s.value?.fitBounds([[j[0],j[1]],[j[2],j[3]]],{padding:50})}function U(F,I,C,b,h="geotiff-layer"){const S=h,z=h+"-source";s.value?.getLayer(S)&&s.value.removeLayer(S),s.value?.getSource(z)&&s.value.removeSource(z);const w=document.createElement("canvas");w.width=I,w.height=C,w.getContext("2d")?.putImageData(F,0,0);const j=w.toDataURL("image/png");s.value?.addSource(z,{type:"image",url:j,coordinates:[[b[0],b[3]],[b[2],b[3]],[b[2],b[1]],[b[0],b[1]]]}),s.value?.addLayer({id:S,type:"raster",source:z,paint:{"raster-opacity":.8}})}function X(F){const I=F,C=F+"-source";s.value?.getLayer(I)&&s.value.removeLayer(I),s.value?.getSource(C)&&s.value.removeSource(C);const b=E.value.indexOf(F);b!==-1&&E.value.splice(b,1)}function Q(F,I,C,b,h=null){const S=document.createElement("canvas");S.width=I,S.height=C;const z=S.getContext("2d"),w=z?.createImageData(I,C),M=Array.isArray(F)?F:[F],j=I*C;let N=T.min,Z=T.max;(N===null||Z===null)&&(N=0,Z=255);const A=b.map(g.hexToRgb),V=A.length;function O(P){if(V===1||P<=0)return A[0];if(P>=1)return A[V-1];const R=1/(V-1),B=Math.floor(P/R),G=(P-B*R)/R,D=A[B],W=A[Math.min(B+1,V-1)];return[Math.round(D[0]+(W[0]-D[0])*G),Math.round(D[1]+(W[1]-D[1])*G),Math.round(D[2]+(W[2]-D[2])*G)]}for(let P=0;P<j;P++){let R,B,G,D;const W=M[0][P];if(h!==null&&W===h)R=B=G=0,D=0;else if(M.length>=3)h!==null&&(M[0][P]===h||M[1][P]===h||M[2][P]===h)?(R=B=G=0,D=0):(R=Math.floor(255*g.clamp((M[0][P]-N)/(Z-N),0,1)),B=Math.floor(255*g.clamp((M[1][P]-N)/(Z-N),0,1)),G=Math.floor(255*g.clamp((M[2][P]-N)/(Z-N),0,1)),D=255);else if(M.length===1){const q=M[0][P];if(q<N)D=0,R=B=G=0;else if(q>Z)R=255,B=G=0,D=255;else{const _=(q-N)/(Z-N),ee=.15,re=(_-ee)/(1-ee);[R,B,G]=O(re),D=255}}else{const _=(M[0][P]-N)/(Z-N);_<.15?(R=B=G=0,D=0):(R=B=G=Math.floor(255*(_-.15)/.85),D=255)}w.data[P*4]=R,w.data[P*4+1]=B,w.data[P*4+2]=G,w.data[P*4+3]=D}return z?.putImageData(w,0,0),w}return{addTifLayer:v,processGeoTIFF:e,removeTifLayer:X}}function fe(s,E,$,T,v){if(console.log("setMapParams",s),!s.layerPaintConfig)return;const e=JSON.parse(s.layerPaintConfig||"{}"),{defaultCenter:U,defaultZoom:X,bearing:Q,pitch:F,baseMap:I,displayFeatures:C}=e;let b=!1;if(I){b=!0;const h=I==="satellite"?Y.MapLayerType.SATELLITE:I==="vector"?Y.MapLayerType.VECTOR:Y.MapLayerType.TOPOGRAPHIC;T.changeMapLayer($,h),E?.setStyle(T.getCurrentMapStyle($))}if(U&&X!==void 0){b=!0;let h;if(typeof U=="string"){const M=U.split(",").map(j=>parseFloat(j.trim()));h=[M[0],M[1]]}else if(Array.isArray(U))h=U;else return;const S=parseFloat(X),z=Q!==void 0?parseFloat(Q):0,w=F!==void 0?parseFloat(F):0;T.saveInitialState($,h,S,z,w),T.setCenter($,h),T.setZoom($,S),T.setBearing($,z),T.setPitch($,w),I?E?.once("styledata",()=>{setTimeout(()=>{v.value=!0,E?.flyTo({center:h,zoom:S,bearing:z,pitch:w,duration:1e3}),E?.once("moveend",()=>{setTimeout(()=>{v.value=!1,ye.ElMessage.success("应用当前配置成功!")},100)})},200)}):(v.value=!0,E?.flyTo({center:h,zoom:S,bearing:z,pitch:w,duration:1e3}),E?.once("moveend",()=>{setTimeout(()=>{v.value=!1,ye.ElMessage.success("应用当前配置成功!")},100)}))}if(C!==void 0){b=!0;const S=(typeof C=="object"?C.label===!0:C===!0)?"visible":"none";setTimeout(()=>{["tdt-satellite-osm-tiles-marker-layer","tdt-vector-osm-tiles-marker-layer","tdt-vector-osm-tiles-marker-layer1","tdt-vector-osm-tiles-marker-layer2","tdt-vector-osm-tiles-marker-layer3"].forEach(w=>{E?.getLayer(w)&&E.setLayoutProperty(w,"visibility",S)})},300)}b&&!(U&&X!==void 0)&&ye.ElMessage.success("应用当前配置成功!")}const Ge=["id"],je={class:"left-bar"},Ve={class:"right-bar"},Je={class:"bottom-bar"},Ze=L.defineComponent({name:"MapView",__name:"MapView",props:{mapRootId:{default:"mapboxV2-map"},tdtToken:{},mapBoxToken:{},amapKey:{},maxZoom:{default:17},minZoom:{default:3},zoom:{default:10},pitch:{default:60},hasScale:{type:Boolean,default:!0},scalePosition:{default:"bottom-right"},center:{},dialogConfig:{default:()=>({center:!1,top:"50px",customClass:"hiper-map-dialog"})},loadIcon:{type:Boolean,default:!0},mapLayerEntity:{}},emits:["mapReady"],setup(s,{expose:E,emit:$}){const T=L.useTemplateRef("mapRoot"),v=Ee.useMapStore();s.dialogConfig&&v.setDialogConfig(s.dialogConfig);const e=L.ref(),{addTifLayer:U,processGeoTIFF:X,removeTifLayer:Q}=Be(e),F=$,I=()=>{ae.accessToken=s.mapBoxToken;const t=v.mapInstances[s.mapRootId];if(console.log("_mapInstance",t),e.value=new ae.Map({container:s.mapRootId,style:v.getCurrentMapStyle(s.mapRootId),center:t.center,zoom:t.zoom,pitch:t.pitch,bearing:0,antialias:!0,maxZoom:t.maxZoom,minZoom:t.minZoom,attributionControl:!1}),e.value.on("load",()=>{if(e.value&&(Pe(),F("mapReady",e.value)),H.mapLoadedBus.emit({mapRootId:s.mapRootId,mapInstance:e.value}),s.mapLayerEntity&&e.value){console.log("外部接口接收到的数据",s.mapLayerEntity);let l;Array.isArray(s.mapLayerEntity)?l=s.mapLayerEntity.find(a=>a.layerType==="map-layer"):l=s.mapLayerEntity,l&&fe(l,e.value,s.mapRootId,v,b)}}),e.value.on("zoomend",()=>{v.setZoom(s.mapRootId,e.value?.getZoom()||0)}),s.hasScale){const l=new ae.ScaleControl({maxWidth:80,unit:"metric"});e.value?.addControl(l,s.scalePosition)}e.value.on("load",()=>{})},C=()=>{e.value?.setStyle(v.getCurrentMapStyle(s.mapRootId)),e.value?.once("styledata",()=>{console.log("地图样式更新完成,重新加载图层"),S.value.forEach(t=>{z(t)}),H.mapStyleChangedBus.emit({mapRootId:s.mapRootId})})},b=L.ref(!1),h=()=>{if(!e.value)return;let t={center:[116.4074,39.9042],zoom:3,bearing:0,pitch:0};const l=v.getInitialState(s.mapRootId);l?t={center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch}:s.center&&(t.center=s.center,t.zoom=s.zoom,t.pitch=s.pitch||0,t.bearing=0),b.value=!0,console.log("开始重置地图视图",t),e.value.flyTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch,duration:2e3}),v.mapInstances[s.mapRootId]&&(v.setCenter(s.mapRootId,t.center),v.setZoom(s.mapRootId,t.zoom),v.setBearing(s.mapRootId,t.bearing),v.setPitch(s.mapRootId,t.pitch)),setTimeout(()=>{b.value=!1},2e3)},S=L.ref([]),z=async t=>{if(!e.value){console.warn("地图实例未初始化,无法添加图层");return}const l=S.value.find(a=>a.id===t.id);if(l?Object.assign(l,t):S.value.push(t),(t.layerType==="sample-group"||t.layerType==="track")&&t.layerDataType==="line"){he(t);return}if(t.geoJSON)console.log("渲染geoJSON---->"),M(t);else{const a=g.getLayerId(t);e.value?.getLayer(a)==null?(console.log("首次渲染---->"),await j(t)):(console.log("非首次渲染---->更新图层"),w(t,JSON.parse(t.layerPaintConfig)))}};function w(t,l){l.fillColorList&&l.fillColorList.length&&(l.fillColorList=l.fillColorList.filter(n=>n.key&&n.value||n.type=="default"));const a=g.getLayerType(t);console.log("currentLayerType--->",a);const o=JSON.parse(JSON.stringify(l));console.log("newStyleConfig---->",o);const r=g.getFillStyle(o);console.log("newFillColorConfig---->",r);const i=g.getOutLineStyle(o);if(console.log("outlineStyle---->",i),t.layerType==="shp"&&t.layerShapes){const n=t.layerShapes.split(",").map(d=>d.trim());if(n.length>1){const d=g.getLayerId(t);if(n.includes("polygon")&&r&&i){const c=d+"-polygon";e.value?.getLayer(c)&&(e.value?.setPaintProperty(c,"fill-color",r["fill-color"]),e.value?.setPaintProperty(c,"fill-opacity",r["fill-opacity"]),e.value?.setPaintProperty(c+"-outline","line-color",i["line-color"]),e.value?.setPaintProperty(c+"-outline","line-width",i["line-width"]),i["line-opacity"]&&e.value?.setPaintProperty(c+"-outline","line-opacity",i["line-opacity"]))}if(n.includes("line")&&i){const c=d+"-line";e.value?.getLayer(c)&&(e.value?.setPaintProperty(c,"line-color",i["line-color"]),e.value?.setPaintProperty(c,"line-width",i["line-width"]),i["line-opacity"]&&e.value?.setPaintProperty(c,"line-opacity",i["line-opacity"]))}if(n.includes("point")){const c=d+"-point",y=g.getLayerStyle(t);e.value?.getLayer(c)&&y&&Object.keys(y).forEach(k=>{e.value?.setPaintProperty(c,k,y[k])});const m=o.symbolConfig?{showLabel:o.symbolConfig.displayLabel==="true",labelField:o.symbolConfig.labelField||"FID",fontSize:o.symbolConfig.labelSize||14,fontColor:o.symbolConfig.labelColor||"#000000",fontFamily:o.symbolConfig.labelFont||"SimSun"}:void 0,x=g.getLabelStyle(m),p=c+"-label";if(x)if(e.value?.getLayer(p))e.value?.setLayoutProperty(p,"text-field",x["text-field"]),e.value?.setLayoutProperty(p,"text-size",x["text-size"]),e.value?.setPaintProperty(p,"text-color",x["text-color"]);else{const k=x["text-color"],te=k==="#ffffff"||k==="rgb(255, 255, 255)"||k==="white";e.value?.addLayer({id:p,type:"symbol",source:g.getLayerId(t),filter:["==",["geometry-type"],"Point"],layout:{"text-field":x["text-field"],"text-font":x["text-font"],"text-size":x["text-size"],"text-anchor":"bottom","text-offset":[0,1.5],"text-allow-overlap":!0,"text-ignore-placement":!0,visibility:"visible"},paint:{"text-color":x["text-color"],"text-halo-color":te?"#000000":"#ffffff","text-halo-width":2}})}else e.value?.getLayer(p)&&e.value?.removeLayer(p)}return}}if(a=="fill"&&r&&i){e.value?.setPaintProperty(g.getLayerId(t),"fill-color",r["fill-color"]),e.value?.setPaintProperty(g.getLayerId(t),"fill-opacity",r["fill-opacity"]),e.value?.setPaintProperty(g.getLayerId(t),"fill-outline-color",r["fill-outline-color"]),i&&i["line-color"]&&e.value?.setPaintProperty(g.getLayerId(t)+"-outline","line-color",i["line-color"]),i&&i["line-opacity"],i&&i["line-width"]&&e.value?.setPaintProperty(g.getLayerId(t)+"-outline","line-width",i["line-width"]),e.value?.setPaintProperty(g.getLayerId(t)+"-outline","line-dasharray",[]),i&&i["line-dasharray"]&&(console.log("outlineStyle['line-dasharray']----->",i["line-dasharray"]),e.value?.setPaintProperty(g.getLayerId(t)+"-outline","line-dasharray",i["line-dasharray"]));const n=o.fillConfig?{showLabel:o.fillConfig.displayLabel==="true",labelField:o.fillConfig.labelField||"FID",fontSize:o.fillConfig.labelSize||14,fontColor:o.fillConfig.labelColor||"#000000",fontFamily:o.fillConfig.labelFont||"SimSun"}:o.labelConfig,d=g.getLabelStyle(n),c=g.getLayerId(t)+"-label",y=e.value?.getLayer(c);if(d)if(y)e.value?.setLayoutProperty(c,"text-field",d["text-field"]),e.value?.setLayoutProperty(c,"text-font",d["text-font"]),e.value?.setLayoutProperty(c,"text-size",d["text-size"]),e.value?.setLayoutProperty(c,"text-anchor",d["text-anchor"]),e.value?.setLayoutProperty(c,"text-offset",d["text-offset"]),e.value?.setLayoutProperty(c,"text-allow-overlap",d["text-allow-overlap"]),e.value?.setPaintProperty(c,"text-color",d["text-color"]);else{const m=g.getSourceId(t);console.log("创建标注图层---->",{labelLayerId:c,sourceId:m,labelStyle:d}),e.value?.addLayer({id:c,type:"symbol",source:m,layout:{"text-field":d["text-field"],"text-font":d["text-font"],"text-size":d["text-size"],"text-anchor":d["text-anchor"],"text-offset":d["text-offset"],"text-allow-overlap":d["text-allow-overlap"]},paint:{"text-color":d["text-color"]}},g.getLayerId(t)+"-outline")}else y&&e.value?.removeLayer(c);if(o.outlineConfig){const m={showLabel:o.outlineConfig.displayLabel==="true",labelField:o.outlineConfig.labelField||"FID",fontSize:o.outlineConfig.labelSize||14,fontColor:o.outlineConfig.labelColor||"#000000",fontFamily:o.outlineConfig.labelFont||"SimSun"},x=g.getLabelStyle(m),p=g.getLayerId(t)+"-outline-label",k=e.value?.getLayer(p);if(x)if(k)e.value?.setLayoutProperty(p,"text-field",x["text-field"]),e.value?.setLayoutProperty(p,"text-font",x["text-font"]),e.value?.setLayoutProperty(p,"text-size",x["text-size"]),e.value?.setLayoutProperty(p,"text-anchor",x["text-anchor"]),e.value?.setLayoutProperty(p,"text-offset",x["text-offset"]),e.value?.setLayoutProperty(p,"text-allow-overlap",x["text-allow-overlap"]),e.value?.setLayoutProperty(p,"symbol-placement","line-center"),e.value?.setPaintProperty(p,"text-color",x["text-color"]);else{const te=g.getSourceId(t);console.log("创建轮廓线标注图层---->",{outlineLabelLayerId:p,sourceId:te,outlineLabelStyle:x}),e.value?.addLayer({id:p,type:"symbol",source:te,layout:{"text-field":x["text-field"],"text-font":x["text-font"],"text-size":x["text-size"],"text-anchor":x["text-anchor"],"text-offset":x["text-offset"],"text-allow-overlap":x["text-allow-overlap"],"symbol-placement":"line-center"},paint:{"text-color":x["text-color"]}},g.getLayerId(t)+"-outline")}else k&&e.value?.removeLayer(p)}}else if(a=="line"){i&&i["line-color"]&&e.value?.setPaintProperty(g.getLayerId(t),"line-color",i["line-color"]),i&&i["line-opacity"]&&e.value?.setPaintProperty(g.getLayerId(t),"line-opacity",i["line-opacity"]),i&&i["line-width"]&&e.value?.setPaintProperty(g.getLayerId(t),"line-width",i["line-width"]),e.value?.setPaintProperty(g.getLayerId(t),"line-dasharray",[]),i&&i["line-dasharray"]&&e.value?.setPaintProperty(g.getLayerId(t),"line-dasharray",i["line-dasharray"]);const n=o.outlineConfig?{showLabel:o.outlineConfig.displayLabel==="true",labelField:o.outlineConfig.labelField||"FID",fontSize:o.outlineConfig.labelSize||14,fontColor:o.outlineConfig.labelColor||"#000000",fontFamily:o.outlineConfig.labelFont||"SimSun"}:o.lineLabelConfig,d=g.getLabelStyle(n),c=g.getLayerId(t)+"-label",y=e.value?.getLayer(c);if(d)if(y)e.value?.setLayoutProperty(c,"text-field",d["text-field"]),e.value?.setLayoutProperty(c,"text-font",d["text-font"]),e.value?.setLayoutProperty(c,"text-size",d["text-size"]),e.value?.setLayoutProperty(c,"text-anchor",d["text-anchor"]),e.value?.setLayoutProperty(c,"text-offset",d["text-offset"]),e.value?.setLayoutProperty(c,"text-allow-overlap",d["text-allow-overlap"]),e.value?.setPaintProperty(c,"text-color",d["text-color"]);else{const m=g.getSourceId(t);console.log("创建线标注图层---->",{lineLabelLayerId:c,sourceId:m,lineLabelStyle:d}),e.value?.addLayer({id:c,type:"symbol",source:m,layout:{"text-field":d["text-field"],"text-font":d["text-font"],"text-size":d["text-size"],"text-anchor":d["text-anchor"],"text-offset":d["text-offset"],"text-allow-overlap":d["text-allow-overlap"],"symbol-placement":"line-center"},paint:{"text-color":d["text-color"]}},g.getLayerId(t))}else y&&e.value?.removeLayer(c)}else if(a=="circle"){const n=g.getCircleStyle(o);n&&n["circle-color"]&&e.value?.setPaintProperty(g.getLayerId(t),"circle-color",n["circle-color"]),n&&n["circle-opacity"]&&e.value?.setPaintProperty(g.getLayerId(t),"circle-opacity",n["circle-opacity"]),n&&n["circle-radius"]&&e.value?.setPaintProperty(g.getLayerId(t),"circle-radius",n["circle-radius"]),n&&n["circle-stroke-color"]&&e.value?.setPaintProperty(g.getLayerId(t),"circle-stroke-color",n["circle-stroke-color"]),n&&n["circle-stroke-width"]&&e.value?.setPaintProperty(g.getLayerId(t),"circle-stroke-width",n["circle-stroke-width"]);const d=o.symbolConfig?{showLabel:o.symbolConfig.displayLabel==="true",labelField:o.symbolConfig.labelField||"FID",fontSize:o.symbolConfig.labelSize||14,fontColor:o.symbolConfig.labelColor||"#000000",fontFamily:o.symbolConfig.labelFont||"SimSun"}:void 0,c=g.getLabelStyle(d),y=g.getLayerId(t)+"-label",m=e.value?.getLayer(y);if(c)if(m)e.value?.setLayoutProperty(y,"text-field",c["text-field"]),e.value?.setLayoutProperty(y,"text-font",c["text-font"]),e.value?.setLayoutProperty(y,"text-size",c["text-size"]),e.value?.setLayoutProperty(y,"text-anchor",c["text-anchor"]),e.value?.setLayoutProperty(y,"text-offset",c["text-offset"]),e.value?.setLayoutProperty(y,"text-allow-overlap",c["text-allow-overlap"]),e.value?.setPaintProperty(y,"text-color",c["text-color"]);else{const x=g.getSourceId(t),p=c["text-color"],k=p==="#ffffff"||p==="rgb(255, 255, 255)"||p==="white";e.value?.addLayer({id:y,type:"symbol",source:x,layout:{"text-field":c["text-field"],"text-font":c["text-font"],"text-size":c["text-size"],"text-anchor":"bottom","text-offset":[0,1.5],"text-allow-overlap":!0,"text-ignore-placement":!0,visibility:"visible"},paint:{"text-color":c["text-color"],"text-halo-color":k?"#000000":"#ffffff","text-halo-width":2}},g.getLayerId(t))}else m&&e.value?.removeLayer(y)}else if(a=="symbol"){const n=g.getCircleStyle(o);n&&n["icon-image"]&&e.value?.setLayoutProperty(g.getLayerId(t),"icon-image",n["icon-image"])}if((t.layerType==="sample-group"||t.layerType==="track")&&t.layerDataType==="line"){const n=JSON.parse(t.layerPaintConfig||"{}"),d=`${t.id}-line-layer`;if(e.value?.getLayer(d)){switch(n.lineColor&&e.value?.setPaintProperty(d,"line-color",n.lineColor),n.lineWidth!==void 0&&e.value?.setPaintProperty(d,"line-width",n.lineWidth),e.value?.setPaintProperty(d,"line-dasharray",[]),n.lineStyle){case"dotted":case"dot-line":e.value?.setPaintProperty(d,"line-dasharray",[5.2,5.2]);break;case"simple-dash":case"dashed":e.value?.setPaintProperty(d,"line-dasharray",[8,4]);break;case"dot-dash":e.value?.setPaintProperty(d,"line-dasharray",[5,5,1,5]);break;case"long-dash":e.value?.setPaintProperty(d,"line-dasharray",[20,5]);break;case"complex-pattern":e.value?.setPaintProperty(d,"line-dasharray",[10,3,3,3]);break}const y=`${t.id}-line-text`;e.value?.getLayer(y)&&(n.labelSize&&e.value?.setLayoutProperty(y,"text-size",n.labelSize),n.labelColor&&e.value?.setPaintProperty(y,"text-color",n.labelColor))}}const u=[];let{symbolConfigList:f}=o;f=f.filter(n=>n.fontSize&&n.field&&n.textColor),f.forEach((n,d)=>{const c="points-symbol-"+t.id+n.field,y=g.getSourceId(t);e.value?.getLayer(c)?(e.value?.setLayoutProperty(c,"text-size",n.fontSize),e.value?.setPaintProperty(c,"text-color",n.textColor)):(e.value?.addLayer({id:c,type:"symbol",source:y,layout:{visibility:"visible","text-field":["get",n.field],"text-size":n.fontSize,"symbol-avoid-edges":!0,"icon-image":"circle-11","text-ignore-placement":!1,"text-max-angle":38},paint:{"text-color":n.textColor}}),u.push(n.field))})}function M(t){if(!t.customLayerConfig||!t.geoJSON){console.warn("图层配置缺失,无法渲染图层");return}const l=JSON.parse(t.customLayerConfig),a=g.getLayerId(t);e.value?.getLayer(a)!==void 0&&(console.warn(`图层 ${a} 已存在,无法重复添加`),e.value?.removeLayer(a),e.value?.removeSource(a));const r=JSON.parse(t.geoJSON);switch(t.layerType){case"symbol":const i={id:a,type:"symbol",source:{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:r.features[0].geometry.coordinates},properties:{title:t.layerName||l.iconName,icon:`${l.iconName}`}}]}},layout:{"icon-image":"{icon}","icon-size":.1,"icon-anchor":"center","text-field":"{title}","text-font":["Open Sans Semibold","Arial Unicode MS Bold"],"text-offset":[0,1.8],"text-anchor":"center","text-size":12,"text-allow-overlap":!0,"text-optional":!0},paint:{"text-color":l.textColor,"text-halo-color":"rgba(0,0,0,0.32)","text-halo-width":1,"text-halo-blur":2,"text-translate":[0,0]}};e.value?.addLayer(i);break;case"line":const u={id:a,type:"line",source:{type:"geojson",data:r},layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":l.lineColor,"line-width":Number(l.lineWidth)}};switch(l.lineStyle){case"dotted":case"dot-line":u.paint["line-dasharray"]=[5.2,5.2];break;case"simple-dash":case"dashed":u.paint["line-dasharray"]=[8,4];break;case"dot-dash":u.paint["line-dasharray"]=[5,5,1,5];break;case"long-dash":u.paint["line-dasharray"]=[20,5];break;case"complex-pattern":u.paint["line-dasharray"]=[10,3,3,3];break}e.value?.addLayer(u);break;case"shape":let f=a+"-outline";const n={id:f,type:"line",source:{type:"geojson",data:JSON.parse(t.geoJSON)},layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":l.fillColor,"line-width":Number(l.lineWidth)}};e.value?.getLayer(f)!==void 0&&(e.value?.removeLayer(f),e.value?.removeSource(f)),e.value?.addLayer(n);const c={id:a,type:"fill",source:{type:"geojson",data:r},layout:{},paint:{"fill-color":l.fillColor,"fill-opacity":.32}};e.value?.addLayer(c);break}}async function j(t){console.log("加载图层---->",t);const l=g.getLayerId(t),a=g.getSourceId(t);console.log("sourceId--->",a);const o=g.parseStyleConfig(t);console.log("styleConfig",o);const r=g.getLayerType(t);if(e.value?.getSource(a)||e.value?.addSource(a,{type:"geojson",data:t.url?.replace("bjhweb","bjh")}),t.layerType==="shp"&&t.layerShapes){const f=t.layerShapes.split(",").map(n=>n.trim());if(console.log("layerShapes--->",f),f.length>1){console.log("多几何类型图层,为每种类型创建图层"),await N(t,a,f,o);return}console.log("单一几何类型图层--->",r)}else console.log("layerType--->",r);const u={id:l,source:a,name:l,layout:{visibility:"visible"},type:r};if(r!="symbol"){const f=g.getLayerStyle(t);if(r==="circle"&&f&&f._useNewFormat){const n=`custom-icon-${t.id}-`;e.value?.listImages&&e.value.listImages().forEach(m=>{m.startsWith(n)&&e.value?.removeImage(m)});const d=f._circleConfigList||[],c=[];d.forEach(y=>{if(!(y.type==="custom"&&(y.value===""||y.value==null))&&y.renderMode==="color"){const m=y.type==="default"?"default":y.key,x=q(y.pointStyle||"地图点.svg",y.pointTintColor||"#67c23a",m).catch(p=>{console.error(`加载 SVG 图标失败: ${y.pointStyle}`,p)});c.push(x)}}),Promise.all(c).then(()=>{e.value?.getLayer(l)&&e.value?.removeLayer(l),u.type="symbol",u.layout={"icon-image":f["icon-image"],"icon-size":f["icon-size"],"icon-allow-overlap":!0,"icon-ignore-placement":!0,visibility:"visible"},e.value?.addLayer(u)}).catch(y=>{console.error("加载图标失败:",y),u.paint=f,e.value?.addLayer(u)})}else u.paint=f,e.value?.addLayer(u)}else{const f=g.getLayerStyle(t);u.layout={visibility:"visible","symbol-placement":"line","symbol-spacing":10,"icon-size":.1,"icon-keep-upright":!0,"icon-rotate":0,"icon-allow-overlap":!0,...f},console.log("layerConfig--->",u),e.value?.addLayer(u)}if(r=="fill"){const f=g.getOutLineStyle(o),n={"line-color":f["line-color"],"line-width":f["line-width"],"line-dasharray":f["line-dasharray"]||[]};f["line-opacity"]&&(n["line-opacity"]=f["line-opacity"]),e.value?.addLayer({id:l+"-outline",source:a,name:l+"-outline",layout:{visibility:"visible","line-join":"round","line-cap":"round"},type:"line",paint:n});const d=o.fillConfig?{showLabel:o.fillConfig.displayLabel==="true",labelField:o.fillConfig.labelField||"FID",fontSize:o.fillConfig.labelSize||14,fontColor:o.fillConfig.labelColor||"#000000",fontFamily:o.fillConfig.labelFont||"SimSun"}:o.labelConfig,c=g.getLabelStyle(d);if(c&&(console.log("初次加载时创建标注图层---->",{labelId:l+"-label",sourceId:a,labelStyle:c}),e.value?.addLayer({id:l+"-label",type:"symbol",source:a,layout:{"text-field":c["text-field"],"text-font":c["text-font"],"text-size":c["text-size"],"text-anchor":c["text-anchor"],"text-offset":c["text-offset"],"text-allow-overlap":c["text-allow-overlap"]},paint:{"text-color":c["text-color"]}})),o.outlineConfig){const y={showLabel:o.outlineConfig.displayLabel==="true",labelField:o.outlineConfig.labelField||"FID",fontSize:o.outlineConfig.labelSize||14,fontColor:o.outlineConfig.labelColor||"#000000",fontFamily:o.outlineConfig.labelFont||"SimSun"},m=g.getLabelStyle(y);m&&(console.log("初次加载时创建轮廓线标注图层---->",{labelId:l+"-outline-label",sourceId:a,outlineLabelStyle:m}),e.value?.addLayer({id:l+"-outline-label",type:"symbol",source:a,layout:{"text-field":m["text-field"],"text-font":m["text-font"],"text-size":m["text-size"],"text-anchor":m["text-anchor"],"text-offset":m["text-offset"],"text-allow-overlap":m["text-allow-overlap"],"symbol-placement":"line-center"},paint:{"text-color":m["text-color"]}}))}}else if(r=="line"){const f=o.outlineConfig?{showLabel:o.outlineConfig.displayLabel==="true",labelField:o.outlineConfig.labelField||"FID",fontSize:o.outlineConfig.labelSize||14,fontColor:o.outlineConfig.labelColor||"#000000",fontFamily:o.outlineConfig.labelFont||"SimSun"}:o.lineLabelConfig,n=g.getLabelStyle(f);n?e.value?.addLayer({id:l+"-label",type:"symbol",source:a,layout:{"text-field":n["text-field"],"text-font":n["text-font"],"text-size":n["text-size"],"text-anchor":n["text-anchor"],"text-offset":n["text-offset"],"text-allow-overlap":n["text-allow-overlap"],"symbol-placement":"line-center"},paint:{"text-color":n["text-color"]}}):console.log("线标注样式为空,不创建标注图层")}else if(r=="circle"){const f=o.symbolConfig?{showLabel:o.symbolConfig.displayLabel==="true",labelField:o.symbolConfig.labelField||"FID",fontSize:o.symbolConfig.labelSize||14,fontColor:o.symbolConfig.labelColor||"#000000",fontFamily:o.symbolConfig.labelFont||"SimSun"}:void 0,n=g.getLabelStyle(f);if(n){const d=n["text-color"],c=d==="#ffffff"||d==="rgb(255, 255, 255)"||d==="white";e.value?.addLayer({id:l+"-label",type:"symbol",source:a,layout:{"text-field":n["text-field"],"text-font":n["text-font"],"text-size":n["text-size"],"text-anchor":"bottom","text-offset":[0,1.5],"text-allow-overlap":!0,"text-ignore-placement":!0,visibility:"visible"},paint:{"text-color":n["text-color"],"text-halo-color":c?"#000000":"#ffffff","text-halo-width":2}})}}}async function N(t,l,a,o){const r=g.getLayerId(t);a.includes("polygon")&&(console.log("渲染多几何类型-面图层"),Z(t,l,r,o)),a.includes("line")&&(console.log("渲染多几何类型-线图层"),A(t,l,r,o)),a.includes("point")&&(console.log("渲染多几何类型-点图层"),await V(t,l,r,o))}function Z(t,l,a,o){const r=a+"-polygon",i=g.getFillStyle(o),u=g.getOutLineStyle(o),f={};i?(f["fill-color"]=i["fill-color"],f["fill-opacity"]=i["fill-opacity"]):(f["fill-color"]="rgba(103, 194, 58, 0.6)",f["fill-opacity"]=.6),e.value?.addLayer({id:r,source:l,type:"fill",filter:["==",["geometry-type"],"Polygon"],paint:f});const n={"line-color":u["line-color"],"line-width":u["line-width"],"line-dasharray":u["line-dasharray"]||[]};u["line-opacity"]&&(n["line-opacity"]=u["line-opacity"]),e.value?.addLayer({id:r+"-outline",source:l,type:"line",filter:["==",["geometry-type"],"Polygon"],layout:{"line-join":"round","line-cap":"round"},paint:n});const d=o.fillConfig?{showLabel:o.fillConfig.displayLabel==="true",labelField:o.fillConfig.labelField||"FID",fontSize:o.fillConfig.labelSize||14,fontColor:o.fillConfig.labelColor||"#000000",fontFamily:o.fillConfig.labelFont||"SimSun"}:void 0,c=g.getLabelStyle(d);c&&e.value?.addLayer({id:r+"-label",type:"symbol",source:l,filter:["==",["geometry-type"],"Polygon"],layout:{"text-field":c["text-field"],"text-font":c["text-font"],"text-size":c["text-size"],"text-anchor":c["text-anchor"],"text-offset":c["text-offset"],"text-allow-overlap":c["text-allow-overlap"]},paint:{"text-color":c["text-color"]}})}function A(t,l,a,o){const r=a+"-line",i=g.getOutLineStyle(o),u={"line-color":i["line-color"],"line-width":i["line-width"]};i["line-dasharray"]&&(u["line-dasharray"]=i["line-dasharray"]),i["line-opacity"]&&(u["line-opacity"]=i["line-opacity"]),e.value?.addLayer({id:r,source:l,type:"line",filter:["==",["geometry-type"],"LineString"],layout:{"line-join":"round","line-cap":"round"},paint:u});const f=o.outlineConfig?{showLabel:o.outlineConfig.displayLabel==="true",labelField:o.outlineConfig.labelField||"FID",fontSize:o.outlineConfig.labelSize||14,fontColor:o.outlineConfig.labelColor||"#000000",fontFamily:o.outlineConfig.labelFont||"SimSun"}:void 0,n=g.getLabelStyle(f);n&&e.value?.addLayer({id:r+"-label",type:"symbol",source:l,filter:["==",["geometry-type"],"LineString"],layout:{"text-field":n["text-field"],"text-font":n["text-font"],"text-size":n["text-size"],"text-anchor":n["text-anchor"],"text-offset":n["text-offset"],"text-allow-overlap":n["text-allow-overlap"],"symbol-placement":"line-center"},paint:{"text-color":n["text-color"]}})}async function V(t,l,a,o){const r=a+"-point",i=g.getLayerStyle(t);if(console.log("renderPointGeometry pointStyle:",i),i&&i._useNewFormat){const n=`custom-icon-${t.id}-`;e.value?.listImages&&e.value.listImages().forEach(m=>{m.startsWith(n)&&e.value?.removeImage(m)});const d=i._circleConfigList||[],c=[];d.forEach(y=>{if(!(y.type==="custom"&&(y.value===""||y.value==null))&&y.renderMode==="color"){const m=y.type==="default"?"default":y.key,x=q(y.pointStyle||"地图点.svg",y.pointTintColor||"#67c23a",m).catch(p=>{console.error(`加载 SVG 图标失败: ${y.pointStyle}`,p)});c.push(x)}});try{await Promise.all(c),e.value?.addLayer({id:r,source:l,type:"symbol",filter:["==",["geometry-type"],"Point"],layout:{"icon-image":i["icon-image"],"icon-size":i["icon-size"],"icon-allow-overlap":!0,"icon-ignore-placement":!0}})}catch(y){console.error("加载图标失败:",y)}}else console.log("使用旧格式渲染点位 (circle)"),e.value?.addLayer({id:r,source:l,type:"circle",filter:["==",["geometry-type"],"Point"],paint:i});const u=o.symbolConfig?{showLabel:o.symbolConfig.displayLabel==="true",labelField:o.symbolConfig.labelField||"FID",fontSize:o.symbolConfig.labelSize||14,fontColor:o.symbolConfig.labelColor||"#000000",fontFamily:o.symbolConfig.labelFont||"SimSun"}:void 0,f=g.getLabelStyle(u);if(f){const n=f["text-color"],d=n==="#ffffff"||n==="rgb(255, 255, 255)"||n==="white";e.value?.addLayer({id:r+"-label",type:"symbol",source:l,filter:["==",["geometry-type"],"Point"],layout:{"text-field":f["text-field"],"text-font":f["text-font"],"text-size":f["text-size"],"text-anchor":"bottom","text-offset":[0,.5],"text-allow-overlap":!0,"text-ignore-placement":!0,visibility:"visible"},paint:{"text-color":f["text-color"],"text-halo-color":d?"#000000":"#ffffff","text-halo-width":2}})}}const O=L.ref([]);function P(t){if(!e.value){console.warn("地图实例未初始化,无法添加调查数据图层");return}se(t);const l={renderMode:"color",pointStyle:"circle",pointTintColor:"#02d2e0",pointSize:18,displayLabel:!1,labelSize:12,labelColor:"#000000",labelFont:"sans-serif"},a=t.layerPaintConfig?JSON.parse(t.layerPaintConfig):l;console.log("addResearchMapLayer layerPaintConfig:",a);const o=t.pointInfo||[];if(!o||o.length===0){console.error("点位数据缺失,无法添加点图层");return}a.renderMode==="hatMap"?R(t,o):a.renderMode==="icon"?B(t,o,a):G(t,o,a),K()}function R(t,l,a){const o=`${t.id}-heatmap-source`,r=`${t.id}-heatmap-layer`,i=l.map(n=>{let d=[0,0];return n.latitude&&n.longitude&&(d=[Number(n.longitude),Number(n.latitude)]),{type:"Feature",properties:{},geometry:{type:"Point",coordinates:d}}});e.value?.getSource(o)&&e.value?.removeSource(o),e.value?.getLayer(r)&&e.value?.removeLayer(r),e.value?.addSource(o,{type:"geojson",data:{type:"FeatureCollection",features:i}}),e.value?.addLayer({id:r,type:"heatmap",source:o,maxzoom:9,paint:{"heatmap-weight":1,"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,9,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(33,102,172,0)",.2,"blue",.4,"cyan",.6,"lime",.8,"yellow",1,"red"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,2,9,20],"heatmap-opacity":["interpolate",["linear"],["zoom"],7,1,9,0]}})}function B(t,l,a){console.log("addIconMarkers pointInfoList:",l),l.forEach((o,r)=>{let i=[0,0];o.latitude&&o.longitude?i=[Number(o.longitude),Number(o.latitude)]:o.latitudeStart&&o.longitudeStart&&(i=[Number(o.longitudeStart),Number(o.latitudeStart)]);const u=document.createElement("div");u.className="research-location-icon-el";const f=document.createElement("img");f.className="research-location-img-el",f.src=ie.mapIconBaseUrl+(a.iconImageName||"default-icon.png"),u.appendChild(f),u.onclick=d=>{ge(d,o)};const n=`${t.id}-research-point-${r}`;we(n,i,u)})}async function G(t,l,a){console.log("addColorMarkers pointInfoList:",l);const o=`${t.id}-color-points-source`,r=`${t.id}-color-points-layer`,i=a.pointStyle||"地图点.svg",u=a.pointTintColor||"#02d2e0";try{const f=await q(i,u,t.id);if(!f){console.error("SVG 图标加载失败,使用默认图标");return}const n=l.map(y=>{let m=[0,0];return y.latitude&&y.longitude?m=[Number(y.longitude),Number(y.latitude)]:y.latitudeStart&&y.longitudeStart&&(m=[Number(y.longitudeStart),Number(y.latitudeStart)]),{type:"Feature",properties:{...y,layerName:t.layerName},geometry:{type:"Point",coordinates:m}}});e.value?.getSource(o)&&e.value?.removeSource(o),e.value?.getLayer(r)&&e.value?.removeLayer(r),e.value?.addSource(o,{type:"geojson",data:{type:"FeatureCollection",features:n}}),e.value?.addLayer({id:r,type:"symbol",source:o,layout:{"icon-image":f,"icon-size":a.pointSize?a.pointSize/100:.18,"icon-anchor":"center","icon-allow-overlap":!0,"text-allow-overlap":!0},paint:{}}),e.value?.on("click",r,y=>{if(y.features&&y.features.length>0){const m=y.features[0].properties;console.log("Point clicked:",m),ge(y.originalEvent,m)}}),e.value?.on("mouseenter",r,()=>{e.value.getCanvas().style.cursor="pointer"}),e.value?.on("mouseleave",r,()=>{e.value.getCanvas().style.cursor=""})}catch(f){console.error("加载 SVG 图标失败:",f)}}const D=Object.assign({"./widgets/svg/24gf-square.svg":J.方形Svg,"./widgets/svg/hexagon-fill.svg":J.六边形Svg,"./widgets/svg/人-地图点位2x.svg":J.人地图点位Svg,"./widgets/svg/地图点 (1).svg":J.地图点1Svg,"./widgets/svg/地图点 (2).svg":J.地图点2Svg,"./widgets/svg/地图点 (3).svg":J.地图点3Svg,"./widgets/svg/地图点 (4).svg":J.地图点4Svg,"./widgets/svg/地图点-红.svg":J.地图点红Svg,"./widgets/svg/地图点.svg":J.地图点Svg,"./widgets/svg/地图点位 (1).svg":J.地图点位1Svg,"./widgets/svg/地图点位.svg":J.地图点位Svg,"./widgets/svg/实五角星.svg":J.实五角星Svg,"./widgets/svg/标记地图点位.svg":J.标记地图点位Svg,"./widgets/svg/正三角形.svg":J.正三角形Svg});function W(t){const l={SimSun:["Arial Unicode MS Regular"],SimHei:["Arial Unicode MS Bold"],DengXian:["Arial Unicode MS Bold"]},a=l[t]||l.DengXian;return console.log("字体栈配置:",t,"->",a),a}async function q(t,l,a){const o=l.replace(/[^a-zA-Z0-9]/g,""),r=`custom-icon-${String(a)}-${t.replace(".svg","")}-${o}`;if(e.value?.hasImage(r))return r;try{const i=`./widgets/svg/${t}`,u=D[i];if(!u)throw new Error(`SVG 文件未找到: ${t},请将文件放到 widgets/svg/ 目录下`);const f=u.replace("{color}",l),n=new Image,d=new Blob([f],{type:"image/svg+xml"}),c=URL.createObjectURL(d);return await new Promise((y,m)=>{n.onload=()=>y(),n.onerror=x=>{console.error("SVG Image 加载失败",x),m(x)},n.src=c}),e.value?.addImage(r,n),URL.revokeObjectURL(c),r}catch(i){throw console.error("加载 SVG 失败:",i),i}}async function _(t,l,a){const o=`${t.id}-color-points-source`,r=`${t.id}-color-points-layer`,i=a.pointStyle||"地图点.svg",u=a.pointTintColor||"#02d2e0";try{const f=`custom-icon-${t.id}-`;e.value?.listImages&&e.value.listImages().forEach(k=>{k.startsWith(f)&&e.value?.removeImage(k)});const n=await q(i,u,t.id);if(!n){console.error("SVG 图标加载失败,使用默认图标");return}const d=l.map(p=>{let k=[0,0];return p.latitude&&p.longitude?k=[Number(p.longitude),Number(p.latitude)]:p.latitudeStart&&p.longitudeStart&&(k=[Number(p.longitudeStart),Number(p.latitudeStart)]),{type:"Feature",properties:{...p,layerName:t.layerName},geometry:{type:"Point",coordinates:k}}});e.value?.getSource(o)&&e.value?.removeSource(o),e.value?.getLayer(r)&&e.value?.removeLayer(r);const m=`${t.id}-color-points-text`;if(e.value?.getLayer(m)&&e.value?.removeLayer(m),e.value?.addSource(o,{type:"geojson",data:{type:"FeatureCollection",features:d}}),e.value?.addLayer({id:r,type:"symbol",source:o,layout:{"icon-image":n,"icon-size":a.pointSize?a.pointSize/100:.18,"icon-anchor":"center","icon-allow-overlap":!0,"text-allow-overlap":!0},paint:{}}),a.displayLabel){console.log("准备添加文本图层",{displayLabel:a.displayLabel,labelSize:a.labelSize,labelColor:a.labelColor,labelFont:a.labelFont});try{e.value?.addLayer({id:m,type:"symbol",source:o,layout:{"text-field":["get","layerName"],"text-font":W(a.labelFont||"DengXian"),"text-size":a.labelSize||11,"text-anchor":"top","text-offset":[0,1],"text-allow-overlap":!0,"text-optional":!1},paint:{"text-color":a.labelColor||"#000000","text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-width":1}}),console.log("文本图层已成功添加:",m)}catch(p){console.error("添加文本图层失败:",p)}}e.value?.on("click",r,p=>{if(p.features&&p.features.length>0){const k=p.features[0].properties;console.log("Point clicked:",k)}}),e.value?.on("mouseenter",r,()=>{e.value.getCanvas().style.cursor="pointer"}),e.value?.on("mouseleave",r,()=>{e.value.getCanvas().style.cursor=""})}catch(f){console.error("加载 SVG 图标失败:",f)}}async function ee(t,l,a){const o=`${t.id}-icon-points-source`,r=`${t.id}-icon-points-layer`,i=a.iconImageName||"default-icon.png";console.log("addIconMarkersForGeoJSON 开始",{mapLayerId:t.id,iconImageName:i,pointCount:l.length});const u=l.map(y=>{let m=[0,0];return y.latitude&&y.longitude?m=[Number(y.longitude),Number(y.latitude)]:y.latitudeStart&&y.longitudeStart&&(m=[Number(y.longitudeStart),Number(y.latitudeStart)]),{type:"Feature",properties:{...y,layerName:t.layerName},geometry:{type:"Point",coordinates:m}}});e.value?.getSource(o)&&(e.value?.removeSource(o),console.log("移除旧数据源:",o)),e.value?.getLayer(r)&&(e.value?.removeLayer(r),console.log("移除旧图层:",r));const d=`${t.id}-icon-points-text`;e.value?.getLayer(d)&&e.value?.removeLayer(d);try{const y=await re(i,t.id);if(console.log("图标名称:",y),e.value?.addSource(o,{type:"geojson",data:{type:"FeatureCollection",features:u}}),console.log("数据源已添加:",o),e.value?.addLayer({id:r,type:"symbol",source:o,layout:{"icon-image":y,"icon-size":a.pointSize?a.pointSize/100:.5,"icon-anchor":"center","icon-allow-overlap":!0,"text-allow-overlap":!0},paint:{}}),console.log("图层已添加:",r,"icon-size:",a.pointSize?a.pointSize/100:.5),a.displayLabel){console.log("准备添加文本图层",{displayLabel:a.displayLabel,labelSize:a.labelSize,labelColor:a.labelColor,labelFont:a.labelFont});try{e.value?.addLayer({id:d,type:"symbol",source:o,layout:{"text-field":["get","layerName"],"text-font":W(a.labelFont||"DengXian"),"text-size":a.labelSize||11,"text-anchor":"top","text-offset":[0,1],"text-allow-overlap":!0,"text-optional":!1},paint:{"text-color":a.labelColor||"#000000","text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-width":1}}),console.log("文本图层已成功添加:",d)}catch(m){console.error("添加文本图层失败:",m)}}e.value?.on("click",r,m=>{if(m.features&&m.features.length>0){const x=m.features[0].properties;console.log("Point clicked:",x)}}),e.value?.on("mouseenter",r,()=>{e.value.getCanvas().style.cursor="pointer"}),e.value?.on("mouseleave",r,()=>{e.value.getCanvas().style.cursor=""})}catch(y){throw console.error("添加图标图层失败:",y),y}}async function re(t,l){const a=`custom-icon-img-${String(l)}-${t}`;if(e.value?.hasImage(a))return a;try{const o=ie.mapIconBaseUrl+t;console.log("开始加载图标:",o);const r=new Image;return r.crossOrigin="Anonymous",await new Promise((i,u)=>{r.onload=()=>{console.log("图标加载成功:",o,"尺寸:",r.width,"x",r.height),i()},r.onerror=f=>{console.error("图标加载失败:",o,f),u(new Error(`Failed to load image: ${o}`))},r.src=o}),e.value&&(e.value.addImage(a,r),console.log("图标已添加到地图:",a)),a}catch(o){throw console.error("加载图标图片失败:",t,o),o}}function we(t,l,a){const o=O.value.find(u=>u.id===t);o&&o.marker&&o.marker?.remove();const r=new ae.Marker(a).setLngLat(l).setOffset([0,-22]).addTo(e.value),i=O.value.findIndex(u=>u.id===t);i>-1?O.value[i].marker=r:O.value.push({id:t,marker:r})}function ge(t,l){console.log("Point clicked:",l)}const me=L.ref(),ve=L.ref();function K(){me.value&&me.value.hidePopup(),ve.value&&ve.value.hidePopup(),pe.value&&pe.value.hidePopup()}const pe=L.ref();function se(t){const l=S.value.find(a=>a.id===t.id);l?Object.assign(l,t):S.value.push(t)}function Pe(){if(!s.loadIcon)return Promise.resolve(!0);if(!e.value)return Promise.reject(new Error("地图实例未初始化,无法加载图标资源"));const t=ie.mapIconNameList.map(l=>new Promise((a,o)=>{e.value?.loadImage(ie.mapIconBaseUrl+l.fileName,(r,i)=>{r?o(r):(i&&e.value?.addImage(l.fileName,i),a(!0))})}));return Promise.all(t)}function ce(t){console.log("removeThirdPartyLayer---->",t);const l=g.getLayerId(t),a=g.getLayerType(t),o=e.value?.getLayer(l);console.log("currentLayerType---->",a,o);let r=-1;if(S.value.forEach((i,u)=>{i.id==t.id&&(r=u)}),r>-1&&S.value.splice(r,1),t.layerType==="shp"&&t.layerShapes&&t.layerShapes.split(",").map(u=>u.trim()).length>1){console.log("移除多几何类型图层"),["-polygon","-polygon-outline","-polygon-label","-line","-line-label","-point","-point-label"].forEach(d=>{const c=l+d;e.value?.getLayer(c)&&(console.log("移除图层---->",c),e.value?.removeLayer(c))});const f=g.getSourceId(t);e.value?.getSource(f)&&(console.log("移除数据源---->",f),e.value?.removeSource(f)),K();return}if(o){const i=e.value?.getLayer(l);if(i){const u=i.source;e.value?.removeLayer(l),t.geoJSON&&u&&e.value?.removeSource(u)}}if(a=="fill"){console.log("移除单一几何类型-面图层的边框");const i=l+"-outline";e.value?.getLayer(i)&&e.value?.removeLayer(i);const f=l+"-label";e.value?.getLayer(f)&&e.value?.removeLayer(f)}else if(a=="line"){console.log("移除单一几何类型-线图层");const i=l+"-label";e.value?.getLayer(i)&&e.value?.removeLayer(i)}else if(a=="circle"){console.log("移除单一几何类型-点图层");const i=l+"-label";e.value?.getLayer(i)&&e.value?.removeLayer(i)}K()}L.watch(()=>s.mapLayerEntity,t=>{if(t&&e.value){let l;Array.isArray(t)?l=t.find(a=>a.layerType==="map-layer"):l=t,l&&fe(l,e.value,s.mapRootId,v,b)}},{deep:!0}),L.watch(()=>v.mapInstances[s.mapRootId]?.activeMapLayer,()=>{e.value&&C()},{immediate:!0}),L.watch(()=>v.mapInstances[s.mapRootId]?.zoom,()=>{e.value&&!b.value&&e.value.flyTo({zoom:v.mapInstances[s.mapRootId].zoom,duration:500})},{immediate:!0}),L.watch(()=>v.mapInstances[s.mapRootId]?.pitch,()=>{e.value&&!b.value&&(v.isDragging?e.value.setPitch(v.mapInstances[s.mapRootId].pitch):e.value.flyTo({pitch:v.mapInstances[s.mapRootId].pitch,duration:1e3}))},{immediate:!0}),L.watch(()=>v.mapInstances[s.mapRootId]?.bearing,()=>{e.value&&!b.value&&(v.isDragging?e.value.setBearing(v.mapInstances[s.mapRootId].bearing):e.value.flyTo({bearing:v.mapInstances[s.mapRootId].bearing,duration:1e3}))},{immediate:!0});const Te=t=>{e.value&&(e.value.flyTo({zoom:4,duration:400}),setTimeout(async()=>{if(!t)return;let l=g.getSourceId(t);if(t.geoJSON&&(l=g.getLayerId(t)),t.url&&!t.geoJSON)try{const r=t.url.replace("bjhweb","bjh"),u=await(await fetch(r)).json();if(u&&u.features&&u.features.length>0){const f=ne.bbox(u);if(f&&!oe(f)){e.value?.fitBounds([[f[0],f[1]],[f[2],f[3]]],{padding:{top:50,bottom:50,left:50,right:50}});return}}}catch(r){console.warn("从URL获取GeoJSON数据失败,尝试其他方法",r)}const a=e.value?.getSource(l);if(a&&a._data&&a._data.features){const r=a._data,i=ne.bbox(r);if(!oe(i)){e.value?.fitBounds([[i[0],i[1]],[i[2],i[3]]],{padding:{top:50,bottom:50,left:50,right:50}});return}}const o=e.value?.querySourceFeatures(l);if(o&&o.length>0){const r=ne.featureCollection(o),i=ne.bbox(r);oe(i)?console.warn("获取的边界框无效"):e.value?.fitBounds([[i[0],i[1]],[i[2],i[3]]],{padding:{top:50,bottom:50,left:50,right:50}})}else console.warn("没有查询到图层数据")},500))};function oe(t){return t[0]===1/0||t[1]===1/0||t[2]===-1/0||t[3]===-1/0||isNaN(t[0])||isNaN(t[1])||isNaN(t[2])||isNaN(t[3])}L.provide("resetMapView",h),L.provide("mapRootId",s.mapRootId),L.provide(Ce.mapInstanceKey,e),L.provide(Ce.thirdPartyLayersKey,S);const xe=({mapRootId:t,layer:l})=>{t===s.mapRootId&&(console.log("接收到渲染地理数据事件",l),l.layerDataType=="research"&&z(l))};H.renderGeographicDataKeyBus.on(xe);function Fe(){if(!e.value){console.warn("地图实例未初始化,无法清除图层");return}console.log("开始清除所有图层"),e.value.setStyle(v.getCurrentMapStyle(s.mapRootId)),S.value=[],O.value.forEach(t=>{t.marker?.remove()}),O.value=[],console.log("所有图层已清除")}E({mapInstance:e,initMap:I,handleSetMapStyle:C,resetMapView:h,addThirdPartyLayer:z,addResearchMapLayer:P,addTifLayer:U,processGeoTIFF:X,removeTifLayer:Q,clearAllLayers:Fe}),L.onBeforeMount(()=>{let t=s.center||[120.1551,30.2741],l=s.zoom,a=s.pitch,o=0,r=Y.MapLayerType.SATELLITE,i;if(s.mapLayerEntity&&(Array.isArray(s.mapLayerEntity)?i=s.mapLayerEntity.find(u=>u.layerType==="map-layer"):i=s.mapLayerEntity),i?.layerPaintConfig)try{const u=JSON.parse(i.layerPaintConfig);if(u.defaultCenter)if(typeof u.defaultCenter=="string"){const f=u.defaultCenter.split(",").map(n=>parseFloat(n.trim()));t=[f[0],f[1]]}else Array.isArray(u.defaultCenter)&&(t=u.defaultCenter);u.defaultZoom!==void 0&&(l=parseFloat(u.defaultZoom)),u.bearing!==void 0&&(o=parseFloat(u.bearing)),u.pitch!==void 0&&(a=parseFloat(u.pitch)),u.baseMap&&(r=u.baseMap==="satellite"?Y.MapLayerType.SATELLITE:u.baseMap==="vector"?Y.MapLayerType.VECTOR:Y.MapLayerType.TOPOGRAPHIC)}catch(u){console.error("解析 layerPaintConfig 失败:",u)}v.mapInstances[s.mapRootId]={maxZoom:s.maxZoom,minZoom:s.minZoom,zoom:l,pitch:a,threeDPitch:a,center:t,bearing:o,is3DMode:a>0,activeMapLayer:r,mapHeight:600,mapWidth:600,mapX:0,mapY:0}});async function Le(t){se(t);const l={renderMode:"color",pointStyle:"circle",pointTintColor:"#02d2e0",pointSize:10,displayLabel:!0,labelSize:12,labelColor:"#000000",labelFont:"sans-serif"},a=t.layerPaintConfig?JSON.parse(t.layerPaintConfig):l;console.log("addRowDataMapLayer layerPaintConfig:",a);const o=t.pointInfo||[];if(console.log("mapLayer 对象:",{id:t.id,layerName:t.layerName,pointInfoCount:o.length,firstPointInfo:o[0],allMapLayerKeys:Object.keys(t)}),!o||o.length===0){console.error("点位数据缺失,无法添加点图层");return}a.renderMode==="hatMap"?R(t,o):a.renderMode==="icon"?(console.log("addRowDataMapLayer icon mode, pointInfoList:",o),await ee(t,o,a)):(console.log("addRowDataMapLayer color mode, pointInfoList:",o),await _(t,o,a)),K()}function ze(t){ue(t);const l=`${t.id}-geo-line-layer`,a=`${t.id}-research-point`;e.value?.getLayer(l)&&e.value?.removeLayer(l);let r=-1;O.value.forEach((i,u)=>{i.id==a&&(r=u)}),r>-1&&(O.value[r].marker&&O.value[r].marker?.remove(),O.value.splice(r,1)),K()}const be=async({mapRootId:t,topic:l,visible:a,delLayer:o})=>{if(console.log("接收到图层切换事件",s.mapRootId,t,l),t===s.mapRootId&&e.value){const r=l.layerType==="species-group"||l.layerType==="interest-point",i=l.layerType==="sample-group"||l.layerType==="track";a?(console.log("delLayer",o),o&&(console.log("mmb: 删除图层",l),ce(l)),r?(le(l),Le(l)):i?l.layerDataType=="point"?(le(l),Le(l)):l.layerDataType=="line"&&(Se(l),he(l)):(ce(l),z(l))):r?le(l):i?l.layerDataType=="point"?le(l):l.layerDataType=="line"&&Se(l):l.layerDataType=="research"?ze(l):ce(l),l.layerType=="map-layer"&&(console.log("设置地图配置000000000000000000000000",l),fe(l,e.value,s.mapRootId,v,b))}};function ue(t){let l=-1;S.value.forEach((a,o)=>{a.id==t.id&&(l=o)}),l>-1&&S.value.splice(l,1)}function le(t){ue(t);const l=`${t.id}-heatmap-source`,a=`${t.id}-heatmap-layer`;e.value?.getLayer(a)&&e.value?.removeLayer(a),e.value?.getSource(l)&&e.value?.removeSource(l);const i=`${t.id}-color-points-source`,u=`${t.id}-color-points-layer`,f=`${t.id}-color-points-text`;e.value?.getLayer(u)&&e.value?.removeLayer(u),e.value?.getLayer(f)&&e.value?.removeLayer(f),e.value?.getSource(i)&&e.value?.removeSource(i);const y=`${t.id}-icon-points-source`,m=`${t.id}-icon-points-layer`,x=`${t.id}-icon-points-text`;e.value?.getLayer(m)&&e.value?.removeLayer(m),e.value?.getLayer(x)&&e.value?.removeLayer(x),e.value?.getSource(y)&&e.value?.removeSource(y),(t.pointInfo||[]).forEach((qe,Ne)=>{const Re=`${t.id}-research-point-${Ne}`,de=O.value.findIndex(ke=>ke.id===Re);de>-1&&(O.value[de].marker?.remove(),O.value.splice(de,1))}),K()}async function he(t){if(!e.value){console.warn("地图实例未初始化,无法添加线图层");return}se(t);const l=t.layerPaintConfig?JSON.parse(t.layerPaintConfig):{lineStyle:"solid-line",lineColor:"#000",lineWidth:4,lineOpacity:100,textColor:"#000",displayLabel:!0,labelSize:12,labelColor:"#000",labelFont:"DengXian"};console.log("addLineMapLayer layerPaintConfig:",l);const a=t.pointInfo||[];if(!a||a.length<2){console.error("点位数据不足,需要至少2个点位来绘制线条");return}const o=a.map(d=>[Number(d.longitude),Number(d.latitude)]),r=`${t.id}-line-source`,i=`${t.id}-line-layer`;e.value?.getSource(r)&&e.value?.removeSource(r),e.value?.getLayer(i)&&e.value?.removeLayer(i),e.value?.addSource(r,{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:o},properties:{layerName:t.layerName}}]}});const n={"line-color":l.lineColor||"#000","line-width":l.lineWidth||4};switch(l.lineStyle){case"dotted":case"dot-line":n["line-dasharray"]=[5.2,5.2];break;case"simple-dash":case"dashed":n["line-dasharray"]=[8,4];break;case"dot-dash":n["line-dasharray"]=[5,5,1,5];break;case"long-dash":n["line-dasharray"]=[20,5];break;case"complex-pattern":n["line-dasharray"]=[10,3,3,3];break}if(e.value?.addLayer({id:i,type:"line",source:r,layout:{"line-join":"round","line-cap":"round"},paint:n}),l.displayLabel&&o.length>0){const d=`${t.id}-line-text`,c=Math.floor(o.length/2),y=o[c];e.value?.getLayer(d)&&e.value?.removeLayer(d);const x=`${t.id}-line-text-source`;e.value?.getSource(x)&&e.value?.removeSource(x),e.value?.addSource(x,{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:y},properties:{layerName:t.layerName}}]}}),e.value?.addLayer({id:d,type:"symbol",source:x,layout:{"text-field":["get","layerName"],"text-font":W(l.labelFont||"DengXian"),"text-size":l.labelSize||12,"text-anchor":"top","text-offset":[0,0],"text-allow-overlap":!0},paint:{"text-color":l.labelColor||"#000","text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-width":1}}),Me(t)}K()}function Me(t){if(!e.value)return;console.log("定位到样线中心",t);const l=t.pointInfo||[];if(!l||l.length<2){console.error("点位数据不足,无法计算样线中心");return}let a=Number.MAX_VALUE,o=Number.MAX_VALUE,r=Number.MIN_VALUE,i=Number.MIN_VALUE;l.forEach(f=>{const n=Number(f.longitude),d=Number(f.latitude);n<a&&(a=n),n>r&&(r=n),d<o&&(o=d),d>i&&(i=d)});const u=[[a,o],[r,i]];oe([a,o,r,i])?console.warn("样线边界框无效"):(e.value?.fitBounds(u,{padding:{top:50,bottom:50,left:50,right:50},duration:1e3}),console.log("已定位到样线:",u))}function Se(t){ue(t);const l=`${t.id}-line-source`,a=`${t.id}-line-layer`,o=`${t.id}-line-text`,r=`${t.id}-line-text-source`;e.value?.getLayer(a)&&e.value?.removeLayer(a),e.value?.getSource(l)&&e.value?.removeSource(l),e.value?.getLayer(o)&&e.value?.removeLayer(o),e.value?.getSource(r)&&e.value?.removeSource(r),K()}const Ie=({mapRootId:t,layer:l})=>{console.log("接收到定位到图层中心事件",l),t===s.mapRootId&&e.value&&Te(l)};return L.onMounted(()=>{v.setMapBoxToken(s.mapBoxToken),v.setTdtToken(s.tdtToken),s.amapKey&&v.setAmapKey(s.amapKey),v.setMaxZoom(s.mapRootId,s.maxZoom),v.setMinZoom(s.mapRootId,s.minZoom);let t;s.mapLayerEntity&&(Array.isArray(s.mapLayerEntity)?t=s.mapLayerEntity.find(a=>a.layerType==="map-layer"):t=s.mapLayerEntity);const l=t?.layerPaintConfig;l||(v.setZoom(s.mapRootId,s.zoom),v.setPitch(s.mapRootId,s.pitch)),setTimeout(()=>{l||v.setThreeDPitch(s.mapRootId,s.pitch),l?I():s.center&&Array.isArray(s.center)&&s.center.length>0?(v.setCenter(s.mapRootId,s.center),I()):navigator.geolocation.getCurrentPosition(a=>{const{latitude:o,longitude:r}=a.coords;v.setCenter(s.mapRootId,[r,o]),I()},()=>{v.setCenter(s.mapRootId,[104.1954,35.8617]),v.setZoom(s.mapRootId,4),I()}),v.mapInstances[s.mapRootId]&&(v.mapInstances[s.mapRootId].mapHeight=T.value?.clientHeight??600,v.mapInstances[s.mapRootId].mapWidth=T.value?.clientWidth??600,v.mapInstances[s.mapRootId].mapX=T.value?.getBoundingClientRect().left??600,v.mapInstances[s.mapRootId].mapY=T.value?.getBoundingClientRect().top??600)},200),console.log("mapStore.mapInstances[mapRootId]--->",s.mapRootId),H.toggleGeographicLayerKeyBus.on(be),H.locateToLayerCenterKeyBus.on(Ie)}),L.onUnmounted(()=>{console.log("组件卸载,清理事件监听"),H.renderGeographicDataKeyBus.off(xe),H.toggleGeographicLayerKeyBus.off(be),H.locateToLayerCenterKeyBus.off(Ie)}),(t,l)=>(L.openBlock(),L.createElementBlock("div",{class:"qy-map",ref_key:"mapRoot",ref:T},[L.createElementVNode("div",{class:"hiper-map-warper",id:s.mapRootId},[L.createElementVNode("div",je,[L.renderSlot(t.$slots,"leftBar",{},void 0,!0)]),L.createElementVNode("div",Ve,[L.renderSlot(t.$slots,"rightBar",{},void 0,!0)]),L.createElementVNode("div",{class:"top-bar",style:L.normalizeStyle({left:L.unref(v).topicVisible?L.unref(v).topicWidth+50+"px":"70px"})},[L.renderSlot(t.$slots,"topBar",{},void 0,!0)],4),L.createElementVNode("div",Je,[L.renderSlot(t.$slots,"bottomBar",{},void 0,!0)]),L.renderSlot(t.$slots,"default",{},void 0,!0)],8,Ge)],512))}}),Ue=$e._export_sfc(Ze,[["__scopeId","data-v-c9760b7a"]]);exports.default=Ue;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),Ve=require("mapbox-gl"),$t=require("../chunks/mapStore-dFPYwvXT.js");;/* empty css */const Ie=require("../chunks/map-CAu4wyVU.js"),w=require("../chunks/utils-CrwGKkIz.js"),Ce=require("../chunks/EventKeys-BvyQ87Zy.js"),Re=require("../chunks/constant-Bq4ASE9Q.js"),Mt=require("@turf/turf"),pt=require("../chunks/ProvideKeys-91lTuLnq.js"),At=require("../chunks/geotiff-OzcRsIeD.js"),Pe=require("element-plus"),je=require("../chunks/index-C-WIOEu8.js"),ne=require("@vueuse/core"),Le=require("../chunks/index-B6SD5IcP.js"),ge=require("../chunks/aria-B5rZ0WFy.js"),be=require("@element-plus/icons-vue"),oe=require("../chunks/style-DiDWGUIe.js"),nt=require("../chunks/index-CD4bijv7.js"),at=require("../chunks/index-BoFuR9-k.js"),Vt=require("../chunks/use-global-config-PaSl-b_9.js"),Rt=require("../chunks/debounce-CHS-N31c.js"),Bt=require("../chunks/vnode-CvqQoLhR.js"),Je=require("../chunks/_plugin-vue_export-helper-BHFhmbuH.js");function Gt(i){const v=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const p in i)if(p!=="default"){const S=Object.getOwnPropertyDescriptor(i,p);Object.defineProperty(v,p,S.get?S:{enumerable:!0,get:()=>i[p]})}}return v.default=i,Object.freeze(v)}const Be=Gt(Mt);var Dt="Expected a function";function Ge(i,v,p){var S=!0,g=!0;if(typeof i!="function")throw new TypeError(Dt);return oe.isObject(p)&&(S="leading"in p?!!p.leading:S,g="trailing"in p?!!p.trailing:g),Rt.debounce(i,v,{leading:S,maxWait:v,trailing:g})}const jt=oe.buildProps({urlList:{type:oe.definePropType(Array),default:()=>nt.mutable([])},zIndex:{type:Number},initialIndex:{type:Number,default:0},infinite:{type:Boolean,default:!0},hideOnClickModal:Boolean,teleported:Boolean,closeOnPressEscape:{type:Boolean,default:!0},zoomRate:{type:Number,default:1.2},scale:{type:Number,default:1},minScale:{type:Number,default:.2},maxScale:{type:Number,default:7},showProgress:Boolean,crossorigin:{type:oe.definePropType(String)}}),Jt={close:()=>!0,error:i=>i instanceof Event,switch:i=>oe.isNumber(i),rotate:i=>oe.isNumber(i)},Wt=o.defineComponent({name:"ElImageViewer"}),Ut=o.defineComponent({...Wt,props:jt,emits:Jt,setup(i,{expose:v,emit:p}){var S;const g=i,C={CONTAIN:{name:"contain",icon:o.markRaw(be.FullScreen)},ORIGINAL:{name:"original",icon:o.markRaw(be.ScaleToOriginal)}};let z;const{t:I}=at.useLocale(),O=oe.useNamespace("image-viewer"),{nextZIndex:V}=at.useZIndex(),L=o.ref(),e=o.ref(),R=o.effectScope(),G=o.computed(()=>{const{scale:$,minScale:_,maxScale:Z}=g;return ne.clamp($,_,Z)}),F=o.ref(!0),k=o.ref(!1),P=o.ref(!1),x=o.ref(g.initialIndex),M=o.shallowRef(C.CONTAIN),E=o.ref({scale:G.value,deg:0,offsetX:0,offsetY:0,enableTransition:!1}),j=o.ref((S=g.zIndex)!=null?S:V());je.useLockscreen(P,{ns:O});const U=o.computed(()=>{const{urlList:$}=g;return $.length<=1}),D=o.computed(()=>x.value===0),K=o.computed(()=>x.value===g.urlList.length-1),J=o.computed(()=>g.urlList[x.value]),Y=o.computed(()=>[O.e("btn"),O.e("prev"),O.is("disabled",!g.infinite&&D.value)]),H=o.computed(()=>[O.e("btn"),O.e("next"),O.is("disabled",!g.infinite&&K.value)]),te=o.computed(()=>{const{scale:$,deg:_,offsetX:Z,offsetY:de,enableTransition:fe}=E.value;let se=Z/$,ye=de/$;const xe=_*Math.PI/180,me=Math.cos(xe),ve=Math.sin(xe);se=se*me+ye*ve,ye=ye*me-Z/$*ve;const Fe={transform:`scale(${$}) rotate(${_}deg) translate(${se}px, ${ye}px)`,transition:fe?"transform .3s":""};return M.value.name===C.CONTAIN.name&&(Fe.maxWidth=Fe.maxHeight="100%"),Fe}),q=o.computed(()=>`${x.value+1} / ${g.urlList.length}`);function le(){ie(),z?.(),P.value=!1,p("close")}function Q(){const $=Ge(Z=>{switch(Le.getEventCode(Z)){case Le.EVENT_CODE.esc:g.closeOnPressEscape&&le();break;case Le.EVENT_CODE.space:Te();break;case Le.EVENT_CODE.left:Ee();break;case Le.EVENT_CODE.up:ue("zoomIn");break;case Le.EVENT_CODE.right:ze();break;case Le.EVENT_CODE.down:ue("zoomOut");break}}),_=Ge(Z=>{const de=Z.deltaY||Z.deltaX;ue(de<0?"zoomIn":"zoomOut",{zoomRate:g.zoomRate,enableTransition:!1})});R.run(()=>{ne.useEventListener(document,"keydown",$),ne.useEventListener(L,"wheel",_)})}function ie(){R.stop()}function A(){F.value=!1}function ae($){k.value=!0,F.value=!1,p("error",$),$.target.alt=I("el.image.error")}function re($){if(F.value||$.button!==0||!L.value)return;E.value.enableTransition=!1;const{offsetX:_,offsetY:Z}=E.value,de=$.pageX,fe=$.pageY,se=Ge(me=>{E.value={...E.value,offsetX:_+me.pageX-de,offsetY:Z+me.pageY-fe}}),ye=ne.useEventListener(document,"mousemove",se),xe=ne.useEventListener(document,"mouseup",()=>{ye(),xe()});$.preventDefault()}function Se($){if(F.value||!L.value||$.touches.length!==1)return;E.value.enableTransition=!1;const{offsetX:_,offsetY:Z}=E.value,{pageX:de,pageY:fe}=$.touches[0],se=Ge(me=>{const ve=me.touches[0];E.value={...E.value,offsetX:_+ve.pageX-de,offsetY:Z+ve.pageY-fe}}),ye=ne.useEventListener(document,"touchmove",se),xe=ne.useEventListener(document,"touchend",()=>{ye(),xe()});$.preventDefault()}function Ne(){E.value={scale:G.value,deg:0,offsetX:0,offsetY:0,enableTransition:!1}}function Te(){if(F.value||k.value)return;const $=Vt.keysOf(C),_=Object.values(C),Z=M.value.name,fe=(_.findIndex(se=>se.name===Z)+1)%$.length;M.value=C[$[fe]],Ne()}function ke($){k.value=!1;const _=g.urlList.length;x.value=($+_)%_}function Ee(){D.value&&!g.infinite||ke(x.value-1)}function ze(){K.value&&!g.infinite||ke(x.value+1)}function ue($,_={}){if(F.value||k.value)return;const{minScale:Z,maxScale:de}=g,{zoomRate:fe,rotateDeg:se,enableTransition:ye}={zoomRate:g.zoomRate,rotateDeg:90,enableTransition:!0,..._};switch($){case"zoomOut":E.value.scale>Z&&(E.value.scale=Number.parseFloat((E.value.scale/fe).toFixed(3)));break;case"zoomIn":E.value.scale<de&&(E.value.scale=Number.parseFloat((E.value.scale*fe).toFixed(3)));break;case"clockwise":E.value.deg+=se,p("rotate",E.value.deg);break;case"anticlockwise":E.value.deg-=se,p("rotate",E.value.deg);break}E.value.enableTransition=ye}function We($){var _;((_=$.detail)==null?void 0:_.focusReason)==="pointer"&&$.preventDefault()}function Oe(){g.closeOnPressEscape&&le()}function $e($){if($.ctrlKey){if($.deltaY<0)return $.preventDefault(),!1;if($.deltaY>0)return $.preventDefault(),!1}}return o.watch(()=>G.value,$=>{E.value.scale=$}),o.watch(J,()=>{o.nextTick(()=>{const $=e.value;$?.complete||(F.value=!0)})}),o.watch(x,$=>{Ne(),p("switch",$)}),o.onMounted(()=>{P.value=!0,Q(),z=ne.useEventListener("wheel",$e,{passive:!1})}),v({setActiveItem:ke}),($,_)=>(o.openBlock(),o.createBlock(o.unref(Le.ElTeleport),{to:"body",disabled:!$.teleported},{default:o.withCtx(()=>[o.createVNode(o.Transition,{name:"viewer-fade",appear:""},{default:o.withCtx(()=>[o.createElementVNode("div",{ref_key:"wrapper",ref:L,tabindex:-1,class:o.normalizeClass(o.unref(O).e("wrapper")),style:o.normalizeStyle({zIndex:j.value})},[o.createVNode(o.unref(Le.ElFocusTrap),{loop:"",trapped:"","focus-trap-el":L.value,"focus-start-el":"container",onFocusoutPrevented:We,onReleaseRequested:Oe},{default:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(o.unref(O).e("mask")),onClick:o.withModifiers(Z=>$.hideOnClickModal&&le(),["self"])},null,10,["onClick"]),o.createCommentVNode(" CLOSE "),o.createElementVNode("span",{class:o.normalizeClass([o.unref(O).e("btn"),o.unref(O).e("close")]),onClick:le},[o.createVNode(o.unref(ge.ElIcon),null,{default:o.withCtx(()=>[o.createVNode(o.unref(be.Close))]),_:1})],2),o.createCommentVNode(" ARROW "),o.unref(U)?o.createCommentVNode("v-if",!0):(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createElementVNode("span",{class:o.normalizeClass(o.unref(Y)),onClick:Ee},[o.createVNode(o.unref(ge.ElIcon),null,{default:o.withCtx(()=>[o.createVNode(o.unref(be.ArrowLeft))]),_:1})],2),o.createElementVNode("span",{class:o.normalizeClass(o.unref(H)),onClick:ze},[o.createVNode(o.unref(ge.ElIcon),null,{default:o.withCtx(()=>[o.createVNode(o.unref(be.ArrowRight))]),_:1})],2)],64)),$.$slots.progress||$.showProgress?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass([o.unref(O).e("btn"),o.unref(O).e("progress")])},[o.renderSlot($.$slots,"progress",{activeIndex:x.value,total:$.urlList.length},()=>[o.createTextVNode(o.toDisplayString(o.unref(q)),1)])],2)):o.createCommentVNode("v-if",!0),o.createCommentVNode(" ACTIONS "),o.createElementVNode("div",{class:o.normalizeClass([o.unref(O).e("btn"),o.unref(O).e("actions")])},[o.createElementVNode("div",{class:o.normalizeClass(o.unref(O).e("actions__inner"))},[o.renderSlot($.$slots,"toolbar",{actions:ue,prev:Ee,next:ze,reset:Te,activeIndex:x.value,setActiveItem:ke},()=>[o.createVNode(o.unref(ge.ElIcon),{onClick:Z=>ue("zoomOut")},{default:o.withCtx(()=>[o.createVNode(o.unref(be.ZoomOut))]),_:1},8,["onClick"]),o.createVNode(o.unref(ge.ElIcon),{onClick:Z=>ue("zoomIn")},{default:o.withCtx(()=>[o.createVNode(o.unref(be.ZoomIn))]),_:1},8,["onClick"]),o.createElementVNode("i",{class:o.normalizeClass(o.unref(O).e("actions__divider"))},null,2),o.createVNode(o.unref(ge.ElIcon),{onClick:Te},{default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(M).icon)))]),_:1}),o.createElementVNode("i",{class:o.normalizeClass(o.unref(O).e("actions__divider"))},null,2),o.createVNode(o.unref(ge.ElIcon),{onClick:Z=>ue("anticlockwise")},{default:o.withCtx(()=>[o.createVNode(o.unref(be.RefreshLeft))]),_:1},8,["onClick"]),o.createVNode(o.unref(ge.ElIcon),{onClick:Z=>ue("clockwise")},{default:o.withCtx(()=>[o.createVNode(o.unref(be.RefreshRight))]),_:1},8,["onClick"])])],2)],2),o.createCommentVNode(" CANVAS "),o.createElementVNode("div",{class:o.normalizeClass(o.unref(O).e("canvas"))},[k.value&&$.$slots["viewer-error"]?o.renderSlot($.$slots,"viewer-error",{key:0,activeIndex:x.value,src:o.unref(J)}):(o.openBlock(),o.createElementBlock("img",{ref_key:"imgRef",ref:e,key:o.unref(J),src:o.unref(J),style:o.normalizeStyle(o.unref(te)),class:o.normalizeClass(o.unref(O).e("img")),crossorigin:$.crossorigin,onLoad:A,onError:ae,onMousedown:re,onTouchstart:Se},null,46,["src","crossorigin"]))],2),o.renderSlot($.$slots,"default")]),_:3},8,["focus-trap-el"])],6)]),_:3})]),_:3},8,["disabled"]))}});var Ht=ge._export_sfc(Ut,[["__file","image-viewer.vue"]]);const Zt=ge.withInstall(Ht),qt=oe.buildProps({hideOnClickModal:Boolean,src:{type:String,default:""},fit:{type:String,values:["","contain","cover","fill","none","scale-down"],default:""},loading:{type:String,values:["eager","lazy"]},lazy:Boolean,scrollContainer:{type:oe.definePropType([String,Object])},previewSrcList:{type:oe.definePropType(Array),default:()=>nt.mutable([])},previewTeleported:Boolean,zIndex:{type:Number},initialIndex:{type:Number,default:0},infinite:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},zoomRate:{type:Number,default:1.2},scale:{type:Number,default:1},minScale:{type:Number,default:.2},maxScale:{type:Number,default:7},showProgress:Boolean,crossorigin:{type:oe.definePropType(String)}}),Kt={load:i=>i instanceof Event,error:i=>i instanceof Event,switch:i=>oe.isNumber(i),close:()=>!0,show:()=>!0},Xt=o.defineComponent({name:"ElImage",inheritAttrs:!1}),Yt=o.defineComponent({...Xt,props:qt,emits:Kt,setup(i,{expose:v,emit:p}){const S=i,{t:g}=at.useLocale(),C=oe.useNamespace("image"),z=o.useAttrs(),I=o.computed(()=>oe.fromPairs(Object.entries(z).filter(([A])=>/^(data-|on[A-Z])/i.test(A)||["id","style"].includes(A)))),O=nt.useAttrs({excludeListeners:!0,excludeKeys:o.computed(()=>Object.keys(I.value))}),V=o.ref(),L=o.ref(!1),e=o.ref(!0),R=o.ref(!1),G=o.ref(),F=o.ref(),k=ne.isClient&&"loading"in HTMLImageElement.prototype;let P;const x=o.computed(()=>[C.e("inner"),E.value&&C.e("preview"),e.value&&C.is("loading")]),M=o.computed(()=>{const{fit:A}=S;return ne.isClient&&A?{objectFit:A}:{}}),E=o.computed(()=>{const{previewSrcList:A}=S;return oe.isArray(A)&&A.length>0}),j=o.computed(()=>{const{previewSrcList:A,initialIndex:ae}=S;let re=ae;return ae>A.length-1&&(re=0),re}),U=o.computed(()=>S.loading==="eager"?!1:!k&&S.loading==="lazy"||S.lazy),D=()=>{ne.isClient&&(e.value=!0,L.value=!1,V.value=S.src)};function K(A){e.value=!1,L.value=!1,p("load",A)}function J(A){e.value=!1,L.value=!0,p("error",A)}function Y(A){A&&(D(),q())}const H=ne.useThrottleFn(Y,200,!0);async function te(){var A;if(!ne.isClient)return;await o.nextTick();const{scrollContainer:ae}=S;if(oe.isElement(ae))F.value=ae;else if(oe.isString(ae)&&ae!=="")F.value=(A=document.querySelector(ae))!=null?A:void 0;else if(G.value){const Se=Bt.getScrollContainer(G.value);F.value=oe.isWindow(Se)?void 0:Se}const{stop:re}=ne.useIntersectionObserver(G,([Se])=>{H(Se.isIntersecting)},{root:F});P=re}function q(){!ne.isClient||!H||(P?.(),F.value=void 0,P=void 0)}function le(){E.value&&(R.value=!0,p("show"))}function Q(){R.value=!1,p("close")}function ie(A){p("switch",A)}return o.watch(()=>S.src,()=>{U.value?(e.value=!0,L.value=!1,q(),te()):D()}),o.onMounted(()=>{U.value?te():D()}),v({showPreview:le}),(A,ae)=>(o.openBlock(),o.createElementBlock("div",o.mergeProps({ref_key:"container",ref:G},o.unref(I),{class:[o.unref(C).b(),A.$attrs.class]}),[L.value?o.renderSlot(A.$slots,"error",{key:0},()=>[o.createElementVNode("div",{class:o.normalizeClass(o.unref(C).e("error"))},o.toDisplayString(o.unref(g)("el.image.error")),3)]):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[V.value!==void 0?(o.openBlock(),o.createElementBlock("img",o.mergeProps({key:0},o.unref(O),{src:V.value,loading:A.loading,style:o.unref(M),class:o.unref(x),crossorigin:A.crossorigin,onClick:le,onLoad:K,onError:J}),null,16,["src","loading","crossorigin"])):o.createCommentVNode("v-if",!0),e.value?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(o.unref(C).e("wrapper"))},[o.renderSlot(A.$slots,"placeholder",{},()=>[o.createElementVNode("div",{class:o.normalizeClass(o.unref(C).e("placeholder"))},null,2)])],2)):o.createCommentVNode("v-if",!0)],64)),o.unref(E)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:2},[R.value?(o.openBlock(),o.createBlock(o.unref(Zt),{key:0,"z-index":A.zIndex,"initial-index":o.unref(j),infinite:A.infinite,"zoom-rate":A.zoomRate,"min-scale":A.minScale,"max-scale":A.maxScale,"show-progress":A.showProgress,"url-list":A.previewSrcList,scale:A.scale,crossorigin:A.crossorigin,"hide-on-click-modal":A.hideOnClickModal,teleported:A.previewTeleported,"close-on-press-escape":A.closeOnPressEscape,onClose:Q,onSwitch:ie},o.createSlots({toolbar:o.withCtx(re=>[o.renderSlot(A.$slots,"toolbar",o.normalizeProps(o.guardReactiveProps(re)))]),default:o.withCtx(()=>[A.$slots.viewer?(o.openBlock(),o.createElementBlock("div",{key:0},[o.renderSlot(A.$slots,"viewer")])):o.createCommentVNode("v-if",!0)]),_:2},[A.$slots.progress?{name:"progress",fn:o.withCtx(re=>[o.renderSlot(A.$slots,"progress",o.normalizeProps(o.guardReactiveProps(re)))])}:void 0,A.$slots["viewer-error"]?{name:"viewer-error",fn:o.withCtx(re=>[o.renderSlot(A.$slots,"viewer-error",o.normalizeProps(o.guardReactiveProps(re)))])}:void 0]),1032,["z-index","initial-index","infinite","zoom-rate","min-scale","max-scale","show-progress","url-list","scale","crossorigin","hide-on-click-modal","teleported","close-on-press-escape"])):o.createCommentVNode("v-if",!0)],64)):o.createCommentVNode("v-if",!0)],16))}});var Qt=ge._export_sfc(Yt,[["__file","image.vue"]]);const _t=ge.withInstall(Qt);function eo(i){const v=o.ref([]);let p=null,S={min:null,max:null,originalMin:null,originalMax:null,bounds:[]};async function g(V,L=["#000000","#FFFFFF"],e=!1){console.log("Adding TIF layer with URL/File:",V,L);const R=`tif-layer-${new Date().getTime()}`;if(V instanceof File){const G=await w.readFileAsArrayBuffer(V);await C(G,L,R,e),v.value.push(R)}else if(typeof V=="string"){const F=await(await fetch(V)).arrayBuffer();await C(F,L,R,e),v.value.push(R)}return{tifId:R,dataRange:S}}async function C(V,L=["#000000","#FFFFFF"],e="geotiff-layer",R=!1){const F=await(await At.fromArrayBuffer(V)).getImage(),k=F.getWidth(),P=F.getHeight(),x=F.fileDirectory||{};console.log("fileDirectory",x);const M=parseInt(x.GDAL_NODATA);console.log("GDAL_NODATA",typeof M,M);const E=w.calculateBounds(F),j=await F.readRasters();p={image:F,data:j,width:k,height:P},console.log("GeoTIFF data loaded:",p);const U=Array.isArray(j)?j:[j];let D=1/0,K=-1/0;for(const Y of U)for(const H of Y)H>-1e10&&H!=M&&(D=Math.min(D,H),K=Math.max(K,H));(!isFinite(D)||!isFinite(K)||D>=K)&&(console.warn("无效的数据范围,使用默认值"),D=0,K=255),S={min:D,max:K,originalMin:D,originalMax:K,bounds:E},console.log("Data range calculated:",S);const J=O(j,k,P,L,M);if(!J){console.error("Failed to create image data from GeoTIFF.");return}z(J,k,P,E,e),R&&i.value?.fitBounds([[E[0],E[1]],[E[2],E[3]]],{padding:50})}function z(V,L,e,R,G="geotiff-layer"){const F=G,k=G+"-source";i.value?.getLayer(F)&&i.value.removeLayer(F),i.value?.getSource(k)&&i.value.removeSource(k);const P=document.createElement("canvas");P.width=L,P.height=e,P.getContext("2d")?.putImageData(V,0,0);const M=P.toDataURL("image/png");i.value?.addSource(k,{type:"image",url:M,coordinates:[[R[0],R[3]],[R[2],R[3]],[R[2],R[1]],[R[0],R[1]]]}),i.value?.addLayer({id:F,type:"raster",source:k,paint:{"raster-opacity":.8}})}function I(V){const L=V,e=V+"-source";i.value?.getLayer(L)&&i.value.removeLayer(L),i.value?.getSource(e)&&i.value.removeSource(e);const R=v.value.indexOf(V);R!==-1&&v.value.splice(R,1)}function O(V,L,e,R,G=null){const F=document.createElement("canvas");F.width=L,F.height=e;const k=F.getContext("2d"),P=k?.createImageData(L,e),x=Array.isArray(V)?V:[V],M=L*e;let E=S.min,j=S.max;(E===null||j===null)&&(E=0,j=255);const U=R.map(w.hexToRgb),D=U.length;function K(J){if(D===1||J<=0)return U[0];if(J>=1)return U[D-1];const Y=1/(D-1),H=Math.floor(J/Y),te=(J-H*Y)/Y,q=U[H],le=U[Math.min(H+1,D-1)];return[Math.round(q[0]+(le[0]-q[0])*te),Math.round(q[1]+(le[1]-q[1])*te),Math.round(q[2]+(le[2]-q[2])*te)]}for(let J=0;J<M;J++){let Y,H,te,q;const le=x[0][J];if(G!==null&&le===G)Y=H=te=0,q=0;else if(x.length>=3)G!==null&&(x[0][J]===G||x[1][J]===G||x[2][J]===G)?(Y=H=te=0,q=0):(Y=Math.floor(255*w.clamp((x[0][J]-E)/(j-E),0,1)),H=Math.floor(255*w.clamp((x[1][J]-E)/(j-E),0,1)),te=Math.floor(255*w.clamp((x[2][J]-E)/(j-E),0,1)),q=255);else if(x.length===1){const Q=x[0][J];if(Q<E)q=0,Y=H=te=0;else if(Q>j)Y=255,H=te=0,q=255;else{const ie=(Q-E)/(j-E),A=.15,ae=(ie-A)/(1-A);[Y,H,te]=K(ae),q=255}}else{const ie=(x[0][J]-E)/(j-E);ie<.15?(Y=H=te=0,q=0):(Y=H=te=Math.floor(255*(ie-.15)/.85),q=255)}P.data[J*4]=Y,P.data[J*4+1]=H,P.data[J*4+2]=te,P.data[J*4+3]=q}return k?.putImageData(P,0,0),P}return{addTifLayer:g,processGeoTIFF:C,removeTifLayer:I}}function _e(i,v,p,S,g){if(console.log("setMapParams",i),!i.layerPaintConfig)return;const C=JSON.parse(i.layerPaintConfig||"{}"),{defaultCenter:z,defaultZoom:I,bearing:O,pitch:V,baseMap:L,displayFeatures:e}=C;let R=!1;if(L){R=!0;const G=L==="satellite"?Ie.MapLayerType.SATELLITE:L==="vector"?Ie.MapLayerType.VECTOR:Ie.MapLayerType.TOPOGRAPHIC;S.changeMapLayer(p,G),v?.setStyle(S.getCurrentMapStyle(p))}if(z&&I!==void 0){R=!0;let G;if(typeof z=="string"){const x=z.split(",").map(M=>parseFloat(M.trim()));G=[x[0],x[1]]}else if(Array.isArray(z))G=z;else return;const F=parseFloat(I),k=O!==void 0?parseFloat(O):0,P=V!==void 0?parseFloat(V):0;S.saveInitialState(p,G,F,k,P),S.setCenter(p,G),S.setZoom(p,F),S.setBearing(p,k),S.setPitch(p,P),L?v?.once("styledata",()=>{setTimeout(()=>{g.value=!0,v?.flyTo({center:G,zoom:F,bearing:k,pitch:P,duration:1e3}),v?.once("moveend",()=>{setTimeout(()=>{g.value=!1,Pe.ElMessage.success("应用当前配置成功!")},100)})},200)}):(g.value=!0,v?.flyTo({center:G,zoom:F,bearing:k,pitch:P,duration:1e3}),v?.once("moveend",()=>{setTimeout(()=>{g.value=!1,Pe.ElMessage.success("应用当前配置成功!")},100)}))}if(e!==void 0){R=!0;const F=(typeof e=="object"?e.label===!0:e===!0)?"visible":"none";setTimeout(()=>{["tdt-satellite-osm-tiles-marker-layer","tdt-vector-osm-tiles-marker-layer","tdt-vector-osm-tiles-marker-layer1","tdt-vector-osm-tiles-marker-layer2","tdt-vector-osm-tiles-marker-layer3"].forEach(P=>{v?.getLayer(P)&&v.setLayoutProperty(P,"visibility",F)})},300)}R&&!(z&&I!==void 0)&&Pe.ElMessage.success("应用当前配置成功!")}const De="FID",pe="rgba(103, 194, 58, 0.6)",mt=De,to=["Open Sans Regular","Arial Unicode MS Regular"],oo={SimSun:["Open Sans Regular","Arial Unicode MS Regular"],SimHei:["Open Sans Bold","Arial Unicode MS Bold"],DengXian:["Open Sans Semibold","Arial Unicode MS Regular"]},vt="/map-icons/svg/",ht="/map-icons/png/",it=i=>oo[i||""]||to,lo=i=>{const v=new Set,p=S=>{if(!S)return;const g=S.type;g==="Polygon"||g==="MultiPolygon"?v.add("polygon"):g==="LineString"||g==="MultiLineString"?v.add("line"):(g==="Point"||g==="MultiPoint")&&v.add("point")};return i.type==="FeatureCollection"?i.features?.forEach(S=>p(S.geometry)):i.type==="Feature"?p(i.geometry):p(i),v},ao=(i,v)=>i.length<2||v.length<2?!1:i[0]===v[0]&&i[1]===v[1],Lt=(i=[])=>i.filter((v,p)=>p===0?!0:!ao(i[p-1],v)),bt=i=>{if(!i)return i;const v=p=>p&&(p.type==="LineString"&&Array.isArray(p.coordinates)?{...p,coordinates:Lt(p.coordinates)}:p.type==="MultiLineString"&&Array.isArray(p.coordinates)?{...p,coordinates:p.coordinates.map(S=>Lt(S))}:p);return i.type==="FeatureCollection"&&Array.isArray(i.features)?{...i,features:i.features.map(p=>({...p,geometry:v(p.geometry)}))}:i.type==="Feature"?{...i,geometry:v(i.geometry)}:v(i)},St=i=>i?i.type==="FeatureCollection"&&Array.isArray(i.features)?{...i,features:i.features.map((v,p)=>({...v,properties:{...v?.properties||{},[mt]:p}}))}:i.type==="Feature"?{...i,properties:{...i.properties||{},[mt]:0}}:i:null,xt=(i,v,p,S="#000000")=>new Promise(async(g,C)=>{if(i.hasImage(p)){g();return}try{const z=await fetch(v);if(!z.ok)throw new Error(`加载 SVG 失败: ${v}`);let I=await z.text();I=I.replace(/\{color\}/g,S);const O=new Image,V=new Blob([I],{type:"image/svg+xml"}),L=URL.createObjectURL(V);O.onload=()=>{URL.revokeObjectURL(L),i.hasImage(p)||i.addImage(p,O),g()},O.onerror=e=>{URL.revokeObjectURL(L),C(e)},O.src=L}catch(z){C(z)}}),Ct=(i,v,p)=>new Promise(async(S,g)=>{if(i.hasImage(p)){S();return}try{const C=new Image;C.crossOrigin="Anonymous",await new Promise((z,I)=>{C.onload=()=>z(),C.onerror=O=>I(O),C.src=v}),i.hasImage(p)||i.addImage(p,C),S()}catch(C){g(C)}}),no=(i,v,p,S,g)=>{const C=S.fillColorList||[],z=C.find(k=>k.type==="default"),I=C.filter(k=>k.type==="custom"),O=["any",["==",["geometry-type"],"Polygon"],["==",["geometry-type"],"MultiPolygon"]],V=new Map;I.forEach(k=>{k.key&&V.set(k.key,(V.get(k.key)||0)+1)});const L=Array.from(V.entries()).sort((k,P)=>P[1]-k[1])[0]?.[0]||"",e=L?I.filter(k=>k.key===L):[],R=L?Array.from(new Set(e.filter(k=>k.value!==null&&k.value!==void 0&&k.value!=="").map(k=>String(k.value)))):[],G=L&&R.length>0?["all",O,["!",["match",["to-string",["get",L]],R,!0,!1]]]:O;if(e.length===0||!L){const k=`geojson-fill-${p.id}-${g}`;i.addLayer({id:k,type:"fill",source:v,filter:O,paint:{"fill-color":z?.color||pe,"fill-opacity":S.fillOpacityConfig?.value??1,"fill-antialias":!1}})}else{const k=`geojson-fill-${p.id}-${g}`;i.addLayer({id:k,type:"fill",source:v,filter:G,paint:{"fill-color":z?.color||pe,"fill-opacity":S.fillOpacityConfig?.value??1,"fill-antialias":!1}}),e.forEach((P,x)=>{if(!P.value)return;const M=`geojson-fill-${p.id}-${g}-${x}`;i.addLayer({id:M,type:"fill",source:v,filter:["all",O,["==",["to-string",["get",L]],String(P.value)]],paint:{"fill-color":P.color,"fill-opacity":P.fillOpacityConfig?.value??1,"fill-antialias":!1}})})}const F=S.fillConfig;if(F&&(F.displayLabel==="true"||F.displayLabel==="show")&&F.labelField)try{const k=`geojson-fill-label-${p.id}-${g}`;i.addLayer({id:k,type:"symbol",source:v,filter:O,layout:{"text-field":["get",F.labelField],"text-size":F.labelSize,"text-font":it(F.labelFont),"text-anchor":"center","text-offset":[0,0],"text-allow-overlap":!1,"text-avoid-edges":!0},paint:{"text-color":F.labelColor,"text-halo-color":"rgba(255,255,255,0.8)","text-halo-width":2}})}catch(k){console.warn("添加面标注失败:",k)}},wt=(i,v,p,S,g)=>{const C=S.outlineConfigList||[],z=C.find(k=>k.type==="default"),I=C.filter(k=>k.type==="custom"),O=["any",["==",["geometry-type"],"LineString"],["==",["geometry-type"],"MultiLineString"]],V=new Map;I.forEach(k=>{k.key&&V.set(k.key,(V.get(k.key)||0)+1)});const L=Array.from(V.entries()).sort((k,P)=>P[1]-k[1])[0]?.[0]||"",e=L?I.filter(k=>k.key===L):[],R=L?Array.from(new Set(e.filter(k=>k.value!==null&&k.value!==void 0&&k.value!=="").map(k=>String(k.value)))):[],G=L&&R.length>0?["!",["match",["to-string",["get",L]],R,!0,!1]]:null;if(e.length===0||!L){const k=`geojson-line-${p.id}-${g}`;try{const P={id:k,type:"line",source:v,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":z?.outlineColor||"rgba(103, 194, 58, 1)","line-width":z?.outlineWidth||2}};z?.lineStyle==="dash"&&(P.paint["line-dasharray"]=[2,2]),G&&(P.filter=G),i.addLayer(P)}catch(P){console.error("添加线图层失败:",P)}}else{const k=`geojson-line-default-${p.id}-${g}`;try{const P={id:k,type:"line",source:v,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":z?.outlineColor||"rgba(103, 194, 58, 1)","line-width":z?.outlineWidth||2}};z?.lineStyle==="dash"&&(P.paint["line-dasharray"]=[2,2]),G&&(P.filter=G),i.addLayer(P)}catch(P){console.error("添加默认线图层失败:",P)}e.forEach((P,x)=>{if(!P.value)return;const M=`geojson-line-custom-${p.id}-${g}-${x}`;try{const E={id:M,type:"line",source:v,filter:["==",["to-string",["get",L]],String(P.value)],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":P.outlineColor,"line-width":P.outlineWidth}};P.lineStyle==="dash"&&(E.paint["line-dasharray"]=[2,2]),i.addLayer(E)}catch(E){console.error(`添加自定义线图层 ${x} 失败:`,E)}})}const F=S.outlineConfig;if(F&&(F.displayLabel==="true"||F.displayLabel==="show")&&F.labelField)try{const k=`geojson-line-label-${p.id}-${g}`;i.addLayer({id:k,type:"symbol",source:v,filter:O,layout:{"text-field":["get",F.labelField],"text-size":F.labelSize,"text-font":it(F.labelFont),"text-anchor":"center","text-offset":[0,0],"text-allow-overlap":!1,"text-avoid-edges":!0},paint:{"text-color":F.labelColor,"text-halo-color":"rgba(255,255,255,0.8)","text-halo-width":2}})}catch(k){console.warn("添加线标注失败:",k)}},io=async(i,v,p,S,g,C)=>{console.log("[renderPointLayer] 开始渲染点图层",{topicId:p.id,topicName:p.layerName,timestamp:g});const z=S.symbolConfigList||S.circleConfigList||[];console.log("[renderPointLayer] symbolConfigList:",{total:z.length,hasSymbolConfigList:!!S.symbolConfigList,hasCircleConfigList:!!S.circleConfigList,items:z.map(x=>({type:x.type,key:x.key,value:x.value,pointStyle:x.pointStyle}))});const I=z.find(x=>x.type==="default"),O=z.filter(x=>x.type==="custom"),V=["any",["==",["geometry-type"],"Point"],["==",["geometry-type"],"MultiPoint"]];console.log("[renderPointLayer] 配置分类:",{defaultConfig:I?{renderMode:I.renderMode,pointStyle:I.pointStyle,pointSize:I.pointSize}:null,customConfigsCount:O.length,customConfigs:O.map(x=>({key:x.key,value:x.value,renderMode:x.renderMode}))});const L=new Map;O.forEach(x=>{x.key&&L.set(x.key,(L.get(x.key)||0)+1)});const e=Array.from(L.entries()).sort((x,M)=>M[1]-x[1])[0]?.[0]||"";console.log("[renderPointLayer] 目标字段检测:",{keyCount:Array.from(L.entries()),currentColumnSet:e});const R=e?O.filter(x=>x.key===e):[];console.log("[renderPointLayer] 匹配的配置:",{currentColumnSet:e,matchedConfigsCount:R.length,matchedConfigs:R.map(x=>({key:x.key,value:x.value}))});const G=e?Array.from(new Set(R.filter(x=>x.value!==null&&x.value!==void 0&&x.value!=="").map(x=>String(x.value)))):[];console.log("[renderPointLayer] 自定义值:",{customPointValues:G,count:G.length});const F=e&&G.length>0?["all",V,["!",["match",["to-string",["get",e]],G,!0,!1]]]:V;console.log("[renderPointLayer] 默认过滤器:",{hasCustomColumnSet:!!e,hasCustomValues:G.length>0,filterType:e&&G.length>0?"exclude-custom":"all-points"});const k=I?.renderMode||"color";if(console.log("[renderPointLayer] 默认渲染模式:",{renderMode:k,hasPointStyle:!!I?.pointStyle,pointStyle:I?.pointStyle,hasIconImageName:!!I?.pointStyle}),k==="color"&&I?.pointStyle){const x=I.pointTintColor||I.circleColor||pe,M=x.replace(/[^a-zA-Z0-9]/g,""),E=`point-svg-default-${I.pointStyle}-${M}`,j=w.resolveAssetById(I.pointStyle,C?.shapeOptions||[]);try{const U=j?.url||`${vt}${I.pointStyle}`;await xt(i,U,E,x),console.log("[renderPointLayer] SVG 加载成功:",E);const D=`geojson-point-default-${p.id}-${g}`;i.addLayer({id:D,type:"symbol",source:v,filter:F,layout:{"icon-image":E,"icon-size":(I.pointSize||10)/20,"icon-anchor":"center","icon-allow-overlap":!0},paint:{}}),console.log("[renderPointLayer] 默认 SVG 图层已添加:",D)}catch(U){console.warn("[renderPointLayer] 加载默认 SVG 失败,回退到圆形:",U);const D=`geojson-point-fallback-${p.id}-${g}`;i.addLayer({id:D,type:"circle",source:v,filter:F,paint:{"circle-radius":I?.pointSize||I?.circleRadius||10,"circle-color":I?.pointTintColor||I?.circleColor||pe}}),console.log("[renderPointLayer] 回退圆形图层已添加:",D)}}else if(k==="icon"&&I?.pointStyle){const x=`point-icon-default-${I.pointStyle}`,M=w.resolveAssetById(I.pointStyle,C?.iconOptions||[]);try{const E=M?.url||`${ht}${I.pointStyle}`;await Ct(i,E,x);const j=`geojson-point-default-${p.id}-${g}`;i.addLayer({id:j,type:"symbol",source:v,filter:F,layout:{"icon-image":x,"icon-size":(I.pointSize||2)/24,"icon-anchor":"center","icon-allow-overlap":!0},paint:{}})}catch(E){console.warn("加载默认图标失败,回退到圆形:",E);const j=`geojson-point-fallback-${p.id}-${g}`;i.addLayer({id:j,type:"circle",source:v,filter:F,paint:{"circle-radius":I?.pointSize||I?.circleRadius||2,"circle-color":I?.pointTintColor||I?.circleColor||pe}})}}else{const x=`geojson-point-default-${p.id}-${g}`;i.addLayer({id:x,type:"circle",source:v,filter:F,paint:{"circle-radius":I?.pointSize||I?.circleRadius||10,"circle-color":I?.pointTintColor||I?.circleColor||pe,"circle-stroke-width":I?.pointStrokeWidth||I?.circleStrokeWidth||0,"circle-stroke-color":I?.pointStrokeColor||I?.pointStrokeColor||"rgba(255, 255, 255, 1)"}})}if(console.log("[renderPointLayer] 开始渲染自定义配置:",{matchedConfigsCount:R.length,currentColumnSet:e}),R.length>0&&e)for(let x=0;x<R.length;x++){const M=R[x];if(!M.value){console.log(`[renderPointLayer] 跳过自定义配置 ${x}: 没有值`);continue}const E=M.renderMode||"color";if(console.log(`[renderPointLayer] 渲染自定义配置 ${x}:`,{key:M.key,value:M.value,renderMode:E,pointStyle:M.pointStyle}),E==="color"&&M.pointStyle){const j=M.pointTintColor||M.circleColor||pe,U=j.replace(/[^a-zA-Z0-9]/g,""),D=`point-svg-custom-${M.pointStyle}-${U}`,K=w.resolveAssetById(M.pointStyle,C?.shapeOptions||[]);try{const J=K?.url||`${vt}${M.pointStyle}`;await xt(i,J,D,j),console.log(`[renderPointLayer] 自定义 SVG ${x} 加载成功:`,D);const Y=`geojson-point-custom-${p.id}-${g}-${x}`,H=["all",V,["==",["to-string",["get",e]],String(M.value)]];console.log(`[renderPointLayer] 自定义 SVG ${x} 图层过滤器:`,{filter:H,field:e,value:String(M.value)}),i.addLayer({id:Y,type:"symbol",source:v,filter:H,layout:{"icon-image":D,"icon-size":(M.pointSize||10)/20,"icon-anchor":"center","icon-allow-overlap":!0},paint:{}}),console.log(`[renderPointLayer] 自定义 SVG ${x} 图层已添加:`,Y)}catch(J){console.warn(`[renderPointLayer] 加载自定义 SVG ${x} 失败:`,J)}}else if(E==="icon"&&M.pointStyle){const j=`point-icon-custom-${M.pointStyle}`,U=w.resolveAssetById(M.pointStyle,C?.iconOptions||[]);try{const D=U?.url||`${ht}${M.pointStyle}`;await Ct(i,D,j),console.log(`[renderPointLayer] 自定义 PNG ${x} 加载成功:`,j);const K=`geojson-point-custom-${p.id}-${g}-${x}`;i.addLayer({id:K,type:"symbol",source:v,filter:["all",V,["==",["to-string",["get",e]],String(M.value)]],layout:{"icon-image":j,"icon-size":(M.pointSize||2)/24,"icon-anchor":"center","icon-allow-overlap":!0},paint:{}}),console.log(`[renderPointLayer] 自定义 PNG ${x} 图层已添加:`,K)}catch(D){console.warn(`[renderPointLayer] 加载自定义图标 ${x} 失败:`,D)}}}else console.log("[renderPointLayer] 没有需要渲染的自定义配置");const P=S.symbolConfig;if(console.log("[renderPointLayer] 标注配置:",{hasSymbolConfig:!!P,displayLabel:P?.displayLabel,labelField:P?.labelField}),P&&(P.displayLabel==="true"||P.displayLabel==="show")&&P.labelField)try{const x=`geojson-circle-label-${p.id}-${g}`;console.log("[renderPointLayer] 添加标注图层:",{labelLayerId:x,labelField:P.labelField,labelSize:P.labelSize}),i.addLayer({id:x,type:"symbol",source:v,filter:V,layout:{"text-field":["get",P.labelField],"text-size":P.labelSize,"text-font":it(P.labelFont),"text-anchor":"top","text-offset":[0,1.5],"text-allow-overlap":!1,"text-avoid-edges":!0},paint:{"text-color":P.labelColor,"text-halo-color":"rgba(255,255,255,0.8)","text-halo-width":2}}),console.log("[renderPointLayer] 标注图层已添加:",x)}catch(x){console.warn("[renderPointLayer] 添加点标注失败:",x)}else console.log("[renderPointLayer] 不添加标注图层");console.log("[renderPointLayer] 点图层渲染完成",{topicId:p.id,topicName:p.layerName,timestamp:g})},ro=i=>{if(!i)return console.log("[parseLayerPaintConfig] 没有配置,使用默认配置"),et();try{let v=i;if(typeof v=="string"&&(v=JSON.parse(v)),typeof v=="object"&&v!==null){const p=v;Array.isArray(p.circleConfigList)&&!Array.isArray(p.symbolConfigList)&&(console.log("[parseLayerPaintConfig] 检测到 circleConfigList,转换为 symbolConfigList"),p.symbolConfigList=p.circleConfigList,delete p.circleConfigList),console.log("[parseLayerPaintConfig] 解析后的配置:",{hasSymbolConfigList:!!p.symbolConfigList,symbolConfigListLength:p.symbolConfigList?.length,hasCircleConfigList:!!p.circleConfigList,circleConfigListLength:p.circleConfigList?.length,firstCustomSymbolConfig:p.symbolConfigList?.find(C=>C.type==="custom")});const S=et(),g={...S,...p};return(!Array.isArray(g.fillColorList)||g.fillColorList.length===0)&&(g.fillColorList=S.fillColorList),(!Array.isArray(g.outlineConfigList)||g.outlineConfigList.length===0)&&(g.outlineConfigList=S.outlineConfigList),(!Array.isArray(g.symbolConfigList)||g.symbolConfigList.length===0)&&(g.symbolConfigList=S.symbolConfigList),(!Array.isArray(g.circleConfigList)||g.circleConfigList.length===0)&&(g.circleConfigList=S.circleConfigList),(!g.fillOpacityConfig||typeof g.fillOpacityConfig.value!="number")&&(g.fillOpacityConfig=S.fillOpacityConfig),g}}catch(v){console.warn("[parseLayerPaintConfig] 解析 layerPaintConfig 失败,使用默认配置:",v)}return et()},et=()=>({fillColorList:[{type:"default",key:"",value:"",color:pe}],outlineConfigList:[{type:"default",outlineColor:"rgba(103, 194, 58, 1)",outlineWidth:2,zoom:0,lineStyle:"solid"}],fillOpacityConfig:{value:1},symbolConfigList:[{type:"default",key:"",value:"",renderMode:"color",pointStyle:"118",pointTintColor:pe,pointSize:2,circleColor:pe,circleRadius:6,pointStrokeWidth:0,pointStrokeColor:"rgba(0,0,0,0)",circleStrokeWidth:0,circleStrokeColor:"rgba(0,0,0,0)"}],circleConfigList:[{type:"default",key:"",value:"",renderMode:"color",pointStyle:"118",pointTintColor:pe,pointSize:2,circleColor:pe,circleRadius:6,pointStrokeWidth:0,pointStrokeColor:"rgba(0,0,0,0)",circleStrokeWidth:0,circleStrokeColor:"rgba(0,0,0,0)"}],fillConfig:{displayLabel:"false",labelSize:14,labelColor:"rgba(0, 0, 0, 1)",labelFont:"SimSun",labelField:De},outlineConfig:{displayLabel:"false",labelSize:14,labelColor:"rgba(0, 0, 0, 1)",labelFont:"SimSun",labelField:De},symbolConfig:{displayLabel:"false",labelSize:14,labelColor:"rgba(0, 0, 0, 1)",labelFont:"SimSun",labelField:De}}),so=async i=>{if(i.geoJSON)try{const v=typeof i.geoJSON=="string"?JSON.parse(i.geoJSON):i.geoJSON;return St(bt(v))}catch(v){throw console.error("解析 geoJSON 字段失败:",v),new Error("解析 geoJSON 字段失败")}if(i.url)try{const p=await(await fetch(i.url)).json();return St(bt(p))}catch(v){throw console.error("获取 GeoJSON 数据失败:",v),new Error("获取 GeoJSON 数据失败")}throw new Error("GeoJSON 数据源缺失")},co=async(i,v,p)=>{console.log("[renderGeojsonLayer] 开始渲染 GeoJSON 图层:",{topicId:v.id,topicName:v.layerName,layerType:v.layerType,hasGeoJSON:!!v.geoJSON,hasUrl:!!v.url,hasConfig:!!v.layerPaintConfig});try{const S=await so(v);if(!S){console.warn("[renderGeojsonLayer] GeoJSON 数据为空");return}console.log("[renderGeojsonLayer] GeoJSON 数据加载成功:",{type:S.type,featuresCount:S.features?.length||0,hasFID:S.features?.[0]?.properties?.hasOwnProperty("FID")});const g=ro(v.layerPaintConfig),C=lo(S);if(console.log("[renderGeojsonLayer] 检测到的几何类型:",{types:Array.from(C),hasPolygon:C.has("polygon"),hasLine:C.has("line"),hasPoint:C.has("point")}),C.size===0){console.warn("[renderGeojsonLayer] GeoJSON 数据为空,无法加载数据");return}const z=Date.now(),I=`geojson-source-${v.id}-${z}`;console.log("[renderGeojsonLayer] 添加数据源:",{sourceId:I,timestamp:z}),i.addSource(I,{type:"geojson",data:S}),C.has("polygon")&&(console.log("[renderGeojsonLayer] 渲染面图层"),no(i,I,v,g,z),wt(i,I,v,g,z)),C.has("line")&&!C.has("polygon")&&(console.log("[renderGeojsonLayer] 渲染线图层"),wt(i,I,v,g,z)),C.has("point")&&(console.log("[renderGeojsonLayer] 渲染点图层"),await io(i,I,v,g,z,p)),setTimeout(()=>{uo(i,S)},300),console.log("[renderGeojsonLayer] GeoJSON 图层渲染完成:",{topicId:v.id,topicName:v.layerName,sourceId:I})}catch(S){throw console.error("[renderGeojsonLayer] 渲染 GeoJSON 图层失败:",S),S}},uo=(i,v)=>{const p=[],S=g=>{if(g)try{switch(g.type){case"Point":g.coordinates&&g.coordinates.length>=2&&p.push([g.coordinates[0],g.coordinates[1]]);break;case"MultiPoint":case"LineString":Array.isArray(g.coordinates)&&g.coordinates.forEach(C=>{C&&C.length>=2&&p.push([C[0],C[1]])});break;case"MultiLineString":case"Polygon":Array.isArray(g.coordinates)&&g.coordinates.forEach(C=>{Array.isArray(C)&&C.forEach(z=>{z&&z.length>=2&&p.push([z[0],z[1]])})});break;case"MultiPolygon":Array.isArray(g.coordinates)&&g.coordinates.forEach(C=>{Array.isArray(C)&&C.forEach(z=>{Array.isArray(z)&&z.forEach(I=>{I&&I.length>=2&&p.push([I[0],I[1]])})})});break}}catch(C){console.warn("提取坐标失败:",C)}};try{v.type==="FeatureCollection"?v.features?.forEach(g=>S(g.geometry)):v.type==="Feature"?S(v.geometry):S(v)}catch(g){console.error("解析几何数据失败:",g);return}if(p.length>0)try{const g=p.map(I=>I[0]),C=p.map(I=>I[1]),z=[[Math.min(...g),Math.min(...C)],[Math.max(...g),Math.max(...C)]];i.fitBounds(z,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:16})}catch(g){console.error("fitBounds 执行失败:",g)}},fo=(i,v)=>{const p=String(v.id);console.log("[removeGeojsonLayer] 开始移除 GeoJSON 图层:",{topicId:v.id,topicName:v.layerName,layerIdPrefix:p});try{const S=i.getStyle();if(S?.layers){const g=S.layers.map(C=>C.id).filter(C=>C.includes(p));console.log("[removeGeojsonLayer] 找到需要删除的图层:",g),g.forEach(C=>{i.getLayer(C)&&(i.removeLayer(C),console.log("[removeGeojsonLayer] 已删除图层:",C))})}S?.sources&&Object.keys(S.sources).forEach(g=>{g.includes(p)&&i.getSource(g)&&(i.removeSource(g),console.log("[removeGeojsonLayer] 已删除数据源:",g))}),console.log("[removeGeojsonLayer] GeoJSON 图层移除完成")}catch(S){console.warn("[removeGeojsonLayer] 移除 GeoJSON 图层失败:",S)}},yo={class:"image-grid"},go={class:"image-name"},po=o.defineComponent({__name:"TrackImageDialog",props:{modelValue:{type:Boolean},imageList:{}},emits:["update:modelValue"],setup(i,{emit:v}){const p=i,S=v,g=o.computed({get:()=>p.modelValue,set:C=>S("update:modelValue",C)});return(C,z)=>{const I=_t,O=je.ElDialog;return o.openBlock(),o.createBlock(O,{modelValue:g.value,"onUpdate:modelValue":z[0]||(z[0]=V=>g.value=V),title:"图片详情",width:"900px","append-to-body":""},{default:o.withCtx(()=>[o.createElementVNode("div",yo,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.imageList,(V,L)=>(o.openBlock(),o.createElementBlock("div",{key:L,class:"image-grid-item"},[o.createElementVNode("p",go,o.toDisplayString(V.title||`图片 ${L+1}`),1),o.createVNode(I,{src:V.url,"preview-src-list":i.imageList.map(e=>e.url),"initial-index":L,fit:"contain",class:"grid-image"},null,8,["src","preview-src-list","initial-index"])]))),128))])]),_:1},8,["modelValue"])}}}),mo=Je._export_sfc(po,[["__scopeId","data-v-c0975131"]]),vo={class:"text-content"},ho={class:"text-item"},Lo={key:0,class:"text-title"},bo={class:"text-body"},So=o.defineComponent({__name:"TrackTextDialog",props:{modelValue:{type:Boolean},textItem:{}},emits:["update:modelValue"],setup(i,{emit:v}){const p=i,S=v,g=o.computed({get:()=>p.modelValue,set:C=>S("update:modelValue",C)});return(C,z)=>{const I=je.ElDialog;return o.openBlock(),o.createBlock(I,{modelValue:g.value,"onUpdate:modelValue":z[0]||(z[0]=O=>g.value=O),title:"文字详情",width:"500px","append-to-body":""},{default:o.withCtx(()=>[o.createElementVNode("div",vo,[o.createElementVNode("div",ho,[i.textItem?.title?(o.openBlock(),o.createElementBlock("p",Lo,o.toDisplayString(i.textItem.title),1)):o.createCommentVNode("",!0),o.createElementVNode("p",bo,o.toDisplayString(i.textItem?.text||"暂无内容"),1)])])]),_:1},8,["modelValue"])}}}),xo=Je._export_sfc(So,[["__scopeId","data-v-0046dbee"]]),Co={class:"voice-content"},wo={key:0,class:"voice-name"},Io=["src"],ko={key:0,class:"empty-tip"},Po=o.defineComponent({__name:"TrackVoiceDialog",props:{modelValue:{type:Boolean},voiceList:{}},emits:["update:modelValue"],setup(i,{emit:v}){const p=i,S=v,g=o.computed({get:()=>p.modelValue,set:C=>S("update:modelValue",C)});return(C,z)=>{const I=je.ElDialog;return o.openBlock(),o.createBlock(I,{modelValue:g.value,"onUpdate:modelValue":z[0]||(z[0]=O=>g.value=O),title:"音频详情",width:"500px","append-to-body":""},{default:o.withCtx(()=>[o.createElementVNode("div",Co,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.voiceList,(O,V)=>(o.openBlock(),o.createElementBlock("div",{key:V,class:"voice-item"},[O.title?(o.openBlock(),o.createElementBlock("p",wo,o.toDisplayString(O.title),1)):o.createCommentVNode("",!0),o.createElementVNode("audio",{controls:"",src:O.url,class:"voice-audio"},null,8,Io)]))),128)),i.voiceList.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",ko,"暂无音频"))])]),_:1},8,["modelValue"])}}}),No=Je._export_sfc(Po,[["__scopeId","data-v-33856ffb"]]),To=["id"],Eo={class:"left-bar"},zo={class:"right-bar"},Fo={class:"bottom-bar"},tt="icon-track-image",ot="icon-track-text",lt="icon-track-voice",Oo=o.defineComponent({name:"MapView",__name:"MapView",props:{mapRootId:{default:"mapboxV2-map"},tdtToken:{},mapBoxToken:{},amapKey:{},maxZoom:{default:17},minZoom:{default:3},zoom:{default:10},pitch:{default:60},hasScale:{type:Boolean,default:!0},scalePosition:{default:"bottom-right"},center:{},dialogConfig:{default:()=>({center:!1,top:"50px",customClass:"hiper-map-dialog"})},loadIcon:{type:Boolean,default:!0},mapLayerEntity:{},shapeOptions:{default:()=>[]},iconOptions:{default:()=>[]}},emits:["mapReady","iconsReady"],setup(i,{expose:v,emit:p}){const S=o.useTemplateRef("mapRoot"),g=o.ref(!1),C=o.ref(!1),z=o.ref(!1),I=o.ref([]),O=o.ref(null),V=o.ref([]);o.provide("shapeOptions",o.computed(()=>i.shapeOptions||[])),o.provide("iconOptions",o.computed(()=>i.iconOptions||[]));const L=$t.useMapStore();i.dialogConfig&&L.setDialogConfig(i.dialogConfig);const e=o.ref(),{addTifLayer:R,processGeoTIFF:G,removeTifLayer:F}=eo(e),k=o.ref(new Map),P=o.ref(new Map),x=o.ref(new Map),M=o.ref(new Map),E=t=>`${t}-media-source`,j=t=>`${t}-media-image-layer`,U=t=>`${t}-media-text-layer`,D=t=>`${t}-media-voice-layer`,K=o.ref(new Map),J=o.ref(new Map),Y=p,H=()=>{Ve.accessToken=i.mapBoxToken;const t=L.mapInstances[i.mapRootId];if(console.log("_mapInstance",t),e.value=new Ve.Map({container:i.mapRootId,style:L.getCurrentMapStyle(i.mapRootId),center:t.center,zoom:t.zoom,pitch:t.pitch,bearing:0,antialias:!0,maxZoom:t.maxZoom,minZoom:t.minZoom,attributionControl:!1}),e.value.on("load",()=>{if(e.value&&(Nt(),Y("mapReady",e.value)),Ce.mapLoadedBus.emit({mapRootId:i.mapRootId,mapInstance:e.value}),i.mapLayerEntity&&e.value){console.log("外部接口接收到的数据",i.mapLayerEntity);let l;Array.isArray(i.mapLayerEntity)?l=i.mapLayerEntity.find(a=>a.layerType==="map-layer"):l=i.mapLayerEntity,l&&_e(l,e.value,i.mapRootId,L,q)}}),e.value.on("zoomend",()=>{L.setZoom(i.mapRootId,e.value?.getZoom()||0)}),i.hasScale){const l=new Ve.ScaleControl({maxWidth:80,unit:"metric"});e.value?.addControl(l,i.scalePosition)}e.value.on("load",()=>{})},te=()=>{e.value?.setStyle(L.getCurrentMapStyle(i.mapRootId)),e.value?.once("styledata",()=>{console.log("地图样式更新完成,重新加载图层"),Q.value.forEach(t=>{ie(t)}),Ce.mapStyleChangedBus.emit({mapRootId:i.mapRootId})})},q=o.ref(!1),le=()=>{if(!e.value)return;let t={center:[116.4074,39.9042],zoom:3,bearing:0,pitch:0};const l=L.getInitialState(i.mapRootId);l?t={center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch}:i.center&&(t.center=i.center,t.zoom=i.zoom,t.pitch=i.pitch||0,t.bearing=0),q.value=!0,console.log("开始重置地图视图",t),e.value.flyTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch,duration:2e3}),L.mapInstances[i.mapRootId]&&(L.setCenter(i.mapRootId,t.center),L.setZoom(i.mapRootId,t.zoom),L.setBearing(i.mapRootId,t.bearing),L.setPitch(i.mapRootId,t.pitch)),setTimeout(()=>{q.value=!1},2e3)},Q=o.ref([]),ie=async t=>{if(!e.value){console.warn("地图实例未初始化,无法添加图层");return}const l=Q.value.find(r=>r.id===t.id);if(l?Object.assign(l,t):Q.value.push(t),t.layerType==="track"||t.layerType==="sample-group"&&t.layerShapes?.includes("line")){Qe(t);return}if(t.layerType==="species-group"||t.layerType==="interest-point"||t.layerType==="sample-group"&&t.layerShapes?.includes("point")){qe(t);return}if(t.geoJSON)console.log("渲染geoJSON---->"),t.layerPaintConfig?Te(t):ae(t);else{const r=w.getLayerId(t);e.value?.getLayer(r)==null?(console.log("首次渲染---->"),await We(t)):(console.log("非首次渲染---->更新图层"),A(t,JSON.parse(t.layerPaintConfig)))}};function A(t,l){if(l.fillColorList&&l.fillColorList.length){const c=l.fillColorList,d=c.find(f=>f.type==="default"),u=c.filter(f=>f.type==="custom"&&f.key&&f.value);l.fillColorList=d?[...u,d]:u}const a=w.getLayerType(t);console.log("currentLayerType--->",a);const n=JSON.parse(JSON.stringify(l));console.log("newStyleConfig---->",n);const r=w.getFillStyle(n);console.log("newFillColorConfig---->",r);const s=w.getOutLineStyle(n);if(console.log("outlineStyle---->",s),["shp","kml","kmz","geojson"].includes(t.layerType)&&t.layerShapes){const c=t.layerShapes.split(",").map(d=>d.trim());if(c.length>1||t.layerType==="geojson"){const d=w.getLayerId(t);if(c.includes("polygon")&&r){const u=d+"-polygon";if(e.value?.getLayer(u)&&(e.value?.setPaintProperty(u,"fill-color",r["fill-color"]),e.value?.setPaintProperty(u,"fill-opacity",r["fill-opacity"])),s){const f=u+"-outline";if(console.log("[updateLayerStyle] 多几何类型 - 更新面的边框线"),console.log("[updateLayerStyle] outlineLayerId:",f),console.log("[updateLayerStyle] outlineStyle:",s),console.log("[updateLayerStyle] 图层是否存在:",!!e.value?.getLayer(f)),e.value?.getLayer(f)){const b=s["line-color"],N=s["line-width"],T=s["line-opacity"],B=s["line-dasharray"];if(console.log("[updateLayerStyle] 设置属性:"),console.log(" - line-color:",b),console.log(" - line-width:",N),console.log(" - line-opacity:",T),console.log(" - line-dasharray:",B),e.value?.setPaintProperty(f,"line-color",b),e.value?.setPaintProperty(f,"line-width",N),T!==void 0&&e.value?.setPaintProperty(f,"line-opacity",T),B){const ee=B;if(Array.isArray(ee))if(ee[0]==="literal"){const X=ee[1]||[];console.log("[updateLayerStyle] 设置 line-dasharray (表达式格式):",X),e.value?.setPaintProperty(f,"line-dasharray",X)}else console.log("[updateLayerStyle] 设置 line-dasharray (直接值):",ee),e.value?.setPaintProperty(f,"line-dasharray",ee)}else console.log("[updateLayerStyle] 设置 line-dasharray (实线):",[]),e.value?.setPaintProperty(f,"line-dasharray",[]);console.log("[updateLayerStyle] 面的边框线样式已更新")}else console.warn("[updateLayerStyle] 面的边框线图层不存在,无法更新样式")}else console.warn("[updateLayerStyle] outlineStyle 为空或未定义")}if(c.includes("line")){const u=n.outlineConfigList||[],f=u.find(T=>T.type==="default"),b=u.filter(T=>T.type==="custom"),N=b.length>0&&b[0].key?b[0].key:void 0;if(b.length===0||!N){const T=d+"-line";e.value?.getLayer(T)&&(e.value?.setPaintProperty(T,"line-color",f?.outlineColor||"rgba(103, 194, 58, 1)"),e.value?.setPaintProperty(T,"line-width",f?.outlineWidth||2))}else{const T=d+"-line-default";e.value?.getLayer(T)&&(e.value?.setPaintProperty(T,"line-color",f?.outlineColor||"rgba(103, 194, 58, 1)"),e.value?.setPaintProperty(T,"line-width",f?.outlineWidth||2)),b.forEach((B,ee)=>{const X=`${d}-line-custom-${ee}`;e.value?.getLayer(X)&&(e.value?.setFilter(X,["==",["to-string",["get",N]],String(B.value??"")]),e.value?.setPaintProperty(X,"line-color",B.outlineColor),e.value?.setPaintProperty(X,"line-width",B.outlineWidth))})}}if(c.includes("point")){const u=d+"-point",f=w.getLayerStyle(t);e.value?.getLayer(u)&&f&&Object.keys(f).forEach(B=>{e.value?.setPaintProperty(u,B,f[B])});const b=n.symbolConfig?{showLabel:n.symbolConfig.displayLabel==="true",labelField:n.symbolConfig.labelField||"FID",fontSize:n.symbolConfig.labelSize||14,fontColor:n.symbolConfig.labelColor||"#000000",fontFamily:n.symbolConfig.labelFont||"SimSun"}:void 0,N=w.getLabelStyle(b),T=u+"-label";if(N)if(e.value?.getLayer(T))e.value?.setLayoutProperty(T,"text-field",N["text-field"]),e.value?.setLayoutProperty(T,"text-size",N["text-size"]),e.value?.setPaintProperty(T,"text-color",N["text-color"]);else{const B=N["text-color"],ee=B==="#ffffff"||B==="rgb(255, 255, 255)"||B==="white";e.value?.addLayer({id:T,type:"symbol",source:w.getSourceId(t),filter:["==",["geometry-type"],"Point"],layout:{"text-field":N["text-field"],"text-font":N["text-font"],"text-size":N["text-size"],"text-anchor":"bottom","text-offset":[0,1.5],"text-allow-overlap":!0,"text-ignore-placement":!0,visibility:"visible"},paint:{"text-color":N["text-color"],"text-halo-color":ee?"#000000":"#ffffff","text-halo-width":2}})}else e.value?.getLayer(T)&&e.value?.removeLayer(T)}return}}if(a=="fill"&&r&&s){e.value?.setPaintProperty(w.getLayerId(t),"fill-color",r["fill-color"]),e.value?.setPaintProperty(w.getLayerId(t),"fill-opacity",r["fill-opacity"]),e.value?.setPaintProperty(w.getLayerId(t),"fill-outline-color",r["fill-outline-color"]);try{const b=e.value?.getStyle();if(b&&b.layers){const N=w.getLayerId(t),T=b.layers.filter(B=>B.id.startsWith(N+"-outline")&&!B.id.endsWith("-label"));console.log("更新 outline 图层:",T.map(B=>B.id)),T.forEach(B=>{s&&s["line-color"]&&e.value?.setPaintProperty(B.id,"line-color",s["line-color"]),s&&s["line-width"]&&e.value?.setPaintProperty(B.id,"line-width",s["line-width"]),s&&s["line-opacity"]!==void 0&&e.value?.setPaintProperty(B.id,"line-opacity",s["line-opacity"]);let ee=[];if(s&&s["line-dasharray"]){const X=s["line-dasharray"];Array.isArray(X)&&(X[0]==="literal"?ee=X[1]||[]:ee=X)}e.value?.setPaintProperty(B.id,"line-dasharray",ee)})}}catch(b){console.warn("更新 outline 图层失败:",b)}const c=n.fillConfig?{showLabel:n.fillConfig.displayLabel==="true",labelField:n.fillConfig.labelField||"FID",fontSize:n.fillConfig.labelSize||14,fontColor:n.fillConfig.labelColor||"#000000",fontFamily:n.fillConfig.labelFont||"SimSun"}:n.labelConfig,d=w.getLabelStyle(c),u=w.getLayerId(t)+"-label",f=e.value?.getLayer(u);if(d)if(f)e.value?.setLayoutProperty(u,"text-field",d["text-field"]),e.value?.setLayoutProperty(u,"text-font",d["text-font"]),e.value?.setLayoutProperty(u,"text-size",d["text-size"]),e.value?.setLayoutProperty(u,"text-anchor",d["text-anchor"]),e.value?.setLayoutProperty(u,"text-offset",d["text-offset"]),e.value?.setLayoutProperty(u,"text-allow-overlap",d["text-allow-overlap"]),e.value?.setPaintProperty(u,"text-color",d["text-color"]);else{const b=w.getSourceId(t);console.log("创建标注图层---->",{labelLayerId:u,sourceId:b,labelStyle:d}),e.value?.addLayer({id:u,type:"symbol",source:b,layout:{"text-field":d["text-field"],"text-font":d["text-font"],"text-size":d["text-size"],"text-anchor":d["text-anchor"],"text-offset":d["text-offset"],"text-allow-overlap":d["text-allow-overlap"]},paint:{"text-color":d["text-color"]}},w.getLayerId(t)+"-outline")}else f&&e.value?.removeLayer(u);if(n.outlineConfig){const b={showLabel:n.outlineConfig.displayLabel==="true",labelField:n.outlineConfig.labelField||"FID",fontSize:n.outlineConfig.labelSize||14,fontColor:n.outlineConfig.labelColor||"#000000",fontFamily:n.outlineConfig.labelFont||"SimSun"},N=w.getLabelStyle(b),T=w.getLayerId(t)+"-outline-label",B=e.value?.getLayer(T);if(N)if(B)e.value?.setLayoutProperty(T,"text-field",N["text-field"]),e.value?.setLayoutProperty(T,"text-font",N["text-font"]),e.value?.setLayoutProperty(T,"text-size",N["text-size"]),e.value?.setLayoutProperty(T,"text-anchor",N["text-anchor"]),e.value?.setLayoutProperty(T,"text-offset",N["text-offset"]),e.value?.setLayoutProperty(T,"text-allow-overlap",N["text-allow-overlap"]),e.value?.setLayoutProperty(T,"symbol-placement","line-center"),e.value?.setPaintProperty(T,"text-color",N["text-color"]);else{const ee=w.getSourceId(t);console.log("创建轮廓线标注图层---->",{outlineLabelLayerId:T,sourceId:ee,outlineLabelStyle:N}),e.value?.addLayer({id:T,type:"symbol",source:ee,layout:{"text-field":N["text-field"],"text-font":N["text-font"],"text-size":N["text-size"],"text-anchor":N["text-anchor"],"text-offset":N["text-offset"],"text-allow-overlap":N["text-allow-overlap"],"symbol-placement":"line-center"},paint:{"text-color":N["text-color"]}},w.getLayerId(t)+"-outline")}else B&&e.value?.removeLayer(T)}}else if(a=="line"){s&&s["line-color"]&&e.value?.setPaintProperty(w.getLayerId(t),"line-color",s["line-color"]),s&&s["line-opacity"]&&e.value?.setPaintProperty(w.getLayerId(t),"line-opacity",s["line-opacity"]),s&&s["line-width"]&&e.value?.setPaintProperty(w.getLayerId(t),"line-width",s["line-width"]),e.value?.setPaintProperty(w.getLayerId(t),"line-dasharray",[]),s&&s["line-dasharray"]&&e.value?.setPaintProperty(w.getLayerId(t),"line-dasharray",s["line-dasharray"]);const c=n.outlineConfig?{showLabel:n.outlineConfig.displayLabel==="true",labelField:n.outlineConfig.labelField||"FID",fontSize:n.outlineConfig.labelSize||14,fontColor:n.outlineConfig.labelColor||"#000000",fontFamily:n.outlineConfig.labelFont||"SimSun"}:n.lineLabelConfig,d=w.getLabelStyle(c),u=w.getLayerId(t)+"-label",f=e.value?.getLayer(u);if(d)if(f)e.value?.setLayoutProperty(u,"text-field",d["text-field"]),e.value?.setLayoutProperty(u,"text-font",d["text-font"]),e.value?.setLayoutProperty(u,"text-size",d["text-size"]),e.value?.setLayoutProperty(u,"text-anchor",d["text-anchor"]),e.value?.setLayoutProperty(u,"text-offset",d["text-offset"]),e.value?.setLayoutProperty(u,"text-allow-overlap",d["text-allow-overlap"]),e.value?.setPaintProperty(u,"text-color",d["text-color"]);else{const b=w.getSourceId(t);console.log("创建线标注图层---->",{lineLabelLayerId:u,sourceId:b,lineLabelStyle:d}),e.value?.addLayer({id:u,type:"symbol",source:b,layout:{"text-field":d["text-field"],"text-font":d["text-font"],"text-size":d["text-size"],"text-anchor":d["text-anchor"],"text-offset":d["text-offset"],"text-allow-overlap":d["text-allow-overlap"],"symbol-placement":"line-center"},paint:{"text-color":d["text-color"]}},w.getLayerId(t))}else f&&e.value?.removeLayer(u)}else if(a=="circle"){const c=w.getCircleStyle(n);c&&c["circle-color"]&&e.value?.setPaintProperty(w.getLayerId(t),"circle-color",c["circle-color"]),c&&c["circle-opacity"]&&e.value?.setPaintProperty(w.getLayerId(t),"circle-opacity",c["circle-opacity"]),c&&c["circle-radius"]&&e.value?.setPaintProperty(w.getLayerId(t),"circle-radius",c["circle-radius"]),c&&c["circle-stroke-color"]&&e.value?.setPaintProperty(w.getLayerId(t),"circle-stroke-color",c["circle-stroke-color"]),c&&c["circle-stroke-width"]&&e.value?.setPaintProperty(w.getLayerId(t),"circle-stroke-width",c["circle-stroke-width"]);const d=n.symbolConfig?{showLabel:n.symbolConfig.displayLabel==="true",labelField:n.symbolConfig.labelField||"FID",fontSize:n.symbolConfig.labelSize||14,fontColor:n.symbolConfig.labelColor||"#000000",fontFamily:n.symbolConfig.labelFont||"SimSun"}:void 0,u=w.getLabelStyle(d),f=w.getLayerId(t)+"-label",b=e.value?.getLayer(f);if(u)if(b)e.value?.setLayoutProperty(f,"text-field",u["text-field"]),e.value?.setLayoutProperty(f,"text-font",u["text-font"]),e.value?.setLayoutProperty(f,"text-size",u["text-size"]),e.value?.setLayoutProperty(f,"text-anchor",u["text-anchor"]),e.value?.setLayoutProperty(f,"text-offset",u["text-offset"]),e.value?.setLayoutProperty(f,"text-allow-overlap",u["text-allow-overlap"]),e.value?.setPaintProperty(f,"text-color",u["text-color"]);else{const N=w.getSourceId(t),T=u["text-color"],B=T==="#ffffff"||T==="rgb(255, 255, 255)"||T==="white";e.value?.addLayer({id:f,type:"symbol",source:N,layout:{"text-field":u["text-field"],"text-font":u["text-font"],"text-size":u["text-size"],"text-anchor":"bottom","text-offset":[0,1.5],"text-allow-overlap":!0,"text-ignore-placement":!0,visibility:"visible"},paint:{"text-color":u["text-color"],"text-halo-color":B?"#000000":"#ffffff","text-halo-width":2}},w.getLayerId(t))}else b&&e.value?.removeLayer(f)}else if(a=="symbol"){const c=w.getCircleStyle(n);c&&c["icon-image"]&&e.value?.setLayoutProperty(w.getLayerId(t),"icon-image",c["icon-image"])}if(t.layerType==="sample-group"&&t.layerShapes?.includes("line")||t.layerType==="track"){const c=JSON.parse(t.layerPaintConfig||"{}"),d=`${t.id}-line-layer`;if(e.value?.getLayer(d)){switch(c.lineColor&&e.value?.setPaintProperty(d,"line-color",c.lineColor),c.lineWidth!==void 0&&e.value?.setPaintProperty(d,"line-width",c.lineWidth),e.value?.setPaintProperty(d,"line-dasharray",[]),c.lineStyle){case"dotted":case"dot-line":e.value?.setPaintProperty(d,"line-dasharray",[5.2,5.2]);break;case"simple-dash":case"dashed":e.value?.setPaintProperty(d,"line-dasharray",[8,4]);break;case"dot-dash":e.value?.setPaintProperty(d,"line-dasharray",[5,5,1,5]);break;case"long-dash":e.value?.setPaintProperty(d,"line-dasharray",[20,5]);break;case"complex-pattern":e.value?.setPaintProperty(d,"line-dasharray",[10,3,3,3]);break}const f=`${t.id}-line-text`;e.value?.getLayer(f)&&(c.labelSize&&e.value?.setLayoutProperty(f,"text-size",c.labelSize),c.labelColor&&e.value?.setPaintProperty(f,"text-color",c.labelColor))}}const h=[];let{symbolConfigList:m}=n;m=(Array.isArray(m)?m:[]).filter(c=>c.fontSize&&c.field&&c.textColor),m.forEach((c,d)=>{const u="points-symbol-"+t.id+c.field,f=w.getSourceId(t);e.value?.getLayer(u)?(e.value?.setLayoutProperty(u,"text-size",c.fontSize),e.value?.setPaintProperty(u,"text-color",c.textColor)):(e.value?.addLayer({id:u,type:"symbol",source:f,layout:{visibility:"visible","text-field":["get",c.field],"text-size":c.fontSize,"symbol-avoid-edges":!0,"icon-image":"circle-11","text-ignore-placement":!1,"text-max-angle":38},paint:{"text-color":c.textColor}}),h.push(c.field))})}function ae(t){if(!t.geoJSON){console.warn("图层配置缺失,无法渲染图层");return}if(t.layerType==="geojson"){const s=w.parseStyleConfig(t);Ne(t,s);return}if(!t.customLayerConfig){console.warn("图层配置缺失,无法渲染图层");return}const l=JSON.parse(t.customLayerConfig),a=w.getLayerId(t);e.value?.getLayer(a)!==void 0&&(console.warn(`图层 ${a} 已存在,无法重复添加`),e.value?.removeLayer(a),e.value?.removeSource(a));const r=JSON.parse(t.geoJSON);switch(t.layerType){case"symbol":const s={id:a,type:"symbol",source:{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:r.features[0].geometry.coordinates},properties:{title:t.layerName||l.iconName,icon:`${l.iconName}`}}]}},layout:{"icon-image":"{icon}","icon-size":.1,"icon-anchor":"center","text-field":"{title}","text-font":["Open Sans Semibold","Arial Unicode MS Bold"],"text-offset":[0,1.8],"text-anchor":"center","text-size":12,"text-allow-overlap":!0,"text-optional":!0},paint:{"text-color":l.textColor,"text-halo-color":"rgba(0,0,0,0.32)","text-halo-width":1,"text-halo-blur":2,"text-translate":[0,0]}};e.value?.addLayer(s);break;case"line":const y={id:a,type:"line",source:{type:"geojson",data:r},layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":l.lineColor,"line-width":Number(l.lineWidth)}};switch(l.lineStyle){case"dotted":case"dot-line":y.paint["line-dasharray"]=[5.2,5.2];break;case"simple-dash":case"dashed":y.paint["line-dasharray"]=[8,4];break;case"dot-dash":y.paint["line-dasharray"]=[5,5,1,5];break;case"long-dash":y.paint["line-dasharray"]=[20,5];break;case"complex-pattern":y.paint["line-dasharray"]=[10,3,3,3];break}e.value?.addLayer(y);break;case"shape":let h=a+"-outline";const m={id:h,type:"line",source:{type:"geojson",data:JSON.parse(t.geoJSON)},layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":l.fillColor,"line-width":Number(l.lineWidth)}};e.value?.getLayer(h)!==void 0&&(e.value?.removeLayer(h),e.value?.removeSource(h)),e.value?.addLayer(m);const d={id:a,type:"fill",source:{type:"geojson",data:r},layout:{},paint:{"fill-color":l.fillColor,"fill-opacity":.32}};e.value?.addLayer(d);break}}function re(t,l){const a=(t.layerShapes||"").split(",").map(s=>s.trim().toLowerCase()).filter(s=>["point","line","polygon"].includes(s));if(a.length>0)return Array.from(new Set(a));const n=Array.isArray(l?.features)?l.features:[],r=new Set;return n.forEach(s=>{const y=s?.geometry?.type;y==="Point"||y==="MultiPoint"?r.add("point"):y==="LineString"||y==="MultiLineString"?r.add("line"):(y==="Polygon"||y==="MultiPolygon")&&r.add("polygon")}),Array.from(r)}function Se(t,l){const a=e.value?.getSource(t);if(a&&typeof a.setData=="function"){a.setData(l);return}a&&e.value?.removeSource(t),e.value?.addSource(t,{type:"geojson",data:l})}function Ne(t,l){const a=w.getLayerId(t),n=w.getSourceId(t),r=JSON.parse(t.geoJSON),s=re(t,r);if(s.length||s.push("point"),ue(t),Se(n,r),s.length>1){Oe(t,n,s,l);return}s[0]==="point"?_(t,n,a,l):s[0]==="line"?$(t,n,a,l):s[0]==="polygon"&&$e(n,a,l)}function Te(t){if(console.log("renderGeoJSONWithPaintConfig 被调用",t),!t.geoJSON){console.warn("图层配置或 geoJSON 数据缺失,无法渲染图层",{hasGeoJSON:!!t.geoJSON,layer:t});return}const l=w.parseLayerPaintConfig(t.layerPaintConfig,t.layerType);if(t.layerType==="geojson"){Ne(t,l);return}console.log("解析后的样式配置:",l);const a=w.getLayerId(t);console.log("图层ID:",a);const n=JSON.parse(t.geoJSON);console.log("解析后的 geoJSON:",n),e.value?.getLayer(a)&&(console.log(`图层 ${a} 已存在,先移除旧图层`),ue(t));const r=t.layerShapes||"point";switch(console.log("几何类型:",r),r){case"point":ke(t,a,n,l);break;case"line":Ee(a,n,l);break;case"polygon":ze(a,n,l);break;default:console.warn(`不支持的几何类型: ${r}`);break}}function ke(t,l,a,n){console.log("renderGeoJSONPoint 被调用",{layerId:l,styleConfig:n,layerName:t.layerName});let r=8,s="#67c23a",y=1,h="",m="rgba(0, 0, 0, 1)",c="#ffffff",d=1;if(n.pointSize||n.pointTintColor||n.iconName||n.textColor)r=n.pointSize||8,s=n.pointTintColor||n.pointColor||"#67c23a",y=n.pointOpacity||1,h=n.iconName||n.pointStyle||"",m=n.textColor||n.labelColor||"rgba(0, 0, 0, 1)",c=n.textHaloColor||"#ffffff",d=n.textHaloWidth||1;else if(n.symbolConfigList||n.circleConfigList){const f=n.symbolConfigList||n.circleConfigList,b=f.find(N=>N.type==="default")||f[0];b&&(r=b.pointSize||8,s=b.pointTintColor||"#67c23a",y=b.pointOpacity||1,h=b.pointStyle||""),n.symbolConfig&&(m=n.symbolConfig.labelColor||"rgba(0, 0, 0, 1)")}console.log("点样式:",{pointSize:r,pointColor:s,pointOpacity:y,iconName:h,textColor:m});const u={id:l,type:"symbol",source:{type:"geojson",data:a},layout:{"icon-image":h,"icon-size":r/80,"icon-anchor":"center","icon-allow-overlap":!0,"text-field":t.layerName||"","text-font":["Open Sans Regular","Arial Unicode MS Regular"],"text-size":12,"text-offset":[0,.8],"text-anchor":"top","text-allow-overlap":!0,"text-optional":!0},paint:{"text-color":m,"text-halo-color":c,"text-halo-width":d,"text-halo-blur":1}};console.log("准备添加 symbol 图层:",u),e.value?.addLayer(u),console.log("symbol 图层已添加")}function Ee(t,l,a){console.log("renderGeoJSONLine 被调用",{layerId:t,styleConfig:a});let n="#67c23a",r=2,s="solid";if(a.lineColor)n=a.lineColor,r=a.lineWidth||2,s=a.lineStyle||"solid";else if(a.outlineConfigList){const h=a.outlineConfigList.find(m=>m.type==="default")||a.outlineConfigList[0];h&&(n=h.outlineColor||"#67c23a",r=h.outlineWidth||2,s=h.lineStyle||"solid")}console.log("线条样式:",{lineColor:n,lineWidth:r,lineStyle:s});const y={id:t,type:"line",source:{type:"geojson",data:l},layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":n,"line-width":r}};switch(s){case"dotted":case"dot-line":y.paint["line-dasharray"]=[5.2,5.2];break;case"simple-dash":case"dashed":y.paint["line-dasharray"]=[8,4];break;case"dot-dash":y.paint["line-dasharray"]=[5,5,1,5];break;case"long-dash":y.paint["line-dasharray"]=[20,5];break;case"complex-pattern":y.paint["line-dasharray"]=[10,3,3,3];break}console.log("准备添加线图层:",y),e.value?.addLayer(y),console.log("线图层已添加")}function ze(t,l,a){if(a?.outlineConfigList||a?.fillColorList){const d=w.getFillStyle(a),u={id:t,type:"fill",source:{type:"geojson",data:l},paint:{"fill-color":d?.["fill-color"]||"#67c23a","fill-opacity":d?.["fill-opacity"]??.3}};e.value?.addLayer(u);const f=a.outlineConfigList||[],b=f.find(W=>W.type==="default"),T=f.filter(W=>W.type==="custom").filter(W=>!!W.key&&W.value!==void 0&&W.value!==null&&String(W.value)!=="");if(T.length===0){const W=w.getOutLineStyle(a);e.value?.addLayer({id:t+"-outline",type:"line",source:{type:"geojson",data:l},layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":W?.["line-color"]||"#67c23a","line-width":W?.["line-width"]||2,"line-opacity":W?.["line-opacity"]??1,"line-dasharray":W?.["line-dasharray"]||[]}});return}const B=new Map;T.forEach(W=>{const ce=B.get(W.key)||[],he=String(W.value);ce.includes(he)||(ce.push(he),B.set(W.key,ce))});const ee=Array.from(B.entries()).map(([W,ce])=>["!",["in",["to-string",["get",W]],["literal",ce]]]),X=ee.length===1?ee[0]:["all",...ee];e.value?.addLayer({id:`${t}-outline-default`,type:"line",source:{type:"geojson",data:l},filter:X,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":b?.outlineColor||"#67c23a","line-width":b?.outlineWidth||2,"line-dasharray":b?.lineStyle==="dash"?[2,2]:[]}}),T.forEach((W,ce)=>{e.value?.addLayer({id:`${t}-outline-custom-${ce}`,type:"line",source:{type:"geojson",data:l},filter:["==",["to-string",["get",W.key]],String(W.value)],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":W.outlineColor||"rgba(103, 194, 58, 1)","line-width":W.outlineWidth??2,"line-dasharray":W.lineStyle==="dash"?[2,2]:[]}})});return}console.log("renderGeoJSONPolygon 被调用",{layerId:t,styleConfig:a});let n="#67c23a",r=.3,s="#67c23a",y=2;if(a.fillColor||a.outlineColor)n=a.fillColor||"#67c23a",r=a.fillOpacity||.3,s=a.outlineColor||a.fillColor||"#67c23a",y=a.outlineWidth||a.lineWidth||2;else{const d=a.fillConfigList?.[0];d&&(n=d.fillColor||"#67c23a",r=d.fillOpacity||.3);const u=a.outlineConfigList?.find(f=>f.type==="default")||a.outlineConfigList?.[0];u&&(s=u.outlineColor||"#67c23a",y=u.outlineWidth||2)}console.log("面样式:",{fillColor:n,fillOpacity:r,outlineColor:s,outlineWidth:y});const h={id:t,type:"fill",source:{type:"geojson",data:l},paint:{"fill-color":n,"fill-opacity":r}};console.log("准备添加填充图层:",h),e.value?.addLayer(h),console.log("填充图层已添加");const c={id:t+"-outline",type:"line",source:{type:"geojson",data:l},layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":s,"line-width":y}};console.log("准备添加边框图层:",c),e.value?.addLayer(c),console.log("边框图层已添加")}function ue(t){if(console.log("[removeGeoJSONLayer] 开始移除图层:",{id:t.id,name:t.layerName,type:t.layerType}),t.layerType==="geojson"&&e.value){fo(e.value,t);let l=-1;Q.value.forEach((a,n)=>{a.id===t.id&&(l=n)}),l>-1?(console.log("[removeGeoJSONLayer] 从 thirdPartyLayers 中移除图层, index:",l),Q.value.splice(l,1)):console.warn("[removeGeoJSONLayer] 图层不在 thirdPartyLayers 中"),console.log("[removeGeoJSONLayer] GeoJSON 图层移除完成");return}console.warn("[removeGeoJSONLayer] 不是 GeoJSON 图层或地图实例不存在,跳过移除")}async function We(t){console.log("加载图层---->",t);const l=w.getLayerId(t),a=w.getSourceId(t);console.log("sourceId--->",a);const n=w.parseStyleConfig(t);console.log("styleConfig",n);const r=w.getLayerType(t);if(e.value?.getSource(a)||e.value?.addSource(a,{type:"geojson",data:t.url?.replace("bjhweb","bjh")}),["shp","kml","kmz","geojson"].includes(t.layerType)&&t.layerShapes){const h=t.layerShapes.split(",").map(m=>m.trim());if(console.log("layerShapes--->",h),h.length>1||t.layerType==="geojson"){console.log("多几何类型图层,为每种类型创建图层"),await Oe(t,a,h,n);return}console.log("单一几何类型图层--->",r)}else console.log("layerType--->",r);const y={id:l,source:a,name:l,layout:{visibility:"visible"},type:r};if(r!="symbol"){const h=w.getLayerStyle(t);if(r==="circle"&&h&&h._useNewFormat){const m=`custom-icon-${t.id}-`;e.value?.listImages&&e.value.listImages().forEach(f=>{f.startsWith(m)&&e.value?.removeImage(f)});const c=h._circleConfigList||[],d=[];c.forEach(u=>{if(!(u.type==="custom"&&(u.value===""||u.value==null))&&u.renderMode==="color"){const f=u.type==="default"?"default":u.key,N=w.resolveAssetById(u.pointStyle||"",i.shapeOptions)?.url||"";if(!N)return;const T=ve(N,u.pointTintColor||"#67c23a",f).catch(B=>{console.error(`加载 SVG 图标失败: ${u.pointStyle}`,B)});d.push(T)}}),Promise.all(d).then(()=>{e.value?.getLayer(l)&&e.value?.removeLayer(l),y.type="symbol",y.layout={"icon-image":h["icon-image"],"icon-size":h["icon-size"],"icon-allow-overlap":!0,"icon-ignore-placement":!0,visibility:"visible"},e.value?.addLayer(y)}).catch(u=>{console.error("加载图标失败:",u),y.paint=h,e.value?.addLayer(y)})}else y.paint=h,e.value?.addLayer(y)}else{const h=w.getLayerStyle(t);y.layout={visibility:"visible","symbol-placement":"line","symbol-spacing":10,"icon-size":.1,"icon-keep-upright":!0,"icon-rotate":0,"icon-allow-overlap":!0,...h},console.log("layerConfig--->",y),e.value?.addLayer(y)}if(r=="fill"){const h=n.outlineConfigList||[],m=h.find(b=>b.type==="default"),c=h.filter(b=>b.type==="custom"),d=c.filter(b=>!!b.key&&b.value!==void 0&&b.value!==null&&String(b.value)!=="");if(d.length===0){const b=w.getOutLineStyle(n),N={"line-color":b["line-color"],"line-width":b["line-width"],"line-dasharray":b["line-dasharray"]||[]};b["line-opacity"]&&(N["line-opacity"]=b["line-opacity"]),e.value?.addLayer({id:l+"-outline",source:a,name:l+"-outline",layout:{visibility:"visible","line-join":"round","line-cap":"round"},type:"line",paint:N})}else{const b=new Map;d.forEach(X=>{const W=b.get(X.key)||[],ce=String(X.value);W.includes(ce)||(W.push(ce),b.set(X.key,W))});const N=Array.from(b.entries()).map(([X,W])=>["!",["in",["to-string",["get",X]],["literal",W]]]),T=N.length===1?N[0]:["all",...N],B=`${l}-outline-default`,ee={"line-color":m?.outlineColor||"rgba(103, 194, 58, 1)","line-width":m?.outlineWidth||2};m?.lineStyle==="dash"&&(ee["line-dasharray"]=[2,2]),e.value?.addLayer({id:B,source:a,type:"line",filter:T,layout:{"line-join":"round","line-cap":"round"},paint:ee}),d.forEach((X,W)=>{const ce=`${l}-outline-custom-${W}`,he={"line-color":X.outlineColor||"rgba(103, 194, 58, 1)","line-width":X.outlineWidth??2};X.lineStyle==="dash"&&(he["line-dasharray"]=[2,2]),e.value?.addLayer({id:ce,source:a,type:"line",filter:["==",["to-string",["get",X.key]],String(X.value)],layout:{"line-join":"round","line-cap":"round"},paint:he})}),console.log(`[outline 多图层] 默认图层 + ${c.filter(X=>X.value).length} 个自定义图层`)}const u=n.fillConfig?{showLabel:n.fillConfig.displayLabel==="true",labelField:n.fillConfig.labelField||"FID",fontSize:n.fillConfig.labelSize||14,fontColor:n.fillConfig.labelColor||"#000000",fontFamily:n.fillConfig.labelFont||"SimSun"}:n.labelConfig,f=w.getLabelStyle(u);if(f&&(console.log("初次加载时创建标注图层---->",{labelId:l+"-label",sourceId:a,labelStyle:f}),e.value?.addLayer({id:l+"-label",type:"symbol",source:a,layout:{"text-field":f["text-field"],"text-font":f["text-font"],"text-size":f["text-size"],"text-anchor":f["text-anchor"],"text-offset":f["text-offset"],"text-allow-overlap":f["text-allow-overlap"]},paint:{"text-color":f["text-color"]}})),n.outlineConfig){const b={showLabel:n.outlineConfig.displayLabel==="true",labelField:n.outlineConfig.labelField||"FID",fontSize:n.outlineConfig.labelSize||14,fontColor:n.outlineConfig.labelColor||"#000000",fontFamily:n.outlineConfig.labelFont||"SimSun"},N=w.getLabelStyle(b);N&&(console.log("初次加载时创建轮廓线标注图层---->",{labelId:l+"-outline-label",sourceId:a,outlineLabelStyle:N}),e.value?.addLayer({id:l+"-outline-label",type:"symbol",source:a,layout:{"text-field":N["text-field"],"text-font":N["text-font"],"text-size":N["text-size"],"text-anchor":N["text-anchor"],"text-offset":N["text-offset"],"text-allow-overlap":N["text-allow-overlap"],"symbol-placement":"line-center"},paint:{"text-color":N["text-color"]}}))}}else if(r=="line"){const h=n.outlineConfig?{showLabel:n.outlineConfig.displayLabel==="true",labelField:n.outlineConfig.labelField||"FID",fontSize:n.outlineConfig.labelSize||14,fontColor:n.outlineConfig.labelColor||"#000000",fontFamily:n.outlineConfig.labelFont||"SimSun"}:n.lineLabelConfig,m=w.getLabelStyle(h);m?e.value?.addLayer({id:l+"-label",type:"symbol",source:a,layout:{"text-field":m["text-field"],"text-font":m["text-font"],"text-size":m["text-size"],"text-anchor":m["text-anchor"],"text-offset":m["text-offset"],"text-allow-overlap":m["text-allow-overlap"],"symbol-placement":"line-center"},paint:{"text-color":m["text-color"]}}):console.log("线标注样式为空,不创建标注图层")}else if(r=="circle"){const h=n.symbolConfig?{showLabel:n.symbolConfig.displayLabel==="true",labelField:n.symbolConfig.labelField||"FID",fontSize:n.symbolConfig.labelSize||14,fontColor:n.symbolConfig.labelColor||"#000000",fontFamily:n.symbolConfig.labelFont||"SimSun"}:void 0,m=w.getLabelStyle(h);if(m){const c=m["text-color"],d=c==="#ffffff"||c==="rgb(255, 255, 255)"||c==="white";e.value?.addLayer({id:l+"-label",type:"symbol",source:a,layout:{"text-field":m["text-field"],"text-font":m["text-font"],"text-size":m["text-size"],"text-anchor":"bottom","text-offset":[0,1.5],"text-allow-overlap":!0,"text-ignore-placement":!0,visibility:"visible"},paint:{"text-color":m["text-color"],"text-halo-color":d?"#000000":"#ffffff","text-halo-width":2}})}}}async function Oe(t,l,a,n){const r=w.getLayerId(t);a.includes("polygon")&&(console.log("渲染多几何类型-面图层"),$e(l,r,n)),a.includes("line")&&(console.log("渲染多几何类型-线图层"),$(t,l,r,n)),a.includes("point")&&(console.log("渲染多几何类型-点图层"),await _(t,l,r,n))}function $e(t,l,a){const n=l+"-polygon",r=w.getFillStyle(a),s={};r?(s["fill-color"]=r["fill-color"],s["fill-opacity"]=r["fill-opacity"]):(s["fill-color"]="rgba(103, 194, 58, 0.6)",s["fill-opacity"]=.6),e.value?.addLayer({id:n,source:t,type:"fill",filter:["==",["geometry-type"],"Polygon"],paint:s});const y=w.getOutLineStyle(a);console.log("[renderPolygonGeometry] outlineStyle:",y);const h={"line-color":y["line-color"],"line-width":y["line-width"]};if(y["line-dasharray"]){const d=y["line-dasharray"];Array.isArray(d)&&d[0]==="literal"?h["line-dasharray"]=d[1]||[]:Array.isArray(d)&&d.length===2?h["line-dasharray"]=d:h["line-dasharray"]=[]}else h["line-dasharray"]=[];y["line-opacity"]!==void 0&&(h["line-opacity"]=y["line-opacity"]),console.log("[renderPolygonGeometry] outlinePaint:",h),e.value?.addLayer({id:n+"-outline",source:t,type:"line",filter:["==",["geometry-type"],"Polygon"],layout:{"line-join":"round","line-cap":"round"},paint:h});const m=a.fillConfig?{showLabel:a.fillConfig.displayLabel==="true",labelField:a.fillConfig.labelField||"FID",fontSize:a.fillConfig.labelSize||14,fontColor:a.fillConfig.labelColor||"#000000",fontFamily:a.fillConfig.labelFont||"SimSun"}:void 0,c=w.getLabelStyle(m);c&&e.value?.addLayer({id:n+"-label",type:"symbol",source:t,filter:["==",["geometry-type"],"Polygon"],layout:{"text-field":c["text-field"],"text-font":c["text-font"],"text-size":c["text-size"],"text-anchor":c["text-anchor"],"text-offset":c["text-offset"],"text-allow-overlap":c["text-allow-overlap"]},paint:{"text-color":c["text-color"]}})}function $(t,l,a,n){const r=n.outlineConfigList||[],s=r.find(d=>d.type==="default"),y=r.filter(d=>d.type==="custom"),h=y.length>0&&y[0].key?y[0].key:void 0;if(y.length===0||!h){const d=a+"-line",u={"line-color":s?.outlineColor||"rgba(103, 194, 58, 1)","line-width":s?.outlineWidth||2};s?.lineStyle==="dash"&&(u["line-dasharray"]=[2,2]),e.value?.addLayer({id:d,source:l,type:"line",filter:["==",["geometry-type"],"LineString"],layout:{"line-join":"round","line-cap":"round"},paint:u})}else{const d=a+"-line-default",u={"line-color":s?.outlineColor||"rgba(103, 194, 58, 1)","line-width":s?.outlineWidth||2};s?.lineStyle==="dash"&&(u["line-dasharray"]=[2,2]),e.value?.addLayer({id:d,source:l,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:u}),y.forEach((f,b)=>{if(!f.value)return;const N=`${a}-line-custom-${b}`,T={"line-color":f.outlineColor||"rgba(103, 194, 58, 1)","line-width":f.outlineWidth??2};f.lineStyle==="dash"&&(T["line-dasharray"]=[2,2]),e.value?.addLayer({id:N,source:l,type:"line",filter:["==",["to-string",["get",h]],String(f.value)],layout:{"line-join":"round","line-cap":"round"},paint:T})}),console.log(`[renderLineGeometry] 多图层方案:默认图层 + ${y.filter(f=>f.value).length} 个自定义图层`)}const m=n.outlineConfig?{showLabel:n.outlineConfig.displayLabel==="true",labelField:n.outlineConfig.labelField||"FID",fontSize:n.outlineConfig.labelSize||14,fontColor:n.outlineConfig.labelColor||"#000000",fontFamily:n.outlineConfig.labelFont||"SimSun"}:void 0,c=w.getLabelStyle(m);c&&e.value?.addLayer({id:a+"-line-label",type:"symbol",source:l,filter:["==",["geometry-type"],"LineString"],layout:{"text-field":c["text-field"],"text-font":c["text-font"],"text-size":c["text-size"],"text-anchor":c["text-anchor"],"text-offset":c["text-offset"],"text-allow-overlap":c["text-allow-overlap"],"symbol-placement":"line-center"},paint:{"text-color":c["text-color"]}})}async function _(t,l,a,n){const r=a+"-point",s=w.getLayerStyle(t);if(console.log("renderPointGeometry pointStyle:",s),s&&s._useNewFormat){const m=`custom-icon-${t.id}-`;e.value?.listImages&&e.value.listImages().forEach(f=>{f.startsWith(m)&&e.value?.removeImage(f)});const c=s._circleConfigList||[],d=[];c.forEach(u=>{if(!(u.type==="custom"&&(u.value===""||u.value==null))&&u.renderMode==="color"){const f=u.type==="default"?"default":u.key,N=w.resolveAssetById(u.pointStyle||"",i.shapeOptions)?.url||"";if(!N)return;const T=ve(N,u.pointTintColor||"#67c23a",f).catch(B=>{console.error(`加载 SVG 图标失败: ${u.pointStyle}`,B)});d.push(T)}});try{await Promise.all(d),e.value?.addLayer({id:r,source:l,type:"symbol",filter:["==",["geometry-type"],"Point"],layout:{"icon-image":s["icon-image"],"icon-size":s["icon-size"],"icon-allow-overlap":!0,"icon-ignore-placement":!0}})}catch(u){console.error("加载图标失败:",u)}}else console.log("使用旧格式渲染点位 (circle)"),e.value?.addLayer({id:r,source:l,type:"circle",filter:["==",["geometry-type"],"Point"],paint:s});const y=n.symbolConfig?{showLabel:n.symbolConfig.displayLabel==="true",labelField:n.symbolConfig.labelField||"FID",fontSize:n.symbolConfig.labelSize||14,fontColor:n.symbolConfig.labelColor||"#000000",fontFamily:n.symbolConfig.labelFont||"SimSun"}:void 0,h=w.getLabelStyle(y);if(h){const m=h["text-color"],c=m==="#ffffff"||m==="rgb(255, 255, 255)"||m==="white";e.value?.addLayer({id:r+"-label",type:"symbol",source:l,filter:["==",["geometry-type"],"Point"],layout:{"text-field":h["text-field"],"text-font":h["text-font"],"text-size":h["text-size"],"text-anchor":"bottom","text-offset":[0,.5],"text-allow-overlap":!0,"text-ignore-placement":!0,visibility:"visible"},paint:{"text-color":h["text-color"],"text-halo-color":c?"#000000":"#ffffff","text-halo-width":2}})}}const Z=o.ref([]);function de(t){if(!e.value){console.warn("地图实例未初始化,无法添加调查数据图层");return}Ue(t);const l={renderMode:"color",pointStyle:"118",pointTintColor:"rgba(103, 194, 58, 0.6)",pointSize:2,displayLabel:!1,labelSize:14,labelColor:"rgba(0, 0, 0, 1)",labelFont:"SimSun"},a=t.layerPaintConfig?JSON.parse(t.layerPaintConfig):l;console.log("addResearchMapLayer layerPaintConfig:",a);const n=t.pointInfo||[];if(!n||n.length===0){console.error("点位数据缺失,无法添加点图层");return}a.renderMode==="hatMap"?fe(t,n):a.renderMode==="icon"?se(t,n,a):ye(t,n,a),we()}function fe(t,l,a){const n=`${t.id}-heatmap-source`,r=`${t.id}-heatmap-layer`,s=l.map(m=>{let c=[0,0];return m.latitude&&m.longitude&&(c=[Number(m.longitude),Number(m.latitude)]),{type:"Feature",properties:{},geometry:{type:"Point",coordinates:c}}});e.value?.getSource(n)&&e.value?.removeSource(n),e.value?.getLayer(r)&&e.value?.removeLayer(r),e.value?.addSource(n,{type:"geojson",data:{type:"FeatureCollection",features:s}}),e.value?.addLayer({id:r,type:"heatmap",source:n,maxzoom:9,paint:{"heatmap-weight":1,"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,9,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(33,102,172,0)",.2,"blue",.4,"cyan",.6,"lime",.8,"yellow",1,"red"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,2,9,20],"heatmap-opacity":["interpolate",["linear"],["zoom"],7,1,9,0]}})}function se(t,l,a){console.log("addIconMarkers pointInfoList:",l),l.forEach((n,r)=>{let s=[0,0];n.latitude&&n.longitude?s=[Number(n.longitude),Number(n.latitude)]:n.latitudeStart&&n.longitudeStart&&(s=[Number(n.longitudeStart),Number(n.latitudeStart)]);const y=document.createElement("div");y.className="research-location-icon-el";const h=document.createElement("img");h.className="research-location-img-el";const m=w.resolveAssetById(a.pointStyle||"",i.iconOptions);h.src=m?.url||Re.mapIconBaseUrl+(a.pointStyle||""),y.appendChild(h),y.onclick=d=>{rt(d,n)};const c=`${t.id}-research-point-${r}`;Pt(c,s,y)})}async function ye(t,l,a){console.log("addColorMarkers pointInfoList:",l);const n=`${t.id}-color-points-source`,r=`${t.id}-color-points-layer`,y=w.resolveAssetById(a.pointStyle||"",i.shapeOptions)?.url||"",h=a.pointTintColor||"rgba(103, 194, 58, 0.6)";try{if(!y){console.error("SVG 图标 URL 解析失败,pointStyle:",a.pointStyle);return}const m=await ve(y,h,t.id);if(!m){console.error("SVG 图标加载失败,使用默认图标");return}const c=l.map(f=>{let b=[0,0];return f.latitude&&f.longitude?b=[Number(f.longitude),Number(f.latitude)]:f.latitudeStart&&f.longitudeStart&&(b=[Number(f.longitudeStart),Number(f.latitudeStart)]),{type:"Feature",properties:{...f,layerName:t.layerName},geometry:{type:"Point",coordinates:b}}});e.value?.getSource(n)&&e.value?.removeSource(n),e.value?.getLayer(r)&&e.value?.removeLayer(r),e.value?.addSource(n,{type:"geojson",data:{type:"FeatureCollection",features:c}}),e.value?.addLayer({id:r,type:"symbol",source:n,layout:{"icon-image":m,"icon-size":a.pointSize?a.pointSize/100:.18,"icon-anchor":"center","icon-allow-overlap":!0,"text-allow-overlap":!0},paint:{}}),e.value?.on("click",r,f=>{if(f.features&&f.features.length>0){const b=f.features[0].properties;console.log("Point clicked:",b),rt(f.originalEvent,b)}}),e.value?.on("mouseenter",r,()=>{e.value.getCanvas().style.cursor="pointer"}),e.value?.on("mouseleave",r,()=>{e.value.getCanvas().style.cursor=""})}catch(m){console.error("加载 SVG 图标失败:",m)}}const xe=Object.assign({});function me(t){const l={SimSun:["Arial Unicode MS Regular"],SimHei:["Arial Unicode MS Bold"],DengXian:["Arial Unicode MS Bold"]},a=l[t]||l.DengXian;return console.log("字体栈配置:",t,"->",a),a}async function ve(t,l,a){const n=l.replace(/[^a-zA-Z0-9]/g,""),r=`custom-icon-${String(a)}-${t.replace(".svg","")}-${n}`;if(e.value?.hasImage(r))return r;try{let s;if(t.startsWith("http")||t.startsWith("/")){const d=await fetch(t);d.ok&&(s=await d.text())}if(!s){const d=`./widgets/svg/${t}`;s=xe[d]}if(!s)throw new Error(`SVG 加载失败: ${t},URL fetch 和本地模块均未找到`);const y=s.replace("{color}",l),h=new Image,m=new Blob([y],{type:"image/svg+xml"}),c=URL.createObjectURL(m);return await new Promise((d,u)=>{h.onload=()=>d(),h.onerror=f=>{console.error("SVG Image 加载失败",f),u(f)},h.src=c}),e.value?.addImage(r,h),URL.revokeObjectURL(c),r}catch(s){throw console.error("加载 SVG 失败:",s),s}}async function Fe(t,l,a){const n=`${t.id}-color-points-source`,r=`${t.id}-color-points-layer`,y=w.resolveAssetById(a.pointStyle||"",i.shapeOptions)?.url||"",h=a.pointTintColor||"rgba(103, 194, 58, 0.6)";try{const m=`custom-icon-${t.id}-`;if(e.value?.listImages&&e.value.listImages().forEach(B=>{B.startsWith(m)&&e.value?.removeImage(B)}),!y){console.error("SVG 图标 URL 解析失败,pointStyle:",a.pointStyle);return}const c=await ve(y,h,t.id);if(!c){console.error("SVG 图标加载失败,使用默认图标");return}const d=l.map(T=>{let B=[0,0];return T.latitude&&T.longitude?B=[Number(T.longitude),Number(T.latitude)]:T.latitudeStart&&T.longitudeStart&&(B=[Number(T.longitudeStart),Number(T.latitudeStart)]),{type:"Feature",properties:{...T,layerName:t.layerName},geometry:{type:"Point",coordinates:B}}});e.value?.getSource(n)&&e.value?.removeSource(n),e.value?.getLayer(r)&&e.value?.removeLayer(r);const b=`${t.id}-color-points-text`;if(e.value?.getLayer(b)&&e.value?.removeLayer(b),e.value?.addSource(n,{type:"geojson",data:{type:"FeatureCollection",features:d}}),e.value?.addLayer({id:r,type:"symbol",source:n,layout:{"icon-image":c,"icon-size":a.pointSize?a.pointSize/100:.18,"icon-anchor":"center","icon-allow-overlap":!0,"text-allow-overlap":!0},paint:{}}),a.displayLabel){console.log("准备添加文本图层",{displayLabel:a.displayLabel,labelSize:a.labelSize,labelColor:a.labelColor,labelFont:a.labelFont});try{e.value?.addLayer({id:b,type:"symbol",source:n,layout:{"text-field":["get","layerName"],"text-font":me(a.labelFont||"DengXian"),"text-size":a.labelSize||11,"text-anchor":"top","text-offset":[0,1],"text-allow-overlap":!0,"text-optional":!1},paint:{"text-color":a.labelColor||"#000000","text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-width":1}}),console.log("文本图层已成功添加:",b)}catch(T){console.error("添加文本图层失败:",T)}}e.value?.on("click",r,T=>{if(T.features&&T.features.length>0){const B=T.features[0].properties;console.log("Point clicked:",B)}}),e.value?.on("mouseenter",r,()=>{e.value.getCanvas().style.cursor="pointer"}),e.value?.on("mouseleave",r,()=>{e.value.getCanvas().style.cursor=""})}catch(m){console.error("加载 SVG 图标失败:",m)}}async function It(t,l,a){const n=`${t.id}-icon-points-source`,r=`${t.id}-icon-points-layer`,s=a.pointStyle||"",h=w.resolveAssetById(s,i.iconOptions)?.url||Re.mapIconBaseUrl+s;console.log("addIconMarkersForGeoJSON 开始",{mapLayerId:t.id,iconImageId:s,iconUrl:h,pointCount:l.length});const m=l.map(b=>{let N=[0,0];return b.latitude&&b.longitude?N=[Number(b.longitude),Number(b.latitude)]:b.latitudeStart&&b.longitudeStart&&(N=[Number(b.longitudeStart),Number(b.latitudeStart)]),{type:"Feature",properties:{...b,layerName:t.layerName},geometry:{type:"Point",coordinates:N}}});e.value?.getSource(n)&&(e.value?.removeSource(n),console.log("移除旧数据源:",n)),e.value?.getLayer(r)&&(e.value?.removeLayer(r),console.log("移除旧图层:",r));const u=`${t.id}-icon-points-text`;e.value?.getLayer(u)&&e.value?.removeLayer(u);try{const b=await kt(h,t.id);if(console.log("图标名称:",b),e.value?.addSource(n,{type:"geojson",data:{type:"FeatureCollection",features:m}}),console.log("数据源已添加:",n),e.value?.addLayer({id:r,type:"symbol",source:n,layout:{"icon-image":b,"icon-size":a.pointSize?a.pointSize/100:.5,"icon-anchor":"center","icon-allow-overlap":!0,"text-allow-overlap":!0},paint:{}}),console.log("图层已添加:",r,"icon-size:",a.pointSize?a.pointSize/100:.5),a.displayLabel){console.log("准备添加文本图层",{displayLabel:a.displayLabel,labelSize:a.labelSize,labelColor:a.labelColor,labelFont:a.labelFont});try{e.value?.addLayer({id:u,type:"symbol",source:n,layout:{"text-field":["get","layerName"],"text-font":me(a.labelFont||"DengXian"),"text-size":a.labelSize||11,"text-anchor":"top","text-offset":[0,1],"text-allow-overlap":!0,"text-optional":!1},paint:{"text-color":a.labelColor||"#000000","text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-width":1}}),console.log("文本图层已成功添加:",u)}catch(N){console.error("添加文本图层失败:",N)}}e.value?.on("click",r,N=>{if(N.features&&N.features.length>0){const T=N.features[0].properties;console.log("Point clicked:",T)}}),e.value?.on("mouseenter",r,()=>{e.value.getCanvas().style.cursor="pointer"}),e.value?.on("mouseleave",r,()=>{e.value.getCanvas().style.cursor=""})}catch(b){throw console.error("添加图标图层失败:",b),b}}async function kt(t,l){const a=`custom-icon-img-${String(l)}-${t}`;if(e.value?.hasImage(a))return a;try{console.log("开始加载图标:",t);const n=new Image;return n.crossOrigin="Anonymous",await new Promise((r,s)=>{n.onload=()=>{console.log("图标加载成功:",t,"尺寸:",n.width,"x",n.height),r()},n.onerror=y=>{console.error("图标加载失败:",t,y),s(new Error(`Failed to load image: ${t}`))},n.src=t}),e.value&&(e.value.addImage(a,n),console.log("图标已添加到地图:",a)),a}catch(n){throw console.error("加载图标图片失败:",t,n),n}}function Pt(t,l,a){const n=Z.value.find(y=>y.id===t);n&&n.marker&&n.marker?.remove();const r=new Ve.Marker(a).setLngLat(l).setOffset([0,-22]).addTo(e.value),s=Z.value.findIndex(y=>y.id===t);s>-1?Z.value[s].marker=r:Z.value.push({id:t,marker:r})}function rt(t,l){console.log("Point clicked:",l)}const st=o.ref(),ct=o.ref();function we(){st.value&&st.value.hidePopup(),ct.value&&ct.value.hidePopup(),ut.value&&ut.value.hidePopup()}const ut=o.ref();function Ue(t){const l=Q.value.find(a=>a.id===t.id);l?Object.assign(l,t):Q.value.push(t)}function Nt(){if(!i.loadIcon)return Promise.resolve(!0);if(!e.value)return Promise.reject(new Error("地图实例未初始化,无法加载图标资源"));const t=i.iconOptions&&i.iconOptions.length>0;t||console.warn("[MapView] iconOptions 为空,使用硬编码列表作为兜底");const l=(t?i.iconOptions:Re.mapIconNameList).map(a=>{const n=t?a.url:Re.mapIconBaseUrl+a.fileName,r=t?a.id:a.fileName;return new Promise((s,y)=>{e.value?.loadImage(n,(h,m)=>{h?(console.warn(`[MapView] 加载图标失败: ${r}`,h),y(h)):(m&&e.value?.addImage(r,m),s(!0))})})});return Promise.all(l).then(()=>(Y("iconsReady"),!0)).catch(a=>{throw console.error("[MapView] 部分图标加载失败:",a),Y("iconsReady"),a})}function He(t){console.log("removeThirdPartyLayer---->",t);const l=w.getLayerId(t),a=w.getLayerType(t),n=e.value?.getLayer(l);console.log("currentLayerType---->",a,n);let r=-1;if(Q.value.forEach((s,y)=>{s.id==t.id&&(r=y)}),r>-1&&Q.value.splice(r,1),["shp","kml","kmz","geojson"].includes(t.layerType)&&t.layerShapes){const s=t.layerShapes.split(",").map(y=>y.trim());if(s.length>1||t.layerType==="geojson"){console.log("移除多几何类型图层"),["-polygon","-polygon-label","-point","-point-label","-line-label"].forEach(c=>{const d=l+c;e.value?.getLayer(d)&&(console.log("移除图层---->",d),e.value?.removeLayer(d))});try{const c=e.value?.getStyle();if(c&&c.layers){console.log("当前地图所有图层:",c.layers.map(u=>u.id));const d=c.layers.filter(u=>u.id.startsWith(l+"-line")&&!u.id.endsWith("-label"));console.log("找到的线图层:",d.map(u=>u.id)),d.forEach(u=>{console.log("移除线图层---->",u.id),e.value?.removeLayer(u.id)})}}catch(c){console.warn("移除线图层失败:",c)}if(s.includes("polygon"))try{const c=e.value?.getStyle();if(c&&c.layers){const d=c.layers.filter(u=>(u.id.startsWith(l+"-polygon-outline")||u.id.startsWith(l+"-outline"))&&!u.id.endsWith("-label"));console.log("找到的 outline 图层:",d.map(u=>u.id)),d.forEach(u=>{console.log("移除 outline 图层---->",u.id),e.value?.removeLayer(u.id)})}}catch(c){console.warn("移除 outline 图层失败:",c)}const h=w.getSourceId(t);e.value?.getSource(h)&&(console.log("移除数据源---->",h),e.value?.removeSource(h)),we();return}}if(n){const s=e.value?.getLayer(l);if(s){const y=s.source;e.value?.removeLayer(l),t.geoJSON&&y&&e.value?.removeSource(y)}}if(a=="fill"){console.log("移除单一几何类型-面图层的边框");try{const h=e.value?.getStyle();if(h&&h.layers){console.log("当前地图所有图层:",h.layers.map(c=>c.id));const m=h.layers.filter(c=>c.id.startsWith(l+"-outline")&&!c.id.endsWith("-label"));console.log("找到的 outline 图层:",m.map(c=>c.id)),m.forEach(c=>{console.log("移除 outline 图层---->",c.id),e.value?.removeLayer(c.id)})}}catch(h){console.warn("移除 outline 图层失败:",h)}const s=l+"-label";e.value?.getLayer(s)&&e.value?.removeLayer(s)}else if(a=="line"){console.log("移除单一几何类型-线图层");const s=l+"-label";e.value?.getLayer(s)&&e.value?.removeLayer(s)}else if(a=="circle"){console.log("移除单一几何类型-点图层");const s=l+"-label";e.value?.getLayer(s)&&e.value?.removeLayer(s)}we()}o.watch(()=>i.mapLayerEntity,t=>{if(t&&e.value){let l;Array.isArray(t)?l=t.find(a=>a.layerType==="map-layer"):l=t,l&&_e(l,e.value,i.mapRootId,L,q)}},{deep:!0}),o.watch(()=>L.mapInstances[i.mapRootId]?.activeMapLayer,()=>{e.value&&te()},{immediate:!0}),o.watch(()=>L.mapInstances[i.mapRootId]?.zoom,()=>{e.value&&!q.value&&e.value.flyTo({zoom:L.mapInstances[i.mapRootId].zoom,duration:500})},{immediate:!0}),o.watch(()=>L.mapInstances[i.mapRootId]?.pitch,()=>{e.value&&!q.value&&(L.isDragging?e.value.setPitch(L.mapInstances[i.mapRootId].pitch):e.value.flyTo({pitch:L.mapInstances[i.mapRootId].pitch,duration:1e3}))},{immediate:!0}),o.watch(()=>L.mapInstances[i.mapRootId]?.bearing,()=>{e.value&&!q.value&&(L.isDragging?e.value.setBearing(L.mapInstances[i.mapRootId].bearing):e.value.flyTo({bearing:L.mapInstances[i.mapRootId].bearing,duration:1e3}))},{immediate:!0});const Tt=t=>{e.value&&(e.value.flyTo({zoom:4,duration:400}),setTimeout(async()=>{if(!t)return;if(t.layerType==="tif"){const r=J.value.get(t.id);if(r&&r.bounds&&r.bounds.length===4){const s=r.bounds;e.value?.fitBounds([[s[0],s[1]],[s[2],s[3]]],{padding:{top:50,bottom:50,left:50,right:50}}),console.log("TIF 图层定位成功:",s)}else console.warn("未找到 TIF 图层的边界信息");return}let l=w.getSourceId(t);if(t.geoJSON&&(l=w.getLayerId(t)),t.url&&!t.geoJSON)try{const r=t.url.replace("bjhweb","bjh"),y=await(await fetch(r)).json();if(y&&y.features&&y.features.length>0){const h=Be.bbox(y);if(h&&!Ze(h)){e.value?.fitBounds([[h[0],h[1]],[h[2],h[3]]],{padding:{top:50,bottom:50,left:50,right:50}});return}}}catch(r){console.warn("从URL获取GeoJSON数据失败,尝试其他方法",r)}const a=e.value?.getSource(l);if(a&&a._data&&a._data.features){const r=a._data,s=Be.bbox(r);if(!Ze(s)){e.value?.fitBounds([[s[0],s[1]],[s[2],s[3]]],{padding:{top:50,bottom:50,left:50,right:50}});return}}const n=e.value?.querySourceFeatures(l);if(n&&n.length>0){const r=Be.featureCollection(n),s=Be.bbox(r);Ze(s)?console.warn("获取的边界框无效"):e.value?.fitBounds([[s[0],s[1]],[s[2],s[3]]],{padding:{top:50,bottom:50,left:50,right:50}})}else console.warn("没有查询到图层数据")},500))};function Ze(t){return t[0]===1/0||t[1]===1/0||t[2]===-1/0||t[3]===-1/0||isNaN(t[0])||isNaN(t[1])||isNaN(t[2])||isNaN(t[3])}o.provide("resetMapView",le),o.provide("mapRootId",i.mapRootId),o.provide(pt.mapInstanceKey,e),o.provide(pt.thirdPartyLayersKey,Q);const dt=({mapRootId:t,layer:l})=>{t===i.mapRootId&&(console.log("接收到渲染地理数据事件",l),ie(l))};Ce.renderGeographicDataKeyBus.on(dt);function Et(){if(!e.value){console.warn("地图实例未初始化,无法清除图层");return}console.log("开始清除所有图层"),e.value.setStyle(L.getCurrentMapStyle(i.mapRootId)),Q.value=[],Z.value.forEach(t=>{t.marker?.remove()}),Z.value=[],console.log("所有图层已清除")}v({mapInstance:e,initMap:H,handleSetMapStyle:te,resetMapView:le,addThirdPartyLayer:ie,addResearchMapLayer:de,addTifLayer:R,processGeoTIFF:G,removeTifLayer:F,clearAllLayers:Et}),o.onBeforeMount(()=>{let t=i.center||[120.1551,30.2741],l=i.zoom,a=i.pitch,n=0,r=Ie.MapLayerType.SATELLITE,s;if(i.mapLayerEntity&&(Array.isArray(i.mapLayerEntity)?s=i.mapLayerEntity.find(y=>y.layerType==="map-layer"):s=i.mapLayerEntity),s?.layerPaintConfig)try{const y=JSON.parse(s.layerPaintConfig);if(y.defaultCenter)if(typeof y.defaultCenter=="string"){const h=y.defaultCenter.split(",").map(m=>parseFloat(m.trim()));t=[h[0],h[1]]}else Array.isArray(y.defaultCenter)&&(t=y.defaultCenter);y.defaultZoom!==void 0&&(l=parseFloat(y.defaultZoom)),y.bearing!==void 0&&(n=parseFloat(y.bearing)),y.pitch!==void 0&&(a=parseFloat(y.pitch)),y.baseMap&&(r=y.baseMap==="satellite"?Ie.MapLayerType.SATELLITE:y.baseMap==="vector"?Ie.MapLayerType.VECTOR:Ie.MapLayerType.TOPOGRAPHIC)}catch(y){console.error("解析 layerPaintConfig 失败:",y)}L.mapInstances[i.mapRootId]={maxZoom:i.maxZoom,minZoom:i.minZoom,zoom:l,pitch:a,threeDPitch:a,center:t,bearing:n,is3DMode:a>0,activeMapLayer:r,mapHeight:600,mapWidth:600,mapX:0,mapY:0}});async function qe(t){Ue(t);const l={renderMode:"color",pointStyle:"118",pointTintColor:"rgba(103, 194, 58, 0.6)",pointSize:2,displayLabel:!1,labelSize:14,labelColor:"rgba(0, 0, 0, 1)",labelFont:"SimSun"},a=t.layerPaintConfig?JSON.parse(t.layerPaintConfig):l;console.log("addRowDataMapLayer layerPaintConfig:",a);const n=t.pointInfo||[];if(console.log("mapLayer 对象:",{id:t.id,layerName:t.layerName,pointInfoCount:n.length,firstPointInfo:n[0],allMapLayerKeys:Object.keys(t)}),!n||n.length===0){console.warn(`点位数据缺失:${t.layerName} 没有可用的点位数据`),Pe.ElMessage.warning(`${t.layerName} 没有可用的点位数据,无法渲染`);return}a.renderMode==="hatMap"?fe(t,n):a.renderMode==="icon"?(console.log("addRowDataMapLayer icon mode, pointInfoList:",n),await It(t,n,a)):(console.log("addRowDataMapLayer color mode, pointInfoList:",n),await Fe(t,n,a)),we()}const ft=async({mapRootId:t,topic:l,visible:a,delLayer:n})=>{if(console.log("接收到图层切换事件",i.mapRootId,t,l),t===i.mapRootId&&e.value){const r=l.layerType==="species-group"||l.layerType==="interest-point",s=l.layerType==="sample-group",y=l.layerType==="track",h=l.layerType==="geojson";if(a)if(console.log("delLayer",n),n&&(console.log("mmb: 删除图层",l),He(l)),r)Me(l),qe(l);else if(y)Ae(l),Qe(l);else if(s)l.layerShapes?.includes("point")?(Me(l),qe(l)):l.layerShapes?.includes("line")&&(Ae(l),Qe(l));else if(h){if(ue(l),e.value)try{await co(e.value,l,{shapeOptions:i.shapeOptions,iconOptions:i.iconOptions});const m=Q.value.find(c=>c.id===l.id);m?Object.assign(m,l):Q.value.push(l)}catch(m){console.error("渲染 GeoJSON 图层失败:",m),Pe.ElMessage.error(`渲染 ${l.layerName} 失败: ${m instanceof Error?m.message:"未知错误"}`)}}else if(l.layerType==="tif"){ie(l);const m=K.value.get(l.id);m&&(F(m),K.value.delete(l.id),J.value.delete(l.id));const c=l.url?.replace("bjhweb","bjh");if(c){const d=await R(c,["#000000","#FFFFFF"],!1);d?.tifId&&(K.value.set(l.id,d.tifId),d.dataRange&&J.value.set(l.id,d.dataRange))}}else He(l),ie(l);else if(console.log("[toggleGeographicLayerKeyListener] 隐藏图层, topic:",l.id,"layerType:",l.layerType,"layerShapes:",l.layerShapes),r)Me(l);else if(y)Ae(l);else if(s)l.layerShapes?.includes("point")?Me(l):l.layerShapes?.includes("line")&&Ae(l);else if(h)console.log("[toggleGeographicLayerKeyListener] 隐藏 GeoJSON 图层, topic:",l.id,l.layerName),ue(l),console.log("[toggleGeographicLayerKeyListener] GeoJSON 图层已隐藏");else if(l.layerType==="tif"){const m=K.value.get(l.id);m&&(F(m),K.value.delete(l.id),J.value.delete(l.id)),Ke(l)}else console.log("[toggleGeographicLayerKeyListener] 调用 removeThirdPartyLayer"),He(l);l.layerType=="map-layer"&&(console.log("设置地图配置000000000000000000000000",l),_e(l,e.value,i.mapRootId,L,q))}};function Ke(t){let l=-1;Q.value.forEach((a,n)=>{a.id==t.id&&(l=n)}),l>-1&&Q.value.splice(l,1)}function Me(t){Ke(t);const l=`${t.id}-heatmap-source`,a=`${t.id}-heatmap-layer`;e.value?.getLayer(a)&&e.value?.removeLayer(a),e.value?.getSource(l)&&e.value?.removeSource(l);const s=`${t.id}-color-points-source`,y=`${t.id}-color-points-layer`,h=`${t.id}-color-points-text`;e.value?.getLayer(y)&&e.value?.removeLayer(y),e.value?.getLayer(h)&&e.value?.removeLayer(h),e.value?.getSource(s)&&e.value?.removeSource(s);const u=`${t.id}-icon-points-source`,f=`${t.id}-icon-points-layer`,b=`${t.id}-icon-points-text`;e.value?.getLayer(f)&&e.value?.removeLayer(f),e.value?.getLayer(b)&&e.value?.removeLayer(b),e.value?.getSource(u)&&e.value?.removeSource(u),(t.pointInfo||[]).forEach((X,W)=>{const ce=`${t.id}-research-point-${W}`,he=Z.value.findIndex(Ot=>Ot.id===ce);he>-1&&(Z.value[he].marker?.remove(),Z.value.splice(he,1))}),we()}const Xe=(t,l)=>{const n=document.createElement("canvas");n.width=36,n.height=36;const r=n.getContext("2d");return r.beginPath(),r.arc(36/2,36/2,36/2-1,0,Math.PI*2),r.fillStyle=t,r.fill(),r.strokeStyle="#fff",r.lineWidth=2,r.stroke(),r.fillStyle="#fff",r.font=`bold ${36*.45}px sans-serif`,r.textAlign="center",r.textBaseline="middle",r.fillText(l,36/2,36/2+1),n},zt=()=>{if(e.value){if(!e.value.hasImage(tt)){const l=Xe("#2196F3","图").getContext("2d");e.value.addImage(tt,{width:36,height:36,data:new Uint8Array(l.getImageData(0,0,36,36).data.buffer)})}if(!e.value.hasImage(ot)){const l=Xe("#4CAF50","文").getContext("2d");e.value.addImage(ot,{width:36,height:36,data:new Uint8Array(l.getImageData(0,0,36,36).data.buffer)})}if(!e.value.hasImage(lt)){const l=Xe("#FF9800","音").getContext("2d");e.value.addImage(lt,{width:36,height:36,data:new Uint8Array(l.getImageData(0,0,36,36).data.buffer)})}}},Ft=(t,l)=>{if(!e.value)return;const a=t.id,n=E(a);yt(t),zt();const r=[];(l.images||[]).forEach(c=>{const d=parseFloat(c.longitude),u=parseFloat(c.latitude);if(isNaN(d)||isNaN(u))return;let f=[];try{f=JSON.parse(c.imageList)||[]}catch(b){console.error("解析图片列表失败:",c.id,c.imageList,b)}f.length&&r.push({type:"Feature",geometry:{type:"Point",coordinates:[d,u]},properties:{id:c.id,type:"image"}})});const s=[];(l.texts||[]).forEach(c=>{const d=parseFloat(c.longitude),u=parseFloat(c.latitude);isNaN(d)||isNaN(u)||!c.text&&!c.title||s.push({type:"Feature",geometry:{type:"Point",coordinates:[d,u]},properties:{id:c.id,type:"text"}})});const y=[];(l.voices||[]).forEach(c=>{const d=parseFloat(c.longitude),u=parseFloat(c.latitude);if(isNaN(d)||isNaN(u))return;let f=[];try{f=JSON.parse(c.voiceList)||[]}catch{}f.length&&y.push({type:"Feature",geometry:{type:"Point",coordinates:[d,u]},properties:{id:c.id,type:"voice"}})}),k.value.set(a,l.images||[]),x.value.set(a,l.texts||[]),P.value.set(a,l.voices||[]),console.log("渲染媒体点位 - 图片:",r.length,"文本:",s.length,"音频:",y.length);const h=[...r,...s,...y];if(console.log("总媒体点位:",h.length),!h.length)return;const m=e.value;if(m.addSource(n,{type:"geojson",data:{type:"FeatureCollection",features:h}}),r.length){m.addLayer({id:j(a),type:"symbol",source:n,filter:["==",["get","type"],"image"],layout:{"icon-image":tt,"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}});const c=f=>Ye(f,a,"image"),d=()=>{m.getCanvas().style.cursor="pointer"},u=()=>{m.getCanvas().style.cursor=""};m.on("click",j(a),c),m.on("mouseenter",j(a),d),m.on("mouseleave",j(a),u),M.value.set(`${a}-image`,{click:c,mouseenter:d,mouseleave:u})}if(s.length){m.addLayer({id:U(a),type:"symbol",source:n,filter:["==",["get","type"],"text"],layout:{"icon-image":ot,"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}});const c=f=>Ye(f,a,"text"),d=()=>{m.getCanvas().style.cursor="pointer"},u=()=>{m.getCanvas().style.cursor=""};m.on("click",U(a),c),m.on("mouseenter",U(a),d),m.on("mouseleave",U(a),u),M.value.set(`${a}-text`,{click:c,mouseenter:d,mouseleave:u})}if(y.length){m.addLayer({id:D(a),type:"symbol",source:n,filter:["==",["get","type"],"voice"],layout:{"icon-image":lt,"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}});const c=f=>Ye(f,a,"voice"),d=()=>{m.getCanvas().style.cursor="pointer"},u=()=>{m.getCanvas().style.cursor=""};m.on("click",D(a),c),m.on("mouseenter",D(a),d),m.on("mouseleave",D(a),u),M.value.set(`${a}-voice`,{click:c,mouseenter:d,mouseleave:u})}},Ye=(t,l,a)=>{if(!e.value)return;let n;switch(a){case"image":n=j(l);break;case"text":n=U(l);break;case"voice":n=D(l);break}const r=e.value.queryRenderedFeatures(t.point,{layers:[n]});if(!r.length)return;const s=r[0].properties?.id;if(!s)return;const y=k.value.get(l),h=x.value.get(l),m=P.value.get(l);switch(a){case"image":const c=y?.find(f=>f.id===s);if(c)try{const f=JSON.parse(c.imageList)||[];I.value=f,g.value=!0}catch(f){console.error("解析图片列表失败:",f)}break;case"text":const d=h?.find(f=>f.id===s);d&&(O.value=d,C.value=!0);break;case"voice":const u=m?.find(f=>f.id===s);if(u)try{const f=JSON.parse(u.voiceList)||[];V.value=f,z.value=!0}catch(f){console.error("解析音频列表失败:",f)}break}},yt=t=>{if(!e.value)return;const l=e.value,a=t.id,n=E(a);if(l.getLayer(j(a))){const r=M.value.get(`${a}-image`);r&&(l.off("click",j(a),r.click),l.off("mouseenter",j(a),r.mouseenter),l.off("mouseleave",j(a),r.mouseleave),M.value.delete(`${a}-image`)),l.removeLayer(j(a))}if(l.getLayer(U(a))){const r=M.value.get(`${a}-text`);r&&(l.off("click",U(a),r.click),l.off("mouseenter",U(a),r.mouseenter),l.off("mouseleave",U(a),r.mouseleave),M.value.delete(`${a}-text`)),l.removeLayer(U(a))}if(l.getLayer(D(a))){const r=M.value.get(`${a}-voice`);r&&(l.off("click",D(a),r.click),l.off("mouseenter",D(a),r.mouseenter),l.off("mouseleave",D(a),r.mouseleave),M.value.delete(`${a}-voice`)),l.removeLayer(D(a))}l.getSource(n)&&l.removeSource(n),k.value.delete(a),x.value.delete(a),P.value.delete(a)};async function Qe(t){if(!e.value){console.warn("地图实例未初始化,无法添加线图层");return}Ue(t);const l=t.layerPaintConfig?JSON.parse(t.layerPaintConfig):{lineStyle:"solid-line",lineColor:"rgba(0, 0, 0, 1)",lineWidth:4,lineOpacity:100,textColor:"rgba(0, 0, 0, 1)",displayLabel:!0,labelSize:12,labelColor:"rgba(0, 0, 0, 1)",labelFont:"DengXian"};console.log("addLineMapLayer layerPaintConfig:",l);const a=t.pointInfo||[];if(!a||a.length<2){const c=a?.length||0;console.warn(`线条数据不足:${t.layerName} 只有 ${c} 个点位,需要至少2个点位才能绘制线条`),Pe.ElMessage.warning(`${t.layerName} 数据不足(${c}个点),无法绘制线条,至少需要2个点位`);return}const n=a.map(c=>[Number(c.longitude),Number(c.latitude)]),r=`${t.id}-line-source`,s=`${t.id}-line-layer`;e.value?.getSource(r)&&e.value?.removeSource(r),e.value?.getLayer(s)&&e.value?.removeLayer(s),e.value?.addSource(r,{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:n},properties:{layerName:t.layerName}}]}});const m={"line-color":l.lineColor||"rgba(0, 0, 0, 1)","line-width":l.lineWidth||4};switch(l.lineStyle){case"dotted":case"dot-line":m["line-dasharray"]=[5.2,5.2];break;case"simple-dash":case"dashed":m["line-dasharray"]=[8,4];break;case"dot-dash":m["line-dasharray"]=[5,5,1,5];break;case"long-dash":m["line-dasharray"]=[20,5];break;case"complex-pattern":m["line-dasharray"]=[10,3,3,3];break}if(e.value?.addLayer({id:s,type:"line",source:r,layout:{"line-join":"round","line-cap":"round"},paint:m}),l.displayLabel&&n.length>0){const c=`${t.id}-line-text`,d=Math.floor(n.length/2),u=n[d];e.value?.getLayer(c)&&e.value?.removeLayer(c);const b=`${t.id}-line-text-source`;e.value?.getSource(b)&&e.value?.removeSource(b),e.value?.addSource(b,{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:u},properties:{layerName:t.layerName}}]}}),e.value?.addLayer({id:c,type:"symbol",source:b,layout:{"text-field":["get","layerName"],"text-font":me(l.labelFont||"DengXian"),"text-size":l.labelSize||12,"text-anchor":"top","text-offset":[0,0],"text-allow-overlap":!0},paint:{"text-color":l.labelColor||"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-width":1}})}t.layerType==="track"&&t.media&&Ft(t,t.media),we()}function Ae(t){Ke(t);const l=`${t.id}-line-source`,a=`${t.id}-line-layer`,n=`${t.id}-line-text`,r=`${t.id}-line-text-source`;e.value?.getLayer(a)&&e.value?.removeLayer(a),e.value?.getSource(l)&&e.value?.removeSource(l),e.value?.getLayer(n)&&e.value?.removeLayer(n),e.value?.getSource(r)&&e.value?.removeSource(r),t.layerType==="track"&&yt(t),we()}const gt=({mapRootId:t,layer:l})=>{console.log("接收到定位到图层中心事件",l),t===i.mapRootId&&e.value&&Tt(l)};return o.onMounted(()=>{L.setMapBoxToken(i.mapBoxToken),L.setTdtToken(i.tdtToken),i.amapKey&&L.setAmapKey(i.amapKey),L.setMaxZoom(i.mapRootId,i.maxZoom),L.setMinZoom(i.mapRootId,i.minZoom);let t;i.mapLayerEntity&&(Array.isArray(i.mapLayerEntity)?t=i.mapLayerEntity.find(a=>a.layerType==="map-layer"):t=i.mapLayerEntity);const l=t?.layerPaintConfig;l||(L.setZoom(i.mapRootId,i.zoom),L.setPitch(i.mapRootId,i.pitch)),setTimeout(()=>{l||L.setThreeDPitch(i.mapRootId,i.pitch),l?H():i.center&&Array.isArray(i.center)&&i.center.length>0?(L.setCenter(i.mapRootId,i.center),H()):navigator.geolocation.getCurrentPosition(a=>{const{latitude:n,longitude:r}=a.coords;L.setCenter(i.mapRootId,[r,n]),H()},()=>{L.setCenter(i.mapRootId,[104.1954,35.8617]),L.setZoom(i.mapRootId,4),H()}),L.mapInstances[i.mapRootId]&&(L.mapInstances[i.mapRootId].mapHeight=S.value?.clientHeight??600,L.mapInstances[i.mapRootId].mapWidth=S.value?.clientWidth??600,L.mapInstances[i.mapRootId].mapX=S.value?.getBoundingClientRect().left??600,L.mapInstances[i.mapRootId].mapY=S.value?.getBoundingClientRect().top??600)},200),console.log("mapStore.mapInstances[mapRootId]--->",i.mapRootId),Ce.toggleGeographicLayerKeyBus.on(ft),Ce.locateToLayerCenterKeyBus.on(gt)}),o.onUnmounted(()=>{console.log("组件卸载,清理事件监听"),Ce.renderGeographicDataKeyBus.off(dt),Ce.toggleGeographicLayerKeyBus.off(ft),Ce.locateToLayerCenterKeyBus.off(gt),K.value.forEach(t=>{const l=t,a=t+"-source";e.value?.getLayer(l)&&e.value.removeLayer(l),e.value?.getSource(a)&&e.value.removeSource(a)}),K.value.forEach(t=>{const l=t,a=t+"-source";e.value?.getLayer(l)&&e.value.removeLayer(l),e.value?.getSource(a)&&e.value.removeSource(a)}),K.value.forEach(t=>{const l=t,a=t+"-source";e.value?.getLayer(l)&&e.value.removeLayer(l),e.value?.getSource(a)&&e.value.removeSource(a)}),K.value.clear(),J.value.clear()}),(t,l)=>(o.openBlock(),o.createElementBlock("div",{class:"qy-map",ref_key:"mapRoot",ref:S},[o.createElementVNode("div",{class:"hiper-map-warper",id:i.mapRootId},[o.createElementVNode("div",Eo,[o.renderSlot(t.$slots,"leftBar",{},void 0,!0)]),o.createElementVNode("div",zo,[o.renderSlot(t.$slots,"rightBar",{},void 0,!0)]),o.createElementVNode("div",{class:"top-bar",style:o.normalizeStyle({left:o.unref(L).topicVisible?o.unref(L).topicWidth+50+"px":"70px"})},[o.renderSlot(t.$slots,"topBar",{},void 0,!0)],4),o.createElementVNode("div",Fo,[o.renderSlot(t.$slots,"bottomBar",{},void 0,!0)]),o.renderSlot(t.$slots,"default",{},void 0,!0)],8,To),o.createVNode(mo,{ref:"trackImageDialogRef",modelValue:g.value,"onUpdate:modelValue":l[0]||(l[0]=a=>g.value=a),"image-list":I.value},null,8,["modelValue","image-list"]),o.createVNode(xo,{ref:"trackTextDialogRef",modelValue:C.value,"onUpdate:modelValue":l[1]||(l[1]=a=>C.value=a),"text-item":O.value},null,8,["modelValue","text-item"]),o.createVNode(No,{ref:"trackVoiceDialogRef",modelValue:z.value,"onUpdate:modelValue":l[2]||(l[2]=a=>z.value=a),"voice-list":V.value},null,8,["modelValue","voice-list"])],512))}}),$o=Je._export_sfc(Oo,[["__scopeId","data-v-0ec6bf90"]]);exports.default=$o;
|