| | |
| | | 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]) |
| | |
| | | }) |
| | | mapView.getView().animate({ // 只设置需要的属性即可 |
| | | center: [positionData[0].lng, positionData[0].lat], // 中心点 |
| | | zoom: 18, // 缩放级别 |
| | | // zoom: 18, // 缩放级别 |
| | | rotation: undefined, // 缩放完成view视图旋转弧度 |
| | | // duration: 1000 // 缩放持续时间,默认不需要设置 |
| | | }) |