Beispiel #1
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     ZoomControl.SetViewFinderVisibility(ZoomCtrl, Visibility.Visible);
     ZoomCtrl.ZoomToFill();
     LayoutAlgorithmComboBox.ItemsSource   = GetLayoutAlgorithmName();
     LayoutAlgorithmComboBox.SelectedIndex = 0;
 }
Beispiel #2
0
        private void DbGraph_Click(object sender, RoutedEventArgs e)
        {
            var graph = GraphDbInfo.GetDbModelGraph();

            GraphArea1.LogicCore.Graph = Convertors.Convert(graph);
            GraphArea1.GenerateGraph();
            ZoomCtrl.ZoomToFill();
        }
Beispiel #3
0
        private void InitializeGraph(EdgeDashStyle edgeDashStyle = EdgeDashStyle.Solid)
        {
            GraphArea.GenerateGraph(true, true);
            GraphArea.SetVerticesDrag(true, true);
            GraphArea.SetEdgesDashStyle(edgeDashStyle);
            GraphArea.ShowAllEdgesLabels(false);
            GraphArea.ShowAllEdgesArrows(false);
            GraphArea.SetVerticesMathShape(VertexShape.Diamond);


            ZoomCtrl.ZoomToFill();
        }
        /// <summary>Assign <paramref name="elementBuilderTree"/> as the model for this editor.</summary>
        private void SetModel(IElementTreeNode elementBuilderTree)
        {
            ClearModel();
            ModelRoot = elementBuilderTree.Root;
            ElementBuilderGraph graph = ElementBuilderGraph.Of(elementBuilderTree);

            ElementGraphArea.LogicCore = new ElementBuilderLogicCore(graph);
            ElementGraphArea.GenerateGraph(true, true);
            ElementDescription.DataContext = this;
            Properties.DataContext         = this;
            XmlLabel.DataContext           = this;
            // I think the animation looks cool when we put a new tree in the GraphArea, but we don't want to trigger that animation every time the selected vertex changes.
            ZoomCtrl.IsAnimationEnabled = true;
            ZoomCtrl.ZoomToFill();
            ZoomCtrl.IsAnimationEnabled     = false;
            ModelRoot.TreeStructureChanged += Model_TreeStructureChanged;
        }
Beispiel #5
0
        private void OtherExample_Click(object sender, RoutedEventArgs e)
        {
            //var graph = GraphSamplesFactory.SimpleExample1();
            //var graph = GraphSamplesFactory.SimpleExample2();
            //var graph = GraphSamplesFactory.QuickGraphRandomGraph(vertexCount:10, edgeCount: 20);
            var graph = GraphSamplesFactory.QuickGraphRandomGraph(vertexCount: 20, edgeCount: 40);

            //var graph = GraphSamplesFactory.CircleGraph( vertexCount:15);
            //var graph = GraphSamplesFactory.FullGraph(vertexCount: 15);
            //var graph = GraphSamplesFactory.TreeGraph(levels:2, degree: 3);

            GraphArea1.LogicCore.Graph = Convertors.Convert(graph);

            GraphArea1.GenerateGraph();

            ZoomCtrl.ZoomToFill();
        }
Beispiel #6
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;
        }
Beispiel #7
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();
        }