wujingjing
2025-02-10 e50196bff10f0196307b2567ed6c0829eadd8ff6
src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/panelTool/ThemeControl.vue
@@ -1,6 +1,6 @@
<template>
   <div class="layer-control bg-white p-3 w-[280px]">
      <div class="bg-white rounded">
   <div class="layer-control bg-white flex-col" style="display: flex">
      <div class="bg-white rounded flex-0">
         <div class="header flex-items-center pb-1.5" style="border-bottom: 1px solid black">
            <div class="flex-items-center">
               <span class="ywifont ywicon-guanbi cursor-pointer mr-1.5" @click="closeClick"></span>
@@ -8,7 +8,7 @@
            </div>
         </div>
      </div>
      <div class="content rounded-lg max-h-[700px] overflow-y-auto min-h-[600px]">
      <div class="flex-auto content rounded-lg overflow-y-auto">
         <!-- <el-tree
            class="w-full"
            :data="themeInfo"
@@ -308,44 +308,51 @@
      switch (shape) {
         case 'Point':
            const pSize = themeStyle?.PSIZE ?? feature.get('psize');
            if (!pSize) return null;
            const pcolor = themeStyle?.PCOLOR ?? feature.get('pcolor');
            const pkey = `${pSize}_${pcolor}`;
            if (!styleMap.junction[pkey]) {
               styleMap.junction[pkey] = new Style({
                  image: new Circle({
                     radius: pSize,
                     fill: new Fill({ color: `#${pcolor}` }),
                     // fill: new Fill({ color: `blue` }),
                  }),
               });
            }
            const pStyle = themeStyle?.PSTYLE ?? feature.get('pstyle');
            // const textStyle = createTextStyle(feature, resolution);
            styles.push(styleMap.junction[pkey]);
            const pointStyle = props.olMap?.getPointStyles({
               size: pSize,
               color: pcolor,
               style: pStyle,
            });
            pointStyle && styles.push(pointStyle);
            break;
         case 'LineString':
            const lSize = themeStyle?.LSIZE ?? feature.get('lsize');
            if (!lSize) return null;
            const lColor = themeStyle?.LCOLOR ?? feature.get('lcolor');
            const lKey = `${lSize}_${lColor}`;
            if (!styleMap.pipe[lKey]) {
               styleMap.pipe[lKey] = new Style({
                  // image: new Circle({
                  //    radius: lsize,
                  //    fill: new Fill({ color: `#${color}` }),
                  // }),
                  stroke: new Stroke({
                     color: `#${lColor}`,
                     width: lSize,
                  }),
               });
            }
            styles.push(styleMap.pipe[lKey]);
            const lStyle = themeStyle?.LSTYLE ?? feature.get('lstyle');
            const pSize1 = themeStyle?.PSIZE ?? feature.get('psize');
            const pcolor1 = themeStyle?.PCOLOR ?? feature.get('pcolor');
            const pStyle1 = themeStyle?.PSTYLE ?? feature.get('pstyle');
            const lineStyle = props.olMap?.getLineStyles({
               lsize: lSize,
               lcolor: lColor,
               lstyle: lStyle,
               psize: pSize1,
               pcolor: pcolor1,
               pstyle: pStyle1,
            });
            lineStyle && styles.push(...lineStyle);
            break;
         case 'Polygon':
            const pColor = feature.get('pcolor');
            const lSize1 = feature.get('lsize');
            const lColor1 = feature.get('lcolor');
            const lstyle1 = feature.get('lstyle');
            const polygonStyle = props.olMap?.getPolygonStyles({
               pcolor: pColor,
               lsize: lSize1,
               lcolor: lColor1,
               lstyle: lstyle1,
            });
            polygonStyle && styles.push(...polygonStyle);
            break;
         default:
            break;
@@ -361,19 +368,21 @@
      // }
      //#region ====================== 添加标注 ======================
      const tString = themeStyle?.TSTRING ?? feature.get('tstring');
      if (tString) {
         const textStyle = createTextStyle(feature, resolution);
         styles.push(textStyle);
      }
      const tStringStyle = props.olMap?.getLabelStyles({
         textContent: tString,
         resolution,
      });
      tStringStyle && styles.push(tStringStyle);
      //#endregion
      return styles;
   };
   const allLayers = props.olMap.layerInfo.value.reduce((preVal, curVal) => {
      return preVal.concat(curVal.children.map((item) => item.model));
   }, []);
   const allLayers = props.olMap.getAllLayers();
   for (const item of allLayers) {
      item.setStyle(themeLayerStyleFunc);
      if (props.olMap?.unsupportedLayers.includes(item.id)) {
         continue;
      }
      item.model.setStyle(themeLayerStyleFunc);
   }
   return res?.legends ?? [];
};
@@ -388,19 +397,16 @@
   const ids = allIds.join(',');
   if (!ids) {
      const allLayers = props.olMap.layerInfo.value.reduce((preVal, curVal) => {
         return preVal.concat(curVal.children.map((item) => item.model));
      }, []);
      const allLayers = props.olMap.getAllLayerModels();
      for (const item of allLayers) {
         const originStyle = item.get('originStyle');
         item.setStyle(originStyle);
         originStyle && item.setStyle(originStyle);
      }
      return;
   }
   const legends = await changeTheme(ids);
   legendList.value = parseLegends(legends);
};
watch(
   () => themeInfo.value,