Example #1
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);
            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.RelayoutFinished += gArea_RelayoutFinished;


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

            _zoomctrl.Resources.MergedDictionaries.Add(myResourceDictionary);

            return(_zoomctrl);
        }
Example #2
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);
        }
Example #3
0
 void CreateNewArea()
 {
     if (dg_Area != null)
     {
         dg_Area.GenerateGraphFinished -= dg_Area_GenerateGraphFinished;
         dg_Area.RelayoutFinished      -= dg_Area_GenerateGraphFinished;
     }
     dg_Area.ClearLayout();
     dg_Area.Dispose();
     dg_Area = new GraphAreaExample
     {
         Name      = "dg_Area",
         LogicCore = new LogicCoreExample(),
         Resources = new ResourceDictionary {
             Source = new Uri("/Templates/Debug/TestTemplates.xaml", UriKind.RelativeOrAbsolute)
         }
     };
     dg_Area.SetVerticesDrag(true, true);
     dg_zoomctrl.Content = dg_Area;
     dg_Area.ShowAllEdgesLabels(false);
 }