Exemplo n.º 1
0
        /// <summary>
        /// Wyœwietlany prostok¹t w kontrolce.
        /// </summary>
        /// <param name="rect">dany prostok¹t</param>
        /// <param name="node">odpowiadaj¹cy prostok¹towi wêze³ listy</param>
        private void viewRectangle(Rectangle rect, RectTreeNode node)
        {
            this.rectangleViewer.Rectangle = rect;
            this.rectangleViewer.Refresh();

            if(rect == null)
                this.rectangleViewer.Clear();

            if (node == null)
            {
                text = "";
                output.Lines = text.Split(param);
            }
            else
                output.Lines = node.InfoOutput.Split(param);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Dodawanie rozwi¹zañ tylko do widoku na kontrolce.
        /// </summary>
        private void addSolutionsOnlyToView()
        {
            for (IEnumerator it = this.solutions.GetEnumerator(); it.MoveNext(); )
            {
                RectTreeNode node = new RectTreeNode();
                Solution s = (Solution)it.Current;
                if (s == null)
                    continue;
                Rectangle sRect = s.Rectangle;
                String descr = "";
                if (sRect != null)
                    descr = " (" + sRect.SideA + ", " + sRect.SideB + ", " + sRect.Area + ")";
                node.Text = s.Tag + descr;
                this.rectanglesTreeView.Nodes[1].Nodes.Add(node);

                text = "Algorytm " + s.Tag + ":\n";
                text += "Suma pól wszystkich prostok¹tów:  " + countArea() + "\n";
                text += "Pole wyliczonego prostok¹ta:            " + s.Rectangle.Area + "\n";
                node.InfoOutput = text;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///  Dodawany prostok¹t do wyœwietlanej listy prostok¹tów.
        /// </summary>
        /// <param name="rect">nowy prostok¹t</param>
        /// <returns>nowo utworzony wêze³</returns>
        private RectTreeNode addRectangleToTreeView(Rectangle rect)
        {
            RectTreeNode node = new RectTreeNode();
            int count = rectangles.Count;
            node.Text = count + " prostok¹t [" + rect.SideA +
                            ", " + rect.SideB + ", " + rect.Area + "]";

            // dodawanie do listy prostok¹tów
            this.rectanglesTreeView.Nodes[0].Nodes.Add(node);
            this.rectanglesTreeView.SelectedNode = this.rectanglesTreeView.Nodes[0].Nodes[count-1];
            TreeNodeMouseClickEventArgs eventArg = new TreeNodeMouseClickEventArgs(this.rectanglesTreeView.SelectedNode,
                MouseButtons.Left, 1, 0, 0);
            rectanglesTreeView_NodeMouseClick(this, eventArg);
            this.rectanglesTreeView.Refresh();

            return node;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Dodawane rozwi¹zanie do listy rozwi¹zañ w odpowiednie miejsce.
 /// </summary>
 /// <param name="newSolution">nowe rozwi¹zanie</param>
 /// <param name="index">wskazane miejsce</param>
 private void addSolution(Solution newSolution, int index)
 {
     if (newSolution != null && index >= 0)
     {
         solutions.Insert(index, newSolution);
         RectTreeNode node = new RectTreeNode();
         Rectangle nsolRect = newSolution.Rectangle;
         String descr = "";
         if (nsolRect != null)
             descr = " (" + nsolRect.SideA + ", " + nsolRect.SideB + ", " + nsolRect.Area + ")";
         node.Text = newSolution.Tag + descr;
         this.rectanglesTreeView.Nodes[1].Nodes.Insert(index, node);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Dodawanie prostok¹tów tylko do widoku na kontrolce.
 /// </summary>
 private void addRectanglesOnlyToView()
 {
     int count = 1;
     for (IEnumerator it = this.rectangles.GetEnumerator(); it.MoveNext(); )
     {
         RectTreeNode node = new RectTreeNode();
         Rectangle rect = (Rectangle)it.Current;
         node.Text = count + " prostok¹t [" + rect.SideA +
                     ", " + rect.SideB + ", " + rect.Area + "]";
         this.rectanglesTreeView.Nodes[0].Nodes.Add(node);
         count++;
     }
 }