From b8c0808ad824de028db2e584ffa634878e1a9274 Mon Sep 17 00:00:00 2001
From: SHICHAO <17568097882@163.com>
Date: Sun, 27 Aug 2023 10:57:18 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B0=B4=E6=BA=90=E7=9B=B8=E5=85=B3=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/mars3d/Map.vue | 14 +++----
src/views/home/index.vue | 2 +-
src/views/home/widget/waterbox.vue | 61 ++++++++++++++----------------
3 files changed, 37 insertions(+), 40 deletions(-)
diff --git a/src/components/mars3d/Map.vue b/src/components/mars3d/Map.vue
index f596de4..4e2fcb0 100644
--- a/src/components/mars3d/Map.vue
+++ b/src/components/mars3d/Map.vue
@@ -140,13 +140,13 @@ export default {
// 抛出事件
this.$emit("onload", map);
//开场动画
- map.openFlyAnimation({
- // duration1:4,
- // easingFunction1: Cesium.EasingFunction.QUINTIC_IN_OUT,
- callback: function () {
- //动画播放完成后回调
- },
- });
+ // map.openFlyAnimation({
+ // // duration1:4,
+ // // easingFunction1: Cesium.EasingFunction.QUINTIC_IN_OUT,
+ // callback: function () {
+ // //动画播放完成后回调
+ // },
+ // });
},
//初始化外部静态widget功能(兼容使用传统模式开发的一些widget)
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index cbab70b..6bda3ac 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -179,7 +179,7 @@
>
-
+
{
this.waterGraphicLayer.removeGraphic(item);
});
+ if (this.pathPointGraphicLayer) {
+ this.pathPointGraphicLayer.clear();
+ }
this.$emit("close");
},
radioChange(e) {
@@ -174,6 +176,7 @@ export default {
var s = parseInt((a % 3600) % 60);
return h + "小时" + m + "分" + s + "秒";
},
+ //火情附近所有点
getNestPoint(lng, lat) {
let from = turf.point([lng, lat]);
this.nestWaterPoints = [];
@@ -196,36 +199,34 @@ export default {
flyToPosition(lngLat) {
this.startLngLat = lngLat;
this.getRoutePath();
- window.globalmap.flyToPoint(lngLat, { radius: 400, pitch: -90 });
+ window.globalmap.flyToPoint(lngLat, { radius: 1200, pitch: -90 });
// {"lat":34.984709,"lng":118.253932,"alt":6066,"heading":354,}
},
getRoutePath() {
// 获取路线数据
let startCoor = this.startLngLat;
let endCoor = this.waterCenter;
- let _this = this;
- axios({
- method: "get",
- url: "http://123.132.248.154:9210/api/FirePrevention/LoadRoad",
- headers: {
- "X-Token": localStorage.getItem("X-Token"),
- },
- params: {
- startlng: parseFloat(startCoor[0]),
- startlat: parseFloat(startCoor[1]),
- endlng: parseFloat(endCoor[0]),
- endlat: parseFloat(endCoor[1]),
- },
- }).then((data) => {
- if (data.data.data.length > 0) {
- let LineString = data.data.data[0].route;
+ let params = {
+ startlng: parseFloat(startCoor[0]),
+ startlat: parseFloat(startCoor[1]),
+ endlng: parseFloat(endCoor[0]),
+ endlat: parseFloat(endCoor[1]),
+ areaname: localStorage.getItem("areaName"),
+ };
+ getMethodCommon("/FirePrevention/LoadRoad", params).then((res) => {
+ console.log("res: ", res);
+ if (res.data.length > 0) {
+ let LineString = res.data[0].route;
if (LineString == null || LineString == "null") {
+ this.$message({
+ type: "warning",
+ message: "距离太近,没有找到合适的路线",
+ });
+ if (this.pathPointGraphicLayer) {
+ this.pathPointGraphicLayer.clear();
+ }
} else {
- setTimeout(function () {
- console.log("LineStringing", LineString);
- _this.drawRoutePath(parse(LineString));
- console.log("2222222222");
- }, 1000);
+ this.drawRoutePath(parse(LineString));
}
} else {
}
@@ -236,14 +237,12 @@ export default {
if (this.pathPointGraphicLayer == null) {
this.pathPointGraphicLayer = new mars3d.layer.GraphicLayer();
window.globalmap.addLayer(this.pathPointGraphicLayer);
+ } else {
+ this.pathPointGraphicLayer.clear();
}
- console.log("geojson", geojson);
- this.pathPointGraphicLayer.clear();
-
if (geojson.type == "LineString") {
geojson.coordinates = [geojson.coordinates];
}
-
// 虚线部分
var startCoor = this.startLngLat;
var endCoor = this.waterCenter;
@@ -278,7 +277,6 @@ export default {
dashLength: 8.0,
},
},
- attr: { remark: "虚线" },
});
this.pathPointGraphicLayer.addGraphic(graphic);
}
@@ -331,7 +329,6 @@ export default {
speed: 10,
},
},
- attr: { remark: "示例13" },
});
this.pathPointGraphicLayer.addGraphic(graphic);