Browse Source

[完善]安信盒子图片超出屏幕的处理

非煤矿业企业安全风险监测预警系统
邵佳豪 2 years ago
parent
commit
e47a38e9dd
  1. 4
      proxy.config.json
  2. 1
      src/app/system-management/host-config/host-config.component.ts
  3. 15
      src/app/system-management/image-label-anxin/image-label-anxin.component.ts

4
proxy.config.json

@ -1,13 +1,13 @@
{
"/api": {
"target": "http://121.36.37.70:8080/",
"target": "http://10.156.134.53:9001/",
"测试":"http://121.36.37.70:8080/",
"生产":"http://10.156.134.53:9001/",
"secure": false,
"changeOrigin": true
},
"/signalr": {
"target": "http://121.36.37.70:8080/",
"target": "http://10.156.134.53:9001/",
"secure": false,
"ws": true,
"logLevel": "debug"

1
src/app/system-management/host-config/host-config.component.ts

@ -1633,7 +1633,6 @@ rule_threshold:
data.server = server;
data.obs = obs;
}
//填充caps数组
this.listOfData.forEach((item: any) => {
if (item.isEnabled) {

15
src/app/system-management/image-label-anxin/image-label-anxin.component.ts

@ -107,9 +107,21 @@ export class ImageLabelAnxinComponent implements OnInit {
// 图片加载完后,将其显示在canvas中
var img = new Image();
img.src = this.imgItem ? this.imgItem : '../../../assets/images/bgImg.png';
console.log('img', img);
img.onload = () => {
console.log('原始宽度', img.width);
console.log('原始高度', img.height);
if (img.width > 1920) {
img.height = img.height * (1920 / img.width);
img.width = 1920;
}
this.canvasWidth = img.width;
this.canvasHeight = img.height;
console.log('显示宽度', this.canvasWidth);
console.log('显示高度', this.canvasHeight);
// return;
window.setTimeout(() => {
// 加载图片
this.ctx.drawImage(img, 0, 0, this.canvasWidth, this.canvasHeight);
@ -499,7 +511,7 @@ export class ImageLabelAnxinComponent implements OnInit {
save() {
console.log(this.camerasData.dimensionedPointsAnxin);
console.log('标点数据', this.PolygonData);
// return;
for (const key in this.PolygonData) {
const element = this.PolygonData[key];
if (element.Points.length !== 0 && element.Points.length <= 2) {
@ -544,6 +556,7 @@ export class ImageLabelAnxinComponent implements OnInit {
};
console.log('标点结果', this.camerasData.dimensionedPointsAnxin);
// return;
this.http
.put(`/api/Cameras/${this.camerasData.id}/DimensionedPoints`, body)
.subscribe((data) => {

Loading…
Cancel
Save