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(); }
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(); }