yxl
2025-01-03 8ca7f7c74de140b79ea7dd821ca0236b11ce7551
src/assets/js/mapSetFunc.js
@@ -37,16 +37,19 @@
    this.setModelChangeColor(colors);
  },
  setModelChangeColor(res) {
    const modelLayer = mapServer.listData.filter((res) => {
      if (res.name == config.modelLayer) {
        return res;
    console.log('mapServer.listData',mapServer.listData,config.modelLayer);
    const modelLayer = mapServer.listData.filter((obj) => {
      if (obj.name == config.modelLayer) {
        return obj;
      }
    });
    if (modelLayer.length <= 0) return;
    earthCtrl.userScene.flyTo(modelLayer[0].layer);
    modelLayer[0].layer.style = new Cesium.Cesium3DTileStyle({
      color: {
        evaluateColor: (feature) => {
          const id = feature.getProperty("id");
          console.log("id**********", id);
          const color = res.filter((item) => {
            if (item.ids.indexOf(id) > -1) {
              return item;
@@ -153,37 +156,31 @@
  },
  creatPoiMap(res) {
    const poi = res.data;
    // const label = earthCtrl.factory.createLabel({
    //   lon: poi._x,
    //   lat: poi._y,
    //   text: this.getName(poi),
    //   alt: 150,
    //   image: SmartEarthRootUrl + "Workers/image/fighter.png",
    //   // 文本偏移量
    //   pixelOffset: new SmartEarth.Cesium.Cartesian2(0, -50),
    //   // 图片偏移量
    //   iPixelOffset: new SmartEarth.Cesium.Cartesian2(0, -20)
    // });
    const label = earthCtrl.factory.createLabel({
      name: "创建文本",
      id: earthCtrl.factory.createUUID(),
      text: this.getName(poi),
      font: "22pt monospace",
      outlineWidth: 2,
      fillColor: SmartEarth.Cesium.Color.YELLOW,
      lon: poi._x,
      lat: poi._y,
      alt: poi.height ? poi.height + 10 : 100,
      iDistanceDisplayCondition: (100, 3000)
    });
    setTimeout(() => {
      this.setEntityTitlesChangeColor(poi.seid);
    }, 200);
    earthCtrl.userScene.flyTo(label);
    this.layerList.push({
      layer: label,
      func: res.func
    res.data.forEach((poi,index) => {
      // const poi = res.data[0];
      console.log('poi------', poi)
      const label = earthCtrl.factory.createLabel({
        name: "创建文本",
        id: earthCtrl.factory.createUUID(),
        text: poi.name,//this.getName(poi),
        font: "22pt monospace",
        outlineWidth: 2,
        fillColor: SmartEarth.Cesium.Color.YELLOW,
        lon: poi.lontitude,
        lat: poi.lattitude,
        alt: poi.height ? poi.height + 10 : 100,
        iDistanceDisplayCondition: (100, 3000)
      });
      setTimeout(() => {
        this.setEntityTitlesChangeColor(poi.seid);
      }, 200);
      if (index == 0) {
        earthCtrl.userScene.flyTo(label);
      }
      this.layerList.push({
        layer: label,
        func: res.func
      });
    });
  },
  setEntityTitlesChangeColor(res) {
@@ -231,6 +228,20 @@
    return name;
  },
  creatAroundPoi(res) {
    let colors = [];
    res.data.forEach((element) => {
      colors.push({
        name: element.type,
        color: element.color,
        ids: element.list
      });
    })
    console.log('colors----',colors);
    store.state.setListColor = colors;
    store.state.showLenged = true;
    this.setModelChangeColor(colors);
  },
  creatAroundPoi1111(res) {
    const poi = res.data;
    var std = [];
    var feature = {