Exemple #1
0
        /// <summary>
        /// Creates a diagram or visual representation of the given incidence structure, returning in addition the association between the graph elements on the one hand
        /// and the visuals on the other.
        /// </summary>
        /// <param name="diagram">The diagram.</param>
        /// <param name="g">The graph to visualize.</param>
        /// <param name="nodeMap">The node map.</param>
        /// <param name="edgeMap">The edge map.</param>
        /// <returns></returns>
        /// <seealso cref="Parse"/>
        public static Graph CreateDiagram(this Telerik.Windows.Controls.RadDiagram diagram, Graph g, out Dictionary <Node, RadDiagramShape> nodeMap, out Dictionary <Edge, RadDiagramConnection> edgeMap, CreateShapeDelegate create, bool randomSize = false)
        {
            if (g == null)
            {
                throw new ArgumentNullException("g");
            }
            diagram.Clear();

            var dic = new Dictionary <int, RadDiagramShape>();

            nodeMap = new Dictionary <Node, RadDiagramShape>();
            edgeMap = new Dictionary <Edge, RadDiagramConnection>();
            foreach (var node in g.Nodes)
            {
                var shape = create(node, randomSize);


                nodeMap.Add(node, shape);
                diagram.AddShape(shape);
                dic.Add(node.Id, shape);
            }
            foreach (Edge link in g.Links)
            {
                var con = diagram.AddConnection(dic[link.Source.Id], dic[link.Sink.Id]) as RadDiagramConnection;
                edgeMap.Add(link, con);
                con.TargetCapType = CapType.Arrow1Filled;
            }
            return(g);
        }
Exemple #2
0
        /// <summary>
        /// Creates a diagram or visual representation of the given incidence structure.
        /// </summary>
        /// <param name="diagram">The diagram.</param>
        /// <param name="g">The graph structure.</param>
        /// <param name="create">The create.</param>
        /// <returns></returns>
        public static Graph CreateDiagram(this Telerik.Windows.Controls.RadDiagram diagram, Graph g, CreateShapeDelegate create = null, bool randomSize = false)
        {
            if (diagram == null)
            {
                throw new ArgumentNullException("diagram");
            }
            if (g == null)
            {
                throw new ArgumentNullException("g");
            }
            diagram.Clear();

            var dic = new Dictionary <int, RadDiagramShape>();

            foreach (var node in g.Nodes)
            {
                var shape = create == null?CreateShape(node, randomSize) : create(node, randomSize);

                diagram.AddShape(shape);
                dic.Add(node.Id, shape);
            }
            foreach (var con in g.Links.Select(link => diagram.AddConnection(dic[link.Source.Id], dic[link.Sink.Id])))
            {
                con.TargetCapType = CapType.Arrow1Filled;
            }
            return(g);
        }
Exemple #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.radDocking1 = ((Telerik.Windows.Controls.RadDocking)(target));
                return;

            case 2:
                this.diagramRootPanel = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.diagramHostPanel = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:
                this.diagram = ((Telerik.Windows.Controls.RadDiagram)(target));
                return;

            case 5:
                this.toolbox = ((Telerik.Windows.Controls.Diagrams.Extensions.RadDiagramToolbox)(target));
                return;
            }
            this._contentLoaded = true;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.toolbox = ((Telerik.Windows.Controls.Diagrams.Extensions.RadDiagramToolbox)(target));
                return;

            case 2:
                this.xsp = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 3:
                this.button = ((System.Windows.Controls.Button)(target));

            #line 35 "..\..\MainWindow.xaml"
                this.button.Click += new System.Windows.RoutedEventHandler(this.button_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.diagram = ((Telerik.Windows.Controls.RadDiagram)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemple #5
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.ToggleMarginButton = ((Telerik.Windows.Controls.RadButton)(target));

            #line 16 "..\..\..\MainWindow.xaml"
                this.ToggleMarginButton.Click += new System.Windows.RoutedEventHandler(this.ToggleMarginButton_Click);

            #line default
            #line hidden
                return;

            case 2:
                this.EditMarginButton = ((Telerik.Windows.Controls.RadButton)(target));

            #line 18 "..\..\..\MainWindow.xaml"
                this.EditMarginButton.Click += new System.Windows.RoutedEventHandler(this.EditMarginButton_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.NewPageButton = ((Telerik.Windows.Controls.RadButton)(target));

            #line 20 "..\..\..\MainWindow.xaml"
                this.NewPageButton.Click += new System.Windows.RoutedEventHandler(this.NewPageButton_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.Diagram = ((Telerik.Windows.Controls.RadDiagram)(target));

            #line 27 "..\..\..\MainWindow.xaml"
                this.Diagram.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Diagram_PreviewMouseDown);

            #line default
            #line hidden
                return;

            case 5:
                this.CurrentPosition = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemple #6
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.toolbox = ((Telerik.Windows.Controls.Diagrams.Extensions.RadDiagramToolbox)(target));
                return;

            case 2:
                this.xsp = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 3:
                this.diagram = ((Telerik.Windows.Controls.RadDiagram)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemple #7
0
        /// <summary>
        /// Creates a diagram or visual representation of the given incidence structure, returning in addition the association between the graph elements on the one hand
        /// and the visuals on the other.
        /// </summary>
        /// <param name="diagram">The diagram.</param>
        /// <param name="structure">The incidence structure.</param>
        /// <param name="nodeMap">The node map.</param>
        /// <param name="edgeMap">The edge map.</param>
        /// <returns></returns>
        /// <seealso cref="Parse"/>
        public static Graph CreateDiagram(this Telerik.Windows.Controls.RadDiagram diagram, IEnumerable <string> structure, out Dictionary <Node, RadDiagramShape> nodeMap, out Dictionary <Edge, RadDiagramConnection> edgeMap, CreateShapeDelegate create, bool randomSize)
        {
            var g = Telerik.Windows.Diagrams.Core.GraphExtensions.Parse(structure);

            return(CreateDiagram(diagram, g, out nodeMap, out edgeMap, create, randomSize));
        }
Exemple #8
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.Ribbon = ((Telerik.Windows.Controls.RadRibbonView)(target));
                return;

            case 3:
                this.SamplesList = ((System.Windows.Controls.ListBox)(target));

            #line 43 "..\..\..\View\Diagrams1.xaml"
                this.SamplesList.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.SamplesList_SelectionChanged);

            #line default
            #line hidden
                return;

            case 4:
                this.NewButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 5:
                this.OpenButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));

            #line 55 "..\..\..\View\Diagrams1.xaml"
                this.OpenButton.Click += new System.Windows.RoutedEventHandler(this.OpenButten_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.SaveButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));

            #line 60 "..\..\..\View\Diagrams1.xaml"
                this.SaveButton.Click += new System.Windows.RoutedEventHandler(this.SaveButton_Click);

            #line default
            #line hidden
                return;

            case 7:

            #line 70 "..\..\..\View\Diagrams1.xaml"
                ((System.Windows.Controls.ListBox)(target)).SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.UndoSelectionChanged);

            #line default
            #line hidden
                return;

            case 8:

            #line 79 "..\..\..\View\Diagrams1.xaml"
                ((System.Windows.Controls.ListBox)(target)).SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.RedoSelectionChanged);

            #line default
            #line hidden
                return;

            case 9:
                this.PasteButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 10:
                this.CutButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 11:
                this.CopyButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 12:
                this.DeleteButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 13:
                this.TextButton = ((Telerik.Windows.Controls.RadRibbonRadioButton)(target));

            #line 116 "..\..\..\View\Diagrams1.xaml"
                this.TextButton.Checked += new System.Windows.RoutedEventHandler(this.OnToolChecked);

            #line default
            #line hidden
                return;

            case 14:
                this.PathButton = ((Telerik.Windows.Controls.RadRibbonRadioButton)(target));

            #line 120 "..\..\..\View\Diagrams1.xaml"
                this.PathButton.Checked += new System.Windows.RoutedEventHandler(this.OnToolChecked);

            #line default
            #line hidden
                return;

            case 15:
                this.PencilButton = ((Telerik.Windows.Controls.RadRibbonRadioButton)(target));

            #line 125 "..\..\..\View\Diagrams1.xaml"
                this.PencilButton.Checked += new System.Windows.RoutedEventHandler(this.OnToolChecked);

            #line default
            #line hidden
                return;

            case 16:
                this.PointerButton = ((Telerik.Windows.Controls.RadRibbonRadioButton)(target));

            #line 130 "..\..\..\View\Diagrams1.xaml"
                this.PointerButton.Checked += new System.Windows.RoutedEventHandler(this.OnToolChecked);

            #line default
            #line hidden
                return;

            case 17:
                this.ConnectionButton = ((Telerik.Windows.Controls.RadRibbonRadioButton)(target));

            #line 135 "..\..\..\View\Diagrams1.xaml"
                this.ConnectionButton.Checked += new System.Windows.RoutedEventHandler(this.OnToolChecked);

            #line default
            #line hidden
                return;

            case 18:

            #line 147 "..\..\..\View\Diagrams1.xaml"
                ((Telerik.Windows.Controls.RadRibbonButton)(target)).Click += new System.Windows.RoutedEventHandler(this.OnExportToHtmlClick);

            #line default
            #line hidden
                return;

            case 19:
                this.GroupButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 20:
                this.UngroupButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 21:
                this.BackwardButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 22:
                this.ForwardButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 23:
                this.ToFrontButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 24:
                this.ToBackButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 25:
                this.AlignLeftButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 26:
                this.AlignBottomButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 27:
                this.AlignTopButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 28:
                this.AlignRightButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 29:
                this.LayoutButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));

            #line 208 "..\..\..\View\Diagrams1.xaml"
                this.LayoutButton.Click += new System.Windows.RoutedEventHandler(this.LayoutButton_Click);

            #line default
            #line hidden
                return;

            case 30:
                this.BackgroundColorButton = ((Telerik.Windows.Controls.RadRibbonDropDownButton)(target));
                return;

            case 31:

            #line 223 "..\..\..\View\Diagrams1.xaml"
                ((Telerik.Windows.Controls.RadColorSelector)(target)).SelectedColorChanged += new System.EventHandler(this.RadColorSelector_SelectedColorChanged);

            #line default
            #line hidden
                return;

            case 32:
                this.ShowGridToggle = ((Telerik.Windows.Controls.RadRibbonToggleButton)(target));
                return;

            case 33:
                this.GridColorButton = ((Telerik.Windows.Controls.RadRibbonDropDownButton)(target));
                return;

            case 34:

            #line 238 "..\..\..\View\Diagrams1.xaml"
                ((Telerik.Windows.Controls.RadColorSelector)(target)).SelectedColorChanged += new System.EventHandler(this.GridColorSelectorOnSelectionChanged);

            #line default
            #line hidden
                return;

            case 35:
                this.CellWidthSpinner = ((Telerik.Windows.Controls.RadNumericUpDown)(target));

            #line 254 "..\..\..\View\Diagrams1.xaml"
                this.CellWidthSpinner.ValueChanged += new System.EventHandler <Telerik.Windows.Controls.RadRangeBaseValueChangedEventArgs>(this.CellWidthSpinner_OnValueChanged);

            #line default
            #line hidden
                return;

            case 36:
                this.CellHeightSpinner = ((Telerik.Windows.Controls.RadNumericUpDown)(target));

            #line 260 "..\..\..\View\Diagrams1.xaml"
                this.CellHeightSpinner.ValueChanged += new System.EventHandler <Telerik.Windows.Controls.RadRangeBaseValueChangedEventArgs>(this.CellHeightSpinner_OnValueChanged);

            #line default
            #line hidden
                return;

            case 37:
                this.ZoomSpinner = ((Telerik.Windows.Controls.RadNumericUpDown)(target));

            #line 302 "..\..\..\View\Diagrams1.xaml"
                this.ZoomSpinner.ValueChanged += new System.EventHandler <Telerik.Windows.Controls.RadRangeBaseValueChangedEventArgs>(this.ZoomSpinner_OnValueChanged);

            #line default
            #line hidden
                return;

            case 38:
                this.FitToWindowButton = ((Telerik.Windows.Controls.RadRibbonButton)(target));
                return;

            case 39:
                this.SelectionModeCombo = ((Telerik.Windows.Controls.RadRibbonComboBox)(target));
                return;

            case 40:
                this.toolBox = ((Telerik.Windows.Controls.Diagrams.Extensions.RadDiagramToolbox)(target));
                return;

            case 41:
                this.diagram = ((Telerik.Windows.Controls.RadDiagram)(target));
                return;

            case 42:
                this.SamplesList1 = ((Telerik.Windows.Controls.RadListBox)(target));
                return;
            }
            this._contentLoaded = true;
        }