Exemplo n.º 1
0
        /// <summary>
        /// Creates the layout with an appropriate layout data which is selected by the layout combo box.
        /// </summary>
        private void CreateLayout()
        {
            switch (layoutComboBox.SelectedIndex)
            {
            default:
            case 0:
                layout = new HierarchicLayout();
                var hierarchicLayoutData = new HierarchicLayoutData();
                layoutData   = hierarchicLayoutData;
                abortHandler = hierarchicLayoutData.AbortHandler;
                break;

            case 1:
                layout = new OrganicLayout
                {
                    QualityTimeRatio      = 1.0,
                    MaximumDuration       = 1200000,
                    MultiThreadingAllowed = true
                };
                var organicLayoutData = new OrganicLayoutData();
                layoutData   = organicLayoutData;
                abortHandler = organicLayoutData.AbortHandler;
                break;

            case 2:
                layout = new OrthogonalLayout {
                    CrossingReduction = true
                };
                var orthogonalLayoutData = new OrthogonalLayoutData();
                layoutData   = orthogonalLayoutData;
                abortHandler = orthogonalLayoutData.AbortHandler;
                break;
            }
        }
        protected override LayoutData CreateConfiguredLayoutData(GraphControl graphControl, ILayoutAlgorithm layout)
        {
            var layoutData = new OrthogonalLayoutData();

            if (ConsiderEdgeDirectionItem)
            {
                layoutData.DirectedEdges.Source = graphControl.Selection.SelectedEdges;
            }
            else
            {
                layoutData.DirectedEdges.Delegate = edge => false;
            }
            return(layoutData);
        }
        protected override LayoutData CreateConfiguredLayoutData(GraphControl graphControl, ILayoutAlgorithm layout)
        {
            var layoutData = new OrthogonalLayoutData();

            if (ConsiderEdgeDirectionItem)
            {
                layoutData.DirectedEdges.Source = graphControl.Selection.SelectedEdges;
            }
            else
            {
                layoutData.DirectedEdges.Delegate = edge => false;
            }

            return(layoutData.CombineWith(
                       CreateLabelingLayoutData(
                           graphControl.Graph,
                           LabelPlacementAlongEdgeItem,
                           LabelPlacementSideOfEdgeItem,
                           LabelPlacementOrientationItem,
                           LabelPlacementDistanceItem
                           )
                       ));
        }