Exemplo n.º 1
0
        private GraphvizEdge AddEdgeIfNotExist(string from, string to, GraphvizEdge.EdgeDir dir)
        {
            GraphvizEdge edge = DotModel.FindEdge(from, to);

            if (edge == null)
            {
                edge = new GraphvizEdge(from, to);
                DotModel.Add(edge);
            }
            edge.Dir = dir;
            return(edge);
        }
Exemplo n.º 2
0
        private void ProcessEdge(GraphvizTableRow row)
        {
            string edges = row[0].Value;

            GraphvizEdge.EdgeDir dir = ToDir(edges);
            var nodes = edges.Split(new string[] { "<->", "->", "--" }, StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < nodes.Length - 1; i++)
            {
                string from = nodes[i].Trim();
                string to   = nodes[i + 1].Trim();
                if (!string.IsNullOrEmpty(from) && !string.IsNullOrEmpty(to))
                {
                    GraphvizEdge edge = AddEdgeIfNotExist(from, to, dir);
                    ProcessEdgeAttributes(row, edge);
                }
            }
        }
Exemplo n.º 3
0
        private void ProcessEdgeAttributes(GraphvizTableRow row, GraphvizEdge edge)
        {
            if (LabelIndex >= 0)
            {
                string label = row[LabelIndex]?.Value;
                edge.Label = label?.Trim();
            }

            if (ColorIndex >= 0)
            {
                string color = row[ColorIndex]?.Value;
                edge.Color = color?.Trim();
            }

            if (ShapeIndex >= 0)
            {
                string shape = row[ShapeIndex]?.Value;
                edge.ArrowHead = shape?.Trim();
            }
        }
Exemplo n.º 4
0
 public void Add(GraphvizEdge edge) => Edges.Add(edge);