|
@@ -9,19 +9,20 @@ import { dataItemPath, dataItem, dataSpaceItem, dataInterface, PolygonItemInterf
|
|
|
*/
|
|
|
export default class SGraphyPolygonItem extends SGraphyItem {
|
|
|
pointArr: SPoint[];
|
|
|
- fillColor: SColor =new SColor('#F2F6FC');
|
|
|
+ fillColor: SColor = new SColor('#F2F6FC');
|
|
|
color: SColor = SColor.Black;
|
|
|
- width: number =200;
|
|
|
+ width: number = 200;
|
|
|
businessId: string | null;
|
|
|
id: string | null;
|
|
|
centerOfGravityPoint: { x: number, y: number };
|
|
|
businessName: null | string | undefined; //业务空间名字
|
|
|
initName: null | string | undefined; //空间名字
|
|
|
- viewText:string = '' //绘出的文案
|
|
|
+ viewText: string = '' //绘出的文案
|
|
|
isBusiness: number = 1;
|
|
|
- cacheColor:SColor= SColor.Black //需要缓存的边框
|
|
|
- cacheFillColor:SColor = new SColor('#F2F6FC'); //需要缓存的填充色
|
|
|
- cacheWidth:number = 100;
|
|
|
+ cacheColor: SColor = SColor.Black //需要缓存的边框
|
|
|
+ cacheFillColor: SColor = new SColor('#F2F6FC'); //需要缓存的填充色
|
|
|
+ cacheWidth: number = 100;
|
|
|
+ businessType: string = '' //类型
|
|
|
// actived: boolean = false; //是否激活
|
|
|
/**
|
|
|
* 构造函数
|
|
@@ -32,38 +33,40 @@ export default class SGraphyPolygonItem extends SGraphyItem {
|
|
|
* @param fillColor 多边形填充的颜色
|
|
|
* @param businessId 空间id
|
|
|
* @param businessName 空间名称
|
|
|
- * @param centerOfGravityPoint 中心点
|
|
|
- * @param isBusiness 状态
|
|
|
+ * @param centerOfGravityPoint 中心点
|
|
|
+ * @param isBusiness 状态
|
|
|
* @param parent
|
|
|
*/
|
|
|
constructor(PolygonItemData: PolygonItemInterface) {
|
|
|
super(PolygonItemData.parent);
|
|
|
// 修改绘制路径格式
|
|
|
let newSpacePaths: SPoint[] = PolygonItemData.space.Paths[0].map(item => {
|
|
|
- return new SPoint(item.X,item.Y)
|
|
|
+ return new SPoint(item.X, item.Y)
|
|
|
});
|
|
|
this.pointArr = newSpacePaths;
|
|
|
- // // 填充色
|
|
|
- PolygonItemData.fillColor ? this.fillColor = PolygonItemData.fillColor : this.fillColor = new SColor('#F2F6FC');
|
|
|
+ // 填充色
|
|
|
+ this.fillColor = PolygonItemData.space.fillColor ? PolygonItemData.space.fillColor : new SColor('#F2F6FC');
|
|
|
// 边框色
|
|
|
- PolygonItemData.color ? this.color = PolygonItemData.color : this.color = SColor.Black;
|
|
|
+ this.color = PolygonItemData.space.color ? PolygonItemData.space.color : SColor.Black;
|
|
|
//边框宽度
|
|
|
- PolygonItemData.width ? this.width = PolygonItemData.width : this.width = 100;
|
|
|
+ this.width = PolygonItemData.space.width ? PolygonItemData.space.width : 100;
|
|
|
//中心点
|
|
|
this.centerOfGravityPoint = {
|
|
|
x: PolygonItemData.space.LocationPoint.X,
|
|
|
y: -PolygonItemData.space.LocationPoint.Y
|
|
|
};
|
|
|
//业务空间类型
|
|
|
- PolygonItemData.isBusiness ? this.isBusiness = PolygonItemData.isBusiness : this.isBusiness = 1;
|
|
|
+ this.isBusiness = PolygonItemData.space.isBusiness ? PolygonItemData.space.isBusiness : 1;
|
|
|
//业务空间id
|
|
|
- PolygonItemData.businessId ? this.businessId = PolygonItemData.businessId : this.businessId = null;
|
|
|
+ this.businessId = PolygonItemData.space.businessId ? PolygonItemData.space.businessId : null
|
|
|
//业务空间名称
|
|
|
this.businessName = PolygonItemData.space.Name;
|
|
|
- this.initName = PolygonItemData.space.Name;
|
|
|
+ this.initName = PolygonItemData.space.Name;
|
|
|
// 空间id
|
|
|
this.id = PolygonItemData.space.id;
|
|
|
this.viewText = PolygonItemData.space.Name;
|
|
|
+ //类型
|
|
|
+ this.businessType = PolygonItemData.businessType ? PolygonItemData.businessType : ''
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -137,11 +140,11 @@ export default class SGraphyPolygonItem extends SGraphyItem {
|
|
|
* @param text 修改的文字
|
|
|
* @param centerOfGravityPoint 文字的坐标
|
|
|
*/
|
|
|
- addText(text:string,centerOfGravityPoint?:{ x: number, y: number }){
|
|
|
- this.viewText = text;
|
|
|
- if(centerOfGravityPoint){
|
|
|
- this.centerOfGravityPoint = centerOfGravityPoint
|
|
|
- }
|
|
|
+ addText(text: string, centerOfGravityPoint?: { x: number, y: number }) {
|
|
|
+ this.viewText = text;
|
|
|
+ if (centerOfGravityPoint) {
|
|
|
+ this.centerOfGravityPoint = centerOfGravityPoint
|
|
|
+ }
|
|
|
}
|
|
|
/**
|
|
|
* Item绘制操作
|
|
@@ -161,10 +164,10 @@ export default class SGraphyPolygonItem extends SGraphyItem {
|
|
|
// } else {
|
|
|
// text = '⬇️ ' + this.initName
|
|
|
// }
|
|
|
- painter.font.size = this.scale*200;
|
|
|
+ painter.font.size = this.scale * 200;
|
|
|
painter.brush.color = SColor.Black;
|
|
|
// painter.drawText(text,this.centerOfGravityPoint.x,this.centerOfGravityPoint.y)
|
|
|
- painter.drawText(this.viewText,this.centerOfGravityPoint.x,this.centerOfGravityPoint.y)
|
|
|
+ painter.drawText(this.viewText, this.centerOfGravityPoint.x, this.centerOfGravityPoint.y)
|
|
|
}
|
|
|
}
|
|
|
onClick(event: SMouseEvent): boolean {
|
|
@@ -192,23 +195,23 @@ export default class SGraphyPolygonItem extends SGraphyItem {
|
|
|
return true;
|
|
|
} // Function onMouseDown()
|
|
|
|
|
|
- /**
|
|
|
- * 鼠标移动事件
|
|
|
- *
|
|
|
- * @param event 保存事件参数
|
|
|
- * @return boolean
|
|
|
- */
|
|
|
+ /**
|
|
|
+ * 鼠标移动事件
|
|
|
+ *
|
|
|
+ * @param event 保存事件参数
|
|
|
+ * @return boolean
|
|
|
+ */
|
|
|
onMouseMove(event: SMouseEvent): boolean {
|
|
|
this.$emit('mouseMove', event);
|
|
|
return true;
|
|
|
} // Function onMouseMove()
|
|
|
|
|
|
- /**
|
|
|
- * 释放鼠标事件
|
|
|
- *
|
|
|
- * @param event 保存事件参数
|
|
|
- * @return boolean
|
|
|
- */
|
|
|
+ /**
|
|
|
+ * 释放鼠标事件
|
|
|
+ *
|
|
|
+ * @param event 保存事件参数
|
|
|
+ * @return boolean
|
|
|
+ */
|
|
|
onMouseUp(event: SMouseEvent): boolean {
|
|
|
this.$emit('mouseUp', event);
|
|
|
return true;
|