Example #1
0
        /// <summary>
        ///     删除瓦斯信息
        /// </summary>
        /// <params name="bid">绑定ID</params>
        /// <params name="mc">煤层</params>
        private void DelGasGushQuantityPt(string bid, string mc)
        {
            var pLayer        = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_HCGZMWSYCLD);
            var pFeatureLayer = (IFeatureLayer)pLayer;

            DataEditCommon.DeleteFeatureByWhereClause(pFeatureLayer, "bid='" + bid + "' and mc='" + mc + "'");
        }
Example #2
0
        /// <summary>
        ///     删除瓦斯信息
        /// </summary>
        /// <params name="bid">绑定ID</params>
        private void DelGasGushQuantityPt(string[] bid)
        {
            var pLayer        = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_WSHLD);
            var pFeatureLayer = (IFeatureLayer)pLayer;
            var strsql        = "";

            for (var i = 0; i < bid.Length; i++)
            {
                if (i == 0)
                {
                    strsql = "bid='" + bid[i] + "'";
                }
                else
                {
                    strsql += " or bid='" + bid[i] + "' ";
                }
            }
            DataEditCommon.DeleteFeatureByWhereClause(pFeatureLayer, strsql);
        }
Example #3
0
        /// <summary>
        ///     修改井筒
        /// </summary>
        /// <param name="pitshaftEntity"></param>
        private void ModifyJingTong(Pitshaft pitshaftEntity)
        {
            //1.获得当前编辑图层
            var drawspecial     = new DrawSpecialCommon();
            var sLayerAliasName = LayerNames.DEFALUT_JINGTONG; //“默认_井筒”图层
            var featureLayer    = drawspecial.GetFeatureLayerByName(sLayerAliasName);

            if (featureLayer == null)
            {
                MessageBox.Show("未找到" + sLayerAliasName + "图层,无法修改井筒图元。");
                return;
            }

            //2.删除原来图元,重新绘制新图元
            var bIsDeleteOldFeature = DataEditCommon.DeleteFeatureByWhereClause(featureLayer,
                                                                                "BID='" + pitshaftEntity.BindingId + "'");
            //if (bIsDeleteOldFeature)
            {
                //绘制井筒
                DrawJingTong(pitshaftEntity);
            }
        }
Example #4
0
        /// <summary>
        ///     回采删除信息
        /// </summary>
        /// <param name="hd1"></param>
        /// <param name="hd2"></param>
        /// <param name="qy"></param>
        private void DelHChuanjc(int hd1, int hd2)
        {
            // 获取已选择明细行的索引
            var iSelIdxsArr = GetSelIdxs();
            var bid         = "";
            //ILayer pLayer = GIS.Common.DataEditCommon.GetLayerByName(GIS.Common.DataEditCommon.g_pMap, GIS.LayerNames.DEFALUT_HENGCHUAN);
            //if (pLayer == null)
            //{
            //    MessageBox.Show("未发现横川图层!");
            //    return;
            //}
            //IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer;
            var str = "";

            for (var i = 0; i < iSelIdxsArr.Length; i++)
            {
                bid = fpDayReportHChuan.Sheets[0].Cells[iSelIdxsArr[i], _BIDIndex].Text.Trim();
                if (bid != "")
                {
                    if (i == 0)
                    {
                        str = "bid='" + bid + "'";
                    }
                    else
                    {
                        str += " or bid='" + bid + "'";
                    }
                }
            }
            DataEditCommon.DeleteFeatureByWhereClause(Global.hdfdfulllyr, str);
            DataEditCommon.DeleteFeatureByWhereClause(Global.hdfdlyr, str);
            //if (DataEditCommon.DeleteFeatureByWhereClause(pFeatureLayer, str))
            //{
            DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
            //}
        }
Example #5
0
        /// <summary>
        /// 生成等值线
        /// </summary>
        /// <params name="targetworkspace"></params>
        /// <params name="nameOftargetFeatureClass"></params>
        /// <params name="sLayerAliasName"></params>
        private bool CreateContours(IWorkspace targetworkspace, string nameOftargetFeatureClass,
                                    string sLayerAliasName, string extent, ref string failInfo)
        {
            double douElevation;

            //设置一个最小值
            progressBarControl1.Properties.Minimum = 0;
            //设置一个最大值
            progressBarControl1.Properties.Maximum = 6;
            //设置步长,即每次增加的数
            progressBarControl1.Properties.Step = 1;
            //设置进度条的样式
            progressBarControl1.Properties.ProgressViewStyle = ProgressViewStyle.Solid;
            progressBarControl1.Position = 0;

            try
            {
                Geoprocessor GP = new Geoprocessor();

                if (withIn(m_strDataFilePath) == false)
                {
                    return(false);
                }
                if (TB_Interval.Text == "")
                {
                    MessageBox.Show("请输入正确的等高距!", "提示!");
                    return(false);
                }
                if (double.TryParse(TB_Interval.Text.Trim(), out douElevation))
                {
                }
                else
                {
                    TB_Interval.Text = null;
                    MessageBox.Show("请输入正确的等高距!", "提示!");
                    return(false);
                }

                string featurOut = m_MakeContoursFolder + "\\Cont.shp";
                int    k         = 0;
                while (File.Exists(featurOut))
                {
                    k++;
                    featurOut = m_MakeContoursFolder + "\\Cont" + k.ToString() + ".shp";
                }
                int countCont = Directory.GetFiles(m_MakeContoursFolder, "Cont*").Length;
                if (countCont > 0)
                {
                    featurOut = m_MakeContoursFolder + "\\Cont" + countCont.ToString() + ".shp";
                }
                if (DrawContours.ConvertASCIIDescretePoint2FeatureClass(GP, m_strDataFilePath, featurOut) == false)
                {
                    return(false);
                }
                //执行步长
                this.progressBarControl1.PerformStep();

                string ContourRaster = m_MakeContoursFolder + "\\Spline";
                //string ContourRaster = m_MakeContoursFolder + "\\" + nameOftargetFeatureClass + "_Render";
                if (extent != "")//右上左下  xmax  ymax  xmin  ymin
                {
                    GP.SetEnvironmentValue("Extent", extent);
                }
                bool   suc = false;
                string sRasterLayerAliasName = sLayerAliasName + "渲染图";
                ILayer rsLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, sRasterLayerAliasName);
                if (rsLayer != null)
                {
                    DataEditCommon.g_pMap.DeleteLayer(rsLayer);
                }
                if (Directory.Exists(ContourRaster))
                {
                    try
                    {
                        Directory.Delete(ContourRaster, true);
                    }
                    catch
                    {
                        k = 1;
                        while (Directory.Exists(ContourRaster))
                        {
                            ContourRaster = m_MakeContoursFolder + "\\Spline" + k.ToString();
                            k++;
                        }
                    }
                }
                switch (CB_InterpolationMethod.Text)
                {
                case "样条函数插值法":
                    suc = DrawContours.Interpolate2RasterSpline(GP, featurOut, ContourRaster, CB_SplineType.Text);
                    break;

                case "自然邻域插值法":
                    suc = DrawContours.Interpolate2RasterNN(GP, featurOut, ContourRaster);
                    break;

                case "克里格插值法":
                    suc = DrawContours.Interpolate2RasterKriging(GP, featurOut, ContourRaster,
                                                                 CB_semiVariogramProp.Text, CB_searchRadiusProp.Text);
                    break;

                case "反距离权重插值法":
                    suc = DrawContours.Interpolate2RasterIDW(GP, featurOut, ContourRaster);
                    break;

                case "趋势面插值法":
                    suc = DrawContours.TrendToRaster(GP, featurOut, ContourRaster);
                    break;
                }
                if (suc == false)
                {
                    return(false);
                }
                this.progressBarControl1.PerformStep();
                GP = new Geoprocessor();
                string R2Contour = m_MakeContoursFolder + "\\Contour.shp";
                k = 1;
                while (File.Exists(R2Contour))
                {
                    R2Contour = m_MakeContoursFolder + "\\Contour" + k.ToString() + ".shp";
                    k++;
                }
                int countContour = Directory.GetFiles(m_MakeContoursFolder, "Contour*").Length;
                if (countContour > 0)
                {
                    R2Contour = m_MakeContoursFolder + "\\Contour" + countContour.ToString() + ".shp";
                }

                if (DrawContours.SplineRasterToContour(GP, ContourRaster, R2Contour, douElevation) == false)
                {
                    return(false);
                }
                this.progressBarControl1.PerformStep();

                string EvEContour = m_MakeContoursFolder + "\\EvEContour.shp";
                k = 1;
                while (File.Exists(EvEContour))
                {
                    EvEContour = m_MakeContoursFolder + "\\EvEContour" + k.ToString() + ".shp";
                    k++;
                }
                int countEvEContour = Directory.GetFiles(m_MakeContoursFolder, "EvEContour*").Length;
                if (countEvEContour > 0)
                {
                    EvEContour = m_MakeContoursFolder + "\\EvEContour" + countEvEContour.ToString() + ".shp";
                }
                if (DrawContours.FeaturesTo3D(GP, R2Contour, EvEContour) == false)
                {
                    return(false);
                }
                this.progressBarControl1.PerformStep();

                //获得等值线Shp文件所在的工作空间
                IWorkspaceFactory workspaceFactory = new ShapefileWorkspaceFactory();
                IWorkspace        sourceworkspace  = workspaceFactory.OpenFromFile(m_MakeContoursFolder, 0);
                //裁切
                IPolygon bianjie = GetPolygon();

                //导入等值线Shp文件到数据库中
                DrawSpecialCommon drawspecial = new DrawSpecialCommon();
                string            nameOfsourceFeatureClass = EvEContour.Substring(EvEContour.LastIndexOf("\\") + 1);
                nameOfsourceFeatureClass = nameOfsourceFeatureClass.Substring(0, nameOfsourceFeatureClass.LastIndexOf("."));
                bool          Import = false;
                List <ziduan> list   = new List <ziduan>
                {
                    new ziduan("BID", ""),
                    new ziduan("mingcheng", sLayerAliasName),
                    new ziduan("mcid", "0"),
                    new ziduan("date", DateTime.Now.ToString()),
                    new ziduan("type", CB_InterpolationMethod.Text)
                };
                list.Add(new ziduan("BID", ""));
                list.Add(new ziduan("mingcheng", sLayerAliasName));
                list.Add(new ziduan("mcid", "0"));
                list.Add(new ziduan("date", DateTime.Now.ToString()));
                list.Add(new ziduan("type", CB_InterpolationMethod.Text));
                IFeatureLayer pFeatureLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, EditLayerName) as IFeatureLayer;
                string        WhereClause   = "mcid='" + "0" + "'";

                DataEditCommon.DeleteFeatureByWhereClause(pFeatureLayer, WhereClause);
                if (radioBtnKJ.Checked && bianjie != null)
                {
                    Import = IntersectAll(DataEditCommon.GetFeatureClassByName(sourceworkspace, nameOfsourceFeatureClass), bianjie, list);
                }
                else
                {
                    Import = drawspecial.ShapeImportGDB(sourceworkspace, targetworkspace, nameOfsourceFeatureClass, nameOftargetFeatureClass, list);
                }
                this.progressBarControl1.PerformStep();

                if (Import == false)
                {
                    MessageBox.Show(sLayerAliasName + "导入数据库失败!");
                    DataEditCommon.g_axTocControl.Update();
                    DataEditCommon.g_pAxMapControl.Refresh();
                    failInfo = sLayerAliasName;
                    return(false);
                }

                //添加相应的渲染图
                IRasterLayer newRasterLayer = new RasterLayerClass();
                newRasterLayer.CreateFromFilePath(ContourRaster);
                newRasterLayer = IntersectRaster(newRasterLayer, bianjie);
                //newRasterLayer.CreateFromDataset(newRasterDs);
                newRasterLayer.Name = sRasterLayerAliasName;
                UsingRasterStretchColorRampRender(newRasterLayer);
                //groupLayer.Add(newRasterLayer as ILayer);
                int indexPosition = DataEditCommon.g_pAxMapControl.LayerCount;//GroupLayer序号

                //判断MapControl中是否存在该图层
                ILayer mLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, sRasterLayerAliasName);
                if (mLayer != null)
                {
                    DataEditCommon.g_pMyMapCtrl.Map.DeleteLayer(mLayer);
                    indexPosition--;
                }
                DataEditCommon.g_pAxMapControl.AddLayer(newRasterLayer as ILayer, indexPosition);//添加到最下面
                DataEditCommon.g_pAxMapControl.ActiveView.Extent = newRasterLayer.AreaOfInterest;
                DataEditCommon.g_axTocControl.Update();
                DataEditCommon.g_pAxMapControl.Refresh();
                this.progressBarControl1.PerformStep();

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }
Example #6
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!check())
            {
                return;
            }
            bindTunnelHChuanEntity();

            var bResult = false;

            int id;

            //检查导线点I与导线点II对应文本框中的数据是否有效

            //构造横穿点串
            var    pntcols = new List <IPoint>();
            IPoint pnt0    = new PointClass();

            pnt0.X = Convert.ToDouble(textBox_X1.Text);
            pnt0.Y = Convert.ToDouble(textBox_Y1.Text);
            pnt0.Z = Convert.ToDouble(textBox_Z1.Text);
            pntcols.Add(pnt0);

            IPoint pnt1 = new PointClass();

            pnt1.X = Convert.ToDouble(textBox_X2.Text);
            pnt1.Y = Convert.ToDouble(textBox_Y2.Text);
            pnt1.Z = Convert.ToDouble(textBox_Z2.Text);
            pntcols.Add(pnt1);
            var hcwid = Convert.ToDouble(txtWidth.Text);

            //添加
            if (Text == Const_GM.TUNNEL_HCHUAN_ADD)
            {
                id      = TunnelHChuanBLL.insertTunnelHChuan(tunnelHChuanEntity);
                bResult = id > -1;
                //添加横穿
                if (id > 0)
                {
                    frmStop.refreshAdd();
                    tunnelHChuanEntity.Id = id;
                    AddHChuanjc(tunnelHChuanEntity, pntcols, hcwid);
                    //bResult = DrawHengChuanPolygon(tunnelHChuanEntity);
                }
            }
            //修改
            if (Text == Const_GM.TUNNEL_HCHUAN_CHANGE)
            {
                if (tmpTunnelHChuanEntity.TunnelId1 != 0)
                {
                    tunnelHChuanEntity.TunnelId1 = tmpTunnelHChuanEntity.TunnelId1;
                }
                if (tmpTunnelHChuanEntity.TunnelId2 != 0)
                {
                    tunnelHChuanEntity.TunnelId2 = tmpTunnelHChuanEntity.TunnelId2;
                }

                bResult = TunnelHChuanBLL.updateTunnelHChuan(tunnelHChuanEntity);
                //修改回采进尺图上显示信息,更新工作面信息表
                if (bResult)
                {
                    frmStop.refreshUpdate();

                    DataEditCommon.DeleteFeatureByWhereClause(Global.hdfdfulllyr, "bid='" + tunnelHChuanEntity.Id + "'");
                    DataEditCommon.DeleteFeatureByWhereClause(Global.hdfdlyr, "bid='" + tunnelHChuanEntity.Id + "'");
                    AddHChuanjc(tunnelHChuanEntity, pntcols, hcwid);
                    //bResult = RedrawHengChuanPolygon(tunnelHChuanEntity);
                }
            }
            if (bResult)
            {
                //TODO:成功后事件
                DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
                Close();
            }
            //暂时保留,是否设置为横川类型。
            //TunnelInfoBLL.setTunnelAsHChuan(tunnelHChuanEntity);
        }
Example #7
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            //1煤2碳化灰岩3粉砂质泥岩4泥岩5泥质粉砂岩
            IWorkspaceEdit workspaceEdit = null;

            try
            {
                labelSC.Visible = true;
                Application.DoEvents();
                //去除无用空行
                for (int i = 0; i < dgrdvZhzzt.RowCount - 1; i++)
                {
                    if (this.dgrdvZhzzt.Rows[i].Cells[0].Value == null &&
                        this.dgrdvZhzzt.Rows[i].Cells[1].Value == null &&
                        this.dgrdvZhzzt.Rows[i].Cells[2].Value == null)
                    {
                        this.dgrdvZhzzt.Rows.RemoveAt(i);
                    }
                }
                //验证
                if (!check())
                {
                    this.DialogResult = DialogResult.None;
                    return;
                }
                this.DialogResult = DialogResult.OK;
                if (isadd)
                {
                    bid = IDGenerator.NewBindingID();
                }
                //实体赋值
                Histogram historam = new Histogram();
                historam.HistogramEntName = txtname.Text.Trim();
                historam.BLC    = Convert.ToDouble(txtBlc.Text.Trim());
                historam.ID     = bid;
                historam.listMY = new List <Historgramlist>();
                double height = 0;
                for (int i = 0; i < dgrdvZhzzt.RowCount - 1; i++)
                {
                    Historgramlist hisl = new Historgramlist();
                    hisl.BID   = bid;
                    hisl.Index = (i + 1);
                    //煤岩名称
                    DataGridViewTextBoxCell cell = dgrdvZhzzt.Rows[i].Cells[0] as DataGridViewTextBoxCell;
                    hisl.MYName  = cell.Value.ToString();
                    cell         = dgrdvZhzzt.Rows[i].Cells[1] as DataGridViewTextBoxCell;
                    hisl.Height  = Convert.ToDouble(cell.Value.ToString());
                    height      += hisl.Height;
                    hisl.SHeight = height;
                    hisl.ZZType  = ZZStrToCode(dgrdvZhzzt.Rows[i].Cells[2].Value.ToString());
                    cell         = dgrdvZhzzt.Rows[i].Cells[3] as DataGridViewTextBoxCell;
                    if (cell.Value != null)
                    {
                        hisl.Describe = cell.Value.ToString();
                    }
                    historam.listMY.Add(hisl);
                }
                if (!isadd)
                {
                    DataEditCommon.DeleteFeatureByWhereClause(frmZhzzt.pFeatureClass, "BID='" + bid + "'");
                }

                progressBar1.Maximum = historam.listMY.Count * 6 + 9;
                progressBar1.Value   = 0;


                IFeatureClass pFeatureClass = frmZhzzt.pFeatureClass;
                progressBar1.Value += 1;
                Application.DoEvents();
                IDataset   dataset   = (IDataset)pFeatureClass;
                IWorkspace workspace = dataset.Workspace;
                workspaceEdit = workspace as IWorkspaceEdit;

                workspaceEdit.StartEditing(true);
                workspaceEdit.StartEditOperation();


                ISegmentCollection pSegmentCollection = new PolygonClass();

                double xbasic = 100;
                double xmin = xbasic, ymin = 99.5, xmax = 110, ymax = 100;

                List <IGeometry> listgeo   = new List <IGeometry>();
                IEnvelope        pEnvelope = new EnvelopeClass();
                pEnvelope.PutCoords(xmin, ymin, xmax, ymax);
                List <ziduan> listzd = new List <ziduan>();
                listzd.Add(new ziduan("textstr", historam.HistogramEntName));
                listzd.Add(new ziduan("zztype", "6"));
                listzd.Add(new ziduan("strtype", "1"));
                listzd.Add(new ziduan("bilici", historam.BLC.ToString()));
                listzd.Add(new ziduan("BID", historam.ID));
                pSegmentCollection.SetRectangle(pEnvelope);
                DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd);
                listgeo.Add(pSegmentCollection as IGeometry);
                progressBar1.Value += 1;
                Application.DoEvents();

                pEnvelope = new EnvelopeClass();
                ymax      = ymin;
                ymin     -= 0.3;
                pEnvelope.PutCoords(xmin, ymin, xmax, ymax);
                listzd = new List <ziduan>();
                listzd.Add(new ziduan("textstr", "比例 1:" + historam.BLC.ToString() + "  单位:米"));
                listzd.Add(new ziduan("zztype", "6"));
                listzd.Add(new ziduan("strtype", "2"));
                listzd.Add(new ziduan("bilici", historam.BLC.ToString()));
                listzd.Add(new ziduan("BID", historam.ID));
                pSegmentCollection = new PolygonClass();
                pSegmentCollection.SetRectangle(pEnvelope);
                DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd);
                listgeo.Add(pSegmentCollection as IGeometry);
                progressBar1.Value += 1;
                Application.DoEvents();

                pEnvelope = new EnvelopeClass();
                ymax      = ymin;
                ymin     -= 0.3; xmax = xmin + 0.6;
                pEnvelope.PutCoords(xmin, ymin, xmax, ymax);
                listzd = new List <ziduan>();
                listzd.Add(new ziduan("textstr", "序号"));
                listzd.Add(new ziduan("zztype", "0"));
                listzd.Add(new ziduan("strtype", "0"));
                listzd.Add(new ziduan("BID", historam.ID));
                pSegmentCollection = new PolygonClass();
                pSegmentCollection.SetRectangle(pEnvelope);
                DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd);
                listgeo.Add(pSegmentCollection as IGeometry);
                progressBar1.Value += 1;
                Application.DoEvents();

                pEnvelope = new EnvelopeClass();
                xmin      = xmax; xmax += 1.8;
                pEnvelope.PutCoords(xmin, ymin, xmax, ymax);
                listzd = new List <ziduan>();
                listzd.Add(new ziduan("textstr", "煤 岩 名 称"));
                listzd.Add(new ziduan("zztype", "0"));
                listzd.Add(new ziduan("strtype", "0"));
                listzd.Add(new ziduan("BID", historam.ID));
                pSegmentCollection = new PolygonClass();
                pSegmentCollection.SetRectangle(pEnvelope);
                DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd);
                listgeo.Add(pSegmentCollection as IGeometry);
                progressBar1.Value += 1;
                Application.DoEvents();

                pEnvelope = new EnvelopeClass();
                xmin      = xmax; xmax += 0.8;
                pEnvelope.PutCoords(xmin, ymin, xmax, ymax);
                listzd = new List <ziduan>();
                listzd.Add(new ziduan("textstr", "真厚"));
                listzd.Add(new ziduan("zztype", "0"));
                listzd.Add(new ziduan("strtype", "0"));
                listzd.Add(new ziduan("BID", historam.ID));
                pSegmentCollection = new PolygonClass();
                pSegmentCollection.SetRectangle(pEnvelope);
                DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd);
                listgeo.Add(pSegmentCollection as IGeometry);
                progressBar1.Value += 1;
                Application.DoEvents();

                pEnvelope = new EnvelopeClass();
                xmin      = xmax; xmax += 1;
                pEnvelope.PutCoords(xmin, ymin, xmax, ymax);
                listzd = new List <ziduan>();
                listzd.Add(new ziduan("textstr", "累厚"));
                listzd.Add(new ziduan("zztype", "0"));
                listzd.Add(new ziduan("strtype", "0"));
                listzd.Add(new ziduan("BID", historam.ID));
                pSegmentCollection = new PolygonClass();
                pSegmentCollection.SetRectangle(pEnvelope);
                DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd);
                listgeo.Add(pSegmentCollection as IGeometry);
                progressBar1.Value += 1;
                Application.DoEvents();

                pEnvelope = new EnvelopeClass();
                xmin      = xmax; xmax += 1.2;
                pEnvelope.PutCoords(xmin, ymin, xmax, ymax);
                listzd = new List <ziduan>();
                listzd.Add(new ziduan("textstr", "柱  状"));
                listzd.Add(new ziduan("zztype", "0"));
                listzd.Add(new ziduan("strtype", "0"));
                listzd.Add(new ziduan("BID", historam.ID));
                pSegmentCollection = new PolygonClass();
                pSegmentCollection.SetRectangle(pEnvelope);
                DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd);
                listgeo.Add(pSegmentCollection as IGeometry);
                progressBar1.Value += 1;
                Application.DoEvents();

                pEnvelope = new EnvelopeClass();
                xmin      = xmax; xmax += 4.6;
                pEnvelope.PutCoords(xmin, ymin, xmax, ymax);
                listzd = new List <ziduan>();
                listzd.Add(new ziduan("textstr", "岩 性 描 述"));
                listzd.Add(new ziduan("zztype", "0"));
                listzd.Add(new ziduan("strtype", "0"));
                listzd.Add(new ziduan("BID", historam.ID));
                pSegmentCollection = new PolygonClass();
                pSegmentCollection.SetRectangle(pEnvelope);
                DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd);
                listgeo.Add(pSegmentCollection as IGeometry);
                progressBar1.Value += 1;
                Application.DoEvents();


                List <Historgramlist> list = historam.ListMY;
                for (int i = 0; i < list.Count; i++)
                {
                    xmin = xbasic;

                    double m_height = list[i].Height;
                    if (m_height < 0.3)
                    {
                        m_height = 0.3;
                    }
                    pEnvelope = new EnvelopeClass();
                    ymax      = ymin;
                    ymin     -= m_height; xmax = xmin + 0.6;
                    pEnvelope.PutCoords(xmin, ymin, xmax, ymax);
                    listzd = new List <ziduan>();
                    listzd.Add(new ziduan("textstr", list[i].Index.ToString()));
                    listzd.Add(new ziduan("xuhaoR", list[i].Index.ToString()));
                    listzd.Add(new ziduan("xuhaoC", "1"));
                    listzd.Add(new ziduan("zztype", "0"));
                    listzd.Add(new ziduan("strtype", "0"));
                    listzd.Add(new ziduan("BID", historam.ID));
                    pSegmentCollection = new PolygonClass();
                    pSegmentCollection.SetRectangle(pEnvelope);
                    DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd);
                    listgeo.Add(pSegmentCollection as IGeometry);
                    progressBar1.Value += 1;
                    Application.DoEvents();

                    pEnvelope = new EnvelopeClass();
                    xmin      = xmax; xmax += 1.8;
                    pEnvelope.PutCoords(xmin, ymin, xmax, ymax);
                    listzd = new List <ziduan>();
                    listzd.Add(new ziduan("textstr", list[i].MYName));
                    listzd.Add(new ziduan("zztype", "0"));
                    listzd.Add(new ziduan("xuhaoR", list[i].Index.ToString()));
                    listzd.Add(new ziduan("xuhaoC", "2"));
                    listzd.Add(new ziduan("strtype", "0"));
                    listzd.Add(new ziduan("BID", historam.ID));
                    pSegmentCollection = new PolygonClass();
                    pSegmentCollection.SetRectangle(pEnvelope);
                    DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd);
                    listgeo.Add(pSegmentCollection as IGeometry);
                    progressBar1.Value += 1;
                    Application.DoEvents();

                    pEnvelope = new EnvelopeClass();
                    xmin      = xmax; xmax += 0.8;
                    pEnvelope.PutCoords(xmin, ymin, xmax, ymax);
                    listzd = new List <ziduan>();
                    listzd.Add(new ziduan("textstr", list[i].Height.ToString()));
                    listzd.Add(new ziduan("zztype", "0"));
                    listzd.Add(new ziduan("xuhaoR", list[i].Index.ToString()));
                    listzd.Add(new ziduan("xuhaoC", "3"));
                    listzd.Add(new ziduan("strtype", "0"));
                    listzd.Add(new ziduan("BID", historam.ID));
                    pSegmentCollection = new PolygonClass();
                    pSegmentCollection.SetRectangle(pEnvelope);
                    DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd);
                    listgeo.Add(pSegmentCollection as IGeometry);
                    progressBar1.Value += 1;
                    Application.DoEvents();

                    pEnvelope = new EnvelopeClass();
                    xmin      = xmax; xmax += 1;
                    pEnvelope.PutCoords(xmin, ymin, xmax, ymax);
                    listzd = new List <ziduan>();
                    listzd.Add(new ziduan("textstr", Math.Round(list[i].SHeight, 1).ToString()));
                    listzd.Add(new ziduan("zztype", "0"));
                    listzd.Add(new ziduan("xuhaoR", list[i].Index.ToString()));
                    listzd.Add(new ziduan("xuhaoC", "4"));
                    listzd.Add(new ziduan("strtype", "0"));
                    listzd.Add(new ziduan("BID", historam.ID));
                    pSegmentCollection = new PolygonClass();
                    pSegmentCollection.SetRectangle(pEnvelope);
                    DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd);
                    listgeo.Add(pSegmentCollection as IGeometry);
                    progressBar1.Value += 1;
                    Application.DoEvents();

                    pEnvelope = new EnvelopeClass();
                    xmin      = xmax; xmax += 1.2;
                    pEnvelope.PutCoords(xmin, ymin, xmax, ymax);
                    listzd = new List <ziduan>();
                    listzd.Add(new ziduan("textstr", ""));
                    listzd.Add(new ziduan("zztype", list[i].ZZType));
                    listzd.Add(new ziduan("xuhaoR", list[i].Index.ToString()));
                    listzd.Add(new ziduan("xuhaoC", "5"));
                    listzd.Add(new ziduan("strtype", "0"));
                    listzd.Add(new ziduan("BID", historam.ID));
                    pSegmentCollection = new PolygonClass();
                    pSegmentCollection.SetRectangle(pEnvelope);
                    DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd);
                    listgeo.Add(pSegmentCollection as IGeometry);
                    progressBar1.Value += 1;
                    Application.DoEvents();

                    pEnvelope = new EnvelopeClass();
                    xmin      = xmax; xmax += 4.6;
                    pEnvelope.PutCoords(xmin, ymin, xmax, ymax);
                    listzd = new List <ziduan>();
                    string strms   = list[i].Describe;
                    string miaoshu = "";
                    if (strms != null && strms.Length > 0)
                    {
                        ASCIIEncoding ascii  = new ASCIIEncoding();
                        int           temLen = 0;
                        byte[]        s      = ascii.GetBytes(strms);

                        for (int j = 0; j < s.Length; j++)
                        {
                            if ((int)s[j] == 63)
                            {
                                temLen += 2;
                            }
                            else
                            {
                                temLen += 1;
                            }
                            miaoshu += strms[j];
                            if (temLen % 38 == 0 || (temLen + 1) % 38 == 0)
                            {
                                if (miaoshu.LastIndexOf('|') != miaoshu.Length - 1)
                                {
                                    miaoshu += "|";
                                }
                            }
                        }
                    }

                    listzd.Add(new ziduan("textstr", miaoshu));
                    listzd.Add(new ziduan("zztype", "0"));
                    listzd.Add(new ziduan("xuhaoR", list[i].Index.ToString()));
                    listzd.Add(new ziduan("xuhaoC", "6"));
                    listzd.Add(new ziduan("strtype", "3"));
                    listzd.Add(new ziduan("BID", historam.ID));
                    pSegmentCollection = new PolygonClass();
                    pSegmentCollection.SetRectangle(pEnvelope);
                    DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd);
                    listgeo.Add(pSegmentCollection as IGeometry);
                    progressBar1.Value += 1;
                    Application.DoEvents();
                }
                workspaceEdit.StopEditOperation();
                workspaceEdit.StopEditing(true);

                frmZhzzt.pGeometry = MyMapHelp.GetGeoFromGeos(listgeo);
                frmZhzzt.BID       = historam.ID;
                frmZhzzt.blc       = historam.BLC;

                DialogResult = DialogResult.OK;
                this.Close();
                if (!isadd)
                {
                    frmZhzzt.refresh();
                }
            }
            catch (Exception ex)
            {
                labelSC.Visible = false;
                MessageBox.Show(ex.Message);
                if (workspaceEdit != null)
                {
                    workspaceEdit.AbortEditOperation();
                    workspaceEdit.StopEditing(false);
                }
            }
        }
Example #8
0
        private void btnup_Click(object sender, EventArgs e)
        {
            //设置一个最小值
            progressBarControl1.Properties.Minimum = 0;

            //设置步长,即每次增加的数
            progressBarControl1.Properties.Step = 1;
            //设置进度条的样式
            progressBarControl1.Properties.ProgressViewStyle = DevExpress.XtraEditors.Controls.ProgressViewStyle.Solid;
            progressBarControl1.Position = 0;

            //设置一个最小值
            progressBarControl2.Properties.Minimum = 0;
            //设置一个最大值
            progressBarControl2.Properties.Maximum = listView1.CheckedItems.Count * 2;
            //设置步长,即每次增加的数
            progressBarControl2.Properties.Step = 1;
            //设置进度条的样式
            progressBarControl2.Properties.ProgressViewStyle = DevExpress.XtraEditors.Controls.ProgressViewStyle.Solid;
            progressBarControl2.Position = 0;

            ////设置一个最小值
            //progressBar2.Minimum = 0;
            ////设置一个最大值
            //progressBar2.Maximum = listView1.CheckedItems.Count * 2;
            ////设置步长,即每次增加的数
            //progressBar2.Step = 1;
            //progressBar2.Value = 0;


            IFeatureClass tFeatureClass = pFeatureLayer_QYYJY.FeatureClass;

            DataEditCommon.DeleteFeatureByWhereClause(tFeatureClass, "");
            IGeometryArray pgeoArrayHong = new GeometryArrayClass();
            IGeometryArray pgeoArrayHang = new GeometryArrayClass();

            for (int i = 0; i < listView1.CheckedItems.Count; i++)
            {
                string        layer         = listView1.CheckedItems[i].SubItems[1].Text.ToString();
                ILayer        pLayer        = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, layer);
                IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
                if (pFeatureLayer == null)
                {
                    continue;
                }
                IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
                //设置一个最大值
                progressBarControl1.Properties.Maximum = pFeatureClass.FeatureCount(null);
                IFeatureCursor pCursor  = pFeatureClass.Search(null, false);
                IFeature       pFeature = pCursor.NextFeature();

                while (pFeature != null)
                {
                    ITopologicalOperator pTopo = (ITopologicalOperator)pFeature.Shape;
                    IGeometry            pGeo  = pTopo.Buffer(hongse);
                    pgeoArrayHong.Add(pGeo);
                    IGeometry pGeoH = pTopo.Buffer(huangse);
                    if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                    {
                        pTopo = (ITopologicalOperator)pGeoH;
                        pGeoH = pTopo.Difference(pGeo);
                    }
                    pgeoArrayHang.Add(pGeoH);
                    pFeature = pCursor.NextFeature();
                    this.progressBarControl1.PerformStep();
                    Application.DoEvents();
                }
                List <ziduan> list = new List <ziduan>();
                list.Add(new ziduan("dengji", "1"));
                list.Add(new ziduan("layername", layer));
                list.Add(new ziduan("BID", "0"));
                DataEditCommon.CreateFeature(tFeatureClass, pgeoArrayHong, list);
                this.progressBarControl2.PerformStep();
                //progressBar2.Value += 1;
                Application.DoEvents();
                List <ziduan> listH = new List <ziduan>();
                listH.Add(new ziduan("dengji", "2"));
                listH.Add(new ziduan("layername", layer));
                listH.Add(new ziduan("BID", "0"));
                DataEditCommon.CreateFeature(tFeatureClass, pgeoArrayHang, listH);
                this.progressBarControl2.PerformStep();
                //progressBar2.Value += 1;
                Application.DoEvents();
            }
            if (pFeatureLayer_QYYJY.Visible == false)
            {
                pFeatureLayer_QYYJY.Visible = true;
            }
            DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
            MessageBox.Show("完成!");
        }