suerprisePlus
2024-07-16 6069325e1a37cf0462afda1627d4c660735dc57e
src/assets/js/map/mapJsonLayer.js
@@ -21,6 +21,7 @@
  linePath: null,
  richTextPoint1: null,
  wfsLayer: null,
  dataSource: null,
  init(url) {
    this.url = url;
    this.getJsonLayer();
@@ -117,7 +118,7 @@
    });
  },
  setQueryTF2(name) {
    // const obj = "weaponname like '%" + name + "%'" + "";
    //  const obj = "weaponname like '%堤丰系统%'" + "";
    const filed = this.getPublickey(name);
    const layer = modelLayer.layers.filter((item) => {
      if (item.name == "武器点") {
@@ -134,12 +135,12 @@
      dbid: modelLayer.dbid,
      where: filed
    }).then((response) => {
      if (response.code != 200) return;
      const geom = response.data.items[0];
      const position = [geom._x, geom._y, 0];
      const cylinder = {
        radius: 1500, //半径
        radius: 400000, //半径
        angle: 30, //扫描角度(可选)
        speed: 5, //倍速(可选)
        stackPartitions: 80, //横向网格数(可选)
@@ -150,7 +151,15 @@
        position,
        cylinder
      );
      // Viewer.zoomTo(this.rectangularSensor.item);
      earthCtrl.camera.flyTo(
        113.00849464328284,
        10.437567580726105,
        1101300.7027243855,
        57, -45, 0, 2
        );
    });
  },
  setQueryByFiled(name, color) {
@@ -233,6 +242,10 @@
  },
  setTitleSetRest() {
    this.targetList = [];
    if (this.dataSource) {
      Viewer.dataSources.remove(this.dataSource);
      this.dataSource = null
    }
    if (this.wfsLayer) {
      // this.wfsLayer.removeFromMap();
      this.wfsLayer.destroy();
@@ -318,18 +331,18 @@
  },
  setAddWfsJson() {
    const url = this.getQueryUrl("SubicBayWeapon_wfs", "weapons");
    const that = this;
    Cesium.GeoJsonDataSource.load(url, {
      fill: Cesium.Color.fromCssColorString("#FFFFFF00"),
      stroke: Cesium.Color.fromCssColorString("#FFFFFF00"), //多边形或线的颜色
      strokeWidth: 0 //多边形或线 宽度
    }).then((dataSource) => {
      const entities = dataSource.entities.values;
      that.dataSource = dataSource;
      const entities = that.dataSource.entities.values;
      entities.map((item) => {
        item.polygon._material.color =
          Cesium.Color.fromCssColorString("#FFFFFF00");
        item.polygon.heightReference =
          Cesium.HeightReference.RELATIVE_TO_GROUND; // 贴地
        item.polygon.height = 0; // 距地高度0米
@@ -343,30 +356,30 @@
          positions: positions,
          clampToGround: true, // 贴地
          width: 5,
          material: Cesium.Color.fromCssColorString("#FF0000")
          material: Cesium.Color.fromCssColorString("#FFA500")
        });
       console.log(item._name);
       const label_name = item.name ?item.name :"";
        const label_name = item.name ? item.name : "";
        item.label = {
          text: label_name,
          font: "500 16x sans-serif",
          style: Cesium.LabelStyle.FILL_AND_OUTLINE, // 字体样式
          fillColor: new Cesium.Color.fromCssColorString("#FFFFFF"),
          outlineWidth: 1,  // 字体外圈线宽度(同样也有颜色可设置)
          outlineColor: new Cesium.Color.fromCssColorString("#FFFFFF"),
          verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // 垂直位置
          fillColor: new Cesium.Color.fromCssColorString("#FFFFFF"),
          outlineWidth: 1, // 字体外圈线宽度(同样也有颜色可设置)
          outlineColor: new Cesium.Color.fromCssColorString("#FFFFFF"),
          verticalOrigin: Cesium.VerticalOrigin.BASELINE, // 垂直位置
          pixelOffset: new Cesium.Cartesian2(0, 0), // 中心位置
          disableDepthTestDistance: Number.POSITIVE_INFINITY,
          distanceDisplayCondition: new Cesium.DistanceDisplayCondition(
            500.0,
            3000.0
          ),
          )
          // showBackground:true,
          // backgroundColor: new Cesium.Color(26 / 255, 196 / 255, 228 / 255, 1.0) //背景顔色
        };
      });
      Viewer.dataSources.add(dataSource);
      Viewer.dataSources.add(that.dataSource);
    });
  },
  getTileSet() {