Ejemplo n.º 1
0
        public void AddNewNode(ACOCity cityToAdd, List <ACOCity> citiesFromState)
        {
            _namesCounter++;
            ACOCity city = new ACOCity((string)cityToAdd.СityName.Clone());

            for (int i = 0; i < _Graph.GetCities().Count; i++)
            {
                city.Connect(_Graph.GetCities()[i], (ACODistance)cityToAdd.GetDistanceTo(citiesFromState[i]));
            }

            foreach (ACOCity c in _Graph.GetCities())
            {
                city.Connect(c, new ACODistance(1, 0.5));
            }
            _Graph.AddCity(city);

            Node node = new Node(city);

            node.Width    = _nodeSize;
            node.Height   = _nodeSize;
            node.Location = _OldNodes[_Nodes.Count].Location;
            _Nodes.Add(node);
            this.Controls.Add(node);

            this.Refresh();
        }
Ejemplo n.º 2
0
 public Node(ACOCity city)
 {
     InitializeComponent();
     City = city;
     Text = city.СityName;
     InitBindedDistancesLength();
 }
Ejemplo n.º 3
0
 private Node PickNodeByCity(ACOCity c)
 {
     foreach (Node n in _Nodes)
     {
         if (n.City == c)
         {
             return(n);
         }
     }
     return(_Nodes[0]);
 }
Ejemplo n.º 4
0
        public void AddNewNode()
        {
            _namesCounter++;
            ACOCity city = new ACOCity(_namesCounter + "");

            foreach (ACOCity c in _Graph.GetCities())
            {
                city.Connect(c, new ACODistance(1, 0.5));
            }

            _Graph.AddCity(city);

            Node node = new Node(city);

            node.Width  = _nodeSize;
            node.Height = _nodeSize;
            _Nodes.Add(node);
            this.Controls.Add(node);
            PlaceNodesAround();
            this.Refresh();
        }