qy-vue-plugins 1.0.5-beta → 1.0.6-beta
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/chunks/{MapTools.vue_vue_type_style_index_0_lang-BJi8BdV8.js → MapTools.vue_vue_type_style_index_0_lang-bBH_E8lt.js} +1 -1
- package/dist/chunks/{MapTools.vue_vue_type_style_index_0_lang-C3__NQXN.js → MapTools.vue_vue_type_style_index_0_lang-uinYXAK2.js} +1 -1
- package/dist/chunks/{constant-mXEWtcQf.js → constant-DOMY69DH.js} +1 -1
- package/dist/chunks/{constant-BqK1UnfT.js → constant-DRPKGC5-.js} +3 -1
- package/dist/chunks/utils-BWKoNKVA.js +1 -0
- package/dist/chunks/utils-CSYjCP1-.js +495 -0
- package/dist/mapboxV2/MapView.cjs +1 -1
- package/dist/mapboxV2/MapView.mjs +1292 -1057
- 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/mapTopic.cjs +1 -1
- package/dist/mapboxV2/components/mapTopic.mjs +319 -398
- package/dist/mapboxV2/constant.cjs +1 -1
- package/dist/mapboxV2/constant.mjs +2 -1
- 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 +314 -264
- package/dist/mapboxV2/widgets/CustomShapeDialog.cjs +1 -1
- package/dist/mapboxV2/widgets/CustomShapeDialog.mjs +85 -65
- package/dist/mapboxV2/widgets/IconPicker.cjs +1 -1
- package/dist/mapboxV2/widgets/IconPicker.mjs +1 -1
- 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 +94 -89
- package/dist/mapboxV2/widgets/LegendDialogPoint.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendDialogPoint.mjs +79 -74
- package/dist/mapboxV2/widgets/LegendLine.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendLine.mjs +41 -58
- package/dist/mapboxV2/widgets/LegendPoint.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendPoint.mjs +39 -39
- package/dist/mapboxV2/widgets/LegendPopLine.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendPopLine.mjs +1 -1
- package/dist/mapboxV2/widgets/LegendPopPoint.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendPopPoint.mjs +2 -2
- 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 +1 -1
- package/dist/mapboxV2/widgets/ShapeDialog.cjs +1 -1
- package/dist/mapboxV2/widgets/ShapeDialog.mjs +1254 -1136
- package/dist/mapboxV2.cjs +1 -1
- package/dist/mapboxV2.mjs +2 -2
- package/dist/qy-vue-plugins.css +1 -1
- package/dist/types/mapboxV2/MapView.vue.d.ts +2 -2
- package/dist/types/mapboxV2/components/mapTopic.vue.d.ts +5 -5
- package/dist/types/mapboxV2/useTif.d.ts +2 -2
- package/dist/types/store/mapStore.d.ts +2 -0
- package/dist/types/types/map.d.ts +3 -2
- package/package/mapboxV2/constant.ts +1 -1
- package/package/mapboxV2/useTif.ts +18 -13
- package/package/mapboxV2/utils.ts +140 -62
- package/package/types/map.ts +6 -2
- package/package.json +1 -1
- package/dist/chunks/utils-CZxmwfl_.js +0 -1
- package/dist/chunks/utils-n1i0zWzc.js +0 -454
|
@@ -2,7 +2,7 @@ import { defineComponent as V, inject as $, ref as n, onUnmounted as z, computed
|
|
|
2
2
|
import { M as R, S as W, D as H } from "./mapbox-gl-draw-CKTcXDzM.js";
|
|
3
3
|
import { m as G } from "./ProvideKeys-CBXsWszp.js";
|
|
4
4
|
import { m as Q, s as X } from "./EventKeys-1aL9cgT0.js";
|
|
5
|
-
import { D as Y } from "./constant-
|
|
5
|
+
import { D as Y } from "./constant-DRPKGC5-.js";
|
|
6
6
|
import * as d from "@turf/turf";
|
|
7
7
|
import { Close as Z } from "@element-plus/icons-vue";
|
|
8
8
|
import { ElIcon as ee } from "element-plus";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const a=require("vue"),h=require("./mapbox-gl-draw-Dg_Inye3.js"),P=require("./ProvideKeys-91lTuLnq.js"),N=require("./EventKeys-BvyQ87Zy.js"),q=require("./constant-
|
|
1
|
+
"use strict";const a=require("vue"),h=require("./mapbox-gl-draw-Dg_Inye3.js"),P=require("./ProvideKeys-91lTuLnq.js"),N=require("./EventKeys-BvyQ87Zy.js"),q=require("./constant-DOMY69DH.js"),B=require("@turf/turf"),I=require("@element-plus/icons-vue"),j=require("element-plus");function $(i){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const n in i)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(i,n);Object.defineProperty(m,n,r.get?r:{enumerable:!0,get:()=>i[n]})}}return m.default=i,Object.freeze(m)}const p=$(B),O={key:0,class:"measure-info-panel"},A={class:"measure-info-content"},R={class:"measure-label"},z={class:"measure-value"},K={class:"qy-flex-row hiper-map-tools-bar"},J=a.defineComponent({__name:"MapTools",props:{tools:{default:()=>["point","line","polygon","measure_distance","measure_area","clear_all"]}},setup(i){const m=a.inject("mapRootId"),n=a.ref(),r=a.ref([]),L=a.ref(null),M=a.ref(null),v=a.ref(!1),c=a.ref("distance"),y=t=>{switch(v.value&&t!=="measure_distance"&&t!=="clear_all"&&D(),n.value=t,t){case"point":s.changeMode("draw_point");break;case"line":s.changeMode("draw_line_string");break;case"polygon":s.changeMode("draw_polygon");break;case"measure_distance":s.changeMode("simple_select"),c.value="distance",x();break;case"measure_area":s.changeMode("simple_select"),c.value="area",x();break;case"clear_all":s.deleteAll(),D();break}},e=a.inject(P.mapInstanceKey),s=new h.MapboxDraw({userProperties:!0,displayControlsDefault:!1,modes:{...h.MapboxDraw.modes,draw_rectangle:h.DrawRectangle,static:h.StaticMode}});let _=null;_=N.mapLoadedBus.on(({mapRootId:t})=>{m!==t||!e?.value||(console.log("hiper-map-tools-bar mounted",e),e.value.addControl(s,"top-left"),e.value.on("draw.create",w))});function w(t){const l=s.getAll();if(!l.features.length)return;l.features=[l.features[0]];const o={point:{layerType:"symbol",config:{textColor:"rgba(0,0,0,1)",iconName:q.DefaultIcon}},line:{layerType:"line",config:{lineWidth:1,lineColor:"rgba(255, 0, 0, 1)",lineStyle:"solid"}},polygon:{layerType:"shape",config:{fillColor:"rgba(241, 131, 127, 1)",lineWidth:1}}}[n.value];o&&N.showLayerEditKeyBus.emit({mapRootId:m,e:new MouseEvent("click"),layer:{layerType:o.layerType,customLayerConfig:JSON.stringify(o.config),geoJSON:JSON.stringify(l),...n.value==="polygon"?{pid:""}:{}}}),s.deleteAll()}function x(){e?.value&&(v.value=!0,r.value=[],e.value.getCanvas().style.cursor="crosshair",e.value.on("click",b),e.value.on("dblclick",g))}function g(t){if(v.value){if(t.preventDefault(),c.value==="distance")r.value.length>=2&&C();else if(r.value.length>=3){const l=r.value[0],u=r.value[r.value.length-1];(l[0]!==u[0]||l[1]!==u[1])&&r.value.push(l),C()}e?.value?.off("click",b),e?.value?.off("dblclick",g),e?.value&&(e.value.getCanvas().style.cursor=""),v.value=!1}}function b(t){if(!v.value||!e?.value)return;t.originalEvent.stopPropagation();const l=[t.lngLat.lng,t.lngLat.lat];r.value.push(l),r.value.length===1?(c.value==="distance"?d.value=0:f.value=0,e.value.getSource("measure-point-source")?e.value.getSource("measure-point-source").setData({type:"Feature",properties:{},geometry:{type:"Point",coordinates:l}}):(e.value.addSource("measure-point-source",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"Point",coordinates:l}}}),e.value.addLayer({id:"measure-point-layer",type:"circle",source:"measure-point-source",paint:{"circle-radius":5,"circle-color":"#16aaff"}}))):(e.value.getSource("measure-point-source")&&e.value.getSource("measure-point-source").setData({type:"FeatureCollection",features:r.value.map(u=>({type:"Feature",properties:{},geometry:{type:"Point",coordinates:u}}))}),C(),c.value==="area"&&r.value.length>=3&&(e.value.getCanvas().style.cursor="pointer"))}function C(){if(!e?.value||r.value.length<2)return;const t=p.lineString(r.value);if(c.value==="distance"){const l=p.length(t,{units:"kilometers"});d.value=l,l<1?`${(l*1e3).toFixed(2)}`:`${l.toFixed(3)}`;const u=Math.floor(r.value.length/2)-1;u<0?r.value[0]:r.value[u],S(t)}else if(r.value.length>=3){const l=[...r.value];l[0]!==l[l.length-1]&&l.push(l[0]);const u=p.polygon([l]),o=p.area(u)/1e6;f.value=o,o<1?`${(o*1e6).toFixed(2)}`:`${o.toFixed(3)}`;const k=p.centroid(u);S(t,k.geometry.coordinates)}else S(t,t.geometry.coordinates[0])}function S(t,l,u){if(e?.value){if(e.value.getSource("measure-line-source")?e.value.getSource("measure-line-source").setData(t):(e.value.addSource("measure-line-source",{type:"geojson",data:t}),e.value.addLayer({id:"measure-line-layer",type:"line",source:"measure-line-source",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#16aaff","line-width":2,"line-dasharray":[2,1]}}),L.value="measure-line-layer"),c.value==="area"&&r.value.length>=3){const o=[...r.value];o[0]!==o[o.length-1]&&o.push(o[0]);const k=p.polygon([o]);e.value.getSource("measure-fill-source")?e.value.getSource("measure-fill-source").setData(k):(e.value.addSource("measure-fill-source",{type:"geojson",data:k}),e.value.addLayer({id:"measure-fill-layer",type:"fill",source:"measure-fill-source",paint:{"fill-color":"#16aaff","fill-opacity":.2,"fill-outline-color":"#16aaff"}},"measure-line-layer"))}e.value.getSource("measure-label-source")&&e.value.getLayer("measure-label-layer")&&(e.value.removeLayer("measure-label-layer"),e.value.removeSource("measure-label-source"),M.value=null)}}function D(){e?.value&&(e.value?.off("click",b),e.value?.off("dblclick",g),e.value.getCanvas().style.cursor="",e.value.getLayer("measure-point-layer")&&(e.value.removeLayer("measure-point-layer"),e.value.removeSource("measure-point-source")),e.value.getLayer("measure-line-layer")&&(e.value.removeLayer("measure-line-layer"),e.value.removeSource("measure-line-source")),e.value.getLayer("measure-fill-layer")&&(e.value.removeLayer("measure-fill-layer"),e.value.removeSource("measure-fill-source")),e.value.getLayer("measure-label-layer")&&(e.value.removeLayer("measure-label-layer"),e.value.removeSource("measure-label-source")),r.value=[],L.value=null,M.value=null,v.value=!1,d.value=0,f.value=0,e.value.getLayer("measure-label-layer")&&e.value.removeLayer("measure-label-layer"),e.value.getSource("measure-label-source")&&e.value.removeSource("measure-label-source"))}a.onUnmounted(()=>{D(),_&&_(),e?.value&&(e.value?.removeControl(s),e.value?.off("draw.create",w),e.value?.off("click",b),e.value?.off("dblclick",g))});const d=a.ref(0),E=a.computed(()=>d.value<1?`${(d.value*1e3).toFixed(2)} 米`:`${d.value.toFixed(3)} 公里`),f=a.ref(0),T=a.computed(()=>f.value<1?`${(f.value*1e6).toFixed(2)} 平方米`:`${f.value.toFixed(3)} 平方公里`),V=a.computed(()=>c.value==="distance"?E.value:T.value),F=a.computed(()=>c.value==="distance"?"总长度: ":"总面积: ");return(t,l)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[v.value||r.value.length>0&&(n.value=="measure_distance"||n.value=="measure_area")?(a.openBlock(),a.createElementBlock("div",O,[a.createElementVNode("div",A,[a.createElementVNode("span",R,a.toDisplayString(F.value),1),a.createElementVNode("span",z,a.toDisplayString(V.value),1),a.createVNode(a.unref(j.ElIcon),{style:{display:"block","margin-left":"10px",cursor:"pointer"},onClick:l[0]||(l[0]=u=>y("clear_all")),size:"20px"},{default:a.withCtx(()=>[a.createVNode(a.unref(I.Close))]),_:1})])])):a.createCommentVNode("",!0),a.createElementVNode("div",K,[l[7]||(l[7]=a.createElementVNode("div",{class:"tools-label"},"测绘工具",-1)),i.tools.includes("measure_distance")?(a.openBlock(),a.createElementBlock("div",{key:0,title:"测距",class:a.normalizeClass(["hiper-map-tools-btn",n.value=="measure_distance"?"active":null]),onClick:l[1]||(l[1]=()=>y("measure_distance"))},[...l[4]||(l[4]=[a.createElementVNode("span",{class:"qyuan icon-ruler"},null,-1)])],2)):a.createCommentVNode("",!0),i.tools.includes("measure_area")?(a.openBlock(),a.createElementBlock("div",{key:1,title:"测面",class:a.normalizeClass(["hiper-map-tools-btn",n.value=="measure_area"?"active":null]),onClick:l[2]||(l[2]=()=>y("measure_area"))},[...l[5]||(l[5]=[a.createElementVNode("span",{class:"qyuan icon-multi-triangular"},null,-1)])],2)):a.createCommentVNode("",!0),i.tools.includes("clear_all")?(a.openBlock(),a.createElementBlock("div",{key:2,title:"清除所有临时绘制图形",class:"hiper-map-tools-btn",style:{border:"none"},onClick:l[3]||(l[3]=()=>y("clear_all"))},[...l[6]||(l[6]=[a.createElementVNode("span",{class:"qyuan icon-clear"},null,-1)])])):a.createCommentVNode("",!0)])],64))}});exports._sfc_main=J;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e="rgba(103, 194, 58, 0.6)",
|
|
1
|
+
"use strict";const e="rgba(103, 194, 58, 0.6)",m="hiper-map-icon-1.png",a=[{type:"default",key:"",value:"",color:e,rgb:"rgba(103, 194, 58)",opacity:.6}],i=[{type:"default",outlineColor:"rgba(103, 194, 58, 1)",outlineOpacity:1,outlineWidth:2,zoom:0,lineStyle:"solid"}],n=[{key:"",value:"",circleType:"circle",circleStrokeColor:"rgba(0,0,0,1)",circleColor:e,iconImageUrl:"hiper-map-icon-1.png",type:"default",zoom:0,circleRadius:2,circleStrokeWidth:0,circleStrokeOpacity:1,circleOpacity:1}],p={circleType:"icon",circleStrokeColor:"rgba(0,0,0,1)",circleColor:e,iconImageUrl:""},o={pointTintColor:"#02d2e0",pointRenderType:"color"},l={fillColorList:a,fillOpacityConfig:{value:1},outlineConfigList:i,symbolConfigList:[],circleBaseConfig:p,circleConfigList:n,antiAliasingConfig:{value:!0}},r="https://shpfile-data-1314977817.cos.ap-guangzhou.myqcloud.com/geojson/beijihua-map-icon/",c=[{fileName:"hiper-map-icon-1.png",name:"标记"},{fileName:"hiper-map-icon-2.png",name:""},{fileName:"hiper-map-icon-3.png",name:""},{fileName:"hiper-map-icon-4.png",name:""},{fileName:"hiper-map-icon-5.png",name:""},{fileName:"hiper-map-icon-6.png",name:""},{fileName:"hiper-map-icon-7.png",name:""},{fileName:"hiper-map-icon-8.png",name:""},{fileName:"hiper-map-icon-9.png",name:""},{fileName:"hiper-map-icon-10.png",name:""},{fileName:"hiper-map-icon-11.png",name:""},{fileName:"hiper-map-icon-12.png",name:""},{fileName:"hiper-map-icon-13.png",name:""},{fileName:"hiper-map-icon-14.png",name:""},{fileName:"hiper-map-icon-15.png",name:""},{fileName:"hiper-map-icon-16.png",name:""},{fileName:"hiper-map-icon-17.png",name:""},{fileName:"hiper-map-icon-18.png",name:""},{fileName:"hiper-map-icon-19.png",name:""},{fileName:"hiper-map-icon-20.png",name:""},{fileName:"hiper-map-icon-21.png",name:""},{fileName:"hiper-map-icon-22.png",name:""},{fileName:"hiper-map-icon-23.png",name:""},{fileName:"hiper-map-icon-24.png",name:""},{fileName:"hiper-map-icon-25.png",name:""},{fileName:"hiper-map-icon-26.png",name:""},{fileName:"hiper-map-icon-27.png",name:""},{fileName:"hiper-map-icon-28.png",name:""},{fileName:"hiper-map-icon-29.png",name:""},{fileName:"hiper-map-icon-30.png",name:""},{fileName:"hiper-map-icon-31.png",name:""},{fileName:"hiper-map-icon-32.png",name:""},{fileName:"hiper-map-icon-33.png",name:""},{fileName:"hiper-map-icon-34.png",name:""},{fileName:"hiper-map-icon-35.png",name:""},{fileName:"hiper-map-icon-36.png",name:""},{fileName:"hiper-map-icon-37.png",name:""},{fileName:"hiper-map-icon-38.png",name:""},{fileName:"hiper-map-icon-39.png",name:""},{fileName:"hiper-map-icon-40.png",name:""},{fileName:"hiper-map-icon-41.png",name:""},{fileName:"hiper-map-icon-42.png",name:""},{fileName:"hiper-map-icon-43.png",name:""},{fileName:"hiper-map-icon-45.png",name:""},{fileName:"hiper-map-icon-46.png",name:""},{fileName:"hiper-map-icon-47.png",name:""},{fileName:"hiper-map-icon-48.png",name:""},{fileName:"hiper-map-icon-49.png",name:""},{fileName:"hiper-map-icon-50.png",name:""},{fileName:"hiper-map-icon-51.png",name:""},{fileName:"hiper-map-icon-52.png",name:""},{fileName:"hiper-map-icon-53.png",name:""},{fileName:"hiper-map-icon-54.png",name:""},{fileName:"hiper-map-icon-55.png",name:""},{fileName:"hiper-map-icon-56.png",name:""},{fileName:"hiper-map-icon-57.png",name:""},{fileName:"hiper-map-icon-58.png",name:""},{fileName:"hiper-map-icon-59.png",name:""},{fileName:"hiper-map-icon-60.png",name:""},{fileName:"hiper-map-icon-61.png",name:""},{fileName:"hiper-map-icon-62.png",name:""},{fileName:"hiper-map-icon-63.png",name:""},{fileName:"hiper-map-icon-64.png",name:""},{fileName:"hiper-map-icon-65.png",name:""}],g=["rgba(255, 69, 0, 1)","rgba(255, 140, 0, 1)","rgba(255, 215, 0, 1)","rgba(144, 238, 144, 1)","rgba(0, 206, 209, 1)","rgba(30, 144, 255, 1)","rgba(199, 21, 133, 1)","rgba(199, 21, 133, 0.46)","rgba(87, 178, 55, 1)","rgba(2, 210, 224, 1)","rgba(38, 24, 171, 1)","rgba(106, 226, 191, 1)","rgba(145, 125, 238, 1)","rgba(236, 97, 93, 1)","rgba(203, 99, 39, 1)","rgba(244, 182, 63, 1)"],f=[{fileName:"实五角星.svg",name:"五角星"},{fileName:"正三角形.svg",name:"三角形"},{fileName:"地图点.svg",name:"地图点"},{fileName:"标记地图点位.svg",name:"标记点位"},{fileName:"24gf-square.svg",name:"方形"},{fileName:"地图点 (1).svg",name:"地图点1"},{fileName:"地图点-红.svg",name:"红地图点"},{fileName:"地图点位.svg",name:"点位"},{fileName:"地图点 (2).svg",name:"地图点2"},{fileName:"地图点 (3).svg",name:"地图点3"},{fileName:"地图点位 (1).svg",name:"点位1"},{fileName:"地图点 (4).svg",name:"地图点4"},{fileName:"hexagon-fill.svg",name:"六边形"},{fileName:"人-地图点位2x.svg",name:"人地图点位"}];exports.DefaultColor=e;exports.DefaultIcon=m;exports.circleConfigList=n;exports.defaultPointLayerPaintConfig=o;exports.defaultStyleConfig=l;exports.fillColorList=a;exports.mapIconBaseUrl=r;exports.mapIconNameList=c;exports.mapPointsColors=g;exports.mapShapeSvgList=f;exports.outlineConfigList=i;
|
|
@@ -12,7 +12,8 @@ const e = "rgba(103, 194, 58, 0.6)", p = "hiper-map-icon-1.png", a = [
|
|
|
12
12
|
type: "default",
|
|
13
13
|
outlineColor: "rgba(103, 194, 58, 1)",
|
|
14
14
|
outlineOpacity: 1,
|
|
15
|
-
outlineWidth:
|
|
15
|
+
outlineWidth: 2,
|
|
16
|
+
// 改为 2,与 LayerStyleEditDialog 保持一致
|
|
16
17
|
zoom: 0,
|
|
17
18
|
lineStyle: "solid"
|
|
18
19
|
//dash
|
|
@@ -353,6 +354,7 @@ export {
|
|
|
353
354
|
g as e,
|
|
354
355
|
c as f,
|
|
355
356
|
n as g,
|
|
357
|
+
a as h,
|
|
356
358
|
r as m,
|
|
357
359
|
i as o
|
|
358
360
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const L=require("vue"),S=require("./constant-DOMY69DH.js");function x(i,e){let l={marginTop:"-2px"};switch(i){case"solid":case"solid-line":l.borderBottom=`4px solid ${e}`;break;case"dash":case"dotted":case"simple-dash":l.borderBottom=`4px dashed ${e}`;break;case"dot-dash":l.backgroundImage=`linear-gradient(to right, ${e} 25%, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 0) 50%, ${e} 50%, ${e} 75%, rgba(255, 255, 255, 0) 75%)`;break;case"long-dash":l.backgroundImage=`linear-gradient(to right, ${e} 50%, rgba(255, 255, 255, 0) 50%)`;break;case"dot-line":l.backgroundImage=`linear-gradient(to right, ${e} 25%, rgba(255, 255, 255, 0) 10%)`;break;case"complex-pattern":l.backgroundImage=`linear-gradient(to right, ${e} 20%, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0) 40%, ${e} 40%, ${e} 60%, rgba(255, 255, 255, 0) 60%)`;break;default:l.borderBottom=`4px solid ${e}`;break}return l}function N(i,e){if(i&&typeof i!="string")return i;switch(e){case"symbol":case"geojson":case"species-group":case"sample-group":case"track":case"interest-point":return i?JSON.parse(i||"{}"):S.defaultPointLayerPaintConfig;case"point":return JSON.parse(i||"{}");case"line":return JSON.parse(i||"{}");case"shape":case"shp":case"kml":case"kmz":case"tif":return i?JSON.parse(i||"{}"):S.defaultStyleConfig;default:throw new Error(`Unsupported layer type: ${e}`)}}function $(i){try{return`layer-id-${i.id}`}catch(e){return console.error("Error getting layer ID:",e),`layer-id-${L.useId()}`}}function T(i){try{return`source-id-${i.id}`}catch(e){return console.error("Error getting source ID:",e),`source-id-${L.useId()}`}}function w(i){try{return i.layerPaintConfig?JSON.parse(i.layerPaintConfig):S.defaultStyleConfig}catch{return S.defaultStyleConfig}}function I(i){let e="fill";switch(i.layerType){case"shp":case"kml":case"kmz":if(i.layerShapes){const l=i.layerShapes.split(",").map(a=>a.trim().toLowerCase());l.length===1?l[0]==="point"?e="circle":l[0]==="line"?e="line":e="fill":e="fill"}else e="fill";break;case"line":e="line";break;case"symbol":if(e="circle",i.layerPaintConfig){const l=JSON.parse(i.layerPaintConfig);l.circleConfigList&&l.circleConfigList?.length>0&&l.circleConfigList[0].circleType=="symbol"&&(e="symbol")}break;default:e="fill"}return e}function E(i){try{let e={},l=JSON.parse(JSON.stringify(i.fillColorList));const a=l.find(r=>r.type==="default"),f=l.filter(r=>r.type==="custom");a&&(l=[...f,a]),console.log("[getFillStyle] 排序后的 fillColorList:",l);let c=l.filter(r=>r.type==="custom"?r.key&&r.value:!0);const u=c[c.length-1];if(!u||u.type!=="default")return console.warn("[getFillStyle] 未找到默认配置,使用系统默认颜色"),e["fill-color"]="rgba(103, 194, 58, 0.6)",e["fill-opacity"]=.6,e["fill-outline-color"]="rgba(103, 194, 58, 1)",e;console.log("[getFillStyle] 默认颜色配置:",u),e["fill-color"]=u.color,e["fill-opacity"]=u.opacity,e["fill-outline-color"]=u.color;let t=[];return i.fillOpacityConfig&&i.fillOpacityConfig.value!=null&&(e["fill-opacity"]=i.fillOpacityConfig.value),c.forEach(r=>{if(r.type=="custom"){let s=-1;t.forEach((o,n)=>{o.key==r.key&&(s=n)}),s>-1?t[s].list.push(r):t.push({key:r.key,list:[r]})}}),t.length&&t.forEach(r=>{r.list.forEach(s=>{e["fill-color"].unshift(s.color),e["fill-color"].unshift(s.value)}),e["fill-color"].unshift(["get",r.key]),e["fill-color"].unshift("match")}),e["fill-color"].length==1&&(e["fill-color"]=e["fill-color"][0]),console.log("[getFillStyle] 生成 fillStyle 成功:",e),e}catch(e){console.log("[getFillStyle] 生成 fillStyle 失败:",e)}}function z(i){if(!i||!i.showLabel)return null;const e={"text-field":["get",i.labelField||"FID"],"text-size":i.fontSize||14,"text-color":i.fontColor||"#000000","text-font":["Open Sans Regular"],"text-anchor":"center","text-offset":[0,0],"text-allow-overlap":!1,"text-avoid-edges":!0};return console.log("生成labelStyle成功---->",e),e}function O(i){try{let{outlineConfigList:e}=i;if(!e||e.length===0)return console.warn("[getOutLineStyle] outlineConfigList 为空,使用默认样式"),{"line-color":"rgba(103, 194, 58, 1)","line-opacity":1,"line-width":2,"line-dasharray":["literal",[]]};let l=JSON.parse(JSON.stringify(e));const a=l.find(r=>r.type==="default"),f=l.filter(r=>r.type==="custom");a&&(l=[...f,a]);const c=l[l.length-1];if(!c||c.type!=="default")return console.warn("[getOutLineStyle] 未找到默认配置,使用系统默认值"),{"line-color":"rgba(103, 194, 58, 1)","line-opacity":1,"line-width":1};let u={"line-color":c.outlineColor||"rgba(103, 194, 58, 1)","line-opacity":c.outlineOpacity??1,"line-width":c.outlineWidth??1};c.lineStyle==="dash"?u["line-dasharray"]=[2,2]:u["line-dasharray"]=["literal",[]];let t=[];if(l.forEach(r=>{if(r.type==="custom"&&r.key&&r.value){let s=-1;t.forEach((o,n)=>{o.key===r.key&&(s=n)}),s>-1?t[s].list.push(r):t.push({key:r.key,list:[r]})}}),t.length>0&&(["line-color","line-opacity","line-width"].forEach(s=>{const o=s==="line-color"?"outlineColor":s==="line-opacity"?"outlineOpacity":"outlineWidth";if(t.some(h=>h.list.some(p=>p[o]!==void 0))){const h=["match",["get",t[0].key]];t.forEach(p=>{p.list.forEach(d=>{d.value!==void 0&&d[o]!==void 0&&(h.push(d.value),h.push(d[o]))})}),h.push(a[o]??u[s]),u[s]=h}}),t.some(s=>s.list.some(o=>o.lineStyle!==void 0)))){const s=["match",["get",t[0].key]];t.forEach(o=>{o.list.forEach(n=>{n.value!==void 0&&n.lineStyle&&(s.push(n.value),s.push(n.lineStyle==="dash"?[2,2]:["literal",[]]))})}),s.push(a.lineStyle==="dash"?[2,2]:["literal",[]]),u["line-dasharray"]=s}return u}catch(e){return console.log("生成outlineStyle失败",e),{}}}function v(i){let{circleConfigList:e}=i,l=JSON.parse(JSON.stringify(e));const a=l.find(o=>o.type==="default"),f=l.filter(o=>o.type==="custom");a&&(l=[...f,a]),console.log("[getCircleStyle] 排序后的 circleConfigList:",l);const c=l[l.length-1],u=c&&(c.renderMode==="color"||c.renderMode==="icon");if(!c||c.type!=="default")return console.warn("[getCircleStyle] 未找到默认配置,使用系统默认值"),{_useNewFormat:!0,_circleConfigList:[{type:"default",renderMode:"color",pointStyle:"地图点.svg",pointTintColor:"#67c23a",pointSize:10}],"icon-image":"custom-icon-default-地图点-67c23a","icon-size":1};if(console.log("[getCircleStyle] 默认配置:",c),u){const o={_useNewFormat:!0,_circleConfigList:l};o["icon-image"]=[],o["icon-size"]=[];const n=l.filter(h=>h.type==="custom"&&h.value!==""&&h.value!=null);if(n.length>0){const h=n[0].key;let p="string";for(const y of n)if(typeof y.value=="number"){p="number";break}const d=y=>p==="number"?typeof y=="number"?y:Number(y):String(y),g=["match",["get",h]];n.forEach(y=>{let b;if(y.renderMode==="color"){const C=(y.pointTintColor||"#67c23a").replace(/[^a-zA-Z0-9]/g,"");b=`custom-icon-${y.key}-${(y.pointStyle||"地图点.svg").replace(".svg","")}-${C}`}else b=y.iconImageName||"hiper-map-icon-1.png";g.push(d(y.value)),g.push(b)});let k;if(c.renderMode==="color"){const y=(c.pointTintColor||"#67c23a").replace(/[^a-zA-Z0-9]/g,"");k=`custom-icon-default-${(c.pointStyle||"地图点.svg").replace(".svg","")}-${y}`}else k=c.iconImageName||"hiper-map-icon-1.png";g.push(k),o["icon-image"]=g;const m=["match",["get",h]];n.forEach(y=>{m.push(d(y.value)),m.push((y.pointSize||10)/20)}),m.push((c.pointSize||10)/20),o["icon-size"]=m}else{let h;if(c.renderMode==="color"){const p=(c.pointTintColor||"#67c23a").replace(/[^a-zA-Z0-9]/g,"");h=`custom-icon-default-${(c.pointStyle||"地图点.svg").replace(".svg","")}-${p}`}else h=c.iconImageName||"hiper-map-icon-1.png";o["icon-image"]=h,o["icon-size"]=(c.pointSize||10)/20}return o}const t={"circle-radius":[],"circle-stroke-width":[],"circle-color":[],"circle-stroke-color":[],"circle-opacity":[],"circle-stroke-opacity":[],"icon-image":[]};e=[...e];const r=e[e.length-1];e.splice(e.length-1,1),t["circle-radius"]=[r.circleRadius],t["circle-stroke-width"]=[r.circleStrokeWidth],t["circle-color"]=[r.circleColor],t["circle-stroke-color"]=[r.circleStrokeColor],t["circle-opacity"]=[r.circleOpacity],t["circle-stroke-opacity"]=[r.circleStrokeOpacity],t["icon-image"]=[r.iconImageUrl||"hiper-map-icon-1.png"];let s=[];return e.forEach(o=>{if(o.type=="custom"){let n=-1;s.forEach((h,p)=>{h.key==o.key&&(n=p)}),n>-1?s[n].list.push(o):s.push({key:o.key,list:[o]})}}),s.forEach(o=>{r.circleType!="symbol"&&(o.list.forEach(n=>{t["circle-radius"].unshift(n.circleRadius),t["circle-radius"].unshift(n.value)}),t["circle-radius"].unshift(["get",o.key]),t["circle-radius"].unshift("match"),o.list.forEach(n=>{t["circle-stroke-width"].unshift(n.circleStrokeWidth),t["circle-stroke-width"].unshift(n.value)}),t["circle-stroke-width"].unshift(["get",o.key]),t["circle-stroke-width"].unshift("match"),o.list.forEach(n=>{t["circle-color"].unshift(n.circleColor),t["circle-color"].unshift(n.value)}),t["circle-color"].unshift(["get",o.key]),t["circle-color"].unshift("match"),o.list.forEach(n=>{t["circle-stroke-color"].unshift(n.circleStrokeColor),t["circle-stroke-color"].unshift(n.value)}),t["circle-stroke-color"].unshift(["get",o.key]),t["circle-stroke-color"].unshift("match"),o.list.forEach(n=>{t["circle-opacity"].unshift(n.circleOpacity),t["circle-opacity"].unshift(n.value)}),t["circle-opacity"].unshift(["get",o.key]),t["circle-opacity"].unshift("match"),o.list.forEach(n=>{t["circle-stroke-opacity"].unshift(n.circleStrokeOpacity),t["circle-stroke-opacity"].unshift(n.value)}),t["circle-stroke-opacity"].unshift(["get",o.key]),t["circle-stroke-opacity"].unshift("match")),r.circleType=="symbol"&&(o.list.forEach(n=>{t["icon-image"].unshift(n.iconImageUrl||"hiper-map-icon-1.png"),t["icon-image"].unshift(n.value)}),t["icon-image"].unshift(["get",o.key]),t["icon-image"].unshift("match"))}),e.length==0&&(t["circle-radius"]=t["circle-radius"][0],t["circle-stroke-width"]=t["circle-stroke-width"][0],t["circle-color"]=t["circle-color"][0],t["circle-stroke-color"]=t["circle-stroke-color"][0],t["circle-opacity"]=t["circle-opacity"][0],t["circle-stroke-opacity"]=t["circle-stroke-opacity"][0],t["icon-image"]=t["icon-image"][0]),t}function F(i){let{circleConfigList:e}=i;const l={"icon-image":[]},a=e[e.length-1];e.splice(e.length-1,1),l["icon-image"]=[a.iconImageUrl||"hiper-map-icon-1.png"];let f=[];return e.forEach(c=>{if(c.type=="custom"){let u=-1;f.forEach((t,r)=>{t.key==c.key&&(u=r)}),u>-1?f[u].list.push(c):f.push({key:c.key,list:[c]})}}),f.forEach(c=>{a.circleType=="symbol"&&(c.list.forEach(u=>{l["icon-image"].unshift(u.iconImageUrl||"hiper-map-icon-1.png"),l["icon-image"].unshift(u.value)}),l["icon-image"].unshift(["get",c.key]),l["icon-image"].unshift("match"))}),e.length==0&&(l["icon-image"]=l["icon-image"][0]),l}function M(i){const e=w(i),l=I(i),a={"fill-color":"rgba(103, 194, 58, 0.6)","fill-opacity":1,"fill-outline-color":"rgba(103, 194, 58, 1)"},f={"line-width":2,"line-color":"rgba(103, 194, 58, 1)","line-opacity":1},c={"circle-radius":["interpolate",["linear"],["zoom"],1,6,10,8,22,12],"circle-stroke-width":["interpolate",["linear"],["zoom"],1,2,10,5,22,10],"circle-stroke-color":["interpolate",["linear"],["zoom"],0,"rgba(103, 194, 58, 0.6)",22,"rgba(103, 194, 58, 0.6)"],"circle-stroke-opacity":["interpolate",["linear"],["zoom"],0,1,22,1],"circle-color":"rgba(103, 194, 58, 0.6)"};if(!e)switch(console.warn("当前图层样式配置不存在,使用默认样式,还有执行到这里的情况?"),l){case"fill":return a;case"line":return f;case"circle":return c}switch(l){case"fill":const u=E(e);return u||a;case"line":const t=O(e);return t||f;case"circle":const r=v(e);return r||c;case"symbol":const s=F(e);return s||{"icon-image":"hiper-map-icon-1.png"}}}function A(i){return new Promise((e,l)=>{const a=new FileReader;a.onload=()=>{a.result instanceof ArrayBuffer?e(a.result):l(new Error("Failed to read file as ArrayBuffer"))},a.onerror=l,a.readAsArrayBuffer(i)})}function J(i){const e=i.fileDirectory||{},l=e.ModelTiepoint||[],a=e.ModelPixelScale||[];if(l.length>=6&&a.length>=3){console.log("情况1:使用ModelTiepoint和ModelPixelScale计算边界",l,a);const f=l[3],c=l[4],u=a[0],t=a[1],r=i.getWidth(),s=i.getHeight(),o=f,n=c,h=f+r*u,p=c-s*Math.abs(t);return[o,p,h,n]}else if(e.ModelTransformation){console.log("情况2:使用ModelTransformation矩阵计算边界");const f=e.ModelTransformation;if(f&&f.length>=16){const c=i.getWidth(),u=i.getHeight(),t=f[3],r=f[7],s=t+c*f[0],o=r+u*f[5];return[t,r,s,o]}}else if(e.GeographicTypeGeoKey)return console.warn("Limited geographic information. Using approximated bounds."),[-180,-90,180,90];return console.warn("No geographic reference found. Using default bounds."),[-180,-90,180,90]}function B(i){i=i.replace(/^#/,"");let e=0,l=0,a=0;return i.length===3?(e=parseInt(i.charAt(0)+i.charAt(0),16),l=parseInt(i.charAt(1)+i.charAt(1),16),a=parseInt(i.charAt(2)+i.charAt(2),16)):i.length===6&&(e=parseInt(i.substring(0,2),16),l=parseInt(i.substring(2,4),16),a=parseInt(i.substring(4,6),16)),[e,l,a]}function U(i,e,l){return Math.max(e,Math.min(l,i))}exports.calculateBounds=J;exports.clamp=U;exports.getCircleStyle=v;exports.getFillStyle=E;exports.getLabelStyle=z;exports.getLayerId=$;exports.getLayerStyle=M;exports.getLayerType=I;exports.getLineLegendStyle=x;exports.getOutLineStyle=O;exports.getSourceId=T;exports.hexToRgb=B;exports.parseLayerPaintConfig=N;exports.parseStyleConfig=w;exports.readFileAsArrayBuffer=A;
|
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import { useId as w } from "vue";
|
|
2
|
+
import { d as b, a as E } from "./constant-DRPKGC5-.js";
|
|
3
|
+
function T(i, e) {
|
|
4
|
+
let l = {
|
|
5
|
+
marginTop: "-2px"
|
|
6
|
+
};
|
|
7
|
+
switch (i) {
|
|
8
|
+
case "solid":
|
|
9
|
+
case "solid-line":
|
|
10
|
+
l.borderBottom = `4px solid ${e}`;
|
|
11
|
+
break;
|
|
12
|
+
case "dash":
|
|
13
|
+
case "dotted":
|
|
14
|
+
case "simple-dash":
|
|
15
|
+
l.borderBottom = `4px dashed ${e}`;
|
|
16
|
+
break;
|
|
17
|
+
case "dot-dash":
|
|
18
|
+
l.backgroundImage = `linear-gradient(to right, ${e} 25%, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 0) 50%, ${e} 50%, ${e} 75%, rgba(255, 255, 255, 0) 75%)`;
|
|
19
|
+
break;
|
|
20
|
+
case "long-dash":
|
|
21
|
+
l.backgroundImage = `linear-gradient(to right, ${e} 50%, rgba(255, 255, 255, 0) 50%)`;
|
|
22
|
+
break;
|
|
23
|
+
case "dot-line":
|
|
24
|
+
l.backgroundImage = `linear-gradient(to right, ${e} 25%, rgba(255, 255, 255, 0) 10%)`;
|
|
25
|
+
break;
|
|
26
|
+
case "complex-pattern":
|
|
27
|
+
l.backgroundImage = `linear-gradient(to right, ${e} 20%, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0) 40%, ${e} 40%, ${e} 60%, rgba(255, 255, 255, 0) 60%)`;
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
l.borderBottom = `4px solid ${e}`;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
return l;
|
|
34
|
+
}
|
|
35
|
+
function M(i, e) {
|
|
36
|
+
if (i && typeof i != "string")
|
|
37
|
+
return i;
|
|
38
|
+
switch (e) {
|
|
39
|
+
case "symbol":
|
|
40
|
+
// 符号图层
|
|
41
|
+
case "geojson":
|
|
42
|
+
case "species-group":
|
|
43
|
+
// 物种组图层
|
|
44
|
+
case "sample-group":
|
|
45
|
+
// 样地样线分组
|
|
46
|
+
case "track":
|
|
47
|
+
// 调查轨迹
|
|
48
|
+
case "interest-point":
|
|
49
|
+
return i ? JSON.parse(i || "{}") : E;
|
|
50
|
+
case "point":
|
|
51
|
+
return JSON.parse(i || "{}");
|
|
52
|
+
case "line":
|
|
53
|
+
return JSON.parse(i || "{}");
|
|
54
|
+
case "shape":
|
|
55
|
+
// 形状图层
|
|
56
|
+
case "shp":
|
|
57
|
+
// SHP 文件图层
|
|
58
|
+
case "kml":
|
|
59
|
+
// KML 文件图层
|
|
60
|
+
case "kmz":
|
|
61
|
+
// KMZ 文件图层
|
|
62
|
+
case "tif":
|
|
63
|
+
return i ? JSON.parse(i || "{}") : b;
|
|
64
|
+
default:
|
|
65
|
+
throw new Error(`Unsupported layer type: ${e}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function F(i) {
|
|
69
|
+
try {
|
|
70
|
+
return `layer-id-${i.id}`;
|
|
71
|
+
} catch (e) {
|
|
72
|
+
return console.error("Error getting layer ID:", e), `layer-id-${w()}`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function A(i) {
|
|
76
|
+
try {
|
|
77
|
+
return `source-id-${i.id}`;
|
|
78
|
+
} catch (e) {
|
|
79
|
+
return console.error("Error getting source ID:", e), `source-id-${w()}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function I(i) {
|
|
83
|
+
try {
|
|
84
|
+
return i.layerPaintConfig ? JSON.parse(i.layerPaintConfig) : b;
|
|
85
|
+
} catch {
|
|
86
|
+
return b;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function O(i) {
|
|
90
|
+
let e = "fill";
|
|
91
|
+
switch (i.layerType) {
|
|
92
|
+
case "shp":
|
|
93
|
+
case "kml":
|
|
94
|
+
case "kmz":
|
|
95
|
+
if (i.layerShapes) {
|
|
96
|
+
const l = i.layerShapes.split(",").map((a) => a.trim().toLowerCase());
|
|
97
|
+
l.length === 1 ? l[0] === "point" ? e = "circle" : l[0] === "line" ? e = "line" : e = "fill" : e = "fill";
|
|
98
|
+
} else
|
|
99
|
+
e = "fill";
|
|
100
|
+
break;
|
|
101
|
+
case "line":
|
|
102
|
+
e = "line";
|
|
103
|
+
break;
|
|
104
|
+
case "symbol":
|
|
105
|
+
if (e = "circle", i.layerPaintConfig) {
|
|
106
|
+
const l = JSON.parse(i.layerPaintConfig);
|
|
107
|
+
l.circleConfigList && l.circleConfigList?.length > 0 && l.circleConfigList[0].circleType == "symbol" && (e = "symbol");
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
default:
|
|
111
|
+
e = "fill";
|
|
112
|
+
}
|
|
113
|
+
return e;
|
|
114
|
+
}
|
|
115
|
+
function v(i) {
|
|
116
|
+
try {
|
|
117
|
+
let e = {}, l = JSON.parse(JSON.stringify(i.fillColorList));
|
|
118
|
+
const a = l.find((r) => r.type === "default"), f = l.filter((r) => r.type === "custom");
|
|
119
|
+
a && (l = [...f, a]), console.log("[getFillStyle] 排序后的 fillColorList:", l);
|
|
120
|
+
let c = l.filter((r) => r.type === "custom" ? r.key && r.value : !0);
|
|
121
|
+
const u = c[c.length - 1];
|
|
122
|
+
if (!u || u.type !== "default")
|
|
123
|
+
return console.warn("[getFillStyle] 未找到默认配置,使用系统默认颜色"), e["fill-color"] = "rgba(103, 194, 58, 0.6)", e["fill-opacity"] = 0.6, e["fill-outline-color"] = "rgba(103, 194, 58, 1)", e;
|
|
124
|
+
console.log("[getFillStyle] 默认颜色配置:", u), e["fill-color"] = u.color, e["fill-opacity"] = u.opacity, e["fill-outline-color"] = u.color;
|
|
125
|
+
let t = [];
|
|
126
|
+
return i.fillOpacityConfig && i.fillOpacityConfig.value != null && (e["fill-opacity"] = i.fillOpacityConfig.value), c.forEach((r) => {
|
|
127
|
+
if (r.type == "custom") {
|
|
128
|
+
let s = -1;
|
|
129
|
+
t.forEach((o, n) => {
|
|
130
|
+
o.key == r.key && (s = n);
|
|
131
|
+
}), s > -1 ? t[s].list.push(r) : t.push({
|
|
132
|
+
key: r.key,
|
|
133
|
+
list: [r]
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}), t.length && t.forEach((r) => {
|
|
137
|
+
r.list.forEach((s) => {
|
|
138
|
+
e["fill-color"].unshift(s.color), e["fill-color"].unshift(s.value);
|
|
139
|
+
}), e["fill-color"].unshift(["get", r.key]), e["fill-color"].unshift("match");
|
|
140
|
+
}), e["fill-color"].length == 1 && (e["fill-color"] = e["fill-color"][0]), console.log("[getFillStyle] 生成 fillStyle 成功:", e), e;
|
|
141
|
+
} catch (e) {
|
|
142
|
+
console.log("[getFillStyle] 生成 fillStyle 失败:", e);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function J(i) {
|
|
146
|
+
if (!i || !i.showLabel)
|
|
147
|
+
return null;
|
|
148
|
+
const e = {
|
|
149
|
+
// 设置标注文本字段
|
|
150
|
+
"text-field": ["get", i.labelField || "FID"],
|
|
151
|
+
// 设置字体大小
|
|
152
|
+
"text-size": i.fontSize || 14,
|
|
153
|
+
// 设置字体颜色
|
|
154
|
+
"text-color": i.fontColor || "#000000",
|
|
155
|
+
// 设置字体 - 使用 Mapbox 默认字体
|
|
156
|
+
"text-font": ["Open Sans Regular"],
|
|
157
|
+
// 文本锚点设置为多边形中心
|
|
158
|
+
"text-anchor": "center",
|
|
159
|
+
// 文本偏移,让文字居中显示
|
|
160
|
+
"text-offset": [0, 0],
|
|
161
|
+
// 允许文本重叠
|
|
162
|
+
"text-allow-overlap": !1,
|
|
163
|
+
// 避免文本被边缘裁剪
|
|
164
|
+
"text-avoid-edges": !0
|
|
165
|
+
};
|
|
166
|
+
return console.log("生成labelStyle成功---->", e), e;
|
|
167
|
+
}
|
|
168
|
+
function C(i) {
|
|
169
|
+
try {
|
|
170
|
+
let { outlineConfigList: e } = i;
|
|
171
|
+
if (!e || e.length === 0)
|
|
172
|
+
return console.warn("[getOutLineStyle] outlineConfigList 为空,使用默认样式"), {
|
|
173
|
+
"line-color": "rgba(103, 194, 58, 1)",
|
|
174
|
+
"line-opacity": 1,
|
|
175
|
+
"line-width": 2,
|
|
176
|
+
"line-dasharray": ["literal", []]
|
|
177
|
+
};
|
|
178
|
+
let l = JSON.parse(JSON.stringify(e));
|
|
179
|
+
const a = l.find((r) => r.type === "default"), f = l.filter((r) => r.type === "custom");
|
|
180
|
+
a && (l = [...f, a]);
|
|
181
|
+
const c = l[l.length - 1];
|
|
182
|
+
if (!c || c.type !== "default")
|
|
183
|
+
return console.warn("[getOutLineStyle] 未找到默认配置,使用系统默认值"), {
|
|
184
|
+
"line-color": "rgba(103, 194, 58, 1)",
|
|
185
|
+
"line-opacity": 1,
|
|
186
|
+
"line-width": 1
|
|
187
|
+
};
|
|
188
|
+
let u = {
|
|
189
|
+
"line-color": c.outlineColor || "rgba(103, 194, 58, 1)",
|
|
190
|
+
"line-opacity": c.outlineOpacity ?? 1,
|
|
191
|
+
"line-width": c.outlineWidth ?? 1
|
|
192
|
+
};
|
|
193
|
+
c.lineStyle === "dash" ? u["line-dasharray"] = [2, 2] : u["line-dasharray"] = ["literal", []];
|
|
194
|
+
let t = [];
|
|
195
|
+
if (l.forEach((r) => {
|
|
196
|
+
if (r.type === "custom" && r.key && r.value) {
|
|
197
|
+
let s = -1;
|
|
198
|
+
t.forEach((o, n) => {
|
|
199
|
+
o.key === r.key && (s = n);
|
|
200
|
+
}), s > -1 ? t[s].list.push(r) : t.push({
|
|
201
|
+
key: r.key,
|
|
202
|
+
list: [r]
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}), t.length > 0 && (["line-color", "line-opacity", "line-width"].forEach((s) => {
|
|
206
|
+
const o = s === "line-color" ? "outlineColor" : s === "line-opacity" ? "outlineOpacity" : "outlineWidth";
|
|
207
|
+
if (t.some((h) => h.list.some((y) => y[o] !== void 0))) {
|
|
208
|
+
const h = ["match", ["get", t[0].key]];
|
|
209
|
+
t.forEach((y) => {
|
|
210
|
+
y.list.forEach((d) => {
|
|
211
|
+
d.value !== void 0 && d[o] !== void 0 && (h.push(d.value), h.push(d[o]));
|
|
212
|
+
});
|
|
213
|
+
}), h.push(a[o] ?? u[s]), u[s] = h;
|
|
214
|
+
}
|
|
215
|
+
}), t.some((s) => s.list.some((o) => o.lineStyle !== void 0)))) {
|
|
216
|
+
const s = ["match", ["get", t[0].key]];
|
|
217
|
+
t.forEach((o) => {
|
|
218
|
+
o.list.forEach((n) => {
|
|
219
|
+
n.value !== void 0 && n.lineStyle && (s.push(n.value), s.push(n.lineStyle === "dash" ? [2, 2] : ["literal", []]));
|
|
220
|
+
});
|
|
221
|
+
}), s.push(a.lineStyle === "dash" ? [2, 2] : ["literal", []]), u["line-dasharray"] = s;
|
|
222
|
+
}
|
|
223
|
+
return u;
|
|
224
|
+
} catch (e) {
|
|
225
|
+
return console.log("生成outlineStyle失败", e), {};
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function x(i) {
|
|
229
|
+
let { circleConfigList: e } = i, l = JSON.parse(JSON.stringify(e));
|
|
230
|
+
const a = l.find((o) => o.type === "default"), f = l.filter((o) => o.type === "custom");
|
|
231
|
+
a && (l = [...f, a]), console.log("[getCircleStyle] 排序后的 circleConfigList:", l);
|
|
232
|
+
const c = l[l.length - 1], u = c && (c.renderMode === "color" || c.renderMode === "icon");
|
|
233
|
+
if (!c || c.type !== "default")
|
|
234
|
+
return console.warn("[getCircleStyle] 未找到默认配置,使用系统默认值"), {
|
|
235
|
+
_useNewFormat: !0,
|
|
236
|
+
_circleConfigList: [
|
|
237
|
+
{
|
|
238
|
+
type: "default",
|
|
239
|
+
renderMode: "color",
|
|
240
|
+
pointStyle: "地图点.svg",
|
|
241
|
+
pointTintColor: "#67c23a",
|
|
242
|
+
pointSize: 10
|
|
243
|
+
}
|
|
244
|
+
],
|
|
245
|
+
"icon-image": "custom-icon-default-地图点-67c23a",
|
|
246
|
+
"icon-size": 1
|
|
247
|
+
};
|
|
248
|
+
if (console.log("[getCircleStyle] 默认配置:", c), u) {
|
|
249
|
+
const o = {
|
|
250
|
+
_useNewFormat: !0,
|
|
251
|
+
// 标记使用了新格式
|
|
252
|
+
_circleConfigList: l
|
|
253
|
+
// 保存完整配置列表供后续使用
|
|
254
|
+
};
|
|
255
|
+
o["icon-image"] = [], o["icon-size"] = [];
|
|
256
|
+
const n = l.filter((h) => h.type === "custom" && h.value !== "" && h.value != null);
|
|
257
|
+
if (n.length > 0) {
|
|
258
|
+
const h = n[0].key;
|
|
259
|
+
let y = "string";
|
|
260
|
+
for (const p of n)
|
|
261
|
+
if (typeof p.value == "number") {
|
|
262
|
+
y = "number";
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
const d = (p) => y === "number" ? typeof p == "number" ? p : Number(p) : String(p), g = ["match", ["get", h]];
|
|
266
|
+
n.forEach((p) => {
|
|
267
|
+
let S;
|
|
268
|
+
if (p.renderMode === "color") {
|
|
269
|
+
const L = (p.pointTintColor || "#67c23a").replace(/[^a-zA-Z0-9]/g, "");
|
|
270
|
+
S = `custom-icon-${p.key}-${(p.pointStyle || "地图点.svg").replace(".svg", "")}-${L}`;
|
|
271
|
+
} else
|
|
272
|
+
S = p.iconImageName || "hiper-map-icon-1.png";
|
|
273
|
+
g.push(d(p.value)), g.push(S);
|
|
274
|
+
});
|
|
275
|
+
let k;
|
|
276
|
+
if (c.renderMode === "color") {
|
|
277
|
+
const p = (c.pointTintColor || "#67c23a").replace(/[^a-zA-Z0-9]/g, "");
|
|
278
|
+
k = `custom-icon-default-${(c.pointStyle || "地图点.svg").replace(".svg", "")}-${p}`;
|
|
279
|
+
} else
|
|
280
|
+
k = c.iconImageName || "hiper-map-icon-1.png";
|
|
281
|
+
g.push(k), o["icon-image"] = g;
|
|
282
|
+
const m = ["match", ["get", h]];
|
|
283
|
+
n.forEach((p) => {
|
|
284
|
+
m.push(d(p.value)), m.push((p.pointSize || 10) / 20);
|
|
285
|
+
}), m.push((c.pointSize || 10) / 20), o["icon-size"] = m;
|
|
286
|
+
} else {
|
|
287
|
+
let h;
|
|
288
|
+
if (c.renderMode === "color") {
|
|
289
|
+
const y = (c.pointTintColor || "#67c23a").replace(/[^a-zA-Z0-9]/g, "");
|
|
290
|
+
h = `custom-icon-default-${(c.pointStyle || "地图点.svg").replace(".svg", "")}-${y}`;
|
|
291
|
+
} else
|
|
292
|
+
h = c.iconImageName || "hiper-map-icon-1.png";
|
|
293
|
+
o["icon-image"] = h, o["icon-size"] = (c.pointSize || 10) / 20;
|
|
294
|
+
}
|
|
295
|
+
return o;
|
|
296
|
+
}
|
|
297
|
+
const t = {
|
|
298
|
+
"circle-radius": [],
|
|
299
|
+
"circle-stroke-width": [],
|
|
300
|
+
"circle-color": [],
|
|
301
|
+
"circle-stroke-color": [],
|
|
302
|
+
"circle-opacity": [],
|
|
303
|
+
"circle-stroke-opacity": [],
|
|
304
|
+
"icon-image": []
|
|
305
|
+
};
|
|
306
|
+
e = [...e];
|
|
307
|
+
const r = e[e.length - 1];
|
|
308
|
+
e.splice(e.length - 1, 1), t["circle-radius"] = [r.circleRadius], t["circle-stroke-width"] = [r.circleStrokeWidth], t["circle-color"] = [r.circleColor], t["circle-stroke-color"] = [r.circleStrokeColor], t["circle-opacity"] = [r.circleOpacity], t["circle-stroke-opacity"] = [r.circleStrokeOpacity], t["icon-image"] = [
|
|
309
|
+
r.iconImageUrl || "hiper-map-icon-1.png"
|
|
310
|
+
];
|
|
311
|
+
let s = [];
|
|
312
|
+
return e.forEach((o) => {
|
|
313
|
+
if (o.type == "custom") {
|
|
314
|
+
let n = -1;
|
|
315
|
+
s.forEach((h, y) => {
|
|
316
|
+
h.key == o.key && (n = y);
|
|
317
|
+
}), n > -1 ? s[n].list.push(o) : s.push({
|
|
318
|
+
key: o.key,
|
|
319
|
+
list: [o]
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}), s.forEach((o) => {
|
|
323
|
+
r.circleType != "symbol" && (o.list.forEach((n) => {
|
|
324
|
+
t["circle-radius"].unshift(n.circleRadius), t["circle-radius"].unshift(n.value);
|
|
325
|
+
}), t["circle-radius"].unshift(["get", o.key]), t["circle-radius"].unshift("match"), o.list.forEach((n) => {
|
|
326
|
+
t["circle-stroke-width"].unshift(n.circleStrokeWidth), t["circle-stroke-width"].unshift(n.value);
|
|
327
|
+
}), t["circle-stroke-width"].unshift([
|
|
328
|
+
"get",
|
|
329
|
+
o.key
|
|
330
|
+
]), t["circle-stroke-width"].unshift("match"), o.list.forEach((n) => {
|
|
331
|
+
t["circle-color"].unshift(n.circleColor), t["circle-color"].unshift(n.value);
|
|
332
|
+
}), t["circle-color"].unshift(["get", o.key]), t["circle-color"].unshift("match"), o.list.forEach((n) => {
|
|
333
|
+
t["circle-stroke-color"].unshift(n.circleStrokeColor), t["circle-stroke-color"].unshift(n.value);
|
|
334
|
+
}), t["circle-stroke-color"].unshift([
|
|
335
|
+
"get",
|
|
336
|
+
o.key
|
|
337
|
+
]), t["circle-stroke-color"].unshift("match"), o.list.forEach((n) => {
|
|
338
|
+
t["circle-opacity"].unshift(n.circleOpacity), t["circle-opacity"].unshift(n.value);
|
|
339
|
+
}), t["circle-opacity"].unshift(["get", o.key]), t["circle-opacity"].unshift("match"), o.list.forEach((n) => {
|
|
340
|
+
t["circle-stroke-opacity"].unshift(n.circleStrokeOpacity), t["circle-stroke-opacity"].unshift(n.value);
|
|
341
|
+
}), t["circle-stroke-opacity"].unshift([
|
|
342
|
+
"get",
|
|
343
|
+
o.key
|
|
344
|
+
]), t["circle-stroke-opacity"].unshift("match")), r.circleType == "symbol" && (o.list.forEach((n) => {
|
|
345
|
+
t["icon-image"].unshift(n.iconImageUrl || "hiper-map-icon-1.png"), t["icon-image"].unshift(n.value);
|
|
346
|
+
}), t["icon-image"].unshift(["get", o.key]), t["icon-image"].unshift("match"));
|
|
347
|
+
}), e.length == 0 && (t["circle-radius"] = t["circle-radius"][0], t["circle-stroke-width"] = t["circle-stroke-width"][0], t["circle-color"] = t["circle-color"][0], t["circle-stroke-color"] = t["circle-stroke-color"][0], t["circle-opacity"] = t["circle-opacity"][0], t["circle-stroke-opacity"] = t["circle-stroke-opacity"][0], t["icon-image"] = t["icon-image"][0]), t;
|
|
348
|
+
}
|
|
349
|
+
function N(i) {
|
|
350
|
+
let { circleConfigList: e } = i;
|
|
351
|
+
const l = {
|
|
352
|
+
"icon-image": []
|
|
353
|
+
}, a = e[e.length - 1];
|
|
354
|
+
e.splice(e.length - 1, 1), l["icon-image"] = [
|
|
355
|
+
a.iconImageUrl || "hiper-map-icon-1.png"
|
|
356
|
+
];
|
|
357
|
+
let f = [];
|
|
358
|
+
return e.forEach((c) => {
|
|
359
|
+
if (c.type == "custom") {
|
|
360
|
+
let u = -1;
|
|
361
|
+
f.forEach((t, r) => {
|
|
362
|
+
t.key == c.key && (u = r);
|
|
363
|
+
}), u > -1 ? f[u].list.push(c) : f.push({
|
|
364
|
+
key: c.key,
|
|
365
|
+
list: [c]
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}), f.forEach((c) => {
|
|
369
|
+
a.circleType == "symbol" && (c.list.forEach((u) => {
|
|
370
|
+
l["icon-image"].unshift(u.iconImageUrl || "hiper-map-icon-1.png"), l["icon-image"].unshift(u.value);
|
|
371
|
+
}), l["icon-image"].unshift(["get", c.key]), l["icon-image"].unshift("match"));
|
|
372
|
+
}), e.length == 0 && (l["icon-image"] = l["icon-image"][0]), l;
|
|
373
|
+
}
|
|
374
|
+
function B(i) {
|
|
375
|
+
const e = I(i), l = O(i), a = {
|
|
376
|
+
"fill-color": "rgba(103, 194, 58, 0.6)",
|
|
377
|
+
// 默认填充颜色为浅绿色,半透明
|
|
378
|
+
"fill-opacity": 1,
|
|
379
|
+
// 默认填充透明度为1
|
|
380
|
+
"fill-outline-color": "rgba(103, 194, 58, 1)"
|
|
381
|
+
// 默认轮廓颜色为绿色,不透明
|
|
382
|
+
}, f = {
|
|
383
|
+
"line-width": 2,
|
|
384
|
+
// 默认线宽为2像素(与 LayerStyleEditDialog 保持一致)
|
|
385
|
+
"line-color": "rgba(103, 194, 58, 1)",
|
|
386
|
+
// 默认线颜色为绿色,不透明
|
|
387
|
+
"line-opacity": 1
|
|
388
|
+
// 默认线透明度
|
|
389
|
+
}, c = {
|
|
390
|
+
"circle-radius": ["interpolate", ["linear"], ["zoom"], 1, 6, 10, 8, 22, 12],
|
|
391
|
+
// 根据缩放级别调整圆点半径
|
|
392
|
+
"circle-stroke-width": [
|
|
393
|
+
"interpolate",
|
|
394
|
+
["linear"],
|
|
395
|
+
["zoom"],
|
|
396
|
+
1,
|
|
397
|
+
2,
|
|
398
|
+
10,
|
|
399
|
+
5,
|
|
400
|
+
22,
|
|
401
|
+
10
|
|
402
|
+
],
|
|
403
|
+
// 根据缩放级别调整描边宽度
|
|
404
|
+
"circle-stroke-color": [
|
|
405
|
+
"interpolate",
|
|
406
|
+
["linear"],
|
|
407
|
+
["zoom"],
|
|
408
|
+
0,
|
|
409
|
+
"rgba(103, 194, 58, 0.6)",
|
|
410
|
+
22,
|
|
411
|
+
"rgba(103, 194, 58, 0.6)"
|
|
412
|
+
],
|
|
413
|
+
// 根据缩放级别调整描边颜色
|
|
414
|
+
"circle-stroke-opacity": ["interpolate", ["linear"], ["zoom"], 0, 1, 22, 1],
|
|
415
|
+
// 根据缩放级别调整描边透明度
|
|
416
|
+
"circle-color": "rgba(103, 194, 58, 0.6)"
|
|
417
|
+
// 默认圆点颜色为浅绿色,半透明
|
|
418
|
+
};
|
|
419
|
+
if (!e)
|
|
420
|
+
switch (console.warn("当前图层样式配置不存在,使用默认样式,还有执行到这里的情况?"), l) {
|
|
421
|
+
case "fill":
|
|
422
|
+
return a;
|
|
423
|
+
case "line":
|
|
424
|
+
return f;
|
|
425
|
+
case "circle":
|
|
426
|
+
return c;
|
|
427
|
+
}
|
|
428
|
+
switch (l) {
|
|
429
|
+
case "fill":
|
|
430
|
+
const u = v(e);
|
|
431
|
+
return u || a;
|
|
432
|
+
case "line":
|
|
433
|
+
const t = C(e);
|
|
434
|
+
return t || f;
|
|
435
|
+
case "circle":
|
|
436
|
+
const r = x(e);
|
|
437
|
+
return r || c;
|
|
438
|
+
case "symbol":
|
|
439
|
+
const s = N(e);
|
|
440
|
+
return s || {
|
|
441
|
+
"icon-image": "hiper-map-icon-1.png"
|
|
442
|
+
// 默认图标图片
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
function U(i) {
|
|
447
|
+
return new Promise((e, l) => {
|
|
448
|
+
const a = new FileReader();
|
|
449
|
+
a.onload = () => {
|
|
450
|
+
a.result instanceof ArrayBuffer ? e(a.result) : l(new Error("Failed to read file as ArrayBuffer"));
|
|
451
|
+
}, a.onerror = l, a.readAsArrayBuffer(i);
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
function W(i) {
|
|
455
|
+
const e = i.fileDirectory || {}, l = e.ModelTiepoint || [], a = e.ModelPixelScale || [];
|
|
456
|
+
if (l.length >= 6 && a.length >= 3) {
|
|
457
|
+
console.log("情况1:使用ModelTiepoint和ModelPixelScale计算边界", l, a);
|
|
458
|
+
const f = l[3], c = l[4], u = a[0], t = a[1], r = i.getWidth(), s = i.getHeight(), o = f, n = c, h = f + r * u, y = c - s * Math.abs(t);
|
|
459
|
+
return [o, y, h, n];
|
|
460
|
+
} else if (e.ModelTransformation) {
|
|
461
|
+
console.log("情况2:使用ModelTransformation矩阵计算边界");
|
|
462
|
+
const f = e.ModelTransformation;
|
|
463
|
+
if (f && f.length >= 16) {
|
|
464
|
+
const c = i.getWidth(), u = i.getHeight(), t = f[3], r = f[7], s = t + c * f[0], o = r + u * f[5];
|
|
465
|
+
return [t, r, s, o];
|
|
466
|
+
}
|
|
467
|
+
} else if (e.GeographicTypeGeoKey)
|
|
468
|
+
return console.warn("Limited geographic information. Using approximated bounds."), [-180, -90, 180, 90];
|
|
469
|
+
return console.warn("No geographic reference found. Using default bounds."), [-180, -90, 180, 90];
|
|
470
|
+
}
|
|
471
|
+
function D(i) {
|
|
472
|
+
i = i.replace(/^#/, "");
|
|
473
|
+
let e = 0, l = 0, a = 0;
|
|
474
|
+
return i.length === 3 ? (e = parseInt(i.charAt(0) + i.charAt(0), 16), l = parseInt(i.charAt(1) + i.charAt(1), 16), a = parseInt(i.charAt(2) + i.charAt(2), 16)) : i.length === 6 && (e = parseInt(i.substring(0, 2), 16), l = parseInt(i.substring(2, 4), 16), a = parseInt(i.substring(4, 6), 16)), [e, l, a];
|
|
475
|
+
}
|
|
476
|
+
function R(i, e, l) {
|
|
477
|
+
return Math.max(e, Math.min(l, i));
|
|
478
|
+
}
|
|
479
|
+
export {
|
|
480
|
+
R as a,
|
|
481
|
+
F as b,
|
|
482
|
+
W as c,
|
|
483
|
+
O as d,
|
|
484
|
+
v as e,
|
|
485
|
+
C as f,
|
|
486
|
+
T as g,
|
|
487
|
+
D as h,
|
|
488
|
+
B as i,
|
|
489
|
+
J as j,
|
|
490
|
+
A as k,
|
|
491
|
+
I as l,
|
|
492
|
+
x as m,
|
|
493
|
+
M as p,
|
|
494
|
+
U as r
|
|
495
|
+
};
|