From 14178b3a35b1636bca0852ba22b64e47339905db Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Wed, 20 Apr 2022 14:56:17 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E4=B8=89=E4=B8=AA=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.module.ts | 3 +- src/app/service/configFormData.service.ts | 10 + .../config-form/config-form.component.html | 2 +- .../config-form/config-form.component.ts | 318 ++---------------- .../host-config/host-config.component.ts | 300 ++++++++++++++++- 5 files changed, 334 insertions(+), 299 deletions(-) create mode 100644 src/app/service/configFormData.service.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index fb8575f..72a75de 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -13,6 +13,7 @@ import { NzMessageModule } from 'ng-zorro-antd/message'; import { TreeService } from './service/tree.service'; import { RouteReuseStrategy } from '@angular/router'; import { CustomReuseStrategy } from './CustomReuseStrategy'; +import { ConfigFormDataService } from './service/configFormData.service'; @NgModule({ declarations: [ AppComponent @@ -27,7 +28,7 @@ import { CustomReuseStrategy } from './CustomReuseStrategy'; NzNotificationModule, NzMessageModule ], - providers: [httpInterceptorProviders, CacheTokenService, TreeService, + providers: [httpInterceptorProviders, CacheTokenService, TreeService, ConfigFormDataService, { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }], bootstrap: [AppComponent] }) diff --git a/src/app/service/configFormData.service.ts b/src/app/service/configFormData.service.ts new file mode 100644 index 0000000..3f02089 --- /dev/null +++ b/src/app/service/configFormData.service.ts @@ -0,0 +1,10 @@ +import { Injectable } from '@angular/core'; + +@Injectable() +export class ConfigFormDataService { + tableData: any//摄像头列表数据 + config1: any//配置文件 + config2: any//配置文件 + config3: any//配置文件 + config4: any//配置文件 +} \ No newline at end of file diff --git a/src/app/system-management/config-form/config-form.component.html b/src/app/system-management/config-form/config-form.component.html index a22a44f..24bf306 100644 --- a/src/app/system-management/config-form/config-form.component.html +++ b/src/app/system-management/config-form/config-form.component.html @@ -10,6 +10,6 @@
- +
\ No newline at end of file diff --git a/src/app/system-management/config-form/config-form.component.ts b/src/app/system-management/config-form/config-form.component.ts index dcf7066..a35dffd 100644 --- a/src/app/system-management/config-form/config-form.component.ts +++ b/src/app/system-management/config-form/config-form.component.ts @@ -1,4 +1,7 @@ +import { HttpClient } from '@angular/common/http'; import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { ConfigFormDataService } from 'src/app/service/configFormData.service'; @Component({ selector: 'app-config-form', @@ -7,301 +10,36 @@ import { Component, OnInit } from '@angular/core'; }) export class ConfigFormComponent implements OnInit { - constructor() { } - + constructor(public configFormData: ConfigFormDataService, private http: HttpClient, private route: ActivatedRoute) { } + config1: string + config2: string + config3: string + config4: string + hostId//主机id + orId//加油站id ngOnInit(): void { + this.hostId = this.route.snapshot.queryParams.hostId + this.orId = this.route.snapshot.queryParams.orId + this.config1 = sessionStorage.getItem('config1') + this.config2 = sessionStorage.getItem('config2') + this.config3 = sessionStorage.getItem('config3') + this.config4 = sessionStorage.getItem('config4') } goback() { history.go(-1) } + putConfig() { + let body = { + configFiles: "string" + } + this.http.put(`/api​/EdgeDevices​/${this.hostId}`, body).subscribe({ + next: (data) => { - config1: string = `[property] - enable=1 - #Width height used for configuration to which below configs are configured - config-width=1980 - config-height=1080 - #osd-mode 0: Dont display any lines, rois and text - # 1: Display only lines, rois and static text i.e. labels - # 2: Display all info from 1 plus information about counts - osd-mode=2 - #Set OSD font size that has to be displayed - display-font-size=12 - - ## Per stream configuration - [roi-filtering-stream-0] - #chaoyang-out174 - #enable or disable following feature - enable=1 - #ROI to filter select objects, and remove from meta data - roi-RF=100;1080;1920;1080;1200;350;500;350 - #remove objects in the ROI - inverse-roi=0 - class-id=-1 - - # ## Per stream configuration - # [roi-filtering-stream-1] - # #chaoyang-out171 - # #enable or disable following feature - # enable=1 - # #ROI to filter select objects, and remove from meta data - # roi-RF=1493;782;1893;782;1796;1077;951;1080 - # #remove objects in the ROI - # inverse-roi=0 - # class-id=-1 - - # ## Per stream configuration - # [roi-filtering-stream-2] - # #chaoyang-out171 - # #enable or disable following feature - # enable=1 - # #ROI to filter select objects, and remove from meta data - # roi-RF=0;1080;1920;1080;1920;540;0;200 - # #remove objects in the ROI - # inverse-roi=0 - # class-id=-1 - - ## Per stream configuration - [roi-filtering-stream-3] - #chaoyang-out171 - #enable or disable following feature - enable=1 - #ROI to filter select objects, and remove from meta data - roi-RF= 0;0;0;0;0;0;0;0 - #remove objects in the ROI - inverse-roi=0 - class-id=-1 - - # ## Per stream configuration - # [roi-filtering-stream-4] - # #chaoyang-out181 - # #enable or disable following feature - # enable=1 - # #ROI to filter select objects, and remove from meta data - # roi-RF=200;0;650;0;650;500;200;500 - # #remove objects in the ROI - # inverse-roi=0 - # class-id=0 - - # ## Per stream configuration - # [roi-filtering-stream-5] - # #chaoyang-out181 - # #enable or disable following feature - # enable=1 - # #ROI to filter select objects, and remove from meta data - # roi-RF=930;93;1870;93;1870;1080;930;1080 - # #remove objects in the ROI - # inverse-roi=0 - # class-id=0 - - # ## Per stream configuration - # [roi-filtering-stream-6] - # #chaoyang-out166 - # #enable or disable following feature - # enable=1 - # #ROI to filter select objects, and remove from meta data - # roi-RF=1174;151;1920;151;1920;1080;1174;1080 - # #remove objects in the ROI - # inverse-roi=0 - # class-id=-1 - - # ## Per stream configuration - # [roi-filtering-stream-7] - # #chaoyang-out166 - # #enable or disable following feature - # enable=1 - # #ROI to filter select objects, and remove from meta data - # roi-RF=1450;300;1910;300;1910;950;1450;950 - # #remove objects in the ROI - # inverse-roi=0 - # class-id=-1 - - [line-crossing-stream-1] - enable=1 - #Label;direction;lc - line-crossing-Entry=1791;473;1570;845;1400;782;1893;782 - # line-crossing-Exit=789;672;1084;900;851;773;1203;732 - class-id=0 - #extended when 0- only counts crossing on the configured Line - # 1- assumes extended Line crossing counts all the crossing - extended=0 - #LC modes supported: - #loose : counts all crossing without strong adherence to direction - #balanced: Strict direction adherence expected compared to mode=loose - #strict : Strict direction adherence expected compared to mode=balanced - mode=loose - - [line-crossing-stream-3] - enable=1 - #Label;direction;lc - line-crossing-Entry=900;600;500;600;900;1080;550;300 - # line-crossing-Exit=789;672;1084;900;851;773;1203;732 - class-id=0 - #extended when 0- only counts crossing on the configured Line - # 1- assumes extended Line crossing counts all the crossing - extended=0 - #LC modes supported: - #loose : counts all crossing without strong adherence to direction - #balanced: Strict direction adherence expected compared to mode=loose - #strict : Strict direction adherence expected compared to mode=balanced - mode=loose` - config2: string = `# The all in one config file. - # RTSP sources - # type - # 0 ViolateArea.ENTRANCE, - # 1 ViolateArea.GAS_AREA, - # 2 ViolateArea.FUEL_AREA, - # 3 ViolateArea.MART, - # don't change the key name. - - debug: true #when the debug is on, osd. - - sources: - config: 'config/source.yaml' - - tracker: - config: 'config/dstest_tracker_config.txt' - - analytics: - config: 'config/config_nvdsanalytics.txt' - - peoplenet: - enable: true - apply_on: -1 - interval: 1 - batch_size: 16 - topk: 5 - roi-top-offset: 0 - roi-bottom-offset: 0 - detected-min-w: 20 - detected-min-h: 200 - - trafficcam: - enable: true - apply_on: 0 - interval: 1 - batch_size: 16 - topk: 5 - roi-top-offset: 0 - roi-bottom-offset: 0 - detected-min-w: 100 - detected-min-h: 100 - - actionnet: - enable: false - apply_on: 1 - # roi: - # - 'fuel_island-4': - # - [200, 0, 450, 500] - # - 'fuel_island-5': - # - [930, 93, 940, 987] - # - 'fuel_island-6': - # - [1174, 151, 746, 929] - # - 'fuel_island-7': - # - [1450, 300, 460, 650] - interval: 1 - batch_size: 32 - - idnet: - enable: true - apply_on: -1 - interval: 1 - batch_size: 32 - - oilnet: - enable: true - apply_on: 2 - interval: 1 - batch_size: 16 - topk: 5 - roi-top-offset: 0 - roi-bottom-offset: 0 - detected-min-w: 20 - detected-min-h: 20 - - smoke_fire_net: - enable: true - apply_on: -1 - interval: 1 - batch_size: 16 - - smoking_calling_net: - enable: true - apply_on: -1 - interval: 1 - batch_size: 32 - - connet: - enable: true - apply_on: 2 - roi: - - 'oil_tube-3': - - [270, 350, 600, 250] - - 'grounder-3': - - [290, 200, 580, 250] - interval: 1 - batch_size: 2 - - #new field for rule threshold - rule_threshold: - object_occurence_interval_second: 15 - object_disappear_interval_second: 60 - on_car_parking_interval_second: 1800 - threshold_relying_sitting: 0.4 #rolling mean confidence - threshold_smoking_calling: 0.8 #rolling mean confidence - threshold_connecting: 0.667 #rolling mean confidence - threshold_identity: 0.1 #only to filter out people net error` + }, + error: (err) => { + console.log('连接失败', err) + } + }) + } - config3: string = `logging_interval: 600 - test_action: true # trigger for imaging capturing, when set to False, image is captured based on fixed time interval, otherwise on rules` - config4: string = `#Chaoyang RTSP sources - video_rate: 5 - inference_buffer_second: 10 - sources: - - name: 'Sources 0' - user: 'admin' - password: 'a12345678' - uri: 'rtsp://10.28.91.170:554/Streaming/Channels/101?transportmode=unicast' - type: 0 - - - name: 'Sources 1' - user: 'admin' - password: 'Aa88888888' - uri: 'rtsp://10.28.91.174:554/Streaming/Channels/101?transportmode=unicast' - type: 3 - - - name: 'Sources 2' - user: 'admin' - password: 'a12345678' - uri: 'rtsp://10.28.91.164:554/Streaming/Channels/101?transportmode=unicast' - type: 0 - - - name: 'Sources 3' - user: 'admin' - password: 'Aa88888888' - uri: 'rtsp://10.28.91.133:554/Streaming/Channels/101?transportmode=unicast' - type: 2 - - - name: 'Sources 4' - user: 'admin' - password: 'Aa88888888' - uri: 'rtsp://10.28.91.171:554/Streaming/Channels/101?transportmode=unicast' - type: 1 - - - name: 'Sources 5' - user: 'admin' - password: 'Aa88888888' - uri: 'rtsp://10.28.91.181:554/Streaming/Channels/101?transportmode=unicast' - type: 1 - - - name: 'Sources 6' - user: 'admin' - password: 'Aa88888888' - uri: 'rtsp://10.28.91.166:554/Streaming/Channels/101?transportmode=unicast' - type: 1 - - - name: 'Sources 7' - user: 'admin' - password: 'a12345678' - uri: 'rtsp://10.28.91.161:554/Streaming/Channels/101?transportmode=unicast' - type: 1` } 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 07a3547..93538b7 100644 --- a/src/app/system-management/host-config/host-config.component.ts +++ b/src/app/system-management/host-config/host-config.component.ts @@ -8,6 +8,7 @@ import { NzMessageService } from 'ng-zorro-antd/message'; import { HttpClient, HttpErrorResponse, HttpResponse } from '@angular/common/http'; import { EditcameraComponent } from './editcamera/editcamera.component'; import { catchError, tap } from 'rxjs/operators'; +import { ConfigFormDataService } from 'src/app/service/configFormData.service'; interface Camera { name: string; user: string; @@ -25,7 +26,7 @@ interface Camera { export class HostConfigComponent implements OnInit { - constructor(private router: Router, private route: ActivatedRoute, private fb: FormBuilder, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef, private http: HttpClient) { } + constructor(private router: Router, private route: ActivatedRoute, private fb: FormBuilder, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef, private http: HttpClient, public configFormData: ConfigFormDataService,) { } hostId//主机id orId//加油站id @@ -132,7 +133,7 @@ export class HostConfigComponent implements OnInit { }); } - label(item){ + label(item) { this.router.navigate(['/system/host/camera/imageLabel']) } @@ -147,15 +148,300 @@ export class HostConfigComponent implements OnInit { }).subscribe({ next: (data) => { console.log('连接状态', data) - // this.router.navigate(['/system/host/camera/imageList']) - this.router.navigate(['/system/host/camera/configForm']) + this.disposalData() + this.router.navigate(['/system/host/camera/configForm'], { queryParams: { 'hostId': this.hostId, 'orId': this.orId } }) }, error: (err) => { console.log('连接失败', err) - }, - - // complete: () => console.log('complete!'), // not called + } }) } + //整理配置文件数据 + disposalData() { + console.log(this.listOfData) + let config1 = `[property] + enable=1 + #Width height used for configuration to which below configs are configured + config-width=1980 + config-height=1080 + #osd-mode 0: Dont display any lines, rois and text + # 1: Display only lines, rois and static text i.e. labels + # 2: Display all info from 1 plus information about counts + osd-mode=2 + #Set OSD font size that has to be displayed + display-font-size=12 + + ## Per stream configuration + [roi-filtering-stream-0] + #shoushiyuan-out202 + #enable or disable following feature + enable=1 + #ROI to filter select objects, and remove from meta data + roi-RF=1052;119;76;1066;1908;1071;1797;180 + #remove objects in the ROI + inverse-roi=0 + class-id=-1 + + # ## Per stream configuration + # [roi-filtering-stream-1] + # #shoushiyuan-out206 + # #enable or disable following feature + # enable=1 + # #ROI to filter select objects, and remove from meta data + # roi-RF=443;660;660;1076;1113;1079;638;541 + # #remove objects in the ROI + # inverse-roi=0 + # class-id=-1 + + ## Per stream configuration + [roi-filtering-stream-2] + #shoushiyuan-out210 + #enable or disable following feature + enable=1 + #ROI to filter select objects, and remove from meta data + roi-RF=10;323;227;1073;1908;1066;1909;370;1291;166 + #remove objects in the ROI + inverse-roi=0 + class-id=0 + + # ## Per stream configuration + # [roi-filtering-stream-3] + # #shoushiyuan-out211 + # #enable or disable following feature + # enable=1 + # #ROI to filter select objects, and remove from meta data + # roi-RF=587;447;405;1063;1904;1063;1334;602 + # #remove objects in the ROI + # inverse-roi=0 + # class-id=-1 + + # ## Per stream configuration + # [roi-filtering-stream-4] + # #shoushiyuan-out214 2区 + # #enable or disable following feature + # enable=1 + # #ROI to filter select objects, and remove from meta data + # roi-RF=687;227;1025;227;1025;688;687;688 + # #remove objects in the ROI + # inverse-roi=0 + # class-id=0 + + # ## Per stream configuration + # [roi-filtering-stream-5] + # #shoushiyuan-out215 3区 + # #enable or disable following feature + # enable=1 + # #ROI to filter select objects, and remove from meta data + # roi-RF=649;139;956;139;956;528;649;528 + # # 659;139;956;139;956;448;659;448 + # #remove objects in the ROI + # inverse-roi=0 + # class-id=0 + + # ## Per stream configuration + # [roi-filtering-stream-6] + # #shoushiyuan-out216 + # #enable or disable following feature + # enable=1 + # #ROI to filter select objects, and remove from meta data + # roi-RF=840;152;1102;152;1102;601;840;601 + # #remove objects in the ROI + # inverse-roi=0 + # class-id=0 + + # ## Per stream configuration + # [roi-filtering-stream-7] + # #shoushiyuan-out217 4区 + # #enable or disable following feature + # enable=1 + # #ROI to filter select objects, and remove from meta data + # roi-RF=886;248;1163;248;1163;627;886;627 + # #remove objects in the ROI + # inverse-roi=0 + # class-id=0 + + [line-crossing-stream-1] + enable=1 + #Label;direction;lc + line-crossing-Entry=471;540;570;689;443;660;638;541 + # line-crossing-Exit=789;672;1084;900;851;773;1203;732 + class-id=0 + #extended when 0- only counts crossing on the configured Line + # 1- assumes extended Line crossing counts all the crossing + extended=0 + #LC modes supported: + #loose : counts all crossing without strong adherence to direction + #balanced: Strict direction adherence expected compared to mode=loose + #strict : Strict direction adherence expected compared to mode=balanced + mode=strict + + [line-crossing-stream-3] + enable=1 + #Label;direction;lc + line-crossing-Entry=685;794;361;704;587;447;405;1063 + # line-crossing-Exit=789;672;1084;900;1908;827;685;436 + class-id=0 + #extended when 0- only counts crossing on the configured Line + # 1- assumes extended Line crossing counts all the crossing + extended=0 + #LC modes supported: + #loose : counts all crossing without strong adherence to direction + #balanced: Strict direction adherence expected compared to mode=loose + #strict : Strict direction adherence expected compared to mode=balanced + mode=strict + + # [overcrowding-stream-1] + # enable=1 + # roi-OC=295;643;579;634;642;913;56;828 + # #no of objects that will trigger OC + # object-threshold=2 + # class-id=-1 + ` + let config2 = `# The all in one config file. + # RTSP sources + # type + # 0 ViolateArea.ENTRANCE, + # 1 ViolateArea.GAS_AREA, + # 2 ViolateArea.FUEL_AREA, + # 3 ViolateArea.MART, + # don't change the key name. + + debug: true #when the debug is on, osd. + + sources: + config: 'config/source.yaml' + + streammux: + width: 1980 + height: 1080 + batch-size: 32 + batched-push-timeout: 4000000 + live-source: true + sync-inputs: true + + sourcebin: + buffer-duration: 1000000000 + buffer-size: 102400 + + tracker: + config: 'config/dstest_tracker_config.txt' + + analytics: + config: 'config/config_nvdsanalytics.txt' + + osd: + enable: false + ipaddr: '0.0.0.0' + port: 8554 + out_path: 'test' + + peoplenet: + enable: true + apply_on: -1 + interval: 1 + batch_size: 16 + topk: 5 + roi-top-offset: 0 + roi-bottom-offset: 0 + detected-min-w: 20 + detected-min-h: 200 + + trafficcam: + enable: true + apply_on: 0 + interval: 1 + batch_size: 16 + topk: 5 + roi-top-offset: 0 + roi-bottom-offset: 0 + detected-min-w: 200 + detected-min-h: 200 + + actionnet: + enable: false + apply_on: 1 + interval: 1 + batch_size: 32 + # roi: + # - 'fuel_island-4': + # - [672, 227, 366, 471] + # - 'fuel_island-5': + # - [649, 139, 307, 389] + # - 'fuel_island-6': + # - [805, 152, 297, 430] + # - 'fuel_island-7': + # - [876, 248, 287, 409] + + idnet: + enable: true + apply_on: -1 + interval: 1 + batch_size: 32 + + oilnet: + enable: true + apply_on: 2 + interval: 1 + batch_size: 16 + roi-top-offset: 0 + roi-bottom-offset: 0 + detected-min-w: 30 + detected-min-h: 0 + + smoke_fire_net: + enable: false + apply_on: -1 + interval: 1 + batch_size: 16 + + smoking_calling_net: + enable: true + apply_on: -1 + interval: 1 + batch_size: 32 + + connet: + enable: false + apply_on: 2 + roi: + - 'oil_tube-3': + - [490, 370, 381, 168] + - 'grounder-3': + - [585, 334, 289, 139] + interval: 1 + batch_size: 2 + + #new field for rule threshold + rule_threshold: + object_occurence_interval_second: 15 + object_disappear_interval_second: 60 + on_car_parking_interval_second: 1800 + threshold_relying_sitting: 0.4 #rolling mean confidence + threshold_smoking_calling: 0.8 #rolling mean confidence + threshold_connecting: 0.667 #rolling mean confidence + threshold_identity: 0.1 #only to filter out people net error + ` + let config3 = `test_action: true + logging_interval : 600 + ` + let config4 = `#RTSP sources for file source, use file as the +#Shoushi Yuan RTSP sources +video_rate: 5 +inference_buffer_second: 10` + this.listOfData.forEach((item: any) => { + config4 += ` + - name: '${item.name}' + user: '${item.user}' + password: '${item.password}' + uri: '${item.uri}' + type: ${item.type} + ` + }) + sessionStorage.setItem('config1', config1) + sessionStorage.setItem('config2', config2) + sessionStorage.setItem('config3', config3) + sessionStorage.setItem('config4', config4) + console.log('config4', config4) + } }