Example #1
0
        public BackToMenuFromDrawButton(AdjacencyList adjacencyList, List <VertexDraw> vertexDraws,
                                        List <EdgeDraw> edgeDraws, StartForm.DrawForm drawForm, AdjacencyListPanel adjacencyListPanel,
                                        WeightTable weightTable, List <List <CellBox> > matrix, List <List <CellAdjacencyList> > cells,
                                        string buttonText = "Menu") : base(buttonText)
        {
            ForeColor = Color.Black;

            this.BackColor = Color.Orange;

            Font = new System.Drawing.Font("Comic Sans MS", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(204)));

            FlatStyle = System.Windows.Forms.FlatStyle.Popup;

            Text = buttonText;

            Location = new System.Drawing.Point(300, 410);

            this.adjacencyList = adjacencyList;

            this.vertexDraws = vertexDraws;

            this.edgeDraws = edgeDraws;

            this.drawForm = drawForm;

            this.weightTable = weightTable;

            this.adjacencyListPanel = adjacencyListPanel;

            this.matrix = matrix;

            this.cells = cells;
        }
        public DeleteAllButton(int width, int height, AdjacencyList adjacencyList, List <VertexDraw> vertexDraws,
                               List <EdgeDraw> edgeDraws, StartForm.DrawForm drawForm, AdjacencyListPanel adjacencyListPanel,
                               WeightTable weightTable, List <List <CellBox> > matrix, List <List <CellAdjacencyList> > cells)
        {
            Size = new System.Drawing.Size(width, height);

            Dock = DockStyle.Top;

            Text = "Delete all";

            Click += new EventHandler(ButtonClick);

            this.adjacencyList = adjacencyList;

            this.vertexDraws = vertexDraws;

            this.edgeDraws = edgeDraws;

            this.drawForm = drawForm;

            this.weightTable = weightTable;

            this.adjacencyListPanel = adjacencyListPanel;

            this.matrix = matrix;

            this.cells = cells;
        }
Example #3
0
        public ToolPanel(int positionX, int positionY, WeightTable weightTable, List <EdgeDraw> edgeDraws
                         , AdjacencyList adjacencyList, StartForm.DrawForm drawForm, AdjacencyListPanel adListPanel
                         , List <VertexDraw> vertexDraws, List <List <CellBox> > matrix, List <List <CellAdjacencyList> > cells
                         , ShortestPathPanel shortestPathPanel)

        {
            Location = new System.Drawing.Point(positionX, positionY);

            Dock = DockStyle.Left;

            LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow;

            saveWeightButton = new SaveWeightButton(20, 20, adjacencyList, matrix, weightTable, adListPanel);

            tableButton = new WeightTableButton(20, 20, weightTable, adListPanel, saveWeightButton);

            cycleButton = new CycleButton(20, 20, adjacencyList, edgeDraws, drawForm);

            shortestPathButton = new ShortestPathPanelButton(20, 20, shortestPathPanel);

            adListButton = new AdjacencyListPanelButton(20, 20, adListPanel, weightTable, saveWeightButton);

            saveButton = new SaveButton(20, 20, adjacencyList, drawForm);

            deleteAllButton = new DeleteAllButton(20, 20, adjacencyList, vertexDraws, edgeDraws, drawForm, adListPanel, weightTable, matrix, cells);


            Items.Add(tableButton);

            Items.Add(new ToolStripSeparator());

            Items.Add(adListButton);

            Items.Add(new ToolStripSeparator());

            Items.Add(cycleButton);

            Items.Add(new ToolStripSeparator());

            Items.Add(shortestPathButton);

            Items.Add(new ToolStripSeparator());

            Items.Add(saveButton);

            Items.Add(new ToolStripSeparator());

            Items.Add(deleteAllButton);

            Items.Add(new ToolStripSeparator());

            Items.Add(saveWeightButton);

            Items.Add(new ToolStripSeparator());
        }
        public ShortestPathPanel(int width, int height, int positionX, int positionY
                                 , GraphRepresentation.AdjacencyList adList, List <EdgeDraw> edgeDraws
                                 , StartForm.DrawForm drawForm)
        {
            Size = new System.Drawing.Size(width, height);

            Location = new System.Drawing.Point(positionX, positionY);

            BorderStyle = BorderStyle.Fixed3D;

            Anchor = (AnchorStyles.Top | AnchorStyles.Left);

            Visible = false;

            this.adList = adList;

            this.edgeDraws = edgeDraws;

            infoText = new InfoTextLabel(180, 20, 10, 20, "Path: ");

            Controls.Add(infoText);

            startVertexText = new InfoTextLabel(65, 20, 0, 60, "From:");

            Controls.Add(startVertexText);

            endVertexText = new InfoTextLabel(45, 20, Size.Width - 100, 60, "To:");

            Controls.Add(endVertexText);

            startVertex = new InputCountBox(20, 20, 65, 60);

            Controls.Add(startVertex);

            endVertex = new InputCountBox(20, 20, Size.Width - 55, 60);

            Controls.Add(endVertex);

            findPathButton = new FindPathButton(95, 30, Size.Width / 2 - 45, Size.Height - 60, adList, edgeDraws
                                                , startVertex, endVertex, drawForm, infoText);

            Controls.Add(findPathButton);
        }
        private void ButtonClick(object sender, EventArgs e)
        {
            vertexDraws.Clear();

            edgeDraws.Clear();

            initialGraph.CreateVertexes();

            initialGraph.FillingMatrix(matrix);

            initialGraph.CreateEdges();

            drawForm = new StartForm.DrawForm(vertexDraws, edgeDraws, matrix, startForm, inputCountForm, matrixGraph, initialGraph.UpdateAdjacencyList(matrix));

            inputCountForm.Hide();

            drawForm.ShowDialog();

            inputCountForm.Close();
        }
Example #6
0
        public SaveButton(int width, int height, AdjacencyList adjacencyList, StartForm.DrawForm drawForm)
        {
            Size = new System.Drawing.Size(width, height);

            Dock = DockStyle.Top;

            Text = "Save that graph";

            Size = new System.Drawing.Size(150, 30);

            Anchor = (AnchorStyles.Bottom | AnchorStyles.Right); // anchorage to place

            Click += new EventHandler(ButtonClick);

            serializeGraph = new SerializeGraph();

            converter = new Converter();

            this.adjacencyList = adjacencyList;

            this.drawForm = drawForm;
        }
        public void ButtonClick(object sender, EventArgs e)
        {
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                loadGraph = deserializeGraph.LoadGraph(ofd.FileName);

                matrix = converter.ConvertToListListCellBox(loadGraph);

                adjacencyList = converter.ConvertToAdjacencyList(matrix);

                DrawingLoadedEdges(matrix);
                DrawingLoadedVertexs(matrix);

                inputCountVertexForm = new InputCountVertexForm(startForm);

                drawForm = new StartForm.DrawForm(vertexDraws, edgeDraws, matrix, startForm, inputCountVertexForm, matrixGraph, adjacencyList);

                startForm.Hide();

                drawForm.ShowDialog();

                startForm.Close();
            }
        }