From 6ad672fc958a43042c7fec8616d7d0c83a4abfce Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Sat, 23 Dec 2023 14:31:35 +0800
Subject: [PATCH] 代码提交

---
 src/views/check/components/OlMapBox.vue |   70 +++++++++++++++++-----------------
 1 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/src/views/check/components/OlMapBox.vue b/src/views/check/components/OlMapBox.vue
index 6164b1a..fd5349c 100644
--- a/src/views/check/components/OlMapBox.vue
+++ b/src/views/check/components/OlMapBox.vue
@@ -348,40 +348,40 @@
                     layersObjcect[layerName] = new VectorLayer({
                         source: layer,
                         zIndex: 24,
-                        // style: (feature, resolution) => {
-                        //     let size = feature.get('features').length
-                        //
-                        //     let radius = 10
-                        //
-                        //     if (size > 900) {
-                        //         radius = 19
-                        //     } else if (size > 600) {
-                        //         radius = 16
-                        //     } else if (size > 400) {
-                        //         radius = 13
-                        //     }
-                        //
-                        //     let style = new Style({
-                        //         image: new Circle({
-                        //             radius: radius,
-                        //             stroke: new Stroke({
-                        //                 color: 'blue',
-                        //                 width: 1
-                        //             }),
-                        //             fill: new Fill({
-                        //                 color: 'blue'
-                        //             })
-                        //         }),
-                        //         text: new Text({
-                        //             text: size.toString(),
-                        //             fill: new Fill({
-                        //                 color: 'white'
-                        //             })
-                        //         })
-                        //     })
-                        //
-                        //     return style
-                        // }
+                        style: (feature, resolution) => {
+                            let size = feature.get('features').length
+
+                            let radius = 10
+
+                            if (size > 900) {
+                                radius = 19
+                            } else if (size > 600) {
+                                radius = 16
+                            } else if (size > 400) {
+                                radius = 13
+                            }
+
+                            let style = new Style({
+                                image: new Circle({
+                                    radius: radius,
+                                    stroke: new Stroke({
+                                        color: 'blue',
+                                        width: 1
+                                    }),
+                                    fill: new Fill({
+                                        color: 'blue'
+                                    })
+                                }),
+                                text: new Text({
+                                    text: size.toString(),
+                                    fill: new Fill({
+                                        color: 'white'
+                                    })
+                                })
+                            })
+
+                            return style
+                        }
                     })
 
                     mapView.addLayer(layersObjcect[layerName])
@@ -411,7 +411,7 @@
             })
             mapView.getView().animate({ // 只设置需要的属性即可
                 center: [positionData[0].lng, positionData[0].lat], // 中心点
-                zoom: 18, // 缩放级别
+                // zoom: 18, // 缩放级别
                 rotation: undefined, // 缩放完成view视图旋转弧度
                 // duration: 1000 // 缩放持续时间,默认不需要设置
             })

--
Gitblit v1.9.3