示例#1
0
        private void GraphAreaSetup(ref GraphAreaExample graphArea)
        {
            graphArea.SetVerticesDrag(true, true);

            graphArea.GenerateGraph(true, true);

            graphArea.SetVerticesMathShape(VertexShape.Rectangle);

            graphArea.SetEdgesDashStyle(EdgeDashStyle.Dash);

            graphArea.ShowAllEdgesArrows(false);

            graphArea.ShowAllEdgesLabels(true);
        }
示例#2
0
        private UIElement GenerateWpfVisuals()
        {
            _zoomctrl = new ZoomControl();
            ZoomControl.SetViewFinderVisibility(_zoomctrl, Visibility.Visible);
            var logic = new GXLogicCore <DataVertex, DataEdge, BidirectionalGraph <DataVertex, DataEdge> >();

            _gArea = new GraphAreaExample
            {
                // EnableWinFormsHostingMode = false,
                LogicCore        = logic,
                EdgeLabelFactory = new DefaultEdgelabelFactory()
            };
            _gArea.ShowAllEdgesLabels(true);
            _gArea.ShowAllEdgesArrows(true);
            logic.Graph = GenerateGraph();
            logic.DefaultLayoutAlgorithm       = LayoutAlgorithmTypeEnum.LinLog;
            logic.DefaultLayoutAlgorithmParams = logic.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum.LinLog);
            //((LinLogLayoutParameters)logic.DefaultLayoutAlgorithmParams). = 100;
            logic.DefaultOverlapRemovalAlgorithm       = OverlapRemovalAlgorithmTypeEnum.FSA;
            logic.DefaultOverlapRemovalAlgorithmParams = logic.AlgorithmFactory.CreateOverlapRemovalParameters(OverlapRemovalAlgorithmTypeEnum.FSA);
            ((OverlapRemovalParameters)logic.DefaultOverlapRemovalAlgorithmParams).HorizontalGap = 50;
            ((OverlapRemovalParameters)logic.DefaultOverlapRemovalAlgorithmParams).VerticalGap   = 50;
            logic.DefaultEdgeRoutingAlgorithm = EdgeRoutingAlgorithmTypeEnum.None;
            logic.AsyncAlgorithmCompute       = false;
            _zoomctrl.Content = _gArea;

            _gArea.SetVerticesMathShape(VertexShape.Triangle);
            _gArea.RelayoutFinished += gArea_RelayoutFinished;


            var myResourceDictionary = new ResourceDictionary {
                Source = new Uri("Templates\\template.xaml", UriKind.Relative)
            };

            //var myResourceDictionary = new ResourceDictionary { Source = new Uri("Templates\\Mini\\CommonMiniTemplate.xaml", UriKind.Relative) };
            _zoomctrl.Resources.MergedDictionaries.Add(myResourceDictionary);
            _gArea.ShowAllEdgesArrows(true);

            return(_zoomctrl);
        }