Example #1
0
        /// <summary>
        /// 点击"编辑标贯/动探"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditNTestButton_Click(object sender, RoutedEventArgs e)
        {
            int selectIndex = this.NTestListDataGrid.SelectedIndex;

            // 传递历史取样深度列表和历史取样编号列表
            List <string> lastNumberList = new List <string>();
            List <double> lastDepthList  = new List <double>();

            if (this.NTestListDataGrid.Items.Count > 0)
            {
                for (int i = 0; i < this.NTestListDataGrid.Items.Count; i++)
                {
                    if (i != selectIndex)
                    {
                        DataRowView drv0 = (DataRowView)this.NTestListDataGrid.Items[i];
                        lastNumberList.Add(drv0[0].ToString());
                        lastDepthList.Add((double)drv0[1]);
                    }
                }
            }

            // 赋值传递数据
            DataRowView drv    = (DataRowView)this.NTestListDataGrid.SelectedItem;
            string      number = (string)drv[0];
            double      depth  = (double)drv[1];
            double      value  = (double)drv[2];

            ZkNTest.ntype type = (ZkNTest.ntype)drv[3];

            // 实例化窗口
            ZkNTestDetail editNTest = new ZkNTestDetail(lastDepthList, number, depth, value, type);

            editNTest.ShowDialog();
            if (editNTest.DialogResult == true)
            {
                number = editNTest.NTestNumberTextBox.Text;
                depth  = Convert.ToDouble(editNTest.NTestDepthTextBox.Text);
                value  = Convert.ToDouble(editNTest.NTestValueTextBox.Text);
                if (editNTest.typeN.IsChecked == true)
                {
                    type = ZkNTest.ntype.N;
                }
                else if (editNTest.typeN10.IsChecked == true)
                {
                    type = ZkNTest.ntype.N10;
                }
                else if (editNTest.typeN635.IsChecked == true)
                {
                    type = ZkNTest.ntype.N635;
                }
                else
                {
                    type = ZkNTest.ntype.N120;
                }
                EditRowNTestListDataTable(selectIndex, number, depth, value, type);

                // 绘图
                DrawZk();
            }
        }
Example #2
0
        /// <summary>
        /// 向NTestListDataTable添加行
        /// </summary>
        /// <param name="_number">标贯/动探编号</param>
        /// <param name="_depth">标贯/动探深度</param>
        /// <param name="_value">标贯/动探击数</param>
        /// <param name="_type">标贯/动探类型</param>
        private void AddRowToNTestListDataTable(string _number, double _depth, double _value, ZkNTest.ntype _type)
        {
            DataRow dr = dtNTest.NewRow();

            dr["numberList"] = _number;
            dr["depthList"]  = _depth;
            dr["valueList"]  = _value;
            dr["typeList"]   = _type;
            dtNTest.Rows.Add(dr);
        }
Example #3
0
        /// <summary>
        /// 编辑NTestListDataTable行
        /// </summary>
        /// <param name="_rowIndex"></param>
        /// <param name="_number">标贯/动探编号</param>
        /// <param name="_depth">标贯/动探深度</param>
        /// <param name="_value">标贯/动探击数</param>
        /// <param name="_type">标贯/动探类型</param>
        private void EditRowNTestListDataTable(int _rowIndex, string _number, double _depth, double _value, ZkNTest.ntype _type)
        {
            DataRow dr = dtNTest.Rows[_rowIndex];

            dr.BeginEdit();
            dr["numberList"] = _number;
            dr["depthList"]  = _depth;
            dr["valueList"]  = _value;
            dr["typeList"]   = _type;
            dr.EndEdit();
        }
        /// <summary>
        /// 根据标贯计算承载力和压缩模量函数
        /// </summary>
        public static void CalcuByNTest(List <StatisticNTest> _nTestStatisticList, string _soilType)
        {
            // 没有统计数据时退出
            if (_nTestStatisticList == null)
            {
                return;
            }

            // 初始化标贯/动探结构体
            ClearNTestStatisticResult();

            // 定义统计指标
            double ntestValue = Constants.NullNumber;

            ZkNTest.ntype ntestType = ZkNTest.ntype.N;

            // 提取数据库中的试验指标
            for (int i = 0; i < _nTestStatisticList.Count; i++)
            {
                if (_nTestStatisticList[i].Layer == LayerNumber)
                {
                    ntestValue = _nTestStatisticList[i].StandardValue == Constants.NullNumber ? _nTestStatisticList[i].Average : _nTestStatisticList[i].StandardValue;
                    ntestType  = _nTestStatisticList[i].Type;
                }
            }

            // 按规范和土质类型提取并计算填充指标
            if (CurrentStandard == "Hubei")
            {
                if (ntestValue != Constants.NullNumber)
                {
                    if (ntestType == ZkNTest.ntype.N)
                    {
                        StatisticResult.NTestParameter  = ntestType.ToString() + "(击)= " + ntestValue.ToString("0.0");
                        StatisticResult.FrictionByNTest = CalcuFrictionByNTest(CurrentStandard, _soilType, ntestValue) == Constants.NullNumber ? "/" : CalcuFrictionByNTest(CurrentStandard, _soilType, ntestValue).ToString("0.0");
                        StatisticResult.CohesionByNTest = CalcuCohesionByNTest(CurrentStandard, _soilType, ntestValue) == Constants.NullNumber ? "/" : CalcuCohesionByNTest(CurrentStandard, _soilType, ntestValue).ToString("0.0");
                    }
                    else
                    {
                        StatisticResult.NTestParameter  = "/";
                        StatisticResult.FrictionByNTest = "/";
                        StatisticResult.CohesionByNTest = "/";
                    }
                }
                else
                {
                    StatisticResult.NTestParameter  = "/";
                    StatisticResult.FrictionByNTest = "/";
                    StatisticResult.CohesionByNTest = "/";
                }
            }
        }
Example #5
0
 /// <summary>
 /// 构造函数,输入原始数据
 /// </summary>
 /// <param name="_layer">层号</param>
 /// <param name="_name">岩土名称</param>
 /// <param name="_type">统计类型</param>
 /// <param name="_datalist">标贯/动探数据列表</param>
 /// <param name="_startCount">起始统计样本数</param>
 public StatisticNTest(string _layer, string _name, ZkNTest.ntype _type, List <double> _datalist, int _startCount)
 {
     Layer                 = _layer;
     Name                  = _name;
     Type                  = _type;
     Count                 = Convert.ToInt32(Statistic.Count(_datalist));
     Max                   = Statistic.Max(_datalist);
     Min                   = Statistic.Min(_datalist);
     Average               = Statistic.Average(_datalist);
     StandardDeviation     = Statistic.StandardDeviation(_datalist, _startCount);
     VariableCoefficient   = Statistic.VariableCoefficient(_datalist, _startCount);
     CorrectionCoefficient = Statistic.CorrectionCoefficient(_datalist, 6, false);
     StandardValue         = Statistic.StandardValue(Average, CorrectionCoefficient);
 }
Example #6
0
 /// <summary>
 /// 构造函数,直接输入统计成果
 /// </summary>
 /// <param name="_layer">层号</param>
 /// <param name="_name">岩土名称</param>
 /// <param name="_type">统计类型</param>
 /// <param name="_count">统计数</param>
 /// <param name="_max">最大值</param>
 /// <param name="_min">最小值</param>
 /// <param name="_average">平均值</param>
 /// <param name="_standardDeviation">标准差</param>
 /// <param name="_variableCoefficient">变异系数</param>
 /// <param name="_correctionCoefficient">统计修正系数</param>
 /// <param name="_standardValue">标准值</param>
 public StatisticNTest(string _layer, string _name, ZkNTest.ntype _type, int _count, double _max, double _min, double _average, double _standardDeviation, double _variableCoefficient, double _correctionCoefficient, double _standardValue)
 {
     Layer                 = _layer;
     Name                  = _name;
     Type                  = _type;
     Count                 = _count;
     Max                   = _max;
     Min                   = _min;
     Average               = _average;
     StandardDeviation     = _standardDeviation;
     VariableCoefficient   = _variableCoefficient;
     CorrectionCoefficient = _correctionCoefficient;
     StandardValue         = _standardValue;
 }
Example #7
0
        /// <summary>
        /// 绘制标贯/动探函数
        /// </summary>
        /// <param name="_depth">标贯/动探深度</param>
        /// <param name="_maxDepth">最大钻探深度</param>
        /// <param name="_value">标贯/动探击数</param>
        /// <param name="_type">标贯/动探类型</param>
        private void DrawZkNTest(double _depth, double _maxDepth, double _value, ZkNTest.ntype _type)
        {
            // 提取绘图区域宽度和高度
            double w = this.ZkCanvas.Width;
            double h = this.ZkCanvas.Height;

            // 设置地面Y坐标
            double dmy = 50;

            // 计算试验Y坐标
            double y = dmy + (h - dmy) * (_depth / _maxDepth);

            // 计算试验标签
            string nTestLabel = _type.ToString() + "=" + _value.ToString();

            // 绘图
            this.ZkCanvas.DrawText(w / 2 + 30, y - 8, nTestLabel, 14, Brushes.Brown, true, true, true);
        }
Example #8
0
        /// <summary>
        /// 绘制钻孔柱状图函数
        /// </summary>
        public void DrawZk()
        {
            // 清空旧柱状图
            ZkCanvas.Children.Clear();

            // 提取绘图区域宽度和高度
            double canvasWidth  = this.ZkCanvas.Width;
            double canvasHeight = this.ZkCanvas.Height;

            // 绘制钻孔表头
            DrawZkLabel();

            // 绘制地面线和钻孔线
            DrawZkLine();

            // 绘制钻孔分层
            double maxDepth = dtLayer.Rows.Count == 0 ? 0 : (double)dtLayer.Rows[dtLayer.Rows.Count - 1][3];

            for (int i = 0; i < dtLayer.Rows.Count; i++)
            {
                double depth      = (double)dtLayer.Rows[i][3];
                double oldDepth   = i == 0 ? depth : (double)dtLayer.Rows[i - 1][3];
                string layerLabel = dtLayer.Rows[i][0].ToString() + " " + dtLayer.Rows[i][1].ToString();
                DrawZkLayer(depth, oldDepth, maxDepth, layerLabel);
            }

            // 绘制取样
            for (int i = 0; i < dtSample.Rows.Count; i++)
            {
                double depth       = (double)dtSample.Rows[i][1];
                bool   isDisturbed = (bool)dtSample.Rows[i][2];
                DrawZkSample(depth, maxDepth, isDisturbed);
            }

            // 绘制标贯
            for (int i = 0; i < dtNTest.Rows.Count; i++)
            {
                double        depth = (double)dtNTest.Rows[i][1];
                double        value = (double)dtNTest.Rows[i][2];
                ZkNTest.ntype type  = (ZkNTest.ntype)dtNTest.Rows[i][3];
                DrawZkNTest(depth, maxDepth, value, type);
            }
        }
Example #9
0
        /// <summary>
        /// 筛选统计数据
        /// </summary>
        /// <returns></returns>
        public static List <StatisticNTest> SelectStatisticData()
        {
            // 定义统计数据列表
            List <StatisticNTest> statisticList = new List <StatisticNTest>();

            // 定义分层分层编号列表、分层岩土名称列表、试验类型列表
            List <string> layerNumberList = ProjectDataBase.ReadLayerNumberList(Program.currentProject);
            List <string> layerNameList   = ProjectDataBase.ReadLayerNameList(Program.currentProject);

            ZkNTest.ntype[] typeList = new ZkNTest.ntype[] { ZkNTest.ntype.N, ZkNTest.ntype.N10, ZkNTest.ntype.N635, ZkNTest.ntype.N120 };

            // 在分层编号列表中循环,赋值统计数据列表
            for (int i = 0; i < layerNumberList.Count; i++)
            {
                // 在试验类型列表中循环
                for (int j = 0; j < typeList.Length; j++)
                {
                    // 检查当前的分层编号和试验类型的组合下在数据库中是否有内容
                    List <ZkNTest> nTestList = BoreholeDataBase.ReadLayerNTest(Program.currentProject, layerNumberList[i], typeList[j]);
                    if (nTestList.Count > 0)
                    {
                        // 提取符合条件的标贯/动探列表中的试验数据值
                        List <double> dataList = new List <double>();
                        foreach (ZkNTest nTest in nTestList)
                        {
                            dataList.Add(nTest.Value);
                        }

                        // 添加一组符合筛选条件的统计数据
                        StatisticNTest stateNTest = new StatisticNTest(layerNumberList[i], layerNameList[i], typeList[j], dataList, 6);
                        statisticList.Add(stateNTest);
                    }
                }
            }

            // 返回
            return(statisticList);
        }
Example #10
0
        /// <summary>
        /// 带5个参数的构造函数,用于编辑试验
        /// </summary>
        /// <param name="_lastDepthList">历史试验深度列表</param>
        /// <param name="_testNumber">试验编号</param>
        /// <param name="_depth">试验深度</param>
        /// <param name="_value">试验击数</param>
        /// <param name="_type">试验类型</param>
        public ZkNTestDetail(List <double> _lastDepthList, string _testNumber, double _depth, double _value, ZkNTest.ntype _type)
        {
            InitializeComponent();

            // 赋值新窗体标题
            this.Title = "编辑标贯/动探试验";

            // 赋值深度列表
            if (_lastDepthList != null)
            {
                LastDepthList = _lastDepthList;
            }

            // 定义试验编号、深度输入框的工具提示
            DefineToolTip();

            // 赋值
            this.NTestNumberTextBox.Text = _testNumber;
            this.NTestDepthTextBox.Text  = _depth.ToString();
            this.NTestValueTextBox.Text  = _value.ToString();
            if (_type == ZkNTest.ntype.N)
            {
                this.typeN.IsChecked = true;
            }
            else if (_type == ZkNTest.ntype.N10)
            {
                this.typeN10.IsChecked = true;
            }
            else if (_type == ZkNTest.ntype.N635)
            {
                this.typeN635.IsChecked = true;
            }
            else if (_type == ZkNTest.ntype.N120)
            {
                this.typeN120.IsChecked = true;
            }

            // 默认聚焦深度输入框
            this.NTestDepthTextBox.Focus();
        }
Example #11
0
 /// <summary>
 /// 编辑一个标贯动探
 /// </summary>
 /// <param name="_zkNumber">钻孔编号</param>
 /// <param name="_oldName">老试验编号</param>
 /// <param name="_name">新试验编号</param>
 /// <param name="_depth">新试验深度</param>
 /// <param name="_value">新试验击数</param>
 /// <param name="_type">新试验类型</param>
 public void EditNTest(string _zkNumber, string _oldName, string _name, double _depth, double _value, ZkNTest.ntype _type)
 {
     if (NTests != null)
     {
         for (int i = 0; i < NTests.Count; i++)
         {
             if (NTests[i].Name == _oldName)
             {
                 NTests[i] = new ZkNTest(_zkNumber, _name, _depth, _value, _type);
             }
         }
     }
 }
Example #12
0
 /// <summary>
 /// 添加一个标贯动探
 /// </summary>
 /// <param name="_zkNumber">钻孔编号</param>
 /// <param name="_name">试验编号</param>
 /// <param name="_depth">试验深度</param>
 /// <param name="_value">试验击数</param>
 /// <param name="_type">试验类型</param>
 public void AddNTest(string _zkNumber, string _name, double _depth, double _value, ZkNTest.ntype _type)
 {
     NTests.Add(new ZkNTest(_zkNumber, _name, _depth, _value, _type));
 }
Example #13
0
 /// <summary>
 /// 构造函数,输入层号、岩土名称、统计类型
 /// </summary>
 /// <param name="_layer">层号</param>
 /// <param name="_name">岩土名称</param>
 /// <param name="_type">统计类型</param>
 public StatisticNTest(string _layer, string _name, ZkNTest.ntype _type)
 {
     Layer = _layer;
     Name  = _name;
     Type  = _type;
 }
Example #14
0
        /// <summary>
        /// 查询某个分层的标贯/动探列表
        /// </summary>
        /// <param name="_projectName">项目名称</param>
        /// <param name="_layerNumber">分层编号</param>
        /// <param name="_type">试验类型</param>
        /// <returns></returns>
        public static List <ZkNTest> ReadLayerNTest(string _projectName, string _layerNumber, ZkNTest.ntype _type)
        {
            // 创建连接到设置信息数据库
            string sql = "Data Source=" + Program.ReadProgramPath() + "\\" + _projectName + ".gsygeo";

            using (SQLiteConnection conn = new SQLiteConnection(sql))
            {
                // 打开连接
                conn.Open();

                // 定义要返回的列表
                List <ZkNTest> ntestList = new List <ZkNTest>();

                // 读取项目分层列表
                List <string> layerList = ProjectDataBase.ReadLayerNumberList(_projectName);

                // 读取钻孔列表,在钻孔列表中循环
                List <string> zkList = ReadZkList(_projectName);
                for (int i = 0; i < zkList.Count; i++)
                {
                    // 读取该钻孔的标贯/动探列表和分层列表
                    List <ZkNTest> zkNtestList = ReadZkNTest(_projectName, zkList[i]);
                    List <ZkLayer> zkLayerList = ReadZkLayer(_projectName, zkList[i]);

                    // 在标贯/动探列表中循环
                    foreach (ZkNTest ntest in zkNtestList)
                    {
                        // 循环查找该标贯/动探所属的分层,查找试验类型,并将符合的数据添加到要返回的列表中
                        int layerIndex = -1;
                        for (int j = 0; j < zkLayerList.Count; j++)
                        {
                            if (ntest.Depth <= zkLayerList[j].Depth)
                            {
                                layerIndex = j;
                                break;
                            }
                        }
                        if (layerIndex != -1 && zkLayerList[layerIndex].Number == _layerNumber && ntest.Type == _type)
                        {
                            ntestList.Add(ntest);
                        }
                    }
                }

                // 返回赋值后的列表
                return(ntestList);
            }
        }
Example #15
0
        /// <summary>
        /// 带参数的构造函数,选取某钻孔时调用
        /// </summary>
        /// <param name="_selectedZk">所选钻孔</param>
        public BoreholeControl(Borehole _selectedZk)
        {
            InitializeComponent();

            // 设置当前为旧钻孔,设置删除按钮可用性
            this.DeleteZkButton.IsEnabled = true;
            isNewZk   = false;
            oldZkName = _selectedZk.Name;

            // 初始化DataTable
            InitialLayerListDataTable();
            InitialSampleListDataTable();
            InitialNTestListDataTable();

            // 定义各输入框的工具提示
            DefineToolTip();

            // 设置绑定
            this.LayerListDataGrid.DataContext  = dtLayer;
            this.SampleListDataGrid.DataContext = dtSample;
            this.NTestListDataGrid.DataContext  = dtNTest;

            // 赋值基本信息
            this.ZKNameTextBox.Text            = _selectedZk.Name;
            this.ZKAltitudeTextBox.Text        = _selectedZk.Altitude.ToString();
            this.AxisXTextBox.Text             = _selectedZk.X.ToString() != "-0.19880205" ? _selectedZk.X.ToString() : null;
            this.AxisYTextBox.Text             = _selectedZk.Y.ToString() != "-0.19880205" ? _selectedZk.Y.ToString() : null;
            this.InitialWaterLevelTextBox.Text = _selectedZk.InitialWaterLevel.ToString() != "-0.19880205" ? _selectedZk.InitialWaterLevel.ToString() : null;
            this.StableWaterLevelTextBox.Text  = _selectedZk.StableWaterLevel.ToString() != "-0.19880205" ? _selectedZk.StableWaterLevel.ToString() : null;

            // 赋值分层列表
            for (int i = 0; i < _selectedZk.Layers.Count; i++)
            {
                string number      = _selectedZk.Layers[i].Number;
                string name        = _selectedZk.Layers[i].Name;
                string geo         = _selectedZk.Layers[i].Geo;
                string description = _selectedZk.Layers[i].Description;
                double depth       = _selectedZk.Layers[i].Depth;
                AddRowToLayerListDataTable(number, name, geo, depth, description);
            }

            // 赋值取样列表
            for (int i = 0; i < _selectedZk.Samples.Count; i++)
            {
                string name        = _selectedZk.Samples[i].Name;
                double depth       = _selectedZk.Samples[i].Depth;
                bool   isDisturbed = _selectedZk.Samples[i].IsDisturbed;
                AddRowToSampleListDataTable(name, depth, isDisturbed);
            }

            // 赋值标贯/动探列表
            for (int i = 0; i < _selectedZk.NTests.Count; i++)
            {
                string        name  = _selectedZk.NTests[i].Name;
                double        depth = _selectedZk.NTests[i].Depth;
                double        value = _selectedZk.NTests[i].Value;
                ZkNTest.ntype type  = _selectedZk.NTests[i].Type;
                AddRowToNTestListDataTable(name, depth, value, type);
            }

            // 更新状态标签
            this.IsChangedTextBlock.Text = "";

            // 绘图
            DrawZk();
        }