Ejemplo n.º 1
0
        void CreateNodeDelegate()
        {
            if (graphViewer.Graph == null)
            {
                return;
            }
            var  nodeCenter  = MousePositionToGraph();
            Node drawingNode = CreateDrawingNodeByUsingDialog();
            var  iNode       = graphViewer.CreateIViewerNode(drawingNode, nodeCenter, null);

            iNode.Node.Attr.Color = Color.Red;
        }
Ejemplo n.º 2
0
        public static IViewerNode addVnodeByDnode(GraphViewer gv, Node node, DPoint pos)
        {
            var graph = gv.Graph;

            Debug.Assert(node.GeometryNode == null);
            LNode lnode     = GeometryGraphCreator.CreateGeometryNode(graph, graph.GeometryGraph, node, ConnectionToGraph.Disconnected);
            var   labelSize = Common.MeasureLabel(node.Label);
            var   mar       = node.Attr.LabelMargin;

            lnode.BoundaryCurve = NodeBoundaryCurves.GetNodeBoundaryCurve(node, labelSize.Width + mar * 2, labelSize.Height + mar * 2);
            node.GeometryNode   = lnode;

            var vnode = gv.CreateIViewerNode(node, pos, null);

            return(vnode);
        }
Ejemplo n.º 3
0
        public static IViewerNode addNode(GraphViewer gv, string id, double x, double y)
        {
            //var node = new Node(id);
            var graph     = gv.Graph;
            var node      = graph.AddNode(id);
            var lnode     = GeometryGraphCreator.CreateGeometryNode(graph, graph.GeometryGraph, node, ConnectionToGraph.Disconnected);
            var labelSize = Common.MeasureLabel(node.Label);

            lnode.BoundaryCurve = NodeBoundaryCurves.GetNodeBoundaryCurve(node, labelSize.Width, labelSize.Height);
            node.GeometryNode   = lnode;
            var vnode = gv.CreateIViewerNode(node, new DPoint(x, y), null);

            return(vnode);
            //gv.AddNode(vnode, true);
            //gv.CreateVNode(node);
        }
Ejemplo n.º 4
0
        public static IViewerNode addNodeWithStyles(GraphViewer gv, string id, DPoint pos, ICollection <Style> styles)
        {
            var graph = gv.Graph;
            var node  = graph.AddNode(id);

            if (styles != null)
            {
                foreach (var s in styles)
                {
                    node.Attr.AddStyle(s);
                }
            }

            var lnode     = GeometryGraphCreator.CreateGeometryNode(graph, graph.GeometryGraph, node, ConnectionToGraph.Disconnected);
            var labelSize = Common.MeasureLabel(node.Label);
            var mar       = node.Attr.LabelMargin;

            lnode.BoundaryCurve = NodeBoundaryCurves.GetNodeBoundaryCurve(node, labelSize.Width + mar * 2, labelSize.Height + mar * 2);
            node.GeometryNode   = lnode;
            var vnode = gv.CreateIViewerNode(node, pos, null);

            return(vnode);
        }