From 2625ee88c405ecf102ca26f8601146fe38392c13 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Mon, 28 Nov 2022 10:52:49 +0800
Subject: [PATCH] 活动人员区域和活动车辆区域添加地图显示;活动增加经纬度保存
---
src/components/map/mapBox.vue | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/components/map/mapBox.vue b/src/components/map/mapBox.vue
index 19e92a8..3cdc6a3 100644
--- a/src/components/map/mapBox.vue
+++ b/src/components/map/mapBox.vue
@@ -32,7 +32,7 @@
export default {
name: 'mapBox',
- props:['routeRange','isDetail',"pointLonLat"],
+ props:['routeRange','isDetail'],
data() {
return {
map: null,
@@ -94,8 +94,8 @@
})
_this.map.addLayer(_this.lineVector)
_this.map.addLayer(_this.pointVector)
- _this.addLineDraw(_this.routeRange)
- _this.addPoint(_this.pointLonLat)
+ //在地图上回显线或点
+ _this.startAdd(_this.routeRange)
},
// 绘画之后的样式
styleFunction() {
@@ -146,10 +146,15 @@
},
// 添加点
addPoint(pointLonLat){
+ // pointLonLat = POINT(115.87531914674 28.8603307485585)
if (pointLonLat){
+ let pointData = ""
+ let pointArray = []
+ pointData = pointLonLat.match(/\(([^)]*)\)/);
+ pointArray = pointData[1].split(" ")
//设置点
let feature_Point = new Feature({
- geometry: new Point([Number(pointLonLat.lon), Number(pointLonLat.lat)])
+ geometry: new Point([Number(pointArray[0]), Number(pointArray[1])])
})
//点样式
let style = new Style({
@@ -162,7 +167,7 @@
});
feature_Point.setStyle(style);
this.pointVector.getSource().addFeature(feature_Point);
- let center = [Number(pointLonLat.lon), Number(pointLonLat.lat)];
+ let center = [Number(pointArray[0]), Number(pointArray[1])];
let view = this.map.getView();
view.setZoom(16);
view.animate({
@@ -392,6 +397,13 @@
_this.tipPosition.w = x + n;
_this.tipPosition.h = y + m;
},
+ startAdd(routeRange){
+ if (routeRange.startsWith("LINESTRING")){
+ this.addLineDraw(routeRange)
+ }else {
+ this.addPoint(routeRange)
+ }
+ }
},
mounted() {
this.createMap()
--
Gitblit v1.9.3