// 查看/添加常规土工试验数据函数 private void ShowAddRoutineSoilTestData() { this.ContectGrid.Children.Clear(); // 实例化一个RoutineSoilTest类列表,并读取数据库信息赋值给此实例 List <RoutineSoilTest> rsts = RoutineSoilTestDataBase.ReadAllData(Program.currentProject); // 实例化RoutineSoilTestControl用户控件,并赋值 RoutineSoilTestControl rstc = new RoutineSoilTestControl(rsts); this.ContectGrid.Children.Add(rstc); }
// 单击菜单"项目"-"打开项目" private void OpenProjectMenu_Click(object sender, RoutedEventArgs e) { // 隐藏项目基本信息窗口 foreach (TreeViewItem item in this.ProjectTreeView.Items) { item.IsSelected = false; } // 重置窗口 SetProgramText(); // 打开 ProjectList projectList = new ProjectList(); projectList.ShowDialog(); if (projectList.DialogResult == true) { MenuIsEnable(true); SetProgramText(Program.currentProject); // 赋值钻孔列表 bind.ReSetZkItem(Program.currentProject); // 赋值原位测试-静力触探列表 if (CPTDataBase.ReadJkList(Program.currentProject).Count > 0) { bind.AddItemToSecondTree(2, "静力触探"); } bind.ReSetJkItem(Program.currentProject); // 赋值室内试验-土工常规 if (RoutineSoilTestDataBase.ReadAllData(Program.currentProject).Count > 0) { bind.AddItemToSecondTree(3, "土工常规"); bind.TreeItem[3].IsExpanded = true; } // 赋值室内试验-颗粒分析 if (GrainAnalysisTestDataBase.ReadAllData(Program.currentProject).Count > 0) { bind.AddItemToSecondTree(3, "颗粒分析"); bind.TreeItem[3].IsExpanded = true; } } }
// TreeView选择节点变化时激活不同的内容控件 private void ProjectTreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { // 读取选中节点 TreeViewItem selectedItem = (TreeViewItem)e.NewValue; // 根据选中状况清空窗口中的控件 if (selectedItem == null) { this.ContectGrid.Children.Clear(); return; } if (selectedItem.Header.ToString() != "基本信息" && selectedItem.Parent != null) { this.ContectGrid.Children.Clear(); } // 选中一级节点时 // 选中"基本信息" if (selectedItem.Header.ToString() == "基本信息") { ProjectBasicInfo prjb = new ProjectBasicInfo(); this.ContectGrid.Children.Add(prjb); } // 选中二级、三级节点时 if (selectedItem.Parent != null) { // 读取父节点 TreeViewItem parentItem = (TreeViewItem)selectedItem.Parent; // 选中"钻孔"子节点 if (parentItem.Header.ToString() == "钻孔") { // 读取当前所选钻孔名称 string prj = Program.currentProject; string zkName = selectedItem.Header.ToString(); // 实例化一个Borehole类,并将当前所选钻孔的数据库信息赋值给此实例 Borehole bh = new Borehole(zkName, BoreholeDataBase.ReadAltitude(prj, zkName)); bh.X = BoreholeDataBase.ReadXAxis(prj, zkName); bh.Y = BoreholeDataBase.ReadYAxis(prj, zkName); bh.InitialWaterLevel = BoreholeDataBase.ReadInitialWaterLevel(prj, zkName); bh.StableWaterLevel = BoreholeDataBase.ReadStableWaterLevel(prj, zkName); bh.Layers = BoreholeDataBase.ReadZkLayer(prj, zkName); bh.Samples = BoreholeDataBase.ReadZkSample(prj, zkName); bh.NTests = BoreholeDataBase.ReadZkNTest(prj, zkName); // 实例化BoreholeControl用户控件,并赋值 BoreholeControl bhc = new BoreholeControl(bh); this.ContectGrid.Children.Add(bhc); } // 选取"原位测试"-"静力触探"子节点 if (parentItem.Header.ToString() == "静力触探") { // 读取当前所选触探孔名称 string prj = Program.currentProject; string jkName = selectedItem.Header.ToString(); // 实例化一个CPT类,并将当前所选触探孔的数据库信息赋值给此实例 CPT cpt = new CPT(jkName, CPTDataBase.ReadAltitude(prj, jkName)); cpt.X = CPTDataBase.ReadXAxis(prj, jkName); cpt.Y = CPTDataBase.ReadYAxis(prj, jkName); cpt.Layers = CPTDataBase.ReadJkLayer(prj, jkName); cpt.PsList = CPTDataBase.ReadJkPs(prj, jkName); // 实例化CPTControl用户控件,并赋值 CPTControl cptc = new CPTControl(cpt); this.ContectGrid.Children.Add(cptc); } // 选取"室内试验"-"土工常规"子节点 if (selectedItem.Header.ToString() == "土工常规") { // 实例化一个RoutineSoilTest类列表,并读取数据库信息赋值给此实例 List <RoutineSoilTest> rsts = RoutineSoilTestDataBase.ReadAllData(Program.currentProject); // 实例化RoutineSoilTestControl用户控件,并赋值 RoutineSoilTestControl rstc = new RoutineSoilTestControl(rsts); this.ContectGrid.Children.Add(rstc); } // 选取"室内试验"-"颗粒分析"子节点 if (selectedItem.Header.ToString() == "颗粒分析") { // 实例化一个RoutineSoilTest类列表,并读取数据库信息赋值给此实例 List <GrainAnalysisTest> gats = GrainAnalysisTestDataBase.ReadAllData(Program.currentProject); // 实例化RoutineSoilTestControl用户控件,并赋值 GrainAnalysisTestControl gatc = new GrainAnalysisTestControl(gats); this.ContectGrid.Children.Add(gatc); } } }
/// <summary> /// 筛选统计数据 /// </summary> /// <returns></returns> public static StatisticWordLoad SelectStatisticData() { // 定义统计数据列表 StatisticWordLoad statisticData = new StatisticWordLoad(); // 读取钻孔列表 List <Borehole> zkList = BoreholeDataBase.ReadZkListAsClass(Program.currentProject); // 统计钻孔数量 int countZk = zkList.Count; double countZkDepth = 0; int countUndisturbedSample = 0, countDisturbedSample = 0; int countNTestStandard = 0, countNTestN10 = 0, countNTestN635 = 0, countNTestN120 = 0; foreach (Borehole zk in zkList) { // 统计钻孔进尺 countZkDepth += zk.Layers[zk.Layers.Count - 1].Depth; // 统计原状样、扰动样数量 foreach (ZkSample sample in zk.Samples) { if (sample.IsDisturbed) { countDisturbedSample++; } else { countUndisturbedSample++; } } // 统计标贯/动探数量 foreach (ZkNTest ntest in zk.NTests) { if (ntest.Type == ZkNTest.ntype.N) { countNTestStandard++; } else if (ntest.Type == ZkNTest.ntype.N10) { countNTestN10++; } else if (ntest.Type == ZkNTest.ntype.N635) { countNTestN635++; } else { countNTestN120++; } } } // 读取土工常规试验列表 List <RoutineSoilTest> rstList = RoutineSoilTestDataBase.ReadAllData(Program.currentProject); // 统计常规试验数量、室内渗透试验数量 int countRST = 0, countPermeability = 0; double n = -0.19880205; foreach (RoutineSoilTest rst in rstList) { // 统计室内渗透试验 if (rst.permeability != n) { countPermeability++; } //统计土工常规试验 if (rst.waterLevel != n || rst.voidRatio != n || rst.specificGravity != n || rst.saturation != n || rst.plasticLimit != n || rst.plasticIndex != n || rst.modulus != n || rst.liquidLimit != n || rst.liquidityIndex != n || rst.frictionAngle != n || rst.density != n || rst.compressibility != n || rst.cohesion != n) { countRST++; } } // 读取颗粒分析试验列表 List <GrainAnalysisTest> gatList = GrainAnalysisTestDataBase.ReadAllData(Program.currentProject); // 统计颗分试验数量 int countGAT = gatList.Count; // 读取静力触探列表 List <CPT> jkList = CPTDataBase.ReadJkListAsClass(Program.currentProject); // 统计钻孔数量 int countJk = jkList.Count; // 统计静力触探进尺 double countJkDepth = 0; foreach (CPT jk in jkList) { countJkDepth += jk.Layers[jk.Layers.Count - 1].Depth; } // 赋值给统计列表 statisticData.CountBorehole = countZk; statisticData.CountBoreholePacking = countZk; statisticData.Borehole = countZkDepth; statisticData.BoreholePacking = countZkDepth; statisticData.UndisturbedSample = countUndisturbedSample; statisticData.DisturbedSample = countDisturbedSample; statisticData.NTestStandard = countNTestStandard; statisticData.NTestN10 = countNTestN10; statisticData.NTestN635 = countNTestN635; statisticData.NTestN120 = countNTestN120; statisticData.CountCPT = countJk; statisticData.CPT = countJkDepth; statisticData.RST = countRST; statisticData.Permeability = countPermeability; statisticData.GAT = countGAT; // 返回 return(statisticData); }