Exemplo n.º 1
0
        private void ResetGraph()
        {
            IGXLogicCore <ArrowGraphVertex, ArrowGraphEdge, BidirectionalGraph <ArrowGraphVertex, ArrowGraphEdge> > logicCore = ArrowGraphAreaCtrl.LogicCore;

            if (logicCore == null)
            {
                throw new InvalidOperationException("LogicCore is null");
            }
            BidirectionalGraph <ArrowGraphVertex, ArrowGraphEdge> graph = logicCore.Graph;

            logicCore.ExternalLayoutAlgorithm = new ArrowGraphLayoutAlgorithm <ArrowGraphVertex, ArrowGraphEdge, BidirectionalGraph <ArrowGraphVertex, ArrowGraphEdge> >(graph);
            ArrowGraphAreaCtrl.RelayoutGraph();
            ArrowGraphAreaCtrl.GenerateAllEdges();
            logicCore.ExternalLayoutAlgorithm = null;
            ZoomCtrl.ZoomToFill();
            ZoomCtrl.Mode = ZoomControlModes.Custom;
        }
Exemplo n.º 2
0
        private void FirstExample_Click(object sender, RoutedEventArgs e)
        {
            // 1. create graph
            //var graph = GraphSamples.FirstSimpleExample();
            var graph = GraphSamples.Example2();

            // 2. add graph layout algorithm
            var gxLogicCoreExample = new GxLogicCoreExample
            {
                Graph = graph,
                //DefaultLayoutAlgorithm = GraphX.PCL.Common.Enums.LayoutAlgorithmTypeEnum.BoundedFR
            };

            GraphArea1.LogicCore = gxLogicCoreExample;

            // 3. display graph
            GraphArea1.GenerateGraph();


            ZoomCtrl.ZoomToFill();
        }
Exemplo n.º 3
0
        private void ZoomCtrl_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            //create vertices and edges only in Edit mode
            if (e.LeftButton != System.Windows.Input.MouseButtonState.Pressed)
            {
                return;
            }
            if (!_editMode)
            {
                return;
            }

            var pos = ZoomCtrl.TranslatePoint(e.GetPosition(ZoomCtrl), GraphArea1);

            pos.Offset(-22.5, -22.5);
            //CreateVertexControl(pos);
            var vc = CreateVertexControl(pos);
            //if (_ecFrom != null)
            //    CreateEdgeControl(vc);
            //else if (_opMode == EditorOperationMode.Select)
            //{
            //    ClearSelectMode(true);
            //}
        }