123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- import { SParser } from '@saga-web/big/lib';
- import { SNoneLegendItem } from '../items/SNoneLegendItem';
- 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 { SSCPZZoneLegendItem } from '../items/SSCPZZoneLegendItem';
- import { SFHFQZoneLegendItem } from '../items/SFHFQZoneLegendItem';
- /**
- * 拓扑图信息解析器
- *
- */
- export class STopologyParser extends SParser {
- constructor() {
- super(...arguments);
- /** 图例list(非图例类型) */
- this.noneLegendList = [];
- /** 图例list(线类型) */
- this.lineLegendList = [];
- /** 图例list(区域类型) */
- this.zoneLegendList = [];
- /** 图例list(图标类型) */
- this.imageLegendList = [];
- /** 标识list(图类型) */
- this.imageMarkerList = [];
- /** 标识list(线类型) */
- this.lineMarkerList = [];
- /** 标识list(文本类型) */
- this.textMarkerList = [];
- /** 管线关系对象关系list */
- this.relationList = [];
- }
- /**
- * 解析数据
- *
- * @param data 系统图数据
- * */
- parseData(data) {
- if (data.Nodes) {
- data.Nodes.forEach((t) => {
- this.addLegend(t);
- });
- }
- if (data.Markers) {
- data.Markers.forEach((t) => {
- this.addMarker(t);
- });
- }
- if (data.Relations) {
- data.Relations.forEach((t) => {
- this.addRelation(t);
- });
- }
- } // Function parseData()
- /**
- * 添加图例节点至场景中
- *
- * @param t 图例节点数据
- * */
- addLegend(t) {
- 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 {
- 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 标识对象数据
- * */
- addMarker(t) {
- 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 管线关系对象数据
- * */
- addRelation(t) {
- let item = new TipelineItem(null, t);
- item.selectable = true;
- this.relationList.push(item);
- } // Function addRelation()
- } // class STopologyParser
|