private void plotLines(Population population, Color color) { Pen penBestIndividual = new Pen(color, 4); int genA, genB; Individual best = population.GetBestIndividual(); for (int i = 0; i < ConfigurationGA.sizeChromossome; i++) { if (i < ConfigurationGA.sizeChromossome - 1) { genA = best.GetGene(i); genB = best.GetGene(i + 1); } else { genA = best.GetGene(i); genB = best.GetGene(0); } int[] vetA = TablePoints.getCoordinates(genA); int[] vetB = TablePoints.getCoordinates(genB); g.DrawLine(penBestIndividual, vetA[0], vetA[1], vetB[0], vetB[1]); } }
private void plotPoints() { if (TablePoints.pointCount > 0) { for (int i = 0; i < TablePoints.pointCount; i++) { Pen blackPen = new Pen(Color.Red, 3); int[] coo = TablePoints.getCoordinates(i); //vetor de cordenadas; Rectangle rect = new Rectangle(coo[0] - 5, coo[1] - 5, 10, 10); g.DrawEllipse(blackPen, rect); g.DrawString((i + 1).ToString(), new Font("Arial Black", 11), Brushes.Black, coo[0] + 3, coo[1]); g.DrawString("X: " + coo[0].ToString(), new Font("Arial Black", 6), Brushes.Black, coo[0] - 20, coo[1] - 25); g.DrawString("Y: " + coo[1].ToString(), new Font("Arial Black", 6), Brushes.Black, coo[0] - 20, coo[1] - 18); } } }