Exemple #1
0
    public List <Vector3> UpdateCurrentVertices(Malla mallaPass, int columns, int rows, float stepX, float stepZ,
                                                RaycastHit hitMouseOnTerrain)
    {
        if (mallaPass.Lots.Count == 0)
        {
            print("Malla pass had not lots assgined");
            return(new List <Vector3>());
        }

        //for GC
        var indexMiddle = UMesh.ReturnIndexContain(hitMouseOnTerrain.point, mallaPass.Lots);

        if (IsOnBankAlready(indexMiddle))
        {
            return(_vertexBank[indexMiddle]);
        }

        List <Vector3> objects = new List <Vector3>();

        objects = UMesh.ReturnThePos(hitMouseOnTerrain.point, stepX, stepZ, columns, rows);

        _indexesHover = UMesh.ReturnIndexesContain(objects, mallaPass.Lots);
        var res = UMesh.ReturnCurrentLotsVertex(IndexesHover, mallaPass.Lots);

        AddToBank(indexMiddle, res);
        return(res);
    }
        public ActionResult DeleteConfirmed(int id)
        {
            Malla malla = db.Mallas.Find(id);

            db.Mallas.Remove(malla);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 private void TxtProductoId_TextChanged(object sender, EventArgs e)
 {
     if (TxtProductoId.Text.Trim().Equals("*"))
     {
         TxtProductoId.Text = "";
         Malla.Focus();
         Malla.CurrentCell = Malla.Rows[SigPartida - 1].Cells[2];
     }
 }
Exemple #4
0
        private void Button1_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter = "Excel Documents (*.xls)|*.xls";
            //Commit
            sfd.FileName = "MiExport.xls";
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                // Copy DataGridView al clipboard
                copyAlltoClipboard();

                object            misValue = System.Reflection.Missing.Value;
                Excel.Application xlexcel  = new Excel.Application();

                xlexcel.DisplayAlerts = false;// Sin esto, obtendrás dos mensajes de confirmación de sobrescritura
                Excel.Workbook  xlWorkBook  = xlexcel.Workbooks.Add(misValue);
                Excel.Worksheet xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);

                // Format column B  siempre será  una despues para afectar una anterior
                Excel.Range rng = xlWorkSheet.get_Range("C:C").Cells;
                rng.NumberFormat = "0.00000";

                // Pegar resultados del portapapeles en el rango de la hoja de trabajo
                Excel.Range CR = (Excel.Range)xlWorkSheet.Cells[1, 1];
                CR.Select();
                xlWorkSheet.PasteSpecial(CR, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, true);


                //// Borra la columna en blanco
                //Excel.Range delRng = xlWorkSheet.get_Range("A:A").Cells;
                //delRng.Delete(Type.Missing);
                //xlWorkSheet.get_Range("A1").Select();

                // Guarde el archivo de Excel en la ubicación capturada desde SaveFileDialog
                xlWorkBook.SaveAs(sfd.FileName, Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
                xlexcel.DisplayAlerts = true;
                xlWorkBook.Close(true, misValue, misValue);
                xlexcel.Quit();

                releaseObject(xlWorkSheet);
                releaseObject(xlWorkBook);
                releaseObject(xlexcel);


                // Borrar la selección del Portapapeles y DataGridView
                Clipboard.Clear();
                Malla.ClearSelection();


                // Abra el archivo de Excel recién guardado
                if (File.Exists(sfd.FileName))
                {
                    System.Diagnostics.Process.Start(sfd.FileName);
                }
            }
        }
 public ActionResult Edit([Bind(Include = "IdMalla,NomMalla,InicioValidez,FinValidez")] Malla malla)
 {
     if (ModelState.IsValid)
     {
         db.Entry(malla).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(malla));
 }
Exemple #6
0
        private void copyAlltoClipboard()
        {
            Malla.SelectAll();
            DataObject dataObj = Malla.GetClipboardContent();

            if (dataObj != null)
            {
                Clipboard.SetDataObject(dataObj);
            }
        }
        public ActionResult Create([Bind(Include = "IdMalla,NomMalla,InicioValidez,FinValidez")] Malla malla)
        {
            if (ModelState.IsValid)
            {
                db.Mallas.Add(malla);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(malla));
        }
Exemple #8
0
 private void RecargarGrid()
 {
     Malla.Rows.Clear();
     foreach (var r in informeController.SelectByDescrip(TxtNombreRep.Text))
     {
         Malla.Rows.Add();
         Malla.Rows[Malla.RowCount - 1].Cells[0].Value = r.InformeId;
         Malla.Rows[Malla.RowCount - 1].Cells[1].Value = r.Sistema;
         Malla.Rows[Malla.RowCount - 1].Cells[2].Value = r.Descripcion;
     }
     Malla.Focus();
 }
Exemple #9
0
 private void RecargarGrid()
 {
     Malla.Rows.Clear();
     foreach (var r in reporteController.FiltrarVsNombre(TxtNombreRep.Text))
     {
         Malla.Rows.Add();
         Malla.Rows[Malla.RowCount - 1].Cells[0].Value = r.ReporteId;
         Malla.Rows[Malla.RowCount - 1].Cells[1].Value = r.Nombre;
         Malla.Rows[Malla.RowCount - 1].Cells[2].Value = r.DelSistema;
         Malla.Rows[Malla.RowCount - 1].Cells[3].Value = r.Parametrizado;
     }
     Malla.Focus();
 }
        // GET: Malla/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Malla malla = db.Mallas.Find(id);

            if (malla == null)
            {
                return(HttpNotFound());
            }
            return(View(malla));
        }
Exemple #11
0
 private void LlenaCampos()
 {
     try
     {
         PbxImg.Image     = null;
         TxtSolucion.Text = error.Solucion;
         PbxImg.Image     = Image.FromFile(error.Img);
         Malla.Focus();
     }
     catch (Exception)
     {
         PbxImg.Image = null;
         Malla.Focus();
     }
 }
Exemple #12
0
    // Use this for initialization
    void Start()
    {
        camera = USearch.FindCurrentCamera();

        Malla     = (Malla)General.Create(Root.malla, container: Program.ClassContainer.transform);
        Poly      = new UPoly();
        subDivide = new SubDivider();
        Vertex    = new Vertexer();
        iniTerr   = new InitializerTerrain();

        iniTerr.Initializer(ref Vertices, ref mesh);
        iniTerr.InitializeMallaStats(Vertices, ref wholeMalla, ref nextStart, ref zLot);

        SubPolyr  = new SubPolyr();
        subMesh   = new SubMeshData();
        IsLoading = true;

        //bz is static and if a new game is started needs to clean up and start again
        CrystalManager1 = new CrystalManager();
    }
Exemple #13
0
 public void RenderMesh()
 {
     // if(Malla.Enabled)
     Malla.Render();
 }
Exemple #14
0
        //Loads the file and initializes all settings with the information of the file
        private void Button_Load_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog Dialogo2 = new OpenFileDialog();
                if (Dialogo2.ShowDialog() == true)
                {
                    BinaryFormatter Bf  = new BinaryFormatter();
                    FileStream      r   = File.OpenRead(Dialogo2.FileName);
                    Guardado        bac = (Guardado)Bf.Deserialize(r);
                    r.Close();
                    Mirror    = bac.getMirror();
                    variables = bac.getVariables();
                    cellGrid  = bac.getGrid();
                    Tiempo    = bac.getTiempo();

                    //Plots
                    tempValues  = bac.getTemp();
                    phaseValues = bac.getPhase();
                    Charts.CreateGraph(tempgraph, tempValues, "Temperature");
                    Charts.CreateGraph(phasegraph, phaseValues, "Phase");

                    ColumnSlider.Value = cellGrid.getceldas()[0].Length - 2;
                    RowsSlider.Value   = cellGrid.getceldas().Length - 2;

                    //Restarting Grid
                    grid.Children.Clear();
                    grid.ColumnDefinitions.Clear();
                    grid.RowDefinitions.Clear();
                    grid2.Children.Clear();
                    grid2.ColumnDefinitions.Clear();
                    grid2.RowDefinitions.Clear();



                    //Adding Columns
                    for (int j = 0; j < ColumnSlider.Value; j++)
                    {
                        grid.ColumnDefinitions.Add(new ColumnDefinition());
                        grid2.ColumnDefinitions.Add(new ColumnDefinition());
                    }
                    //We convert the stack to list in order to serach for the first cells
                    Celda[][][] temp = cellGrid.getMemory().ToArray();

                    //Adding Rows
                    Rectangle[][] rectanglesTemp  = new Rectangle[cellGrid.getceldas().Length][];
                    Rectangle[][] rectanglesPhase = new Rectangle[cellGrid.getceldas().Length][];
                    for (int i = 1; i < RowsSlider.Value + 1; i++)
                    {
                        Rectangle[] CellRowTemp  = new Rectangle[cellGrid.getceldas()[0].Length];
                        Rectangle[] CellRowPhase = new Rectangle[cellGrid.getceldas()[0].Length];
                        grid.RowDefinitions.Add(new RowDefinition());
                        grid2.RowDefinitions.Add(new RowDefinition());

                        //This for loop prints the grid
                        for (int j = 1; j < ColumnSlider.Value + 1; j++)
                        {
                            Rectangle       rectangle  = new Rectangle();
                            Rectangle       rectangle2 = new Rectangle();
                            SolidColorBrush BlackBrush = new SolidColorBrush();
                            BlackBrush.Color  = Colors.Black;
                            rectangle.Stroke  = BlackBrush;
                            rectangle2.Stroke = BlackBrush;

                            if (temp[temp.Length - 1][i][j].getPhase() == 0)
                            {
                                rectangle.StrokeThickness  = 3;
                                rectangle2.StrokeThickness = 3;
                            }
                            else
                            {
                                rectangle.StrokeThickness  = 1;
                                rectangle2.StrokeThickness = 1;
                            }

                            rectangle.Fill  = new SolidColorBrush(Colors.White);
                            rectangle2.Fill = new SolidColorBrush(Colors.White);
                            //Here we add the rectangles inside the grid
                            Grid.SetRow(rectangle, i - 1);
                            Grid.SetColumn(rectangle, j - 1);
                            grid.Children.Add(rectangle);
                            Grid.SetRow(rectangle2, i - 1);
                            Grid.SetColumn(rectangle2, j - 1);
                            grid2.Children.Add(rectangle2);
                            CellRowTemp[j]  = rectangle;
                            CellRowPhase[j] = rectangle2;
                        }
                        rectanglesTemp[i]  = CellRowTemp;
                        rectanglesPhase[i] = CellRowPhase;
                    }
                    cellGrid.loadFixRectangles(rectanglesTemp, rectanglesPhase);
                    cellGrid.Represent();

                    //Style
                    SetGrid.IsEnabled              = false;
                    DiscardGrid.IsEnabled          = false;
                    ColumnSlider.IsEnabled         = false;
                    RowsSlider.IsEnabled           = false;
                    button_Demonstration.IsEnabled = false;

                    button_Play.IsEnabled     = true;
                    button_Pause.IsEnabled    = true;
                    button_Atrás.IsEnabled    = true;
                    button_Adelante.IsEnabled = true;
                    button_Stop.IsEnabled     = true;

                    Combobox_Condition.IsEnabled = false;
                    Combobox_Variables.IsEnabled = false;
                    Custom_Variables.IsEnabled   = false;

                    button_Save.Visibility = Visibility.Visible;
                    button_Load.Visibility = Visibility.Hidden;

                    Confirm_Button.Content = "Reset Configuration";
                    HelpLabel.Content      = "";

                    //Style
                    Confirm_Button.Background = new SolidColorBrush(Color.FromArgb(255, 255, 110, 110));

                    //ZedGRaph
                    tempgraph.AxisChange();
                    phasegraph.AxisChange();
                    tempgraph.Invalidate();
                    phasegraph.Invalidate();

                    //Simulation started
                    Started = true;
                }
            }
            catch
            {
                MessageBox.Show("There was a problem loading");
            }
        }
Exemple #15
0
        //If all the parameters have been set the simulation can start. Once it has been confirmed this button will reset all the parameters
        private void Confirm_Button_Click(object sender, RoutedEventArgs e)
        {
            if (Confirm_Button.Content.ToString() == "Confirm Configuration")
            {
                if (gridSet)
                {
                    if (Condition)
                    {
                        if (variables != null && !CustomvarUnmarked)
                        {
                            if (cellGrid.HayGrano())
                            {
                                Started = true;
                                //Buttons
                                SetGrid.IsEnabled              = false;
                                DiscardGrid.IsEnabled          = false;
                                ColumnSlider.IsEnabled         = false;
                                RowsSlider.IsEnabled           = false;
                                button_Demonstration.IsEnabled = false;

                                button_Play.IsEnabled     = true;
                                button_Pause.IsEnabled    = true;
                                button_Atrás.IsEnabled    = true;
                                button_Adelante.IsEnabled = true;
                                button_Stop.IsEnabled     = true;

                                Combobox_Condition.IsEnabled = false;
                                Combobox_Variables.IsEnabled = false;
                                Custom_Variables.IsEnabled   = false;

                                button_Save.Visibility = Visibility.Visible;
                                button_Load.Visibility = Visibility.Hidden;

                                Confirm_Button.Content = "Reset Configuration";
                                HelpLabel.Content      = "";

                                //Style
                                Confirm_Button.Background = new SolidColorBrush(Color.FromArgb(255, 255, 110, 110));
                                LabelMostrar.Content      = "Move Over The\nGrid To See Values";
                                LabelMostrar.FontSize     = 14;
                            }
                            else
                            {
                                MessageBox.Show("Select the Starting Point/s First!");
                            }
                        }
                        else
                        {
                            if (variables == null)
                            {
                                MessageBox.Show("Select the Variables First!");
                            }
                            else
                            {
                                MessageBox.Show("You have unmarked your custom variables, please select them or select the predefined variables");
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Select the Boundary Condition First!");
                    }
                }
                else
                {
                    MessageBox.Show("Set the Gird First!");
                }
            }
            else
            {
                //Unsetting variables
                cellGrid = new Malla();
                //We set started to false because the simulation has ended and we set custom variables to false
                Started = false;
                if (Customvar)
                {
                    Customvar         = false;
                    CustomvarUnmarked = false;
                    Combobox_Variables.Items.RemoveAt(3);
                    Combobox_Variables.SelectedIndex = 0;
                }
                //Buttons
                SetGrid.IsEnabled              = true;
                DiscardGrid.IsEnabled          = true;
                ColumnSlider.IsEnabled         = true;
                RowsSlider.IsEnabled           = true;
                button_Demonstration.IsEnabled = true;

                button_Play.IsEnabled     = false;
                button_Pause.IsEnabled    = false;
                button_Atrás.IsEnabled    = false;
                button_Adelante.IsEnabled = false;
                button_Stop.IsEnabled     = false;
                simSpeed.IsEnabled        = false;

                Combobox_Condition.IsEnabled = true;
                Combobox_Variables.IsEnabled = true;
                Custom_Variables.IsEnabled   = true;

                button_Save.Visibility = Visibility.Hidden;
                button_Load.Visibility = Visibility.Visible;

                timer.Stop();
                timer_label.Visibility = Visibility.Hidden;
                DiscardGrid_Click(new object(), new RoutedEventArgs());

                Tiempo = new List <double>()
                {
                    0
                };

                Confirm_Button.Content = "Confirm Configuration";
                HelpLabel.Content      = "Build the environment first!";

                //Style
                Confirm_Button.Background = new SolidColorBrush(Color.FromArgb(255, 160, 255, 110));

                //ZedGraph
                tempValues.RemoveRange(0, tempValues.Count);
                phaseValues.RemoveRange(0, phaseValues.Count);
                tempgraph.AxisChange();
                phasegraph.AxisChange();
                tempgraph.Invalidate();
                phasegraph.Invalidate();
            }
        }