| | |
| | | ) |
| | | }) |
| | | |
| | | mapView.getView().on('change:resolution', function () { |
| | | console.log('mapView地图缩放事件') |
| | | // that.$emit('getlivePersonLocationList') |
| | | }) |
| | | |
| | | that.baseInitLayer(that.mapType) |
| | | }) |
| | | }, |
| | |
| | | color: color |
| | | }), |
| | | padding: [2, 5, 2, 5], |
| | | stroke: new Stroke({ color: '#00000000', width: 1 }) |
| | | stroke: new Stroke({ color: '#00000000', width: 1 }), |
| | | offsetX: -60, |
| | | offsetY: -60 |
| | | }) |
| | | } |
| | | |
| | |
| | | layersObjcect[layerName] = new VectorLayer({ |
| | | // 图标图层 |
| | | zIndex: 24, |
| | | minZoom: 12, |
| | | // minZoom: 12, |
| | | source: new VectorSource(), |
| | | }) |
| | | } |
| | |
| | | item, |
| | | lng: item.lng, |
| | | lat: item.lat, |
| | | text: item.text, |
| | | url: imgUrl, |
| | | event: incident |
| | | })) |
| | | mapView.getView().animate({ // 只设置需要的属性即可 |
| | | center: [item.lng, item.lat], // 中心点 |
| | | zoom: 18, // 缩放级别 |
| | | rotation: undefined, // 缩放完成view视图旋转弧度 |
| | | duration: 1000 // 缩放持续时间,默认不需要设置 |
| | | }) |
| | | }) |
| | | |
| | | mapView.getView().animate({ // 只设置需要的属性即可 |
| | | center: [positionData[0].lng, positionData[0].lat], // 中心点 |
| | | zoom: 18, // 缩放级别 |
| | | rotation: undefined, // 缩放完成view视图旋转弧度 |
| | | // duration: 1000 // 缩放持续时间,默认不需要设置 |
| | | }) |
| | | }, |
| | | |
| | | // 生成地图弹窗 |
| | |
| | | |
| | | <template> |
| | | <div style="width: 100%; height: 100%;"> |
| | | <OlMapBox ref="olmapboxelement"></OlMapBox> |
| | | <OlMapBox ref="olmapboxelement" @getlivePersonLocationList="getlivePersonLocationList"></OlMapBox> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | res.data.data.forEach(item => { |
| | | item.lng = item.longitude |
| | | item.lat = item.latitude |
| | | item.text = item.realName |
| | | }) |
| | | this.$refs.olmapboxelement.mapAddClusterLayer('livePersonLocationLayer', 'img/map/security.png', res.data.data, this.livePersonIconClick) |
| | | }) |