From 2bb706cc9371e7cb568193db863477d1271c1cba Mon Sep 17 00:00:00 2001
From: master <master@163.com>
Date: 星期四, 05 五月 2022 21:04:28 +0800
Subject: [PATCH] 完善公交地图页面功能1.0
---
src/views/map/map.vue | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 52 insertions(+), 8 deletions(-)
diff --git a/src/views/map/map.vue b/src/views/map/map.vue
index 68c97d7..93d92c8 100644
--- a/src/views/map/map.vue
+++ b/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.鍦╨ayer涓婄粦瀹氱洃鍚簨浠�
+ 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++) {
--
Gitblit v1.9.1