不规则框选

This commit is contained in:
于秀圆 2022-09-29 18:19:24 +08:00
parent 057b926183
commit bcbafaf9f0
4 changed files with 180 additions and 71 deletions

View File

@ -105,9 +105,5 @@ export function getCameraInfoByAreaId(params) {
}
//-
export function getCameraByCondition(params) {
return axios.get(
'http://10.134.135.92:9537/data_service/getCamera/getCameraByCondition?' +
params,
config2
)
return axios.post('http://10.134.135.92:9537/data_service/getCamera/getCameraByCondition', params, config2)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -413,7 +413,7 @@
<div class="contentNum">
<p>
备选
<span>{{ pagination.total }}</span>
<span>{{ pagination.total || 0 }}</span>
</p>
<!-- <i class="boundary"></i> -->
@ -941,9 +941,16 @@
mapSearchParam.value.gpsX = param.gpsX
mapSearchParam.value.gpsY = param.gpsY
mapSearchParam.value.radius = param.radius
mapSearchParam.value.type = param.type
mapSearchParam.value.borderPolygonList = param.borderPolygonList
mapSearchParam.value.pageSize = param.type!=0?20000:10
selectedRowKeys.value = [] //
selectedList.value = []
getCamera()
dataSource.value = param.dataSource
pagination.value.total = param.total
// getCamera()
})
//
mybus.off('pointMarkerClick')
@ -1761,6 +1768,7 @@
videoList.value = []
pagination.value.current = 1
mapSearchParam.value.pageNum = 1
mapSearchParam.value.type = 0
pagination.value.pageSize = 10
getCamera()
}
@ -1871,6 +1879,8 @@
latitude: mapSearchParam.value.gpsY || '',
radius: mapSearchParam.value.radius || '',
name: mapSearchParam.value.cameraName,
type: mapSearchParam.value.type,
borderPolygonList: mapSearchParam.value.borderPolygonList || [],
}
// todo-
// if (
@ -1880,22 +1890,22 @@
// ) {
// params.status = ''
// }
let paramsFather = ''
let i = 1
for (var key in params) {
if (params[key] === '') {
delete params[key]
} else {
if (i != 1) {
paramsFather += `&${key}=` + params[key]
i += 1
} else if (i == 1) {
paramsFather += `${key}=` + params[key]
i += 1
}
}
}
getCameraByCondition(paramsFather).then((res) => {
// let paramsFather = ''
// let i = 1
// for (var key in params) {
// if (params[key] === '') {
// delete params[key]
// } else {
// if (i != 1) {
// paramsFather += `&${key}=` + params[key]
// i += 1
// } else if (i == 1) {
// paramsFather += `${key}=` + params[key]
// i += 1
// }
// }
// }
getCameraByCondition(params).then((res) => {
dataSource.value = res.data.data
pagination.value.total = res.data.count
console.log('根据parent查询摄像头', res.data.data)

View File

@ -65,6 +65,8 @@
data-spm-anchor-id="a313x.7781069.0.i0"
></path>
</svg>
<img class="icon-poylon" @click="areaMode()" src="~@/supermap/image/icon-poylon.png">
</div>
<video-play
v-if="openVideo"
@ -92,6 +94,7 @@
} from '@/api/videoSurveillance'
import { getCameraByCondition } from '@/api/file'
import mybus from '@/myplugins/mybus'
import * as turf from '@turf/turf';
export default {
data() {
@ -112,6 +115,7 @@
openVideo: false,
channelCode: [],
circleModeFlag: false,
areaModeFlag: false,
addressMatchUrl: '',
address: '',
whoShow1: whoShow,
@ -124,6 +128,8 @@
gpsX: '',
gpsY: '',
radius: '',
borderPolygonList: [],
type: 0, //012
},
pointAllData:[],
}
@ -162,7 +168,7 @@
//
mybus.off('selectTablePoint')
mybus.on('selectTablePoint', (pointlist) => {
console.log("mounted -> pointlist", pointlist)
console.log("mounted -> pointlist", pointlist);
for(let i=0;i<this.pointAllData.length;i++){
this.pointAllData[i].active = false
for(let j=0;j<pointlist.length;j++){
@ -184,6 +190,46 @@
}
this.hiMapFun.mapFlyTo(latLng)
},
//
areaSelectResource(){
//
L.drawLocal.draw.handlers.polygon.tooltip.start = '单击开始绘制形状'
L.drawLocal.draw.handlers.polygon.tooltip.cont = '单击继续绘制形状'
L.drawLocal.draw.handlers.polygon.tooltip.end =
'单击继续绘制形状,双击结束绘制'
this.hiMap.mapObj.map.off('draw:created')
this.hiMap.mapObj.drawPolygon.enable()
this.hiMap.mapObj.map.once('draw:created', (e) => {
const type = e.layerType
const circleLayer = e.layer
console.log('查询图层draw:created', e)
if (type === 'polygon') {
const polygonLayer = e.layer;
this.hiMap.mapObj.featureGroup.addLayer(polygonLayer);
this.hiMap.mapObj.layerGroup.set('rectangleSelectLayer', polygonLayer);
const arr = [];
const latlngs = []; //
polygonLayer._latlngs[0].map(item => {
// const bdLonLat = wgs84LL2bdLL();
arr.push(turf.point([item.lng, item.lat]));
latlngs.push([item.lat,item.lng])
});
const points = turf.featureCollection(arr);
const rect = turf.convex(points);
this.mapSearchParam.borderPolygonList = latlngs
this.mapSearchParam.type = 2
const params = {
borderPolygonList: latlngs,
type: this.mapSearchParam.type,
}
// mybus.emit('getListByMap', params);
this.getCameraByParentId('map');
console.log("areaSelectResource -> latlngs", latlngs)
}
})
},
//
circleSelectResource() {
L.drawLocal.draw.handlers.circle.tooltip.start = '请圈选区域'
@ -211,18 +257,20 @@
this.mapSearchParam.gpsX = e.layer._latlng.lng
this.mapSearchParam.gpsY = e.layer._latlng.lat
this.mapSearchParam.radius = radius
this.mapSearchParam.type = 1
const params = {
gpsX: this.mapSearchParam.gpsX,
gpsY: this.mapSearchParam.gpsY,
radius: radius,
type: this.mapSearchParam.type,
}
mybus.emit('getListByMap', params)
this.getCameraByParentId()
// mybus.emit('getListByMap', params)
this.getCameraByParentId('map')
}
}
})
},
getCameraByParentId() {
getCameraByParentId(type) {
if (!this.whoShow1.itShowXiHaiAn) {
debugger
getCameraByParentId(this.mapSearchParam).then((res) => {
@ -236,31 +284,42 @@
this.mapSearchParam.parentId ||
'70be8c5b664f4bcf869d82f2e8335051',
pageNum: this.mapSearchParam.pageNum,
pageSize: this.mapSearchParam.pageSize,
pageSize: this.mapSearchParam.type!=0?this.mapSearchParam.pageSize:10,
name: this.mapSearchParam.cameraName || '',
longitude: this.mapSearchParam.gpsX || '',
latitude: this.mapSearchParam.gpsY || '',
radius: this.mapSearchParam.radius || '',
type: this.mapSearchParam.type,
borderPolygonList: this.mapSearchParam.borderPolygonList || [],
}
let paramsFather = ''
let i = 1
for (var key in params) {
if (params[key] === '') {
delete params[key]
} else {
if (i != 1) {
paramsFather += `&${key}=` + params[key]
i += 1
} else if (i == 1) {
paramsFather += `${key}=` + params[key]
i += 1
}
}
}
getCameraByCondition(paramsFather).then((res) => {
// let paramsFather = ''
// let i = 1
// for (var key in params) {
// if (params[key] === '') {
// delete params[key]
// } else {
// if (i != 1) {
// paramsFather += `&${key}=` + params[key]
// i += 1
// } else if (i == 1) {
// paramsFather += `${key}=` + params[key]
// i += 1
// }
// }
// }
getCameraByCondition(params).then((res) => {
console.log('根据parent查询摄像头', res.data.data)
this.pointAllData = res.data.data
this.addResourceTomap('videoMap', res.data.data)
if(type=='map'){
let params = this.mapSearchParam;
params.dataSource = res.data.data||0;
params.total = res.data.count||0;
mybus.emit('getListByMap', params);
}
this.pointAllData = res.data.data;
if(this.mapSearchParam.type!=0)
this.addResourceTomap('videoMap', res.data.data)
else
this.addResourceTomap('videoMap', []) //
})
}
},
@ -271,28 +330,66 @@
this.addressMatchUrl
)
},
areaMode(){
//
if(this.circleModeFlag){
this.resetCircle();
this.circleModeFlag = false;
}
this.areaModeFlag = !this.areaModeFlag;
if (this.areaModeFlag) {
//
this.areaSelectResource()
} else {
this.resetArea();
}
},
circleMode() {
if(this.areaModeFlag){
this.resetArea();
this.areaModeFlag = false;
}
//
this.circleModeFlag = !this.circleModeFlag
if (this.circleModeFlag) {
//
this.circleSelectResource()
} else {
//
this.hiMapFun.removeLayerByLayerName('circlePloygonLayer')
//
this.mapSearchParam.gpsX = ''
this.mapSearchParam.gpsY = ''
this.mapSearchParam.radius = ''
this.getCameraByParentId()
const params = {
gpsX: this.mapSearchParam.gpsX,
gpsY: this.mapSearchParam.gpsY,
radius: this.mapSearchParam.radius,
}
mybus.emit('getListByMap', params)
this.resetCircle();
}
},
resetCircle(){
//
this.hiMapFun.removeLayerByLayerName('circlePloygonLayer')
//
this.mapSearchParam.gpsX = ''
this.mapSearchParam.gpsY = ''
this.mapSearchParam.radius = ''
this.mapSearchParam.type = 0;
const params = {
gpsX: this.mapSearchParam.gpsX,
gpsY: this.mapSearchParam.gpsY,
radius: this.mapSearchParam.radius,
type: this.mapSearchParam.type
}
this.getCameraByParentId('map')
// mybus.emit('getListByMap', params);
},
resetArea(){
//
this.hiMapFun.removeLayerByLayerName('rectangleSelectLayer');
//
this.mapSearchParam.borderPolygonList = [];
this.mapSearchParam.type = 0;
const params = {
borderPolygonList: this.mapSearchParam.borderPolygonList,
type: this.mapSearchParam.type
}
this.getCameraByParentId('map')
// mybus.emit('getListByMap', params);
},
//
async searchAddressByKeyWord(queryString, cb, indexX) {
this.disasterPointIndex = indexX
@ -367,17 +464,19 @@
addResourceTomap(type, data) {
const dataEvent = []
data.forEach((item) => {
const arr = [0, 0.0, '', '0', '0.0']
if (arr.indexOf(item.gpsX) == -1) {
dataEvent.push({
latLng: { lat: Number(item.gpsY), lng: Number(item.gpsX) },
data: item,
active: item.active,
type: 'videoSurveillance',
})
}
})
if(data&&data.length>0){
data.forEach((item) => {
const arr = [0, 0.0, '', '0', '0.0']
if (arr.indexOf(item.gpsX) == -1) {
dataEvent.push({
latLng: { lat: Number(item.gpsY), lng: Number(item.gpsX) },
data: item,
active: item.active,
type: 'videoSurveillance',
})
}
})
}
console.log('上图数据', dataEvent)
this.getMapPoint(dataEvent, 'icon_camare.png', type)
},
@ -560,13 +659,17 @@
.leaflet-control-attribution {
display: none;
}
svg {
svg,.icon-poylon {
position: absolute;
bottom: 0.1rem;
right: 0.1rem;
z-index: 988;
cursor: pointer;
}
.icon-poylon {
width: 0.46rem;
bottom: 0.6rem;
}
.address-auto-complete-input {
width: 2.4rem;
}