|
@@ -34,17 +34,14 @@ export class DoorItem extends SGraphyItem {
|
|
/** 门轮廓线坐标list */
|
|
/** 门轮廓线坐标list */
|
|
private readonly pointArr: SPoint[] = [];
|
|
private readonly pointArr: SPoint[] = [];
|
|
/** 门长度 */
|
|
/** 门长度 */
|
|
- private r: number = 0;
|
|
|
|
|
|
+ private readonly r: number = 0;
|
|
/** 角度 */
|
|
/** 角度 */
|
|
- private ang: number = 0;
|
|
|
|
|
|
+ private readonly ang: number = 0;
|
|
/** 旋转点 */
|
|
/** 旋转点 */
|
|
private p: SPoint = new SPoint(0, 0);
|
|
private p: SPoint = new SPoint(0, 0);
|
|
- /** 旋转起始角度 */
|
|
|
|
|
|
+ /** 旋转起始角度,结束角度+Math.PI/2 */
|
|
private startAng: number = -Math.PI / 2;
|
|
private startAng: number = -Math.PI / 2;
|
|
- /** 旋转结束角度 */
|
|
|
|
- private endAng: number = 0;
|
|
|
|
|
|
|
|
- // number: number = 0;
|
|
|
|
/**
|
|
/**
|
|
* 构造函数
|
|
* 构造函数
|
|
*
|
|
*
|
|
@@ -59,8 +56,23 @@ export class DoorItem extends SGraphyItem {
|
|
return new SPoint(t.X, -t.Y);
|
|
return new SPoint(t.X, -t.Y);
|
|
});
|
|
});
|
|
|
|
|
|
- let p1 = this.pointArr[0];
|
|
|
|
- let p2 = this.pointArr[1];
|
|
|
|
|
|
+ let p1, p2;
|
|
|
|
+ if (this.pointArr[0].x < this.pointArr[1].x) {
|
|
|
|
+ p1 = this.pointArr[0];
|
|
|
|
+ p2 = this.pointArr[1];
|
|
|
|
+ } else if (this.pointArr[0].x == this.pointArr[1].x) {
|
|
|
|
+ if (this.pointArr[0].y <= this.pointArr[1].y) {
|
|
|
|
+ p1 = this.pointArr[0];
|
|
|
|
+ p2 = this.pointArr[1];
|
|
|
|
+ } else {
|
|
|
|
+ p1 = this.pointArr[1];
|
|
|
|
+ p2 = this.pointArr[0];
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ p1 = this.pointArr[1];
|
|
|
|
+ p2 = this.pointArr[0];
|
|
|
|
+ }
|
|
|
|
+
|
|
let fo = Math.atan(
|
|
let fo = Math.atan(
|
|
-this.data.FaceDirection.Y / this.data.FaceDirection.X
|
|
-this.data.FaceDirection.Y / this.data.FaceDirection.X
|
|
);
|
|
);
|
|
@@ -71,45 +83,22 @@ export class DoorItem extends SGraphyItem {
|
|
// 门朝向角度
|
|
// 门朝向角度
|
|
this.ang = this.data.FaceDirection.X > 0 ? fo : fo + Math.PI;
|
|
this.ang = this.data.FaceDirection.X > 0 ? fo : fo + Math.PI;
|
|
// 旋转点
|
|
// 旋转点
|
|
|
|
+ this.p = p1;
|
|
if (
|
|
if (
|
|
Math.abs(this.data.HandDirection.X) >
|
|
Math.abs(this.data.HandDirection.X) >
|
|
Math.abs(this.data.HandDirection.Y)
|
|
Math.abs(this.data.HandDirection.Y)
|
|
) {
|
|
) {
|
|
- // this.startAng = 0;
|
|
|
|
- // this.endAng = Math.PI / 2;
|
|
|
|
if (this.data.HandDirection.X > 0) {
|
|
if (this.data.HandDirection.X > 0) {
|
|
- if (p1.x > p2.x) {
|
|
|
|
- this.p = p1;
|
|
|
|
- // this.number = 1; //
|
|
|
|
- } else {
|
|
|
|
- this.p = p2;
|
|
|
|
- // this.number = 2;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (p1.x < p2.x) {
|
|
|
|
- this.p = p1;
|
|
|
|
- // this.number = 3; //
|
|
|
|
- } else {
|
|
|
|
- this.p = p2;
|
|
|
|
- // this.number = 4; //
|
|
|
|
|
|
+ this.p = p2;
|
|
|
|
+ if (this.data.FaceDirection.X > 0) {
|
|
|
|
+ this.startAng = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if (this.data.HandDirection.Y > 0) {
|
|
if (this.data.HandDirection.Y > 0) {
|
|
- if (p1.y > p2.y) {
|
|
|
|
- this.p = p1;
|
|
|
|
- // this.number = 5; //
|
|
|
|
- } else {
|
|
|
|
- this.p = p2;
|
|
|
|
- // this.number = 6;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (p1.y < p2.y) {
|
|
|
|
- this.p = p1;
|
|
|
|
- // this.number = 7;
|
|
|
|
- } else {
|
|
|
|
- this.p = p2;
|
|
|
|
- // this.number = 8;
|
|
|
|
|
|
+ this.p = p2;
|
|
|
|
+ if (this.data.FaceDirection.X > 0) {
|
|
|
|
+ this.startAng = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -127,20 +116,8 @@ export class DoorItem extends SGraphyItem {
|
|
painter.translate(this.p.x, this.p.y);
|
|
painter.translate(this.p.x, this.p.y);
|
|
painter.rotate(this.ang);
|
|
painter.rotate(this.ang);
|
|
painter.pen.lineWidth = 100;
|
|
painter.pen.lineWidth = 100;
|
|
- // let color = [
|
|
|
|
- // "#42b983", //1
|
|
|
|
- // "#4287b9", //2
|
|
|
|
- // "#9742b9", //3
|
|
|
|
- // "#b94242", //4
|
|
|
|
- // "#ffd945", //5
|
|
|
|
- // "#46ff45", //
|
|
|
|
- // "#45f5ff", //
|
|
|
|
- // "#f3f3f3"
|
|
|
|
- // ];
|
|
|
|
- // painter.pen.color = new SColor(color[this.number - 1]);
|
|
|
|
painter.pen.color = Opt.doorColor;
|
|
painter.pen.color = Opt.doorColor;
|
|
painter.drawLine(0, 0, this.r, 0);
|
|
painter.drawLine(0, 0, this.r, 0);
|
|
-
|
|
|
|
painter.pen.lineDash = [50, 100];
|
|
painter.pen.lineDash = [50, 100];
|
|
// painter.drawArc(
|
|
// painter.drawArc(
|
|
// -this.r,
|
|
// -this.r,
|
|
@@ -148,7 +125,7 @@ export class DoorItem extends SGraphyItem {
|
|
// this.r * 2,
|
|
// this.r * 2,
|
|
// this.r * 2,
|
|
// this.r * 2,
|
|
// this.startAng,
|
|
// this.startAng,
|
|
- // this.endAng
|
|
|
|
|
|
+ // this.startAng + Math.PI / 2
|
|
// );
|
|
// );
|
|
}
|
|
}
|
|
} // Function onDraw()
|
|
} // Function onDraw()
|