|
|
|
@ -53,7 +53,7 @@ export class HostConfigComponent implements OnInit {
|
|
|
|
|
private viewContainerRef: ViewContainerRef, |
|
|
|
|
private http: HttpClient, |
|
|
|
|
public configFormData: ConfigFormDataService |
|
|
|
|
) { } |
|
|
|
|
) {} |
|
|
|
|
|
|
|
|
|
hostId; //主机id
|
|
|
|
|
orId; //加油站id
|
|
|
|
@ -219,8 +219,8 @@ export class HostConfigComponent implements OnInit {
|
|
|
|
|
// );
|
|
|
|
|
console.log('向边缘设备发送拉取图片请求成功'); |
|
|
|
|
}, |
|
|
|
|
error: (error: HttpErrorResponse) => { }, |
|
|
|
|
complete: () => { }, |
|
|
|
|
error: (error: HttpErrorResponse) => {}, |
|
|
|
|
complete: () => {}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -269,7 +269,7 @@ export class HostConfigComponent implements OnInit {
|
|
|
|
|
nzComponentParams: { |
|
|
|
|
data: item.id, |
|
|
|
|
}, |
|
|
|
|
nzOnOk: async () => { }, |
|
|
|
|
nzOnOk: async () => {}, |
|
|
|
|
}); |
|
|
|
|
modal.afterClose.subscribe((result) => { |
|
|
|
|
this.ngOnInit(); |
|
|
|
@ -291,6 +291,7 @@ export class HostConfigComponent implements OnInit {
|
|
|
|
|
nzClosable: false, |
|
|
|
|
nzFooter: null, |
|
|
|
|
nzWrapClassName: 'canvasContentBox', |
|
|
|
|
nzMaskClosable:false, |
|
|
|
|
nzBodyStyle: { |
|
|
|
|
'border-radius': '0px', |
|
|
|
|
padding: '0px', |
|
|
|
@ -305,7 +306,7 @@ export class HostConfigComponent implements OnInit {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
error: (err) => { }, |
|
|
|
|
error: (err) => {}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -513,9 +514,9 @@ sources:`;
|
|
|
|
|
if (item.type == 0) { |
|
|
|
|
item.dimensionedPointsObj |
|
|
|
|
? item.dimensionedPointsObj.polygon.forEach((element) => { |
|
|
|
|
customArea.push(element.x); |
|
|
|
|
customArea.push(element.y); |
|
|
|
|
}) |
|
|
|
|
customArea.push(element.x); |
|
|
|
|
customArea.push(element.y); |
|
|
|
|
}) |
|
|
|
|
: null; |
|
|
|
|
} else { |
|
|
|
|
console.log(item.dimensionedPointsObj); |
|
|
|
@ -637,9 +638,9 @@ oil_other_threshold: 0.5
|
|
|
|
|
let str = ''; |
|
|
|
|
item.dimensionedPointsObj |
|
|
|
|
? item.dimensionedPointsObj.polygon.forEach((element) => { |
|
|
|
|
str += element.x + ';'; |
|
|
|
|
str += element.y + ';'; |
|
|
|
|
}) |
|
|
|
|
str += element.x + ';'; |
|
|
|
|
str += element.y + ';'; |
|
|
|
|
}) |
|
|
|
|
: 0; |
|
|
|
|
str = str.substring(0, str.lastIndexOf(';')); |
|
|
|
|
console.log('进出口多边形', str); |
|
|
|
@ -873,50 +874,76 @@ ${newstr}class-id=0
|
|
|
|
|
oilDischargeOrder != undefined |
|
|
|
|
? null |
|
|
|
|
: (oilDischargeOrder = |
|
|
|
|
copyListOfData[copyListOfData.length - 1].order + 1); |
|
|
|
|
copyListOfData[copyListOfData.length - 1].order + 1); |
|
|
|
|
console.log('泄油管区域', xieyouguan); |
|
|
|
|
console.log('静电接地', jingdian); |
|
|
|
|
|
|
|
|
|
console.log(this.hostData); |
|
|
|
|
//如果之前保存过文件
|
|
|
|
|
if (this.hostData.configFiles && this.hostData.configFiles.length !== 0) { |
|
|
|
|
console.log('走这里了吗') |
|
|
|
|
let config_arm = this.hostData.configFiles.find( |
|
|
|
|
(item) => item.name == 'config_arm.yaml' |
|
|
|
|
).content; |
|
|
|
|
let config_x86 = this.hostData.configFiles.find( |
|
|
|
|
(item) => item.name == 'config_x86.yaml' |
|
|
|
|
).content; |
|
|
|
|
let producer = this.hostData.configFiles.find( |
|
|
|
|
(item) => item.name == 'producer.yaml' |
|
|
|
|
).content; |
|
|
|
|
// console.log(111, config_arm);
|
|
|
|
|
// console.log(222, config_x86);
|
|
|
|
|
//修改config_arm.yaml文件
|
|
|
|
|
//更改connet_oil
|
|
|
|
|
let config_armObj = yaml.load(config_arm); |
|
|
|
|
// let config_armObj = YAML.parse(config_arm);
|
|
|
|
|
for (const key in config_armObj.connet_oil.roi[0]) { |
|
|
|
|
delete config_armObj.connet_oil.roi[0][key]; |
|
|
|
|
} |
|
|
|
|
let key1 = `oil_tube-${oilDischargeOrder}`; |
|
|
|
|
let arr1 = []; |
|
|
|
|
xieyouguan.split(',').forEach((item) => { |
|
|
|
|
arr1.push(Number(item)); |
|
|
|
|
}); |
|
|
|
|
config_armObj.connet_oil.roi[0][key1] = [arr1]; |
|
|
|
|
// 更改connet_grounder
|
|
|
|
|
for (const key in config_armObj.connet_grounder.roi[0]) { |
|
|
|
|
delete config_armObj.connet_grounder.roi[0][key]; |
|
|
|
|
} |
|
|
|
|
let key2 = `grounder-${oilDischargeOrder}`; |
|
|
|
|
let arr2 = []; |
|
|
|
|
jingdian.split(',').forEach((item) => { |
|
|
|
|
arr2.push(Number(item)); |
|
|
|
|
}); |
|
|
|
|
config_armObj.connet_grounder.roi[0][key2] = [arr2]; |
|
|
|
|
config2 = yaml.dump(config_armObj, { lineWidth: -1 }); |
|
|
|
|
//修改config_x86.yaml文件
|
|
|
|
|
//更改connet_oil
|
|
|
|
|
let config_x86Obj = yaml.load(config_x86); |
|
|
|
|
console.log('config_x86.yaml', config_x86Obj); |
|
|
|
|
for (const key in config_x86Obj.connet_oil.roi[0]) { |
|
|
|
|
delete config_x86Obj.connet_oil.roi[0][key]; |
|
|
|
|
} |
|
|
|
|
let key3 = `oil_tube-${oilDischargeOrder}`; |
|
|
|
|
let arr3 = []; |
|
|
|
|
xieyouguan.split(',').forEach((item) => { |
|
|
|
|
arr3.push(Number(item)); |
|
|
|
|
}); |
|
|
|
|
config_x86Obj.connet_oil.roi[0][key3] = [arr3]; |
|
|
|
|
// 更改connet_grounder
|
|
|
|
|
for (const key in config_x86Obj.connet_grounder.roi[0]) { |
|
|
|
|
delete config_x86Obj.connet_grounder.roi[0][key]; |
|
|
|
|
} |
|
|
|
|
let key4 = `grounder-${oilDischargeOrder}`; |
|
|
|
|
let arr4 = []; |
|
|
|
|
jingdian.split(',').forEach((item) => { |
|
|
|
|
arr4.push(Number(item)); |
|
|
|
|
}); |
|
|
|
|
config_x86Obj.connet_grounder.roi[0][key4] = [arr4]; |
|
|
|
|
config3 = yaml.dump(config_x86Obj, { lineWidth: -1 }); |
|
|
|
|
|
|
|
|
|
// for (const key in config_armObj.connet_oil.roi[0]) {
|
|
|
|
|
// delete config_armObj.connet_oil.roi[0][key];
|
|
|
|
|
// }
|
|
|
|
|
// let key1 = `oil_tube-${oilDischargeOrder}`;
|
|
|
|
|
// let arr1 = [];
|
|
|
|
|
// xieyouguan.split(',').forEach((item) => {
|
|
|
|
|
// arr1.push(Number(item));
|
|
|
|
|
// });
|
|
|
|
|
// config_armObj.connet_oil.roi[0][key1] = [arr1];
|
|
|
|
|
//更改connet_grounder
|
|
|
|
|
// for (const key in config_armObj.connet_grounder.roi[0]) {
|
|
|
|
|
// delete config_armObj.connet_grounder.roi[0][key];
|
|
|
|
|
// }
|
|
|
|
|
// let key2 = `grounder-${oilDischargeOrder}`;
|
|
|
|
|
// let arr2 = [];
|
|
|
|
|
// jingdian.split(',').forEach((item) => {
|
|
|
|
|
// arr2.push(Number(99));
|
|
|
|
|
// });
|
|
|
|
|
// config_armObj.connet_grounder.roi[0][key2] = [arr2];
|
|
|
|
|
// let yyy = JSON.parse(JSON.stringify(config_armObj, null, 2))
|
|
|
|
|
config2 = yaml.dump(config_armObj, { lineWidth: -1, indent: 3, noArrayIndent: true }); |
|
|
|
|
// config2 =JSON.parse(JSON.stringify(YAML.stringify(config_armObj)) )
|
|
|
|
|
console.log(888, config2) |
|
|
|
|
// let producerObj = yaml.load(producer);
|
|
|
|
|
// config4 = yaml.dump(producerObj, { lineWidth: -1 });
|
|
|
|
|
config4 = producer |
|
|
|
|
console.log() |
|
|
|
|
} else { |
|
|
|
|
//使用模板
|
|
|
|
|
config2 = `# The all in one config file.
|
|
|
|
@ -1222,19 +1249,19 @@ ${newstr}class-id=0
|
|
|
|
|
} |
|
|
|
|
// 读取文本文件内容
|
|
|
|
|
async readFile(file) { |
|
|
|
|
const reader = new FileReader() |
|
|
|
|
const reader = new FileReader(); |
|
|
|
|
const promise = new Promise((resolve, reject) => { |
|
|
|
|
reader.onload = function () { |
|
|
|
|
resolve(reader.result) |
|
|
|
|
} |
|
|
|
|
resolve(reader.result); |
|
|
|
|
}; |
|
|
|
|
reader.onerror = function (e) { |
|
|
|
|
reader.abort() |
|
|
|
|
reject(e) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
reader.readAsText(file, 'UTF-8') // 将文件读取为文本
|
|
|
|
|
reader.abort(); |
|
|
|
|
reject(e); |
|
|
|
|
}; |
|
|
|
|
}); |
|
|
|
|
reader.readAsText(file, 'UTF-8'); // 将文件读取为文本
|
|
|
|
|
|
|
|
|
|
return promise |
|
|
|
|
return promise; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//黄海配置文件
|
|
|
|
@ -1371,9 +1398,9 @@ ${newstr}class-id=0
|
|
|
|
|
item.dimensionedPointsHuanghaiObj.unloadingROI[0].x, |
|
|
|
|
item.dimensionedPointsHuanghaiObj.unloadingROI[0].y, |
|
|
|
|
item.dimensionedPointsHuanghaiObj.unloadingROI[0].x + |
|
|
|
|
item.dimensionedPointsHuanghaiObj.unloadingROI[0].width, |
|
|
|
|
item.dimensionedPointsHuanghaiObj.unloadingROI[0].width, |
|
|
|
|
item.dimensionedPointsHuanghaiObj.unloadingROI[0].y + |
|
|
|
|
item.dimensionedPointsHuanghaiObj.unloadingROI[0].height, |
|
|
|
|
item.dimensionedPointsHuanghaiObj.unloadingROI[0].height, |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
if ( |
|
|
|
|