suerprisePlus
2024-06-27 12a2d994bace6430a49e390b2ed3df9e00af6168
方案2
已修改2个文件
68 ■■■■ 文件已修改
src/assets/js/map/mapJsonLayer.js 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/chartView/index.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/map/mapJsonLayer.js
@@ -309,12 +309,65 @@
    });
  },
  setAddWfsLayer(){
    this.wfsLayer = earthCtrl.factory.createWfsLayer('polygon', {
      urls: 'https://cim.smartearth.cn/SEserver/wfsserver/SubicBayWeapon_wfs',
      layer: 'weapons',
      outlineColor:'#ff0000',
      alpha:0,
    })
    this.wfsLayer = earthCtrl.factory.createWfsLayer("polygon", {
      urls: "https://cim.smartearth.cn/SEserver/wfsserver/SubicBayWeapon_wfs",
      layer: "weapons",
      outlineColor: "#ff0000",
      alpha: 0
    });
  },
  setAddWfsJson() {
    const url = this.getQueryUrl("SubicBayWeapon_wfs", "weapons");
    Cesium.GeoJsonDataSource.load(url, {
      fill: Cesium.Color.fromCssColorString("#FFFFFF00"),
      stroke: Cesium.Color.fromCssColorString("#FFFFFF00"), //多边形或线的颜色
      strokeWidth: 0 //多边形或线 宽度
    }).then((dataSource) => {
      const entities = 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米
        var polyPositions = item.polygon.hierarchy.getValue().positions;
        var polyCenter = Cesium.BoundingSphere.fromPoints(polyPositions).center; //中心点
        polyCenter = Cesium.Ellipsoid.WGS84.scaleToGeodeticSurface(polyCenter);
        item.position = polyCenter;
        let positions = item.polygon.hierarchy._value.positions;
        // 设置面轮廓
        item.polyline = new Cesium.PolylineGraphics({
          positions: positions,
          clampToGround: true, // 贴地
          width: 5,
          material: Cesium.Color.fromCssColorString("#FF0000")
        });
       console.log(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, // 垂直位置
          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);
    });
  },
  getTileSet() {
    var objItem = mapServer.listData.filter((item) => {
src/views/chartView/index.vue
@@ -270,7 +270,6 @@
      mapInfo.setEntityQueryInput();
      switch (res) {
        case "scanWeapon":
          mapInfo.setFlyTo({
            "longitude": 120.26907736668211,
            "latitude": 14.791708841800627,
@@ -279,7 +278,7 @@
          var obj = this.getQueryGroupBy("武器", "weaponname")
          this.getQueryEentityGroupBy(obj, "weaponname")
          layerJson.setAddWfsLayer();
          // layerJson.setAddWfsJson();
          break;
        case "weaponParameters":
          var obj = this.getQueryGroupBy("武器", "description")