public bool CheckTopNum(node_view top) { foreach (node_view model in TopList) if (top.TopNum == model.TopNum && model != top) return false; return true; }
public graphNodeCS(node_view parentView) { InitializeComponent(); this.parentView = parentView; Canvas.SetZIndex(this, 2); this.point.Width = this.point.Height = NodeRadius; opaqueBrush = new SolidColorBrush(Colors.Black); opaqueBrush.Opacity = 0; }
public void AddTop(bool center) { node_view top = new node_view(this); if (center) top.CNTRPosition(); else OnPointPositionChanged(top); }
public void DeleteNode(node_view top) { if (TopList.Contains(top)) { for (int i = edgeList.Count-1; i >=0; i--) if (edgeList[i].From == top || edgeList[i].To == top) DeleteEdge(edgeList[i]); TopList.Remove(top); canvas.Children.Remove(top.View); } }
public void OnPointPositionChanged(node_view top) { top.UpdPos(); Canvas.SetLeft(top.GRNode, top.RELPos.X); Canvas.SetTop(top.GRNode, top.RELPos.Y); }
public void AddTop(double X, double Y, string id) { node_view top = new node_view(this); top.GivenPosition(X, Y, id); }
public void EndAddEdge() { edgeAdd = false; FirstTop = null; }
public void AddEdge(int index_from, int index_to) { bool isExist = false; node_view from_node = TopList[index_from]; node_view to_node = TopList[index_to]; foreach (edge_view line0 in edgeList) if ((line0.From == from_node && line0.To == to_node) || (line0.To == from_node && line0.From == to_node)) { MessageBox.Show("Дуга вже існує"); isExist = true; } if (!isExist) { edge_view line = new edge_view(this, from_node, to_node); edgeList.Add(line); FirstTop = null; EndAddEdge(); } }