public Boolean visited; //访问标志,遍历时使用 public Vertex(Station value) //构造方法 { data = value; }
public static Track getTrack(Station from, Station to) { Track track = new Track(); string path = ""; path = from.name + "->" + to.name; switch (path) { case "W0->P1": //1 track.Name = null; track.StartStation = "Start"; track.EndStation = "P1"; track.AddArc(150, 350, 100, 100, 180, 90); break; case "P1->K1": //2 track.Name = null; track.StartStation = "P1"; track.EndStation = "K1"; track.AddLine(200, 350, 350, 350); break; case "K1->F1": //3 track.Name = "K1S"; track.StartStation = "K1"; track.EndStation = "F1"; track.AddLine(350, 350, 450, 350); break; case "K1->T1": //4 track.Name = "K1L"; track.StartStation = "K1"; track.EndStation = "T1"; track.AddArc(350, 300, 100, 100, 180, 90); break; case "T1->F1": //5 track.Name = "T1"; track.StartStation = "T1"; track.EndStation = "F1"; track.AddArc(350, 300, 100, 100, 270, 90); break; case "F1->P2": //6 track.Name = null; track.StartStation = "F1"; track.EndStation = "P2"; track.AddLine(450, 350, 600, 350); break; case "P2->P4": //7 track.Name = null; track.StartStation = "P2"; track.EndStation = "P4"; track.AddArc(550, 350, 100, 100, 270, 180); break; case "P4->F2": //8 track.Name = null; track.StartStation = "P4"; track.EndStation = "F2"; track.AddLine(600, 450, 450, 450); break; case "F2->K2": //9 track.Name = "F2S"; track.StartStation = "F2"; track.EndStation = "K2"; track.AddLine(450, 450, 350, 450); break; case "F2->T2": //10 track.Name = "F2L"; track.StartStation = "F2"; track.EndStation = "T2"; track.AddArc(350, 400, 100, 100, 0, 90); break; case "T2->K2": //11 track.Name = "T2"; track.StartStation = "T2"; track.EndStation = "K2"; track.AddArc(350, 400, 100, 100, 90, 90); break; case "K2->P3": //12 track.Name = null; track.StartStation = "K2"; track.EndStation = "P3"; track.AddLine(350, 450, 200, 450); break; case "P3->W0": //13 track.Name = "W0"; track.StartStation = "P3"; track.EndStation = "Start"; track.AddArc(150, 350, 100, 100, 90, 90); break; default: break; } return(track); }