From a3fadb577e4d18c1d7ff60e23be4f3d27f63b9a3 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Mon, 17 Jan 2022 17:07:52 +0800
Subject: [PATCH] +
---
src/store/modules/mobile.js | 78 ++++++++++++++++++++++-----------------
1 files changed, 44 insertions(+), 34 deletions(-)
diff --git a/src/store/modules/mobile.js b/src/store/modules/mobile.js
index 01217ab..d747e5a 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,48 @@
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 },
+ 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); //移动
},
@@ -805,7 +815,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) {
--
Gitblit v1.9.3