|
@@ -9,28 +9,48 @@ import { SPen, SPainter, SColor } from "@sybotan-web/draw";
|
|
*/
|
|
*/
|
|
export class SGraphyPolygonItem extends SGraphyItem {
|
|
export class SGraphyPolygonItem extends SGraphyItem {
|
|
pointArr: SPoint[];
|
|
pointArr: SPoint[];
|
|
|
|
+ fillColor: SColor = SColor.White;
|
|
color: SColor = SColor.Black;
|
|
color: SColor = SColor.Black;
|
|
width: number = 1;
|
|
width: number = 1;
|
|
|
|
+ businessId: number = 0;
|
|
|
|
+ centerOfGravityPoint: { x: number, y: number };
|
|
|
|
+ businessName: string = '';
|
|
|
|
+ isBusiness: number = 1;
|
|
|
|
+ actived: boolean = false; //是否激活
|
|
|
|
|
|
/**
|
|
/**
|
|
* 构造函数
|
|
* 构造函数
|
|
*
|
|
*
|
|
- * @param pointArr 点坐标list
|
|
|
|
- * @param width 线的宽度
|
|
|
|
- *
|
|
|
|
- * @param color 线的颜色
|
|
|
|
|
|
+ * @param pointArr 点坐标list
|
|
|
|
+ * @param width 边框的宽度
|
|
|
|
+ * @param color 边框的颜色
|
|
|
|
+ * @param fillColor 多边形填充的颜色
|
|
|
|
+ * @param businessId 空间id
|
|
|
|
+ * @param businessName 空间名称
|
|
|
|
+ * @param centerOfGravityPoint 中心点
|
|
|
|
+ * @param isBusiness 状态
|
|
* @param parent
|
|
* @param parent
|
|
*/
|
|
*/
|
|
constructor(
|
|
constructor(
|
|
parent: SGraphyItem | null,
|
|
parent: SGraphyItem | null,
|
|
pointArr: SPoint[],
|
|
pointArr: SPoint[],
|
|
|
|
+ centerOfGravityPoint: { x: number, y: number },
|
|
|
|
+ fillColor: SColor = SColor.White,
|
|
color: SColor = SColor.Black,
|
|
color: SColor = SColor.Black,
|
|
|
|
+ isBusiness: number = 1,
|
|
|
|
+ businessId?: number,
|
|
|
|
+ businessName?: string,
|
|
width: number = 1
|
|
width: number = 1
|
|
) {
|
|
) {
|
|
super(parent);
|
|
super(parent);
|
|
this.pointArr = pointArr;
|
|
this.pointArr = pointArr;
|
|
|
|
+ this.fillColor = fillColor;
|
|
this.color = color;
|
|
this.color = color;
|
|
this.width = width;
|
|
this.width = width;
|
|
|
|
+ this.centerOfGravityPoint = centerOfGravityPoint;
|
|
|
|
+ this.isBusiness = isBusiness;
|
|
|
|
+ this.businessId = businessId as number;
|
|
|
|
+ this.businessName = businessName as string;
|
|
} // Constructor()
|
|
} // Constructor()
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -108,8 +128,18 @@ export class SGraphyPolygonItem extends SGraphyItem {
|
|
*/
|
|
*/
|
|
onDraw(painter: SPainter, rect: SRect): void {
|
|
onDraw(painter: SPainter, rect: SRect): void {
|
|
if (this.pointArr.length) {
|
|
if (this.pointArr.length) {
|
|
- painter.pen = new SPen(this.color, this.width);
|
|
|
|
|
|
+ // painter.pen = new SPen(this.color, this.width);
|
|
|
|
+ painter.pen.color = this.color;
|
|
|
|
+ painter.brush.color = this.fillColor;
|
|
painter.drawPolygon(this.pointArr)
|
|
painter.drawPolygon(this.pointArr)
|
|
|
|
+ let text = ''
|
|
|
|
+ if (this.businessName || this.businessId) {
|
|
|
|
+ text = '👇 ' + this.businessName
|
|
|
|
+ } else {
|
|
|
|
+ text = '⬇️ ' + this.businessName
|
|
|
|
+ }
|
|
|
|
+ // painter.font = new SFont()
|
|
|
|
+ painter.drawText(text, this.centerOfGravityPoint.x, this.centerOfGravityPoint.y)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} // Class SGraphyPolygonItem
|
|
} // Class SGraphyPolygonItem
|