예제 #1
0
        void generarAristas()
        {
            int ponderacion = 0;
            int j           = 0;
            int generarID   = 0;
            //Arista aux = new Arista(-1, null, null, 5000);
            List <Point> pList;

            for (int i = 0; i < grafo.getVertices().Count; i++)
            {
                for (j = i + 1; j < grafo.getVertices().Count; j++)
                {
                    ponderacion = obtenerDistancia(grafo.getVertices()[i].getCentro(), grafo.getVertices()[j].getCentro());
                    pList       = new List <Point>(detectarObstaculos(grafo.getVertices()[i].getCentro(), grafo.getVertices()[j].getCentro()));

                    if (pList.Count != 0)
                    {
                        Arista arista = new Arista(generarID, grafo.getVertices()[i], grafo.getVertices()[j], ponderacion, pList);
                        grafo.getVertices()[i].agregarArista(arista);
                        generarID++;
                        pList.Reverse();
                        Arista _arista = new Arista(generarID, grafo.getVertices()[j], grafo.getVertices()[i], ponderacion, pList);
                        grafo.getVertices()[j].agregarArista(_arista);
                        generarID++;
                        //	MessageBox.Show("Primero elemento X: "+arista.getListaPixeles()[0].X+" Y:"+arista.getListaPixeles()[0].Y);

                        //MessageBox.Show("Primero elemento X: "+_arista.getListaPixeles()[0].X+" Y:"+_arista.getListaPixeles()[0].Y);
                        pictureBox1.Refresh();
                    }
                }
            }
            pictureBox1.Refresh();
            dibujarPonderacion();
            pintarAristas();
        }
 public void agregarArista(Arista l)
 {
     this.aL.Add(l);
 }