12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import { SGraphItem } from "@saga-web/graph/lib";
- import { SPoint } from "@saga-web/draw/lib";
- import { SLineItem, ItemOrder } from '@saga-web/big/lib';
- import { Marker } from '../types/Marker';
- /**
- * 标识对象Item(线类型)
- *
- * * @author 张宇(taohuzy@163.com)
- */
- export class SLineMarkerItem extends SLineItem {
- /** 标识对象数据 */
- data: Marker;
- /**
- * 构造函数
- *
- * @param parent 指向父对象
- * @param data 标识对象数据
- */
- constructor(parent: SGraphItem | null, data: Marker) {
- super(parent);
- this.zOrder = ItemOrder.lineOrder;
- 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: SPoint[];
- setPointList = data.Properties.Line.map(i => {
- return new SPoint(i.X, i.Y)
- })
- this.line = setPointList;
- }
- if (data.Properties && data.Properties.LineWidth) {
- this.lineWidth = data.Properties.LineWidth;
- }
- if (data.Properties && data.Properties.LineStyle) {
- this.lineStyle = data.Properties.LineStyle;
- }
- if (data.Properties && data.Properties.StrokeColor) {
- this.strokeColor = data.Properties.StrokeColor;
- }
- } // Constructor
- toData(): Marker {
- this.data.Pos = {X: this.x, Y: this.y};
- this.data.Properties.Line = this.line.map(pos => {
- return {
- X: pos.x,
- Y: pos.y
- }
- });
- this.data.Properties.LineWidth = this.lineWidth;
- this.data.Properties.StrokeColor = this.strokeColor;
- this.data.Properties.LineStyle = this.lineStyle;
- return this.data;
- }
- } // Class SLineMarkerItem
|