Esempio n. 1
0
 public void DisconnectNode(Link ln)
 {
     DisconnectNode(ln.Node1, ln.Node2);
 }
Esempio n. 2
0
        void FigurePanel_Click(object sender, EventArgs e)
        {
            Point p = this.PointToClient(Control.MousePosition);

            foreach (var pair in agentViews)
            {
                if (pair.Value.includes(p.X, p.Y))
                {
                    AgentIO io = pair.Key;

                    if ((e as MouseEventArgs).Button == MouseButtons.Left)
                    {
                        AgentStatePanel.RegisterAgent(io.Algorithm as IAATBasedAgent);
                    }
                    else if ((e as MouseEventArgs).Button == MouseButtons.Right)
                    {
                        //なにかエージェントが選択中ならば
                        if (AgentStatePanel.Agent != null)
                        {
                            var selected = (AgentStatePanel.Agent as AgentAlgorithm).Body;
                            var net = selected.Network;

                            if (io != selected)
                            {
                                var link = new Link(io, selected);

                                if (io.Neighbours.Contains(selected))
                                {
                                    net.DisconnectNode(link);
                                }
                                else{
                                    net.ConnectNode(link);
                                }

                            }
                        }

                    }

                    this.Invalidate();
                    return;
                }

            }

            AgentStatePanel.RegisterAgent(null);
            this.Invalidate();
        }
Esempio n. 3
0
 public void ConnectNode(Link ln)
 {
     ConnectNodes(ln.Node1, ln.Node2);
 }