|
@@ -2,6 +2,8 @@ import { SPolylineItem } from '@saga-web/big/lib';
|
|
|
import { SPainter, SColor } from '@saga-web/draw';
|
|
|
import { SAnchorItem, SGraphItem } from '@saga-web/graph/lib';
|
|
|
import { Relation } from '../types/Relation';
|
|
|
+import { SPoint } from "@saga-web/draw/lib";
|
|
|
+import {Point} from "@saga-web/big/lib/types/Point";
|
|
|
|
|
|
/**
|
|
|
* 管道item
|
|
@@ -12,6 +14,61 @@ export class TipelineItem extends SPolylineItem {
|
|
|
startAnchor: SAnchorItem | null = null;
|
|
|
/** 结束锚点 */
|
|
|
endAnchor: SAnchorItem | null = null;
|
|
|
+ /** 对应的图例ID */
|
|
|
+ _graphElementId: string = "";
|
|
|
+ get graphElementId(): string {
|
|
|
+ return this._graphElementId;
|
|
|
+ }
|
|
|
+ set graphElementId(v: string) {
|
|
|
+ this._graphElementId = v;
|
|
|
+ if (this.data) {
|
|
|
+ this.data.GraphElementId = this._graphElementId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /** 关联节点1ID */
|
|
|
+ _node1Id: string = "";
|
|
|
+ get node1Id(): string {
|
|
|
+ return this._node1Id;
|
|
|
+ }
|
|
|
+ set node1Id(v: string) {
|
|
|
+ this._node1Id = v;
|
|
|
+ if (this.data) {
|
|
|
+ this.data.Node1ID = this._node1Id;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /** 关联节点2ID */
|
|
|
+ _node2Id: string = "";
|
|
|
+ get node2Id(): string {
|
|
|
+ return this._node2Id;
|
|
|
+ }
|
|
|
+ set node2Id(v: string) {
|
|
|
+ this._node2Id = v;
|
|
|
+ if (this.data) {
|
|
|
+ this.data.Node2ID = this._node2Id;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /** 关联锚点1ID */
|
|
|
+ _anchor1ID: string = "";
|
|
|
+ get anchor1ID(): string {
|
|
|
+ return this._anchor1ID;
|
|
|
+ }
|
|
|
+ set anchor1ID(v: string) {
|
|
|
+ this._anchor1ID = v;
|
|
|
+ if (this.data) {
|
|
|
+ this.data.Anchor1ID = this._anchor1ID;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /** 关联锚点2ID */
|
|
|
+ _anchor2ID: string = "";
|
|
|
+ get anchor2ID(): string {
|
|
|
+ return this._anchor2ID;
|
|
|
+ }
|
|
|
+ set anchor2ID(v: string) {
|
|
|
+ this._anchor2ID = v;
|
|
|
+ if (this.data) {
|
|
|
+ this.data.Anchor2ID = this._anchor2ID;
|
|
|
+ }
|
|
|
+ }
|
|
|
/** 数据存储 */
|
|
|
data: Relation | null = null;
|
|
|
/** 接收事件作出修改 */
|
|
@@ -32,8 +89,44 @@ export class TipelineItem extends SPolylineItem {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // constructor(parent: SGraphItem | null, data: Relation) {
|
|
|
- // super(parent, data.PointList);
|
|
|
- // this.data = data;
|
|
|
- // }
|
|
|
+ constructor(parent: SGraphItem | null, data: Relation) {
|
|
|
+ super(parent, []);
|
|
|
+ this.pointList = data.PointList.map(item => {
|
|
|
+ return new SPoint(item.X,item.Y);
|
|
|
+ });
|
|
|
+ this.data = data;
|
|
|
+ this.id = data.ID;
|
|
|
+ if (data.GraphElementId) {
|
|
|
+ this._graphElementId = data.GraphElementId
|
|
|
+ }
|
|
|
+ if (data.Node1ID) {
|
|
|
+ this._node1Id = data.Node1ID
|
|
|
+ }
|
|
|
+ if (data.Node2ID) {
|
|
|
+ this._node2Id = data.Node2ID
|
|
|
+ }
|
|
|
+ if (data.Anchor1ID) {
|
|
|
+ this._anchor1ID = data.Anchor1ID
|
|
|
+ }
|
|
|
+ if (data.Anchor2ID) {
|
|
|
+ this._anchor2ID = data.Anchor2ID
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 获取data数据 */
|
|
|
+ getData(): Relation | null {
|
|
|
+ let pointList:Point[] = this.pointList.map(item => {
|
|
|
+ return {
|
|
|
+ X: item.x,
|
|
|
+ Y: item.y
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (this.data) {
|
|
|
+ this.data.PointList = pointList;
|
|
|
+ }
|
|
|
+
|
|
|
+ return this.data
|
|
|
+ }
|
|
|
}
|