private void buttonNewEdge_Click(object sender, EventArgs e) { NodeWrapper current_node = CurrentSelectedNodeWrapper(); if (current_node == null) { return; } TargetChooser new_edge_dlg = new TargetChooser(); new_edge_dlg.InitForNewEdge(CurrentGraph, current_node.GraphNode, "Choose destination node for the new edge"); new_edge_dlg.ShowDialog(); if (new_edge_dlg.DialogResult == System.Windows.Forms.DialogResult.OK) { current_node.GraphNode.ConnectTo(new_edge_dlg.ChosenNode); RebuildEdgeList(); } }
private void buttonFindPath_Click(object sender, EventArgs e) { NodeWrapper current_node = CurrentSelectedNodeWrapper(); if (current_node == null) { return; } TargetChooser destination_dlg = new TargetChooser(); destination_dlg.OfferAllNodes(CurrentGraph, "choose destination node for the path"); //, current_node.GraphNode); destination_dlg.ShowDialog(); if (destination_dlg.DialogResult == System.Windows.Forms.DialogResult.OK) { if (destination_dlg.ChosenNode == current_node.GraphNode) { MessageBox.Show("That's the same node"); } else { List <GlGraphEdge> short_path = CurrentGraph.ShortestPath(current_node.GraphNode, destination_dlg.ChosenNode); if (short_path == null) { MessageBox.Show("No path found"); } else { string path_desc = NodeWrapper.GetNodeName(current_node.GraphNode); foreach (GlGraphEdge one_step in short_path) { path_desc += "->" + NodeWrapper.GetNodeName(one_step.TargetNode); } MessageBox.Show(path_desc); } } } }
private void buttonFindPath_Click(object sender, EventArgs e) { NodeWrapper current_node = CurrentSelectedNodeWrapper(); if (current_node == null) return; TargetChooser destination_dlg = new TargetChooser(); destination_dlg.OfferAllNodes(CurrentGraph, "choose destination node for the path"); //, current_node.GraphNode); destination_dlg.ShowDialog(); if (destination_dlg.DialogResult == System.Windows.Forms.DialogResult.OK) { if (destination_dlg.ChosenNode == current_node.GraphNode) MessageBox.Show("That's the same node"); else { List<GlGraphEdge> short_path = CurrentGraph.ShortestPath(current_node.GraphNode, destination_dlg.ChosenNode); if (short_path == null) MessageBox.Show("No path found"); else { string path_desc = NodeWrapper.GetNodeName(current_node.GraphNode); foreach (GlGraphEdge one_step in short_path) { path_desc += "->" + NodeWrapper.GetNodeName(one_step.TargetNode); } MessageBox.Show(path_desc); } } } }
private void buttonNewEdge_Click(object sender, EventArgs e) { NodeWrapper current_node = CurrentSelectedNodeWrapper(); if (current_node == null) return; TargetChooser new_edge_dlg = new TargetChooser(); new_edge_dlg.InitForNewEdge(CurrentGraph, current_node.GraphNode, "Choose destination node for the new edge"); new_edge_dlg.ShowDialog(); if (new_edge_dlg.DialogResult == System.Windows.Forms.DialogResult.OK) { current_node.GraphNode.ConnectTo(new_edge_dlg.ChosenNode); RebuildEdgeList(); } }