コード例 #1
0
ファイル: AddDongshi.cs プロジェクト: zhongshuiyuan/gews
        /// <summary>
        /// Occurs when this tool is clicked
        /// </summary>
        public override void OnClick()
        {
            drawSpecialCom  = new GIS.Common.DrawSpecialCommon();
            nearestGeometry = new PolylineClass();
            hightPoint      = new PointClass();
            hightPoint.PutCoords(0, 0);
            string layerName = GIS.LayerNames.DEFALUT_DONGSHI;

            m_pDongshiFeatureLayer = drawSpecialCom.GetFeatureLayerByName(layerName);
            if (m_pDongshiFeatureLayer == null)
            {
                MessageBox.Show(@"当前地图上没有找到硐室图层", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
コード例 #2
0
        /// <summary>
        ///     根据钻孔绑定ID删除钻孔图元
        /// </summary>
        /// <params name="sBoreholeBidArray">要删除钻孔的绑定ID</params>
        private static void DeleteZuanKongByBid(ICollection<string> sBoreholeBidArray)
        {
            if (sBoreholeBidArray.Count == 0) return;

            //1.获得当前编辑图层
            var drawspecial = new DrawSpecialCommon();
            const string sLayerAliasName = LayerNames.DEFALUT_BOREHOLE; //“钻孔”图层
            var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            if (featureLayer == null)
            {
                MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法删除钻孔图元。");
                return;
            }

            //2.删除钻孔图元
            foreach (var sBoreholeBid in sBoreholeBidArray)
            {
                DataEditCommon.DeleteFeatureByBId(featureLayer, sBoreholeBid);
            }
        }
コード例 #3
0
        /// <summary>
        ///     提  交
        /// </summary>
        /// <params name="sender"></params>
        /// <params name="e"></params>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            var borehole = Borehole.FindAllByProperty("name", txtBoreholeNumber.Text).FirstOrDefault() ??
                           new Borehole { bid = IdGenerator.NewBindingId() };
            borehole.name = txtBoreholeNumber.Text.Trim();
            borehole.ground_elevation = Convert.ToDouble(txtGroundElevation.Text.Trim());
            borehole.coordinate_x = Convert.ToDouble(txtCoordinateX.Text.Trim());
            borehole.coordinate_y = Convert.ToDouble(txtCoordinateY.Text.Trim());
            borehole.coordinate_z = Convert.ToDouble(txtCoordinateZ.Text.Trim());
            borehole.coal_seam_texture = string.Empty;
            borehole.Save();
            var subBorehole = new SubBorehole();
            for (var i = 0; i < gvCoalSeamsTexture.RowCount; i++)
            {
                // 最后一行为空行时,跳出循环
                if (i == gvCoalSeamsTexture.RowCount - 1)
                {
                    break;
                }

                // 创建钻孔岩性实体
                subBorehole = new SubBorehole
                {
                    floor_elevation = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[1].Value),
                    thickness = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[2].Value),
                    coal_seam = gvCoalSeamsTexture.Rows[i].Cells[3].Value.ToString(),
                    coordinate_x = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[4].Value),
                    coordinate_y = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[5].Value),
                    coordinate_z = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[6].Value),
                    lithology = gvCoalSeamsTexture.Rows[i].Cells[0].Value.ToString(),
                    borehole = borehole
                };
                subBorehole.Save();
            }

            var drawspecial = new DrawSpecialCommon();
            const string sLayerAliasName = LayerNames.DEFALUT_BOREHOLE; //“钻孔”图层
            var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            if (featureLayer == null)
            {
                MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法删钻孔图元。");
                return;
            }

            if (borehole.id != 0)
            {
                DataEditCommon.DeleteFeatureByBId(featureLayer, borehole.bid);
            }

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

            borehole = Borehole.FindAllByProperty("name", borehole.name).First();
            switch (dlgResult)
            {
                case DialogResult.Yes:
                    DrawZuanKong(borehole, subBorehole);
                    break;
                case DialogResult.No:
                    DrawZuanKong(borehole);
                    break;
                case DialogResult.Cancel:
                    break;
            }
            DialogResult = DialogResult.OK;
        }
コード例 #4
0
        /// <summary>
        ///     根据勘探线层绑定ID删除勘探线层图元
        /// </summary>
        /// <params name="sfpFaultageBidArray">要删除勘探线层的绑定ID</params>
        private void DeleteJLDCByBID(string[] sfpFaultageBidArray)
        {
            if (sfpFaultageBidArray.Length == 0) return;

            //1.获得当前编辑图层
            var drawspecial = new DrawSpecialCommon();
            const string sLayerAliasName = LayerNames.DEFALUT_KANTANXIAN; //“勘探线层”图层
            var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            if (featureLayer == null)
            {
                MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法删除揭露断层图元。");
                return;
            }

            //2.删除勘探线层图元
            foreach (var sfpFaultageBid in sfpFaultageBidArray)
            {
                DataEditCommon.DeleteFeatureByBId(featureLayer, sfpFaultageBid);
            }
        }
コード例 #5
0
ファイル: AddDongshi.cs プロジェクト: zhongshuiyuan/gews
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            // 右键返回
            if (Button == 2)
            {
                return;
            }
            if (m_pDongshiFeatureLayer == null)
            {
                return;
            }
            m_pPoint = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
            m_pPoint = GIS.GraphicEdit.SnapSetting.getSnapPoint(m_pPoint);

            double angle     = -1;
            string layerName = LayerNames.LAYER_ALIAS_MR_TUNNEL_FD;      //巷道

            pFeatLayer = drawSpecialCom.GetFeatureLayerByName(layerName);

            IFeature pFeature = null;

            TestExistPointFeature(m_hookHelper, m_pPoint, pFeatLayer, ref pFeature);
            if (pFeature == null)
            {
                MessageBox.Show(@"鼠标点击处没有巷道,请先选择一条巷道边线", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //IPoint hightPoint= Snapping(m_pPoint, pFeatLayer, pFeature);
            //if (hightPoint.IsEmpty)
            //{
            //    MessageBox.Show("获取巷道边界失败,请重新选择", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    return;
            //}
            IProximityOperator proximityOperator = (IProximityOperator)pFeature.Shape;
            IPoint             mousePoint        = proximityOperator.ReturnNearestPoint(m_pPoint, esriSegmentExtension.esriNoExtension);

            IProximityOperator proximityOperator2 = (IProximityOperator)mousePoint;
            ISegmentCollection segmentCollection  = (ISegmentCollection)pFeature.Shape;

            for (int i = 0; i < segmentCollection.SegmentCount; i++)
            {
                ISegmentCollection geometryCollection = new PolylineClass();
                ISegment           segment            = segmentCollection.get_Segment(i);
                geometryCollection.AddSegment(segment);
                geometryCollection.SegmentsChanged();
                var distance = proximityOperator2.ReturnDistance((IGeometry)geometryCollection);

                if (distance < 0.0001)
                {
                    angle = ((ILine)segment).Angle;
                    break;
                }
            }
            if (angle == -1)
            {
                MessageBox.Show(@"获取巷道边界失败,请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //得到相应的中线
            string hdid = pFeature.get_Value(pFeature.Fields.FindField(GIS_Const.FIELD_HDID)).ToString();
            string bid  = pFeature.get_Value(pFeature.Fields.FindField(GIS_Const.FIELD_BID)).ToString();

            FormCaveSizeInput frmCaveSize = new FormCaveSizeInput();

            frmCaveSize.ShowDialog();
            if (frmCaveSize.DialogResult == DialogResult.OK)
            {
                //输入正确,获得硐室的长和宽
                double Width  = frmCaveSize.CaveWidth;
                double Height = frmCaveSize.CaveHeight;

                PointClass p0 = RectanglePoint(mousePoint, angle, Width);
                PointClass p1 = RectanglePoint(mousePoint, angle + Math.PI, Width);
                PointClass p2 = RectanglePoint2(p0, angle + 90 * Math.PI / 180, Height);
                PointClass p3 = RectanglePoint2(p1, angle + 90 * Math.PI / 180, Height);
                //绘制硐室
                CreateDongShi(p0, p2, p3, p1, hdid, bid);
            }
        }
コード例 #6
0
        /// <summary>
        ///     根据揭露断层绑定ID删除揭露断层图元
        /// </summary>
        /// <params name="sfpFaultageBidArray">要删除揭露断层的绑定ID</params>
        private void DeleteJLDCByBID(ICollection<string> sfpFaultageBidArray)
        {
            if (sfpFaultageBidArray.Count == 0) return;

            //1.获得当前编辑图层
            var drawspecial = new DrawSpecialCommon();
            const string sLayerAliasName = LayerNames.DEFALUT_EXPOSE_FAULTAGE; //“揭露断层”图层
            var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            if (featureLayer == null)
            {
                MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法删除揭露断层图元。");
                return;
            }

            //2.删除揭露断层图元
            foreach (var sfpFaultageBid in sfpFaultageBidArray)
            {
                DataEditCommon.DeleteFeatureByBId(featureLayer, sfpFaultageBid);
            }
        }
コード例 #7
0
 /// <summary>
 /// Occurs when this tool is clicked
 /// </summary>
 public override void OnClick()
 {
     drawSpecialCom = new GIS.Common.DrawSpecialCommon();
     nearestGeometry = new PolylineClass();
     hightPoint = new PointClass();
     hightPoint.PutCoords(0, 0);
     string layerName = GIS.LayerNames.DEFALUT_DONGSHI;
     m_pDongshiFeatureLayer = drawSpecialCom.GetFeatureLayerByName(layerName);
     if (m_pDongshiFeatureLayer == null)
     {
         MessageBox.Show(@"��ǰ��ͼ��û���ҵ�����ͼ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return;
     }
 }
コード例 #8
0
        /// <summary>
        ///     修改井筒
        /// </summary>
        /// <params name="pitshaftEntity"></params>
        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.bid + "'");
            //if (bIsDeleteOldFeature)
            {
                //绘制井筒
                DrawJingTong(pitshaftEntity);
            }
        }
コード例 #9
0
        /// <summary>
        ///     修改揭露断层图元
        /// </summary>
        /// <params name="faultageEntity"></params>
        private void ModifyJldc(Faultage faultageEntity)
        {
            //1.获得当前编辑图层
            var drawspecial = new DrawSpecialCommon();
            const string sLayerAliasName = LayerNames.DEFALUT_EXPOSE_FAULTAGE; //“揭露断层”图层
            var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            if (featureLayer == null)
            {
                MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法修改揭露断层图元。");
                return;
            }

            //2.删除原来图元,重新绘制新图元
            DataEditCommon.DeleteFeatureByBId(featureLayer, faultageEntity.bid);
            DrawJldc(faultageEntity);
        }
コード例 #10
0
        /// <summary>
        ///     修改勘探线图元
        /// </summary>
        /// <params name="prospectingLineEntity"></params>
        /// <params name="lstProspectingBoreholePts"></params>
        private void ModifyProspectingLine(ProspectingLine prospectingLineEntity, List<IPoint> lstProspectingBoreholePts)
        {
            //1.获得当前编辑图层
            var drawspecial = new DrawSpecialCommon();
            var sLayerAliasName = LayerNames.DEFALUT_KANTANXIAN; //“勘探线”图层
            var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            if (featureLayer == null)
            {
                MessageBox.Show("未找到" + sLayerAliasName + "图层,无法修改勘探线图元。");
                return;
            }

            //2.删除原来图元,重新绘制新图元
            var bIsDeleteOldFeature = DataEditCommon.DeleteFeatureByBId(featureLayer, prospectingLineEntity.binding_id);
            if (bIsDeleteOldFeature)
            {
                //绘制图元
                DrawProspectingLine(prospectingLineEntity, lstProspectingBoreholePts);
            }
        }
コード例 #11
0
        /// <summary>
        ///     根据所选钻孔点绘制勘探线
        /// </summary>
        /// <params name="prospectingLineEntity"></params>
        /// <params name="lstProspectingBoreholePts"></params>
        private void DrawProspectingLine(ProspectingLine prospectingLineEntity, List<IPoint> lstProspectingBoreholePts)
        {
            //1.获得当前编辑图层
            var drawspecial = new DrawSpecialCommon();
            var sLayerAliasName = LayerNames.DEFALUT_KANTANXIAN; //“勘探线”图层
            var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            if (featureLayer == null)
            {
                MessageBox.Show("未找到" + sLayerAliasName + "图层,无法绘制勘探线图元。");
                return;
            }

            //2.绘制图元
            if (lstProspectingBoreholePts.Count == 0) return;

            var prospectingLineID = prospectingLineEntity.binding_id;
            //绘制推断断层
            PointsFit2Polyline.CreateLine(featureLayer, lstProspectingBoreholePts, prospectingLineID);
        }
コード例 #12
0
        /// <summary>
        ///     根据井筒绑定ID删除井筒图元
        /// </summary>
        /// <params name="sPitshaftBIDArray">要删除井筒的绑定ID</params>
        private void DeleteJintTongByBID(string[] sPitshaftBIDArray)
        {
            if (sPitshaftBIDArray.Length == 0) return;

            //1.获得当前编辑图层
            var drawspecial = new DrawSpecialCommon();
            var sLayerAliasName = LayerNames.DEFALUT_JINGTONG; //“井筒”图层
            var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            if (featureLayer == null)
            {
                MessageBox.Show("未找到" + sLayerAliasName + "图层,无法删除井筒图元。");
                return;
            }

            //2.删除井筒图元
            var sPitshaftBID = "";
            for (var i = 0; i < sPitshaftBIDArray.Length; i++)
            {
                sPitshaftBID = sPitshaftBIDArray[i];

                DataEditCommon.DeleteFeatureByBId(featureLayer, sPitshaftBID);
            }
        }
コード例 #13
0
        /// <summary>
        ///     删除陷落柱图元
        /// </summary>
        /// <params name="sCollapseId"></params>
        private void DeleteyXLZ(string sCollapseId)
        {
            //1.获得当前编辑图层
            var drawspecial = new DrawSpecialCommon();
            const string sLayerAliasName = LayerNames.LAYER_ALIAS_MR_XianLuoZhu1; //“陷落柱_1”图层
            var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            if (featureLayer == null)
            {
                MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法删除陷落柱图元。");
                return;
            }

            //2.删除原来图元,重新绘制新图元
            DataEditCommon.DeleteFeatureByBId(featureLayer, sCollapseId);
        }
コード例 #14
0
        /// <summary>
        ///     修改陷落柱图元
        /// </summary>
        /// <params name="lstCollapsePillarsEntKeyPts"></params>
        /// <params name="sCollapseId"></params>
        private void ModifyXlz(List<CollapsePillarPoint> lstCollapsePillarsEntKeyPts, string sCollapseId)
        {
            //1.获得当前编辑图层
            var drawspecial = new DrawSpecialCommon();
            const string sLayerAliasName = LayerNames.DEFALUT_COLLAPSE_PILLAR_1; //“陷落柱_1”图层
            IFeatureLayer featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName);
            if (featureLayer == null)
            {
                MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法修改陷落柱图元。");
                return;
            }

            //2.删除原来图元,重新绘制新图元
            bool bIsDeleteOldFeature = DataEditCommon.DeleteFeatureByBId(featureLayer, sCollapseId);
            if (bIsDeleteOldFeature)
            {
                //绘制图元
                DrawXlz(lstCollapsePillarsEntKeyPts, sCollapseId);
            }
        }