예제 #1
0
파일: GraphBox.cs 프로젝트: Raixur/BeGraph
		/// <summary>
		/// Generating vertex at cursor point. Display input 
		/// form which requires you to enter name of the vertex. 
		/// </summary>
		/// <param name="p">p is current position of the mouse cusror</param>
		/// <returns>Returns generated vertex</returns>
		private Vertex GenerateVert(Point p) {
			if (HaveSpace(p)) {
				InputDialog.InputDialog id = new InputDialog.InputDialog("Enter name of a vertex", "Vertex generation");
				DialogResult dResult = id.ShowDialog(this);
				if (dResult == DialogResult.OK) {
					Vertex v = new Vertex(id.getInput(), p);			
					return v;
				}
			}
			else
				MessageBox.Show("Invalid place to put a vertex!", "Error", MessageBoxButtons.OK);
			return null;
		}
예제 #2
0
파일: GraphBox.cs 프로젝트: Raixur/BeGraph
		private void pb_MouseDown(object sender, MouseEventArgs me) {
			switch (me.Button) {
				case MouseButtons.Left:
					if (me.Clicks == 1) {
						isMouseButtonLeftDown = true;
						last = g.VertAt(me.Location);
					}
					break;
				case MouseButtons.Right:
					// TODO: implement moving vertexes
					break;
			}
		}
예제 #3
0
파일: Edge.cs 프로젝트: Raixur/BeGraph
 public Edge(Vertex f, Vertex s, double w = 0.0){
     first = f;
     second = s;
     weight = w;
 }