Example #1
0
        public void window_loaded_prev1(object sender, RoutedEventArgs e)
        {
            GraphViewer graphViewer = new GraphViewer();

            graphViewer.BindToPanel(panel);
            //panel.LastChildFill = true;
            panel.Background = Brushes.LightGray;
            Graph graph = new Graph();
            //graph.Attr.LayerDirection = LayerDirection.LR;

            var edge = graph.AddEdge("A", "B");

            //edge.DrawEdgeDelegate = edge_rendering_delegate;
            edge.UserData     = "center_of";
            graphViewer.Graph = graph;
            this.MouseWheel  += MouseWheelEventHandler;
            //panel.MouseWheel += MouseWheelEventHandler;
            //graphViewer.GraphCanvas.MouseWheel += MouseWheelEventHandler;
            var gv = graphViewer;

            _graphViewer = gv;

            GVH.addNode(gv, "55", 0, 0);
            GVH.addLineEdge2(gv, "B", "55");
            graph.GeometryGraph.UpdateBoundingBox();
            //DebugV.D.tag = 1;
            gv.SetInitialTransform();
            //gv.GraphCanvas.Background = Brushes.Red;
            var ov = gv.GraphCanvas.Focus();
        }
Example #2
0
        public void window_loaded_prev2(object sender, RoutedEventArgs e)
        {
            Graph graph = new Graph();
            //graph.Attr.LayerDirection = LayerDirection.LR;
            //graph.AddNode("aaa");

            //graphViewer.Graph.CreateGeometryGraph();

            //var edge = graph.AddEdge("A", "B");
            //edge.DrawEdgeDelegate = edge_rendering_delegate;
            var edgeg = graph.AddEdge("ma", "mi");

            edgeg.LabelText = "has edge";
            var gv = _graphViewer;

            gv.Graph = graph;

            this.MouseWheel += MouseWheelEventHandler;

            //_graphViewer = gv;

            GVH.addNode(gv, "A", 0, 30);
            GVH.addNode(gv, "B", 20, 15);
            var dnode = graph.FindNode("A");
            var vnode = gv.GetIViewerObject(dnode) as VNode;

            //dnode.GeometryNode.BoundaryCurve = null;
            //VDebug.D.tag = 2;
            dnode.Attr.Shape = Shape.Diamond;

            dnode.GeometryNode.BoundaryCurve = NodeBoundaryCurves.GetNodeBoundaryCurve(dnode, 15, 12);


            //vnode.Invalidate();

            var edge = GVH.addLineEdge2(gv, "A", "B");

            //edge.Edge.DrawEdgeDelegate = edge_rendering_delegate;
            edge.Edge.UserData = "center_of";
            GVH.addNode(gv, "55", 0, 0);
            GVH.addLineEdge2(gv, "B", "55");
            graph.GeometryGraph.UpdateBoundingBox();
            //DebugV.D.tag = 1;

            gv.SetInitialTransform();
            gv.Transform = gv.Transform;

            gv.LayoutEditor.ObjectEditingStatusChanged += viewerObjectSelected;

            //timer1 = new System.Windows.Threading.DispatcherTimer();
            //timer1.Tick += TimeTick;
            //timer1.Interval = TimeSpan.FromMilliseconds(500);
            //timer1.Start();
            panel.Focusable = true;
        }