Example #1
0
 private bool ConvertFlowConditionsSettingConstant()
 {
     try
     {
         DataGridView v = dataGridView;
         RiverSimulationProfile.TwoInOne o = _data as RiverSimulationProfile.TwoInOne;
         for (int i = 0; i < v.ColumnCount; ++i)
         {
             o.Array2D()[i, 0] = Convert.ToDouble(v[i, 0].Value);
         }
         if (singleValueTxt.Enabled)
         {
             o.ValueDouble()[0] = Convert.ToDouble(singleValueTxt.Text);
         }
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Example #2
0
 private bool ConvertTwoInOneDouble()
 {
     try
     {
         DataGridView v = dataGridView;
         RiverSimulationProfile.TwoInOne o = _data as RiverSimulationProfile.TwoInOne;
         for (int i = 0; i < colCount; ++i)
         {
             for (int j = 0; j < rowCount; ++j)
             {
                 o.Array2D()[i, j] = Convert.ToDouble(v[i, j].Value);
             }
         }
         if (singleValueTxt.Enabled)
         {
             o.ValueDouble()[0] = Convert.ToDouble(singleValueTxt.Text);
         }
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Example #3
0
        private void InitializeDataGridView()
        {
            if (inputFormType == InputFormType.SeparateForm)
            {
                DataGridViewUtility.InitializeDataGridView(dataGridView, colCount, rowCount, colWidth, rowHeadersWidth,
                                                           tableName, colName, rowName, nocolNum, noRowNum, false, true);
            }
            else if (inputFormType == InputFormType.VerticalVelocityDistributionForm)
            {
                DataGridViewUtility.InitializeDataGridView(dataGridView, colCount, rowCount, colWidth, rowHeadersWidth,
                                                           tableName, colName, rowName, nocolNum, noRowNum, false, true);
                dataGridView.Columns[0].Name = "垂向分層位置";
                dataGridView.Columns[1].Name = "比例係數";
            }
            else if (inputFormType == InputFormType.BoundaryTime)
            {
                DataGridViewUtility.InitializeDataGridView(dataGridView, colCount, rowCount, colWidth, rowHeadersWidth,
                                                           tableName, colName, rowName, nocolNum, noRowNum, false, false);
            }
            else if (inputFormType == InputFormType.TwoInOneDouble ||
                     inputFormType == InputFormType.TwoInOneDoubleGreaterThanZero ||
                     inputFormType == InputFormType.TwoInOneDoubleGreaterThanOrEqualZero)
            {
                RiverSimulationProfile.TwoInOne o = _data as RiverSimulationProfile.TwoInOne;
                Debug.Assert(o != null);

                singleValueTxt.Text = o.ValueDouble()[0].ToString();
                DataGridViewUtility.InitializeDataGridView(dataGridView, colCount, rowCount, colWidth, rowHeadersWidth,
                                                           tableName, colName, rowName, nocolNum, noRowNum);
                selInputBtn.Visible = true;

                switch (o.type)
                {
                case RiverSimulationProfile.TwoInOne.Type.UseValue:
                    singleValueRdo.Checked = true;
                    break;

                case RiverSimulationProfile.TwoInOne.Type.UseArray:
                    tableValueRdo.Checked = true;
                    break;

                case RiverSimulationProfile.TwoInOne.Type.None:
                    singleValueRdo.Checked = false;
                    tableValueRdo.Checked  = false;
                    singleValueTxt.Enabled = false;
                    dataGridView.Enabled   = false;
                    break;
                }
            }
            else if (inputFormType == InputFormType.GenericDouble ||
                     inputFormType == InputFormType.GenericDoubleGreaterThanZero ||
                     inputFormType == InputFormType.GenericDoubleGreaterThanOrEqualZero)
            {
                DataGridViewUtility.InitializeDataGridView(dataGridView, colCount, rowCount, colWidth, rowHeadersWidth,
                                                           tableName, colName, rowName, nocolNum, noRowNum);
            }
            else if (inputFormType == InputFormType.FlowConditionsSettingConstant)
            {
                RiverSimulationProfile.TwoInOne o = _data as RiverSimulationProfile.TwoInOne;
                Debug.Assert(o != null);

                singleValueTxt.Text = o.ValueDouble()[0].ToString();
                DataGridViewUtility.InitializeDataGridView(dataGridView, colCount, rowCount, colWidth, rowHeadersWidth,
                                                           "", colName, rowName, nocolNum, true);
                dataGridView.Rows[0].HeaderCell.Value = tableName;

                switch (o.type)
                {
                case RiverSimulationProfile.TwoInOne.Type.UseValue:
                    singleValueRdo.Checked = true;
                    break;

                case RiverSimulationProfile.TwoInOne.Type.UseArray:
                    tableValueRdo.Checked = true;
                    break;

                case RiverSimulationProfile.TwoInOne.Type.None:
                    singleValueRdo.Checked = false;
                    tableValueRdo.Checked  = false;
                    singleValueTxt.Enabled = false;
                    dataGridView.Enabled   = false;
                    break;
                }
            }
            else if (inputFormType == InputFormType.FlowConditionsSettingVariable)
            {
                RiverSimulationProfile.TwoInOne o = _data as RiverSimulationProfile.TwoInOne;
                Debug.Assert(o != null);

                switch (o.type)
                {
                case RiverSimulationProfile.TwoInOne.Type.UseValue:
                    singleValueRdo.Checked = true;
                    break;

                case RiverSimulationProfile.TwoInOne.Type.UseArray:
                    tableValueRdo.Checked = true;
                    break;

                case RiverSimulationProfile.TwoInOne.Type.None:
                    singleValueRdo.Checked = false;
                    tableValueRdo.Checked  = false;
                    singleValueTxt.Enabled = false;
                    dataGridView.Enabled   = false;
                    break;
                }
                singleValueTxt.Visible = (inputFormType == InputFormType.FlowConditionsSettingConstant) ? true :false;
            }
            else if (inputFormType == InputFormType.SeabedThicknessForm)
            {
                DataGridViewUtility.InitializeDataGridView(dataGridView, colCount, rowCount, colWidth, rowHeadersWidth,
                                                           tableName, colName, rowName, nocolNum, noRowNum, false, true);
                dataGridView.Rows[0].HeaderCell.Value = "作用層";
            }
            else if (inputFormType == InputFormType.SedimentCompositionRatioForm)
            {
                DataGridViewUtility.InitializeDataGridView(dataGridView, colCount, rowCount, colWidth, rowHeadersWidth,
                                                           tableName, colName, rowName, nocolNum, noRowNum, false, true);
                dataGridView.Rows[0].HeaderCell.Value = "作用層";
            }
            else if (inputFormType == InputFormType.BottomBedParticleSizeRatio)
            {
                InitTableBottomBedParticleSizeRatio();
            }

            else
            {
                DataGridViewUtility.InitializeDataGridView(dataGridView, colCount, rowCount, colWidth, rowHeadersWidth,
                                                           tableName, colName, rowName, nocolNum, noRowNum);
            }

            FillDataGridView();
        }