コード例 #1
0
        /// <summary>
        /// Prepares graph area control for future use.
        /// </summary>
        /// <returns></returns>
        public static ReadyGraphArea Initialize(DataGraph graph)
        {
            var gg_Area = new ReadyGraphArea();

            try
            {
                var logicCore = new LogicCore();
                logicCore.DefaultLayoutAlgorithm       = GraphX.LayoutAlgorithmTypeEnum.Tree;
                logicCore.DefaultLayoutAlgorithmParams =
                    logicCore.AlgorithmFactory.CreateLayoutParameters(GraphX.LayoutAlgorithmTypeEnum.Tree);
                ((SimpleTreeLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).LayerGap               = 100;
                ((SimpleTreeLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).VertexGap              = 100;
                ((SimpleTreeLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).WidthPerHeight         = 1000;
                ((SimpleTreeLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).OptimizeWidthAndHeight = true;

                /************************************/

                /*logicCore.DefaultLayoutAlgorithm = GraphX.LayoutAlgorithmTypeEnum.KK;
                 * logicCore.DefaultLayoutAlgorithmParams =
                 *                 logicCore.AlgorithmFactory.CreateLayoutParameters(GraphX.LayoutAlgorithmTypeEnum.KK);
                 * ((KKLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).MaxIterations = 100;*/

                /*************************************/



                logicCore.DefaultOverlapRemovalAlgorithm       = GraphX.OverlapRemovalAlgorithmTypeEnum.FSA;
                logicCore.DefaultOverlapRemovalAlgorithmParams =
                    logicCore.AlgorithmFactory.CreateOverlapRemovalParameters(GraphX.OverlapRemovalAlgorithmTypeEnum.FSA);
                ((OverlapRemovalParameters)logicCore.DefaultOverlapRemovalAlgorithmParams).HorizontalGap = 100;
                ((OverlapRemovalParameters)logicCore.DefaultOverlapRemovalAlgorithmParams).VerticalGap   = 100;

                logicCore.DefaultEdgeRoutingAlgorithm = GraphX.EdgeRoutingAlgorithmTypeEnum.SimpleER;
                logicCore.EnableParallelEdges         = true;
                logicCore.EdgeShowSelfLooped          = true;
                logicCore.EdgeSelfLoopCircleOffset    = new Point(0, 0);
                logicCore.AsyncAlgorithmCompute       = false;
                logicCore.ParallelEdgeDistance        = 50;
                logicCore.EdgeSelfLoopCircleRadius    = 50;
                logicCore.EdgeCurvingEnabled          = true;
                gg_Area.LogicCore        = logicCore;
                gg_Area.EdgeDoubleClick += delegate(object sender, EdgeSelectedEventArgs args)
                {
                    var backRef = ((DataEdge)(args.EdgeControl.Edge)).BackRef;
                    GoToCodeEventHandler.ClickHandler(backRef, args);
                };
                gg_Area.InitializeComponent();
                gg_Area.GenerateGraph(graph, true, true, true);
                gg_Area.ShowAllEdgesLabels(true);
                gg_Area.AlignAllEdgesLabels(false);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                MessageBox.Show(e.StackTrace);
            }
            return(gg_Area);
        }
コード例 #2
0
 public void GetSourceCode(object sender, EventArgs args)
 {
     try
     {
         //return source code
         GoToCodeEventHandler.OnEvent(textControl, new BackRefEventArgs((FSharpOption <ICSharpLiteralExpression>)sender));
     }
     catch (NullReferenceException e) { }
 }