public AdjacencyListTable(GraphRepresentation.AdjacencyList adjacencyList, AdjacencyListPanel adListPanel) { this.adjacencyList = adjacencyList; this.adListPanel = adListPanel; Cells = new List <List <CellAdjacencyList> >(); int stepX = 160; int stepY = 80; for (int i = 0; i < adjacencyList.adjacencyList.Count; ++i) { Cells.Add(new List <CellAdjacencyList>()); InfoTextLabel startId = new InfoTextLabel(40, 20, adListPanel.HorizontalScroll.Value, 20 + i * stepY, Convert.ToString(i) + ": "); adListPanel.Controls.Add(startId); for (int j = 0; j < adjacencyList.adjacencyList[i].Count; ++j) { int id = adjacencyList.adjacencyList[i][j].Connectable; int weight = adjacencyList.adjacencyList[i][j].Weight; Cells[i].Add(new CellAdjacencyList(id, weight, 40 + stepX * j, stepY * i)); adListPanel.Controls.Add(Cells[i][j]); } } }
public FindPathButton(int width, int height, int positionX, int positionY , GraphRepresentation.AdjacencyList adList, List <EdgeDraw> edgeDraws , InputCountBox startVertex, InputCountBox endVertex , StartForm.DrawForm drawForm, InfoTextLabel infoText) { Size = new System.Drawing.Size(width, height); Location = new System.Drawing.Point(positionX, positionY); Text = "Find path"; Click += new EventHandler(ButtonClick); this.adList = adList; this.edgeDraws = edgeDraws; this.startVertex = startVertex; this.endVertex = endVertex; this.drawForm = drawForm; this.infoText = infoText; path = null; }
public ShortestPathPanel(int width, int height, int positionX, int positionY , GraphRepresentation.AdjacencyList adList, List <EdgeDraw> edgeDraws , StartForm.DrawForm drawForm) { Size = new System.Drawing.Size(width, height); Location = new System.Drawing.Point(positionX, positionY); BorderStyle = BorderStyle.Fixed3D; Anchor = (AnchorStyles.Top | AnchorStyles.Left); Visible = false; this.adList = adList; this.edgeDraws = edgeDraws; infoText = new InfoTextLabel(180, 20, 10, 20, "Path: "); Controls.Add(infoText); startVertexText = new InfoTextLabel(65, 20, 0, 60, "From:"); Controls.Add(startVertexText); endVertexText = new InfoTextLabel(45, 20, Size.Width - 100, 60, "To:"); Controls.Add(endVertexText); startVertex = new InputCountBox(20, 20, 65, 60); Controls.Add(startVertex); endVertex = new InputCountBox(20, 20, Size.Width - 55, 60); Controls.Add(endVertex); findPathButton = new FindPathButton(95, 30, Size.Width / 2 - 45, Size.Height - 60, adList, edgeDraws , startVertex, endVertex, drawForm, infoText); Controls.Add(findPathButton); }
public AdjacencyListPanel(int width, int height, int positionX, int positionY, GraphRepresentation.AdjacencyList adjacencyList) { Size = new System.Drawing.Size(width, height); Location = new System.Drawing.Point(positionX, positionY); Dock = DockStyle.Right; AutoScroll = true; BorderStyle = BorderStyle.Fixed3D; AdListTable = new AdjacencyListTable(adjacencyList, this); Visible = false; }