From bbb9ee296e5ca96d80eed76173c3d76ebc14fc5f Mon Sep 17 00:00:00 2001
From: guanqb <18720758508@163.com>
Date: Wed, 17 May 2023 09:50:08 +0800
Subject: [PATCH] Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/srs-police-affairs
---
src/components/map/index.vue | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 53 insertions(+), 1 deletions(-)
diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index 4c3fbc9..41becd2 100644
--- a/src/components/map/index.vue
+++ b/src/components/map/index.vue
@@ -2,7 +2,7 @@
* @Author: shuishen 1109946754@qq.com
* @Date: 2022-08-18 17:00:30
* @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2023-05-11 09:36:50
+ * @LastEditTime: 2023-05-16 20:44:11
* @FilePath: \srs-police-affairs\src\components\map\index.vue
* @Description: 公用地图组件
*
@@ -166,6 +166,7 @@
import yToolTip from './components/yToolTip.vue'
import createTools from '@/utils/tools/index'
import { mapGetters } from 'vuex'
+import { getLineSpeed } from '@/utils/turfPolygon'
import yxLayerJson from './yxlayer'
@@ -465,6 +466,10 @@
} else {
that.layerPolygonAdd(params.layerName, params.positions, params.material, params.distanceDisplayCondition, 'polygon', params.params, params.incident, params.mouseOverIncident, params.mouseOutIncident, params.setStyle)
}
+ })
+
+ this.$EventBus.$on('layerPolygonArrowsAdd', (params) => {
+ that.layerPolygonArrowsAdd(params.layerName, params.positions, params.material, params.polygonName, params.params, params.incident, params.mouseOverIncident, params.mouseOutIncident, params.setStyle)
})
this.$EventBus.$on('layerPolylineAdd', (params) => {
@@ -1049,6 +1054,52 @@
},
/**
+ * 图层面添加
+ * @param {*} layerName 图层名称
+ * @param {*} positions 图层位置数据
+ * @param {*} material 颜色
+ * @param {*} distanceDisplayCondition 可见距离
+ */
+ layerPolygonArrowsAdd (layerName, positions, material, polygonName = '', params, incident = (e) => { }, mouseOverIncident = (e) => { },
+ mouseOutIncident = (e) => { }, setStyle = {}) {
+ if (!layersObjcect[layerName] || layersObjcect[layerName] == null) {
+ this.mapAddLayer(layerName, 'VectorLayer')
+
+ layersObjcect[layerName].allowDrillPicking = true
+ }
+
+ if (polygonName == '') {
+ polygonName = layerName + params.id
+ }
+
+ polygonObj[polygonName] = new global.DC.Polyline(positions)
+
+
+ let positionData = positions.split(';').map(item => {
+ return [Number(item.split(',')[0]), Number(item.split(',')[1])]
+ }).filter(item => {
+ return !item.some(it => it == 0)
+ })
+
+ polygonObj[polygonName].setStyle({
+ width: (params.width / 2),
+ material: new global.DC.PolylineImageTrailMaterialProperty({
+ color: new global.DC.Color(255, 255, 255),
+ speed: 20,
+ image: '/images/arrows.png',
+ repeat: {
+ x: (getLineSpeed(positionData) / 2), y: 1
+ }
+ }),
+ clampToGround: false,
+ ...setStyle
+ })
+
+ polygonObj[polygonName].attrParams = params
+ layersObjcect[layerName].addOverlay(polygonObj[polygonName])
+ },
+
+ /**
* 图层线添加
* @param {*} layerName 图层名称
* @param {*} positions 图层位置数据
@@ -1326,6 +1377,7 @@
this.$EventBus.$off('mapClearLayer')
this.$EventBus.$off('layerPointAdd')
this.$EventBus.$off('layerPolygonAdd')
+ this.$EventBus.$off('layerPolygonArrowsAdd')
this.$EventBus.$off('layerPolylineAdd')
this.$EventBus.$off('layerWallAdd')
this.$EventBus.$off('rowLayerWallAdd')
--
Gitblit v1.9.3