拖旺项目:聊城公交辅助决策系统
master
2022-05-05 2bb706cc9371e7cb568193db863477d1271c1cba
完善公交地图页面功能1.0
1个文件已修改
60 ■■■■ 已修改文件
src/views/map/map.vue 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/map/map.vue
@@ -274,8 +274,8 @@
      switch (type) {
        case 0:
          window.marsmap._layerCache.zhandian_layer && window.marsmap._layerCache.zhandian_layer.remove()
           window.marsmap._layerCache.changzhan_layer && window.marsmap._layerCache.changzhan_layer.remove()
           window.marsmap._layerCache.cheliang_layer && window.marsmap._layerCache.cheliang_layer.remove()
          window.marsmap._layerCache.changzhan_layer && window.marsmap._layerCache.changzhan_layer.remove()
          window.marsmap._layerCache.cheliang_layer && window.marsmap._layerCache.cheliang_layer.remove()
          this.initfgsLayer();
          this.isActivatetool = false
          this.isActivatetoolcl = false
@@ -286,9 +286,9 @@
          this.bar[type].text_div = false;
          break;
        case 1:
           window.marsmap._layerCache.zhandian_layer && window.marsmap._layerCache.zhandian_layer.remove()
           window.marsmap._layerCache.fengongsi_layer && window.marsmap._layerCache.fengongsi_layer.remove()
           window.marsmap._layerCache.cheliang_layer && window.marsmap._layerCache.cheliang_layer.remove()
          window.marsmap._layerCache.zhandian_layer && window.marsmap._layerCache.zhandian_layer.remove()
          window.marsmap._layerCache.fengongsi_layer && window.marsmap._layerCache.fengongsi_layer.remove()
          window.marsmap._layerCache.cheliang_layer && window.marsmap._layerCache.cheliang_layer.remove()
          this.initczLayer();
          this.$store.commit("SET_MapMenu", "场站")
          this.$store.commit("SET_SelAttr", { visa: false })
@@ -299,6 +299,10 @@
          this.bar[type].text_div = false;
          break;
        case 2:
          window.marsmap._layerCache.fengongsi_layer && window.marsmap._layerCache.fengongsi_layer.remove()
          window.marsmap._layerCache.changzhan_layer && window.marsmap._layerCache.changzhan_layer.remove()
          window.marsmap._layerCache.cheliang_layer && window.marsmap._layerCache.cheliang_layer.remove()
          window.marsmap._layerCache.zhandian_layer && window.marsmap._layerCache.zhandian_layer.remove()
          this.isActivatetool = false
          this.isActivatetoolcl = false
          this.isActivateSearch = false
@@ -613,7 +617,7 @@
      window.marsmap.addLayer(changzhan_area_layer)
      this.$axios.get(this.$Interface.mapResource.getChangZhanAllData, {}).then((res) => {
        console.log(res,"changzhan")
        console.log(res, "changzhan")
        if (res.code === 0) {
          console.log(res.data);
          for (let i = 0; i < res.data.length; i++) {
@@ -637,7 +641,47 @@
        }
      });
    },
    initxlLayer () {
    // 路线
    initxlLayer (id = "411", type = "1") {
      let that = this
      const luxian_layer = new this.mars3d.layer.GraphicLayer({ id: 'luxian_layer' })
      // 2.在layer上绑定监听事件
      luxian_layer.on(this.mars3d.EventType.click, function (event) {
        console.log('监听layer,单击了矢量对象', event)
        console.log(event.graphic.attr)
        that.$store.commit("SET_SelAttr", { visa: true, type: "luxian", id: event.graphic.attr.stationId, value: event.graphic.attr.stationName })
        event.graphic.flyTo({ radius: 2000, duration: 1 })
      })
      const luxian_area_layer = new this.mars3d.layer.GraphicLayer({ id: 'luxian_area_layer' })
      window.marsmap.addLayer(luxian_layer)
      window.marsmap.addLayer(luxian_area_layer)
      this.$axios.get(this.$Interface.mapResource.getXianLuDataByLineID, {
        params: { lineId: id, flag: type },
      }).then((res) => {
        console.log(res.data.stationList, "luxian")
        if (res.code === 0) {
          console.log(res.data);
          for (let i = 0; i < res.data.stationList.length; i++) {
            console.log("dingwei", res.data.stationList[i].longitude, res.data.stationList[i].latitude)
            const graphic = new this.mars3d.graphic.PointEntity({
              position: [res.data.stationList[i].longitude, res.data.stationList[i].latitude, 0],
              style: {
                color: "#ff0000",
                pixelSize: 10,
                outlineColor: "#ffffff",
                outlineWidth: 2,
                label: {
                  text: res.data.stationList[i].stationName,
                }
              },
              attr: res.data[i]
            })
            luxian_layer.addGraphic(graphic)
          }
        }
      });
      // utils.loadGeometryById("411", "1");
      console.log("eee")
    },
@@ -659,7 +703,7 @@
      window.marsmap.addLayer(cheliang_area_layer)
      this.$axios.get(this.$Interface.mapResource.getChangZhanAllData, {}).then((res) => {
        console.log(res,"cheliang")
        console.log(res, "cheliang")
        if (res.code === 0) {
          console.log(res.data);
          for (let i = 0; i < res.data.length; i++) {