예제 #1
0
        public DotHtmlTable SimpleTable(IEnumerable <KeyValuePair <string, IDotHtmlLabel> > tableContents)
        {
            var table =
                DotUtils.Table()
                .SetBorder(0);

            //Add a row with a single cell and port name for each entry
            table
            .AddRows(
                tableContents.Select(
                    item =>
                    DotUtils.Cell()
                    .SetContents(item.Value)
                    .SetPort(item.Key)
                    )
                );

            //Set common attributes of added cells
            foreach (var row in table.Skip(1))
            {
                row.FirstCell
                .SetBorder(1)
                .SetSides(DotSides.Top);
            }

            return(table);
        }
예제 #2
0
        public DotSubGraph SetMargin(float x, float y)
        {
            AssertIsCluster();

            SetAttribute("margin", DotUtils.ToDotPoint(x, y));

            return(this);
        }
예제 #3
0
        public DotSubGraph SetLabelPosition(float x, float y, float z)
        {
            AssertIsCluster();

            SetAttribute("lp", DotUtils.ToDotPoint(x, y, z));

            return(this);
        }
예제 #4
0
        private DotNode AddBasisBlades(AstFrame frame)
        {
            var innerTable =
                DotUtils.Table()
                .SetBorder(0);

            innerTable
            .AddRow()
            .AddCells("Grade", "Index", "ID", "Name", "Indexed Name", "Binary Name", "Grade + Index Name");

            foreach (var cell in innerTable.FirstRow)
            {
                cell
                .SetBorder(1)
                .SetSides(DotSides.Top, DotSides.Bottom);
            }

            for (var grade = 0; grade <= frame.VSpaceDimension; grade++)
            {
                var n = frame.KvSpaceDimension(grade);

                for (var index = 0; index < n; index++)
                {
                    var basisBlade = frame.BasisBlade(grade, index);

                    innerTable
                    .AddRow()
                    .AddCells(
                        basisBlade.Grade.ToString(),
                        basisBlade.Index.ToString(),
                        basisBlade.BasisBladeId.ToString(),
                        basisBlade.Name,
                        basisBlade.IndexedName,
                        basisBlade.BinaryIndexedName,
                        basisBlade.GradeIndexName
                        );
                }
            }

            var table =
                DotUtils.Table()
                .SetBorder(0);

            table.AddRows(
                DotUtils.Cell().SetContents("Basis Blades".Bold()),
                DotUtils.Cell().SetContents(innerTable)
                );

            var node =
                Graph
                .AddNode("Basis Blades")
                .SetLabel(table);

            Graph.AddEdge("Inner Product Matrix", "Basis Blades");

            return(node);
        }
예제 #5
0
        public static DotGraph ToGraphViz(this GaNumMapBilinearTree bilinearMap, bool showFullGraph = false, bool showLeafValues = false)
        {
            var dotGraph = DotGraph.Directed("Graph");

            dotGraph.AddQuadTree(bilinearMap.BasisBladesMapTree, showFullGraph);

            if (!showLeafValues)
            {
                return(dotGraph);
            }

            foreach (var leafPair in bilinearMap.BasisBladesMapTree.LeafValuePairs)
            {
                var dotHtmlTable = DotUtils.Table();
                dotHtmlTable.SetBorder(0);
                dotHtmlTable.SetCellBorder(1);
                var dotHtmlRow = dotHtmlTable.AddRow();
                var mv         = leafPair.Item3;

                foreach (var term in mv.Terms)
                {
                    var columnTable = DotUtils.Table();
                    columnTable.SetBorder(0);
                    columnTable.SetCellBorder(0);
                    columnTable.AddRow(
                        term.Key.PatternToString(mv.VSpaceDimension).ToHtmlString()
                        );
                    columnTable.AddRow(term.Value.ToString("G"));

                    dotHtmlRow.AddCell(columnTable);
                }

                var parentNodeName =
                    leafPair.Item1.PatternToString(bilinearMap.DomainVSpaceDimension) + ", " +
                    leafPair.Item2.PatternToString(bilinearMap.DomainVSpaceDimension);
                var node = dotGraph.AddNode("coef" + parentNodeName);

                node.SetLabel(dotHtmlTable);
                node.SetShape(DotNodeShape.Note);
                node.SetStyle(DotNodeStyle.Solid);
                node.SetColor(DotColor.Rgb(Color.Black));
                node.SetFontColor(DotColor.Rgb(Color.Black));

                var dotEdge = node.AddEdgeFrom(parentNodeName);
                dotEdge.SetArrowHead(DotArrowType.Inv);
                dotEdge.SetArrowTail(DotArrowType.Inv);
                dotEdge.SetStyle(DotEdgeStyle.Solid);
                dotEdge.SetColor(DotColor.Rgb(Color.Black));
                dotEdge.SetFontColor(DotColor.Rgb(Color.Black));
            }

            return(dotGraph);
        }
예제 #6
0
        private void AddStatistics()
        {
            var statsTable =
                DotUtils.Table()
                .SetCellBorder(1)
                .SetBorder(0);

            var stats = CodeBlock.GetStatistics();

            var flag = false;

            foreach (var pair in stats)
            {
                var row = statsTable.AddRow(pair.Key, pair.Value);

                if (flag)
                {
                    row[0].SetSides(DotSides.Top);
                    row[1].SetSides(DotSides.Top);
                }
                else
                {
                    row[0].SetBorder(0);
                    row[1].SetBorder(0);

                    flag = true;
                }

                row[0].SetAlign(DotAlign.Right);
                row[1].SetAlign(DotAlign.Left);
            }

            var colorsTable = GetColorsTable();

            var finalTable =
                DotUtils.Table()
                .SetCellBorder(1)
                .SetBorder(0);

            finalTable
            .AddRow()
            .AddCells(statsTable, colorsTable);

            Graph
            .AddNode("Statistics")
            .SetFontSize(11)
            .SetLabel(finalTable)
            .SetFontName("Consolas")
            .SetFillColor(Color.White.ToDotRgbColor())
            .SetShape(DotNodeShape.Rectangle)
            .SetStyle(DotNodeStyle.Bold, DotNodeStyle.Rounded, DotNodeStyle.Filled);
        }
예제 #7
0
        public DotHtmlTable Table(string iconName, IDotHtmlLabel titleContents)
        {
            var table =
                DotUtils.Table()
                .SetBorder(0);

            table.AddRow(
                DotUtils.ImageCell(Path.Combine(IconsPath, iconName + "64.png")),
                DotUtils.Cell().SetContents(titleContents)
                );

            return(table);
        }
예제 #8
0
        private DotHtmlTable GetColorsTable()
        {
            var dict = new Dictionary <int, Tuple <int, int> >();

            for (var i = 0; i <= MaxLevels; i++)
            {
                var colorNum = GetEdgeColorIndex(i);

                Tuple <int, int> range;

                if (dict.TryGetValue(colorNum, out range) == false)
                {
                    dict.Add(colorNum, new Tuple <int, int>(i, i));
                }

                else
                {
                    if (i < range.Item1)
                    {
                        dict[colorNum] = new Tuple <int, int>(i, range.Item2);
                    }

                    else if (i > range.Item2)
                    {
                        dict[colorNum] = new Tuple <int, int>(range.Item1, i);
                    }
                }
            }

            var colorsTable =
                DotUtils.Table()
                .SetCellBorder(1)
                .SetBorder(0);

            foreach (var pair in dict)
            {
                colorsTable
                .AddRow()
                .AddCell(
                    pair.Value.Item1 == pair.Value.Item2
                    ? pair.Value.Item1.ToString()
                    : (pair.Value.Item1 + " : " + pair.Value.Item2)
                    )
                .SetBackgroundColor(
                    ColorTemplate[ColorTemplate.MaxColors][pair.Key]
                    );
            }

            return(colorsTable);
        }
예제 #9
0
        public DotHtmlTable SimpleTable(IEnumerable <string> tableContents)
        {
            var table =
                DotUtils.Table()
                .SetBorder(0);

            //Add a row with a single cell for each entry
            table.AddRows(tableContents);

            //Set common attributes of added cells
            foreach (var row in table.Skip(1))
            {
                row.FirstCell
                .SetBorder(1)
                .SetSides(DotSides.Top);
            }

            return(table);
        }
예제 #10
0
        private DotNode AddIpm(AstFrame frame)
        {
            var innerTable =
                DotUtils.Table()
                .AddRows(frame.VSpaceDimension + 1, frame.VSpaceDimension + 1)
                .SetBorder(0);

            var vectorsNames =
                frame.BasisVectors.Select(item => item.Name).ToArray();

            var ipm = frame.GetInnerProductMatrix();

            for (var row = 0; row < frame.VSpaceDimension; row++)
            {
                innerTable[row + 1][0].SetContents(vectorsNames[row]);
                innerTable[0][row + 1].SetContents(vectorsNames[row]);

                for (var col = 0; col < frame.VSpaceDimension; col++)
                {
                    innerTable[row + 1][col + 1].SetContents(ipm[row, col].ToString());
                }
            }

            var table =
                DotUtils.Table()
                .SetBorder(0);

            table.AddRows(
                DotUtils.Cell().SetContents("Inner Product Matrix".Bold()),
                DotUtils.Cell().SetContents(innerTable)
                );

            var node =
                Graph
                .AddNode("Inner Product Matrix")
                .SetLabel(table);

            Graph.AddEdge(frame.AccessName, node.NodeName);

            return(node);
        }
예제 #11
0
파일: DotGraph.cs 프로젝트: phreed/GMac
 public DotGraph SetEdgeSeparationMarginsDelta(double x, double y)
 {
     return(SetAttribute("esep", DotUtils.ToDotSignedPoint(x, y)));
 }
예제 #12
0
파일: DotEdge.cs 프로젝트: phreed/GMac
        public DotEdge SetTailLabelPosition(float x, float y, float z)
        {
            AttrValues.SetAttribute("tail_lp", DotUtils.ToDotPoint(x, y, z));

            return(this);
        }
예제 #13
0
파일: DotGraph.cs 프로젝트: phreed/GMac
 public DotGraph SetPage(float x, float y)
 {
     return(SetAttribute("page", DotUtils.ToDotPoint(x, y)));
 }
예제 #14
0
        public DotNode SetRectangleSides(float x1, float y1, float x2, float y2)
        {
            AttrValues.SetAttribute("rects", DotUtils.ToDotRect(x1, y1, x2, y2));

            return(this);
        }
예제 #15
0
파일: DotGraph.cs 프로젝트: phreed/GMac
 public DotGraph SetLabelPosition(float x, float y)
 {
     return(SetAttribute("lp", DotUtils.ToDotPoint(x, y)));
 }
예제 #16
0
파일: DotGraph.cs 프로젝트: phreed/GMac
 public DotGraph SetMargin(float x, float y)
 {
     return(SetAttribute("margin", DotUtils.ToDotPoint(x, y)));
 }
예제 #17
0
파일: DotGraph.cs 프로젝트: phreed/GMac
 public DotGraph SetLabelPosition(double x, double y)
 {
     return(SetAttribute("lp", DotUtils.ToDotPoint(x, y)));
 }
예제 #18
0
파일: DotGraph.cs 프로젝트: phreed/GMac
 public DotGraph SetScale(double x, double y)
 {
     return(SetAttribute("scale", DotUtils.ToDotPoint(x, y)));
 }
예제 #19
0
파일: DotGraph.cs 프로젝트: phreed/GMac
 public DotGraph SetScale(float x, float y)
 {
     return(SetAttribute("scale", DotUtils.ToDotPoint(x, y)));
 }
예제 #20
0
파일: DotGraph.cs 프로젝트: phreed/GMac
 public DotGraph SetPage(double x, double y)
 {
     return(SetAttribute("page", DotUtils.ToDotPoint(x, y)));
 }
예제 #21
0
        public DotNode SetMargin(float x, float y)
        {
            AttrValues.SetAttribute("margin", DotUtils.ToDotPoint(x, y));

            return(this);
        }
예제 #22
0
파일: DotGraph.cs 프로젝트: phreed/GMac
 public DotGraph SetBoundingBox(float x1, float y1, float x2, float y2)
 {
     return(SetAttribute("bb", DotUtils.ToDotRect(x1, y1, x2, y2)));
 }
예제 #23
0
        public DotNode SetPosition(float x, float y, float z)
        {
            AttrValues.SetAttribute("pos", DotUtils.ToDotPoint(x, y, z));

            return(this);
        }
예제 #24
0
파일: DotEdge.cs 프로젝트: phreed/GMac
        public DotEdge SetHeadLabelPosition(float x, float y)
        {
            AttrValues.SetAttribute("head_lp", DotUtils.ToDotPoint(x, y));

            return(this);
        }
예제 #25
0
        public DotNode SetExternalLabelPosition(float x, float y, float z)
        {
            AttrValues.SetAttribute("xlp", DotUtils.ToDotPoint(x, y, z));

            return(this);
        }
예제 #26
0
파일: DotEdge.cs 프로젝트: phreed/GMac
        public DotEdge SetPosition(float x, float y)
        {
            AttrValues.SetAttribute("pos", DotUtils.ToDotPoint(x, y));

            return(this);
        }
예제 #27
0
        public DotSubGraphDefaults SetLabelPosition(float x, float y, float z)
        {
            AttrValues.SetAttribute("lp", DotUtils.ToDotPoint(x, y, z));

            return(this);
        }
예제 #28
0
파일: DotGraph.cs 프로젝트: phreed/GMac
 public DotGraph SetMargin(double x, double y)
 {
     return(SetAttribute("margin", DotUtils.ToDotPoint(x, y)));
 }
예제 #29
0
        public DotSubGraphDefaults SetMargin(float x, float y)
        {
            AttrValues.SetAttribute("margin", DotUtils.ToDotPoint(x, y));

            return(this);
        }
예제 #30
0
파일: DotGraph.cs 프로젝트: phreed/GMac
        public DotGraph SetSize(double x, double y, bool isDesiredSize)
        {
            var finalValue = DotUtils.ToDotPoint(x, y) + (isDesiredSize ? "!" : string.Empty);

            return(SetAttribute("size", finalValue.DoubleQuote()));
        }