From 4d0cece6f88fa97f5e299dc450d4707d3eec534e Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Tue, 18 Jan 2022 09:51:17 +0800
Subject: [PATCH] +
---
src/store/modules/mobile.js | 91 ++++++++++++++++++++++++++++-----------------
1 files changed, 56 insertions(+), 35 deletions(-)
diff --git a/src/store/modules/mobile.js b/src/store/modules/mobile.js
index 01217ab..117f84b 100644
--- a/src/store/modules/mobile.js
+++ b/src/store/modules/mobile.js
@@ -56,6 +56,7 @@
navigationStartLngLat: "", //导航起点
navigationEndLngLat: "", //导航终点
drawALineLayer: null, //导航路径图层
+ drawALineLayerIcon: null, //导航路径图层图标
isOpenDrawALine: false, //是否开启路径
endPosition: "", //传送终点经纬度--
isendPosition: false, //传送终点经纬度--感应数据
@@ -268,6 +269,12 @@
state.drawALineLayer.remove();
state.drawALineLayer = null;
state.isOpenDrawALine = false;
+ }
+ },
+ removerPolyLineIcon(state) {
+ if (state.drawALineLayerIcon) {
+ state.drawALineLayerIcon.remove();
+ state.drawALineLayerIcon = null;
}
},
removePolylineMany(state) {
@@ -744,45 +751,53 @@
color: color,
speed: 10,
});
- let drawALineLayer = new global.DC.VectorLayer("layer");
- state.mviewer.addLayer(drawALineLayer);
- let polyline = new global.DC.Polyline(Str); //加入绘画点
+ state.drawALineLayer = new global.DC.VectorLayer("lineLayer");
+ state.mviewer.addLayer(state.drawALineLayer);
+
+ //如果是添加 给第一个点加入图标 和事件
+ if (value[1]) {
+ commit("removerPolyLineIcon");
+ state.drawALineLayerIcon = new global.DC.VectorLayer("pointLayer");
+ state.mviewer.addLayer(state.drawALineLayerIcon);
+ let post = Str.split(";")[0].split(",");
+ let position = new global.DC.Position(post[0], post[1]);
+ let billboard = new global.DC.Billboard(
+ position,
+ "img/dingwei/dingwei1.png"
+ ); //加入绘画点
+ billboard.setStyle({
+ pixelOffset: { x: 0, y: -17 }, //偏移像素
+ });
+ //订阅事件
+ billboard.on(global.DC.MouseEventType.CLICK, (e) => {
+ // console.log(e);
+ // return;
+ // 定制化窗体
+ let position = e.position,
+ lntLat = [e.overlay._position._lng, e.overlay._position._lat];
+ let windowData = {
+ position,
+ lntLat,
+ query: {
+ ...(value[1] || {}),
+ position,
+ lntLat,
+ notAddGoOn: "notAddGoOn",
+ },
+ useJWD: true, //仅使用经纬度
+ };
+ dispatch("setMobileWindows", windowData);
+ });
+ state.drawALineLayerIcon.addOverlay(billboard);
+ }
+ let polyline = new global.DC.Polyline(Str); //加入线
polyline.setStyle({
width: 3,
material: material,
clampToGround: true,
});
- drawALineLayer.addOverlay(polyline);
- //如果是添加 给第一个点加入图标 和事件
- // if (value[1]) {
- // let post = Str.split(";")[0].split(",");
- // let position = new global.DC.Position(post[0], post[1]);
- // let billboard = new global.DC.Billboard(
- // position,
- // "img/dingwei/dingwei4.png"
- // ); //加入绘画点
- // billboard.setStyle({
- // pixelOffset: { x: 0, y: -17 }, //偏移像素
- // });
- // //订阅事件
- // billboard.on(global.DC.MouseEventType.CLICK, (e) => {
- // // console.log(e);
- // // return;
- // // 定制化窗体
- // let position = e.position,
- // lntLat = [e.overlay._position._lng, e.overlay._position._lat];
- // let windowData = {
- // position,
- // lntLat,
- // query: { ...(value[1] || {}), position, lntLat },
- // useJWD: true, //仅使用经纬度
- // };
- // dispatch("setMobileWindows", windowData);
- // });
- // drawALineLayer.addOverlay(billboard);
- // }
+ state.drawALineLayer.addOverlay(polyline);
- state.drawALineLayer = drawALineLayer;
state.isOpenDrawALine = true;
// commit("cameraSetView", state.navigationStartLngLat); //移动
},
@@ -791,6 +806,7 @@
//检查是否存在路线
commit("removePolylineMany");
commit("removePolyline");
+ commit("removerPolyLineIcon");
let Strs = value[0];
let red = global.DC.Namespace.Cesium.Color.fromCssColorString("#FF0000");
let white = global.DC.Namespace.Cesium.Color.fromCssColorString("#fff");
@@ -805,7 +821,7 @@
image: "img/icon/right.png",
repeat: { x: 320, y: 1 },
});
- let drawALineLayerMany = new global.DC.VectorLayer("layer");
+ let drawALineLayerMany = new global.DC.VectorLayer("manyLinePointLayer");
state.mviewer.addLayer(drawALineLayerMany);
//多条线
for (let k in Strs) {
@@ -853,7 +869,12 @@
let windowData = {
position,
lntLat,
- query: { ...(value[2] || {}), position, lntLat },
+ query: {
+ ...(value[2] || {}),
+ position,
+ lntLat,
+ notAddGoOn: "notAddGoOn",
+ },
useJWD: true, //仅使用经纬度
};
dispatch("setMobileWindows", windowData);
--
Gitblit v1.9.3