예제 #1
0
        private void PintaArista(Nodo nodoIni, Nodo nodoEnd, Arista arista)
        {
            var nix = nodoIni.X;
            var niy = nodoIni.Y;
            var nfx = nodoEnd.X;
            var nfy = nodoEnd.Y;
            AdjustableArrowCap finfle = new AdjustableArrowCap(5, 5);

            _plumaFlechaR.EndCap       = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
            _plumaFlechaR.CustomEndCap = finfle;

            if (nix < nfx && niy > nfy)
            {
                _graphics.DrawLine(_plumaFlechaR, nix + 20, niy + 20, nfx + 5, nfy + 30);
            }
            if (nix > nfx && niy > nfy)
            {
                _graphics.DrawLine(_plumaFlechaR, nix + 20, niy + 20, nfx + 30, nfy + 30);
            }
            if (nix < nfx && niy < nfy)
            {
                _graphics.DrawLine(_plumaFlechaR, nix + 20, niy + 20, nfx + 5, nfy + 5);
            }
            if (nix > nfx && niy < nfy)
            {
                _graphics.DrawLine(_plumaFlechaR, nix + 20, niy + 20, nfx + 30, nfy + 5);
            }
            if (nix == nfx && nix > nfy)
            {
                _graphics.DrawLine(_plumaFlechaR, nix + 20, niy + 20, nfx + 15, nfy + 30);
            }
            if (nix == nfx && niy < nfy)
            {
                _graphics.DrawLine(_plumaFlechaR, nix + 20, niy + 20, nfx + 15, nfy + 30);
            }
            if (nix < nfx && niy == nfy)
            {
                _graphics.DrawLine(_plumaFlechaR, nix + 20, niy + 20, nfx - 5, nfy + 15);
            }
            if (nix > nfx && niy == nfy)
            {
                _graphics.DrawLine(_plumaFlechaR, nix + 20, niy + 20, nfx + 35, nfy + 15);
            }
            if (nix == nfx && niy == nfy)
            {
                creaVuelta(nodoIni, _graphics, 2);
            }

            _graphics.DrawRectangle(pincel, 20, 20, 51, 51);
            _graphics.FillRectangle(colorultipos, 20, 20, 50, 50);
            _graphics.DrawString(arista.Id.ToString(), fuente3, coloranul, 25, 25);

            pBAfd.Refresh();
        }
예제 #2
0
        private void creaVuelta(Nodo afdNodo, Graphics g, int op)
        {
            PointF p1 = new PointF(afdNodo.X, afdNodo.Y + 15);
            PointF p2 = new PointF(afdNodo.X - curva - 10, afdNodo.Y + 15 + curva);
            PointF p3 = new PointF((afdNodo.X - (curva * 3)), afdNodo.Y + 15);
            PointF p4 = new PointF(afdNodo.X - curva - 10, afdNodo.Y - 5);
            PointF p5 = new PointF(afdNodo.X, afdNodo.Y + 15);

            PointF[] arreglo = { p1, p2, p3, p4, p5 };
            g.DrawCurve(_plumaFlecha, arreglo);
            if (op == 2)
            {
                g.DrawCurve(_plumaFlechaR, arreglo);
            }
        }
예제 #3
0
        private void dibuja(Nodo afdNodo, Graphics dib)
        {
            AdjustableArrowCap finfle = new AdjustableArrowCap(5, 5);

            _plumaFlecha.EndCap       = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
            _plumaFlecha.CustomEndCap = finfle;

            if (afdNodo.Type == NodoType.Inicio)
            {
                dib.DrawString(afdNodo.Type.ToString(), fuente, coloranul, afdNodo.X - 20, afdNodo.Y - 50);
                dib.DrawLine(_plumaFlecha, afdNodo.X + 15, afdNodo.Y - 30, afdNodo.X + 15, afdNodo.Y);
            }
            dib.DrawEllipse(pincel, afdNodo.X, afdNodo.Y, 36, 36);
            dib.FillEllipse(relleno, afdNodo.X, afdNodo.Y, 35, 35);
            dib.DrawString(afdNodo.Id.ToString(), fuente, coloranul, afdNodo.X + 5, afdNodo.Y + 5);
            if (afdNodo.Type == NodoType.Fin)
            {
                dib.DrawEllipse(pincel, afdNodo.X + 2, afdNodo.Y + 2, 31, 31);
            }
        }
예제 #4
0
 private void HazFlechas(Nodo afdNodo, Nodo nodo)
 {
 }
예제 #5
0
        private static void CreaAristas(IEnumerable <int[]> sigPos, IEnumerable <Nodo> nodos, IEnumerable <Nodo> newEst, Nodo origen)
        {
            var id = 'a';

            foreach (var nodo in sigPos.Select(destino => GetNodoFromArray(nodos.Union(newEst), destino)).
                     Where(nodo => nodo != null))
            {
                origen.Aristas.Add(new Arista {
                    Id = id++, Nodo = nodo
                });
            }
        }
예제 #6
0
 public static bool SequenceContains(this IEnumerable <int[]> sequence, AFD.Nodo nodo)
 {
     return(sequence.Any(arr => arr.SequenceEqual(nodo.Arreglo)));
 }