Пример #1
0
        /// <summary>
        /// 点击事件
        /// </summary>
        public override void OnClick()
        {
            DataEditCommon.InitEditEnvironment();
            DataEditCommon.CheckEditState();
            m_pCurrentLayer = DataEditCommon.g_pLayer;
            IFeatureLayer featureLayer = m_pCurrentLayer as IFeatureLayer;

            if (featureLayer == null)
            {
                MessageBox.Show(@"请选择绘制图层。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DataEditCommon.g_pMyMapCtrl.CurrentTool = null;
                return;
            }
            else
            {
                if (featureLayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolyline &&
                    featureLayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolygon || featureLayer.FeatureClass.FeatureType == esriFeatureType.esriFTAnnotation)
                {
                    MessageBox.Show(@"请选择线状图层或面状图层。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DataEditCommon.g_pMyMapCtrl.CurrentTool = null;
                    return;
                }
            }

            m_pMap  = m_hookHelper.FocusMap;
            m_pScrD = m_hookHelper.ActiveView.ScreenDisplay;
            m_pNewCircleFeedback = null;
        }
Пример #2
0
        /// <summary>
        /// 绘制文字到地图中
        /// </summary>
        /// <params name="text"></params>
        /// <params name="pPoint"></params>
        /// <params name="drawFont"></params>
        void DrawTextToMap(string text, ESRI.ArcGIS.Geometry.IPoint pPoint)
        {
            IElement element;

            ITextElement textElement = new TextElementClass();

            element = textElement as IElement;

            ITextSymbol textSymbol = new TextSymbolClass();

            textSymbol.Color = m_color;
            if (m_pFont != null)
            {
                textSymbol.Font = (stdole.IFontDisp)ESRI.ArcGIS.ADF.COMSupport.OLE.GetIFontDispFromFont(m_pFont);
                textSymbol.Size = Convert.ToDouble(m_pFont.Size);
            }
            element.Geometry = pPoint;

            textElement.Symbol = textSymbol;
            textElement.Text   = text;
            IFeature pFeature = DataEditCommon.SaveAnno(element, text);

            GIS.Common.DataEditCommon.g_pMap.SelectFeature(GIS.Common.DataEditCommon.g_pLayer, pFeature);
            GIS.Common.DataEditCommon.g_pAxMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics | esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewBackground, null, null);
        }
Пример #3
0
        /// <summary>
        /// 点击事件
        /// </summary>
        public override void OnClick()
        {
            DataEditCommon.InitEditEnvironment();
            DataEditCommon.CheckEditState();

            m_pCurrentLayer = DataEditCommon.g_pLayer;
            IFeatureLayer featureLayer = m_pCurrentLayer as IFeatureLayer;

            if (featureLayer == null)
            {
                MessageBox.Show(@"请选择绘制图层。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DataEditCommon.g_pMyMapCtrl.CurrentTool = null;
                return;
            }
            else
            {
                if (featureLayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolyline)
                {
                    MessageBox.Show(@"请选择线状图层。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DataEditCommon.g_pMyMapCtrl.CurrentTool = null;
                    return;
                }
            }

            m_pMap = m_hookHelper.FocusMap;
        }
Пример #4
0
 /// <summary>
 /// 绘制矩形
 /// </summary>
 /// <params name="pLayer"></params>
 /// <params name="pScreenDisplay"></params>
 private void DrawRectangular(ILayer pLayer, IGeometry pGeo)
 {
     if (pLayer != null)
     {
         ISegmentCollection pSegmentCollection = null;
         if (pLayer is IFeatureLayer)
         {
             IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
             IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
             if (pFeatureClass != null)
             {
                 if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                 {
                     pSegmentCollection = new PolylineClass();
                 }
                 else if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                 {
                     pSegmentCollection = new PolygonClass();
                 }
                 pSegmentCollection.SetRectangle(pGeo.Envelope);
                 IFeature pFeature = DataEditCommon.CreateUndoRedoFeature(pFeatureLayer, (IGeometry)pSegmentCollection);
                 m_hookHelper.FocusMap.SelectFeature(m_pCurrentLayer, pFeature);
                 m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics | esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewBackground, null, null);
             }
         }
     }
 }
Пример #5
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 + "'");
        }
Пример #6
0
        /// <summary>
        /// 判断鼠标点击处有无巷道要素
        /// </summary>
        /// <param name="m_hookHelper"></param>
        /// <param name="pMousePoint">鼠标点</param>
        /// <param name="pFeatureLayer">导线点图层</param>
        /// <param name="theFeature">返回离鼠标最近的导线点</param>
        public void TestExistPointFeature(IHookHelper m_hookHelper, IPoint pMousePoint, IFeatureLayer pFeatureLayer, ref IFeature theFeature)
        {
            ArrayList             pSelected = new ArrayList();
            IFeatureClass         pFeatureClass;
            ISelectionEnvironment pSelectionEnvironment;
            IFeature             pFeature = null;
            IGeometry            pGeometry;
            ITopologicalOperator pTopolagicalOperator;
            double dLength;

            IEnvelope pSrchEnv;

            pSelectionEnvironment = new SelectionEnvironmentClass();
            dLength         = pSelectionEnvironment.SearchTolerance;
            pGeometry       = pMousePoint;
            dLength         = DataEditCommon.ConvertPixelDistanceToMapDistance(m_hookHelper.ActiveView, dLength);
            pSrchEnv        = pMousePoint.Envelope;
            pSrchEnv.Width  = dLength;
            pSrchEnv.Height = dLength;
            pSrchEnv.CenterAt(pMousePoint);

            pTopolagicalOperator = (ITopologicalOperator)pGeometry;
            IGeometry pBuffer = pTopolagicalOperator.Buffer(dLength);

            pGeometry = pBuffer;

            IFeature pFeat = null;
            IMap     pMap  = m_hookHelper.FocusMap;

            pFeatureClass = pFeatureLayer.FeatureClass;
            IIdentify2 pID = pFeatureLayer as IIdentify2;
            //IArray pArray = pID.Identify(pSrchEnv, null);
            IArray pArray = pID.Identify(pGeometry, null);
            IFeatureIdentifyObj pFeatIdObj;
            IRowIdentifyObject  pRowObj;

            if (pArray != null)
            {
                for (int j = 0; j < pArray.Count; j++)
                {
                    if (pArray.Element[j] is IFeatureIdentifyObj)
                    {
                        pFeatIdObj = pArray.Element[j] as IFeatureIdentifyObj;
                        pRowObj    = pFeatIdObj as IRowIdentifyObject;
                        pFeature   = pRowObj.Row as IFeature;
                        pSelected.Add(pFeature);
                    }
                }
                pArray.RemoveAll();
            }
            theFeature = pFeature;

            return;

            //GetClosestFeatureInCollection(m_hookHelper, dLength, pSelected, pMousePoint, ref pFeat);
            //if (pFeat != null)
            //    theFeature = pFeat;
            //else
            //    theFeature = null;
        }
Пример #7
0
        /// <summary>
        /// µã»÷ʼþ
        /// </summary>
        public override void OnClick()
        {
            DataEditCommon.InitEditEnvironment();
            DataEditCommon.CheckEditState();

            m_pCurrentLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_XianLuoZhu1);
            IFeatureLayer featureLayer = m_pCurrentLayer as IFeatureLayer;

            if (featureLayer == null)
            {
                MessageBox.Show(@"ÏÝÂäÖùͼ²ã¶ªÊ§£¡", "Ìáʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DataEditCommon.g_pMyMapCtrl.CurrentTool = null;
                return;
            }
            else
            {
                if (featureLayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolygon)
                {
                    MessageBox.Show(@"ÏÝÂäÖùͼ²ã¶ªÊ§£¡", "Ìáʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DataEditCommon.g_pMyMapCtrl.CurrentTool = null;
                    return;
                }
            }

            m_pMap = m_hookHelper.FocusMap;
        }
Пример #8
0
        /// <summary>
        /// 点击事件
        /// </summary>
        public override void OnClick()
        {
            m_pMapControl = DataEditCommon.g_pMyMapCtrl;

            DataEditCommon.InitEditEnvironment();
            DataEditCommon.CheckEditState();
            ///获得编辑目标图层
            m_pCurrentLayer = DataEditCommon.g_pLayer;
            pFeatureLayer   = m_pCurrentLayer as IFeatureLayer;
            if (pFeatureLayer == null)
            {
                MessageBox.Show(@"请选择绘制图层。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DataEditCommon.g_pMyMapCtrl.CurrentTool = null;
                return;
            }
            else
            {
                if (pFeatureLayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolyline && pFeatureLayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolygon || pFeatureLayer.FeatureClass.FeatureType == esriFeatureType.esriFTAnnotation)
                {
                    MessageBox.Show(@"请选择线状或面状图层。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DataEditCommon.g_pMyMapCtrl.CurrentTool = null;
                    return;
                }
            }

            m_pMap         = m_hookHelper.FocusMap;
            m_IsFirstPoint = true;
        }
Пример #9
0
        private void btndel_Click(object sender, EventArgs e)
        {
            if (this.Tag == null || this.Text != "修改小柱状")
            {
                MessageBox.Show("请先使用修改按钮选中要删除的小柱状");
                return;
            }
            string bid       = this.Tag.ToString();
            var    AnnoLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_AnnotationXZZ) as IFeatureLayer; //注记图层
            var    lineLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_PolylineXZZ) as IFeatureLayer;   //线源图层
            var    topLayer  = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_PolygonXZZ) as IFeatureLayer;    //外部图形图层

            if (AnnoLayer == null || lineLayer == null || topLayer == null)
            {
                return;
            }
            DataEditCommon.DeleteFeatureByBId(AnnoLayer, bid);
            DataEditCommon.DeleteFeatureByBId(lineLayer, bid);
            DataEditCommon.DeleteFeatureByBId(topLayer, bid);
            FrmNewXZZ frm = new FrmNewXZZ();

            frm.Show(this.Owner);
            frm.Location = this.Location;
            this.Close();
            DataEditCommon.g_pAxMapControl.CurrentTool = null;
        }
Пример #10
0
        //获取矿界
        private IPolygon GetPolygon()
        {
            IPolygon      polygon2     = null;
            ILayer        pLayer       = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MINE_BOUNDARY);
            IFeatureLayer polygonLayer = (IFeatureLayer)pLayer;

            IQueryFilter filter = new QueryFilterClass();

            filter.WhereClause = "layer = '预警矿界'";

            IFeatureLayer         featureLayer        = polygonLayer as IFeatureLayer;
            IFeatureCursor        featureCursor       = featureLayer.Search(filter, false);
            ITopologicalOperator2 topologicalOperator = null;

            //  获得矿界组合成面
            if (featureCursor != null)
            {
                ISegmentCollection polygon = new PolygonClass();

                IFeature feature = featureCursor.NextFeature();

                while (feature != null)
                {
                    polygon.AddSegmentCollection((ISegmentCollection)feature.Shape);
                    feature = featureCursor.NextFeature();
                }

                topologicalOperator = (ITopologicalOperator2)polygon;
                topologicalOperator.IsKnownSimple_2 = true;
                topologicalOperator.Simplify();

                polygon2 = (IPolygon)topologicalOperator;
            }
            return(polygon2);
        }
Пример #11
0
        private bool IntersectAll(IFeatureClass lineLayer, IPolygon polygon2, List <ziduan> list)
        {
            try
            {
                if (radioBtnKJ.Checked && polygon2 != null)
                {
                    //  根据组合成的面裁剪压力等值线
                    SpatialFilterClass qfilter = new SpatialFilterClass();
                    qfilter.Geometry   = polygon2;
                    qfilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;

                    IFeatureCursor qfeatureCursor = lineLayer.Search(qfilter, false);

                    if (qfeatureCursor != null)
                    {
                        IFeature       feature       = qfeatureCursor.NextFeature();
                        IGeometryArray geometryArray = new GeometryArrayClass();
                        while (feature != null)
                        {
                            geometryArray.Add(feature.Shape);
                            feature = qfeatureCursor.NextFeature();
                        }

                        IGeometryServer2 geometryServer2 = new GeometryServerClass();
                        IGeometryArray   geometryArray2  = geometryServer2.Intersect(polygon2.SpatialReference, geometryArray, polygon2);
                        //DataEditCommon.DeleteFeatureByWhereClause(lineLayer, "");
                        IFeatureLayer pFeatureLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, EditLayerName) as IFeatureLayer;
                        DataEditCommon.CreateFeature(pFeatureLayer.FeatureClass, geometryArray2, list);
                    }
                }
                return(true);
            }
            catch
            { return(false); }
        }
Пример #12
0
        /// <summary>
        ///     根据坐标绘制导线点
        /// </summary>
        /// <params name="lstWpie">导线坐标(List)</params>
        /// <params name="addOrChange"></params>
        private void DrawWirePoint(List <WirePoint> lstWpie, string addOrChange)
        {
            IPoint pt = new Point();

            //找到导线点图层
            var          map          = DataEditCommon.g_pMap;
            const string layerName    = LayerNames.DEFALUT_WIRE_PT; //“导线点”图层
            var          featureLayer = LayerHelper.GetLayerByName(map, layerName);

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

            var drawWirePt = new DrawTunnels();

            //修改导线点操作,要先删除原有导线点要素
            if (addOrChange == "CHANGE")
            {
                foreach (var t in lstWpie)
                {
                    var wirePtInfo = t;
                    DataEditCommon.DeleteFeatureByBId(featureLayer, wirePtInfo.bid);
                }
            }

            foreach (var t in lstWpie)
            {
                pt.X = t.coordinate_x;
                pt.Y = t.coordinate_y;
                pt.Z = t.coordinate_z;
                drawWirePt.CreatePoint(featureLayer, pt, t.bid, t);
            }
        }
Пример #13
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);
            }
        }
Пример #14
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);
            }
        }
Пример #15
0
 private void mapControl_GM_OnKeyUp(object sender, IMapControlEvents2_OnKeyUpEvent e)
 {
     if (e.keyCode == (int)Keys.Delete && mapControl_GM.CurrentTool != null &&
         !mapControl_GM.CurrentTool.GetType()
         .FullName.Equals("ESRI.ArcGIS.Controls.ControlsEditingEditToolClass"))
     {
         DataEditCommon.DeleteAllSelection();
     }
 }
Пример #16
0
 public override void OnDblClick()
 {
     if (pFeature != null)
     {
         var AnnoLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_AnnotationXZZ) as IFeatureLayer;//×¢¼Çͼ²ã
         if (AnnoLayer == null)
         {
             return;
         }
         string bid = pFeature.get_Value(pFeature.Fields.FindField("bid")).ToString();
         Form.Text = "ÐÞ¸ÄСÖù×´";
         Form.Tag  = bid;
         IFeatureClass pFeatureClass = AnnoLayer.FeatureClass;
         IQueryFilter  pFilter       = new QueryFilterClass();
         pFilter.WhereClause = "bid='" + bid + "'";
         IFeatureCursor pCursor  = pFeatureClass.Search(pFilter, false);
         IFeature       mFeature = pCursor.NextFeature();
         int            k        = 0;
         int            count    = pFeatureClass.FeatureCount(pFilter);
         System.Collections.Generic.KeyValuePair <int, string>[] listobj = new System.Collections.Generic.KeyValuePair <int, string> [count];
         while (mFeature != null)
         {
             if (k == 0)
             {
                 Form.txtAngle.Text = mFeature.get_Value(mFeature.Fields.FindField("strAngle")).ToString();
                 Form.txtBlc.Text   = mFeature.get_Value(mFeature.Fields.FindField("strScale")).ToString();
                 Form.txtX.Text     = mFeature.get_Value(mFeature.Fields.FindField("strX")).ToString();
                 Form.txtY.Text     = mFeature.get_Value(mFeature.Fields.FindField("strY")).ToString();
             }
             int    index = Convert.ToInt32(mFeature.get_Value(mFeature.Fields.FindField("strIndex")).ToString());
             int    type  = Convert.ToInt32(mFeature.get_Value(mFeature.Fields.FindField("strType")).ToString());
             string str   = mFeature.get_Value(mFeature.Fields.FindField("TextString")).ToString();
             listobj[index - 1] = new System.Collections.Generic.KeyValuePair <int, string>(type, str);
             mFeature           = pCursor.NextFeature();
             k++;
         }
         if (listobj.Length > 0)
         {
             Form.dgrdvZhzzt.RowCount = listobj.Length;
             for (int i = 0; i < listobj.Length - 1; i++)
             {
                 Form.dgrdvZhzzt.Rows[i].Cells[0].Value = listobj[i].Value;
                 DataGridViewComboBoxCell cell = Form.dgrdvZhzzt.Rows[i].Cells[1] as DataGridViewComboBoxCell;
                 if (listobj[i].Key == 0)
                 {
                     cell.Value = "ÑÒ²ã";
                 }
                 else
                 {
                     cell.Value = "ú²ã";
                 }
             }
             Form.txtDBBG.Text = listobj[listobj.Length - 1].Value;
         }
     }
 }
Пример #17
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            IPoint pMovePt = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);

            pMovePt = GIS.GraphicEdit.SnapSetting.getSnapPoint(pMovePt);
            IFeature pFeature = DataEditCommon.CreateUndoRedoFeature(m_featureLayer, pMovePt);

            m_hookHelper.FocusMap.SelectFeature(m_featureLayer, pFeature);
            m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
        }
Пример #18
0
        /// <summary>
        ///     带参数的构造方法
        /// </summary>
        public FaultageInfoEntering(Faultage faultage)
        {
            InitializeComponent();
            Faultage = faultage;
            // 设置窗体默认属性
            FormDefaultPropertiesSetter.SetEnteringFormDefaultProperties(this, Const_GM.UPDATE_FAULTAGE_INFO);

            // 设置断层信息
            // 断层名称
            txtFaultageName.Text = Faultage.FaultageName;
            // 落差
            txtGap.Text = Faultage.Gap;
            // 倾角
            txtAngle.Text = Faultage.Angle.ToString(CultureInfo.InvariantCulture);
            // 类型
            if (Const_GM.FRONT_FAULTAGE.Equals(Faultage.Type))
            {
                rbtnFrontFaultage.Checked = true;
            }
            else
            {
                rbtnOppositeFaultage.Checked = true;
            }
            // 走向
            txtTrend.Text = Faultage.Trend.ToString(CultureInfo.InvariantCulture);
            // 断距
            txtSeparation.Text = Faultage.Separation;
            // 坐标X
            txtCoordinateX.Text = Faultage.CoordinateX.ToString(CultureInfo.InvariantCulture);
            // 坐标Y
            txtCoordinateY.Text = Faultage.CoordinateY.ToString(CultureInfo.InvariantCulture);
            // 坐标Z
            txtCoordinateZ.Text = Faultage.CoordinateZ.ToString(CultureInfo.InvariantCulture);
            //长度
            var bid          = Faultage.BindingId;
            var pLayer       = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_EXPOSE_FAULTAGE);
            var featureLayer = (IFeatureLayer)pLayer;

            if (pLayer == null)
            {
                txtLength.Text = @"0";
                return;
            }
            var pFeature = MyMapHelp.FindFeatureByWhereClause(featureLayer, "BID='" + bid + "'");

            if (pFeature != null)
            {
                var pline = (IPolyline)pFeature.Shape;
                if (pline == null)
                {
                    return;
                }
                txtLength.Text = Math.Round(pline.Length).ToString(CultureInfo.InvariantCulture);
            }
        }
Пример #19
0
        /// <summary>
        /// 插入新要素
        /// </summary>
        /// <param name="featureLayer">图层</param>
        /// <param name="geom">插入要素几何图形</param>
        /// <param name="ID">要素ID(绑定ID)</param>
        /// <returns></returns>
        public static bool InsertNewFeature(IFeatureLayer featureLayer, IGeometry geom, string ID)
        {
            IWorkspaceEdit workspaceEdit = null;
            IFeatureCursor featureCursor = null;

            try
            {
                IFeatureClass featureClass = featureLayer.FeatureClass;

                IDataset   dataset   = (IDataset)featureClass;
                IWorkspace workspace = dataset.Workspace;
                workspaceEdit = workspace as IWorkspaceEdit;

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

                IFeatureBuffer featureBuffer = featureClass.CreateFeatureBuffer();
                DataEditCommon.ZMValue(featureBuffer, geom);    //几何图形Z值处理
                featureBuffer.Shape = geom;

                int iFieldID = featureBuffer.Fields.FindField("ID");
                featureBuffer.Value[iFieldID] = ID.ToString();

                //开始插入要素
                featureCursor = featureClass.Insert(true);
                object featureOID = featureCursor.InsertFeature(featureBuffer);

                //保存要素
                featureCursor.Flush();

                IFeature feature = featureCursor.NextFeature();

                workspaceEdit.StopEditOperation();
                workspaceEdit.StopEditing(true);

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

                workspaceEdit.AbortEditOperation();
                workspaceEdit.StopEditing(false);

                return(false);
            }
            finally
            {
                if (featureCursor != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(featureCursor);  //释放指针
                }
            }
        }
Пример #20
0
        /// <summary>
        ///     带参数的构造方法
        /// </summary>
        public FaultageInfoEntering(Faultage faultage)
        {
            InitializeComponent();
            Faultage = faultage;

            // 设置断层信息
            // 断层名称
            txtFaultageName.Text = Faultage.name;
            // 落差
            txtGap.Text = Faultage.gap;
            // 倾角
            txtAngle.Text = Faultage.angle.ToString(CultureInfo.InvariantCulture);
            // 类型
            if (Faultage.type == "正断层")
            {
                rbtnFrontFaultage.Checked = true;
            }
            else
            {
                rbtnOppositeFaultage.Checked = true;
            }
            // 走向
            txtTrend.Text = Faultage.trend.ToString(CultureInfo.InvariantCulture);
            // 断距
            txtSeparation.Text = Faultage.separation;
            // 坐标X
            txtCoordinateX.Text = Faultage.coordinate_x.ToString(CultureInfo.InvariantCulture);
            // 坐标Y
            txtCoordinateY.Text = Faultage.coordinate_y.ToString(CultureInfo.InvariantCulture);
            // 坐标Z
            txtCoordinateZ.Text = Faultage.coordinate_z.ToString(CultureInfo.InvariantCulture);
            //长度
            var bid          = Faultage.bid;
            var pLayer       = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_EXPOSE_FAULTAGE);
            var featureLayer = (IFeatureLayer)pLayer;

            if (pLayer == null)
            {
                txtLength.Text = @"0";
                return;
            }
            var pFeature = MyMapHelp.FindFeatureByWhereClause(featureLayer, "BID='" + bid + "'");

            if (pFeature != null)
            {
                var pline = (IPolyline)pFeature.Shape;
                if (pline == null)
                {
                    return;
                }
                txtLength.Text = Math.Round(pline.Length).ToString(CultureInfo.InvariantCulture);
            }
        }
Пример #21
0
        /// <summary>
        /// 点击事件
        /// </summary>
        public override void OnClick()
        {
            IFeature     pFeature;
            IEnumFeature pEnumFeature;

            // Get a cursor on selected features
            IFeatureCursor cursor = null;

            pEnumFeature = DataEditCommon.g_pAxMapControl.Map.FeatureSelection as IEnumFeature;

            IFeatureLayer feaLayer = DataEditCommon.g_pLayer as IFeatureLayer;

            //pEnumFeature = DataEditCommon.g_engineEditor.EditSelection;
            //int selectionCnt = DataEditCommon.g_engineEditor.SelectionCount;
            //// 没有选中任何图形
            //if (selectionCnt <= 0)
            //{
            //    return;
            //}

            if (pEnumFeature == null)
            {
                return;
            }
            pEnumFeature.Reset();
            pFeature = pEnumFeature.Next();
            if (pFeature == null)
            {
                System.Windows.Forms.MessageBox.Show("请先选择要删除的图元!");
                return;
            }
            DataEditCommon.InitEditEnvironment();
            DataEditCommon.CheckEditState();
            DataEditCommon.g_engineEditor.StartOperation();
            //DataEditCommon.g_CurWorkspaceEdit.StartEditOperation();
            do
            {
                int    iFieldBID = pFeature.Fields.FindField(GIS_Const.FIELD_OBJECTID);//图层中对应绑定ID字段
                string sObjId    = pFeature.get_Value(iFieldBID).ToString();

                //pFeature.Delete();
                //RefreshModifyFeature((IObject)pFeature);

                DataEditCommon.DeleteFeatureByObjectId(feaLayer, sObjId);
                RefreshModifyFeature((IObject)pFeature);

                pFeature = pEnumFeature.Next();
            }while (pFeature != null);
            //DataEditCommon.g_CurWorkspaceEdit.StopEditOperation();
            DataEditCommon.g_engineEditor.StopOperation("Delete Feature");
            DataEditCommon.g_pMap.ClearSelection();
            DataEditCommon.g_pMyMapCtrl.ActiveView.Refresh();
        }
Пример #22
0
        /// <summary>
        ///     图显按钮事件
        /// </summary>
        /// <params name="sender"></params>
        /// <params name="e"></params>
        private void btnMap_Click(object sender, EventArgs e)
        {
            // 获取已选择明细行的索引
            int[] iSelIdxsArr = { ((InferFaultage)gridView1.GetFocusedRow()).id };

            var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_INFERRED_FAULTAGE);

            if (pLayer == null)
            {
                MessageBox.Show(@"未发现推断断层图层!");
                return;
            }
            var pFeatureLayer = (IFeatureLayer)pLayer;
            var str           = "";

            for (var i = 0; i < iSelIdxsArr.Length; i++)
            {
                var bid = ((InferFaultage)gridView1.GetFocusedRow()).bid;
                if (bid == "")
                {
                    continue;
                }
                if (i == 0)
                {
                    str = "bid='" + bid + "'";
                }
                else
                {
                    str += " or bid='" + bid + "'";
                }
            }
            var list = MyMapHelp.FindFeatureListByWhereClause(pFeatureLayer, str);

            if (list.Count > 0)
            {
                MyMapHelp.Jump(MyMapHelp.GetGeoFromFeature(list));
                DataEditCommon.g_pMap.ClearSelection();
                for (var i = 0; i < list.Count; i++)
                {
                    DataEditCommon.g_pMap.SelectFeature(pLayer, list[i]);
                }
                WindowState = FormWindowState.Normal;
                Location    = DataEditCommon.g_axTocControl.Location;
                Width       = DataEditCommon.g_axTocControl.Width;
                Height      = DataEditCommon.g_axTocControl.Height;
                DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null,
                                                                      DataEditCommon.g_pAxMapControl.Extent);
            }
            else
            {
                Alert.AlertMsg("图元丢失");
            }
        }
Пример #23
0
        public override void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            if (Button != 1)
            {
                return;
            }

            if (m_lMouseDownCount > 2)
            {
                m_lMouseDownCount = 0;
                ISegmentCollection pSegColl     = null;
                IFeatureLayer      featureLayer = m_pCurrentLayer as IFeatureLayer;

                if (featureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)   //创建线要素
                {
                    IPolyline pPolyline;
                    pSegColl = new PolylineClass();
                    pSegColl.AddSegment(m_pCircleArc as ISegment);
                    pPolyline = pSegColl as IPolyline;
                    if (pPolyline.Length < 0.001)
                    {
                        return;
                    }
                    IFeature pFeature = DataEditCommon.CreateUndoRedoFeature(featureLayer, pPolyline);
                    m_hookHelper.FocusMap.SelectFeature(m_pCurrentLayer, pFeature);
                    m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics | esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewBackground, null, null);
                }
                else   //创建面要素
                {
                    IPolygon pPolygon;
                    pSegColl = new PolygonClass();
                    pSegColl.AddSegment(m_pCircleArc as ISegment);
                    pPolygon = pSegColl as IPolygon;
                    pPolygon.Close();
                    if (pPolygon.Length < 0.001)
                    {
                        return;
                    }
                    IFeature pFeature = DataEditCommon.CreateUndoRedoFeature(featureLayer, pPolygon);
                    m_hookHelper.FocusMap.SelectFeature(m_pCurrentLayer, pFeature);
                    m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics | esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewBackground, null, null);
                }

                //局部刷新
                //IInvalidArea pInvalidArea = new InvalidAreaClass();
                //pInvalidArea.Add(pSegColl);
                //pInvalidArea.Display = m_hookHelper.ActiveView.ScreenDisplay;
                //pInvalidArea.Invalidate((short)esriScreenCache.esriAllScreenCaches);

                m_bCreated = true;
            }
        }
Пример #24
0
 //设置捕捉环境
 public static void StartSnappingEnv()
 {
     if (m_bStartSnap)
     {
         m_SnappingEnv = DataEditCommon.GetSnapEnvironment(m_hookHelper, snappingType);
         if (m_SnappingEnv != null)
         {
             m_Snapper          = m_SnappingEnv.PointSnapper;
             m_SnappingFeedback = new SnappingFeedbackClass();
             m_SnappingFeedback.Initialize(m_hookHelper.Hook, m_SnappingEnv);
         }
     }
 }
Пример #25
0
        /// <summary>
        /// 根据绘制的圆形创建要素
        /// </summary>
        /// <params name="pLayer"></params>
        /// <params name="pCircuArc"></params>
        /// <params name="pScreenDisplay"></params>
        private void DrawCircleFeature(ILayer pLayer, ICircularArc pCircuArc, IScreenDisplay pScreenDisplay)
        {
            if (pLayer == null)
            {
                return;
            }
            ISegmentCollection pSegmentCollection = null;

            if (pLayer is IFeatureLayer)
            {
                IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
                IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
                if (pFeatureClass != null)
                {
                    IPolyline pPolyline = null;
                    IPolygon  pPolygon  = null;

                    if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                    {
                        pSegmentCollection = new PolylineClass();
                        pSegmentCollection.AddSegment(pCircuArc as ISegment);
                        pPolyline = pSegmentCollection as IPolyline;
                    }
                    else if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                    {
                        pSegmentCollection = new PolygonClass();
                        pSegmentCollection.AddSegment(pCircuArc as ISegment);
                        pPolygon = pSegmentCollection as IPolygon;
                    }
                    else
                    {
                        return;
                    }
                    IFeature pFeature = null;
                    if (pPolyline != null)
                    {
                        pFeature = DataEditCommon.CreateUndoRedoFeature(pFeatureLayer, pPolyline);
                    }
                    else if (pPolygon != null)
                    {
                        pFeature = DataEditCommon.CreateUndoRedoFeature(pFeatureLayer, pPolygon);
                    }
                    else
                    {
                        return;
                    }
                    m_hookHelper.FocusMap.SelectFeature(m_pCurrentLayer, pFeature);
                    m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics | esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewBackground, null, null);
                }
            }
        }
Пример #26
0
        private bool RedrawHengChuanPolygon(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.ModifyFeature(featureLayer, entity.Id, polygon, list);

            return(feature != null);
        }
Пример #27
0
        private void OnMouseUp()
        {
            if (m_lMouseDownCount != 2)
            {
                return;
            }
            if (m_pEllipticArc == null)
            {
                return;
            }

            m_lMouseDownCount = 0;
            ISegmentCollection pSegColl = null;

            if (m_pEllipticArc.Envelope.Width > 0.001 && m_pEllipticArc.Envelope.Height > 0.001)
            {
                m_pCurrentLayer = DataEditCommon.g_pLayer;
                IFeatureLayer featureLayer = m_pCurrentLayer as IFeatureLayer;

                if (featureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)   //创建线要素
                {
                    IPolyline pPolyline;
                    pSegColl = new PolylineClass();
                    pSegColl.AddSegment(m_pEllipticArc as ISegment);
                    pPolyline = pSegColl as IPolyline;
                    IFeature pFeature = DataEditCommon.CreateUndoRedoFeature(featureLayer, pPolyline);
                    m_hookHelper.FocusMap.SelectFeature(m_pCurrentLayer, pFeature);
                    m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics | esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewBackground, null, null);
                }
                if (featureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)   //创建面要素
                {
                    IPolygon pPolygon;
                    pSegColl = new PolygonClass();
                    pSegColl.AddSegment(m_pEllipticArc as ISegment);
                    pPolygon = pSegColl as IPolygon;
                    IFeature pFeature = DataEditCommon.CreateUndoRedoFeature(featureLayer, pPolygon);
                    m_hookHelper.FocusMap.SelectFeature(m_pCurrentLayer, pFeature);
                    m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics | esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewBackground, null, null);
                }

                //局部刷新
                IInvalidArea pInvalidArea = new InvalidAreaClass();
                pInvalidArea.Add(pSegColl);
                pInvalidArea.Display = m_hookHelper.ActiveView.ScreenDisplay;
                pInvalidArea.Invalidate((short)esriScreenCache.esriAllScreenCaches);

                m_bCreated = true;
            }
        }
Пример #28
0
        /// <summary>
        /// 点击事件
        /// </summary>
        public override void OnClick()
        {
            DataEditCommon.InitEditEnvironment();
            DataEditCommon.CheckEditState();
            m_featureLayer = DataEditCommon.g_pLayer as IFeatureLayer;
            if (m_featureLayer == null)
            {
                MessageBox.Show(@"请选择图层。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DataEditCommon.g_pMyMapCtrl.CurrentTool = null;
                return;
            }
            DataEditCommon.g_engineEditLayers.SetTargetLayer(m_featureLayer, 0);

            DataEditCommon.g_pMyMapCtrl.CurrentTool = (ITool)m_command;
        }
Пример #29
0
        public override void OnClick()
        {
            DataEditCommon.InitEditEnvironment();
            DataEditCommon.CheckEditState();
            ILayer        pLayer        = GIS.Common.DataEditCommon.g_pLayer;
            IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer;
            IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;

            if (pFeatureClass.FeatureType != esriFeatureType.esriFTAnnotation)
            {
                MessageBox.Show(@"请选择文字注记(标注)图层。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DataEditCommon.g_pMyMapCtrl.CurrentTool = null;
                return;
            }
        }
Пример #30
0
        private void btnMap_Click(object sender, EventArgs e)
        {
            var faultage = (Faultage)gridView1.GetFocusedRow();
            var bid      = faultage.bid;
            var pLayer   = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_EXPOSE_FAULTAGE);

            if (pLayer == null)
            {
                MessageBox.Show(@"未发现揭露断层图层!");
                return;
            }
            var pFeatureLayer = (IFeatureLayer)pLayer;
            var str           = "";

            //for (int i = 0; i < iSelIdxsArr.Length; i++)
            //{
            if (bid != "")
            {
                if (true)
                {
                    str = "bid='" + bid + "'";
                }
                //else
                //    str += " or bid='" + bid + "'";
            }
            //}
            var list = MyMapHelp.FindFeatureListByWhereClause(pFeatureLayer, str);

            if (list.Count > 0)
            {
                MyMapHelp.Jump(MyMapHelp.GetGeoFromFeature(list));
                DataEditCommon.g_pMap.ClearSelection();
                foreach (var t in list)
                {
                    DataEditCommon.g_pMap.SelectFeature(pLayer, t);
                }
                WindowState = FormWindowState.Normal;
                Location    = DataEditCommon.g_axTocControl.Location;
                Width       = DataEditCommon.g_axTocControl.Width;
                Height      = DataEditCommon.g_axTocControl.Height;
                DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null,
                                                                      DataEditCommon.g_pAxMapControl.Extent);
            }
            else
            {
                Alert.AlertMsg("图元丢失");
            }
        }