【Mars3D项目实战开发】加载水系河流,加载植被,加载区划街道社区吊牌,点击加载对应社区倾斜摄影

news2025/1/11 3:05:19

Mars3D有很多很强大的功能,可以在地球上实现很多炫酷的3D效果。今天继续给大家分享功能,在地球上加载水系河流,加载geojson植被,加载区划街道社区吊牌,点击社区可加载对应社区的倾斜摄影。

1.话不多说,先展示

水系,植被,区划吊牌,社区倾斜摄影

2.设计思路

通过axios获取要加载水系的点位数据,加载本地geojson的植被数据,获取请求的区划数据,点击可视角移动,社区的话可加载对应社区的倾斜摄影。

3.具体代码

<script setup>
import * as Cesium from "mars3d-cesium";
import * as mars3d from "mars3d";
//引入cesium基础库
import "mars3d-cesium/Build/Cesium/Widgets/widgets.css";
//导入mars3d主库
import "mars3d/mars3d.css"; //v3.8.6及之前版本使用 import "mars3d/dist/mars3d.css";
import axios from "axios";

//导入mars3d插件(按需使用,需要先npm install)
import "mars3d-space";
import { ref, onMounted, reactive } from "vue";

var tileLayer = reactive({});//天地图影像图层
var tiles3dLayer1 = reactive({});//白膜图层
var tiles3dLayer2 = reactive({});//倾斜摄影图层
var graphicLayer = reactive({});//区域边界,街道边界,水系,tyLoad, 区划
var graphicLayer2 = reactive({});//植被图层
var map = reactive({});

var grid = reactive({});
var list = ref([]);
var sxlist = ref([]);
var roadlist = ref([]);
var qhlist = ref([]);


var mapOptions = {
  terrain: {
    //地形
    url: "http://data.mars3d.cn/terrain",
    show: true,
  },
  scene: {
    // center: { lat: 30.422407, lng: 115.820222, alt: 3498, heading: 67, pitch: -32 },
    showSun: false, //是否显示太阳
    showMoon: false, //是否显示月亮
    showSkyBox: true, //是否显示天空盒
    showSkyAtmosphere: false, //是否显示地球大气层外光圈
    contextmenu: false,
    fog: false, //是否启用雾化效果
    globe: {
      showGroundAtmosphere: false,
      enableLighting: false,
      depthTestAgainstTerrain: true, // 地形检测,不加无法投射到地形上
    },
    fxaa: true, // 不开启抗锯齿,可视域会闪烁
    skyBox: {
      type: "ground",
      sources: {
        positiveX: "../assets/imgs/skybox/lantian/Right.jpg",
        negativeX: "../assets/imgs/skybox/lantian/Left.png",
        positiveY: "../assets/imgs/skybox/lantian/Front.png",
        negativeY: "../assets/imgs/skybox/lantian/Back.png",
        positiveZ: "../assets/imgs/skybox/lantian/Up.png",
        negativeZ: "../assets/imgs/skybox/lantian/Down.png",
      },
    },
  },

  basemaps: [
    {
      name: "天地图电子底图",
      layer: "vec_d",
      type: "tdt",
      invertColor: false, // 反向颜色 color.r = 1.0 - color.r
      filterColor: "#0950a9", // 滤镜颜色  color.r = color.r * filterColor.r
      brightness: 2, // 亮度
      contrast: 0.6, // 对比度
      hue: 0.1, // 色彩
      saturation: 1, // 饱和度
      gamma: 0.2, // 伽马值
      opacity: 1, // 透明度
      minimumLevel: 0,
      maximumLevel: 18,
      key: ["自己申请的天地图key"],
      show: true,
    },
  ],
};

onMounted(async() => {
  map = new mars3d.Map("mars3dContainer", mapOptions);
  graphicLayer = new mars3d.layer.GraphicLayer({
    hasEdit: false,
    isAutoEditing: false,
    clustering: {
      enabled: false,
      pixelRange: 20,
      clampToGround: false,
      addHeight: 1000,
    },
  });
  map.addLayer(graphicLayer);
  
  getBm();
  getGridBJ();
  getJdLists();
  getWater();
  wblzb();
  getRolad();
  getGrid("");

  setEvent();

});

//加载白膜数据 并动画到指定位置
const getBm = () => {
  tiles3dLayer1 = new mars3d.layer.TilesetLayer({
    name: "白膜",
    url: "http://172.16.10.83:9509/map3d/wbl/BM4/tileset.json",
    position: {
      alt: 0,
    },
    maximumScreenSpaceError: 256,
    zIndex: 3,
    show: true,
  });
  map.addLayer(tiles3dLayer1);

  //飞到指定经纬度
  map.openFlyAnimation({
    center: {
      lat: 37.84331,
      lng: 112.543554,
      alt: 1587.8,
      heading: 296,
      pitch: -17.2,
    },
  });
};

//加载wbl区域边界
const getGridBJ = async () => {
  await axios.get("http://172.16.10.83:8085/grid/getWkt").then((res) => {
    if (res.data.code == "20000000") {
      grid = res.data.data.grid;
        let item = grid;
        if (item.wkt.indexOf(")),MULTILINESTRING ((") == -1) {
              let wkt = item.wkt
                .split("MULTIPOLYGON (((")[1]
                .split(")))")[0]
                .split(", ");
              let positions = [];
              wkt.forEach((item1) => {
                let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                positions.push(arr);
              });
              const graphic = new mars3d.graphic.PolylineEntity({
                id: item.id,
                name: item.name,
                positions: positions,
                style: {
                  width: 5,
                  color: "#867352",
                  clampToGround: true,
                },
                show: true,
              });
              graphicLayer.addGraphic(graphic);
              const graphic2 = new mars3d.graphic.PolylineEntity({
                positions: positions,
                style: {
                  width: 5,
                  clampToGround: true,
                  materialType: mars3d.MaterialType.LineFlicker,
                  materialOptions: {
                    color: "#867352",
                    speed: 10,
                  },
                },
                show: true,
              });
              graphicLayer.addGraphic(graphic2);
            }
    }
  });
};

//加载街道区域轮廓线
const getJdLists = async () => {
  await axios.get("http://172.16.10.83:8085/layer/jd").then((res) => {
    if (res.data.code == "20000000") {
      list.value = res.data.data.list;
      if (list.value.length > 0) {
        let listData = list.value;
        listData.forEach((item) => {
          if (item.wkt) {
            if (item.wkt.indexOf(")),MULTILINESTRING ((") == -1) {
              let wkt = item.wkt
                .split("MULTILINESTRING ((")[1]
                .split("))")[0]
                .split(", ");
              let positions = [];
              wkt.forEach((item1) => {
                let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                positions.push(arr);
              });
              const graphic2 = new mars3d.graphic.PolylineEntity({
                positions: positions,
                style: {
                  width: 5,
                  color: "rgba(255,255,0,.02)",
                  clampToGround: true,
                },
                show: true,
              });
              graphicLayer.addGraphic(graphic2);
              const graphic = new mars3d.graphic.PolylineEntity({
                positions: positions,
                style: {
                  width: 5,
                  clampToGround: true,
                  materialType: mars3d.MaterialType.LineFlicker,
                  materialOptions: {
                    color: "#ffff00",
                    speed: 5,
                  },
                },
                zIndex: 5,
                show: true,
              });

              graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
            } else {
              let pList = item.wkt.split(")),MULTILINESTRING ((");
              for (let i = 0; i < pList.length; i++) {
                let item2 = pList[i];
                if (item2.indexOf("MULTILINESTRING ((") != -1) {
                  let wkt = item2.split("MULTILINESTRING ((")[1].split(", ");
                  let positions = [];
                  wkt.forEach((item1) => {
                    let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                    positions.push(arr);
                  });
                  const graphic2 = new mars3d.graphic.PolylineEntity({
                    positions: positions,
                    style: {
                      width: 5,
                      color: "rgba(255,255,0,.02)",
                      clampToGround: true,
                    },
                    show: true,
                  });
                  graphicLayer.addGraphic(graphic2);
                  const graphic = new mars3d.graphic.PolylineEntity({
                    positions: positions,
                    style: {
                      width: 3,
                      clampToGround: true,
                      materialType: mars3d.MaterialType.LineFlicker,
                      materialOptions: {
                        color: "#ffff00",
                        speed: 5,
                      },
                    },
                    zIndex: 5,
                    show: true,
                  });
                  graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
                } else if (item2.indexOf("))") != -1) {
                  let wkt = item2.split("))")[0].split(", ");
                  let positions = [];
                  wkt.forEach((item1) => {
                    let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                    positions.push(arr);
                  });
                  const graphic2 = new mars3d.graphic.PolylineEntity({
                    positions: positions,
                    style: {
                      width: 5,
                      color: "rgba(255,255,0,.02)",
                      clampToGround: true,
                    },
                    show: true,
                  });
                  graphicLayer.addGraphic(graphic2);
                  const graphic = new mars3d.graphic.PolylineEntity({
                    positions: positions,
                    style: {
                      width: 3,
                      clampToGround: true,
                      materialType: mars3d.MaterialType.LineFlicker,
                      materialOptions: {
                        color: "#ffff00",
                        speed: 1,
                      },
                    },
                    zIndex: 5,
                    show: true,
                  });
                  graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
                } else {
                  let wkt = item2.split(", ");
                  let positions = [];
                  wkt.forEach((item1) => {
                    let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                    positions.push(arr);
                  });
                  const graphic2 = new mars3d.graphic.PolylineEntity({
                    positions: positions,
                    style: {
                      width: 5,
                      color: "rgba(255,255,0,.02)",
                      clampToGround: true,
                    },
                    show: true,
                  });
                  graphicLayer.addGraphic(graphic2);
                  const graphic = new mars3d.graphic.PolylineEntity({
                    positions: positions,
                    style: {
                      width: 3,
                      clampToGround: true,
                      materialType: mars3d.MaterialType.LineFlicker,
                      materialOptions: {
                        color: "#ffff00",
                        speed: 1,
                      },
                    },
                    zIndex: 5,
                    show: true,
                  });
                  graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
                }
              }
            }
          }
        });
      }
    }
  });
};

//加载水系
const getWater = async()=>{
      // 动态河流
      // const dynamicRiver = new mars3d.graphic.DynamicRiver({
      //   positions: [
      //     [115.906607, 30.441582, 555.9],
      //     [115.899964, 30.438543, 467.3],
      //     [115.893105, 30.440714, 374.6],
      //     [115.88362, 30.443924, 340.7],
      //     [115.873948, 30.444827, 299],
      //     [115.864003, 30.442111, 292.2],
      //     [115.850741, 30.438108, 189.9]
      //   ],
      //   style: {
      //     image: "//data.mars3d.cn/img/textures/poly-rivers.png",
      //     width: 280,
      //     height: 30,
      //     speed: 10
      //   }
      // })
      //graphicLayer.addGraphic(dynamicRiver)

      //水域加载
      await axios.get("http://172.16.10.83:8085/layer/sx").then((res) => {
          if (res.data.code == "20000000") {
            sxlist.value = res.data.data.list;
            if (sxlist.value.length > 0) {
              let listData = sxlist.value;
              listData.forEach((item) => {
                if (item.wkt) {
                    if (item.wkt.indexOf("))),MULTIPOLYGON (((") == -1) {
                      let wkt = item.wkt
                        .split("MULTIPOLYGON (((")[1]
                        .split(")))")[0]
                        .split(", ");
                      let positions = [];
                      wkt.forEach((item1) => {
                        let arr = [item1.split(" ")[0], item1.split(" ")[
                          1]];
                        positions.push(arr);
                      });
                      const dynamicWater = new mars3d.graphic.Water({
                          positions: positions,
                          style: {
                            normalMap: "/src/assets/imgs/waterNormals.jpg", // 水正常扰动的法线图
                            frequency: 8000.0, // 控制波数的数字。
                            animationSpeed: 0.02, // 控制水的动画速度的数字。
                            amplitude: 5.0, // 控制水波振幅的数字。
                            specularIntensity: 0.8, // 控制镜面反射强度的数字。
                            baseWaterColor: "#006ab4", // rgba颜色对象基础颜色的水。#00ffff,#00baff,#006ab4
                            blendColor: "#006ab4", // 从水中混合到非水域时使用的rgba颜色对象。
                            opacity: 0.7, // 透明度
                            offsetAttribute: Cesium.GeometryOffsetAttribute.ALL, // 需要有
                            offsetHeight: 0,
                            clampToGround: true, // 是否贴地
                        },
                      })
                      graphicLayer.addGraphic(dynamicWater)
                    } else {
                      let pList = item.wkt.split("))),MULTIPOLYGON ((()");
                      for (let i = 0; i < pList.length; i++) {
                        let item2 = pList[i];
                        if (item2.indexOf("MULTIPOLYGON ((") != -1) {
                          let wkt = item2.split("MULTIPOLYGON ((")[1].split(", ");
                          let positions = [];
                          wkt.forEach((item1) => {
                            let arr = [item1.split(" ")[0], item1.split(
                              " ")[1]];
                            positions.push(arr);
                          });
                              const dynamicWater = new mars3d.graphic.Water({
                              positions: positions,
                              style: {
                              normalMap: "/src/assets/imgs/waterNormals.jpg", // 水正常扰动的法线图
                              frequency: 8000.0, // 控制波数的数字。
                              animationSpeed: 0.02, // 控制水的动画速度的数字。
                              amplitude: 5.0, // 控制水波振幅的数字。
                              specularIntensity: 0.8, // 控制镜面反射强度的数字。
                              baseWaterColor: "#006ab4", // rgba颜色对象基础颜色的水。#00ffff,#00baff,#006ab4
                              blendColor: "#006ab4", // 从水中混合到非水域时使用的rgba颜色对象。
                              opacity: 0.7, // 透明度
                              offsetAttribute: Cesium.GeometryOffsetAttribute.ALL, // 需要有
                              offsetHeight: 0,
                              clampToGround: true, // 是否贴地
                            },
                          })
                          graphicLayer.addGraphic(dynamicWater)
                        } else if (item2.indexOf(")))") != -1) {
                          let wkt = item2.split(")))")[0].split(", ");
                          let positions = [];
                          wkt.forEach((item1) => {
                            let arr = [item1.split(" ")[0], item1.split(
                              " ")[1]];
                            positions.push(arr);
                          });
                              const dynamicWater = new mars3d.graphic.Water({
                              positions: positions,
                              style: {
                              normalMap: "/src/assets/imgs/waterNormals.jpg", // 水正常扰动的法线图
                              frequency: 8000.0, // 控制波数的数字。
                              animationSpeed: 0.02, // 控制水的动画速度的数字。
                              amplitude: 5.0, // 控制水波振幅的数字。
                              specularIntensity: 0.8, // 控制镜面反射强度的数字。
                              baseWaterColor: "#006ab4", // rgba颜色对象基础颜色的水。#00ffff,#00baff,#006ab4
                              blendColor: "#006ab4", // 从水中混合到非水域时使用的rgba颜色对象。
                              opacity: 0.7, // 透明度
                              offsetAttribute: Cesium.GeometryOffsetAttribute.ALL, // 需要有
                              offsetHeight: 0,
                              clampToGround: true, // 是否贴地
                            },
                          })
                          graphicLayer.addGraphic(dynamicWater)
                        } else {
                          let wkt = item2.split(", ");
                          let positions = [];
                          wkt.forEach((item1) => {
                            let arr = [item1.split(" ")[0], item1.split(
                              " ")[1]];
                            positions.push(arr);
                          });
                              const dynamicWater = new mars3d.graphic.Water({
                              positions: positions,
                              style: {
                              normalMap: "/src/assets/imgs/waterNormals.jpg", // 水正常扰动的法线图
                              frequency: 8000.0, // 控制波数的数字。
                              animationSpeed: 0.02, // 控制水的动画速度的数字。
                              amplitude: 5.0, // 控制水波振幅的数字。
                              specularIntensity: 0.8, // 控制镜面反射强度的数字。
                              baseWaterColor: "#006ab4", // rgba颜色对象基础颜色的水。#00ffff,#00baff,#006ab4
                              blendColor: "#006ab4", // 从水中混合到非水域时使用的rgba颜色对象。
                              opacity: 0.7, // 透明度
                              offsetAttribute: Cesium.GeometryOffsetAttribute.ALL, // 需要有
                              offsetHeight: 0,
                              clampToGround: true, // 是否贴地
                            },
                          })
                          graphicLayer.addGraphic(dynamicWater)
                        }
                      }
                    }
                  }
              });
            }
          }
        });
};

//加载植被
const wblzb = async()=>{
  graphicLayer2 = new mars3d.layer.GeoJsonLayer({
    name: "植被",
    url: "/src/assets/json/wblzb.json",
    symbol: {
      merge: true,
      styleOptions: {
        fill: true,
        color: "#208a26",
        clampToGround: true,
      }
    },
  })
  map.addLayer(graphicLayer2);


};

//加载ty路网
const getRolad = async()=>{
  await axios.get("http://172.16.10.83:8085/layer/road").then((res) => {
    if (res.data.code == "20000000") {
        roadlist.value = res.data.data.list;
        if (roadlist.value.length > 0) {
          roadlist.value.forEach((item) => {
            if (item.wkt) {
              if (item.wkt.indexOf(")),MULTILINESTRING ((") == -1) {
                let wkt = item.wkt
                  .split("MULTILINESTRING ((")[1]
                  .split("))")[0]
                  .split(", ");
                let positions = [];
                wkt.forEach((item1) => {
                  let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                  positions.push(arr);
                });

                const graphic = new mars3d.graphic.PolylinePrimitive({
                  positions: positions,
                  style: {
                    width: 3,
                    clampToGround: true,
                    materialType: mars3d.MaterialType.LineFlow,
                    materialOptions: {
                      //   color: "#cd8c2f",
                      image: "/src/assets/imgs/lu1.png",
                      speed: 5,
                    },
                  },
                  zIndex: 5,
                });
                graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
              } else {
                let pList = item.wkt.split(")),MULTILINESTRING ((");
                for (let i = 0; i < pList.length; i++) {
                  let item2 = pList[i];
                  if (item2.indexOf("MULTILINESTRING ((") != -1) {
                    let wkt = item2
                      .split("MULTILINESTRING ((")[1]
                      .split(", ");
                    let positions = [];
                    wkt.forEach((item1) => {
                      let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                      positions.push(arr);
                    });
                    const graphic = new mars3d.graphic.PolylinePrimitive({
                      positions: positions,
                      style: {
                        width: 3,
                        clampToGround: true,
                        materialType: mars3d.MaterialType.LineFlow,
                        materialOptions: {
                          image: "/src/assets/imgs/lu1.png",
                          speed: 5,
                        },
                      },
                      zIndex: 5,
                    });
                    graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
                  } else if (item2.indexOf("))") != -1) {
                    let wkt = item2.split("))")[0].split(", ");
                    let positions = [];
                    wkt.forEach((item1) => {
                      let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                      positions.push(arr);
                    });
                    const graphic = new mars3d.graphic.PolylinePrimitive({
                      positions: positions,
                      style: {
                        width: 3,
                        clampToGround: true,
                        materialType: mars3d.MaterialType.LineFlow,
                        materialOptions: {
                          image: "/src/assets/imgs/lu1.png",
                          speed: 5,
                        },
                      },
                      zIndex: 5,
                    });
                    graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
                  } else {
                    let wkt = item2.split(", ");
                    let positions = [];
                    wkt.forEach((item1) => {
                      let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                      positions.push(arr);
                    });
                    const graphic = new mars3d.graphic.PolylinePrimitive({
                      positions: positions,
                      style: {
                        width: 3,
                        clampToGround: true,
                        materialType: mars3d.MaterialType.LineFlow,
                        materialOptions: {
                          image: "/src/assets/imgs/lu1.png",
                          speed: 5,
                        },
                      },
                      zIndex: 5,
                    });
                    graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
                  }
                }
              }
            }
          });
        }
    }
  });
};

//加载区划
const getGrid = async(qhid)=>{
  console.log(qhid)
  const params ={
    id:qhid
  }
await axios.get("http://172.16.10.83:8085/grid/list",{params}).then((res) => {
    if (res.data.code == "20000000") {
        qhlist.value = res.data.data.list
        if(qhlist.value.length>0){
            qhlist.value.forEach((item, index) => {
            if (item.name == "万柏林区") {
                
            } else if (item.name.indexOf("街办") != -1) {
              let pointNew = item.point.split(",");
              if (item.wkt) {
                if (item.wkt.indexOf("))),MULTIPOLYGON (((") == -1) {
                  let wkt = item.wkt
                    .split("MULTIPOLYGON (((")[1]
                    .split(")))")[0]
                    .split(", ");
                  let positions = [];
                  wkt.forEach((item1) => {
                    let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                    positions.push(arr);
                  });
                  const graphic = new mars3d.graphic.ScrollWall({
                    map3d: item.map3d,
                    point: item.point,
                    name: item.name,
                    Newid: item.id,
                    positions: positions,
                    style: {
                      clampToGround: true,
                      diffHeight: 100, // 高度
                      color: "rgba(255,0, 0,1)",
                      speed: 30,
                      reverse: false, // 方向:true往上、false往下
                    },
                    show: false,
                  });
                  graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
      
                } else {
                  let pList = item.wkt.split("))),MULTIPOLYGON (((");
                  for (let i = 0; i < pList.length; i++) {
                    let item2 = pList[i];
                    if (item2.indexOf("MULTIPOLYGON (((") != -1) {
                      let wkt = item2
                        .split("MULTIPOLYGON (((")[1]
                        .split(", ");
                      let positions = [];
                      wkt.forEach((item1) => {
                        let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                        positions.push(arr);
                      });
                      const graphic = new mars3d.graphic.ScrollWall({
                        map3d: item.map3d,
                        point: item.point,
                        name: item.name,
                        Newid: item.id,
                        positions: positions,
                        style: {
                          clampToGround: true,
                          diffHeight: 100, // 高度
                          color: "rgba(255,0, 0,1)",
                          speed: 30,
                          reverse: false, // 方向:true往上、false往下
                        },
                        show: false,
                      });
                      graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
        
                    } else if (item2.indexOf(")))") != -1) {
                      let wkt = item2.split(")))")[0].split(", ");
                      let positions = [];
                      wkt.forEach((item1) => {
                        let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                        positions.push(arr);
                      });
                      const graphic = new mars3d.graphic.ScrollWall({
                        map3d: item.map3d,
                        point: item.point,
                        name: item.name,
                        Newid: item.id,
                        positions: positions,
                        style: {
                          clampToGround: true,
                          diffHeight: 100, // 高度
                          color: "rgba(255,0, 0,1)",
                          speed: 30,
                          reverse: false, // 方向:true往上、false往下
                        },
                        show: false,
                      });
                      graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
                      
                    } else {
                      let wkt = item2.split(", ");
                      let positions = [];
                      wkt.forEach((item1) => {
                        let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                        positions.push(arr);
                      });
                      const graphic = new mars3d.graphic.ScrollWall({
                        map3d: item.map3d,
                        point: item.point,
                        name: item.name,
                        Newid: item.id,
                        positions: positions,
                        style: {
                          clampToGround: true,
                          diffHeight: 100, // 高度
                          color: "rgba(255,0, 0,1)",
                          speed: 30,
                          reverse: false, // 方向:true往上、false往下
                        },
                        show: false,
                      });
                      graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
                      
                    }
                  }
                }
              }
              let point = item.point.split(",");
              const graphicName = new mars3d.graphic.BillboardEntity({
                map3d: item.map3d,
                // point: item.point,//会绘制一个白点
                name: item.name,
                Newid: item.id,
                position: [point[1], point[0], 1000],
                style: {
                  image: "/src/assets/imgs/11.png",
                  scale: self.big ? 0.1 : 0.08,
                  horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
                  verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
                  label: {
                    visibleDepth: false,
                    text: item.name,
                    pixelOffsetY: self.big ? -90 : -70,
                    pixelOffsetX: 0,
                    font_size: self.big ? 35 : 20,
                    color: "#fff",
                    outline: true,
                    outlineColor: "#000000",
                    outlineWidth: 8,
                  },
                  clampToGround: false,
                },
                // 高亮时的样式(默认为鼠标移入,也可以指定type:'click'单击高亮),构造后也可以openHighlight、closeHighlight方法来手动调用

              });
              graphicLayer.addGraphic(graphicName);
              
            } else if (
              item.name.indexOf("社区") != -1 &&
              item.name.indexOf("网格") == -1
            ) {
              if (item.wkt) {
                if (item.wkt.indexOf("))),MULTIPOLYGON (((") == -1) {
                  let wkt = item.wkt
                    .split("MULTIPOLYGON (((")[1]
                    .split(")))")[0]
                    .split(", ");
                  let positions = [];
                  wkt.forEach((item1) => {
                    let arr = [item1.split(" ")[0], item1.split(" ")[1], 770];
                    positions.push(arr);
                  });

                  const graphic = new mars3d.graphic.WallEntity({
                    map3d: item.map3d,
                    point: item.point,
                    name: item.name,
                    Newid: item.id,
                    positions: positions,
                    style: {
                      diffHeight: 20, // 高度
                      materialType: mars3d.MaterialType.WallScroll,
                      materialOptions: {
                        image: "/src/assets/imgs/flow-wall-4.png",
                        color: "rgba(3, 104, 255,0.5)",
                        count: 1,
                        speed: 20,
                        bloom: true,
                      },
                    },
                    zIndex: 5,
                    show: false,
                  });
                  graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)

                } else {
                  let pList = item.wkt.split("))),MULTIPOLYGON (((");
                  for (let i = 0; i < pList.length; i++) {
                    let item2 = pList[i];
                    if (item2.indexOf("MULTIPOLYGON (((") != -1) {
                      let wkt = item2
                        .split("MULTIPOLYGON (((")[1]
                        .split(", ");
                      let positions = [];
                      wkt.forEach((item1) => {
                        let arr = [
                          item1.split(" ")[0],
                          item1.split(" ")[1],
                          770,
                        ];
                        positions.push(arr);
                      });
                      const graphic = new mars3d.graphic.WallEntity({
                        map3d: item.map3d,
                        point: item.point,
                        name: item.name,
                        Newid: item.id,
                        positions: positions,
                        style: {
                          diffHeight: 20, // 高度
                          materialType: mars3d.MaterialType.WallScroll,
                          materialOptions: {
                            image: "/src/assets/imgs/flow-wall-4.png",
                            color: "rgba(3, 104, 255,0.5)",
                            count: 1,
                            speed: 20,
                            bloom: true,
                          },
                        },
                        zIndex: 5,
                        show: false,
                      });
                      graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)

                    } else if (item2.indexOf(")))") != -1) {
                      let wkt = item2.split(")))")[0].split(", ");
                      let positions = [];
                      wkt.forEach((item1) => {
                        let arr = [
                          item1.split(" ")[0],
                          item1.split(" ")[1],
                          770,
                        ];
                        positions.push(arr);
                      });
                      const graphic = new mars3d.graphic.WallEntity({
                        map3d: item.map3d,
                        point: item.point,
                        name: item.name,
                        Newid: item.id,
                        positions: positions,
                        style: {
                          diffHeight: 20, // 高度
                          materialType: mars3d.MaterialType.WallScroll,
                          materialOptions: {
                            image: "/src/assets/imgs/flow-wall-4.png",
                            color: "rgba(3, 104, 255,0.5)",
                            count: 1,
                            speed: 20,
                            bloom: true,
                          },
                        },
                        zIndex: 5,
                        show: false,
                      });
                      graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)

                    } else {
                      let wkt = item2.split(", ");
                      let positions = [];
                      wkt.forEach((item1) => {
                        let arr = [
                          item1.split(" ")[0],
                          item1.split(" ")[1],
                          770,
                        ];
                        positions.push(arr);
                      });
                      const graphic = new mars3d.graphic.WallEntity({
                        map3d: item.map3d,
                        point: item.point,
                        name: item.name,
                        Newid: item.id,
                        positions: positions,
                        style: {
                          diffHeight: 20, // 高度
                          materialType: mars3d.MaterialType.WallScroll,
                          materialOptions: {
                            image: "/src/assets/imgs/flow-wall-4.png",
                            color: "rgba(3, 104, 255,0.5)",
                            count: 1,
                            speed: 20,
                            bloom: true,
                          },
                        },
                        zIndex: 5,
                        show: false,
                      });
                      graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)

                    
                    }
                  }
                }
              }
              let point = item.point.split(",");
              const graphicName = new mars3d.graphic.BillboardEntity({
                map3d: item.map3d,
                //point: item.point,
                name: item.name,
                Newid: item.id,
                position: [point[1], point[0], 870],
                style: {
                  image: "/src/assets/imgs/8.png",
                  scale: self.big ? 0.5 : 0.3,
                  horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
                  verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
                  // perPositionHeight: true,
                  label: {
                    visibleDepth: false,
                    text: item.name,
                    pixelOffsetY: self.big ? -210 : -115,
                    pixelOffsetX: 10,
                    font_size: self.big ? 35 : 20,
                    color: "#fff",
                    // perPositionHeight: true
                  },
                  // 高亮时的样式(默认为鼠标移入,也可以指定type:'click'单击高亮),构造后也可以openHighlight、closeHighlight方法来手动调用
                },
              });
              graphicLayer.addGraphic(graphicName);
              // if (graphicName.startBounce) {
              //   graphicName.startBounce({
              //     maxHeight: 10,
              //     step: 0.3,
              //   });
              // }
              // self.sqList.push(graphicName);
            } else {
              if (item.wkt) {
                if (item.wkt.indexOf("))),MULTIPOLYGON (((") == -1) {
                  let wkt = item.wkt
                    .split("MULTIPOLYGON (((")[1]
                    .split(")))")[0]
                    .split(", ");
                  let positions = [];
                  wkt.forEach((item1) => {
                    let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                    positions.push(arr);
                  });
                  const graphic = new mars3d.graphic.WallEntity({
                    map3d: item.map3d,
                    point: item.point,
                    name: item.name,
                    Newid: item.id,
                    positions: positions,
                    style: {
                      materialType: mars3d.MaterialType.WallScroll,
                      materialOptions: {
                        image: "/src/assets/imgs/fence.png",
                        color: "rgba(154, 255, 0,1)",
                        count: 3,
                        speed: 20,
                        bloom: true,
                      },
                    },
                    zIndex: 5,
                  });
                  graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
          
                } else {
                  let pList = item.wkt.split("))),MULTIPOLYGON (((");
                  for (let i = 0; i < pList.length; i++) {
                    let item2 = pList[i];
                    if (item2.indexOf("MULTIPOLYGON (((") != -1) {
                      let wkt = item2
                        .split("MULTIPOLYGON (((")[1]
                        .split(", ");
                      let positions = [];
                      wkt.forEach((item1) => {
                        let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                        positions.push(arr);
                      });
                      const graphic = new mars3d.graphic.WallEntity({
                        map3d: item.map3d,
                        point: item.point,
                        name: item.name,
                        Newid: item.id,
                        positions: positions,
                        style: {
                          materialType: mars3d.MaterialType.WallScroll,
                          materialOptions: {
                            image: "/src/assets/imgs/fence.png",
                            color: "rgba(154, 255, 0,1)",
                            count: 3,
                            speed: 20,
                            bloom: true,
                          },
                        },
                        zIndex: 5,
                      });
                      graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
                    
                    } else if (item2.indexOf(")))") != -1) {
                      let wkt = item2.split(")))")[0].split(", ");
                      let positions = [];
                      wkt.forEach((item1) => {
                        let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                        positions.push(arr);
                      });
                      const graphic = new mars3d.graphic.WallEntity({
                        map3d: item.map3d,
                        point: item.point,
                        name: item.name,
                        Newid: item.id,
                        positions: positions,
                        style: {
                          materialType: mars3d.MaterialType.WallScroll,
                          materialOptions: {
                            image: "/src/assets/imgs/fence.png",
                            color: "rgba(154, 255, 0,1)",
                            count: 3,
                            speed: 20,
                            bloom: true,
                          },
                        },
                        zIndex: 5,
                      });
                      graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
                      
                    } else {
                      let wkt = item2.split(", ");
                      let positions = [];
                      wkt.forEach((item1) => {
                        let arr = [item1.split(" ")[0], item1.split(" ")[1]];
                        positions.push(arr);
                      });
                      const graphic = new mars3d.graphic.WallEntity({
                        map3d: item.map3d,
                        point: item.point,
                        name: item.name,
                        Newid: item.id,
                        positions: positions,
                        style: {
                          materialType: mars3d.MaterialType.WallScroll,
                          materialOptions: {
                            image: "/src/assets/imgs/fence.png",
                            color: "rgba(154, 255, 0,1)",
                            count: 3,
                            speed: 20,
                            bloom: true,
                          },
                        },
                        zIndex: 5,
                      });
                      graphicLayer.addGraphic(graphic); // 还可以另外一种写法: graphic.addTo(graphicLayer)
            
                    }
                  }
                }
              }

              let point = item.point.split(",");
              const graphicName = new mars3d.graphic.BillboardEntity({
                map3d: item.map3d,
                point: item.point,
                name: item.name.split("")[1],
                Newid: item.id,
                position: [point[1], point[0], 820],
                style: {
                  image: "/src/assets/imgs/wg.png",
                  scale: self.big ? 1 : 0.3,
                  horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
                  verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
                  // perPositionHeight: true,
                  label: {
                    visibleDepth: false,
                    text: item.name.split("")[1],
                    pixelOffsetY: self.big ? -240 : -73,
                    pixelOffsetX: 0,
                    font_size: self.big ? 50 : 15,
                    color: "#fff",
                  },
                  // 高亮时的样式(默认为鼠标移入,也可以指定type:'click'单击高亮),构造后也可以openHighlight、closeHighlight方法来手动调用
                },
              });
              graphicLayer.addGraphic(graphicName);
              // if (graphicName.startBounce) {
              //   graphicName.startBounce({
              //     maxHeight: 10,
              //     step: 0.3,
              //   });
              // }
              // self.wgList.push(graphicName);
            }

            if (item.name == "万柏林区") {
              console.log("item.name == '万柏林区'")
              getGrid(item.id);
            }
          });
        }
    }
  });
};

//设置事件监听
const setEvent = () =>{
  map.on([mars3d.EventType.click], function (e) {
      if (
        e.graphic.options.name != "万柏林区" &&
        e.graphic.options.name != "楼栋" &&
        e.graphic.options.name != "房屋"
      ) {
        row({
          name: e.graphic.options.name,
          id: e.graphic.options.Newid,
          point: e.graphic.options.position,
          map3d: e.graphic.options.map3d,
          type: "none",
        });

        
      } else {
        // if (e.graphic.options.name == "楼栋") {
        //   Map.wblDt(e.graphic.options);
        // }
        // if (e.graphic.options.name == "房屋") {
        //   self.isRoomPopup = true;
        //   setTimeout(() => {
        //     bus.$emit("setBuildingDate", e.graphic.options.newName);
        //   }, 500);
        // }
      }
    });
    
}

//视角移动
const row = (item)=>{
    if (item.name != "万柏林区") {
    let point = item.point;
    let hei = 3000;
    if (
      item.name.indexOf("小区") != -1 ||
      item.name.indexOf("楼栋") != -1
    ) {
      hei = 1500;
    }
    map.flyToPoint(new mars3d.LngLatPoint(point[0], point[1]), {
      radius: hei,
      heading: item.heading ? item.heading : 343,
      pitch: item.pitch ? item.pitch : -18,
      alt: item.alt ? item.alt : 0,
      roll: 0,
      clampToGround: true,
    });
    if (item.name.indexOf("街办") != -1) {
      getGrid(item.id);
    } else if (
      item.name.indexOf("社区") != -1 &&
      item.name.indexOf("网格") == -1
    ) {

      tiles3dLayer1.show = false;//清除白膜

      tileLayer = new mars3d.layer.TdtLayer({
        name: "天地图影像底图",
        layer: "img_d",
      });
      map.addLayer(tileLayer);
        if (item.map3d) {

          // 模型
          tiles3dLayer2 = new mars3d.layer.TilesetLayer({
            name: "社区",
            url: "http://172.16.10.83:9509/map3d" + item.map3d,
            position: {
              alt_offset: -10
            },
            maximumScreenSpaceError: 16, //【重要】数值加大,能让最终成像变模糊
            zIndex: 3,
            show: true,
          });
         map.addLayer(tiles3dLayer2);
        }



      // if (this.isDt != "影像地图") {
      //   this.setLayer("y");
      //   this.isDt = "影像地图";
      // }

      // this.activeWgId = null;
      // this.ldId = null;
      // if (this.xqList.length > 0) {
      //   let arr = this.xqList;
      //   for (let i = 0; i < arr.length; i++) {
      //     window.$drawControl.removeGraphic(arr[i], true);
      //     arr.splice(i, 1);
      //     //重置i,否则i会跳一位
      //     i--;
      //   };
      //   this.xqList = [];
      // }
      // this.wgLists = [];
      // if (this.wgList.length > 0) {
      //   let arr = this.wgList;
      //   for (let i = 0; i < arr.length; i++) {
      //     window.$drawControl.removeGraphic(arr[i], true);
      //     arr.splice(i, 1);
      //     //重置i,否则i会跳一位
      //     i--;
      //   };
      //   this.wgList = [];
      // }
      // if (this.ldList.length > 0) {
      //   let arr = this.ldList;
      //   for (let i = 0; i < arr.length; i++) {
      //     window.$drawControl.removeGraphic(arr[i], true);
      //     arr.splice(i, 1);
      //     //重置i,否则i会跳一位
      //     i--;
      //   };
      //   this.ldList = [];
      // }
      // if (this.roomList.length > 0) {
      //   let arr = this.roomList;
      //   for (let i = 0; i < arr.length; i++) {
      //     window.$drawControl.removeGraphic(arr[i], true);
      //     arr.splice(i, 1);
      //     //重置i,否则i会跳一位
      //     i--;
      //   };
      //   this.roomList = [];
      // }
      // if (this.zbList.length > 0) {
      //   let arr = this.zbList;
      //   for (let i = 0; i < arr.length; i++) {
      //     window.$viewer.removeLayer(arr[i], true);
      //     arr.splice(i, 1);
      //     //重置i,否则i会跳一位
      //     i--;
      //   };
      //   this.zbList = [];
      // }
      // console.log(this.activesQId)
      // console.log(item.id)
      // if (this.activesQId != item.id) {
      //   if (this.titlesListSq.length > 0) {
      //     let arr = this.titlesListSq;
      //     console.log(arr)
      //     for (let i = 0; i < arr.length; i++) {
      //       console.log(arr[i])
      //       window.$viewer.removeLayer(arr[i], true);
      //       arr.splice(i, 1);
      //       //重置i,否则i会跳一位
      //       i--;
      //     };
      //     this.titlesListSq = [];
      //   }
      //   let arr1 = this.titlesList;
      //   for (let i = 0; i < arr1.length; i++) {
      //     window.$viewer.removeLayer(arr1[i], true);
      //     arr1.splice(i, 1);
      //     //重置i,否则i会跳一位
      //     i--;
      //   };

      //   this.titlesList = []
      //   if (item.map3d) {

      //     // 模型
      //     let tiles3dLayer = new EGLOBE.layer.TilesetLayer({
      //       name: "社区",
      //       url: this.tileset + item.map3d,
      //       position: {
      //         alt_offset: -10
      //       },
      //       maximumScreenSpaceError: 256, //【重要】数值加大,能让最终成像变模糊
      //       zIndex: 3,
      //       show: true,

      //       cacheBytes: 4096 * 1024 * 1024, // 1024MB = 1024*1024*1024 【重要】额定显存大小(以字节为单位),允许在这个值上下波动。
      //       maximumCacheOverflowBytes: 6144 * 1024 * 1024, // 2048MB = 2048*1024*1024 【重要】最大显存大小(以字节为单位)。
      //       skipLevelOfDetail: true,
      //       baseScreenSpaceError: 1024,
      //       skipScreenSpaceErrorFactor: 16,
      //       skipLevels: 1,
      //       immediatelyLoadDesiredLevelOfDetail: false,
      //       loadSiblings: false, // 如果为true则不会在已加载完概况房屋后,自动从中心开始超清化房屋
      //       cullWithChildrenBounds: true,
      //       cullRequestsWhileMoving: true,
      //       cullRequestsWhileMovingMultiplier: 10, //【重要】 值越小能够更快的剔除
      //       preloadWhenHidden: true,
      //       preferLeaves: true,
      //       progressiveResolutionHeightFraction: 1, //【重要】 数值偏于0能够让初始加载变得模糊
      //       // dynamicScreenSpaceErrorDensity: 0.1, // 数值加大,能让周边加载变快
      //       dynamicScreenSpaceErrorDensity: 1, // 数值加大,能让周边加载变快
      //       dynamicScreenSpaceErrorFactor: 1, // 不知道起了什么作用没,反正放着吧先
      //       dynamicScreenSpaceError: false, // 根据测试,有了这个后,会在真正的全屏加载完之后才清晰化房屋
      //       preloadWhenHidden: true,
      //       flat: item.flat ? item.flat : {}
      //     });
      //    view.addLayer(tiles3dLayer);
      //     this.titlesListSq.push(tiles3dLayer);
      //     setTimeout(() => {
      //       self.sqList.forEach(item => {
      //         item.show = true;
      //       })
      //     }, 5000)
      //   }
      // }
      // this.activesQId = item.id;
      // this.getEstateLists(item.id);
      // this.getBuildinglists(item.id);
    } else if (item.name.indexOf("小区") != -1) {


    } else if (item.name.indexOf("楼栋") != -1) {
      // if (this.shuixi.length > 0) {
      //   let arr1 = this.shuixi;
      //   for (let i = 0; i < arr1.length; i++) {
      //     window.$drawControl.removeGraphic(arr1[i], true);
      //     arr1.splice(i, 1);
      //     //重置i,否则i会跳一位
      //     i--;
      //   };

      //   this.shuixi = [];
      // }
      // if (this.road.length > 0) {
      //   let arr1 = this.road;
      //   for (let i = 0; i < arr1.length; i++) {
      //     window.$drawControl.removeGraphic(arr1[i], true);
      //     arr1.splice(i, 1);
      //     //重置i,否则i会跳一位
      //     i--;
      //   };
      //   this.road = [];
      // }
      // if (this.ldId != item.id) {
      //   this.ldId = item.id;
      //   if (this.roomList.length > 0) {
      //     let arr1 = this.roomList;
      //     for (let i = 0; i < arr1.length; i++) {
      //       window.$drawControl.removeGraphic(arr1[i], true);
      //       arr1.splice(i, 1);
      //       //重置i,否则i会跳一位
      //       i--;
      //     };
      //     this.roomList = [];
      //   }
      //   this.getRoomlists(item.id);
      // }
    } else {
      //this.activeWgId = item.id;
    }

  }
}
</script>

<template>
  <div id="mars3dContainer" class="mars3dBox"></div>
</template>

<style scoped>
.mars3dBox {
  width: 100%;
  height: 100%;
}
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2274671.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

大语言模型训练的数据集从哪里来?

继续上篇文章的内容说说大语言模型预训练的数据集从哪里来以及为什么互联网上的数据已经被耗尽这个说法并不专业&#xff0c;再谈谈大语言模型预训练数据集的优化思路。 1. GPT2使用的数据集是WebText&#xff0c;该数据集大概40GB&#xff0c;由OpenAI创建&#xff0c;主要内…

【C++习题】22.随机链表的复制

文章目录 题目&#xff1a;138. 随机链表的复制 - 力扣&#xff08;LeetCode&#xff09;代码&#xff1a; 题目&#xff1a;138. 随机链表的复制 - 力扣&#xff08;LeetCode&#xff09; 链接&#x1f517;&#xff1a;138. 随机链表的复制 - 力扣&#xff08;LeetCode&…

C# 或 .NetCore 如何使用 NPOI 导出图片到 Excel 文件

今天在本文中&#xff0c;我们将尝试使用NPOI库将图像插入到 Excel 文件的特定位置。请将以下逻辑添加到您的写作方法中&#xff0c;在 Excel 文件中添加图像&#xff08;JPEG、PNG&#xff09;,我已经有一个示例 jpeg 文件 - Read-write-excel-npoi.jpg &#xff0c;我们将尝试…

Photon最新版本PUN 2.29 PREE,在无网的局域网下,无法连接自己搭建的本地服务器

1.图1为官方解答 2.就是加上这一段段代码&#xff1a;PhotonNetwork.NetworkingClient.SerializationProtocol SerializationProtocol.GpBinaryV16; 完美解决 unity 商店最新PUN 2 插件 不能连接 &#xff08;环境为&#xff1a;本地局域网 无外网情况 &#xff09; …

Python 爬虫验证码识别

在我们进行爬虫的过程中&#xff0c;经常会碰到有些网站会时不时弹出来验证码识别。我们该如何解决呢&#xff1f;这里分享 2 种我尝试过的方法。 0.验证码示例 1.OpenCV pytesseract 使用 Python 中的 OpenCV 库进行图像预处理&#xff08;边缘保留滤波、灰度化、二值化、…

【Rust自学】10.7. 生命周期 Pt.3:输入输出生命周期与3规则

喜欢的话别忘了点赞、收藏加关注哦&#xff0c;对接下来的教程有兴趣的可以关注专栏。谢谢喵&#xff01;(&#xff65;ω&#xff65;) 10.7.1. 深入理解生命周期 1.指定生命周期参数的方式依赖于函数所做的事情 以上一篇文章的代码为例子&#xff1a; fn longest<a&g…

创建并配置华为云虚拟私有云

目录 私有云 创建虚拟私有云 私有云 私有云是一种云计算模式&#xff0c;它将云服务部署在企业或组织内部的私有基础设施上&#xff0c;仅供该企业或组织内部使用&#xff0c;不对外提供服务.私有云的主要特点包括&#xff1a; 私密性&#xff1a;私有云的资源&#xff08;如…

子父组件传值

Angular 2 及以上版本中的父子组件通信方式 在 Angular 2 及以上版本中&#xff0c;父子组件通信主要通过以下几种方式实现&#xff1a; 一、使用Input()进行父向子通信 父组件通过属性绑定的方式将数据传递给子组件&#xff0c;子组件使用Input()装饰器来接收这些数据。 二…

wireshark排除私接小路由

1.wireshark打开&#xff0c;发现了可疑地址&#xff0c;合法的地址段DHCP是192.168.100.0段的&#xff0c;打开后查看发现可疑地址段&#xff0c;分别是&#xff0c;192.168.0.1 192.168.1.174 192.168.1.1。查找到它对应的MAC地址。 ip.src192.168.1.1 2.通过show fdb p…

机器学习实战——决策树:从原理到应用的深度解析

✨个人主页欢迎您的访问 ✨期待您的三连 ✨ ✨个人主页欢迎您的访问 ✨期待您的三连 ✨ ✨个人主页欢迎您的访问 ✨期待您的三连✨ ​​​ ​​​ ​​ 决策树&#xff08;Decision Tree&#xff09;是一种简单而直观的分类与回归模型&#xff0c;在机器学习中广泛应用。它的…

2025年01月09日Github流行趋势

1. 项目名称&#xff1a;khoj 项目地址url&#xff1a;https://github.com/khoj-ai/khoj项目语言&#xff1a;Python历史star数&#xff1a;22750今日star数&#xff1a;1272项目维护者&#xff1a;debanjum, sabaimran, MythicalCow, aam-at, eltociear项目简介&#xff1a;你…

用python实现烟花代码,完整代码拿走不谢

有时候用python实现一些有趣的代码&#xff0c;既有趣&#xff0c;又能提升知识 使用Python实现动态烟花代码 效果如下&#xff1a; 不废话&#xff0c;直接上代码&#xff1a; import pygame from random import randint, uniform, choice import mathvector pygame.math…

Python机器学习笔记(十八、交互特征与多项式特征)

添加原始数据的交互特征&#xff08;interaction feature&#xff09;和多项式特征&#xff08;polynomial feature&#xff09;可以丰富特征表示&#xff0c;特别是对于线性模型。这种特征工程可以用统计建模和许多实际的机器学习应用中。 上一次学习&#xff1a;线性模型对w…

数据结构——栈的实现

今天&#xff0c;我们来写一下关于栈的博文。 1.首先我们先了解一下什么是栈&#xff1f; 一&#xff1a;概念&#xff1a; 栈&#xff1a;一种特殊的线性表&#xff0c;其只允许在固定的一端进行插入和删除元素操作。 进行数据插入和删除操作的一端称为栈顶&#xff0c;另…

电脑提示directx错误导致玩不了游戏怎么办?dx出错的解决方法

想必大家都有过这样的崩溃瞬间&#xff1a;满心欢喜打开心仪的游戏&#xff0c;准备在虚拟世界里大杀四方或者畅游冒险&#xff0c;结果屏幕上突然弹出个 DirectX 错误的提示框&#xff0c;紧接着游戏闪退&#xff0c;一切美好戛然而止。DirectX 作为 Windows 系统下游戏运行的…

python学opencv|读取图像(二十九)使用cv2.getRotationMatrix2D()函数旋转缩放图像

【1】引言 前序已经学习了如何平移图像&#xff0c;相关文章链接为&#xff1a; python学opencv|读取图像&#xff08;二十七&#xff09;使用cv2.warpAffine&#xff08;&#xff09;函数平移图像-CSDN博客 在此基础上&#xff0c;我们尝试旋转图像的同时缩放图像。 【2】…

MySQL表的增删查改(下)——Update(更新),Delete(删除)

文章目录 Update将孙悟空同学的数学成绩修改为80分将曹孟德同学的数学成绩变更为 60 分&#xff0c;语文成绩变更为 70 分将总成绩倒数前三的 3 位同学的数学成绩加上 30 分将所有同学的语文成绩更新为原来的 2 倍 Delete删除数据删除孙悟空同学的考试成绩删除整张表数据 截断表…

Virgo:增强慢思考推理能力的多模态大语言模型

每周跟踪AI热点新闻动向和震撼发展 想要探索生成式人工智能的前沿进展吗&#xff1f;订阅我们的简报&#xff0c;深入解析最新的技术突破、实际应用案例和未来的趋势。与全球数同行一同&#xff0c;从行业内部的深度分析和实用指南中受益。不要错过这个机会&#xff0c;成为AI领…

聚类系列 (二)——HDBSCAN算法详解

在进行组会汇报的时候&#xff0c;为了引出本研究动机&#xff08;论文尚未发表&#xff0c;暂不介绍&#xff09;&#xff0c;需要对DBSCAN、OPTICS、和HDBSCAN算法等进行详细介绍。在查询相关资料的时候&#xff0c;发现网络上对于DBSCAN算法的介绍非常多与细致&#xff0c;但…

零基础 监控数据可视化 Spring Boot 2.x(Actuator + Prometheus + Grafana手把手) (上)

一、安装Prometheus Releases prometheus/prometheus GitHubhttps://github.com/prometheus/prometheus/releases 或 https://prometheus.io/download/https://prometheus.io/download/ 1. 下载适用于 Windows 的二进制文件&#xff1a; 找到最新版本的发布页面&#xf…