Beispiel #1
0
 public void AddItem(object sender, EventArgs e)
 {
     DiagramItem item = new DiagramItem(helper);
     rectangleXTextEdit.Value = DiagramConstant.Random.Next(10, 800);
     rectangleYTextEdit.Value = DiagramConstant.Random.Next(10, 800);
     item.Location = new Point((int)rectangleXTextEdit.Value, (int)rectangleYTextEdit.Value);
     helper.DiagramItems.Add(item);
 }
Beispiel #2
0
 public DiagramItem Create(DiagramHelper owner, string id)
 {
     if(ht.ContainsKey(id)) return (DiagramItem)ht[id];
     else {
         var result = new DiagramItem(owner) { Name = id };
         ht.Add(id, result);
         return result;
     }
 }
Beispiel #3
0
 public void DepthFirstSearch(DiagramItem item)
 {
     used[item.Id] = true;
     list.Add(item);
     var edgesList = edges.Where(x => (x.Item1 == item && x.Item2 != item) || x.Item2 == item);
     foreach (var e in edgesList) {
         if (e.Item1 != item) {
             var temp = e.Item2;
             e.Item2 = e.Item1;
             e.Item1 = temp;
         }
     }
     foreach (var edge in edgesList) {
         if (!used[edge.Item2.Id]) {
             DepthFirstSearch(edge.Item2);
         }
     }
 }
Beispiel #4
0
 void AddDiagramItemInFullDiagramItems(DiagramItem DiagramItem)
 {
     if (!IsFullDiagramItemsContain(DiagramItem)) diagramItemsFull.Add(DiagramItem);
 }
Beispiel #5
0
 bool IsFullDiagramItemsContain(DiagramItem DiagramItem)
 {
     foreach(DiagramItem item in diagramItemsFull)
         if(item.Name == DiagramItem.Name)
             return true;
     return false;
 }
Beispiel #6
0
 protected override void OnMouseUp(MouseEventArgs e)
 {
     base.OnMouseUp(e);
     dragItem = null;
     startPoint = Point.Empty;
 }
Beispiel #7
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     base.OnMouseDown(e);
     dragItem = helper.CalcHitInfo(Point.Add(e.Location,new Size(-globalOffset.Width, -globalOffset.Height)));
     startPoint = e.Location;
 }
Beispiel #8
0
 internal object XtraCreateDiagramItemsItem(XtraItemEventArgs e)
 {
     DiagramItem item = new DiagramItem(this);
     DiagramItems.Add(item);
     return item;
 }