Beispiel #1
0
        /// <summary>
        ///     根据钻孔点名查找钻孔点信息
        /// </summary>
        /// <param name="strDisplayName"></param>
        /// <returns></returns>
        private IPoint GetProspectingBoreholePointSelected(String strDisplayName)
        {
            try
            {
                var brehole = Borehole.FindOneByBoreholeNum(strDisplayName);

                IPoint pt = new PointClass();
                if (brehole != null)
                {
                    pt.X = brehole.CoordinateX;
                    pt.Y = brehole.CoordinateX;
                    pt.Z = brehole.CoordinateZ;
                }

                return(pt);
            }
            catch
            {
                return(null);
            }
        }
Beispiel #2
0
        private void btnReadMultTxt_Click(object sender, EventArgs e)
        {
            var ofd = new OpenFileDialog
            {
                RestoreDirectory = true,
                Filter           = @"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*",
                Multiselect      = true
            };

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            _errorMsg       = @"失败文件名:";
            pbCount.Maximum = ofd.FileNames.Length;
            pbCount.Value   = 0;
            lblTotal.Text   = ofd.FileNames.Length.ToString(CultureInfo.InvariantCulture);
            foreach (var fileName in ofd.FileNames)
            {
                var encoder = TxtFileEncoding.GetEncoding(fileName, Encoding.GetEncoding("GB2312"));

                var    sr = new StreamReader(fileName, encoder);
                string duqu;
                while ((duqu = sr.ReadLine()) != null)
                {
                    try
                    {
                        var str      = duqu.Split('|');
                        var borehole = Borehole.FindOneByBoreholeNum(str[0]) ??
                                       new Borehole {
                            BindingId = IDGenerator.NewBindingID()
                        };

                        borehole.BoreholeNumber   = str[0];
                        borehole.GroundElevation  = Convert.ToDouble(str[3]);
                        borehole.CoordinateX      = Convert.ToDouble(str[1].Split(',')[0]);
                        borehole.CoordinateY      = Convert.ToDouble(str[1].Split(',')[1]);
                        borehole.CoordinateZ      = 0;
                        borehole.CoalSeamsTexture = String.Empty;
                        // 创建钻孔岩性实体
                        var boreholeLithology = new BoreholeLithology
                        {
                            Borehole       = borehole,
                            Lithology      = Lithology.FindOneByCoal(),
                            FloorElevation = Convert.ToDouble(str[4]),
                            CoalSeamsName  = CoalSeams.FindAll().First().CoalSeamsName,
                            Thickness      = Convert.ToDouble(str[2]),
                            CoordinateX    = Convert.ToDouble(str[1].Split(',')[0]),
                            CoordinateY    = Convert.ToDouble(str[1].Split(',')[1]),
                            CoordinateZ    = 0
                        };

                        borehole.BoreholeLithologys = new[] { boreholeLithology };
                        DrawZuanKong(borehole, boreholeLithology);
                        borehole.Save();
                    }
                    catch (Exception)
                    {
                        lblError.Text =
                            (Convert.ToInt32(lblError.Text) + 1).ToString(CultureInfo.InvariantCulture);
                        lblSuccessed.Text =
                            (Convert.ToInt32(lblSuccessed.Text) - 1).ToString(CultureInfo.InvariantCulture);
                        _errorMsg         += fileName.Substring(fileName.LastIndexOf(@"\", StringComparison.Ordinal) + 1) + "\n";
                        btnDetails.Enabled = true;
                    }
                }
                lblSuccessed.Text =
                    (Convert.ToInt32(lblSuccessed.Text) + 1).ToString(CultureInfo.InvariantCulture);
                pbCount.Value++;
            }
            Alert.alert("导入成功!");
        }
Beispiel #3
0
        /// <summary>
        ///     提  交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            // 验证
            if (!Check())
            {
                DialogResult = DialogResult.None;
                return;
            }


            var borehole = Borehole.FindOneByBoreholeNum(txtBoreholeNumber.Text) ??
                           new Borehole {
                BindingId = IDGenerator.NewBindingID()
            };

            borehole.BoreholeNumber   = txtBoreholeNumber.Text.Trim();
            borehole.GroundElevation  = Convert.ToDouble(txtGroundElevation.Text.Trim());
            borehole.CoordinateX      = Convert.ToDouble(txtCoordinateX.Text.Trim());
            borehole.CoordinateY      = Convert.ToDouble(txtCoordinateY.Text.Trim());
            borehole.CoordinateZ      = Convert.ToDouble(txtCoordinateZ.Text.Trim());
            borehole.CoalSeamsTexture = string.Empty;

            var boreholeLithologys = new List <BoreholeLithology>();

            for (var i = 0; i < gvCoalSeamsTexture.RowCount; i++)
            {
                // 最后一行为空行时,跳出循环
                if (i == gvCoalSeamsTexture.RowCount - 1)
                {
                    break;
                }
                // 创建钻孔岩性实体
                var boreholeLithology = new BoreholeLithology
                {
                    FloorElevation = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[1].Value),
                    Thickness      = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[2].Value),
                    CoalSeamsName  = gvCoalSeamsTexture.Rows[i].Cells[3].Value.ToString(),
                    CoordinateX    = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[4].Value),
                    CoordinateY    = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[5].Value),
                    CoordinateZ    = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[6].Value),
                    Lithology      = Lithology.FindOneByLithologyName(gvCoalSeamsTexture.Rows[i].Cells[0].Value.ToString()),
                    Borehole       = borehole
                };
                boreholeLithologys.Add(boreholeLithology);
            }
            borehole.BoreholeLithologys = boreholeLithologys;
            borehole.Save();

            //    var dlgResult = MessageBox.Show(@"是:见煤钻孔,否:未见煤钻孔,取消:不绘制钻孔", @"绘制钻孔",
            //        MessageBoxButtons.YesNoCancel);

            //    if (dlgResult == DialogResult.Yes)
            //    {
            //        DrawZuanKong(borehole, boreholeLithologyEntityList[0]);
            //    }
            //    else if (dlgResult == DialogResult.No)
            //    {
            //        DrawZuanKong(borehole);
            //    }
            //    else if (dlgResult == DialogResult.Cancel)
            //    {
            //    }
            //}
            //else
            //{
            //1.获得当前编辑图层
            var          drawspecial     = new DrawSpecialCommon();
            const string sLayerAliasName = LayerNames.DEFALUT_BOREHOLE; //“默认_钻孔”图层
            var          featureLayer    = drawspecial.GetFeatureLayerByName(sLayerAliasName);

            if (featureLayer == null)
            {
                MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法删钻孔图元。");
                return;
            }

            if (borehole.BoreholeId != 0)
            {
                DataEditCommon.DeleteFeatureByBId(featureLayer, borehole.BindingId);
            }

            var dlgResult = MessageBox.Show(@"是:见煤钻孔,否:未见煤钻孔,取消:不绘制钻孔",
                                            @"绘制钻孔", MessageBoxButtons.YesNoCancel);

            switch (dlgResult)
            {
            case DialogResult.Yes:
                DrawZuanKong(borehole, borehole.BoreholeLithologys.First());
                break;

            case DialogResult.No:
                DrawZuanKong(borehole);
                break;

            case DialogResult.Cancel:
                break;
            }
            DialogResult = DialogResult.OK;
        }