Ejemplo n.º 1
0
        public void CreateVertex(Data data, MakeTruePoint makeTruePoint, bool caged, bool doted, int cageSize)
        {
            Point point = new Point();

            if (caged == true || doted == true)
            {
                point = MakeCagedPoint(makeTruePoint.TruePoint, cageSize);
            }
            else
            {
                point = makeTruePoint.TruePoint;
            }

            RadioButton rd_button = new RadioButton
            {
                Name     = data.NumbVertexes.ToString(),
                Enabled  = true,
                Checked  = true,
                Text     = (data.NumbVertexes + 1).ToString(),
                Visible  = true,
                Location = point,
                AutoSize = true
            };

            data.RadioButtons.Add(rd_button);
            data.Edges.Add(new List <int>());
            data.NumbVertexes++;
        }
Ejemplo n.º 2
0
        public void PanelClicked(Data data, Line line, MakeTruePoint makeTruePoint, bool caged, bool doted, int cageSize)
        {
            if (doted == true || caged == true)
            {
                data.RadioButtons[Id].Location = MakeCagedPoint(makeTruePoint.TruePoint, cageSize);
            }
            else
            {
                data.RadioButtons[Id].Location = makeTruePoint.TruePoint;
            }

            LineMake(data.RadioButtons[Id].Location);

            for (int i = 0; i < data.EdgesForDraw.Count(); i++)
            {
                if (Id == data.EdgesForDraw[i].a)
                {
                    data.EdgesForDraw[i].point_a = TruePoint;
                }
                else if (Id == data.EdgesForDraw[i].b)
                {
                    data.EdgesForDraw[i].point_b = TruePoint;
                }
            }
            Handed = false;
        }
Ejemplo n.º 3
0
        public void PanelClicked(Data data, MakeTruePoint makeTruePoint)
        {
            for (int i = data.EdgesForDraw.Count() - 1; i >= 0; i--)
            {
                IsEdge = CheckIsEdge(makeTruePoint.TruePoint, data.EdgesForDraw[i]);

                if (IsEdge == true)
                {
                    data.Edges[data.EdgesForDraw[i].a].Remove(data.EdgesForDraw[i].b);
                    data.Edges[data.EdgesForDraw[i].b].Remove(data.EdgesForDraw[i].a);
                    data.EdgesForDraw.RemoveAt(i);
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        public bool IsVertex(Data data, MakeTruePoint makeTruePoint, bool caged, bool doted, int cageSize)
        {
            Point point = new Point();

            if (caged == true || doted == true)
            {
                point = MakeCagedPoint(makeTruePoint.TruePoint, cageSize);
            }
            else
            {
                point = makeTruePoint.TruePoint;
            }
            for (int i = 0; i < data.RadioButtons.Count(); i++)
            {
                if (data.RadioButtons[i].Location == point)
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 5
0
        private void Form1_Click(object sender, EventArgs e)
        {
            MakeTruePoint makeTruePoint = new MakeTruePoint();

            makeTruePoint.FormLocation = Location;

            if (buttonSelected == "Hand" && hand.Handed == true)
            {
                makeTruePoint.Vertex();
                this.Controls.Remove(data.RadioButtons[hand.Id]);

                hand.PanelClicked(data, line, makeTruePoint, caged, doted, cageSize);

                this.Controls.Add(data.RadioButtons[hand.Id]);
                InitializeBitmap();
                this.Invalidate();
            }
            else if (buttonSelected == "Vertex")
            {
                makeTruePoint.Vertex();
                if (!vertex.IsVertex(data, makeTruePoint, caged, doted, cageSize))
                {
                    vertex.CreateVertex(data, makeTruePoint, caged, doted, cageSize);

                    data.RadioButtons[data.NumbVertexes - 1].MouseClick += new MouseEventHandler(RdButtton_Click);
                    this.Controls.Add(data.RadioButtons[data.NumbVertexes - 1]);
                }
            }
            else if (buttonSelected == "Delete")
            {
                makeTruePoint.LineDelete();
                delete.PanelClicked(data, makeTruePoint);
                if (delete.IsEdge == true)
                {
                    InitializeBitmap();
                    this.Invalidate();
                }
            }
        }