From e2c9365138e3b9a2bcf046dbda9438458ea6073b Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Sat, 23 Dec 2023 14:25:21 +0800
Subject: [PATCH] 图片大小修改

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

diff --git a/src/views/check/components/OlMapBox.vue b/src/views/check/components/OlMapBox.vue
index 47e6f27..6164b1a 100644
--- a/src/views/check/components/OlMapBox.vue
+++ b/src/views/check/components/OlMapBox.vue
@@ -134,7 +134,7 @@
                 layers: [],
                 view: new OlView({
                     // 初始化中心点坐标,经纬度一会自己换一下
-                    center: [113, 24],
+                    center: [114.89844546788195, 25.861142035590277],
                     zoom: 18,
                     projection: "EPSG:4326"
                 }),
@@ -255,11 +255,11 @@
             }
 
             if (params.url) {
-                styleOptions.image = new Icon({
-                    scale: params.scale || 1,
-                    imgSize: params.imgSize || [160, 221],
-                    src: params.url,
-                })
+              styleOptions.image = new Icon({
+                scale: params.scale || 1,
+                imgSize: params.imgSize || [32, 32],
+                src: params.url,
+              })
             }
 
             if (params.text) {
@@ -284,8 +284,8 @@
                     }),
                     padding: [2, 5, 2, 5],
                     stroke: new Stroke({ color: '#00000000', width: 1 }),
-                    offsetX: -60,
-                    offsetY: -60
+                    // offsetX: -60,
+                    offsetY: 30
                 })
             }
 
@@ -325,7 +325,7 @@
         // 添加聚合图层的新模式,水库点分布
         mapAddClusterLayer (layerName, imgUrl, positionData, incident = (e) => { }, type = '') {
             const that = this
-
+            console.log(layersObjcect,layerName,positionData,"+++++++++++++")
             if (!layersObjcect[layerName]) {
                 if (type == 'cluster') {
                     let source = new VectorSource()
@@ -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])
@@ -404,7 +404,7 @@
                     item,
                     lng: item.lng,
                     lat: item.lat,
-                    text: item.text,
+                    text: item.realName,
                     url: imgUrl,
                     event: incident
                 }))

--
Gitblit v1.9.3