Пример #1
0
        public void RenderGraph_givenNodeShape_generatesImage(
            [Values(NodeShape.None,
                    NodeShape.Box,
                    NodeShape.Circle,
                    NodeShape.Diamond,
                    NodeShape.DoubleCircle,
                    NodeShape.DoubleOctagon,
                    NodeShape.Egg,
                    NodeShape.Ellipse,
                    NodeShape.Hexagon,
                    NodeShape.House,
                    NodeShape.InvHouse,
                    NodeShape.InvTrapezium,
                    NodeShape.InvTriangle,
                    NodeShape.MCircle,
                    NodeShape.MDiamond,
                    NodeShape.MSquare,
                    NodeShape.Octagon,
                    NodeShape.Parallelogram,
                    NodeShape.Pentagon,
                    NodeShape.Plaintext,
                    NodeShape.Point,
                    NodeShape.Polygon,
                    NodeShape.Septagon,
                    NodeShape.Trapezium,
                    NodeShape.Triangle,
                    NodeShape.TripleOctagon)]
            NodeShape shape)
        {
            var nodeStyle = new NodeStyle();
            nodeStyle.Shape = shape;

            var n = Enum.GetName(typeof(NodeShape), shape);

            var node = nodeStyle.CreateNode(n, n);

            var graphFactory = new GraphFactory();
            var graph = graphFactory.CreateGraph(node);

            var renderer = new DotRenderer(graph);

            var filename = n + ".png";
            var image = renderer.RenderImage();
            image.Save(filename);
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EdgeGenerator"/> class.
        /// </summary>
        public EdgeGenerator()
        {
            mNodes = new Dictionary<string, Node>();
            mMissingNodeStyle
                = new NodeStyle
                      {
                          FillColor = Color.Red,
                          FontColor = Color.White,
                          Shape = NodeShape.Octagon
                      };

            mDependencyEdges
                = new EdgeStyle
                      {
                          ArrowHead = ArrowShape.Normal,
                          ArrowTail = ArrowShape.None,
                          Color = Color.Gray
                      };
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NodeGenerator"/> class.
        /// </summary>
        public NodeGenerator()
        {
            mProjectStyle
                = new NodeStyle
                      {
                          FillColor = Color.WhiteSmoke,
                          Shape = NodeShape.Box
                      };

            mExternalTargetStyle
                = new NodeStyle
                      {
                          FillColor = Color.LemonChiffon,
                          Shape = NodeShape.Record
                      };

            mInternalTargetStyle
                = new NodeStyle
                      {
                          FillColor = Color.Khaki,
                          Shape = NodeShape.Box
                      };
        }