private void ConnectNodes(StationTopoloty topo1, StationTopoloty topo2, string deviceName1, string deviceName2) { TopolotyNode leftNode = null; foreach (var item in topo1.Nodes) { if (item.NodeDevice.Name == deviceName1) { leftNode = item; } } TopolotyNode rightNode = null; foreach (var item in topo2.Nodes) { if (item.NodeDevice.Name == deviceName2) { rightNode = item; } } if (leftNode != null && rightNode != null) { leftNode.LeftNodes.Add(rightNode); rightNode.RightNodes.Add(leftNode); } }
private void LoadSecondStation() { StationElements elements_1 = StationElements.Open("StationElements1.xml", null); stationTopoloty_1_ = new StationTopoloty(); stationTopoloty_1_.Open("StationTopoloty1.xml", elements_1.Elements); foreach (var item in elements_1.Elements) { item.Left += 2000; } ConnectNodes(stationTopoloty_, stationTopoloty_1_, "201G", "301G"); ConnectNodes(stationTopoloty_, stationTopoloty_1_, "210G", "306G"); ConnectNodes(stationTopoloty_1_, stationTopoloty_, "413G", "115G"); //避免轨道连成环索引不方便 ConnectNodes(stationTopoloty_1_, stationTopoloty_, "416G", "114G"); //避免轨道连成环索引不方便 }
private void LoadStationTopo(string path) { stationTopoloty_ = new StationTopoloty(); stationTopoloty_.Open(path, stationElements_.Elements); }