import { SPoint } from "@saga-web/draw/lib"; import { SPolylineItem } from '@saga-web/big/lib'; /** * 图例节点Item(线类型) * * * @author 张宇(taohuzy@163.com) */ export class SLineLegendItem extends SPolylineItem { /** * 构造函数 * * @param parent 指向父对象 * @param data 图例节点对象数据 */ constructor(parent, data) { super(parent, []); this.data = data; this.id = data.ID; this.name = data.Name; this.moveTo(data.Pos.X, data.Pos.Y); if (data.Properties && data.Properties.Line) { let setPointList; setPointList = data.Properties.Line.map(i => { return new SPoint(i.x, i.y); }); this.pointList = setPointList; } if (data.Properties && data.Properties.LineWidth) { this.lineWidth = data.Properties.LineWidth; } if (data.Properties && data.Properties.StrokeColor) { this.strokeColor = data.Properties.StrokeColor; } } toData() { this.data.Pos = { X: this.x, Y: this.y }; this.data.Properties.Line = this.pointList.map(pos => { return { X: pos.x, Y: pos.y }; }); this.data.Properties.LineWidth = this.lineWidth; this.data.Properties.StrokeColor = this.strokeColor; return this.data; } } // Class SLineLegendItem