Newer
Older
KaiFengPC / src / views / sponeScreen / gisMF / cesiumMapLegend.js
@jimengfei jimengfei on 26 Jun 10 KB updata
import builtCity from '@/assets/geojson/kaifeng/builtCity.json';
import centerCity from '@/assets/geojson/kaifeng/centerCity.json';
import cityArea from '@/assets/geojson/kaifeng/cityArea.json';
import riverLake from '@/assets/geojson/kaifeng/riverLake.json';
import pipeFlow from '@/assets/geojson/kaifeng/pipeFlow.json';
import { oneMapFacilityPumpList } from '@/api/scada/pumpStationInformation';
import bus from '@/bus';
let YSBZ, WSBZ, HLBZ;
let legendDataList;
export default class cesiumMapCommonLegend {
  //获取站点数据
  static async getStationData() {
    //雨水泵站
    let resRainwater = await oneMapFacilityPumpList();
    if (resRainwater && resRainwater.code == 200) {
      let YSBZDataList = resRainwater.data.filter(data => data.pumpType == 'rain_water');
      let WSBZDataList = resRainwater.data.filter(data => data.pumpType == 'sewage_water');
      let HLBZDataList = resRainwater.data.filter(data => data.pumpType == 'confluence');
      YSBZ = this.getGeojsonData(YSBZDataList);
      WSBZ = this.getGeojsonData(WSBZDataList);
      HLBZ = this.getGeojsonData(HLBZDataList);
      //发送图例
      legendDataList = this.legendData();
      bus.emit('legendDataList', legendDataList);
    }
  }
  //构建geojson格式
  static getGeojsonData(dataList) {
    let features = [];
    let feature = {};
    dataList.forEach(data => {
      if (data.lonLat) {
        let lonlat = data.lonLat.split(',');
        feature = {
          type: 'Feature',
          geometry: {
            type: 'Point',
            coordinates: [Number(lonlat[0]), Number(lonlat[1])],
          },
          properties: data,
        };
      } else if (data.lon && data.lat) {
        feature = {
          type: 'Feature',
          geometry: {
            type: 'Point',
            coordinates: [Number(data.lon), Number(data.lat)],
          },
          properties: data,
        };
      } else if (data.originalX && data.originalY) {
        feature = {
          type: 'Feature',
          geometry: {
            type: 'Point',
            coordinates: [Number(data.originalX), Number(data.originalY)],
          },
          properties: data,
        };
      }
      features.push(feature);
    });
    return {
      type: 'FeatureCollection',
      features: features,
    };
  }
  static legendData() {
    return [
      {
        title: '基础图层',
        isCheck: false,
        children: [
          [
            {
              isCheck: false,
              name: '白色地图',
              url: 'whiteMap_icon.png',
              layername: 'whiteMap',
              type: 'background',
            },
            {
              isCheck: true,
              name: '深色地图',
              url: 'blackMap_icon.png',
              layername: 'blackMap',
              type: 'background',
            },
          ],
          [
            {
              isCheck: false,
              name: '影像图',
              url: 'imageMap_icon.png',
              layername: 'imageMap',
              type: 'background',
            },
            {
              isCheck: false,
              name: '三维建筑',
              url: 'building_icon.png',
              layername: 'buildingModel',
              type: '3dModel',
              data: [
                'https://server1.wh-nf.cn:9000/newfiber-standard-kaifeng/2024/06/24/kaifengBuilding/kaifengBuilding/kaifengBuilding.scp',
              ],
            },
          ],
          [
            {
              isCheck: false,
              name: '行政区划',
              url: 'cityArea_icon.png',
              layername: 'cityArea',
              type: 'polygon',
              data: cityArea,
            },
            {
              isCheck: false,
              name: '建成区',
              url: 'builtCity_icon.png',
              layername: 'builtCity',
              type: 'areaWall',
              data: builtCity,
            },
          ],
          [
            {
              isCheck: false,
              name: '中心城区',
              url: 'centerCity_icon.png',
              layername: 'centerCity',
              type: 'areaWall',
              data: centerCity,
            },
            {
              isCheck: false,
              name: '河湖水系',
              url: 'dynamicWater_icon.png',
              layername: 'dynamicWater',
              type: 'dynamicWater',
              data: riverLake,
            },
          ],
          [
            {
              isCheck: false,
              name: '排水分区一',
              url: 'paiShuiArea1_icon.png',
              layername: 'cesiumPaishuiArea1',
              type: 'cesiumPaishuiArea',
            },
            {
              isCheck: false,
              name: '地形地貌',
              url: 'topography_icon.png',
              layername: 'topography',
              type: 'pngImage',
            },
          ],
          [
            {
              isCheck: false,
              name: '排水分区二',
              url: 'paiShuiArea2_icon.png',
              layername: 'cesiumPaishuiArea2',
              type: 'cesiumPaishuiArea',
            },
            {
              isCheck: false,
              name: '供水厂',
              url: 'waterFactory_icon.png',
              layername: 'waterFactory',
              type: 'iconPoint',
            },
          ],
          [
            {
              isCheck: false,
              name: '排水分区三',
              url: 'paiShuiArea3_icon.png',
              layername: 'cesiumPaishuiArea3',
              type: 'cesiumPaishuiArea',
            },
          ],
        ],
      },
      {
        title: '雨水/污水系统',
        isCheck: false,
        children: [
          [
            {
              isCheck: false,
              name: '雨水管网',
              layername: 'rainLine',
              url: 'rainLine_icon.png', //图层+json √
              type: '3dModel',
              data: [
                'https://server1.wh-nf.cn:9000/newfiber-standard-kaifeng/2024/06/24/pipeData/ysline/ysline.scp',
                'https://server1.wh-nf.cn:9000/newfiber-standard-kaifeng/2024/06/24/pipeData/YS_Point/YS_Point.scp',
              ],
            },
            {
              isCheck: false,
              name: '雨水泵站',
              layername: 'YSBZ',
              url: 'rainBengZhan_icon.png', //图层+json √
              mapUrl: 'paiLaoBeng.png',
              type: 'point',
              data: YSBZ,
              //data: ysBengZhan,
            },
          ],
          [
            {
              isCheck: false,
              name: '污水管网',
              layername: 'sewageLine',
              url: 'sewageLine_icon.png', //服务  √
              type: '3dModel',
              data: [
                'https://server1.wh-nf.cn:9000/newfiber-standard-kaifeng/2024/06/24/pipeData/wsLine/wsLine.scp',
                'https://server1.wh-nf.cn:9000/newfiber-standard-kaifeng/2024/06/24/pipeData/WS_Point/WS_Point.scp',
              ],
            },
            {
              isCheck: false,
              name: '污水泵站', //图层+json   √
              layername: 'WSBZ',
              url: 'sewageBenZhan_icon.png',
              mapUrl: 'wsBeng.png',
              type: 'point',
              data: WSBZ,
              //data: wsBengZhan,
            },
          ],
          [
            {
              isCheck: false,
              name: '合流管网',
              layername: 'combineLine',
              url: 'combineLine_icon.png', //服务  √
              type: '3dModel',
              data: [
                'https://server1.wh-nf.cn:9000/newfiber-standard-kaifeng/2024/06/24/pipeData/hsLine/hsLine.scp',
                'https://server1.wh-nf.cn:9000/newfiber-standard-kaifeng/2024/06/24/pipeData/hs_Point/hs_Point.scp',
              ],
            },
            {
              isCheck: false,
              name: '合流泵站', //图层+json   √
              layername: 'combineBengZhan',
              url: 'combineBengZhan_icon.png',
              mapUrl: 'wsBeng.png',
              type: 'point',
              data: HLBZ,
              //data: wsBengZhan,
            },
          ],
          [
            {
              isCheck: false,
              name: '污水处理厂',
              layername: 'sewageFactory', //图层+json   √
              url: 'sewageFactory_icon.png',
              mapUrl: 'WSC.png',
              type: 'point',
              //data: WSCLC,
              //data: wuShuiChang,
            },
            {
              isCheck: false,
              name: '管网流向',
              layername: 'pipeLineFlow',
              url: 'pipeLineFlow_icon.png',
              type: 'dynamicLine',
              data: pipeFlow,
            },
          ],
        ],
      },
      {
        title: '感知监测',
        isCheck: false,
        children: [
          [
            {
              isCheck: false,
              name: '内涝积水点',
              layername: 'waterLoging', //图层+json  √
              url: 'waterLoging_icon.png',
              mapUrl: 'rain.png',
              type: 'point',
              //data: rainStation,
            },
            {
              isCheck: false,
              name: '河道断面',
              layername: 'waterCourse',
              url: 'waterCourse_icon.png', //图层+json  √
              mapUrl: 'KDJZWMX.png',
              type: 'point',
              //data: riverLake,
            },
          ],
          [
            {
              isCheck: false,
              name: '雨量站',
              layername: 'rainStation',
              url: 'rainStation_icon.png', //图层+json  √
              mapUrl: 'yuanTou.png',
              type: 'point',
              //data: waterSectionInfo,
            },
            {
              isCheck: false,
              name: '源头地块',
              layername: 'origine', //图层+json  √
              url: 'origine_icon.png',
              mapUrl: 'rainSupervise.png',
              type: 'point',
              //data: pipeSupervise,
            },
          ],
          [
            {
              isCheck: false,
              name: '海绵设施',
              layername: 'spongeFacility',
              url: 'spongeFacility_icon.png', //图层+json  √
              mapUrl: 'yiLao.png',
              type: 'point',
              //data: waterlog,
            },
          ],
        ],
      },
    ];
  }
}