1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import { SGraphItem } from "@saga-web/graph/lib";
- import { SPoint } from "@saga-web/draw/lib";
- import { SPolylineItem } from '@saga-web/big/lib';
- import { Legend } from '../types/Legend';
- /**
- * 图例节点Item(线类型)
- *
- * * @author 张宇(taohuzy@163.com)
- */
- export class SLineLegendItem extends SPolylineItem {
- /** 图例节点对象数据 */
- data: Legend;
- /**
- * 构造函数
- *
- * @param parent 指向父对象
- * @param data 图例节点对象数据
- */
- constructor(parent: SGraphItem | null, data: Legend) {
- super(parent,[]);
- this.data = data;
- this.id = data.ID;
- this.name = data.Name;
- this.moveTo(data.Pos.X, data.Pos.Y);
- if (data.Properties.Zorder) {
- this.zOrder = data.Properties.Zorder;
- }
- if (data.Properties && data.Properties.Line) {
- let setPointList: SPoint[];
- 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(): Legend {
- 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.Zorder = this.zOrder;
- this.data.Properties.LineWidth = this.lineWidth;
- this.data.Properties.StrokeColor = this.strokeColor;
- return this.data;
- }
- } // Class SLineLegendItem
|