Exemplo n.º 1
0
        private void PanelDibujo_MouseClick(object sender, MouseEventArgs e)
        {
            Point  click    = e.Location;
            double x        = click.X - G.Escenario.Centro.X;
            double y        = click.Y - G.Escenario.Centro.Y;
            Punto  relClick = new Punto(x, y);

            if (rbEjeFijado.Checked)
            {
                G.Escenario.Centro     = new Punto(click.X, click.Y);
                G.Escenario.EjeVisible = ejeVisible.Checked;
                msnlbl.Text            = "Nuevo eje fijado en punto: (" + click.X + "," + click.Y + ")";
                PanelDibujo.Refresh();
            }
            if (rbDibujar.Checked)
            {
                if (nPuntos == 0)
                {
                    puntosTemporales = new List <Punto>();
                    puntosTemporales.Add(relClick);
                }
                else
                {
                    puntosTemporales.Add(relClick);
                }
                nPuntos++;
                dibujarTemporales();

                lblLastPoint.Text = "Ultimo punto rel: (" + x + "," + y + ")";
                actEtiquetas();
            }
        }
Exemplo n.º 2
0
 private void listboxObjetos_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == (char)Keys.Delete && listboxObjetos.SelectedItem != null)
     {
         G.Escenario.Objetos.RemoveAt(listboxObjetos.SelectedIndex);
         listboxObjetos.Items.RemoveAt(listboxObjetos.Items.Count - 1);
         nObjetos--;
         actEtiquetas();
         PanelDibujo.Refresh();
     }
 }
Exemplo n.º 3
0
        private void btnObjeto_Click(object sender, EventArgs e)
        {
            if (nPoligonos > 0)
            {
                G.Escenario.Objetos[nObjetos - 1].convertirARelativo();
                nPoligonos = 0;
                nPuntos    = 0;
                actEtiquetas();

                PanelDibujo.Refresh();
            }
            else
            {
                MessageBox.Show("No existe ningun poligono creado, cree al menos un poligono");
            }
        }
Exemplo n.º 4
0
 public void instanciarPoligono(ref Poligono poligono)
 {
     if (nPoligonos == 0)
     {
         //AÑADIR LOGICA NUEVA DE CREACION DE OBJETOS RELATIVOS A SI MISMOS
         Objeto obj = new Objeto(Objeto.Relatividad.escenario);//crea un nuevo objeto relativo al escenario con centro 0,0
         poligono.Centro = obj.Centro;
         obj.Add(poligono);
         G.Escenario.Objetos.Add(obj);
         nObjetos++;
     }
     else
     {
         poligono.Centro = G.Escenario.Objetos[nObjetos - 1].Centro;
         G.Escenario.Objetos[nObjetos - 1].Add(poligono);
     }
     nPuntos          = 0;
     puntosTemporales = new List <Punto>();
     nPoligonos++;
     actEtiquetas();
     PanelDibujo.Refresh();
 }
Exemplo n.º 5
0
 private void timer_Tick(object sender, EventArgs e)
 {
     /*
      * Matriz m1 = new Matriz();
      * m1.MatrizEscala(1.005, 1);
      * Transformacion.transObjeto(escenario.Objetos[listboxObjetos.SelectedIndex], m1);
      *
      * Matriz m2 = new Matriz();
      * m2.MatrizRotacion(2);
      * Transformacion.transObjeto(escenario.Objetos[listboxObjetos.SelectedIndex], m2);
      *
      * Matriz m3 = new Matriz();
      * m3.MatrizTraslacion(2,0);
      * Transformacion.transObjeto(escenario.Objetos[listboxObjetos.SelectedIndex], m3);
      */
     foreach (Matriz matriz in G.Animaciones[listboxAnimacion.SelectedIndex].Matrices)
     {
         Transformacion.transObjeto(G.Escenario.Objetos[listboxObjetos.SelectedIndex], matriz);
     }
     contador.Text = timercount.ToString();
     timercount++;
     PanelDibujo.Refresh();
 }
Exemplo n.º 6
0
 private void load()
 {
     try
     {
         using (System.Windows.Forms.OpenFileDialog dialog = new OpenFileDialog())
         {
             if (dialog.ShowDialog() == DialogResult.OK)
             {
                 using (Stream st = File.Open(dialog.FileName, FileMode.Open))
                 {
                     var binfor = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                     G = (Graficador)binfor.Deserialize(st);
                     PanelDibujo.Refresh();
                     actEtiquetas();
                     MessageBox.Show("CARGADO");
                 }
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 7
0
 //al modificar el check de mostrar ejes
 private void ejeVisible_CheckedChanged(object sender, EventArgs e)
 {
     //se actualiza el check y se redibuja el panel
     G.Escenario.EjeVisible = ejeVisible.Checked;
     PanelDibujo.Refresh();
 }
Exemplo n.º 8
0
 private void btnCentrarEje_Click(object sender, EventArgs e)
 {
     G.Escenario.Centro = new Punto(PanelDibujo.Width / 2, PanelDibujo.Height / 2);
     msnlbl.Text        = "Eje centrado en: (" + G.Escenario.Centro.X + "," + G.Escenario.Centro.Y + ")";
     PanelDibujo.Refresh();
 }