public override void OnMouseDown(DrawArea drawArea, System.Windows.Forms.MouseEventArgs e) { DrawPower pow = new DrawPower(e.X, e.Y, 80, 53); //在结点链表里加结点 VertexNode temp = new VertexNode(ComFunction.NewNodeNumber()); pow.ObjectID = ComFunction.NewEquipmentNumber(); temp.BelongsIndex = pow.ObjectID; base.AddNewObject(drawArea, pow); base.AddNewNode(drawArea, temp); }
/// <summary> /// 进行深度优先搜索() /// </summary> /// <param name="drawArea"></param> public void Do_DFS(DrawArea drawArea) { List <int> temp = new List <int>(); //用于记录电源的编号 for (int i = 0; i < drawArea.GraphicsList.Count; i++) { if (drawArea.GraphicsList[i] is DrawPower) { DrawPower temp1 = drawArea.GraphicsList[i] as DrawPower; temp.Add(FindVertextID(drawArea, temp1.ObjectID, 1)); } } drawArea.GraphicsNodeList.DFSTraversal(temp); }