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
|
@@ -17,6 +17,7 @@ import type {
|
|
|
17
17
|
} from "../types/map"; // 导入地图相关的类型定义
|
|
18
18
|
import { defaultPointLayerPaintConfig, defaultStyleConfig } from "./constant"; // 导入默认的点图层绘制配置和默认样式配置
|
|
19
19
|
import { GeoTIFFImage } from "geotiff";
|
|
20
|
+
import type { PointAssetOption } from "./types/map-layer";
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* 获取图例线条样式
|
|
@@ -96,6 +97,9 @@ export function parseLayerPaintConfig<T>(
|
|
|
96
97
|
return JSON.parse(layerPaintConfig || "{}") as T;
|
|
97
98
|
case "shape": // 形状图层
|
|
98
99
|
case "shp": // SHP 文件图层
|
|
100
|
+
case "kml": // KML 文件图层
|
|
101
|
+
case "kmz": // KMZ 文件图层
|
|
102
|
+
case "tif": // TIF 文件图层
|
|
99
103
|
// 对于symbol和shape类型,可能没有特定的配置
|
|
100
104
|
// 如果没有提供配置,则返回默认样式配置
|
|
101
105
|
if (!layerPaintConfig) {
|
|
@@ -156,14 +160,100 @@ export function getSourceId(layer: GeographicLayerEntity): string {
|
|
|
156
160
|
*/
|
|
157
161
|
export function parseStyleConfig(layer: GeographicLayerEntity): MapStyleConfig {
|
|
158
162
|
try {
|
|
159
|
-
|
|
163
|
+
const styleConfig = layer.layerPaintConfig
|
|
160
164
|
? JSON.parse(layer.layerPaintConfig)
|
|
161
165
|
: defaultStyleConfig;
|
|
166
|
+
|
|
167
|
+
if (styleConfig && typeof styleConfig === "object") {
|
|
168
|
+
const config = styleConfig as any;
|
|
169
|
+
const mergedConfig: any = {
|
|
170
|
+
...defaultStyleConfig,
|
|
171
|
+
...config,
|
|
172
|
+
};
|
|
173
|
+
const symbolConfigList = Array.isArray(config.symbolConfigList)
|
|
174
|
+
? config.symbolConfigList
|
|
175
|
+
: [];
|
|
176
|
+
const circleConfigList = Array.isArray(config.circleConfigList)
|
|
177
|
+
? config.circleConfigList
|
|
178
|
+
: [];
|
|
179
|
+
|
|
180
|
+
// 兼容新老字段:读取时双向兜底,避免任一链路缺字段导致渲染中断
|
|
181
|
+
if (!symbolConfigList.length && circleConfigList.length) {
|
|
182
|
+
mergedConfig.symbolConfigList = JSON.parse(
|
|
183
|
+
JSON.stringify(circleConfigList),
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
if (!circleConfigList.length && symbolConfigList.length) {
|
|
187
|
+
mergedConfig.circleConfigList = JSON.parse(
|
|
188
|
+
JSON.stringify(symbolConfigList),
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (
|
|
193
|
+
!Array.isArray(mergedConfig.fillColorList) ||
|
|
194
|
+
mergedConfig.fillColorList.length === 0
|
|
195
|
+
) {
|
|
196
|
+
mergedConfig.fillColorList = JSON.parse(
|
|
197
|
+
JSON.stringify(defaultStyleConfig.fillColorList || []),
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
if (
|
|
201
|
+
!Array.isArray(mergedConfig.outlineConfigList) ||
|
|
202
|
+
mergedConfig.outlineConfigList.length === 0
|
|
203
|
+
) {
|
|
204
|
+
mergedConfig.outlineConfigList = JSON.parse(
|
|
205
|
+
JSON.stringify(defaultStyleConfig.outlineConfigList || []),
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
if (
|
|
209
|
+
!Array.isArray(mergedConfig.symbolConfigList) ||
|
|
210
|
+
mergedConfig.symbolConfigList.length === 0
|
|
211
|
+
) {
|
|
212
|
+
mergedConfig.symbolConfigList = JSON.parse(
|
|
213
|
+
JSON.stringify(defaultStyleConfig.symbolConfigList || []),
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
if (
|
|
217
|
+
!Array.isArray(mergedConfig.circleConfigList) ||
|
|
218
|
+
mergedConfig.circleConfigList.length === 0
|
|
219
|
+
) {
|
|
220
|
+
mergedConfig.circleConfigList = JSON.parse(
|
|
221
|
+
JSON.stringify(defaultStyleConfig.circleConfigList || []),
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
if (
|
|
225
|
+
!mergedConfig.fillOpacityConfig ||
|
|
226
|
+
typeof mergedConfig.fillOpacityConfig.value !== "number"
|
|
227
|
+
) {
|
|
228
|
+
mergedConfig.fillOpacityConfig = JSON.parse(
|
|
229
|
+
JSON.stringify(defaultStyleConfig.fillOpacityConfig || { value: 1 }),
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return mergedConfig as MapStyleConfig;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return defaultStyleConfig;
|
|
162
237
|
} catch (e) {
|
|
163
238
|
return defaultStyleConfig;
|
|
164
239
|
}
|
|
165
240
|
}
|
|
166
241
|
|
|
242
|
+
const getPointStyleList = (styleConfig: MapStyleConfig): CircleConfig[] => {
|
|
243
|
+
const symbolConfigList = (styleConfig as any).symbolConfigList as
|
|
244
|
+
| CircleConfig[]
|
|
245
|
+
| undefined;
|
|
246
|
+
const circleConfigList = styleConfig.circleConfigList;
|
|
247
|
+
|
|
248
|
+
if (Array.isArray(symbolConfigList) && symbolConfigList.length > 0) {
|
|
249
|
+
return JSON.parse(JSON.stringify(symbolConfigList));
|
|
250
|
+
}
|
|
251
|
+
if (Array.isArray(circleConfigList) && circleConfigList.length > 0) {
|
|
252
|
+
return JSON.parse(JSON.stringify(circleConfigList));
|
|
253
|
+
}
|
|
254
|
+
return JSON.parse(JSON.stringify(defaultStyleConfig.circleConfigList || []));
|
|
255
|
+
};
|
|
256
|
+
|
|
167
257
|
/**
|
|
168
258
|
* 获取图层类型
|
|
169
259
|
* @param layer 地理数据图层实体
|
|
@@ -175,9 +265,13 @@ export function getLayerType(layer: GeographicLayerEntity): MapBoxLayerType {
|
|
|
175
265
|
let result: MapBoxLayerType = "fill";
|
|
176
266
|
switch (layer.layerType) {
|
|
177
267
|
case "shp":
|
|
268
|
+
case "kml":
|
|
269
|
+
case "kmz":
|
|
178
270
|
// 根据 layerShapes 判断几何类型
|
|
179
271
|
if (layer.layerShapes) {
|
|
180
|
-
const shapes = layer.layerShapes
|
|
272
|
+
const shapes = layer.layerShapes
|
|
273
|
+
.split(",")
|
|
274
|
+
.map((s) => s.trim().toLowerCase());
|
|
181
275
|
// 优先返回 polygon,其次是 line,最后是 point
|
|
182
276
|
// 但当只有单一类型时返回对应类型
|
|
183
277
|
if (shapes.length === 1) {
|
|
@@ -204,8 +298,9 @@ export function getLayerType(layer: GeographicLayerEntity): MapBoxLayerType {
|
|
|
204
298
|
result = "circle";
|
|
205
299
|
if (layer.layerPaintConfig) {
|
|
206
300
|
const config = JSON.parse(layer.layerPaintConfig);
|
|
207
|
-
|
|
208
|
-
|
|
301
|
+
const pointStyleList = config.symbolConfigList || config.circleConfigList;
|
|
302
|
+
if (pointStyleList && pointStyleList?.length > 0) {
|
|
303
|
+
if (pointStyleList[0].circleType == "symbol") {
|
|
209
304
|
result = "symbol";
|
|
210
305
|
}
|
|
211
306
|
}
|
|
@@ -217,21 +312,6 @@ export function getLayerType(layer: GeographicLayerEntity): MapBoxLayerType {
|
|
|
217
312
|
return result;
|
|
218
313
|
}
|
|
219
314
|
|
|
220
|
-
/**
|
|
221
|
-
* 过滤填充颜色列表
|
|
222
|
-
* @param list 填充颜色列表
|
|
223
|
-
* @returns 过滤后的填充颜色列表,只保留key为字符串且value有值的项
|
|
224
|
-
* @description 用于清理无效的填充颜色配置项
|
|
225
|
-
*/
|
|
226
|
-
function filterFillColorList(list: FillColor[]) {
|
|
227
|
-
if (list) {
|
|
228
|
-
return list.filter((ele) => {
|
|
229
|
-
return typeof ele.key == "string" && ele.value;
|
|
230
|
-
});
|
|
231
|
-
} else {
|
|
232
|
-
return [];
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
315
|
/**
|
|
236
316
|
* 获取填充样式
|
|
237
317
|
* @param styleConfig 地图样式配置
|
|
@@ -240,33 +320,48 @@ function filterFillColorList(list: FillColor[]) {
|
|
|
240
320
|
*/
|
|
241
321
|
export function getFillStyle(styleConfig: MapStyleConfig) {
|
|
242
322
|
try {
|
|
243
|
-
// 深拷贝并过滤填充颜色列表
|
|
244
|
-
let fillColorList = [
|
|
245
|
-
...filterFillColorList(
|
|
246
|
-
JSON.parse(JSON.stringify(styleConfig.fillColorList)),
|
|
247
|
-
),
|
|
248
|
-
];
|
|
249
323
|
let fillStyle: Record<string, any> = {};
|
|
250
|
-
|
|
324
|
+
|
|
325
|
+
// 先重新排序,确保默认配置在最后
|
|
326
|
+
let sortedFillColorList = JSON.parse(
|
|
251
327
|
JSON.stringify(styleConfig.fillColorList),
|
|
252
328
|
);
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
329
|
+
const defaultConfig = sortedFillColorList.find(
|
|
330
|
+
(c: FillColor) => c.type === "default",
|
|
331
|
+
);
|
|
332
|
+
const customConfigs = sortedFillColorList.filter(
|
|
333
|
+
(c: FillColor) => c.type === "custom",
|
|
334
|
+
);
|
|
335
|
+
if (defaultConfig) {
|
|
336
|
+
sortedFillColorList = [...customConfigs, defaultConfig];
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
console.log("[getFillStyle] 排序后的 fillColorList:", sortedFillColorList);
|
|
340
|
+
|
|
341
|
+
// 过滤掉无效的自定义配置(必须有 key 和 value)
|
|
342
|
+
let fillColorList = sortedFillColorList.filter((c: FillColor) => {
|
|
343
|
+
if (c.type === "custom") {
|
|
344
|
+
return c.key && c.value;
|
|
345
|
+
}
|
|
346
|
+
return true; // 保留默认配置
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
// 获取默认颜色配置(现在一定在最后一项)
|
|
350
|
+
const defaultColorConfig = fillColorList[fillColorList.length - 1];
|
|
351
|
+
|
|
352
|
+
if (!defaultColorConfig || defaultColorConfig.type !== "default") {
|
|
353
|
+
console.warn("[getFillStyle] 未找到默认配置,使用系统默认颜色");
|
|
354
|
+
fillStyle["fill-color"] = "rgba(103, 194, 58, 0.6)";
|
|
355
|
+
fillStyle["fill-outline-color"] = "rgba(103, 194, 58, 1)";
|
|
356
|
+
return fillStyle;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
console.log("[getFillStyle] 默认颜色配置:", defaultColorConfig);
|
|
360
|
+
|
|
260
361
|
// 用于分组处理相同key的颜色配置
|
|
261
362
|
let fillColorGroupList: { list: FillColor[]; key: string }[] = [];
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
styleConfig.fillOpacityConfig &&
|
|
265
|
-
styleConfig.fillOpacityConfig.value != null
|
|
266
|
-
) {
|
|
267
|
-
fillStyle["fill-opacity"] = styleConfig.fillOpacityConfig.value;
|
|
268
|
-
}
|
|
269
|
-
fillColorList.forEach((colorConfig) => {
|
|
363
|
+
|
|
364
|
+
fillColorList.forEach((colorConfig: FillColor) => {
|
|
270
365
|
if (colorConfig.type == "custom") {
|
|
271
366
|
let findColorConfigGroupIndex = -1;
|
|
272
367
|
fillColorGroupList.forEach((configGroup, configGroupIndex) => {
|
|
@@ -284,24 +379,46 @@ export function getFillStyle(styleConfig: MapStyleConfig) {
|
|
|
284
379
|
}
|
|
285
380
|
}
|
|
286
381
|
});
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
382
|
+
|
|
383
|
+
console.log("[getFillStyle] fillColorGroupList:", fillColorGroupList);
|
|
384
|
+
|
|
385
|
+
// 构建填充颜色样式(支持条件渲染)
|
|
386
|
+
if (fillColorGroupList.length > 0) {
|
|
387
|
+
// 有条件配置,使用 match 表达式
|
|
388
|
+
let colorExpression: any = defaultColorConfig.color;
|
|
389
|
+
|
|
390
|
+
// 为每个分组构造嵌套 match,并统一按字符串比较,
|
|
391
|
+
// 避免表单值和 GeoJSON 属性值类型不一致时匹配失败。
|
|
392
|
+
[...fillColorGroupList].reverse().forEach((colorConfigGroup) => {
|
|
393
|
+
const groupExpression: any[] = [
|
|
394
|
+
"match",
|
|
395
|
+
["to-string", ["get", colorConfigGroup.key]],
|
|
396
|
+
];
|
|
397
|
+
|
|
290
398
|
colorConfigGroup.list.forEach((colorConfig) => {
|
|
291
|
-
|
|
292
|
-
|
|
399
|
+
groupExpression.push(String(colorConfig.value));
|
|
400
|
+
groupExpression.push(colorConfig.color);
|
|
293
401
|
});
|
|
294
|
-
|
|
295
|
-
|
|
402
|
+
|
|
403
|
+
groupExpression.push(colorExpression);
|
|
404
|
+
colorExpression = groupExpression;
|
|
296
405
|
});
|
|
406
|
+
|
|
407
|
+
fillStyle["fill-color"] = colorExpression;
|
|
408
|
+
console.log("[getFillStyle] 使用条件渲染,colorExpression:", colorExpression);
|
|
409
|
+
} else {
|
|
410
|
+
// 没有条件配置,使用单一颜色
|
|
411
|
+
fillStyle["fill-color"] = defaultColorConfig.color;
|
|
412
|
+
console.log("[getFillStyle] 使用单一颜色:", defaultColorConfig.color);
|
|
297
413
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
414
|
+
|
|
415
|
+
fillStyle["fill-outline-color"] = defaultColorConfig.color;
|
|
416
|
+
fillStyle["fill-opacity"] = styleConfig?.fillOpacityConfig?.value ?? 1;
|
|
417
|
+
|
|
418
|
+
console.log("[getFillStyle] 生成 fillStyle 成功:", fillStyle);
|
|
302
419
|
return fillStyle;
|
|
303
420
|
} catch (e) {
|
|
304
|
-
console.log("生成fillStyle
|
|
421
|
+
console.log("[getFillStyle] 生成 fillStyle 失败:", e);
|
|
305
422
|
}
|
|
306
423
|
}
|
|
307
424
|
|
|
@@ -349,30 +466,48 @@ export function getOutLineStyle(styleConfig: MapStyleConfig) {
|
|
|
349
466
|
try {
|
|
350
467
|
let { outlineConfigList } = styleConfig;
|
|
351
468
|
if (!outlineConfigList || outlineConfigList.length === 0) {
|
|
352
|
-
console.warn("outlineConfigList
|
|
353
|
-
return {
|
|
469
|
+
console.warn("[getOutLineStyle] outlineConfigList 为空,使用默认样式");
|
|
470
|
+
return {
|
|
471
|
+
"line-color": "rgba(103, 194, 58, 1)",
|
|
472
|
+
"line-width": 2,
|
|
473
|
+
"line-dasharray": ["literal", []],
|
|
474
|
+
};
|
|
354
475
|
}
|
|
355
476
|
|
|
356
|
-
//
|
|
357
|
-
|
|
358
|
-
|
|
477
|
+
// 先重新排序,确保默认配置在最后
|
|
478
|
+
// 这样在处理 match 表达式时,default 配置会作为兜底值
|
|
479
|
+
let sortedOutlineConfigList = JSON.parse(JSON.stringify(outlineConfigList));
|
|
480
|
+
const defaultConfig = sortedOutlineConfigList.find(
|
|
481
|
+
(c: OutlineConfig) => c.type === "default",
|
|
482
|
+
);
|
|
483
|
+
const customConfigs = sortedOutlineConfigList.filter(
|
|
484
|
+
(c: OutlineConfig) => c.type === "custom",
|
|
359
485
|
);
|
|
486
|
+
if (defaultConfig) {
|
|
487
|
+
sortedOutlineConfigList = [...customConfigs, defaultConfig];
|
|
488
|
+
}
|
|
360
489
|
|
|
361
|
-
//
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
(config: OutlineConfig) => config.type === "default",
|
|
365
|
-
) || originOutlineConfigList[originOutlineConfigList.length - 1];
|
|
490
|
+
// 找到默认配置(现在一定在最后一项)
|
|
491
|
+
const defaultOutlineConfig =
|
|
492
|
+
sortedOutlineConfigList[sortedOutlineConfigList.length - 1];
|
|
366
493
|
|
|
367
|
-
|
|
494
|
+
if (!defaultOutlineConfig || defaultOutlineConfig.type !== "default") {
|
|
495
|
+
console.warn("[getOutLineStyle] 未找到默认配置,使用系统默认值");
|
|
496
|
+
return {
|
|
497
|
+
"line-color": "rgba(103, 194, 58, 1)",
|
|
498
|
+
"line-width": 1,
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// 初始化样式对象(使用 default 配置)
|
|
368
503
|
let outlineStyle: Record<string, any> = {
|
|
369
|
-
"line-color":
|
|
370
|
-
|
|
371
|
-
"line-width":
|
|
504
|
+
"line-color":
|
|
505
|
+
defaultOutlineConfig.outlineColor || "rgba(103, 194, 58, 1)",
|
|
506
|
+
"line-width": defaultOutlineConfig.outlineWidth ?? 1,
|
|
372
507
|
};
|
|
373
508
|
|
|
374
509
|
// 设置线型(虚线/实线)
|
|
375
|
-
if (
|
|
510
|
+
if (defaultOutlineConfig.lineStyle === "dash") {
|
|
376
511
|
outlineStyle["line-dasharray"] = [2, 2];
|
|
377
512
|
} else {
|
|
378
513
|
outlineStyle["line-dasharray"] = ["literal", []];
|
|
@@ -382,8 +517,8 @@ export function getOutLineStyle(styleConfig: MapStyleConfig) {
|
|
|
382
517
|
let outlineGroupList: { list: OutlineConfig[]; key: string }[] = [];
|
|
383
518
|
|
|
384
519
|
// 分组处理自定义配置
|
|
385
|
-
|
|
386
|
-
if (config.type === "custom" && config.key) {
|
|
520
|
+
sortedOutlineConfigList.forEach((config: OutlineConfig) => {
|
|
521
|
+
if (config.type === "custom" && config.key && config.value) {
|
|
387
522
|
let findGroupIndex = -1;
|
|
388
523
|
outlineGroupList.forEach((group, groupIndex) => {
|
|
389
524
|
if (group.key === config.key) {
|
|
@@ -401,17 +536,14 @@ export function getOutLineStyle(styleConfig: MapStyleConfig) {
|
|
|
401
536
|
}
|
|
402
537
|
});
|
|
403
538
|
|
|
404
|
-
// 如果有自定义配置,使用 match
|
|
539
|
+
// 如果有自定义配置,使用 Mapbox match 表达式实现数据驱动的样式
|
|
540
|
+
// 例如:根据 name 字段的值显示不同颜色的线
|
|
405
541
|
if (outlineGroupList.length > 0) {
|
|
406
542
|
// 为每个属性构建 match 表达式
|
|
407
|
-
["line-color", "line-
|
|
543
|
+
["line-color", "line-width"].forEach((prop) => {
|
|
408
544
|
// 获取配置的属性名
|
|
409
545
|
const configKey =
|
|
410
|
-
prop === "line-color"
|
|
411
|
-
? "outlineColor"
|
|
412
|
-
: prop === "line-opacity"
|
|
413
|
-
? "outlineOpacity"
|
|
414
|
-
: "outlineWidth";
|
|
546
|
+
prop === "line-color" ? "outlineColor" : "outlineWidth";
|
|
415
547
|
|
|
416
548
|
// 检查是否有自定义配置需要处理
|
|
417
549
|
const hasCustomConfig = outlineGroupList.some((group) =>
|
|
@@ -419,7 +551,10 @@ export function getOutLineStyle(styleConfig: MapStyleConfig) {
|
|
|
419
551
|
);
|
|
420
552
|
|
|
421
553
|
if (hasCustomConfig) {
|
|
422
|
-
const expr: any[] = [
|
|
554
|
+
const expr: any[] = [
|
|
555
|
+
"match",
|
|
556
|
+
["to-string", ["get", outlineGroupList[0].key]],
|
|
557
|
+
];
|
|
423
558
|
|
|
424
559
|
// 为每个组添加条件
|
|
425
560
|
outlineGroupList.forEach((group) => {
|
|
@@ -428,13 +563,13 @@ export function getOutLineStyle(styleConfig: MapStyleConfig) {
|
|
|
428
563
|
config.value !== undefined &&
|
|
429
564
|
config[configKey] !== undefined
|
|
430
565
|
) {
|
|
431
|
-
expr.push(config.value);
|
|
566
|
+
expr.push(String(config.value));
|
|
432
567
|
expr.push(config[configKey]);
|
|
433
568
|
}
|
|
434
569
|
});
|
|
435
570
|
});
|
|
436
571
|
|
|
437
|
-
//
|
|
572
|
+
// 添加默认值(使用 default 配置)
|
|
438
573
|
expr.push(defaultConfig[configKey] ?? outlineStyle[prop]);
|
|
439
574
|
|
|
440
575
|
outlineStyle[prop] = expr;
|
|
@@ -446,11 +581,14 @@ export function getOutLineStyle(styleConfig: MapStyleConfig) {
|
|
|
446
581
|
group.list.some((c) => c.lineStyle !== undefined),
|
|
447
582
|
);
|
|
448
583
|
if (hasLineStyleConfig) {
|
|
449
|
-
const dashExpr: any[] = [
|
|
584
|
+
const dashExpr: any[] = [
|
|
585
|
+
"match",
|
|
586
|
+
["to-string", ["get", outlineGroupList[0].key]],
|
|
587
|
+
];
|
|
450
588
|
outlineGroupList.forEach((group) => {
|
|
451
589
|
group.list.forEach((config) => {
|
|
452
590
|
if (config.value !== undefined && config.lineStyle) {
|
|
453
|
-
dashExpr.push(config.value);
|
|
591
|
+
dashExpr.push(String(config.value));
|
|
454
592
|
dashExpr.push(
|
|
455
593
|
config.lineStyle === "dash" ? [2, 2] : ["literal", []],
|
|
456
594
|
);
|
|
@@ -464,11 +602,15 @@ export function getOutLineStyle(styleConfig: MapStyleConfig) {
|
|
|
464
602
|
}
|
|
465
603
|
}
|
|
466
604
|
|
|
467
|
-
console.log("outlineStyle--->", outlineStyle);
|
|
468
605
|
return outlineStyle;
|
|
469
606
|
} catch (e) {
|
|
470
607
|
console.log("生成outlineStyle失败", e);
|
|
471
|
-
|
|
608
|
+
// 返回默认样式而不是空对象,确保总是有有效的样式
|
|
609
|
+
return {
|
|
610
|
+
"line-color": "rgba(103, 194, 58, 1)",
|
|
611
|
+
"line-width": 2,
|
|
612
|
+
"line-dasharray": [],
|
|
613
|
+
};
|
|
472
614
|
}
|
|
473
615
|
}
|
|
474
616
|
|
|
@@ -480,21 +622,59 @@ export function getOutLineStyle(styleConfig: MapStyleConfig) {
|
|
|
480
622
|
*/
|
|
481
623
|
export function getCircleStyle(styleConfig: MapStyleConfig) {
|
|
482
624
|
// 获取圆点配置列表
|
|
483
|
-
let
|
|
625
|
+
let circleConfigList = getPointStyleList(styleConfig);
|
|
484
626
|
|
|
485
|
-
//
|
|
486
|
-
|
|
627
|
+
// 先重新排序,确保默认配置在最后
|
|
628
|
+
let sortedCircleConfigList = JSON.parse(JSON.stringify(circleConfigList));
|
|
629
|
+
const defaultConfigTemp = sortedCircleConfigList.find(
|
|
630
|
+
(c: CircleConfig) => c.type === "default",
|
|
631
|
+
);
|
|
632
|
+
const customConfigs = sortedCircleConfigList.filter(
|
|
633
|
+
(c: CircleConfig) => c.type === "custom",
|
|
634
|
+
);
|
|
635
|
+
if (defaultConfigTemp) {
|
|
636
|
+
sortedCircleConfigList = [...customConfigs, defaultConfigTemp];
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
console.log(
|
|
640
|
+
"[getCircleStyle] 排序后的 circleConfigList:",
|
|
641
|
+
sortedCircleConfigList,
|
|
642
|
+
);
|
|
643
|
+
|
|
644
|
+
// 检查默认配置是否使用了新格式(现在一定在最后一项)
|
|
645
|
+
const defaultCircleConfig =
|
|
646
|
+
sortedCircleConfigList[sortedCircleConfigList.length - 1];
|
|
487
647
|
const useNewFormat =
|
|
488
648
|
defaultCircleConfig &&
|
|
489
649
|
(defaultCircleConfig.renderMode === "color" ||
|
|
490
650
|
defaultCircleConfig.renderMode === "icon");
|
|
491
651
|
|
|
652
|
+
if (!defaultCircleConfig || defaultCircleConfig.type !== "default") {
|
|
653
|
+
console.warn("[getCircleStyle] 未找到默认配置,使用系统默认值");
|
|
654
|
+
return {
|
|
655
|
+
_useNewFormat: true,
|
|
656
|
+
_circleConfigList: [
|
|
657
|
+
{
|
|
658
|
+
type: "default",
|
|
659
|
+
renderMode: "color",
|
|
660
|
+
pointStyle: "118",
|
|
661
|
+
pointTintColor: "rgba(103, 194, 58, 0.6)",
|
|
662
|
+
pointSize: 2,
|
|
663
|
+
},
|
|
664
|
+
],
|
|
665
|
+
"icon-image": "custom-icon-default-118-1031945806",
|
|
666
|
+
"icon-size": 1,
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
console.log("[getCircleStyle] 默认配置:", defaultCircleConfig);
|
|
671
|
+
|
|
492
672
|
// 如果使用新格式,生成新格式的样式配置
|
|
493
673
|
if (useNewFormat) {
|
|
494
|
-
// 新格式:使用 renderMode, pointStyle, pointTintColor, pointSize,
|
|
674
|
+
// 新格式:使用 renderMode, pointStyle, pointTintColor, pointSize, pointStyle
|
|
495
675
|
const result: any = {
|
|
496
676
|
_useNewFormat: true, // 标记使用了新格式
|
|
497
|
-
_circleConfigList:
|
|
677
|
+
_circleConfigList: sortedCircleConfigList, // 保存完整配置列表供后续使用
|
|
498
678
|
};
|
|
499
679
|
|
|
500
680
|
// 默认使用 symbol 图层,通过 icon-image 来显示
|
|
@@ -506,18 +686,18 @@ export function getCircleStyle(styleConfig: MapStyleConfig) {
|
|
|
506
686
|
result["icon-size"] = [];
|
|
507
687
|
|
|
508
688
|
// 处理自定义配置(过滤掉 value 为空的配置)
|
|
509
|
-
const
|
|
510
|
-
(config) =>
|
|
689
|
+
const customConfigsFiltered = sortedCircleConfigList.filter(
|
|
690
|
+
(config: CircleConfig) =>
|
|
511
691
|
config.type === "custom" && config.value !== "" && config.value != null,
|
|
512
692
|
);
|
|
513
693
|
|
|
514
|
-
if (
|
|
694
|
+
if (customConfigsFiltered.length > 0) {
|
|
515
695
|
// 假设所有自定义配置使用同一个字段(这是当前的设计)
|
|
516
|
-
const fieldKey =
|
|
696
|
+
const fieldKey = customConfigsFiltered[0].key;
|
|
517
697
|
|
|
518
698
|
// 找到第一个有效的 value 类型(优先使用数字类型)
|
|
519
699
|
let firstValueType = "string";
|
|
520
|
-
for (const config of
|
|
700
|
+
for (const config of customConfigsFiltered) {
|
|
521
701
|
if (typeof config.value === "number") {
|
|
522
702
|
firstValueType = "number";
|
|
523
703
|
break;
|
|
@@ -534,18 +714,18 @@ export function getCircleStyle(styleConfig: MapStyleConfig) {
|
|
|
534
714
|
|
|
535
715
|
// 构建 icon-image 的 match 表达式: ["match", ["get", "FID_"], 1, "icon1", 2, "icon2", "default"]
|
|
536
716
|
const iconImageMatch: any[] = ["match", ["get", fieldKey]];
|
|
537
|
-
|
|
717
|
+
customConfigsFiltered.forEach((config: CircleConfig) => {
|
|
538
718
|
let iconName: string;
|
|
539
719
|
if (config.renderMode === "color") {
|
|
540
720
|
// 纯色点:生成带颜色的 SVG 图标名称(实际加载在 MapView 中)
|
|
541
|
-
const colorSuffix = (config.pointTintColor || "
|
|
721
|
+
const colorSuffix = (config.pointTintColor || "rgba(103, 194, 58, 1)").replace(
|
|
542
722
|
/[^a-zA-Z0-9]/g,
|
|
543
723
|
"",
|
|
544
724
|
);
|
|
545
|
-
iconName = `custom-icon-${config.key}-${
|
|
725
|
+
iconName = `custom-icon-${config.key}-${config.pointStyle || ""}-${colorSuffix}`;
|
|
546
726
|
} else {
|
|
547
727
|
// 图标模式:使用预置图标
|
|
548
|
-
iconName = config.
|
|
728
|
+
iconName = config.pointStyle || "";
|
|
549
729
|
}
|
|
550
730
|
iconImageMatch.push(normalizeValue(config.value));
|
|
551
731
|
iconImageMatch.push(iconName);
|
|
@@ -557,17 +737,17 @@ export function getCircleStyle(styleConfig: MapStyleConfig) {
|
|
|
557
737
|
const colorSuffix = (
|
|
558
738
|
defaultCircleConfig.pointTintColor || "#67c23a"
|
|
559
739
|
).replace(/[^a-zA-Z0-9]/g, "");
|
|
560
|
-
defaultIconName = `custom-icon-default-${
|
|
740
|
+
defaultIconName = `custom-icon-default-${defaultCircleConfig.pointStyle || ""}-${colorSuffix}`;
|
|
561
741
|
} else {
|
|
562
742
|
defaultIconName =
|
|
563
|
-
defaultCircleConfig.
|
|
743
|
+
defaultCircleConfig.pointStyle || "";
|
|
564
744
|
}
|
|
565
745
|
iconImageMatch.push(defaultIconName);
|
|
566
746
|
result["icon-image"] = iconImageMatch;
|
|
567
747
|
|
|
568
748
|
// 构建 icon-size 的 match 表达式
|
|
569
749
|
const iconSizeMatch: any[] = ["match", ["get", fieldKey]];
|
|
570
|
-
|
|
750
|
+
customConfigsFiltered.forEach((config: CircleConfig) => {
|
|
571
751
|
// 统一 value 的类型
|
|
572
752
|
iconSizeMatch.push(normalizeValue(config.value));
|
|
573
753
|
iconSizeMatch.push((config.pointSize || 10) / 20);
|
|
@@ -581,10 +761,10 @@ export function getCircleStyle(styleConfig: MapStyleConfig) {
|
|
|
581
761
|
const colorSuffix = (
|
|
582
762
|
defaultCircleConfig.pointTintColor || "#67c23a"
|
|
583
763
|
).replace(/[^a-zA-Z0-9]/g, "");
|
|
584
|
-
defaultIconName = `custom-icon-default-${
|
|
764
|
+
defaultIconName = `custom-icon-default-${defaultCircleConfig.pointStyle || ""}-${colorSuffix}`;
|
|
585
765
|
} else {
|
|
586
766
|
defaultIconName =
|
|
587
|
-
defaultCircleConfig.
|
|
767
|
+
defaultCircleConfig.pointStyle || "";
|
|
588
768
|
}
|
|
589
769
|
result["icon-image"] = defaultIconName;
|
|
590
770
|
result["icon-size"] = (defaultCircleConfig.pointSize || 10) / 20;
|
|
@@ -594,22 +774,18 @@ export function getCircleStyle(styleConfig: MapStyleConfig) {
|
|
|
594
774
|
}
|
|
595
775
|
|
|
596
776
|
// 旧格式:继续使用原有逻辑
|
|
597
|
-
//
|
|
777
|
+
// 初始化圆点样式对象,包含半径、描边宽度、颜色、描边颜色等属性
|
|
598
778
|
const circleStyle: {
|
|
599
779
|
"circle-radius": any[]; // 圆点半径
|
|
600
780
|
"circle-stroke-width": any[]; // 圆点描边宽度
|
|
601
|
-
"circle-color": any[]; //
|
|
602
|
-
"circle-stroke-color": any[]; //
|
|
603
|
-
"circle-opacity": any[]; // 圆点透明度
|
|
604
|
-
"circle-stroke-opacity": any[]; // 圆点描边透明度
|
|
781
|
+
"circle-color": any[]; // 圆点填充颜色(rgba格式,包含透明度)
|
|
782
|
+
"circle-stroke-color": any[]; // 圆点描边颜色(rgba格式,包含透明度)
|
|
605
783
|
"icon-image": any[]; // 图标图片
|
|
606
784
|
} = {
|
|
607
785
|
"circle-radius": [],
|
|
608
786
|
"circle-stroke-width": [],
|
|
609
787
|
"circle-color": [],
|
|
610
788
|
"circle-stroke-color": [],
|
|
611
|
-
"circle-opacity": [],
|
|
612
|
-
"circle-stroke-opacity": [],
|
|
613
789
|
"icon-image": [],
|
|
614
790
|
};
|
|
615
791
|
|
|
@@ -622,10 +798,8 @@ export function getCircleStyle(styleConfig: MapStyleConfig) {
|
|
|
622
798
|
circleStyle["circle-stroke-width"] = [defaultConfig.circleStrokeWidth!];
|
|
623
799
|
circleStyle["circle-color"] = [defaultConfig.circleColor!];
|
|
624
800
|
circleStyle["circle-stroke-color"] = [defaultConfig.circleStrokeColor!];
|
|
625
|
-
circleStyle["circle-opacity"] = [defaultConfig.circleOpacity];
|
|
626
|
-
circleStyle["circle-stroke-opacity"] = [defaultConfig.circleStrokeOpacity!];
|
|
627
801
|
circleStyle["icon-image"] = [
|
|
628
|
-
defaultConfig.iconImageUrl || "
|
|
802
|
+
defaultConfig.iconImageUrl || "",
|
|
629
803
|
]; // 图标图片
|
|
630
804
|
let circleConfigGroupList: { list: CircleConfig[]; key: string }[] = [];
|
|
631
805
|
circleConfigList.forEach((circleConfig) => {
|
|
@@ -687,31 +861,12 @@ export function getCircleStyle(styleConfig: MapStyleConfig) {
|
|
|
687
861
|
circleConfigGroup.key,
|
|
688
862
|
]);
|
|
689
863
|
circleStyle["circle-stroke-color"].unshift("match");
|
|
690
|
-
//
|
|
691
|
-
circleConfigGroup.list.forEach((circleConfig) => {
|
|
692
|
-
circleStyle["circle-opacity"].unshift(circleConfig.circleOpacity);
|
|
693
|
-
circleStyle["circle-opacity"].unshift(circleConfig.value);
|
|
694
|
-
});
|
|
695
|
-
circleStyle["circle-opacity"].unshift(["get", circleConfigGroup.key]);
|
|
696
|
-
circleStyle["circle-opacity"].unshift("match");
|
|
697
|
-
//
|
|
698
|
-
circleConfigGroup.list.forEach((circleConfig) => {
|
|
699
|
-
circleStyle["circle-stroke-opacity"].unshift(
|
|
700
|
-
circleConfig.circleStrokeOpacity,
|
|
701
|
-
);
|
|
702
|
-
circleStyle["circle-stroke-opacity"].unshift(circleConfig.value);
|
|
703
|
-
});
|
|
704
|
-
circleStyle["circle-stroke-opacity"].unshift([
|
|
705
|
-
"get",
|
|
706
|
-
circleConfigGroup.key,
|
|
707
|
-
]);
|
|
708
|
-
circleStyle["circle-stroke-opacity"].unshift("match");
|
|
709
864
|
}
|
|
710
865
|
// 如果是图标类型的圆点样式,设置图标图片
|
|
711
866
|
if (defaultConfig.circleType == "symbol") {
|
|
712
867
|
circleConfigGroup.list.forEach((circleConfig) => {
|
|
713
868
|
circleStyle["icon-image"].unshift(
|
|
714
|
-
circleConfig.iconImageUrl || "
|
|
869
|
+
circleConfig.iconImageUrl || "",
|
|
715
870
|
);
|
|
716
871
|
circleStyle["icon-image"].unshift(circleConfig.value);
|
|
717
872
|
});
|
|
@@ -724,9 +879,6 @@ export function getCircleStyle(styleConfig: MapStyleConfig) {
|
|
|
724
879
|
circleStyle["circle-stroke-width"] = circleStyle["circle-stroke-width"][0];
|
|
725
880
|
circleStyle["circle-color"] = circleStyle["circle-color"][0];
|
|
726
881
|
circleStyle["circle-stroke-color"] = circleStyle["circle-stroke-color"][0];
|
|
727
|
-
circleStyle["circle-opacity"] = circleStyle["circle-opacity"][0];
|
|
728
|
-
circleStyle["circle-stroke-opacity"] =
|
|
729
|
-
circleStyle["circle-stroke-opacity"][0];
|
|
730
882
|
circleStyle["icon-image"] = circleStyle["icon-image"][0];
|
|
731
883
|
}
|
|
732
884
|
return circleStyle;
|
|
@@ -739,7 +891,7 @@ export function getCircleStyle(styleConfig: MapStyleConfig) {
|
|
|
739
891
|
*/
|
|
740
892
|
export function getSymbolStyle(styleConfig: MapStyleConfig) {
|
|
741
893
|
// 获取圆点配置列表
|
|
742
|
-
let
|
|
894
|
+
let circleConfigList = getPointStyleList(styleConfig);
|
|
743
895
|
// 初始化圆点样式对象,包含半径、描边宽度、颜色、描边颜色、透明度等属性
|
|
744
896
|
const circleStyle: {
|
|
745
897
|
"icon-image": any[]; // 图标图片
|
|
@@ -747,9 +899,9 @@ export function getSymbolStyle(styleConfig: MapStyleConfig) {
|
|
|
747
899
|
"icon-image": [],
|
|
748
900
|
};
|
|
749
901
|
const defaultCircleConfig = circleConfigList[circleConfigList.length - 1];
|
|
750
|
-
circleConfigList.
|
|
902
|
+
circleConfigList = circleConfigList.slice(0, -1);
|
|
751
903
|
circleStyle["icon-image"] = [
|
|
752
|
-
defaultCircleConfig.iconImageUrl || "
|
|
904
|
+
defaultCircleConfig.iconImageUrl || "",
|
|
753
905
|
]; // 图标图片
|
|
754
906
|
let circleConfigGroupList: { list: CircleConfig[]; key: string }[] = [];
|
|
755
907
|
circleConfigList.forEach((circleConfig) => {
|
|
@@ -777,7 +929,7 @@ export function getSymbolStyle(styleConfig: MapStyleConfig) {
|
|
|
777
929
|
if (defaultCircleConfig.circleType == "symbol") {
|
|
778
930
|
circleConfigGroup.list.forEach((circleConfig) => {
|
|
779
931
|
circleStyle["icon-image"].unshift(
|
|
780
|
-
circleConfig.iconImageUrl || "
|
|
932
|
+
circleConfig.iconImageUrl || "",
|
|
781
933
|
);
|
|
782
934
|
circleStyle["icon-image"].unshift(circleConfig.value);
|
|
783
935
|
});
|
|
@@ -811,8 +963,8 @@ export function getLayerStyle(layer: GeographicLayerEntity) {
|
|
|
811
963
|
|
|
812
964
|
// 默认线样式配置,用于线状要素
|
|
813
965
|
const defaultLineStyle = {
|
|
814
|
-
"line-width":
|
|
815
|
-
"line-color": "rgba(103, 194, 58,
|
|
966
|
+
"line-width": 2, // 默认线宽为2像素(与 LayerStyleEditDialog 保持一致)
|
|
967
|
+
"line-color": "rgba(103, 194, 58, 1)", // 默认线颜色为绿色,不透明
|
|
816
968
|
};
|
|
817
969
|
|
|
818
970
|
// 默认圆点样式配置,用于点状要素
|
|
@@ -883,7 +1035,7 @@ export function getLayerStyle(layer: GeographicLayerEntity) {
|
|
|
883
1035
|
return symbolStyle;
|
|
884
1036
|
}
|
|
885
1037
|
return {
|
|
886
|
-
"icon-image": "
|
|
1038
|
+
"icon-image": "",
|
|
887
1039
|
};
|
|
888
1040
|
default:
|
|
889
1041
|
break;
|
|
@@ -1011,3 +1163,11 @@ export function hexToRgb(hex: string): [number, number, number] {
|
|
|
1011
1163
|
export function clamp(value: number, min: number, max: number) {
|
|
1012
1164
|
return Math.max(min, Math.min(max, value));
|
|
1013
1165
|
}
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* 通过 id 从资源列表中查找匹配项
|
|
1169
|
+
*/
|
|
1170
|
+
export function resolveAssetById(id: string, options: PointAssetOption[]): PointAssetOption | undefined {
|
|
1171
|
+
if (!id) return undefined;
|
|
1172
|
+
return options.find(item => item.id === id);
|
|
1173
|
+
}
|