|
|
@ -402,7 +402,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV |
|
|
|
Id: Guid.NewGuid().ToString(), |
|
|
|
Id: Guid.NewGuid().ToString(), |
|
|
|
ImageUrl: this.canvasData.selectTemplateData.imageUrl, |
|
|
|
ImageUrl: this.canvasData.selectTemplateData.imageUrl, |
|
|
|
InteractiveMode: this.canvasData.selectTemplateData.interactiveMode, |
|
|
|
InteractiveMode: this.canvasData.selectTemplateData.interactiveMode, |
|
|
|
MultiPoint: this.paintPoints, |
|
|
|
MultiPoint: JSON.parse(JSON.stringify(this.paintPoints)), |
|
|
|
Point: new PIXI.Point(0, 0), |
|
|
|
Point: new PIXI.Point(0, 0), |
|
|
|
Name: this.canvasData.selectTemplateData.name, |
|
|
|
Name: this.canvasData.selectTemplateData.name, |
|
|
|
PropertyInfos: propertyList, |
|
|
|
PropertyInfos: propertyList, |
|
|
@ -671,7 +671,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV |
|
|
|
Id: Guid.NewGuid().ToString(), |
|
|
|
Id: Guid.NewGuid().ToString(), |
|
|
|
ImageUrl: this.canvasData.selectTemplateData.imageUrl, |
|
|
|
ImageUrl: this.canvasData.selectTemplateData.imageUrl, |
|
|
|
InteractiveMode: this.canvasData.selectTemplateData.interactiveMode, |
|
|
|
InteractiveMode: this.canvasData.selectTemplateData.interactiveMode, |
|
|
|
MultiPoint: this.paintPoints, |
|
|
|
MultiPoint: JSON.parse(JSON.stringify(this.paintPoints)), |
|
|
|
Point: new PIXI.Point(0, 0), |
|
|
|
Point: new PIXI.Point(0, 0), |
|
|
|
Name: this.canvasData.selectTemplateData.name, |
|
|
|
Name: this.canvasData.selectTemplateData.name, |
|
|
|
PropertyInfos: propertyList, |
|
|
|
PropertyInfos: propertyList, |
|
|
@ -1066,12 +1066,10 @@ export class PolygonIcon extends PIXI.Container { |
|
|
|
this.polygonLineGraphics.drawPolygon(this.getPoints()); |
|
|
|
this.polygonLineGraphics.drawPolygon(this.getPoints()); |
|
|
|
this.polygonLineGraphics.closePath(); |
|
|
|
this.polygonLineGraphics.closePath(); |
|
|
|
this.addChild(this.polygonLineGraphics); |
|
|
|
this.addChild(this.polygonLineGraphics); |
|
|
|
// 名称
|
|
|
|
|
|
|
|
// const text = new PIXI.Text(this.assetData.Name, {
|
|
|
|
|
|
|
|
// fontFamily: 'Arial', fontSize: 18, fill: 0xffffff, align: 'center'
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
this.text.anchor.set(0.5); |
|
|
|
this.text.anchor.set(0.5); |
|
|
|
this.text.y -= this.assetData.Height; |
|
|
|
// this.text.position = this.getCenterOfGravityPoint(this.pointsData);
|
|
|
|
|
|
|
|
console.log(this.polygonLineGraphics._bounds); |
|
|
|
this.polygonLineGraphics.addChild(this.text); |
|
|
|
this.polygonLineGraphics.addChild(this.text); |
|
|
|
// 添加圆点事件
|
|
|
|
// 添加圆点事件
|
|
|
|
this.pointsGraphics.forEach((item, index, array) => { |
|
|
|
this.pointsGraphics.forEach((item, index, array) => { |
|
|
@ -1167,6 +1165,32 @@ export class PolygonIcon extends PIXI.Container { |
|
|
|
item.visible = value; |
|
|
|
item.visible = value; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public getCenterOfGravityPoint(points) { |
|
|
|
|
|
|
|
let sumX = 0; |
|
|
|
|
|
|
|
let sumY = 0; |
|
|
|
|
|
|
|
let sumArea = 0; |
|
|
|
|
|
|
|
let area = 0; |
|
|
|
|
|
|
|
let p1 = points[1]; |
|
|
|
|
|
|
|
for (let i = 2; i < points.length; i++) { |
|
|
|
|
|
|
|
const p2 = points[i]; |
|
|
|
|
|
|
|
area = this.Area(points[0], p1, p2); |
|
|
|
|
|
|
|
sumArea += area; |
|
|
|
|
|
|
|
sumX += (points[0][0] + p1[0] + p2[0]) * area; |
|
|
|
|
|
|
|
sumY += (points[0][1] + p1[1] + p2[1]) * area; |
|
|
|
|
|
|
|
p1 = p2; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const pointX = sumX / sumArea / 3; |
|
|
|
|
|
|
|
const pointY = sumY / sumArea / 3; |
|
|
|
|
|
|
|
console.log(pointX); |
|
|
|
|
|
|
|
console.log(pointY); |
|
|
|
|
|
|
|
return new PIXI.Point(pointX, pointY); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Area(p0, p1, p2) { |
|
|
|
|
|
|
|
let area = 0.0; |
|
|
|
|
|
|
|
area = p0[0] * p1[1] + p1[0] * p2[1] + p2[0] * p0[1] - p1[0] * p0[1] - p2[0] * p1[1] - p0[0] * p2[1]; |
|
|
|
|
|
|
|
return area / 2; |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取点集合 |
|
|
|
* 获取点集合 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|