保安服务企业管理项目备份
zhongrj
2024-05-24 f2a74b0b28b74dc29be85ec8e6328bdd262f84b9
src/views/check/components/OlMapBox.vue
@@ -134,7 +134,7 @@
                layers: [],
                view: new OlView({
                    // 初始化中心点坐标,经纬度一会自己换一下
                    center: [114.89844546788195, 25.861142035590277],
                   center: [112.85857823133, 35.496284586473],
                    zoom: 18,
                    projection: "EPSG:4326"
                }),
@@ -255,11 +255,11 @@
            }
            if (params.url) {
              styleOptions.image = new Icon({
                scale: params.scale || 1,
                imgSize: params.imgSize || [32, 32],
                src: params.url,
              })
                styleOptions.image = new Icon({
                    scale: params.scale || 1,
                    imgSize: params.imgSize || [32, 32],
                    src: params.url,
                })
            }
            if (params.text) {
@@ -325,7 +325,7 @@
        // 添加聚合图层的新模式,水库点分布
        mapAddClusterLayer (layerName, imgUrl, positionData, incident = (e) => { }, type = '') {
            const that = this
            console.log(layersObjcect,layerName,positionData,"+++++++++++++")
            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])
@@ -411,7 +411,7 @@
            })
            mapView.getView().animate({ // 只设置需要的属性即可
                center: [positionData[0].lng, positionData[0].lat], // 中心点
                zoom: 18, // 缩放级别
                // zoom: 18, // 缩放级别
                rotation: undefined, // 缩放完成view视图旋转弧度
                // duration: 1000 // 缩放持续时间,默认不需要设置
            })
@@ -466,8 +466,8 @@
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #cccccc;
    bottom: 130px;
    left: -114px;
    bottom: 34px;
    left: -46px;
    min-width: 300px;
}