private void ParseNodeString(string nodeLine) { var values = nodeLine.Split(' '); int parameters = 3; if (nodeLine.Contains("Edges:")) { _state = PARSE_EDGES; return; } if (values.Length == 0) { return; } int nodeId = 0; string nodeLabel = ""; int xPos = 0; int yPos = 0; int actualParam = 0; for (int i = 0; i < values.Length && i < parameters; i++) { string token = values[i]; switch (i) { case 0: int.TryParse(token, out nodeId); nodeLabel = nodeId.ToString(); break; case 1: int.TryParse(token, out xPos); break; case 2: int.TryParse(token, out yPos); break; } } TopologicalNode topoNode = new TopologicalNode(nodeId, nodeLabel, xPos, yPos); _graph.AddNode(topoNode); }
public void AddNode(TopologicalNode node) { _nodeList.Add(node); }