From 517ad1037d4cbfb409caeaaef2a55c73ba817320 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Mon, 17 Apr 2023 10:24:45 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E4=BF=AE=E6=94=B9=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../host-config/host-config.component.ts | 44 +++++++++++++--- .../image-label/image-label.component.ts | 52 +++++++++---------- 2 files changed, 62 insertions(+), 34 deletions(-) diff --git a/src/app/system-management/host-config/host-config.component.ts b/src/app/system-management/host-config/host-config.component.ts index 75871df..2eb9b68 100644 --- a/src/app/system-management/host-config/host-config.component.ts +++ b/src/app/system-management/host-config/host-config.component.ts @@ -291,7 +291,7 @@ export class HostConfigComponent implements OnInit { nzClosable: false, nzFooter: null, nzWrapClassName: 'canvasContentBox', - nzMaskClosable:false, + nzMaskClosable: false, nzBodyStyle: { 'border-radius': '0px', padding: '0px', @@ -357,7 +357,7 @@ export class HostConfigComponent implements OnInit { copyListOfData = copyListOfData.filter((item, i) => { return item.isEnabled; }); - let config4 = `video_rate: 5 + let config4 = `video_rate: 3 inference_buffer_second: 10 sources:`; copyListOfData.forEach((item: any, index) => { @@ -942,8 +942,8 @@ ${newstr}class-id=0 // let producerObj = yaml.load(producer); // config4 = yaml.dump(producerObj, { lineWidth: -1 }); - config4 = producer - console.log() + config4 = producer; + console.log(); } else { //使用模板 config2 = `# The all in one config file. @@ -1344,10 +1344,11 @@ ${newstr}class-id=0 prefix: '/api/Objects/gas', }; this.listOfData.forEach((item: any) => { + let newRtsp = newUri(item.uri, item.user, item.password); if (item.type === 0) { let objitem: any = { nickName: '进出口', - rtsp: item.uri, + rtsp: newRtsp, areaName: item.name, }; if ( @@ -1363,7 +1364,7 @@ ${newstr}class-id=0 if (item.type === 1) { let objitem: any = { nickName: '加油区', - rtsp: item.uri, + rtsp: newRtsp, areaName: item.name, }; if ( @@ -1379,7 +1380,7 @@ ${newstr}class-id=0 if (item.type === 2) { let objitem: any = { nickName: '卸油区', - rtsp: item.uri, + rtsp: newRtsp, areaName: item.name, }; if ( @@ -1403,6 +1404,21 @@ ${newstr}class-id=0 item.dimensionedPointsHuanghaiObj.unloadingROI[0].height, ]; } + + if ( + item.dimensionedPointsHuanghaiObj && + item.dimensionedPointsHuanghaiObj.pecROI + ) { + objitem.pecROI = [ + item.dimensionedPointsHuanghaiObj.pecROI[0].x, + item.dimensionedPointsHuanghaiObj.pecROI[0].y, + item.dimensionedPointsHuanghaiObj.pecROI[0].x + + item.dimensionedPointsHuanghaiObj.pecROI[0].width, + item.dimensionedPointsHuanghaiObj.pecROI[0].y + + item.dimensionedPointsHuanghaiObj.pecROI[0].height, + ]; + } + if ( item.dimensionedPointsHuanghaiObj && item.dimensionedPointsHuanghaiObj.carStopROI @@ -1416,7 +1432,7 @@ ${newstr}class-id=0 if (item.type === 3) { let objitem: any = { nickName: '便利店', - rtsp: item.uri, + rtsp: newRtsp, areaName: item.name, }; if ( @@ -1441,5 +1457,17 @@ ${newstr}class-id=0 arr.push([data[0].x, data[0].y]); return arr; } + + function newUri(uri, admin, password) { + let endIndex = uri.indexOf('//') + 2; + return ( + uri.slice(0, endIndex) + + admin + + ':' + + password + + '@' + + uri.slice(endIndex) + ); + } } } diff --git a/src/app/system-management/image-label/image-label.component.ts b/src/app/system-management/image-label/image-label.component.ts index 9d85f8a..df8d88c 100644 --- a/src/app/system-management/image-label/image-label.component.ts +++ b/src/app/system-management/image-label/image-label.component.ts @@ -199,13 +199,13 @@ export class ImageLabelComponent implements OnInit { //绘制人,灭火器,隔离锥矩形 if ( - this.camerasData.dimensionedPointsHuanghai.xxxROI && - this.camerasData.dimensionedPointsHuanghai.xxxROI.length !== 0 + this.camerasData.dimensionedPointsHuanghai.pecROI && + this.camerasData.dimensionedPointsHuanghai.pecROI.length !== 0 ) { - this.xxxROIOblongPoints = - this.camerasData.dimensionedPointsHuanghai.xxxROI; - this.xxxROIDrawOblong( - this.camerasData.dimensionedPointsHuanghai.xxxROI, + this.pecROIOblongPoints = + this.camerasData.dimensionedPointsHuanghai.pecROI; + this.pecROIDrawOblong( + this.camerasData.dimensionedPointsHuanghai.pecROI, context ); } @@ -279,7 +279,7 @@ export class ImageLabelComponent implements OnInit { ); }; } else if (this.selectedBtn === '人') { - if (this.xxxROIOblongPoints.length === 1) { + if (this.pecROIOblongPoints.length === 1) { //限制数量 this.message.create('warning', '人,灭火器,隔离椎只允许绘制1个!'); return; @@ -294,7 +294,7 @@ export class ImageLabelComponent implements OnInit { var moveX = ev.pageX - canvas.offsetLeft; var moveY = ev.pageY - canvas.offsetTop; - this.xxxROIDrawOblong(this.xxxROIOblongPoints, context); + this.pecROIDrawOblong(this.pecROIOblongPoints, context); context.strokeStyle = 'black'; let element = this.getOblongInfo( this.downx, @@ -343,7 +343,7 @@ export class ImageLabelComponent implements OnInit { if ( this.markType === 2 && this.selectedBtn === '人' && - this.xxxROIOblongPoints.length === 1 + this.pecROIOblongPoints.length === 1 ) { return; } @@ -358,8 +358,8 @@ export class ImageLabelComponent implements OnInit { var upX = e.pageX - canvas.offsetLeft; var upY = e.pageY - canvas.offsetTop; let point = this.getOblongInfo(this.downx, this.downy, upX, upY); - this.xxxROIOblongPoints.push(point); - this.xxxROIDrawOblong(this.xxxROIOblongPoints, context); + this.pecROIOblongPoints.push(point); + this.pecROIDrawOblong(this.pecROIOblongPoints, context); } }; } @@ -392,8 +392,8 @@ export class ImageLabelComponent implements OnInit { ); } //重绘人,灭火器,隔离椎 - if (this.xxxROIOblongPoints && this.xxxROIOblongPoints.length != 0) { - this.redrawRectangle(this.xxxROIOblongPoints, context, 'black'); + if (this.pecROIOblongPoints && this.pecROIOblongPoints.length != 0) { + this.redrawRectangle(this.pecROIOblongPoints, context, 'black'); } oblongList.forEach((element) => { @@ -407,8 +407,8 @@ export class ImageLabelComponent implements OnInit { } //人,灭火器,隔离椎矩形 - xxxROIOblongPoints = []; //矩形的点的集合 - xxxROIDrawOblong(oblongList, context) { + pecROIOblongPoints = []; //矩形的点的集合 + pecROIDrawOblong(oblongList, context) { context.clearRect(0, 0, this.canvasWidth, this.canvasHeight); this.copyCanvas ? context.putImageData(this.copyCanvas, 0, 0) : null; @@ -531,8 +531,8 @@ export class ImageLabelComponent implements OnInit { this.redrawRectangle(this.unloadingROIOblongPoints, context, 'orange'); } //重绘人,灭火器,隔离椎 - if (this.xxxROIOblongPoints && this.xxxROIOblongPoints.length != 0) { - this.redrawRectangle(this.xxxROIOblongPoints, context, 'black'); + if (this.pecROIOblongPoints && this.pecROIOblongPoints.length != 0) { + this.redrawRectangle(this.pecROIOblongPoints, context, 'black'); } //遍历数组画圆 var circle = { @@ -630,8 +630,8 @@ export class ImageLabelComponent implements OnInit { this.redrawRectangle(this.unloadingROIOblongPoints, context, 'orange'); } //重绘人,灭火器,隔离椎 - if (this.xxxROIOblongPoints && this.xxxROIOblongPoints.length != 0) { - this.redrawRectangle(this.xxxROIOblongPoints, context, 'black'); + if (this.pecROIOblongPoints && this.pecROIOblongPoints.length != 0) { + this.redrawRectangle(this.pecROIOblongPoints, context, 'black'); } //遍历数组画圆 var circle = { @@ -861,7 +861,7 @@ export class ImageLabelComponent implements OnInit { let canvas = document.getElementById('canvas') as any; let context = canvas.getContext('2d'); this.unloadingROIOblongPoints = []; //矩形的点的集合 - this.xxxROIOblongPoints = []; //矩形的点的集合 + this.pecROIOblongPoints = []; //矩形的点的集合 //停车区多边形 this.carStopROIPoints = []; //线段的点的集合 this.carStopROICircles = []; //可拖动圆圈的点的集合 @@ -914,8 +914,8 @@ export class ImageLabelComponent implements OnInit { this.unloadingROIOblongPoints = []; this.redrawAll(); } - if (type === 'xxxROI') { - this.xxxROIOblongPoints = []; + if (type === 'pecROI') { + this.pecROIOblongPoints = []; this.redrawAll(); } } else { @@ -945,7 +945,7 @@ export class ImageLabelComponent implements OnInit { this.redrawRectangle(this.unloadingROIOblongPoints, this.context, 'orange'); - this.redrawRectangle(this.xxxROIOblongPoints, this.context, 'black'); + this.redrawRectangle(this.pecROIOblongPoints, this.context, 'black'); } //根据已有数据重绘多边形 @@ -1002,7 +1002,7 @@ export class ImageLabelComponent implements OnInit { cashierROI: [], unloadingROI: [], bulkoilROI: [], - xxxROI: [], + pecROI: [], }; } //进出口 @@ -1040,8 +1040,8 @@ export class ImageLabelComponent implements OnInit { this.intrusionROIPoints; this.camerasData.dimensionedPointsHuanghai.unloadingROI = this.unloadingROIOblongPoints; - this.camerasData.dimensionedPointsHuanghai.xxxROI = - this.xxxROIOblongPoints; + this.camerasData.dimensionedPointsHuanghai.pecROI = + this.pecROIOblongPoints; } //便利店 if (this.markType === 3) {