Exemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();
            GraphBuilder_SizeChanged(null, null);

            graphDrawing = new GraphDrawing(DrawingSurface.Width, DrawingSurface.Height);

            graphDrawing.RadiusChanged += (sender, args1) =>
            {
                if (BasicTypeCheckBox.Checked)
                {
                    graphDrawing.DrawTheWholeGraph(digraph);
                }
                else
                {
                    graphDrawing.DrawTheWholeGraphSandpile(digraph, false);
                }
                DrawingSurface.Image = graphDrawing.Image;
            };

            VerticesColorPanel.BackColor = graphDrawing.VerticesColor;
            ArcsColorPanel.BackColor     = graphDrawing.ArcsColor;

            graphDrawing.SandpilePaletteChanged +=
                (sender, e) =>
                DigraphInformationDemonstration.DisplaySandpileColors(graphDrawing, SandpilePalette);

            CommandsManager.CanRedoChanged += (sender, e) => RedoButton.Enabled = (bool)sender;
            CommandsManager.CanUndoChanged += (sender, e) => UndoButton.Enabled = (bool)sender;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Redraws the digraph, refill DataGridViews with the digraph info
 /// </summary>
 private void UpdateDigraphInfo()
 {
     graphDrawing.DrawTheWholeGraph(digraph);
     DrawingSurface.Image = graphDrawing.Image;
     ArcName.Items.Clear();
     ArcName.Text   = String.Empty;
     ArcLength.Text = String.Empty;
     digraph.Arcs.ForEach(arc => ArcName.Items.Add((arc.StartVertex + 1) + "-" + (arc.EndVertex + 1)));
     DigraphInformationDemonstration.DisplayGraphAdjacencyInfo(digraph.AdjacencyMatrix, GridAdjacencyMatrix);
     DigraphInformationDemonstration.DisplayGraphParameters(digraph, GridParameters);
 }