Exemple #1
0
 public bool SetSelectedByPos(int x, int y)
 {
     int num;
     bool flag = false;
     if (!this.TestCaptureByPos(x, y))
     {
         return false;
     }
     flag = false;
     for (num = this.mNodes.Count - 1; num >= 0; num--)
     {
         this.mNodes[num].Selected = false;
         if (!flag && this.mNodes[num].TestCapture(x, y))
         {
             this.mNodes[num].Selected = true;
             flag = true;
             this.mSelectedUnit = this.mNodes[num];
         }
     }
     for (num = this.mALines.Count - 1; num >= 0; num--)
     {
         this.mALines[num].Selected = false;
         if (!flag && this.mALines[num].TestCapture(x, y))
         {
             this.mALines[num].Selected = true;
             flag = true;
             this.mSelectedUnit = this.mALines[num];
         }
     }
     this.Draw();
     if (flag)
     {
         this.OnUnitSelect(EventArgs.Empty);
     }
     return flag;
 }
Exemple #2
0
 public void SetUnitSelect(string id)
 {
     int num;
     for (num = this.mNodes.Count - 1; num >= 0; num--)
     {
         if (this.mNodes[num].ID == id)
         {
             this.SelectedUnit = this.mNodes[num];
             return;
         }
     }
     for (num = this.mALines.Count - 1; num >= 0; num--)
     {
         if (this.mALines[num].ID == id)
         {
             this.SelectedUnit = this.mALines[num];
             break;
         }
     }
 }
Exemple #3
0
 public void RemoveUnit(GraphUnit u)
 {
     if (u is Node)
     {
         this.OnUnitRemove(EventArgs.Empty);
         for (int i = this.mALines.Count - 1; i >= 0; i--)
         {
             if ((this.mALines[i].StartNode == u) || (this.mALines[i].EndNode == u))
             {
                 this.mALines.Remove(this.mALines[i]);
             }
         }
         this.mNodes.Remove((Node) u);
         this.Draw();
     }
     else if (u is ArrowLine)
     {
         this.OnUnitRemove(EventArgs.Empty);
         this.mALines.Remove((ArrowLine) u);
         this.Draw();
     }
 }