|
@@ -15,6 +15,17 @@ import { Zone } from "../types/floor/Zone";
|
|
|
import { SImageItem, STextItem } from "..";
|
|
|
import { ImageData } from "../types/ImageData";
|
|
|
import { TextData } from "../types/TextData";
|
|
|
+import { Node } from "../types/topology/Node";
|
|
|
+import { Marker } from "../types/topology/Marker";
|
|
|
+import { Relation } from "../types/topology/Relation";
|
|
|
+import { SEntityItem } from "./../items/topology/SEntityItem";
|
|
|
+import { SRelation } from "./../items/topology/SRelation";
|
|
|
+import { SLineRelation } from "./../items/topology/SLineRelation";
|
|
|
+import { SVerticalRelation } from "./../items/topology/SVerticalRelation";
|
|
|
+import { SCurveRelation } from "./../items/topology/SCurveRelation";
|
|
|
+import { Anchor } from "../types/topology/Anchor";
|
|
|
+import { SAnchorItem } from "../items/topology/SAnchorItem";
|
|
|
+import { SLineType } from "../enums/SLineType";
|
|
|
|
|
|
/**
|
|
|
* 拓扑图信息解析器
|
|
@@ -115,4 +126,60 @@ export class SItemFactory {
|
|
|
// createText(data: TextData): STextItem {
|
|
|
// return new STextItem(null);
|
|
|
// } // Function createImage()
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建图例节点item
|
|
|
+ *
|
|
|
+ * @param data 图例节点数据
|
|
|
+ * */
|
|
|
+ createNode(data: Node): SEntityItem {
|
|
|
+ let entityItem = new SEntityItem(null);
|
|
|
+ if (data.AnchorList && data.AnchorList.length ) {
|
|
|
+ data.AnchorList.forEach((anchor: Anchor) => {
|
|
|
+ let anchorItem = new SAnchorItem(entityItem);
|
|
|
+ if (anchor && anchor.Pos) {
|
|
|
+ anchorItem.moveTo(anchor.Pos.X, anchor.Pos.Y)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return entityItem;
|
|
|
+ } // Function createNode()
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建标识item
|
|
|
+ *
|
|
|
+ * @param data 标识对象数据
|
|
|
+ * */
|
|
|
+ createMarker(data: Marker): SImageItem {
|
|
|
+ return new SImageItem(null);
|
|
|
+ } // Function createMarker()
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建管线关系item
|
|
|
+ *
|
|
|
+ * @param data 管线关系对象数据
|
|
|
+ * */
|
|
|
+ createRelation(data: Relation): SRelation {
|
|
|
+ switch(data.LineType) {
|
|
|
+ case SLineType.Straight:
|
|
|
+ return new SLineRelation(null);
|
|
|
+ case SLineType.Angle:
|
|
|
+ return new SVerticalRelation(null);
|
|
|
+ case SLineType.Curve:
|
|
|
+ return new SCurveRelation(null);
|
|
|
+ default:
|
|
|
+ return new SLineRelation(null);
|
|
|
+ }
|
|
|
+ } // Function createRelation()
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建锚点item
|
|
|
+ *
|
|
|
+ * @param data 锚点数据
|
|
|
+ * */
|
|
|
+ createAnchor(data: Anchor): SAnchorItem {
|
|
|
+ return new SAnchorItem(null);
|
|
|
+ } // Function createAnchor()
|
|
|
+
|
|
|
} // class SItemFactory
|