临时提交
This commit is contained in:
@@ -148,6 +148,8 @@ public class VideoManagerConstants {
|
||||
public static final String VM_MSG_SUBSCRIBE_DEVICE_STATUS = "device";
|
||||
|
||||
|
||||
|
||||
|
||||
//************************** 第三方 ****************************************
|
||||
|
||||
public static final String WVP_STREAM_GB_ID_PREFIX = "memberNo_";
|
||||
|
||||
@@ -642,4 +642,6 @@ public interface CommonGBChannelMapper {
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListInPolygonForKingBase", databaseId = "postgresql")
|
||||
List<CameraChannel> queryListInPolygon(@Param("pointList") List<Point> pointList, @Param("level") Integer level, @Param("groupList") List<CameraGroup> groupList);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListForSyMobile")
|
||||
List<CameraChannel> queryListForSyMobile(@Param("business") String business);
|
||||
}
|
||||
|
||||
@@ -820,4 +820,9 @@ public class ChannelProvider {
|
||||
sqlBuild.append(" )");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryListForSyMobile(Map<String, Object> params ){
|
||||
return BASE_SQL_FOR_CAMERA_DEVICE +
|
||||
" WHERE wdc.gb_ptz_type = 99 AND coalesce(gb_business_group_id, business_group_id) = #{business}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class CameraChannelController {
|
||||
@Parameter(name = "geoCoordSys", description = "坐标系类型:WGS84,GCJ02、BD09")
|
||||
@Parameter(name = "status", description = "摄像头状态")
|
||||
public PageInfo<CameraChannel> queryListWithChild(@RequestParam(required = false, value = "page", defaultValue = "1" )Integer page,
|
||||
@RequestParam(required = false, value = "page", defaultValue = "100")Integer count,
|
||||
@RequestParam(required = false, value = "count", defaultValue = "100")Integer count,
|
||||
@RequestParam(required = false) String query,
|
||||
@RequestParam(required = false) String sortName,
|
||||
@RequestParam(required = false) Boolean order,
|
||||
@@ -262,10 +262,19 @@ public class CameraChannelController {
|
||||
result.setResult(wvpResult);
|
||||
});
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
@GetMapping(value = "/camera/list-for-mobile")
|
||||
@ResponseBody
|
||||
@Operation(summary = "查询移动设备摄像机列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "page", description = "当前页")
|
||||
@Parameter(name = "count", description = "每页查询数量")
|
||||
@Parameter(name = "topGroupAlias", description = "分组别名")
|
||||
public PageInfo<CameraChannel> queryListForMobile(@RequestParam(required = false, value = "page", defaultValue = "1" )Integer page,
|
||||
@RequestParam(required = false, value = "count", defaultValue = "100")Integer count,
|
||||
String topGroupAlias){
|
||||
|
||||
|
||||
return channelService.queryListForMobile(page, count, topGroupAlias);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class CameraChannelService implements CommandLineRunner {
|
||||
public PageInfo<CameraChannel> queryList(Integer page, Integer count, String groupAlias, Boolean status, String geoCoordSys) {
|
||||
// 构建组织结构信息
|
||||
Group group = groupMapper.queryGroupByAlias(groupAlias);
|
||||
Assert.notNull(group, "获取组织结构失败");
|
||||
Assert.notNull(group, "组织结构不存在");
|
||||
String groupDeviceId = group.getDeviceId();
|
||||
|
||||
// 构建分页
|
||||
@@ -125,7 +125,7 @@ public class CameraChannelService implements CommandLineRunner {
|
||||
public PageInfo<CameraChannel> queryListWithChild(Integer page, Integer count, String query, String sortName, Boolean order, String groupAlias, Boolean status, String geoCoordSys) {
|
||||
// 构建组织结构信息
|
||||
CameraGroup group = groupMapper.queryGroupByAlias(groupAlias);
|
||||
Assert.notNull(group, "获取组织结构失败");
|
||||
Assert.notNull(group, "组织结构不存在");
|
||||
String groupDeviceId = group.getDeviceId();
|
||||
// 获取所有子节点
|
||||
List<CameraGroup> groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup());
|
||||
@@ -346,7 +346,7 @@ public class CameraChannelService implements CommandLineRunner {
|
||||
public List<CameraChannel> queryListInBox(Double minLongitude, Double maxLongitude, Double minLatitude, Double maxLatitude, Integer level, String groupAlias, String geoCoordSys) {
|
||||
// 构建组织结构信息
|
||||
CameraGroup group = groupMapper.queryGroupByAlias(groupAlias);
|
||||
Assert.notNull(group, "获取组织结构失败");
|
||||
Assert.notNull(group, "组织结构不存在");
|
||||
// 获取所有子节点
|
||||
List<CameraGroup> groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup());
|
||||
groupList.add(group);
|
||||
@@ -380,7 +380,7 @@ public class CameraChannelService implements CommandLineRunner {
|
||||
public List<CameraChannel> queryListInCircle(Double centerLongitude, Double centerLatitude, Double radius, Integer level, String groupAlias, String geoCoordSys) {
|
||||
// 构建组织结构信息
|
||||
CameraGroup group = groupMapper.queryGroupByAlias(groupAlias);
|
||||
Assert.notNull(group, "获取组织结构失败");
|
||||
Assert.notNull(group, "组织结构不存在");
|
||||
// 获取所有子节点
|
||||
List<CameraGroup> groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup());
|
||||
groupList.add(group);
|
||||
@@ -407,7 +407,7 @@ public class CameraChannelService implements CommandLineRunner {
|
||||
public List<CameraChannel> queryListInPolygon(List<Point> pointList, String groupAlias, Integer level, String geoCoordSys) {
|
||||
// 构建组织结构信息
|
||||
CameraGroup group = groupMapper.queryGroupByAlias(groupAlias);
|
||||
Assert.notNull(group, "获取组织结构失败");
|
||||
Assert.notNull(group, "组织结构不存在");
|
||||
// 获取所有子节点
|
||||
List<CameraGroup> groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup());
|
||||
groupList.add(group);
|
||||
@@ -431,4 +431,19 @@ public class CameraChannelService implements CommandLineRunner {
|
||||
List<CameraChannel> all = channelMapper.queryListInPolygon(pointList, level, groupList);
|
||||
return addIconPathAndPositionForCameraChannelList(all, geoCoordSys);
|
||||
}
|
||||
|
||||
public PageInfo<CameraChannel> queryListForMobile(Integer page, Integer count, String topGroupAlias) {
|
||||
|
||||
CameraGroup cameraGroup = groupMapper.queryGroupByAlias(topGroupAlias);
|
||||
Assert.notNull(cameraGroup, "组织结构不存在");
|
||||
|
||||
// 构建分页
|
||||
PageHelper.startPage(page, count);
|
||||
|
||||
List<CameraChannel> all = channelMapper.queryListForSyMobile(cameraGroup.getDeviceId());
|
||||
PageInfo<CameraChannel> groupPageInfo = new PageInfo<>(all);
|
||||
List<CameraChannel> list = addIconPathAndPositionForCameraChannelList(groupPageInfo.getList(), null);
|
||||
groupPageInfo.setList(list);
|
||||
return groupPageInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +138,9 @@ export default {
|
||||
features = {}
|
||||
layer = {}
|
||||
})
|
||||
olMap.getView().on('change:resolution', ()=> {
|
||||
console.log(olMap.getView().getZoom())
|
||||
})
|
||||
},
|
||||
setCenter(point) {
|
||||
|
||||
@@ -250,9 +253,12 @@ export default {
|
||||
* @param data
|
||||
* @param clickEvent
|
||||
*/
|
||||
addPointLayer(data, clickEvent) {
|
||||
addPointLayer(data, clickEvent, option) {
|
||||
console.log(option.minZoom + ' ========= ' + data.length)
|
||||
if (data.length > 0) {
|
||||
const features = []
|
||||
let maxZoom = option.maxZoom | olMap.getView().getMaxZoom()
|
||||
let minZoom = option.minZoom | olMap.getView().getMinZoom()
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const feature = new Feature(new Point(fromLonLat(data[i].position)))
|
||||
feature.setId(data[i].id)
|
||||
@@ -272,7 +278,9 @@ export default {
|
||||
const vectorLayer = new VectorLayer({
|
||||
source: source,
|
||||
renderMode: 'image',
|
||||
declutter: false
|
||||
declutter: false,
|
||||
maxZoom: maxZoom,
|
||||
minZoom: minZoom
|
||||
})
|
||||
olMap.addLayer(vectorLayer)
|
||||
if (typeof clickEvent === 'function') {
|
||||
@@ -311,7 +319,7 @@ export default {
|
||||
if (postponement) {
|
||||
olMap.removeLayer(layer)
|
||||
setTimeout(() => {
|
||||
olMap.addPointLayer(layer)
|
||||
olMap.addLayer(layer)
|
||||
}, 100)
|
||||
}
|
||||
return layer
|
||||
@@ -372,7 +380,7 @@ export default {
|
||||
const vectorLayer = new VectorLayer({
|
||||
source: source
|
||||
})
|
||||
olMap.addPointLayer(vectorLayer)
|
||||
olMap.addLayer(vectorLayer)
|
||||
return vectorLayer
|
||||
}
|
||||
},
|
||||
@@ -392,6 +400,9 @@ export default {
|
||||
olMap.getView().setCenter(fromLonLat(center))
|
||||
}
|
||||
},
|
||||
getZoomExtent(){
|
||||
return [olMap.getView().getMinZoom(), olMap.getView().getMaxZoom()]
|
||||
},
|
||||
/**
|
||||
* 根据距离计算经纬度差值,方便前端抽稀计算
|
||||
* @param distance 距离, 单位:像素值
|
||||
@@ -401,17 +412,58 @@ export default {
|
||||
if (!distance) {
|
||||
return []
|
||||
}
|
||||
let resolution;
|
||||
let resolution
|
||||
if (!zoom) {
|
||||
resolution = olMap.getView().getResolution()
|
||||
}else {
|
||||
resolution = olMap.getView().getResolutionForZoom(zoom)
|
||||
}
|
||||
let diff = resolution * distance
|
||||
let position = toLonLat([diff, diff])
|
||||
console.log(position)
|
||||
|
||||
return toLonLat([diff, diff])[0]
|
||||
|
||||
|
||||
// let extent = olMap.getView().calculateExtent(olMap.getSize())
|
||||
//
|
||||
//
|
||||
// let minLng = extent[0]
|
||||
// let maxLng = extent[2]
|
||||
// let minLat = extent[1]
|
||||
// let maxLat = extent[3]
|
||||
//
|
||||
// let style = new Style({
|
||||
// stroke: new Stroke({
|
||||
// width: 1,
|
||||
// color: 'rgba(65,65,65,0.8)'
|
||||
// })
|
||||
// })
|
||||
// const source = new VectorSource()
|
||||
// let lng = minLng
|
||||
// while (lng <= maxLng) {
|
||||
//
|
||||
// const points = [[lng, minLat], [lng, maxLat]]
|
||||
// const line = new LineString(points)
|
||||
// const lineFeature = new Feature(line)
|
||||
// lineFeature.setStyle(style)
|
||||
// source.addFeature(lineFeature)
|
||||
// lng += diff
|
||||
// }
|
||||
//
|
||||
// let lat = minLat
|
||||
// while (lat <= maxLat) {
|
||||
//
|
||||
// const points = [[minLng, lat], [maxLng, lat]]
|
||||
// console.log(points)
|
||||
// const line = new LineString(points)
|
||||
// const lineFeature = new Feature(line)
|
||||
// lineFeature.setStyle(style)
|
||||
// source.addFeature(lineFeature)
|
||||
// lat += diff
|
||||
// }
|
||||
//
|
||||
// const vectorLayer = new VectorLayer({
|
||||
// source: source
|
||||
// })
|
||||
// olMap.addLayer(vectorLayer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,27 +32,31 @@
|
||||
</div>
|
||||
<div class="map-tool-box-top-left">
|
||||
<div class="map-tool-btn-group">
|
||||
<div class="map-tool-btn" title="图层抽稀" @click="drawThin">
|
||||
<i class="iconfont icon-mti-sandian"></i> <span>图层抽稀</span>
|
||||
</div>
|
||||
<div class="map-tool-btn" title="位置编辑" @click="testArray">
|
||||
<i class="el-icon-edit"></i> <span>位置编辑</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="map-tool-box-top-right">
|
||||
<div class="map-tool-btn-group">
|
||||
<div class="map-tool-btn" title="抽稀">
|
||||
<i class="iconfont icon-mti-sandian"></i>
|
||||
</div>
|
||||
<div class="map-tool-btn" title="聚合">
|
||||
<i class="iconfont icon-mti-jutai"></i>
|
||||
</div>
|
||||
<div class="map-tool-btn" title="默认">
|
||||
<i class="iconfont icon-mti-jutai"></i>
|
||||
</div>
|
||||
<el-dropdown >
|
||||
<div class="map-tool-btn" title="图层抽稀">
|
||||
<i class="iconfont icon-mti-sandian"></i> <span>图层抽稀</span>
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item @click.native="quicklyDrawThin">快速抽稀</el-dropdown-item>
|
||||
<el-dropdown-item>局部抽稀</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="map-tool-box-top-right">-->
|
||||
<!-- <div class="map-tool-btn-group">-->
|
||||
<!-- <div class="map-tool-btn" title="抽稀">-->
|
||||
<!-- <i class="iconfont icon-mti-sandian"></i>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="map-tool-btn" title="聚合">-->
|
||||
<!-- <i class="iconfont icon-mti-jutai"></i>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="map-tool-btn" title="默认">-->
|
||||
<!-- <i class="iconfont icon-mti-jutai"></i>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div ref="infobox">
|
||||
<transition name="el-zoom-in-center">
|
||||
<div class="infobox-content" v-if="channel">
|
||||
@@ -93,8 +97,9 @@ import DeviceTree from '../common/DeviceTree.vue'
|
||||
import queryTrace from './queryTrace.vue'
|
||||
import MapComponent from '../common/MapComponent.vue'
|
||||
import devicePlayer from '../common/channelPlayer/index.vue'
|
||||
import gcoord from 'gcoord'
|
||||
|
||||
let cameraLayerList = []
|
||||
let cameraLayerExtent = []
|
||||
export default {
|
||||
name: 'Map',
|
||||
components: {
|
||||
@@ -118,7 +123,8 @@ export default {
|
||||
isLoging: false,
|
||||
longitudeStr: 'longitude',
|
||||
latitudeStr: 'latitude',
|
||||
mapTileList: []
|
||||
mapTileList: [],
|
||||
diffPixels: 40
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -190,9 +196,30 @@ export default {
|
||||
// 获取所有有位置的通道
|
||||
this.closeInfoBox()
|
||||
this.$store.dispatch('commonChanel/getAllForMap', {}).then(data => {
|
||||
cameraLayerList = data
|
||||
let minLng, minLat, maxLng, maxLat
|
||||
let array = []
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let item = data[i]
|
||||
if (i === 0) {
|
||||
minLng = item.gbLongitude
|
||||
maxLng = item.gbLongitude
|
||||
minLat = item.gbLatitude
|
||||
maxLat = item.gbLatitude
|
||||
}else {
|
||||
if (item.gbLongitude < minLng) {
|
||||
minLng = item.gbLongitude
|
||||
}
|
||||
if (item.gbLongitude > maxLng) {
|
||||
maxLng = item.gbLongitude
|
||||
}
|
||||
if (item.gbLatitude < minLat) {
|
||||
minLat = item.gbLatitude
|
||||
}
|
||||
if (item.gbLatitude > maxLat) {
|
||||
maxLat = item.gbLatitude
|
||||
}
|
||||
}
|
||||
if (item.gbLongitude && item.gbLatitude) {
|
||||
let position = [item.gbLongitude, item.gbLatitude]
|
||||
array.push({
|
||||
@@ -206,7 +233,8 @@ export default {
|
||||
})
|
||||
}
|
||||
}
|
||||
this.updateChannelLayer(array)
|
||||
cameraLayerExtent = [minLng, minLat, maxLng, maxLat]
|
||||
// this.updateChannelLayer(array)
|
||||
})
|
||||
},
|
||||
changeMapTile: function (index) {
|
||||
@@ -259,7 +287,6 @@ export default {
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
})
|
||||
|
||||
},
|
||||
edit: function (channel) {
|
||||
this.closeInfoBox()
|
||||
@@ -389,12 +416,80 @@ export default {
|
||||
testArray: function (){
|
||||
this.$store.dispatch('commonChanel/test')
|
||||
},
|
||||
drawThin: function (){
|
||||
// 假设抽稀的距离
|
||||
let distance = 1000
|
||||
// 根据距离计算经纬度差值
|
||||
let diff = this.$refs.mapComponent.computeDiff(distance)
|
||||
quicklyDrawThin: function (){
|
||||
console.log(cameraLayerList.length)
|
||||
let allCameraList = cameraLayerList.slice()
|
||||
// 获取全部层级
|
||||
let zoomExtent = this.$refs.mapComponent.getZoomExtent()
|
||||
|
||||
let zoom = zoomExtent[0]
|
||||
let zoomCameraMap = new Map()
|
||||
let useCameraMap = new Map()
|
||||
|
||||
while (zoom < zoomExtent[1]) {
|
||||
|
||||
// 计算经纬度差值
|
||||
let diff = this.$refs.mapComponent.computeDiff(this.diffPixels, zoom)
|
||||
let cameraMap = new Map()
|
||||
|
||||
for (let i = 0; i < allCameraList.length; i++) {
|
||||
let value = allCameraList[i]
|
||||
if (useCameraMap.has(value.gbId) || !value.gbLongitude || !value.gbLatitude) {
|
||||
continue
|
||||
}
|
||||
let lngGrid = Math.trunc(value.gbLongitude / diff)
|
||||
let latGrid = Math.trunc(value.gbLatitude / diff)
|
||||
let gridKey = latGrid + ':' + lngGrid
|
||||
if (cameraMap.has(gridKey)) {
|
||||
let oldValue = cameraMap.get(gridKey)
|
||||
if (value.gbLongitude % diff < oldValue.gbLongitude % diff) {
|
||||
cameraMap.set(gridKey, value)
|
||||
useCameraMap.set(value.gbId, value)
|
||||
useCameraMap.delete(oldValue.gbId)
|
||||
}
|
||||
}else {
|
||||
cameraMap.set(gridKey, value)
|
||||
useCameraMap.set(value.gbId, value)
|
||||
}
|
||||
}
|
||||
|
||||
let cameraArray = Array.from(cameraMap.values())
|
||||
zoomCameraMap.set(zoom, cameraArray)
|
||||
this.addZoomLayer(cameraArray, zoom)
|
||||
zoom += 1
|
||||
}
|
||||
let cameraArray = []
|
||||
for (let i = 0; i < allCameraList.length; i++) {
|
||||
let value = allCameraList[i]
|
||||
if (useCameraMap.has(value.gbId) || !value.gbLongitude || !value.gbLatitude) {
|
||||
continue
|
||||
}
|
||||
cameraArray.push(value)
|
||||
|
||||
}
|
||||
this.addZoomLayer(cameraArray, zoomExtent[1])
|
||||
},
|
||||
|
||||
addZoomLayer(cameraArray, zoom) {
|
||||
let dataArray = []
|
||||
for (let i = 0; i < cameraArray.length; i++) {
|
||||
let item = cameraArray[i]
|
||||
let position = [item.gbLongitude, item.gbLatitude]
|
||||
dataArray.push({
|
||||
id: item.gbId,
|
||||
position: position,
|
||||
data: item,
|
||||
image: {
|
||||
anchor: [0.5, 1],
|
||||
src: this.getImageByChannel(item)
|
||||
}
|
||||
})
|
||||
}
|
||||
this.$refs.mapComponent.addPointLayer(dataArray, data => {
|
||||
|
||||
}, {
|
||||
minZoom: zoom
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user