示例#1
0
        /// <summary>
        /// 带参数的构造函数,选取某静力触探孔时调用
        /// </summary>
        /// <param name="_selectCPT">所选静力触探孔</param>
        public CPTControl(CPT _selectCPT)
        {
            InitializeComponent();

            // 设置当前为旧触探孔,设置删除按钮可用性
            this.DeleteJkButton.IsEnabled = true;
            isNewJk   = false;
            oldJkName = _selectCPT.Name;

            // 初始化DataTable
            InitialLayerListDataTable(_selectCPT.Layers);
            InitialPsListDataTable(_selectCPT.PsList);

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

            // 设置绑定
            this.LayerListDataGrid.DataContext = dtLayer;
            this.PsListDataGrid.DataContext    = dtPs;

            // 赋值基本信息
            this.JKNameTextBox.Text     = _selectCPT.Name;
            this.JKAltitudeTextBox.Text = _selectCPT.Altitude.ToString();
            this.AxisXTextBox.Text      = _selectCPT.X.ToString() != "-0.19880205" ? _selectCPT.ToString() : null;
            this.AxisYTextBox.Text      = _selectCPT.Y.ToString() != "-0.19880205" ? _selectCPT.ToString() : null;

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

            // 绘图
            DrawJk();
        }
示例#2
0
        /// <summary>
        /// 查询触探孔列表,输出为CPT类形式
        /// </summary>
        /// <param name="_projectName">项目名称</param>
        /// <returns></returns>
        public static List <CPT> ReadJkListAsClass(string _projectName)
        {
            // 创建连接到设置信息数据库
            string sql = "Data Source=" + Program.ReadProgramPath() + "\\" + _projectName + ".gsygeo";

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

                // 新建要返回的类列表
                List <CPT> jklist = new List <CPT>();

                // 循环读取钻孔数据
                sql = "select * from jkBasicInfo order by name";
                SQLiteDataReader reader = new SQLiteCommand(sql, conn).ExecuteReader();
                while (reader.Read())
                {
                    CPT jk = new CPT(reader["name"].ToString(), Convert.ToDouble(reader["altitude"]));
                    jk.X      = Convert.ToDouble(reader["xAxis"]);
                    jk.Y      = Convert.ToDouble(reader["yAxis"]);
                    jk.Layers = CPTDataBase.ReadJkLayer(_projectName, reader["name"].ToString());
                    jk.PsList = CPTDataBase.ReadJkPs(_projectName, reader["name"].ToString());

                    jklist.Add(jk);
                }

                // 返回
                return(jklist);
            }
        }
示例#3
0
        // 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);
                }
            }
        }
示例#4
0
文件: CAD.cs 项目: xeon-ye/GSYGeo
        /// <summary>
        /// 方法,绘制单个静力触探曲线图
        /// </summary>
        /// <param name="_drawIndex">曲线图编号,从0开始,用于绘制多个曲线图时计算其摆放位置</param>
        /// <param name="_projectName">工程名称</param>
        /// <param name="_companyName">公司名称</param>
        /// <param name="_jk">触探孔数据</param>
        /// <param name="_scaleList">比例尺列表</param>
        /// <param name="_style1">曲线图的文字样式</param>
        /// <param name="_style2">剖面图触探孔的文字样式</param>
        public void DrawJk(int _drawIndex, string _projectName, string[] _company, CPT _jk, List <double> _scaleList, DxfTextStyle _style1, DxfTextStyle _style2)
        {
            // 当触探孔内没有分层时退出
            if (_jk.Layers.Count == 0)
            {
                return;
            }

            // 计算图形横向偏移量,用于绘制多个柱状图时的空间摆放距离
            double xDis = _drawIndex * 195;

            // 绘制钻孔柱状图框架
            AddRectangle(0 + xDis, 0, 195 + xDis, 280);
            AddRectangle(10 + xDis, 20, 185 + xDis, 261);
            Model.Entities[Model.Entities.Count - 1].LineWeight = 30;

            double[,] pointKJ = new double[28, 4]
            {
                { 10, 254, 185, 254 }, { 10, 247, 57, 247 }, { 63, 247, 185, 247 }, { 10, 240, 185, 240 }, { 10, 220, 185, 220 },
                { 30, 261, 30, 240 }, { 57, 254, 57, 240 }, { 63, 254, 63, 240 }, { 90, 261, 90, 240 }, { 110, 261, 110, 240 },
                { 137, 254, 137, 240 }, { 157, 254, 157, 240 }, { 22, 240, 22, 20 }, { 30, 240, 30, 20 }, { 42, 240, 42, 20 },
                { 52, 240, 52, 20 }, { 62, 240, 62, 20 }, { 77, 240, 77, 20 },
                { 87, 220, 87, 222 }, { 97, 220, 97, 222 }, { 107, 220, 107, 222 }, { 117, 220, 117, 222 }, { 127, 220, 127, 222 },
                { 137, 220, 137, 222 }, { 147, 220, 147, 222 }, { 157, 220, 157, 222 }, { 167, 220, 167, 222 }, { 177, 220, 177, 222 }
            };
            for (int i = 0; i < 28; i++)
            {
                AddLine(pointKJ[i, 0] + xDis, pointKJ[i, 1], pointKJ[i, 2] + xDis, pointKJ[i, 3]);
            }

            string[] textKJ = new string[32]
            {
                "工程名称", "钻孔编号", "孔口高程", "勘察单位", "钻孔深度", "钻孔日期", "初见水位", "稳定水位", "地\n质\n年\n代", "及\n成\n因", "层\n \n序",
                "层\n底\n标\n高\n(m)", "层\n底\n深\n度\n(m)", "分\n层\n厚\n度\n(m)", "比 贯 入 阻 力 (MPa)", "1", "2", "3", "4", "5",
                "6", "7", "8", "9", "10", "静 力 触 探 曲 线 图", "制图:", "校核:", "审查:", "核定:", "X:", "Y:"
            };
            double[,] ptextKJ = new double[32, 3]
            {
                { 20, 257.5, 20 }, { 20, 250.5, 20 }, { 20, 243.5, 20 }, { 100, 257.5, 20 }, { 100, 250.5, 20 }, { 100, 243.5, 20 }, { 147, 250.5, 20 }, { 147, 243.5, 20 },
                { 13, 230, 6 }, { 19, 230, 6 }, { 26, 230, 8 }, { 36, 230, 12 }, { 47, 230, 10 }, { 57, 230, 10 }, { 131, 234.5, 108 }, { 87, 227, 2 },
                { 97, 227, 2 }, { 107, 227, 2 }, { 117, 227, 2 }, { 127, 227, 2 }, { 137, 227, 2 }, { 147, 227, 2 }, { 157, 227, 2 },
                { 167, 227, 2 }, { 177, 227, 2 }, { 97.5, 270, 175 }, { 32, 13, 10 }, { 70, 13, 10 }, { 106, 13, 10 }, { 144, 13, 10 }, { 65.5, 252, 5 }, { 65.5, 245, 5 }
            };
            for (int i = 0; i < textKJ.Length; i++)
            {
                DxfMText t = AddMText(textKJ[i], ptextKJ[i, 0] + xDis, ptextKJ[i, 1], ptextKJ[i, 2], 2.5, _style1);
                if (i == 11 || i == 12 || i == 13)
                {
                    t.LineSpacingFactor = 0.8;
                }
            }

            // 绘制表头信息
            AddMText(_projectName, 60 + xDis, 257.5, 60, 2.5, _style1);
            AddMText(_jk.Name, 43.5 + xDis, 250.5, 27, 2.5, _style1);
            AddMText(_jk.Altitude.ToString("0.00") + "      m", 43.5 + xDis, 243.5, 27, 2.5, _style1);
            AddMText(_company[0], 147.5 + xDis, 257.5, 75, 2.5, _style1);
            AddMText(_jk.Layers[_jk.Layers.Count - 1].Depth.ToString("0.00") + "   m", 123.5 + xDis, 250.5, 27, 2.5, _style1);

            // 计算比例尺
            double scale;

            if (_jk.Layers[_jk.Layers.Count - 1].Depth <= 20)
            {
                scale = 100;
            }
            else if (_jk.Layers[_jk.Layers.Count - 1].Depth <= 40)
            {
                scale = 200;
            }
            else if (_jk.Layers[_jk.Layers.Count - 1].Depth <= 100)
            {
                scale = 500;
            }
            else
            {
                scale = 1000;
            }
            AddMText("柱\n状\n图\n1:" + scale, 69.5 + xDis, 230, 12, 2.5, _style1);

            // 绘制分层
            for (int i = 0; i < _jk.Layers.Count; i++)
            {
                // 分层线及深度标签
                double drawY = 220 - _jk.Layers[i].Depth / scale * 1000;

                AddLine(10 + xDis, drawY, 77 + xDis, drawY);
                AddMText(_jk.Layers[i].Number, 26 + xDis, drawY + 3, 8, 2.5, _style1);
                AddMText((_jk.Altitude - _jk.Layers[i].Depth).ToString("0.00"), 36 + xDis, drawY + 3, 8, 2.5, _style1);
                AddMText(_jk.Layers[i].Depth.ToString("0.00"), 47 + xDis, drawY + 3, 8, 2.5, _style1);
                if (i > 0)
                {
                    AddMText((_jk.Layers[i].Depth - _jk.Layers[i - 1].Depth).ToString("0.00"), 57 + xDis, drawY + 3, 8, 2.5, _style1);
                }
                else
                {
                    AddMText(_jk.Layers[i].Depth.ToString("0.00"), 57 + xDis, drawY + 3, 8, 2.5, _style1);
                }

                // 地质填充
                double hatchY1 = drawY;
                double hatchY2;
                if (i > 0)
                {
                    hatchY2 = 220 - _jk.Layers[i - 1].Depth / scale * 1000;
                }
                else
                {
                    hatchY2 = 220;
                }

                try
                {
                    string s = _jk.Layers[i].Name;
                    if (s.Contains("黏"))
                    {
                        s = s.Replace("黏", "粘");
                    }
                    AddRecHatch(HatchTrans(s), 62 + xDis, hatchY1, 77 + xDis, hatchY2);
                }
                catch
                {
                    AddRecHatch("SOLID", 62 + xDis, hatchY1, 77 + xDis, hatchY2);
                }
            }

            // 绘制Ps曲线
            int n1 = _jk.PsList.Count;

            DxfVertex2D[] pointList = new DxfVertex2D[n1];
            for (int i = 0; i < n1; i++)
            {
                double drawY = 220 - Convert.ToDouble(i) / scale * 100;
                double drawX = 77 + _jk.PsList[i] * 10 + xDis;
                pointList[i] = new DxfVertex2D(drawX, drawY);
            }
            AddPline(pointList);

            // 绘制人员信息
            AddMText(_company[2], 44 + xDis, 13, 10, 2.5, _style1);
            AddMText(_company[4], 82 + xDis, 13, 10, 2.5, _style1);
            AddMText(_company[5], 118 + xDis, 13, 10, 2.5, _style1);
            AddMText(_company[6], 156 + xDis, 13, 10, 2.5, _style1);

            // 绘制剖面静力触探曲线图
            double distanceY = 280;

            for (int i = 0; i < _scaleList.Count; i++)
            {
                // 计算绘图起始位置
                distanceY = distanceY + 40 + _jk.Layers[_jk.Layers.Count - 1].Depth * 1000 / _scaleList[i];

                // 绘制钻孔编号、孔口高程、钻孔轴线
                AddLine(124 + xDis, distanceY + 10, 136 + xDis, distanceY + 10);
                AddMText(_jk.Name, 130 + xDis, distanceY + 13.5, 12, 4, _style2);
                AddMText(_jk.Altitude.ToString("0.00"), 130 + xDis, distanceY + 7, 12, 4, _style2);
                DxfPolyline2D l = AddLine(130 + xDis, distanceY, 130 + xDis, distanceY - _jk.Layers[_jk.Layers.Count - 1].Depth * 1000 / _scaleList[i]);
                l.LineWeight = 50;

                // 绘制分层
                for (int j = 0; j < _jk.Layers.Count; j++)
                {
                    double layerY    = distanceY - _jk.Layers[j].Depth * 1000 / _scaleList[i];
                    double layerYold = distanceY;
                    if (j > 0)
                    {
                        layerYold = distanceY - _jk.Layers[j - 1].Depth * 1000 / _scaleList[i];
                    }

                    if (j < _jk.Layers.Count - 1)
                    {
                        AddLine(123 + xDis, layerY, 130 + xDis, layerY);
                    }
                    DxfMText text = AddMText(_jk.Layers[j].Depth.ToString("0.00") + "(" + (_jk.Altitude - _jk.Layers[j].Depth).ToString("0.00") + ")", 121 + xDis, layerY + 1.5, 33, 3, _style2);
                    text.AttachmentPoint = AttachmentPoint.MiddleLeft;

                    try
                    {
                        string s = _jk.Layers[j].Name;
                        if (s.Contains("黏"))
                        {
                            s = s.Replace("黏", "粘");
                        }
                        AddRecHatch(HatchTrans(s), 123 + xDis, layerY, 130 + xDis, layerYold);
                    }
                    catch
                    {
                        AddRecHatch("SOLID", 123 + xDis, layerY, 130 + xDis, layerYold);
                    }
                }

                // 绘制Ps值曲线
                int           n2         = _jk.PsList.Count;
                DxfVertex2D[] pointList2 = new DxfVertex2D[n2];
                for (int j = 0; j < n2; j++)
                {
                    double drawY = distanceY - Convert.ToDouble(j) / _scaleList[i] * 100;
                    double drawX = 130 + _jk.PsList[j] * 10 + xDis;
                    pointList2[j] = new DxfVertex2D(drawX, drawY);
                }
                AddPline(pointList2);

                // 绘制Ps刻度
                double kdY = distanceY - _jk.Layers[_jk.Layers.Count - 1].Depth * 1000 / _scaleList[i] - 15;
                AddLine(130 + xDis, kdY, 180 + xDis, kdY);
                AddLine(130 + xDis, kdY, 130 + xDis, kdY + 8);
                for (int j = 1; j <= 5; j++)
                {
                    AddLine(130 + 10 * j + xDis, kdY, 130 + 10 * j + xDis, kdY + 2);
                    AddMText(j.ToString(), 130 + 10 * j + xDis, kdY + 7, 2, 3, _style2);
                }

                // 绘制比例尺标记
                double scY = distanceY - _jk.Layers[_jk.Layers.Count - 1].Depth * 1000 / _scaleList[i] / 2;

                DxfMText t = AddMText("1:" + _scaleList[i], 20 + xDis, scY, 80, 20, _style2);
                t.AttachmentPoint = AttachmentPoint.MiddleLeft;
            }
        }