From 9d967228f25d0eb4635c4438576b139f2d8fe257 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 20 Sep 2022 17:08:10 +0800
Subject: [PATCH] 绘制线段

---
 src/components/map/index.vue |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index 8698f2f..5af9111 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: 2022-09-20 16:25:50
+ * @LastEditTime: 2022-09-20 17:07:27
  * @FilePath: \srs-police-affairs\src\components\map\index.vue
  * @Description: 公用地图组件
  * 
@@ -341,6 +341,10 @@
             that.layerPolygonAdd(params.layerName, params.positions, params.material)
         })
 
+        this.$EventBus.$on('layerPolylineAdd', (params) => {
+            that.layerPolylineAdd(params.layerName, params.positions, params.material, params.width)
+        })
+
         this.$EventBus.$on('layerShow', (params) => {
             that.layerShow(params.layerName, params.flag)
         })
@@ -514,6 +518,31 @@
         },
 
         /**
+         * 图层线添加
+         * @param {*} layerName 图层名称
+         * @param {*} positions 图层位置数据
+         * @param {*} material 颜色
+         * @param {*} width 宽度
+         */
+        layerPolylineAdd (layerName, positions, material, width) {
+            if (!layersObjcect[layerName] || layersObjcect[layerName] == null) {
+                this.mapAddLayer(layerName, 'VectorLayer')
+
+                layersObjcect[layerName].allowDrillPicking = true
+            }
+
+            let polyline = new global.DC.Polyline(positions)
+
+            polyline.setStyle({
+                width: width,
+                material: material,
+                clampToGround: false
+            })
+
+            layersObjcect[layerName].addOverlay(polyline)
+        },
+
+        /**
          * 图层显示隐藏
          * @param {*} layerName 图层名称
          * @param {*} flag 显示隐藏

--
Gitblit v1.9.3