qy-vue-plugins 1.0.10-beta → 1.0.11-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/{utils-DD-obz1R.js → utils-D722bgrC.js} +1 -1
- package/dist/chunks/{utils-OPfLDCco.js → utils-DmR75yi4.js} +9 -9
- package/dist/mapboxV2/MapView.cjs +1 -1
- package/dist/mapboxV2/MapView.mjs +332 -333
- package/dist/mapboxV2/useTif.cjs +1 -1
- package/dist/mapboxV2/useTif.mjs +1 -1
- package/dist/mapboxV2/utils.cjs +1 -1
- package/dist/mapboxV2/utils.mjs +9 -9
- package/dist/mapboxV2/widgets/CustomShapeDialog.cjs +1 -1
- package/dist/mapboxV2/widgets/CustomShapeDialog.mjs +1 -1
- package/dist/mapboxV2/widgets/IconPicker.cjs +1 -1
- package/dist/mapboxV2/widgets/IconPicker.mjs +38 -35
- package/dist/mapboxV2/widgets/LegendDialogLine.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendDialogLine.mjs +1 -1
- package/dist/mapboxV2/widgets/LegendDialogPoint.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendDialogPoint.mjs +67 -64
- package/dist/mapboxV2/widgets/LegendLine.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendLine.mjs +1 -1
- package/dist/mapboxV2/widgets/LegendPoint.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendPoint.mjs +8 -8
- package/dist/mapboxV2/widgets/LegendPopPoint.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendPopPoint.mjs +55 -56
- package/dist/mapboxV2/widgets/LegendShape.cjs +1 -1
- package/dist/mapboxV2/widgets/LegendShape.mjs +1 -1
- package/dist/mapboxV2/widgets/ShapeDialog.cjs +1 -1
- package/dist/mapboxV2/widgets/ShapeDialog.mjs +1176 -1038
- package/dist/qy-vue-plugins.css +1 -1
- package/dist/types/mapboxV2/types/map-layer.d.ts +0 -4
- package/dist/types/mapboxV2/utils/geojsonRenderer.d.ts +0 -1
- package/package/mapboxV2/utils.ts +4 -4
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const L=require("vue"),p=require("./constant-D5rOYGSP.js");function x(i,e){let t={marginTop:"-2px"};switch(i){case"solid":case"solid-line":t.borderBottom=`4px solid ${e}`;break;case"dash":case"dotted":case"simple-dash":t.borderBottom=`4px dashed ${e}`;break;case"dot-dash":t.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":t.backgroundImage=`linear-gradient(to right, ${e} 50%, rgba(255, 255, 255, 0) 50%)`;break;case"dot-line":t.backgroundImage=`linear-gradient(to right, ${e} 25%, rgba(255, 255, 255, 0) 10%)`;break;case"complex-pattern":t.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:t.borderBottom=`4px solid ${e}`;break}return t}function $(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||"{}"):p.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||"{}"):p.defaultStyleConfig;default:throw new Error(`Unsupported layer type: ${e}`)}}function F(i){try{return`layer-id-${i.id}`}catch(e){return console.error("Error getting layer ID:",e),`layer-id-${L.useId()}`}}function J(i){try{return`source-id-${i.id}`}catch(e){return console.error("Error getting source ID:",e),`source-id-${L.useId()}`}}function C(i){try{const e=i.layerPaintConfig?JSON.parse(i.layerPaintConfig):p.defaultStyleConfig;if(e&&typeof e=="object"){const t=e,s=Array.isArray(t.symbolConfigList)?t.symbolConfigList:[],f=Array.isArray(t.circleConfigList)?t.circleConfigList:[];!s.length&&f.length&&(t.symbolConfigList=JSON.parse(JSON.stringify(f))),!f.length&&s.length&&(t.circleConfigList=JSON.parse(JSON.stringify(s)))}return e}catch{return p.defaultStyleConfig}}const w=i=>{const e=i.symbolConfigList,t=i.circleConfigList;return Array.isArray(e)&&e.length>0?JSON.parse(JSON.stringify(e)):Array.isArray(t)&&t.length>0?JSON.parse(JSON.stringify(t)):JSON.parse(JSON.stringify(p.defaultStyleConfig.circleConfigList||[]))};function I(i){let e="fill";switch(i.layerType){case"shp":case"kml":case"kmz":if(i.layerShapes){const t=i.layerShapes.split(",").map(s=>s.trim().toLowerCase());t.length===1?t[0]==="point"?e="circle":t[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 t=JSON.parse(i.layerPaintConfig),s=t.symbolConfigList||t.circleConfigList;s&&s?.length>0&&s[0].circleType=="symbol"&&(e="symbol")}break;default:e="fill"}return e}function E(i){try{let e={},t=JSON.parse(JSON.stringify(i.fillColorList));const s=t.find(o=>o.type==="default"),f=t.filter(o=>o.type==="custom");s&&(t=[...f,s]),console.log("[getFillStyle] 排序后的 fillColorList:",t);let n=t.filter(o=>o.type==="custom"?o.key&&o.value:!0);const u=n[n.length-1];if(!u||u.type!=="default")return console.warn("[getFillStyle] 未找到默认配置,使用系统默认颜色"),e["fill-color"]="rgba(103, 194, 58, 0.6)",e["fill-outline-color"]="rgba(103, 194, 58, 1)",e;console.log("[getFillStyle] 默认颜色配置:",u);let r=[];if(n.forEach(o=>{if(o.type=="custom"){let a=-1;r.forEach((l,c)=>{l.key==o.key&&(a=c)}),a>-1?r[a].list.push(o):r.push({key:o.key,list:[o]})}}),console.log("[getFillStyle] fillColorGroupList:",r),r.length>0){let o=u.color;[...r].reverse().forEach(a=>{const l=["match",["to-string",["get",a.key]]];a.list.forEach(c=>{l.push(String(c.value)),l.push(c.color)}),l.push(o),o=l}),e["fill-color"]=o,console.log("[getFillStyle] 使用条件渲染,colorExpression:",o)}else e["fill-color"]=u.color,console.log("[getFillStyle] 使用单一颜色:",u.color);return e["fill-outline-color"]=u.color,console.log("[getFillStyle] 生成 fillStyle 成功:",e),e}catch(e){console.log("[getFillStyle] 生成 fillStyle 失败:",e)}}function T(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 N(i){try{let{outlineConfigList:e}=i;if(!e||e.length===0)return console.warn("[getOutLineStyle] outlineConfigList 为空,使用默认样式"),{"line-color":"rgba(103, 194, 58, 1)","line-width":2,"line-dasharray":["literal",[]]};let t=JSON.parse(JSON.stringify(e));const s=t.find(o=>o.type==="default"),f=t.filter(o=>o.type==="custom");s&&(t=[...f,s]);const n=t[t.length-1];if(!n||n.type!=="default")return console.warn("[getOutLineStyle] 未找到默认配置,使用系统默认值"),{"line-color":"rgba(103, 194, 58, 1)","line-width":1};let u={"line-color":n.outlineColor||"rgba(103, 194, 58, 1)","line-width":n.outlineWidth??1};n.lineStyle==="dash"?u["line-dasharray"]=[2,2]:u["line-dasharray"]=["literal",[]];let r=[];if(t.forEach(o=>{if(o.type==="custom"&&o.key&&o.value){let a=-1;r.forEach((l,c)=>{l.key===o.key&&(a=c)}),a>-1?r[a].list.push(o):r.push({key:o.key,list:[o]})}}),r.length>0&&(["line-color","line-width"].forEach(a=>{const l=a==="line-color"?"outlineColor":"outlineWidth";if(r.some(g=>g.list.some(d=>d[l]!==void 0))){const g=["match",["to-string",["get",r[0].key]]];r.forEach(d=>{d.list.forEach(h=>{h.value!==void 0&&h[l]!==void 0&&(g.push(String(h.value)),g.push(h[l]))})}),g.push(s[l]??u[a]),u[a]=g}}),r.some(a=>a.list.some(l=>l.lineStyle!==void 0)))){const a=["match",["to-string",["get",r[0].key]]];r.forEach(l=>{l.list.forEach(c=>{c.value!==void 0&&c.lineStyle&&(a.push(String(c.value)),a.push(c.lineStyle==="dash"?[2,2]:["literal",[]]))})}),a.push(s.lineStyle==="dash"?[2,2]:["literal",[]]),u["line-dasharray"]=a}return u}catch(e){return console.log("生成outlineStyle失败",e),{"line-color":"rgba(103, 194, 58, 1)","line-width":2,"line-dasharray":[]}}}function O(i){let e=w(i),t=JSON.parse(JSON.stringify(e));const s=t.find(l=>l.type==="default"),f=t.filter(l=>l.type==="custom");s&&(t=[...f,s]),console.log("[getCircleStyle] 排序后的 circleConfigList:",t);const n=t[t.length-1],u=n&&(n.renderMode==="color"||n.renderMode==="icon");if(!n||n.type!=="default")return console.warn("[getCircleStyle] 未找到默认配置,使用系统默认值"),{_useNewFormat:!0,_circleConfigList:[{type:"default",renderMode:"color",pointStyle:"",pointTintColor:"rgba(103, 194, 58, 1)",pointSize:10}],"icon-image":"custom-icon-default--67c23a","icon-size":1};if(console.log("[getCircleStyle] 默认配置:",n),u){const l={_useNewFormat:!0,_circleConfigList:t};l["icon-image"]=[],l["icon-size"]=[];const c=t.filter(g=>g.type==="custom"&&g.value!==""&&g.value!=null);if(c.length>0){const g=c[0].key;let d="string";for(const y of c)if(typeof y.value=="number"){d="number";break}const h=y=>d==="number"?typeof y=="number"?y:Number(y):String(y),m=["match",["get",g]];c.forEach(y=>{let k;if(y.renderMode==="color"){const A=(y.pointTintColor||"rgba(103, 194, 58, 1)").replace(/[^a-zA-Z0-9]/g,"");k=`custom-icon-${y.key}-${y.pointStyle||""}-${A}`}else k=y.iconImageName||"";m.push(h(y.value)),m.push(k)});let b;if(n.renderMode==="color"){const y=(n.pointTintColor||"#67c23a").replace(/[^a-zA-Z0-9]/g,"");b=`custom-icon-default-${n.pointStyle||""}-${y}`}else b=n.iconImageName||"";m.push(b),l["icon-image"]=m;const S=["match",["get",g]];c.forEach(y=>{S.push(h(y.value)),S.push((y.pointSize||10)/20)}),S.push((n.pointSize||10)/20),l["icon-size"]=S}else{let g;if(n.renderMode==="color"){const d=(n.pointTintColor||"#67c23a").replace(/[^a-zA-Z0-9]/g,"");g=`custom-icon-default-${n.pointStyle||""}-${d}`}else g=n.iconImageName||"";l["icon-image"]=g,l["icon-size"]=(n.pointSize||10)/20}return l}const r={"circle-radius":[],"circle-stroke-width":[],"circle-color":[],"circle-stroke-color":[],"icon-image":[]};e=[...e];const o=e[e.length-1];e.splice(e.length-1,1),r["circle-radius"]=[o.circleRadius],r["circle-stroke-width"]=[o.circleStrokeWidth],r["circle-color"]=[o.circleColor],r["circle-stroke-color"]=[o.circleStrokeColor],r["icon-image"]=[o.iconImageUrl||""];let a=[];return e.forEach(l=>{if(l.type=="custom"){let c=-1;a.forEach((g,d)=>{g.key==l.key&&(c=d)}),c>-1?a[c].list.push(l):a.push({key:l.key,list:[l]})}}),a.forEach(l=>{o.circleType!="symbol"&&(l.list.forEach(c=>{r["circle-radius"].unshift(c.circleRadius),r["circle-radius"].unshift(c.value)}),r["circle-radius"].unshift(["get",l.key]),r["circle-radius"].unshift("match"),l.list.forEach(c=>{r["circle-stroke-width"].unshift(c.circleStrokeWidth),r["circle-stroke-width"].unshift(c.value)}),r["circle-stroke-width"].unshift(["get",l.key]),r["circle-stroke-width"].unshift("match"),l.list.forEach(c=>{r["circle-color"].unshift(c.circleColor),r["circle-color"].unshift(c.value)}),r["circle-color"].unshift(["get",l.key]),r["circle-color"].unshift("match"),l.list.forEach(c=>{r["circle-stroke-color"].unshift(c.circleStrokeColor),r["circle-stroke-color"].unshift(c.value)}),r["circle-stroke-color"].unshift(["get",l.key]),r["circle-stroke-color"].unshift("match")),o.circleType=="symbol"&&(l.list.forEach(c=>{r["icon-image"].unshift(c.iconImageUrl||""),r["icon-image"].unshift(c.value)}),r["icon-image"].unshift(["get",l.key]),r["icon-image"].unshift("match"))}),e.length==0&&(r["circle-radius"]=r["circle-radius"][0],r["circle-stroke-width"]=r["circle-stroke-width"][0],r["circle-color"]=r["circle-color"][0],r["circle-stroke-color"]=r["circle-stroke-color"][0],r["icon-image"]=r["icon-image"][0]),r}function v(i){let e=w(i);const t={"icon-image":[]},s=e[e.length-1];e=e.slice(0,-1),t["icon-image"]=[s.iconImageUrl||""];let f=[];return e.forEach(n=>{if(n.type=="custom"){let u=-1;f.forEach((r,o)=>{r.key==n.key&&(u=o)}),u>-1?f[u].list.push(n):f.push({key:n.key,list:[n]})}}),f.forEach(n=>{s.circleType=="symbol"&&(n.list.forEach(u=>{t["icon-image"].unshift(u.iconImageUrl||""),t["icon-image"].unshift(u.value)}),t["icon-image"].unshift(["get",n.key]),t["icon-image"].unshift("match"))}),e.length==0&&(t["icon-image"]=t["icon-image"][0]),t}function z(i){const e=C(i),t=I(i),s={"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)"},n={"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("当前图层样式配置不存在,使用默认样式,还有执行到这里的情况?"),t){case"fill":return s;case"line":return f;case"circle":return n}switch(t){case"fill":const u=E(e);return u||s;case"line":const r=N(e);return r||f;case"circle":const o=O(e);return o||n;case"symbol":const a=v(e);return a||{"icon-image":""}}}function M(i){return new Promise((e,t)=>{const s=new FileReader;s.onload=()=>{s.result instanceof ArrayBuffer?e(s.result):t(new Error("Failed to read file as ArrayBuffer"))},s.onerror=t,s.readAsArrayBuffer(i)})}function B(i){const e=i.fileDirectory||{},t=e.ModelTiepoint||[],s=e.ModelPixelScale||[];if(t.length>=6&&s.length>=3){console.log("情况1:使用ModelTiepoint和ModelPixelScale计算边界",t,s);const f=t[3],n=t[4],u=s[0],r=s[1],o=i.getWidth(),a=i.getHeight(),l=f,c=n,g=f+o*u,d=n-a*Math.abs(r);return[l,d,g,c]}else if(e.ModelTransformation){console.log("情况2:使用ModelTransformation矩阵计算边界");const f=e.ModelTransformation;if(f&&f.length>=16){const n=i.getWidth(),u=i.getHeight(),r=f[3],o=f[7],a=r+n*f[0],l=o+u*f[5];return[r,o,a,l]}}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 U(i){i=i.replace(/^#/,"");let e=0,t=0,s=0;return i.length===3?(e=parseInt(i.charAt(0)+i.charAt(0),16),t=parseInt(i.charAt(1)+i.charAt(1),16),s=parseInt(i.charAt(2)+i.charAt(2),16)):i.length===6&&(e=parseInt(i.substring(0,2),16),t=parseInt(i.substring(2,4),16),s=parseInt(i.substring(4,6),16)),[e,t,s]}function R(i,e,t){return Math.max(e,Math.min(t,i))}function W(i,e){if(i)return e.find(t=>t.id===i)}exports.calculateBounds=B;exports.clamp=R;exports.getCircleStyle=O;exports.getFillStyle=E;exports.getLabelStyle=T;exports.getLayerId=F;exports.getLayerStyle=z;exports.getLayerType=I;exports.getLineLegendStyle=x;exports.getOutLineStyle=N;exports.getSourceId=J;exports.hexToRgb=U;exports.parseLayerPaintConfig=$;exports.parseStyleConfig=C;exports.readFileAsArrayBuffer=M;exports.resolveAssetById=W;
|
|
1
|
+
"use strict";const L=require("vue"),p=require("./constant-D5rOYGSP.js");function x(i,e){let t={marginTop:"-2px"};switch(i){case"solid":case"solid-line":t.borderBottom=`4px solid ${e}`;break;case"dash":case"dotted":case"simple-dash":t.borderBottom=`4px dashed ${e}`;break;case"dot-dash":t.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":t.backgroundImage=`linear-gradient(to right, ${e} 50%, rgba(255, 255, 255, 0) 50%)`;break;case"dot-line":t.backgroundImage=`linear-gradient(to right, ${e} 25%, rgba(255, 255, 255, 0) 10%)`;break;case"complex-pattern":t.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:t.borderBottom=`4px solid ${e}`;break}return t}function $(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||"{}"):p.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||"{}"):p.defaultStyleConfig;default:throw new Error(`Unsupported layer type: ${e}`)}}function F(i){try{return`layer-id-${i.id}`}catch(e){return console.error("Error getting layer ID:",e),`layer-id-${L.useId()}`}}function J(i){try{return`source-id-${i.id}`}catch(e){return console.error("Error getting source ID:",e),`source-id-${L.useId()}`}}function C(i){try{const e=i.layerPaintConfig?JSON.parse(i.layerPaintConfig):p.defaultStyleConfig;if(e&&typeof e=="object"){const t=e,s=Array.isArray(t.symbolConfigList)?t.symbolConfigList:[],f=Array.isArray(t.circleConfigList)?t.circleConfigList:[];!s.length&&f.length&&(t.symbolConfigList=JSON.parse(JSON.stringify(f))),!f.length&&s.length&&(t.circleConfigList=JSON.parse(JSON.stringify(s)))}return e}catch{return p.defaultStyleConfig}}const w=i=>{const e=i.symbolConfigList,t=i.circleConfigList;return Array.isArray(e)&&e.length>0?JSON.parse(JSON.stringify(e)):Array.isArray(t)&&t.length>0?JSON.parse(JSON.stringify(t)):JSON.parse(JSON.stringify(p.defaultStyleConfig.circleConfigList||[]))};function E(i){let e="fill";switch(i.layerType){case"shp":case"kml":case"kmz":if(i.layerShapes){const t=i.layerShapes.split(",").map(s=>s.trim().toLowerCase());t.length===1?t[0]==="point"?e="circle":t[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 t=JSON.parse(i.layerPaintConfig),s=t.symbolConfigList||t.circleConfigList;s&&s?.length>0&&s[0].circleType=="symbol"&&(e="symbol")}break;default:e="fill"}return e}function I(i){try{let e={},t=JSON.parse(JSON.stringify(i.fillColorList));const s=t.find(o=>o.type==="default"),f=t.filter(o=>o.type==="custom");s&&(t=[...f,s]),console.log("[getFillStyle] 排序后的 fillColorList:",t);let n=t.filter(o=>o.type==="custom"?o.key&&o.value:!0);const u=n[n.length-1];if(!u||u.type!=="default")return console.warn("[getFillStyle] 未找到默认配置,使用系统默认颜色"),e["fill-color"]="rgba(103, 194, 58, 0.6)",e["fill-outline-color"]="rgba(103, 194, 58, 1)",e;console.log("[getFillStyle] 默认颜色配置:",u);let r=[];if(n.forEach(o=>{if(o.type=="custom"){let a=-1;r.forEach((l,c)=>{l.key==o.key&&(a=c)}),a>-1?r[a].list.push(o):r.push({key:o.key,list:[o]})}}),console.log("[getFillStyle] fillColorGroupList:",r),r.length>0){let o=u.color;[...r].reverse().forEach(a=>{const l=["match",["to-string",["get",a.key]]];a.list.forEach(c=>{l.push(String(c.value)),l.push(c.color)}),l.push(o),o=l}),e["fill-color"]=o,console.log("[getFillStyle] 使用条件渲染,colorExpression:",o)}else e["fill-color"]=u.color,console.log("[getFillStyle] 使用单一颜色:",u.color);return e["fill-outline-color"]=u.color,console.log("[getFillStyle] 生成 fillStyle 成功:",e),e}catch(e){console.log("[getFillStyle] 生成 fillStyle 失败:",e)}}function T(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-width":2,"line-dasharray":["literal",[]]};let t=JSON.parse(JSON.stringify(e));const s=t.find(o=>o.type==="default"),f=t.filter(o=>o.type==="custom");s&&(t=[...f,s]);const n=t[t.length-1];if(!n||n.type!=="default")return console.warn("[getOutLineStyle] 未找到默认配置,使用系统默认值"),{"line-color":"rgba(103, 194, 58, 1)","line-width":1};let u={"line-color":n.outlineColor||"rgba(103, 194, 58, 1)","line-width":n.outlineWidth??1};n.lineStyle==="dash"?u["line-dasharray"]=[2,2]:u["line-dasharray"]=["literal",[]];let r=[];if(t.forEach(o=>{if(o.type==="custom"&&o.key&&o.value){let a=-1;r.forEach((l,c)=>{l.key===o.key&&(a=c)}),a>-1?r[a].list.push(o):r.push({key:o.key,list:[o]})}}),r.length>0&&(["line-color","line-width"].forEach(a=>{const l=a==="line-color"?"outlineColor":"outlineWidth";if(r.some(g=>g.list.some(d=>d[l]!==void 0))){const g=["match",["to-string",["get",r[0].key]]];r.forEach(d=>{d.list.forEach(h=>{h.value!==void 0&&h[l]!==void 0&&(g.push(String(h.value)),g.push(h[l]))})}),g.push(s[l]??u[a]),u[a]=g}}),r.some(a=>a.list.some(l=>l.lineStyle!==void 0)))){const a=["match",["to-string",["get",r[0].key]]];r.forEach(l=>{l.list.forEach(c=>{c.value!==void 0&&c.lineStyle&&(a.push(String(c.value)),a.push(c.lineStyle==="dash"?[2,2]:["literal",[]]))})}),a.push(s.lineStyle==="dash"?[2,2]:["literal",[]]),u["line-dasharray"]=a}return u}catch(e){return console.log("生成outlineStyle失败",e),{"line-color":"rgba(103, 194, 58, 1)","line-width":2,"line-dasharray":[]}}}function N(i){let e=w(i),t=JSON.parse(JSON.stringify(e));const s=t.find(l=>l.type==="default"),f=t.filter(l=>l.type==="custom");s&&(t=[...f,s]),console.log("[getCircleStyle] 排序后的 circleConfigList:",t);const n=t[t.length-1],u=n&&(n.renderMode==="color"||n.renderMode==="icon");if(!n||n.type!=="default")return console.warn("[getCircleStyle] 未找到默认配置,使用系统默认值"),{_useNewFormat:!0,_circleConfigList:[{type:"default",renderMode:"color",pointStyle:"",pointTintColor:"rgba(103, 194, 58, 1)",pointSize:10}],"icon-image":"custom-icon-default--67c23a","icon-size":1};if(console.log("[getCircleStyle] 默认配置:",n),u){const l={_useNewFormat:!0,_circleConfigList:t};l["icon-image"]=[],l["icon-size"]=[];const c=t.filter(g=>g.type==="custom"&&g.value!==""&&g.value!=null);if(c.length>0){const g=c[0].key;let d="string";for(const y of c)if(typeof y.value=="number"){d="number";break}const h=y=>d==="number"?typeof y=="number"?y:Number(y):String(y),m=["match",["get",g]];c.forEach(y=>{let k;if(y.renderMode==="color"){const A=(y.pointTintColor||"rgba(103, 194, 58, 1)").replace(/[^a-zA-Z0-9]/g,"");k=`custom-icon-${y.key}-${y.pointStyle||""}-${A}`}else k=y.pointStyle||"";m.push(h(y.value)),m.push(k)});let b;if(n.renderMode==="color"){const y=(n.pointTintColor||"#67c23a").replace(/[^a-zA-Z0-9]/g,"");b=`custom-icon-default-${n.pointStyle||""}-${y}`}else b=n.pointStyle||"";m.push(b),l["icon-image"]=m;const S=["match",["get",g]];c.forEach(y=>{S.push(h(y.value)),S.push((y.pointSize||10)/20)}),S.push((n.pointSize||10)/20),l["icon-size"]=S}else{let g;if(n.renderMode==="color"){const d=(n.pointTintColor||"#67c23a").replace(/[^a-zA-Z0-9]/g,"");g=`custom-icon-default-${n.pointStyle||""}-${d}`}else g=n.pointStyle||"";l["icon-image"]=g,l["icon-size"]=(n.pointSize||10)/20}return l}const r={"circle-radius":[],"circle-stroke-width":[],"circle-color":[],"circle-stroke-color":[],"icon-image":[]};e=[...e];const o=e[e.length-1];e.splice(e.length-1,1),r["circle-radius"]=[o.circleRadius],r["circle-stroke-width"]=[o.circleStrokeWidth],r["circle-color"]=[o.circleColor],r["circle-stroke-color"]=[o.circleStrokeColor],r["icon-image"]=[o.iconImageUrl||""];let a=[];return e.forEach(l=>{if(l.type=="custom"){let c=-1;a.forEach((g,d)=>{g.key==l.key&&(c=d)}),c>-1?a[c].list.push(l):a.push({key:l.key,list:[l]})}}),a.forEach(l=>{o.circleType!="symbol"&&(l.list.forEach(c=>{r["circle-radius"].unshift(c.circleRadius),r["circle-radius"].unshift(c.value)}),r["circle-radius"].unshift(["get",l.key]),r["circle-radius"].unshift("match"),l.list.forEach(c=>{r["circle-stroke-width"].unshift(c.circleStrokeWidth),r["circle-stroke-width"].unshift(c.value)}),r["circle-stroke-width"].unshift(["get",l.key]),r["circle-stroke-width"].unshift("match"),l.list.forEach(c=>{r["circle-color"].unshift(c.circleColor),r["circle-color"].unshift(c.value)}),r["circle-color"].unshift(["get",l.key]),r["circle-color"].unshift("match"),l.list.forEach(c=>{r["circle-stroke-color"].unshift(c.circleStrokeColor),r["circle-stroke-color"].unshift(c.value)}),r["circle-stroke-color"].unshift(["get",l.key]),r["circle-stroke-color"].unshift("match")),o.circleType=="symbol"&&(l.list.forEach(c=>{r["icon-image"].unshift(c.iconImageUrl||""),r["icon-image"].unshift(c.value)}),r["icon-image"].unshift(["get",l.key]),r["icon-image"].unshift("match"))}),e.length==0&&(r["circle-radius"]=r["circle-radius"][0],r["circle-stroke-width"]=r["circle-stroke-width"][0],r["circle-color"]=r["circle-color"][0],r["circle-stroke-color"]=r["circle-stroke-color"][0],r["icon-image"]=r["icon-image"][0]),r}function v(i){let e=w(i);const t={"icon-image":[]},s=e[e.length-1];e=e.slice(0,-1),t["icon-image"]=[s.iconImageUrl||""];let f=[];return e.forEach(n=>{if(n.type=="custom"){let u=-1;f.forEach((r,o)=>{r.key==n.key&&(u=o)}),u>-1?f[u].list.push(n):f.push({key:n.key,list:[n]})}}),f.forEach(n=>{s.circleType=="symbol"&&(n.list.forEach(u=>{t["icon-image"].unshift(u.iconImageUrl||""),t["icon-image"].unshift(u.value)}),t["icon-image"].unshift(["get",n.key]),t["icon-image"].unshift("match"))}),e.length==0&&(t["icon-image"]=t["icon-image"][0]),t}function z(i){const e=C(i),t=E(i),s={"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)"},n={"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("当前图层样式配置不存在,使用默认样式,还有执行到这里的情况?"),t){case"fill":return s;case"line":return f;case"circle":return n}switch(t){case"fill":const u=I(e);return u||s;case"line":const r=O(e);return r||f;case"circle":const o=N(e);return o||n;case"symbol":const a=v(e);return a||{"icon-image":""}}}function M(i){return new Promise((e,t)=>{const s=new FileReader;s.onload=()=>{s.result instanceof ArrayBuffer?e(s.result):t(new Error("Failed to read file as ArrayBuffer"))},s.onerror=t,s.readAsArrayBuffer(i)})}function B(i){const e=i.fileDirectory||{},t=e.ModelTiepoint||[],s=e.ModelPixelScale||[];if(t.length>=6&&s.length>=3){console.log("情况1:使用ModelTiepoint和ModelPixelScale计算边界",t,s);const f=t[3],n=t[4],u=s[0],r=s[1],o=i.getWidth(),a=i.getHeight(),l=f,c=n,g=f+o*u,d=n-a*Math.abs(r);return[l,d,g,c]}else if(e.ModelTransformation){console.log("情况2:使用ModelTransformation矩阵计算边界");const f=e.ModelTransformation;if(f&&f.length>=16){const n=i.getWidth(),u=i.getHeight(),r=f[3],o=f[7],a=r+n*f[0],l=o+u*f[5];return[r,o,a,l]}}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 U(i){i=i.replace(/^#/,"");let e=0,t=0,s=0;return i.length===3?(e=parseInt(i.charAt(0)+i.charAt(0),16),t=parseInt(i.charAt(1)+i.charAt(1),16),s=parseInt(i.charAt(2)+i.charAt(2),16)):i.length===6&&(e=parseInt(i.substring(0,2),16),t=parseInt(i.substring(2,4),16),s=parseInt(i.substring(4,6),16)),[e,t,s]}function R(i,e,t){return Math.max(e,Math.min(t,i))}function W(i,e){if(i)return e.find(t=>t.id===i)}exports.calculateBounds=B;exports.clamp=R;exports.getCircleStyle=N;exports.getFillStyle=I;exports.getLabelStyle=T;exports.getLayerId=F;exports.getLayerStyle=z;exports.getLayerType=E;exports.getLineLegendStyle=x;exports.getOutLineStyle=O;exports.getSourceId=J;exports.hexToRgb=U;exports.parseLayerPaintConfig=$;exports.parseStyleConfig=C;exports.readFileAsArrayBuffer=M;exports.resolveAssetById=W;
|
|
@@ -95,7 +95,7 @@ const C = (i) => {
|
|
|
95
95
|
const e = i.symbolConfigList, t = i.circleConfigList;
|
|
96
96
|
return Array.isArray(e) && e.length > 0 ? JSON.parse(JSON.stringify(e)) : Array.isArray(t) && t.length > 0 ? JSON.parse(JSON.stringify(t)) : JSON.parse(JSON.stringify(S.circleConfigList || []));
|
|
97
97
|
};
|
|
98
|
-
function
|
|
98
|
+
function O(i) {
|
|
99
99
|
let e = "fill";
|
|
100
100
|
switch (i.layerType) {
|
|
101
101
|
case "shp":
|
|
@@ -121,7 +121,7 @@ function I(i) {
|
|
|
121
121
|
}
|
|
122
122
|
return e;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function I(i) {
|
|
125
125
|
try {
|
|
126
126
|
let e = {}, t = JSON.parse(JSON.stringify(i.fillColorList));
|
|
127
127
|
const s = t.find((o) => o.type === "default"), f = t.filter((o) => o.type === "custom");
|
|
@@ -294,7 +294,7 @@ function A(i) {
|
|
|
294
294
|
const w = (h.pointTintColor || "rgba(103, 194, 58, 1)").replace(/[^a-zA-Z0-9]/g, "");
|
|
295
295
|
k = `custom-icon-${h.key}-${h.pointStyle || ""}-${w}`;
|
|
296
296
|
} else
|
|
297
|
-
k = h.
|
|
297
|
+
k = h.pointStyle || "";
|
|
298
298
|
p.push(y(h.value)), p.push(k);
|
|
299
299
|
});
|
|
300
300
|
let b;
|
|
@@ -302,7 +302,7 @@ function A(i) {
|
|
|
302
302
|
const h = (n.pointTintColor || "#67c23a").replace(/[^a-zA-Z0-9]/g, "");
|
|
303
303
|
b = `custom-icon-default-${n.pointStyle || ""}-${h}`;
|
|
304
304
|
} else
|
|
305
|
-
b = n.
|
|
305
|
+
b = n.pointStyle || "";
|
|
306
306
|
p.push(b), l["icon-image"] = p;
|
|
307
307
|
const m = ["match", ["get", g]];
|
|
308
308
|
c.forEach((h) => {
|
|
@@ -314,7 +314,7 @@ function A(i) {
|
|
|
314
314
|
const d = (n.pointTintColor || "#67c23a").replace(/[^a-zA-Z0-9]/g, "");
|
|
315
315
|
g = `custom-icon-default-${n.pointStyle || ""}-${d}`;
|
|
316
316
|
} else
|
|
317
|
-
g = n.
|
|
317
|
+
g = n.pointStyle || "";
|
|
318
318
|
l["icon-image"] = g, l["icon-size"] = (n.pointSize || 10) / 20;
|
|
319
319
|
}
|
|
320
320
|
return l;
|
|
@@ -388,7 +388,7 @@ function $(i) {
|
|
|
388
388
|
}), e.length == 0 && (t["icon-image"] = t["icon-image"][0]), t;
|
|
389
389
|
}
|
|
390
390
|
function U(i) {
|
|
391
|
-
const e = N(i), t =
|
|
391
|
+
const e = N(i), t = O(i), s = {
|
|
392
392
|
"fill-color": "rgba(103, 194, 58, 0.6)",
|
|
393
393
|
// 默认填充颜色为浅绿色,半透明
|
|
394
394
|
"fill-opacity": 1,
|
|
@@ -441,7 +441,7 @@ function U(i) {
|
|
|
441
441
|
}
|
|
442
442
|
switch (t) {
|
|
443
443
|
case "fill":
|
|
444
|
-
const u =
|
|
444
|
+
const u = I(e);
|
|
445
445
|
return u || s;
|
|
446
446
|
case "line":
|
|
447
447
|
const r = x(e);
|
|
@@ -498,8 +498,8 @@ export {
|
|
|
498
498
|
X as b,
|
|
499
499
|
D as c,
|
|
500
500
|
v as d,
|
|
501
|
-
|
|
502
|
-
|
|
501
|
+
O as e,
|
|
502
|
+
I as f,
|
|
503
503
|
F as g,
|
|
504
504
|
R as h,
|
|
505
505
|
x as i,
|