Example #1
0
        /// <summary>
        ///     20140801SDE中添加瓦斯压力点
        /// </summary>
        private void DrawGasGushQuantityPt(GasPressure gasGushQuantityEntity)
        {
            var    dCoordinateX = Convert.ToDouble(txtCoordinateX.Text);
            var    dCoordinateY = Convert.ToDouble(txtCoordinateY.Text);
            var    dCoordinateZ = Convert.ToDouble(txtCoordinateZ.Text);
            IPoint pt           = new PointClass();

            pt.X = dCoordinateX;
            pt.Y = dCoordinateY;
            pt.Z = dCoordinateZ;
            var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_WSYLD);

            if (pLayer == null)
            {
                MessageBox.Show(@"未找到瓦斯压力点图层,无法绘制瓦斯压力点图元。");
                return;
            }
            var       pFeatureLayer = (IFeatureLayer)pLayer;
            IGeometry geometry      = pt;
            var       list          = new List <ziduan>
            {
                new ziduan("bid", gasGushQuantityEntity.BindingId),
                new ziduan("mc", gasGushQuantityEntity.CoalSeams.ToString()),
                new ziduan("addtime", DateTime.Now.ToString(CultureInfo.InvariantCulture))
            };
            var wsyl = gasGushQuantityEntity.GasPressureValue.ToString(CultureInfo.InvariantCulture);
            var cdbg = gasGushQuantityEntity.CoordinateZ.ToString(CultureInfo.InvariantCulture);
            var ms   = gasGushQuantityEntity.Depth.ToString(CultureInfo.InvariantCulture);

            if (DataEditCommon.strLen(cdbg) < DataEditCommon.strLen(ms))
            {
                var count = DataEditCommon.strLen(ms) - DataEditCommon.strLen(cdbg);
                for (var i = 0; i < count; i++)
                {
                    cdbg = " " + cdbg; // // 测点标高
                }
            }
            else if (DataEditCommon.strLen(cdbg) > DataEditCommon.strLen(ms))
            {
                var count = DataEditCommon.strLen(cdbg) - DataEditCommon.strLen(ms);
                for (var i = 0; i < count; i++)
                {
                    ms += " ";
                }
            }

            list.Add(new ziduan("wsyl", wsyl));
            list.Add(new ziduan("cdbg", cdbg));
            list.Add(new ziduan("ms", ms));

            var pfeature = DataEditCommon.CreateNewFeature(pFeatureLayer, geometry, list);

            if (pfeature != null)
            {
                MyMapHelp.Jump(pt);
                DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(
                    (esriViewDrawPhase)34, null, null);
            }
        }
Example #2
0
        private bool DrawHengChuanPolygon(TunnelHChuan entity)
        {
            //找到导线点图层
            IMap map = new MapClass();

            map = DataEditCommon.g_pMap;
            var           layerName    = LayerNames.DEFALUT_HENGCHUAN; //“默认_导线点”图层
            IFeatureLayer featureLayer = new FeatureLayerClass();

            featureLayer = LayerHelper.GetLayerByName(map, layerName); //获得图层

            if (featureLayer == null)
            {
                MessageBox.Show("没有找到" + layerName + "图层,将不能绘制导线点。", "提示", MessageBoxButtons.OK);
                return(false);
            }

            var point1 = new PointClass {
                X = entity.X1, Y = entity.Y1, Z = entity.Z1, ZAware = true
            };
            var point2 = new PointClass {
                X = entity.X2, Y = entity.Y2, Z = entity.Z2, ZAware = true
            };
            var line = new LineClass {
                FromPoint = point1, ToPoint = point2
            };
            var polygon = new PolygonClass {
                ZAware = true
            };
            var width = entity.Width / 2;

            polygon.AddPoint(ConstructPoint(point2, line.Angle / Deg2Rad + 90, width));
            polygon.AddPoint(ConstructPoint(point2, line.Angle / Deg2Rad - 90, width));
            polygon.AddPoint(ConstructPoint(point1, line.Angle / Deg2Rad + 180 + 90, width));
            polygon.AddPoint(ConstructPoint(point1, line.Angle / Deg2Rad + 180 - 90, width));
            polygon.SimplifyPreserveFromTo();

            var list = new List <ziduan>
            {
                new ziduan("BID", entity.Id.ToString()),
                new ziduan("BID0", entity.TunnelId1.ToString()),
                new ziduan("BID1", entity.TunnelId2.ToString()),
                new ziduan("NAME", entity.NameHChuan)
            };

            var feature = DataEditCommon.CreateNewFeature(featureLayer, polygon, list);

            return(feature != null);
        }
Example #3
0
        private void CreateDongShi(IPoint P0, IPoint P1, IPoint P2, IPoint P3, string hdid, string bid)
        {
            ISegmentCollection pPath = new PathClass();
            //第一条线段
            ILine pLine = new LineClass();

            pLine.PutCoords(P0, P1);
            //QI到ISegment
            ISegment pSegment = pLine as ISegment;

            //创建一个Path对象
            System.Object o = Type.Missing;
            //通过ISegmentCollection接口为Path对象添加Segment对象
            pPath.AddSegment(pSegment, ref o, ref o);
            //第二条线段
            ILine pLine2 = new LineClass();

            pLine2.PutCoords(P1, P2);
            ISegment pSegment2 = pLine2 as ISegment;

            //创建一个Path对象
            //通过ISegmentCollection接口为Path对象添加Segment对象
            pPath.AddSegment(pSegment2, ref o, ref o);
            //第三条线段
            ILine pLine3 = new LineClass();

            pLine3.PutCoords(P2, P3);
            ISegment pSegment3 = pLine3 as ISegment;

            //创建一个Path对象
            //通过ISegmentCollection接口为Path对象添加Segment对象
            pPath.AddSegment(pSegment3, ref o, ref o);

            IGeometryCollection pPolyline = new PolylineClass();

            //通过IGeometryCollection为Polyline对象添加Path对象
            pPolyline.AddGeometry(pPath as IGeometry, ref o, ref o);

            if (m_pDongshiFeatureLayer != null)
            {
                System.Collections.Generic.List <ziduan> list = new System.Collections.Generic.List <ziduan>();
                list.Add(new ziduan(GIS_Const.FIELD_HDID, hdid));
                list.Add(new ziduan(GIS_Const.FIELD_BID, bid));
                DataEditCommon.CreateNewFeature(m_pDongshiFeatureLayer, pPolyline as IGeometry, list);
                m_hookHelper.ActiveView.Refresh();
            }
        }
Example #4
0
        /// <summary>
        ///     20140801SDE中添加瓦斯涌出量点
        /// </summary>
        private void DrawGasGushQuantityPt(GasGushQuantity gasGushQuantityEntity)
        {
            var    dCoordinateX = Convert.ToDouble(txtCoordinateX.Text);
            var    dCoordinateY = Convert.ToDouble(txtCoordinateY.Text);
            var    dCoordinateZ = Convert.ToDouble(txtCoordinateZ.Text);
            IPoint pt           = new PointClass();

            pt.X = dCoordinateX;
            pt.Y = dCoordinateY;
            pt.Z = dCoordinateZ;
            var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_HCGZMWSYCLD);

            if (pLayer == null)
            {
                MessageBox.Show(@"未找到瓦斯涌出量点图层,无法绘制瓦斯涌出量点图元。");
                return;
            }
            var       pFeatureLayer = (IFeatureLayer)pLayer;
            IGeometry geometry      = pt;
            var       list          = new List <ziduan>
            {
                new ziduan("bid", gasGushQuantityEntity.binding_id),
                new ziduan("mc", gasGushQuantityEntity.coal_seam.ToString()),
                new ziduan("addtime", DateTime.Now.ToString(CultureInfo.InvariantCulture))
            };
            var hcny    = gasGushQuantityEntity.stope_date.ToLongDateString();
            var ydwsycl = gasGushQuantityEntity.absolute_gas_gush_quantity.ToString(CultureInfo.InvariantCulture);
            var xdwsycl = gasGushQuantityEntity.relative_gas_gush_quantity.ToString(CultureInfo.InvariantCulture);
            var gzmrcl  = gasGushQuantityEntity.working_face_day_output.ToString(CultureInfo.InvariantCulture);

            if (DataEditCommon.strLen(ydwsycl) < DataEditCommon.strLen(xdwsycl))
            {
                var count = DataEditCommon.strLen(xdwsycl) - DataEditCommon.strLen(ydwsycl);
                for (var i = 0; i < count; i++)
                {
                    ydwsycl += " ";
                }
            }
            else if (DataEditCommon.strLen(ydwsycl) > DataEditCommon.strLen(xdwsycl))
            {
                var count = DataEditCommon.strLen(ydwsycl) - DataEditCommon.strLen(xdwsycl);
                for (var i = 0; i < count; i++)
                {
                    xdwsycl += " ";
                }
            }
            if (DataEditCommon.strLen(gzmrcl) < DataEditCommon.strLen(hcny))
            {
                var count = DataEditCommon.strLen(hcny) - DataEditCommon.strLen(gzmrcl);
                for (var i = 0; i < count; i++)
                {
                    gzmrcl = " " + gzmrcl;
                }
            }
            else if (DataEditCommon.strLen(gzmrcl) > DataEditCommon.strLen(hcny))
            {
                var count = DataEditCommon.strLen(gzmrcl) - DataEditCommon.strLen(hcny);
                for (var i = 0; i < count; i++)
                {
                    hcny += " ";
                }
            }
            list.Add(new ziduan("hcny", hcny));
            list.Add(new ziduan("jdwsycl", ydwsycl));
            list.Add(new ziduan("xdwsycl", xdwsycl));
            list.Add(new ziduan("gzmrcl", gzmrcl));

            var pfeature = DataEditCommon.CreateNewFeature(pFeatureLayer, geometry, list);

            if (pfeature != null)
            {
                MyMapHelp.Jump(pt);
                DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh((esriViewDrawPhase)34, null, null);
            }
        }
        /// <summary>
        /// 绘制推断断层
        /// </summary>
        /// <param name="title">文字</param>
        /// <param name="bid"></param>
        /// <param name="listptS">上盘坐标集合</param>
        /// <param name="listptX">下盘坐标集合</param>
        /// <returns></returns>
        public static bool DrawTDDC(string title, string bid, List <IPoint> listptS, List <IPoint> listptX)
        {
            try
            {
                const string  sLayerAliasName = LayerNames.DEFALUT_INFERRED_FAULTAGE; //“默认_推断断层”图层
                ILayer        pLayer          = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, sLayerAliasName);
                IFeatureLayer pFeatureLayer   = pLayer as IFeatureLayer;
                if (pFeatureLayer == null)
                {
                    MessageBox.Show(@"推断断层图层缺失!");
                    return(false);
                }

                INewBezierCurveFeedback pNewBezierCurveFeedback = new NewBezierCurveFeedbackClass();
                pNewBezierCurveFeedback.Display = DataEditCommon.g_pAxMapControl.ActiveView.ScreenDisplay;
                for (int i = 0; i < listptS.Count; i++)
                {
                    if (i == 0)
                    {
                        pNewBezierCurveFeedback.Start(listptS[0]);
                    }
                    else
                    {
                        pNewBezierCurveFeedback.AddPoint(listptS[i]);
                    }
                }
                IGeometry     pGeometry = pNewBezierCurveFeedback.Stop();
                var           polyline  = (IPolyline)pGeometry;
                var           pTopo     = pGeometry as ITopologicalOperator;
                List <ziduan> ziduan    = new List <ziduan>
                {
                    new ziduan("str", title),
                    new ziduan("type", "1"),
                    new ziduan("BID", bid)
                };
                IFeature pFeature = DataEditCommon.CreateNewFeature(pFeatureLayer, polyline, ziduan);
                DataEditCommon.g_pMap.SelectFeature(pFeatureLayer, pFeature);


                pNewBezierCurveFeedback = new NewBezierCurveFeedbackClass
                {
                    Display = DataEditCommon.g_pAxMapControl.ActiveView.ScreenDisplay
                };
                for (int i = 0; i < listptX.Count; i++)
                {
                    if (i == 0)
                    {
                        pNewBezierCurveFeedback.Start(listptX[0]);
                    }
                    else
                    {
                        pNewBezierCurveFeedback.AddPoint(listptX[i]);
                    }
                }
                IGeometry xGeometry = pNewBezierCurveFeedback.Stop();
                polyline = (IPolyline)xGeometry;
                ziduan   = new List <ziduan> {
                    new ziduan("str", ""), new ziduan("type", "2"), new ziduan("BID", bid)
                };
                pFeature = DataEditCommon.CreateNewFeature(pFeatureLayer, polyline, ziduan);
                if (pTopo != null)
                {
                    pTopo.Union(xGeometry);
                    DataEditCommon.g_pMap.SelectFeature(pFeatureLayer, pFeature);

                    MyMapHelp.Jump((IGeometry)pTopo);
                }
                DataEditCommon.g_pAxMapControl.ActiveView.PartialRefresh((esriViewDrawPhase)5, null, null);
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }
Example #6
0
        /// <summary>
        ///     未见煤钻孔
        /// </summary>
        /// <param name="breholeEntity">钻孔实体</param>
        private void DrawZuanKong(Borehole breholeEntity)
        {
            ////1.获得当前编辑图层
            //DrawSpecialCommon drawspecial = new DrawSpecialCommon();
            //string sLayerAliasName = LibCommon.LibLayerNames.DEFALUT_BOREHOLE;//“默认_钻孔”图层
            //IFeatureLayer featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            //if (featureLayer == null)
            //{
            //    MessageBox.Show("未找到" + sLayerAliasName + "图层,无法绘制钻孔图元。");
            //    return;
            //}

            ////2.绘制图元
            //IPoint pt = new PointClass();
            //pt.X = breholeEntity.CoordinateX;
            //pt.Y = breholeEntity.CoordinateY;
            //pt.Z = breholeEntity.CoordinateZ;
            //if (pt.Z == double.NaN)
            //    pt.Z = 0;
            //GIS.SpecialGraphic.DrawZK2 drawZK2 = null;
            ////标注内容
            //string strH =breholeEntity.GroundElevation.ToString();//地面标高
            //string strName = breholeEntity.BoreholeNumber.ToString();//孔号(名称)

            //IFeature feature = featureLayer.FeatureClass.CreateFeature();
            //IGeometry geometry = pt;
            //DataEditCommon.ZMValue(feature, geometry);   //几何图形Z值处理
            ////drawspecial.ZMValue(feature, geometry);    //几何图形Z值处理
            //feature.Shape = pt;//要素形状
            ////要素ID字段赋值(对应属性表中BindingID)
            //int iFieldID = feature.Fields.FindField("ID");
            //feature.Value[iFieldID] = breholeEntity.BindingId.ToString();
            //feature.Store();//存储要素

            //string strValue = feature.get_Value(feature.Fields.FindField("OBJECTID")).ToString();
            //DataEditCommon.SpecialPointRenderer(featureLayer, "OBJECTID", strValue, drawZK2.m_Bitmap);

            /////3.显示钻孔图层
            //if (featureLayer.Visible == false)
            //    featureLayer.Visible = true;

            //IEnvelope envelop = feature.Shape.Envelope;
            //DataEditCommon.g_pMyMapCtrl.ActiveView.Extent = envelop;
            //DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
            //DataEditCommon.g_pMyMapCtrl.ActiveView.Refresh();

            IPoint pt = new PointClass();

            pt.X = breholeEntity.CoordinateX;
            pt.Y = breholeEntity.CoordinateY;
            pt.Z = breholeEntity.CoordinateZ;
            if (double.IsNaN(pt.Z))
            {
                pt.Z = 0;
            }
            var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_BOREHOLE);

            if (pLayer == null)
            {
                MessageBox.Show(@"未找到钻孔图层,无法绘制钻孔图元。");
                return;
            }
            var       pFeatureLayer = (IFeatureLayer)pLayer;
            IGeometry geometry      = pt;
            var       list          = new List <ziduan>
            {
                new ziduan(GIS_Const.FIELD_BID, breholeEntity.BindingId),
                new ziduan(GIS_Const.FIELD_BOREHOLE_NUMBER, breholeEntity.BoreholeNumber),
                new ziduan(GIS_Const.FIELD_ADD_TIME, DateTime.Now.ToString(CultureInfo.InvariantCulture)),
                new ziduan(GIS_Const.FIELD_GROUND_ELEVATION,
                           breholeEntity.GroundElevation.ToString(CultureInfo.InvariantCulture)),
                new ziduan(GIS_Const.FIELD_GROUND_FLOOR_ELEVATION, ""),
                new ziduan(GIS_Const.FIELD_THICKNESS, ""),
                new ziduan(GIS_Const.FIELD_TYPE, "1")
            };

            var pfeature = DataEditCommon.CreateNewFeature(pFeatureLayer, geometry, list);

            if (pfeature == null)
            {
                return;
            }
            MyMapHelp.Jump(pt);
            DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(
                (esriViewDrawPhase)34, null, null);
        }
        private void DrawXlz(List <CollapsePillarsPoint> lstCollapsePillarsEntKeyPts, string sCollapseId)
        {
            ILayer mPCurrentLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap,
                                                                  LayerNames.LAYER_ALIAS_MR_XianLuoZhu1);
            var pFeatureLayer = mPCurrentLayer as IFeatureLayer;
            INewBezierCurveFeedback pBezier = new NewBezierCurveFeedbackClass();
            IPoint    pt;
            IPolyline polyline = new PolylineClass();

            for (int i = 0; i < lstCollapsePillarsEntKeyPts.Count; i++)
            {
                pt = new PointClass();
                var mZAware = (IZAware)pt;
                mZAware.ZAware = true;

                pt.X = lstCollapsePillarsEntKeyPts[i].CoordinateX;
                pt.Y = lstCollapsePillarsEntKeyPts[i].CoordinateY;
                pt.Z = lstCollapsePillarsEntKeyPts[i].CoordinateZ;
                if (i == 0)
                {
                    pBezier.Start(pt);
                }
                else if (i == lstCollapsePillarsEntKeyPts.Count - 1)
                {
                    pBezier.AddPoint(pt);
                    pt = new PointClass();
                    var zZAware = (IZAware)pt;
                    zZAware.ZAware = true;
                    pt.X           = lstCollapsePillarsEntKeyPts[0].CoordinateX;
                    pt.Y           = lstCollapsePillarsEntKeyPts[0].CoordinateY;
                    pt.Z           = lstCollapsePillarsEntKeyPts[0].CoordinateZ;
                    pBezier.AddPoint(pt);
                    polyline = pBezier.Stop();
                }
                else
                {
                    pBezier.AddPoint(pt);
                }
            }
            //polyline = (IPolyline)geo;
            var pSegmentCollection = polyline as ISegmentCollection;

            if (pSegmentCollection != null)
            {
                for (int i = 0; i < pSegmentCollection.SegmentCount; i++)
                {
                    pt = new PointClass();
                    var mZAware = (IZAware)pt;
                    mZAware.ZAware = true;

                    pt.X = lstCollapsePillarsEntKeyPts[i].CoordinateX;
                    pt.Y = lstCollapsePillarsEntKeyPts[i].CoordinateY;
                    pt.Z = lstCollapsePillarsEntKeyPts[i].CoordinateZ;


                    IPoint pt1 = new PointClass();
                    mZAware        = (IZAware)pt1;
                    mZAware.ZAware = true;
                    if (i == pSegmentCollection.SegmentCount - 1)
                    {
                        pt1.X = lstCollapsePillarsEntKeyPts[0].CoordinateX;
                        pt1.Y = lstCollapsePillarsEntKeyPts[0].CoordinateY;
                        pt1.Z = lstCollapsePillarsEntKeyPts[0].CoordinateZ;

                        pSegmentCollection.Segment[i].FromPoint = pt;
                        pSegmentCollection.Segment[i].ToPoint   = pt1;
                    }
                    else
                    {
                        pt1.X = lstCollapsePillarsEntKeyPts[i + 1].CoordinateX;
                        pt1.Y = lstCollapsePillarsEntKeyPts[i + 1].CoordinateY;
                        pt1.Z = lstCollapsePillarsEntKeyPts[i + 1].CoordinateZ;

                        pSegmentCollection.Segment[i].FromPoint = pt;
                        pSegmentCollection.Segment[i].ToPoint   = pt1;
                    }
                }
            }
            polyline = pSegmentCollection as IPolyline;
            //polyline = DataEditCommon.PDFX(polyline, "Bezier");

            IPolygon pPolygon = DataEditCommon.PolylineToPolygon(polyline);
            var      list     = new List <ziduan>
            {
                new ziduan("COLLAPSE_PILLAR_NAME", lstCollapsePillarsEntKeyPts.First().CollapsePillars.CollapsePillarsName),
                new ziduan("BID", sCollapseId),
                radioBtnX.Checked ? new ziduan("XTYPE", "0") : new ziduan("XTYPE", "1")
            };
            IFeature pFeature = DataEditCommon.CreateNewFeature(pFeatureLayer, pPolygon, list);

            if (pFeature != null)
            {
                MyMapHelp.Jump(pFeature.Shape);
                DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
            }

            #region 暂时无用

            //string sTempFolderPath = System.Windows.Forms.Application.StartupPath + "\\TempFolder";

            /////1.将关键点坐标存储到临时文件中
            //string sPtsCoordinateTxtPath = sTempFolderPath + "\\PtsCoordinate.txt";
            //bool bIsWrite = WritePtsInfo2Txt(lstCollapsePillarsEntKeyPts, sPtsCoordinateTxtPath);
            //if (!bIsWrite) return;

            /////2.读取点坐标文件拟合生成陷落柱,仿照等值线
            /////步骤:点文件生成点要素层→转为Raster→提取等值线
            //Geoprocessor GP = new Geoprocessor();
            //string featureOut = sTempFolderPath + "\\KeyPts.shp";
            //DrawContours.ConvertASCIIDescretePoint2FeatureClass(GP, sPtsCoordinateTxtPath, featureOut);//点文件生成点要素层

            //string sRasterOut = sTempFolderPath + "\\Raster";
            //DrawContours.ConvertFeatureCls2Raster(GP, featureOut, sRasterOut);//要素层→Raster

            //string sR2Contour = sTempFolderPath + "\\Contour.shp";
            //double douElevation = 0.5;//等高距0.5
            //DrawContours.SplineRasterToContour(GP, sRasterOut, sR2Contour, douElevation);//提取等值线(即为拟合的陷落柱)

            /////3.复制生成的等值线(即为拟合的陷落柱)要素到陷落柱图层
            /////3.1 获得源图层
            //IFeatureLayer sourceFeaLayer = new FeatureLayerClass();
            //string sourcefeatureClassName = "Contour.shp";
            //IFeatureClass featureClass =PointsFit2Polyline.GetFeatureClassFromShapefileOnDisk(sTempFolderPath, sourcefeatureClassName);//获得等值线(即为拟合的陷落柱)图层

            //if (featureClass == null) return;
            //sourceFeaLayer.FeatureClass = featureClass;


            /////3.2 获得当前编辑图层(目标图层)
            //DrawSpecialCommon drawspecial = new DrawSpecialCommon();
            //string sLayerAliasName = LibCommon.LibLayerNames.DEFALUT_COLLAPSE_PILLAR;//“默认_陷落柱_1”图层
            //IFeatureLayer featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            //if (featureLayer == null)
            //{
            //    MessageBox.Show("未找到" + sLayerAliasName + "图层,无法绘制陷落柱图元。");
            //    return;
            //}

            /////3.3 复制要素
            //PointsFit2Polyline.CopyFeature(sourceFeaLayer, featureLayer, sCollapseID);

            #endregion
        }
Example #8
0
        /// <summary>
        ///     绘制井筒图元
        /// </summary>
        /// <param name="pitshaftEntity"></param>
        private void DrawJingTong(Pitshaft pitshaftEntity)
        {
            ////1.获得当前编辑图层
            //DrawSpecialCommon drawspecial = new DrawSpecialCommon();
            //string sLayerAliasName = LibCommon.LibLayerNames.DEFALUT_JINGTONG;//“默认_井筒”图层
            //IFeatureLayer featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            //if (featureLayer == null)
            //{
            //    MessageBox.Show("未找到" + sLayerAliasName + "图层,无法绘制井筒图元。");
            //    return;
            //}

            ////2.绘制井筒
            //double X = Convert.ToDouble(this.txtFigureCoordinateX.Text.ToString());
            //double Y = Convert.ToDouble(this.txtFigureCoordinateY.Text.ToString());
            //IPoint pt = new PointClass();
            //pt.X = X;
            //pt.Y = Y;

            //double dZ = 0;
            //if (!string.IsNullOrEmpty(this.txtFigureCoordinateZ.Text))
            //{
            //    double.TryParse(this.txtFigureCoordinateZ.Text, out dZ);
            //}
            //pt.Z = dZ;

            ////标注内容
            //string strH =(Convert.ToDouble(this.txtWellheadElevation.Text.ToString())+
            //    Convert.ToDouble(this.txtWellbottomElevation.Text.ToString())).ToString();//井口标高+井底标高
            //string strX = SplitStr(this.txtPitshaftCoordinateX.Text.ToString());
            //string strY = SplitStr(this.txtPitshaftCoordinateY.Text.ToString());
            ////string strName =this.cobPitshaftType.SelectedValue.ToString()+":"+
            ////    this.txtPitshaftName.Text.ToString();
            //string strName = this.cobPitshaftType.SelectedValue.ToString() + ":" +
            //   this.txtPitshaftName.Text.ToString();

            //GIS.SpecialGraphic.DrawJT drawJT = new GIS.SpecialGraphic.DrawJT(strX, strY, strH, strName);
            ////dfs
            //DataEditCommon.InitEditEnvironment();
            //DataEditCommon.CheckEditState();
            //DataEditCommon.g_CurWorkspaceEdit.StartEditOperation();
            ////dfe
            //IFeature feature = featureLayer.FeatureClass.CreateFeature();
            //IGeometry geometry = pt;
            //DataEditCommon.ZMValue(feature, geometry);   //几何图形Z值处理
            ////drawspecial.ZMValue(feature, geometry);//几何图形Z值处理
            //feature.Shape = pt;
            ////要素ID字段赋值(对应属性表中BindingID)
            //int iFieldID = feature.Fields.FindField(GIS_Const.FIELD_BID);
            //feature.Value[iFieldID] = pitshaftEntity.BindingId.ToString();
            //feature.Store();
            //DataEditCommon.g_CurWorkspaceEdit.StopEditOperation();
            //string strValue = feature.get_Value(feature.Fields.FindField(GIS_Const.FIELD_OBJECTID)).ToString();
            //DataEditCommon.SpecialPointRenderer(featureLayer, GIS_Const.FIELD_OBJECTID, strValue, drawJT.m_Bitmap);

            /////3.显示井筒图层
            //if (featureLayer.Visible == false)
            //    featureLayer.Visible = true;

            ////缩放到新增的线要素,并高亮该要素
            //GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.Extent = feature.Shape.Envelope;
            //GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.Extent.Expand(2.5, 2.5, true);
            //GIS.Common.DataEditCommon.g_pMyMapCtrl.Map.SelectFeature(featureLayer, feature);
            //GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null);

            ////DataEditCommon.g_pMyMapCtrl.ActiveView.Refresh();

            var    X  = Convert.ToDouble(txtFigureCoordinateX.Text);
            var    Y  = Convert.ToDouble(txtFigureCoordinateY.Text);
            IPoint pt = new PointClass();

            pt.X = X;
            pt.Y = Y;

            double dZ = 0;

            if (!string.IsNullOrEmpty(txtFigureCoordinateZ.Text))
            {
                double.TryParse(txtFigureCoordinateZ.Text, out dZ);
            }
            pt.Z = dZ;
            var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_JINGTONG);

            if (pLayer == null)
            {
                MessageBox.Show("未找到井筒图层,无法绘制井筒图元。");
                return;
            }
            var       pFeatureLayer = (IFeatureLayer)pLayer;
            IGeometry geometry      = pt;
            var       list          = new List <ziduan>();

            list.Add(new ziduan("bid", pitshaftEntity.BindingId));
            list.Add(new ziduan("mc", pitshaftEntity.PitshaftName));
            list.Add(new ziduan("addtime", DateTime.Now.ToString()));
            list.Add(new ziduan("jkgc", pitshaftEntity.WellheadElevation.ToString()));
            list.Add(new ziduan("jdgc", pitshaftEntity.WellbottomElevation.ToString()));
            list.Add(new ziduan("yt", cobPitshaftType.Text));
            list.Add(new ziduan("x", pitshaftEntity.PitshaftCoordinateX.ToString()));
            list.Add(new ziduan("y", pitshaftEntity.PitshaftCoordinateY.ToString()));
            list.Add(new ziduan("h", (pitshaftEntity.WellbottomElevation + pitshaftEntity.WellheadElevation).ToString()));

            var pfeature = DataEditCommon.CreateNewFeature(pFeatureLayer, geometry, list);

            if (pfeature != null)
            {
                MyMapHelp.Jump(pt);
                DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(
                    esriViewDrawPhase.esriViewGeography | esriViewDrawPhase.esriViewForeground, null, null);
            }
        }
Example #9
0
        /// <summary>
        ///     见煤钻孔
        /// </summary>
        /// <params name="breholeEntity">钻孔实体</params>
        /// <params name="subBoreholeEntity">钻孔岩性实体</params>
        private void DrawZuanKong(Borehole breholeEntity, SubBorehole subBoreholeEntity)
        {
            ////1.获得当前编辑图层
            //DrawSpecialCommon drawspecial = new DrawSpecialCommon();
            //string sLayerAliasName = LibCommon.LibLayerNames.DEFALUT_BOREHOLE;//“钻孔”图层
            //IFeatureLayer featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            //if (featureLayer == null)
            //{
            //    MessageBox.Show("未找到" + sLayerAliasName + "图层,无法绘制钻孔图元。");
            //    return;
            //}

            ////2.绘制图元
            //IPoint pt = new PointClass();
            //pt.X = breholeEntity.CoordinateX;
            //pt.Y = breholeEntity.CoordinateY;
            //pt.Z = breholeEntity.CoordinateZ;

            ////标注内容
            //string strH = breholeEntity.GroundElevation.ToString();//地面标高
            //string strName = breholeEntity.BoreholeNumber.ToString();//孔号(名称)
            //string strDBBG = subBoreholeEntity.FloorElevation.ToString();//底板标高
            //string strMCHD = subBoreholeEntity.Thickness.ToString();//煤层厚度

            //GIS.SpecialGraphic.DrawZK1 drawZK1 = new GIS.SpecialGraphic.DrawZK1(strName, strH, strDBBG, strMCHD);
            //DataEditCommon.g_CurWorkspaceEdit.StartEditing(false);
            //DataEditCommon.g_CurWorkspaceEdit.StartEditOperation();
            //IFeature feature = featureLayer.FeatureClass.CreateFeature();

            //IGeometry geometry = pt;
            //DataEditCommon.ZMValue(feature, geometry);   //几何图形Z值处理
            ////drawspecial.ZMValue(feature, geometry);//几何图形Z值处理
            //feature.Shape = pt;//要素形状
            ////要素ID字段赋值(对应属性表中BindingID)
            //int iFieldID = feature.Fields.FindField("BID");
            //feature.Value[iFieldID] =breholeEntity.bid.ToString();
            //feature.Store();//存储要素
            //DataEditCommon.g_CurWorkspaceEdit.StopEditOperation();
            //DataEditCommon.g_CurWorkspaceEdit.StopEditing(true);
            //string strValue = feature.get_Value(feature.Fields.FindField("OBJECTID")).ToString();
            //DataEditCommon.SpecialPointRenderer(featureLayer, "OBJECTID", strValue, drawZK1.m_Bitmap);

            /////3.显示钻孔图层
            //if (featureLayer.Visible == false)
            //    featureLayer.Visible = true;

            //IEnvelope envelop = feature.Shape.Envelope;
            //DataEditCommon.g_pMyMapCtrl.ActiveView.Extent = envelop;
            //DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
            //DataEditCommon.g_pMyMapCtrl.ActiveView.Refresh();

            IPoint pt = new PointClass();

            pt.X = breholeEntity.coordinate_x;
            pt.Y = breholeEntity.coordinate_y;
            pt.Z = breholeEntity.coordinate_z;
            if (double.IsNaN(pt.Z))
            {
                pt.Z = 0;
            }
            var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_BOREHOLE);

            if (pLayer == null)
            {
                MessageBox.Show(@"未找到钻孔图层,无法绘制钻孔图元。");
                return;
            }
            var       pFeatureLayer = (IFeatureLayer)pLayer;
            IGeometry geometry      = pt;
            var       list          = new List <ziduan>
            {
                new ziduan("bid", breholeEntity.bid),
                new ziduan("BOREHOLE_NUMBER", breholeEntity.name),
                new ziduan("addtime", DateTime.Now.ToString(CultureInfo.InvariantCulture)),
                new ziduan("GROUND_ELEVATION", breholeEntity.ground_elevation.ToString(CultureInfo.InvariantCulture)),
                new ziduan("FLOOR_ELEVATION",
                           subBoreholeEntity.floor_elevation.ToString(CultureInfo.InvariantCulture)),
                new ziduan("THICKNESS", subBoreholeEntity.thickness.ToString(CultureInfo.InvariantCulture)),
                new ziduan("type", "2")
            };

            var pfeature = DataEditCommon.CreateNewFeature(pFeatureLayer, geometry, list);

            if (pfeature != null)
            {
                MyMapHelp.Jump(pt);
                DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(
                    (esriViewDrawPhase)34, null, null);
            }
        }
Example #10
0
        /// <summary>
        ///     绘制揭露断层图元
        /// </summary>
        /// <params name="faultage"></params>
        private void DrawJldc(Faultage faultage)
        {
            ////1.获得当前编辑图层
            //DrawSpecialCommon drawspecial = new DrawSpecialCommon();
            //string sLayerAliasName = LibCommon.LibLayerNames.DEFALUT_EXPOSE_FAULTAGE;//“揭露断层”图层
            //IFeatureLayer featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            //if (featureLayer == null)
            //{
            //    MessageBox.Show("未找到" + sLayerAliasName + "图层,无法绘制揭露断层图元。");
            //    return;
            //}

            ////2.生成要素(要根据中心点获取起止点)
            ////中心点
            //double centrePtX = Convert.ToDouble(this.txtCoordinateX.Text.ToString());
            //double centrePtY = Convert.ToDouble(this.txtCoordinateY.Text.ToString());
            //IPoint centrePt = new PointClass();
            //centrePt.X = centrePtX;
            //centrePt.Y = centrePtY;

            //// 图形坐标Z  //zwy 20140526 add
            //double dCoordinateZ = 0;
            //if (!double.TryParse(this.txtCoordinateZ.Text.Trim(), out dCoordinateZ))
            //{
            //    MessageBox.Show("输入的Z坐标不是有效数值,请检查!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    return;
            //}
            //centrePt.Z = dCoordinateZ;

            //double angle = Convert.ToDouble(this.txtAngle.Text.ToString());//倾角
            //double length = 10;//默认长度为20,左右各10

            ////计算起止点
            //IPoint fromPt = new PointClass();
            //IPoint toPt = new PointClass();
            //CalculateEndpoints(centrePt, angle, length, ref fromPt, ref toPt);
            //DataEditCommon.g_CurWorkspaceEdit.StartEditing(false);
            //DataEditCommon.g_CurWorkspaceEdit.StartEditOperation();
            //IFeature pFeature = featureLayer.FeatureClass.CreateFeature();

            //ILine line = new LineClass();
            //line.PutCoords(fromPt, toPt);
            //object Missing = Type.Missing;
            //ISegment segment = line as ISegment;
            //ISegmentCollection newLine = new PolylineClass();
            //newLine.AddSegment(segment, ref Missing, ref Missing);
            //IPolyline polyline = newLine as IPolyline;

            //DataEditCommon.ZMValue(pFeature, polyline);  //zwy 20140526 add
            //pFeature.Shape = polyline;

            ////2.1断层标注(DCBZ)
            //string strMC = this.txtFaultageName.Text;//断层名称
            //string strLC = this.txtGap.Text;//落差
            //string strQJ = this.txtAngle.Text;//倾角
            //string strDCBZ = strMC + " " + "H=" + strLC + "m" + " " + "<" + strQJ + "°";

            ////断层标注字段赋值(该字段值保持在图层属性中)
            //int index = featureLayer.FeatureClass.Fields.FindField("FAULTAGE_NAME");
            //pFeature.set_Value(index, strDCBZ);

            ////要素ID字段赋值(对应属性表中BindingID)
            //int iFieldID = pFeature.Fields.FindField(GIS_Const.FIELD_BID);
            //pFeature.Value[iFieldID] = faultage.bid.ToString();

            //pFeature.Store();
            //DataEditCommon.g_CurWorkspaceEdit.StopEditOperation();
            //DataEditCommon.g_CurWorkspaceEdit.StopEditing(true);
            ////2.2给生成的断层赋符号
            //int ID = pFeature.OID;
            //string path = Application.StartupPath + @"\symbol.ServerStyle";//【这里用到了自己定义的符号库】
            ////默认为正断层(符号)
            //string sGalleryClassName = "123";
            //string symbolName = "123"; ;
            //if (this.rbtnFrontFaultage.Checked)//正断层
            //{

            //    sGalleryClassName = "123";
            //    symbolName = "123";
            //}
            //else if (this.rbtnOppositeFaultage.Checked)//逆断层
            //{

            //    sGalleryClassName = "1234";
            //    symbolName = "1234";
            //}

            //ILineSymbol lineSymbol = GetSymbol(path, sGalleryClassName, symbolName);
            //ILayer layer = featureLayer as ILayer;
            //SpecialLineRenderer(layer, ID, lineSymbol);
            //AddAnnotate(layer, GIS_Const.FILE_DCBZ);

            ////缩放到新增的线要素,并高亮该要素
            //GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.Extent = pFeature.Shape.Envelope;
            //GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.Extent.Expand(1.5, 1.5, true);
            //GIS.Common.DataEditCommon.g_pMyMapCtrl.Map.SelectFeature(featureLayer, pFeature);
            //GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null);


            var pLayer       = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_EXPOSE_FAULTAGE);
            var featureLayer = (IFeatureLayer)pLayer;

            if (pLayer == null)
            {
                MessageBox.Show(@"未找到揭露断层图层,无法绘制揭露断层图元。");
                return;
            }
            //2.生成要素(要根据中心点获取起止点)
            //中心点
            IPoint centrePt = new PointClass();

            centrePt.X = faultage.coordinate_x;
            centrePt.Y = faultage.coordinate_y;
            centrePt.Z = faultage.coordinate_z;

            var trend  = faultage.trend;      //走向
            var length = faultage.length / 2; //默认长度为20,左右各10

            //计算起止点
            IPoint fromPt = new PointClass();
            IPoint toPt   = new PointClass();

            CalculateEndpoints(centrePt, trend, length, ref fromPt, ref toPt);

            ILine line = new LineClass();

            line.PutCoords(fromPt, toPt);
            var missing = Type.Missing;
            var segment = (ISegment)line;
            ISegmentCollection newLine = new PolylineClass();

            newLine.AddSegment(segment, ref missing, ref missing);
            var polyline = (IPolyline)newLine;

            var list = new List <ziduan>
            {
                new ziduan("bid", faultage.bid),
                new ziduan("FAULTAGE_NAME", faultage.name),
                new ziduan("addtime", DateTime.Now.ToString(CultureInfo.InvariantCulture)),
                new ziduan("GAP", faultage.gap),
                new ziduan("ANGLE", faultage.angle.ToString(CultureInfo.InvariantCulture)),
                new ziduan("TREND", faultage.trend.ToString(CultureInfo.InvariantCulture)),
                new ziduan("SEPARATION", faultage.separation),
                new ziduan("type", faultage.type)
            };

            var pfeature = DataEditCommon.CreateNewFeature(featureLayer, polyline, list);

            if (pfeature == null)
            {
                return;
            }
            MyMapHelp.Jump(polyline);
            DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(
                (esriViewDrawPhase)34, null, null);
        }