예제 #1
0
        private void BuildSequenceGraphLogicCore()
        {
            const LayoutAlgorithmTypeEnum algo = LayoutAlgorithmTypeEnum.Tree;
            var logicCore = new LogicCore {
                DefaultLayoutAlgorithm = algo
            };

            logicCore.DefaultLayoutAlgorithmParams = logicCore.AlgorithmFactory.CreateLayoutParameters(algo);
            var layoutParams = ((SimpleTreeLayoutParameters)logicCore.DefaultLayoutAlgorithmParams);

            layoutParams.Direction = LayoutDirection.LeftToRight;
            layoutParams.LayerGap  = 125;
            layoutParams.VertexGap = 40;

            logicCore.DefaultOverlapRemovalAlgorithm = OverlapRemovalAlgorithmTypeEnum.None;
            logicCore.DefaultEdgeRoutingAlgorithm    = EdgeRoutingAlgorithmTypeEnum.None;
            logicCore.AsyncAlgorithmCompute          = false;

            if (this.SequenceGraphArea.LogicCore != null && this.SequenceGraphArea.LogicCore.Graph != null)
            {
                logicCore.Graph = this.SequenceGraphArea.LogicCore.Graph;
            }

            this.SequenceGraphArea.LogicCore = logicCore;
            this.SequenceGraphArea.GenerateGraph(true);
        }
예제 #2
0
        /// <summary>
        /// Generate and initialize layout algorithm
        /// </summary>
        /// <param name="newAlgorithmType">Layout algorithm type</param>
        /// <param name="iGraph">Graph</param>
        /// <param name="positions">Optional vertex positions</param>
        /// <param name="sizes">Optional vertex sizes</param>
        /// <param name="parameters">Optional algorithm parameters</param>
        public ILayoutAlgorithm <TVertex, TEdge, TGraph> CreateLayoutAlgorithm(LayoutAlgorithmTypeEnum newAlgorithmType, TGraph iGraph, IDictionary <TVertex, Point> positions = null, IDictionary <TVertex, Size> sizes = null, ILayoutParameters parameters = null)
        {
            if (iGraph == null)
            {
                return(null);
            }
            if (parameters == null)
            {
                parameters = CreateLayoutParameters(newAlgorithmType);
            }
            var graph = iGraph.CopyToGraph <TGraph, TVertex, TEdge>();

            graph.RemoveEdgeIf(a => a.SkipProcessing == ProcessingOptionEnum.Exclude);
            graph.RemoveVertexIf(a => a.SkipProcessing == ProcessingOptionEnum.Exclude);

            switch (newAlgorithmType)
            {
            case LayoutAlgorithmTypeEnum.Tree:
                return(new SimpleTreeLayoutAlgorithm <TVertex, TEdge, TGraph>(graph, positions, sizes, parameters as SimpleTreeLayoutParameters));

            case LayoutAlgorithmTypeEnum.SimpleRandom:
                return(new RandomLayoutAlgorithm <TVertex, TEdge, TGraph>(graph, positions, parameters as RandomLayoutAlgorithmParams));

            case LayoutAlgorithmTypeEnum.Circular:
                return(new CircularLayoutAlgorithm <TVertex, TEdge, TGraph>(graph, positions, sizes, parameters as CircularLayoutParameters));

            case LayoutAlgorithmTypeEnum.FR:
                return(new FRLayoutAlgorithm <TVertex, TEdge, TGraph>(graph, positions, parameters as FRLayoutParametersBase));

            case LayoutAlgorithmTypeEnum.BoundedFR:
                return(new FRLayoutAlgorithm <TVertex, TEdge, TGraph>(graph, positions, parameters as BoundedFRLayoutParameters));

            case LayoutAlgorithmTypeEnum.KK:
                return(new KKLayoutAlgorithm <TVertex, TEdge, TGraph>(graph, positions, parameters as KKLayoutParameters));

            case LayoutAlgorithmTypeEnum.ISOM:
                return(new ISOMLayoutAlgorithm <TVertex, TEdge, TGraph>(graph, positions, parameters as ISOMLayoutParameters));

            case LayoutAlgorithmTypeEnum.LinLog:
                return(new LinLogLayoutAlgorithm <TVertex, TEdge, TGraph>(graph, positions, parameters as LinLogLayoutParameters));

            case LayoutAlgorithmTypeEnum.EfficientSugiyama:
                return(new EfficientSugiyamaLayoutAlgorithm <TVertex, TEdge, TGraph>(graph, parameters as EfficientSugiyamaLayoutParameters, positions, sizes));

            case LayoutAlgorithmTypeEnum.Sugiyama:
                return(new SugiyamaLayoutAlgorithm <TVertex, TEdge, TGraph>(graph, sizes, positions, parameters as SugiyamaLayoutParameters,
                                                                            e => (e is TypedEdge <TVertex>
                                                                                  ?(e as TypedEdge <TVertex>).Type
                                                                                  : EdgeTypes.Hierarchical)));

            case LayoutAlgorithmTypeEnum.CompoundFDP:
                return(new CompoundFDPLayoutAlgorithm <TVertex, TEdge, TGraph>(graph, sizes, new Dictionary <TVertex, Thickness>(), new Dictionary <TVertex, CompoundVertexInnerLayoutType>(),
                                                                               positions, parameters as CompoundFDPLayoutParameters));

            /*case LayoutAlgorithmTypeEnum.BalloonTree:
             *  return new BalloonTreeLayoutAlgorithm<TVertex, TEdge, TGraph>(Graph, Positions, Sizes, parameters as BalloonTreeLayoutParameters, Graph.Vertices.FirstOrDefault());*/
            default:
                return(null);
            }
        }
예제 #3
0
        private void ChangeLayoutAlgorithm(LayoutAlgorithmTypeEnum layoutChoice)
        {
            if (GraphArea1?.LogicCore == null)
            {
                return;
            }

            GraphArea1.LogicCore.DefaultLayoutAlgorithm = layoutChoice;

            switch (layoutChoice)
            {
            case LayoutAlgorithmTypeEnum.EfficientSugiyama:
                var prms = GraphArea1.LogicCore.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum.EfficientSugiyama) as EfficientSugiyamaLayoutParameters;
                Debug.Assert(prms != null);

                prms.EdgeRouting   = SugiyamaEdgeRoutings.Orthogonal;
                prms.LayerDistance = prms.VertexDistance = 100;
                GraphArea1.LogicCore.EdgeCurvingEnabled           = false;
                GraphArea1.LogicCore.DefaultLayoutAlgorithmParams = prms;
                //gg_eralgo.SelectedItem = EdgeRoutingAlgorithmTypeEnum.None;
                break;

            case LayoutAlgorithmTypeEnum.BoundedFR:
                GraphArea1.LogicCore.DefaultLayoutAlgorithmParams = GraphArea1.LogicCore.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum.BoundedFR);
                break;

            case LayoutAlgorithmTypeEnum.FR:
                GraphArea1.LogicCore.DefaultLayoutAlgorithmParams = GraphArea1.LogicCore.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum.FR);
                break;
            }

            GraphArea1.LogicCore.EdgeCurvingEnabled = layoutChoice != LayoutAlgorithmTypeEnum.EfficientSugiyama;
        }
예제 #4
0
        public void SetDefaultLayoutAlgorithm(LayoutAlgorithmTypeEnum algorithm)
        {
            this.DefaultLayoutAlgorithm = algorithm;
            if (this.DefaultLayoutAlgorithm == LayoutAlgorithmTypeEnum.EfficientSugiyama)
            {
                var prms = this.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum.EfficientSugiyama) as EfficientSugiyamaLayoutParameters;
                prms.EdgeRouting                  = SugiyamaEdgeRoutings.Orthogonal;
                prms.LayerDistance                = prms.VertexDistance = 100;
                this.EdgeCurvingEnabled           = false;
                this.DefaultLayoutAlgorithmParams = prms;
            }
            else
            {
                this.EdgeCurvingEnabled = true;
            }

            if (this.DefaultLayoutAlgorithm == LayoutAlgorithmTypeEnum.BoundedFR)
            {
                this.DefaultLayoutAlgorithmParams = this.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum.BoundedFR);
            }
            if (this.DefaultLayoutAlgorithm == LayoutAlgorithmTypeEnum.FR)
            {
                this.DefaultLayoutAlgorithmParams = this.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum.FR);
            }

            this.NotifyParent();
        }
예제 #5
0
 /// <summary>
 /// Returns True if specified layout algorithm ever needs overlap removal pass
 /// </summary>
 /// <param name="algorithmType">Layout algorithm type</param>
 public bool NeedOverlapRemoval(LayoutAlgorithmTypeEnum algorithmType)
 {
     return(algorithmType != LayoutAlgorithmTypeEnum.Sugiyama &&
            algorithmType != LayoutAlgorithmTypeEnum.EfficientSugiyama &&
            algorithmType != LayoutAlgorithmTypeEnum.Circular &&
            algorithmType != LayoutAlgorithmTypeEnum.Tree
            /*&& algorithmType != LayoutAlgorithmTypeEnum.BalloonTree*/);
 }
예제 #6
0
        /// <summary>
        /// Returns True if specified layout algorithm needs vertex size data for its calculations
        /// </summary>
        /// <param name="algorithmType">Layout algorithm type</param>
        public bool NeedSizes(LayoutAlgorithmTypeEnum algorithmType)
        {
            switch (algorithmType)
            {
            case LayoutAlgorithmTypeEnum.Tree:
            case LayoutAlgorithmTypeEnum.Circular:
            case LayoutAlgorithmTypeEnum.EfficientSugiyama:
            case LayoutAlgorithmTypeEnum.Sugiyama:
            case LayoutAlgorithmTypeEnum.CompoundFDP:
            case LayoutAlgorithmTypeEnum.SimpleRandom:
                return(true);

            default:
                return(false);
            }
        }
예제 #7
0
        /// <summary>
        /// Creates parameters data for layout algorithm
        /// </summary>
        /// <param name="algorithmType">Layout algorithm type</param>
        public ILayoutParameters CreateLayoutParameters(LayoutAlgorithmTypeEnum algorithmType)
        {
            switch (algorithmType)
            {
            case LayoutAlgorithmTypeEnum.Tree:
                return(new SimpleTreeLayoutParameters());

            case LayoutAlgorithmTypeEnum.Circular:
                return(new CircularLayoutParameters());

            case LayoutAlgorithmTypeEnum.FR:
                return(new FreeFRLayoutParameters());

            case LayoutAlgorithmTypeEnum.BoundedFR:
                return(new BoundedFRLayoutParameters());

            case LayoutAlgorithmTypeEnum.KK:
                return(new KKLayoutParameters());

            case LayoutAlgorithmTypeEnum.ISOM:
                return(new ISOMLayoutParameters());

            case LayoutAlgorithmTypeEnum.LinLog:
                return(new LinLogLayoutParameters());

            case LayoutAlgorithmTypeEnum.EfficientSugiyama:
                return(new EfficientSugiyamaLayoutParameters());

            case LayoutAlgorithmTypeEnum.Sugiyama:
                return(new SugiyamaLayoutParameters());

            case LayoutAlgorithmTypeEnum.CompoundFDP:
                return(new CompoundFDPLayoutParameters());

            case LayoutAlgorithmTypeEnum.SimpleRandom:
                return(new RandomLayoutAlgorithmParams());

            // case LayoutAlgorithmTypeEnum.BalloonTree:
            //     return new BalloonTreeLayoutParameters();
            default:
                return(null);
            }
        }
예제 #8
0
 public GraphForm(BeltPlan plan, LayoutAlgorithmTypeEnum layoutAlgorithm) : this(plan)
 {
     _layoutAlgorithm = layoutAlgorithm;
 }
예제 #9
0
 public static void GraphAreaSetupLayoutAlgorithm(LayoutAlgorithmTypeEnum layoutAlgorithmTypeEnum)
 {
     //This property sets layout algorithm that will be used to calculate vertices positions
     //Different algorithms uses different values and some of them uses edge Weight property.
     logicCore.DefaultLayoutAlgorithm = layoutAlgorithmTypeEnum;
 }
예제 #10
0
 /// <summary>
 /// Returns True if specified layout algorithm ever needs edge routing pass
 /// </summary>
 /// <param name="algorithmType">Layout algorithm type</param>
 public bool NeedEdgeRouting(LayoutAlgorithmTypeEnum algorithmType)
 {
     return((algorithmType != LayoutAlgorithmTypeEnum.Sugiyama) && (algorithmType != LayoutAlgorithmTypeEnum.EfficientSugiyama));
 }
예제 #11
0
 /// <summary>
 /// Returns True if specified layout algorithm needs vertex size data for its calculations
 /// </summary>
 /// <param name="algorithmType">Layout algorithm type</param>
 public bool NeedSizes(LayoutAlgorithmTypeEnum algorithmType)
 {
     return((algorithmType == LayoutAlgorithmTypeEnum.Tree) /*|| (algorithmType == LayoutAlgorithmTypeEnum.BalloonTree)*/ || (algorithmType == LayoutAlgorithmTypeEnum.Circular) ||
            (algorithmType == LayoutAlgorithmTypeEnum.EfficientSugiyama) || (algorithmType == LayoutAlgorithmTypeEnum.Sugiyama) ||
            (algorithmType == LayoutAlgorithmTypeEnum.CompoundFDP));
 }