Beispiel #1
0
 private void updateTransformation()
 {
     this.Transformation = () =>
     {
         this.view.Rotate(angle);
         this.view.moveTo(this.view.Center.X + dx, this.view.Center.Y + dy);
         this.view         = this.view.getScaled(dScale);
         this.drawColor.R += dR;
         this.drawColor.G += dG;
         this.drawColor.B += dB;
     };
 }
Beispiel #2
0
 public virtual IEnumerable <GlPointR2> getIntersection(GlFigure F)
 {
     throw new System.NotImplementedException();
 }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == -1 || GlConstants.CERTAIN_FIGURES[comboBox1.SelectedIndex].Equals(GlConstants.VECTOR) ||
                GlConstants.CERTAIN_FIGURES[comboBox1.SelectedIndex].Equals(GlConstants.FIGURE_SYSTEM) ||
                GlConstants.CERTAIN_FIGURES[comboBox1.SelectedIndex].Equals(GlConstants.POLYGON))
            {
                return;
            }

            List <string> figureInfo = new List <string>();

            foreach (TextBox i in currentFigure.DataFields)
            {
                if (i.Text == "" || (!normalInputDot.IsMatch(i.Text) && !normalInputComma.IsMatch(i.Text)))
                {
                    return;
                }
                else
                {
                    figureInfo.Add(i.Text);
                }
            }

            GlFigure f = currentFigure.constructFigure(GlConstants.CERTAIN_FIGURES[currentFigure.FigureIndex]);

            currentFigure.View = f;

            try
            {
                currentFigure.Angle              = (float)Convert.ToDouble(textBox2.Text);
                currentFigure.DX                 = (float)Convert.ToDouble(textBox3.Text);
                currentFigure.DY                 = (float)Convert.ToDouble(textBox4.Text);
                currentFigure.deltaScale         = (float)Convert.ToDouble(textBox5.Text);
                currentFigure.DR                 = Convert.ToInt32(numericUpDown1.Value);
                currentFigure.DG                 = Convert.ToInt32(numericUpDown2.Value);
                currentFigure.DB                 = Convert.ToInt32(numericUpDown3.Value);
                currentFigure.catchIntersections = checkBox1.Checked;
                currentFigure.tangentFrom        = Convert.ToInt32(numericUpDown4.Value);
                currentFigure.curvFrom           = Convert.ToInt32(numericUpDown5.Value);
                currentFigure.boxDraw            = checkBox2.Checked;
            }
            catch
            {
                MessageBox.Show("Fill in all the gaps!", "Error");
                return;
            }

            updateDrawing();
            demoFigures.Add(currentFigure);

            dataGridView1.Rows.Add();
            dataGridView1.Rows[demoFigures.Count - 1].Cells[0].Value = currentFigure.View.GetType().Name + ", " + (demoFigures.Count - 1);
            dataGridView1.Rows[demoFigures.Count - 1].Cells[1].Value = string.Join(";", figureInfo.ToArray());
            dataGridView1.Rows[demoFigures.Count - 1].Cells[2].Value = (comboBox2.SelectedIndex == -1 ? "Normal" : comboBox2.Items[comboBox2.SelectedIndex].ToString())
                                                                       + ";" + button2.BackColor.R + ";" + button2.BackColor.G + ";"
                                                                       + button2.BackColor.B + ";" + textBox1.Text;
            dataGridView1.Rows[demoFigures.Count - 1].Cells[3].Value = checkBox1.Checked.ToString();
            dataGridView1.Rows[demoFigures.Count - 1].Cells[4].Value = numericUpDown4.Value.ToString();
            dataGridView1.Rows[demoFigures.Count - 1].Cells[5].Value = numericUpDown5.Value.ToString();
            updateFigure();
        }
Beispiel #4
0
 public virtual void AddFigure(GlFigure F)
 {
     throw new System.NotImplementedException();
 }