|
@@ -27,6 +27,7 @@
|
|
|
import {
|
|
|
SColor,
|
|
|
SPainter,
|
|
|
+ SPath,
|
|
|
SPoint,
|
|
|
SPolygonUtil,
|
|
|
SRect,
|
|
@@ -42,21 +43,21 @@ import { SGraphItem } from "@persagy-web/graph";
|
|
|
* @author 郝建龙
|
|
|
*/
|
|
|
export class SSpaceItem extends SGraphItem {
|
|
|
- /** 空间所有数据 */
|
|
|
+ /** 空间所有数据 */
|
|
|
data: Space;
|
|
|
- /** 空间轮廓线坐标list */
|
|
|
+ /** 空间轮廓线坐标list */
|
|
|
readonly pointArr: SPoint[][] = [];
|
|
|
- /** X坐标最小值 */
|
|
|
+ /** X坐标最小值 */
|
|
|
minX = Number.MAX_SAFE_INTEGER;
|
|
|
- /** X坐标最大值 */
|
|
|
+ /** X坐标最大值 */
|
|
|
maxX = Number.MIN_SAFE_INTEGER;
|
|
|
- /** Y坐标最小值 */
|
|
|
+ /** Y坐标最小值 */
|
|
|
minY = Number.MAX_SAFE_INTEGER;
|
|
|
- /** Y坐标最大值 */
|
|
|
+ /** Y坐标最大值 */
|
|
|
maxY = Number.MIN_SAFE_INTEGER;
|
|
|
- /** path对象 */
|
|
|
- // private path = new SPath2D();
|
|
|
- /** 高亮状态 */
|
|
|
+ /** path对象 */
|
|
|
+ private path = new SPath();
|
|
|
+ /** 高亮状态 */
|
|
|
private _highLightFlag: boolean = false;
|
|
|
get highLightFlag(): boolean {
|
|
|
return this._highLightFlag;
|
|
@@ -65,7 +66,7 @@ export class SSpaceItem extends SGraphItem {
|
|
|
this._highLightFlag = value;
|
|
|
this.update();
|
|
|
} // Set highLightFlag
|
|
|
- /** 是否显示名字 */
|
|
|
+ /** 是否显示名字 */
|
|
|
private _showBaseName: boolean = false;
|
|
|
get showBaseName(): boolean {
|
|
|
return this._showBaseName;
|
|
@@ -74,7 +75,7 @@ export class SSpaceItem extends SGraphItem {
|
|
|
this._showBaseName = value;
|
|
|
this.update();
|
|
|
} // Set showBaseName
|
|
|
- /** 是否名字大小 */
|
|
|
+ /** 是否名字大小 */
|
|
|
private _nameSize: number = 10;
|
|
|
get nameSize(): number {
|
|
|
return this._nameSize;
|
|
@@ -83,7 +84,7 @@ export class SSpaceItem extends SGraphItem {
|
|
|
this._nameSize = value;
|
|
|
this.update();
|
|
|
} // Set nameSize
|
|
|
- /** 名字是否缩放 */
|
|
|
+ /** 名字是否缩放 */
|
|
|
private _nameTransform: boolean = false;
|
|
|
get nameTransform(): boolean {
|
|
|
return this._nameTransform;
|
|
@@ -92,7 +93,7 @@ export class SSpaceItem extends SGraphItem {
|
|
|
this._nameTransform = value;
|
|
|
this.update();
|
|
|
} // Set nameTransform
|
|
|
- /** 名字颜色 */
|
|
|
+ /** 名字颜色 */
|
|
|
private _nameColor: string = "#000000";
|
|
|
get nameColor(): string {
|
|
|
return this._nameColor;
|
|
@@ -139,7 +140,7 @@ export class SSpaceItem extends SGraphItem {
|
|
|
return new SPoint(x, y);
|
|
|
}
|
|
|
);
|
|
|
- // this.path.polygon(temp);
|
|
|
+ this.path.polygon(temp);
|
|
|
return temp;
|
|
|
});
|
|
|
}
|
|
@@ -159,38 +160,6 @@ export class SSpaceItem extends SGraphItem {
|
|
|
);
|
|
|
} // Function boundingRect()
|
|
|
|
|
|
- // /**
|
|
|
- // * 鼠标单击事件
|
|
|
- // *
|
|
|
- // * @param event 事件参数
|
|
|
- // * @return boolean
|
|
|
- // */
|
|
|
- // onMouseDown(event: SMouseEvent): boolean {
|
|
|
- // console.log("spaceDown");
|
|
|
- // this.$emit("click", event);
|
|
|
- // return true;
|
|
|
- // } // Function onMouseDown()
|
|
|
-
|
|
|
- // /**
|
|
|
- // * 鼠标移动事件
|
|
|
- // *
|
|
|
- // * @param event 事件参数
|
|
|
- // */
|
|
|
- // onMouseMove(event: SMouseEvent): boolean {
|
|
|
- // return false;
|
|
|
- // } // Function onMouseMove()
|
|
|
-
|
|
|
- // /**
|
|
|
- // * 鼠标抬起事件
|
|
|
- // *
|
|
|
- // * @param event 事件参数
|
|
|
- // * @return boolean
|
|
|
- // */
|
|
|
- // onMouseUp(event: SMouseEvent): boolean {
|
|
|
- // console.log("spaceUp");
|
|
|
- // return false;
|
|
|
- // } // Function onClick()
|
|
|
-
|
|
|
/**
|
|
|
* 判断点是否在区域内
|
|
|
*
|
|
@@ -226,10 +195,7 @@ export class SSpaceItem extends SGraphItem {
|
|
|
painter.brush.color = ItemColor.spaceColor;
|
|
|
}
|
|
|
painter.pen.lineWidth = painter.toPx(1);
|
|
|
- // painter.drawPath(this.path);
|
|
|
- if (this.pointArr.length) {
|
|
|
- painter.drawPolygon(this.pointArr[0]);
|
|
|
- }
|
|
|
+ painter.drawPath(this.path);
|
|
|
|
|
|
if (this.showBaseName) {
|
|
|
if (this.name && this.name != "null") {
|
|
@@ -239,7 +205,6 @@ export class SSpaceItem extends SGraphItem {
|
|
|
} else {
|
|
|
painter.font.size = painter.toPx(this.nameSize);
|
|
|
}
|
|
|
- // painter.font.size = 500;
|
|
|
painter.font.textAlign = STextAlign.Center;
|
|
|
painter.drawText(
|
|
|
this.name,
|