Exemple #1
0
        private static void AddNode(GleeGraph g, NodeShape n, Dictionary <string, NodeShape> shapesMap)
        {
            shapesMap.Add(n.Id.ToString(), n);

            Node node = new Node(n.Id.ToString(), CurveFactory.CreateBox(n.Bounds.Width, n.Bounds.Height, new Point(0.0, 0.0)));

            node.Padding = NodePadding;

            if (n.IsRelativeChildShape)
            {
                if (n.MovementBehaviour == ShapeMovementBehaviour.PositionOnEdgeOfParent)
                {
                    if (n.Parent != null)
                    {
                        if (g.NodeMap.ContainsKey(n.Parent.Id.ToString()))
                        {
                            //node.Padding = NodePaddingRelativeOnEdge;

                            // add edge so that this shape is kept close to its parent shape
                            //g.AddEdge(new Edge(g.NodeMap[n.Parent.Id.ToString()], node));
                        }
                    }
                }
            }


            g.AddNode(node);
        }
Exemple #2
0
        private GleeGraph CreateAndLayoutGraph()
        {
            double    w     = 30;
            double    h     = 20;
            GleeGraph graph = new GleeGraph();
            Node      a     = new Node("a", new Ellipse(w, h, new P()));
            Node      b     = new Node("b", CurveFactory.CreateBox(w, h, new P()));

            graph.AddNode(a);
            graph.AddNode(b);
            Edge e = new Edge(a, b);

            e.ArrowHeadAtSource = true;
            graph.AddEdge(e);
            graph.AddEdge(new Edge(a, b));
            graph.CalculateLayout();
            return(graph);
        }