import { ElementData } from "../types/ElementData"; import { Legend } from "../types/Legend"; import { Marker } from "../types/Marker"; import { Relation } from "../types/Relation"; import { SGraphElementType } from "../enums/SGraphElementType"; import { SMarkerType } from "../enums/SMarkerType"; import { SParser, SRelation } from '@saga-web/big/lib'; import { SNoneLegendItem } from '../items/SNoneLegendItem'; import { SLineLegendItem } from '../items/SLineLegendItem'; import { SZoneLegendItem } from '../items/SZoneLegendItem'; import { SImageLegendItem } from '../items/SImageLegendItem'; import { SImageMarkerItem } from '../items/SImageMarkerItem'; import { SLineMarkerItem } from '../items/SLineMarkerItem'; import { STextMarkerItem } from '../items/STextMarkerItem'; import { TipelineItem } from '../items/TipelineItem'; import { ItemOrder } from "@saga-web/big"; import { SItemStatus } from "@saga-web/big"; import { SSCPZZoneLegendItem } from '../items/SSCPZZoneLegendItem'; import { SFHFQZoneLegendItem } from '../items/SFHFQZoneLegendItem'; import { SCustomLegendItem } from '../items/SCustomLegendItem'; /** * 拓扑图信息解析器 * */ export class STopologyParser extends SParser { /** 图例list(非图例类型) */ noneLegendList: SNoneLegendItem[] = []; /** 图例list(线类型) */ lineLegendList: SLineLegendItem[] = []; /** 图例list(区域类型) */ zoneLegendList: SZoneLegendItem[] = []; /** 图例list(图标类型) */ imageLegendList: SImageLegendItem[] = []; /** 标识list(图类型) */ imageMarkerList: SImageMarkerItem[] = []; /** 标识list(线类型) */ lineMarkerList: SLineMarkerItem[] = []; /** 标识list(文本类型) */ textMarkerList: STextMarkerItem[] = []; /** 管线关系对象关系list */ relationList: SRelation[] = []; /** * 解析数据 * * @param data 系统图数据 * */ parseData(data: ElementData): void { if (data.Nodes) { data.Nodes.forEach((t: Legend): void => { this.addLegend(t); }); } if (data.Markers) { data.Markers.forEach((t: Marker): void => { this.addMarker(t); }); } if (data.Relations) { data.Relations.forEach((t: Relation): void => { this.addRelation(t); }); } } // Function parseData() /** * 添加图例节点至场景中 * * @param t 图例节点数据 * */ private addLegend(t: Legend): void { if (t.GraphElementType == 'None') { let item = new SNoneLegendItem(null, t); this.noneLegendList.push(item); } else if (t.GraphElementType == "Zone") { if (t.SubType == "SCPZ") { let item = new SSCPZZoneLegendItem(null, t); item.selectable = true; this.zoneLegendList.push(item); } else if (t.SubType == "FHFQ") { let item = new SFHFQZoneLegendItem(null, t); item.selectable = true; this.zoneLegendList.push(item); } else if (t.SubType == "CUSTOM") { let item = new SCustomLegendItem(null, t); item.selectable = true; this.zoneLegendList.push(item); } else { let item = new SZoneLegendItem(null, t); item.selectable = true; this.zoneLegendList.push(item); } } else if (t.GraphElementType == 'Image') { let item = new SImageLegendItem(null, t); item.selectable = true; this.imageLegendList.push(item); } } // Function addNode() /** * 添加标识对象至场景中 * * @param t 标识对象数据 * */ private addMarker(t: Marker): void { if (t.Type == "Image") { let item = new SImageMarkerItem(null, t); this.imageMarkerList.push(item); item.selectable = true; } else if (t.Type == "Line") { let item = new SLineMarkerItem(null, t); item.selectable = true; this.lineMarkerList.push(item); } else if (t.Type == "Text") { let item = new STextMarkerItem(null, t); item.selectable = true; this.textMarkerList.push(item); } } // Function addMarker() /** * 添加管线关系至场景中 * * @param t 管线关系对象数据 * */ private addRelation(t: Relation): void { let item = new TipelineItem(null, t); item.selectable = true; this.relationList.push(item); } // Function addRelation() } // class STopologyParser