Exemple #1
0
 private void btnGeometryAdd_Click(object sender, EventArgs e)
 {
     Geometry.LayerStart ls = new Geometry.LayerStart();
     if (ValidateDouble(txtZMin, ref ls.ZMin, -1000000.0, 1000000.0) && ValidateDouble(txtRadLen, ref ls.RadiationLength, 0.0, 1000000.0) && ValidateInt(txtPlate, ref ls.Plate, 0, 1000) && ValidateLong(txtBrick, ref ls.Brick, 0, 100000000))
     {
         System.Collections.ArrayList ar = new System.Collections.ArrayList();
         ar.AddRange(C.Geometry.Layers);
         ar.Add(ls);
         ar.Sort(new Geometry.order());
         C.Geometry.Layers = (Geometry.LayerStart[])ar.ToArray(typeof(Geometry.LayerStart));
         SetGeometryList();
     }
 }
Exemple #2
0
 private void btnFromDB_Click(object sender, EventArgs e)
 {
     if (ValidateLong(txtBrick, ref m_Brick, 0, 100000000) == false)
     {
         MessageBox.Show("A valid brick number is required.", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     SySal.OperaDb.OperaDbConnection conn = null;
     try
     {
         conn = SySal.OperaDb.OperaDbCredentials.CreateFromRecord().Connect();
         conn.Open();
         SySal.OperaDb.Schema.DB = conn;
         SySal.OperaDb.Schema.TB_PLATES plates = SySal.OperaDb.Schema.TB_PLATES.SelectWhere("ID_EVENTBRICK = " + m_Brick, "Z ASC");
         Geometry.LayerStart[]          ls     = new Geometry.LayerStart[plates.Count * 2];
         int i;
         for (i = 0; i < plates.Count; i++)
         {
             plates.Row                    = i;
             ls[i * 2].Brick               = m_Brick;
             ls[i * 2].Plate               = (int)plates._ID;
             ls[i * 2].ZMin                = plates._Z - 255.0;
             ls[i * 2].RadiationLength     = 29000.0;
             ls[i * 2 + 1].Brick           = m_Brick;
             ls[i * 2 + 1].Plate           = 0;
             ls[i * 2 + 1].ZMin            = plates._Z + 45.0;
             ls[i * 2 + 1].RadiationLength = 5600.0;
         }
         ls[i * 2 - 1].RadiationLength = 1e9;
         C.Geometry.Layers             = ls;
         SetGeometryList();
     }
     catch (Exception x)
     {
         MessageBox.Show(x.Message, "DB Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         if (conn != null)
         {
             conn.Close();
             conn = null;
         }
         try
         {
             SySal.OperaDb.Schema.DB = null;
         }
         catch (Exception) { }
     }
 }
Exemple #3
0
        private Geometry orderElementGeometry(Geometry toOrder)
        {
            Geometry  myGeometry = new Geometry();
            ArrayList geom       = new ArrayList();
            int       i;

            for (i = 0; i < toOrder.Layers.Length; i++)
            {
                Geometry.LayerStart info = new Geometry.LayerStart();
                info = toOrder.Layers[i];
                geom.Add(info);
            }
            IComparer myComparer = new Geometry.order();

            geom.Sort(myComparer);

            Geometry.LayerStart[] gmArray = (Geometry.LayerStart[])geom.ToArray(typeof(Geometry.LayerStart));
            myGeometry.Layers = gmArray;
            return(myGeometry);
        }