Esempio n. 1
0
        /// <summary>
        /// 创建要素
        /// </summary>
        /// <param name="pGeometry"></param>
        private void CreateFeature(IGeometry pGeometry)
        {
            try
            {
                if (m_EngineEditLayers == null) return;
                IFeatureLayer pFeatLyr = m_EngineEditLayers.TargetLayer;
                if (pFeatLyr == null) return;
                IFeatureClass pFeatCls = pFeatLyr.FeatureClass;
                if (pFeatCls == null) return;
                if (m_EngineEditor == null) return;
                if (pGeometry == null) return;
                ITopologicalOperator pTop = pGeometry as ITopologicalOperator;
                pTop.Simplify();
                IGeoDataset pGeoDataset = pFeatCls as IGeoDataset;
                if (pGeoDataset.SpatialReference != null)
                {
                    pGeometry.Project(pGeoDataset.SpatialReference);
                }
                m_EngineEditor.StartOperation();
                IFeature pFeature = null;
                pFeature = pFeatCls.CreateFeature();
                pFeature.Shape = SupportZMFeatureClass.ModifyGeomtryZMValue(pFeatCls, pGeometry);
                pFeature.Store();
                m_EngineEditor.StopOperation("添加要素");
                m_Map.SelectFeature(pFeatLyr, pFeature);
                m_activeView.Refresh();
            }
            catch (Exception ex)
            {

            }
        }
Esempio n. 2
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            double offsetValue = -1;

            try
            {
                offsetValue = Convert.ToDouble(textEdit1.Text);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("请输入数值类型", "提示信息", MessageBoxButtons.OK);
                return;
            }
            try
            {
                //启动编辑
                IFeatureLayer featureLayer  = mLayer as IFeatureLayer;
                IFeatureClass pFeatureClass = featureLayer.FeatureClass;

                IWorkspace    workspace     = null;
                IEngineEditor mEngineEditor = mEngineEditor = new EngineEditorClass();
                if (pFeatureClass.FeatureDataset != null)
                {
                    workspace = pFeatureClass.FeatureDataset.Workspace;
                    mEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
                    mEngineEditor.StartEditing(workspace, mMap);
                    ((IEngineEditLayers)mEngineEditor).SetTargetLayer(featureLayer, -1);
                    mEngineEditor.StartOperation();
                }



                ISelectionSet mSelectionSet = (mLayer as IFeatureSelection).SelectionSet;
                ICursor       mCursor;
                mSelectionSet.Search(null, false, out mCursor);

                IFeature mFeature = mCursor.NextRow() as IFeature;
                while (mFeature != null)
                {
                    IGeometry  geometry  = mFeature.ShapeCopy;
                    IPolycurve polycurve = geometry as IPolycurve;
                    polycurve.Smooth(offsetValue);
                    mFeature.Shape = polycurve as IGeometry;
                    mFeature.Store();
                    mFeature = mCursor.NextRow() as IFeature;
                }
                if (workspace != null)
                {
                    mEngineEditor.StopEditing(true);
                }

                this.Dispose();
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("平滑失败", "提示信息", MessageBoxButtons.OK);
            }
        }
 public void OnClick()
 {
     try
     {
         m_Map              = m_hookHelper.FocusMap;
         m_activeView       = m_Map as IActiveView;
         m_EngineEditor     = MapManager.EngineEditor;
         m_EngineEditLayers = MapManager.EngineEditor as IEngineEditLayers;
         if (m_EngineEditor == null)
         {
             return;
         }
         if (m_EngineEditor.EditState != esriEngineEditState.esriEngineStateEditing)
         {
             return;
         }
         if (m_EngineEditLayers == null)
         {
             return;
         }
         IFeatureLayer pFeatLyr = m_EngineEditLayers.TargetLayer;
         if (pFeatLyr == null)
         {
             return;
         }
         IFeatureClass pFeatCls = pFeatLyr.FeatureClass;
         if (pFeatCls == null)
         {
             return;
         }
         IFeatureCursor pFeatCur = MapManager.GetSelectedFeatures(pFeatLyr);
         if (pFeatCur == null)
         {
             MessageBox.Show("请选择要删除的要素!", "提示",
                             MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         m_EngineEditor.StartOperation();
         IFeature pFeature = pFeatCur.NextFeature();
         if (MessageBox.Show("是否删除所选要素?", "提示", MessageBoxButtons.YesNo,
                             MessageBoxIcon.Information) == DialogResult.Yes)
         {
             while (pFeature != null)
             {
                 pFeature.Delete();
                 pFeature = pFeatCur.NextFeature();
             }
         }
         System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatCur);
         m_EngineEditor.StopOperation("DelFeatureCommand");
         m_activeView.Refresh();
     }
     catch (Exception ex)
     {
         //SysLogHelper.WriteOperationLog("要素删除错误", ex.Source, "数据编辑");
     }
 }
Esempio n. 4
0
        public void OnFinishSketch()
        {
            //get reference to featurelayer being edited
            IFeatureLayer featureLayer = m_editLayer.TargetLayer as IFeatureLayer;
            //get reference to the sketch geometry
            IGeometry reshapeGeom = m_editSketch.Geometry;

            if (reshapeGeom.IsEmpty == false)
            {
                //get the currently selected feature
                IFeatureSelection featureSelection = featureLayer as IFeatureSelection;
                ISelectionSet     selectionSet     = featureSelection.SelectionSet;
                ICursor           cursor;
                selectionSet.Search(null, false, out cursor);
                IFeatureCursor featureCursor = cursor as IFeatureCursor;
                //the PerformSketchToolEnabledChecks property has already checked that only 1 feature is selected
                IFeature feature = featureCursor.NextFeature();

                //Take a copy of geometry for the selected feature
                IGeometry editShape = feature.ShapeCopy;

                //create a path from the editsketch geometry
                IPointCollection reshapePath = new PathClass();
                reshapePath.AddPointCollection(reshapeGeom as IPointCollection);

                //reshape the selected feature
                IPolyline polyline = editShape as IPolyline;
                polyline.Reshape(reshapePath as IPath);

                #region Perform an edit operation to store the new geometry for selected feature

                try
                {
                    m_engineEditor.StartOperation();
                    feature.Shape = editShape;
                    feature.Store();
                    m_engineEditor.StopOperation("Reshape Feature");
                }
                catch (Exception ex)
                {
                    m_engineEditor.AbortOperation();
                    System.Diagnostics.Trace.WriteLine(ex.Message, "Reshape Geometry Failed");
                }

                #endregion
            }

            //refresh the display
            IActiveView activeView = m_engineEditor.Map as IActiveView;
            activeView.PartialRefresh(esriViewDrawPhase.esriViewGeography, (object)featureLayer, activeView.Extent);
        }
Esempio n. 5
0
 /// <summary>
 /// 创建要素
 /// </summary>
 /// <param name="geometry"></param>
 private void CreateFeature(IGeometry geometry)
 {
     try
     {
         if (engineEditLayers == null)
         {
             return;
         }
         IFeatureLayer featureLayer = engineEditLayers.TargetLayer;
         if (featureLayer == null)
         {
             return;
         }
         IFeatureClass featureClass = featureLayer.FeatureClass;
         if (featureClass == null)
         {
             return;
         }
         if (engineEditor == null)
         {
             return;
         }
         if (geometry == null)
         {
             return;
         }
         ITopologicalOperator topologicalOperator = geometry as ITopologicalOperator;
         topologicalOperator.Simplify();
         IGeoDataset geoDataset = featureClass as IGeoDataset;
         if (geoDataset.SpatialReference != null)
         {
             geometry.Project(geoDataset.SpatialReference);
         }
         engineEditor.StartOperation();
         IFeature feature = null;
         feature       = featureClass.CreateFeature();
         feature.Shape = SupportZMFeatureClass.ModifyGeometryZMValue(featureClass, geometry);
         feature.Store();
         engineEditor.StopOperation("添加要素");
         map.SelectFeature(featureLayer, feature);
         activeView.Refresh();
     }
     catch (Exception exception)
     {}
 }
Esempio n. 6
0
        private void startEdit_ToolbarItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            IBasicMap          map           = null;
            ILayer             selectedLayer = null;
            object             unk           = null;
            object             data          = null;
            esriTOCControlItem item          = esriTOCControlItem.esriTOCControlItemNone;

            m_tocControl.GetSelectedItem(ref item, ref map, ref selectedLayer, ref unk, ref data);

            if (item == esriTOCControlItem.esriTOCControlItemLayer)
            {
                // 启动编辑
                if (pEngineEditor.EditState != esriEngineEditState.esriEngineStateNotEditing)
                {
                    return;
                }

                IFeatureLayer featurelayer = selectedLayer as IFeatureLayer;
                IDataset      dataset      = featurelayer.FeatureClass as IDataset;
                IWorkspace    workspace    = dataset.Workspace;

                pEngineEditor.StartEditing(workspace, m_mapControl.Map);
                ((IEngineEditLayers)pEngineEditor).SetTargetLayer(featurelayer, -1);

                pEngineEditor.StartOperation();

                // 设置目标图层
                IEngineEditLayers pEditLayer = pEngineEditor as IEngineEditLayers;
                pEditLayer.SetTargetLayer(featurelayer, 0);
                targetLayer_ToolbarText.Caption += " " + featurelayer.Name;

                featureEditor_ToolbarItem_ItemClick(null, null);

                featureEditToolbar.Visible = true;
            }
            ICommand pcommand = new ControlsEditingStartCommand();

            pcommand.OnCreate(m_mapControl.Object);
            pcommand.OnClick();
        }
Esempio n. 7
0
        /// <summary>
        /// 编辑所选图层
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editLayer_ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            pEngineEditor = new EngineEditorClass();
            IBasicMap          map           = null;
            ILayer             selectedLayer = null;
            object             unk           = null;
            object             data          = null;
            esriTOCControlItem item          = esriTOCControlItem.esriTOCControlItemNone;

            m_tocControl.GetSelectedItem(ref item, ref map, ref selectedLayer, ref unk, ref data);

            if (item == esriTOCControlItem.esriTOCControlItemLayer)
            {
                //启动编辑
                if (pEngineEditor.EditState != esriEngineEditState.esriEngineStateNotEditing)
                {
                    return;
                }
                IFeatureLayer featurelayer = selectedLayer as IFeatureLayer;
                IDataset      dataset      = featurelayer.FeatureClass as IDataset;
                IWorkspace    workspace    = dataset.Workspace;

                pEngineEditor.StartEditing(workspace, m_mapControl.Map);
                ((IEngineEditLayers)pEngineEditor).SetTargetLayer(featurelayer, -1);

                pEngineEditor.StartOperation();

                //设置目标图层
                IEngineEditLayers pEditLayer = pEngineEditor as IEngineEditLayers;
                pEditLayer.SetTargetLayer(featurelayer, 0);
                m_editinglayer.Caption += " " + featurelayer.Name;

                ICommand t_editcommand = new ESRI.ArcGIS.Controls.ControlsEditingEditToolClass();
                t_editcommand.OnCreate(m_mapControl.Object);
                m_mapControl.CurrentTool = t_editcommand as ITool;
                t_editcommand.OnClick();

                map_edittools.Visible = true;
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 根据参考线要素,对选择的线要素进行延伸
        /// </summary>
        /// <param name="featExtend">待延伸的线要素</param>
        /// <param name="featRef">参考线要素</param>
        /// <returns>成功返回True</returns>
        public bool ExtendLine(IFeature featExtend, IFeature featRef)
        {
            try
            {
                ISegmentCollection extendSegCol = featExtend.ShapeCopy as ISegmentCollection;
                ISegmentCollection refSegCol    = featRef.Shape as ISegmentCollection;

                ICurve extendCurve = extendSegCol as ICurve;
                ICurve refCurve    = refSegCol as ICurve;

                bool            bExtensionPerformed = false;
                IConstructCurve constructCurve      = new PolylineClass();
                constructCurve.ConstructExtended(extendCurve, refCurve, 0, ref bExtensionPerformed);

                if (bExtensionPerformed)   //延伸成功
                {
                    IPolyline resultPolyline = constructCurve as IPolyline;
                    if (resultPolyline != null)
                    {
                        m_engineEditor.StartOperation();

                        featExtend.Shape = resultPolyline as IGeometry;
                        featExtend.Store();

                        m_engineEditor.StopOperation("Extend Features");
                        m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                        m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, resultPolyline.Envelope);

                        return(bExtensionPerformed);
                    }
                }
                return(false);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message, "Extend Line");
                return(false);
            }
        }
Esempio n. 9
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            if (Button != 1)
            {
                return;
            }

            IPoint pMousePnt = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);

            pMousePnt = GIS.GraphicEdit.SnapSetting.getSnapPoint(pMousePnt);
            IGeometry pgeo = GIS.Common.DataEditCommon.g_pMyMapCtrl.TrackRectangle() as IGeometry;

            if (pgeo.IsEmpty)
            {
                return;
            }
            mGeo = pgeo;
            m_hookHelper.FocusMap.SelectByShape(pgeo, null, false);


            m_FeatureTrim = GetTrimLine();
            if (m_FeatureTrim != null)
            {
                if (TrimLine(m_FeatureTrim, m_FeatureRef, pMousePnt))   //开始裁剪,若打断成功,则删除选中这端
                {
                    m_hookHelper.FocusMap.SelectByShape(pgeo, null, false);
                    m_FeatureTrim = GetTrimLine();
                    if (m_engineEditor != null)
                    {
                        m_engineEditor.StartOperation();
                        m_FeatureTrim.Delete();
                        m_engineEditor.StopOperation("Delete Features");
                    }
                }
            }
            m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewGeography, null, m_hookHelper.ActiveView.Extent);
        }
Esempio n. 10
0
 private void gridViewAttribute_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (_gisEdit == null)
         {
             return;
         }
         if (pFeature == null)
         {
             return;
         }
         _gisEdit.StartOperation();
         int    pIndex      = gridViewAttribute.CurrentCell.RowIndex;
         object sFieldValue = gridViewAttribute.Rows[pIndex].Cells[1].Value;
         string sFieldName  = gridViewAttribute.Rows[pIndex].Cells[0].Value.ToString();
         pFeature.set_Value(pFeature.Fields.FindField(sFieldName), sFieldValue);
         pFeature.Store();
         _gisEdit.StopOperation("属性编辑");
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 11
0
 private void DelVertexNode(IPoint pPnt)
 {
     try
     {
         IFeatureLayer pFeaturelayer = m_EngineEditLayers.TargetLayer;
         IActiveView   pActiveView   = m_activeView;
         IPoint        pPoint        = pPnt;
         if (pFeaturelayer.FeatureClass == null)
         {
             return;
         }
         //如果不是面状地物则退出
         if (pFeaturelayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryEnvelope &&
             pFeaturelayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolygon &&
             pFeaturelayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryLine &&
             pFeaturelayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolyline)
         {
             return;
         }
         IGeometry pGeo        = null;
         IFeature  pSelFeature = null;
         pSelFeature = EditVertexClass.GetSelectedFeature(pFeaturelayer);
         //是否有选中的几何体
         if (pSelFeature == null)
         {
             return;
         }
         pGeo = pSelFeature.ShapeCopy;
         double pSrchDis = 0;
         double pHitDis  = 0;
         pSrchDis = pActiveView.Extent.Width / 200;
         pPoint.Z = 0;
         int              pIndex       = 0;
         IElement         pElement     = null;
         IHitTest         pHtTest      = null;
         bool             pBoolHitTest = false;
         IPoint           pPtHit       = null;
         IPointCollection pPointCol    = null;
         IPolygon         pPolygon     = null;
         IPolyline        pPyline      = null;
         bool             bRightZSide  = true;
         int              pInt         = 0;
         m_EngineEditor.StartOperation();
         //删除面状要素的节点
         if (pFeaturelayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon ||
             pFeaturelayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryEnvelope)
         {
             pElement          = new PolygonElement();
             pElement.Geometry = pSelFeature.Shape;
             IPolygon pPoly = null;
             pPoly        = pElement.Geometry as IPolygon;
             pHtTest      = pPoly as IHitTest;
             pBoolHitTest = pHtTest.HitTest(pPoint, pSrchDis, esriGeometryHitPartType.esriGeometryPartVertex,
                                            pPtHit, ref pHitDis, ref pInt, ref pIndex, ref bRightZSide);
             if (pBoolHitTest == false)
             {
                 return;
             }
             EditVertexClass.pHitPnt = pPtHit;
             pPointCol = pSelFeature.ShapeCopy as IPointCollection;
             //如果多边形的节点只有3个则不能再删除了
             if (pPointCol.PointCount <= 4)
             {
                 MessageBox.Show("多边形的节点至少需要3个!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
             //顶点删除
             pPointCol.RemovePoints(pIndex, 1);
             pPolygon = pPointCol as IPolygon;
             pPolygon.Close();
             pSelFeature.Shape = pPolygon;
             pSelFeature.Store();
         }
         //删除线状要素的节点
         else if (pFeaturelayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline ||
                  pFeaturelayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryLine)
         {
             pElement          = new LineElement();
             pElement.Geometry = pSelFeature.Shape;
             IPolyline pPolyLine = default(IPolyline);
             pPolyLine    = pElement.Geometry as IPolyline;
             pHtTest      = pPolyLine as IHitTest;
             pBoolHitTest = pHtTest.HitTest(pPoint, pSrchDis, esriGeometryHitPartType.esriGeometryPartVertex,
                                            pPtHit, ref pHitDis, ref pInt, ref pIndex, ref bRightZSide);
             if (pBoolHitTest == false)
             {
                 return;
             }
             EditVertexClass.pHitPnt = pPtHit;
             pPointCol = pSelFeature.ShapeCopy as IPointCollection;
             //如果Polyline节点只有2个则不能再删除了
             if (pPointCol.PointCount <= 2)
             {
                 MessageBox.Show("线的节点至少需要2个!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
             //顶点删除
             pPointCol.RemovePoints(pIndex, 1);
             pPyline           = pPointCol as IPolyline;
             pSelFeature.Shape = pPyline;
             pSelFeature.Store();
         }
         //与选中点坐标相同的节点都删除
         for (int i = 0; i <= pPointCol.PointCount - 1; i++)
         {
             if (i > pPointCol.PointCount - 1)
             {
                 break;
             }
             if (pPointCol.get_Point(i).X == pPoint.X & pPointCol.get_Point(i).Y == pPoint.Y)
             {
                 pPointCol.RemovePoints(i, 1);
                 i = i - 1;
             }
         }
         //停止编辑
         m_EngineEditor.StopOperation("DelVertexTool");
         //显示顶点
         EditVertexClass.ShowAllVertex(pFeaturelayer);
         m_activeView.Refresh();
     }
     catch (Exception ex)
     {
         m_activeView.Refresh();
     }
 }
Esempio n. 12
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            if (Button != 1)
            {
                return;
            }

            IWorkspace workspace = null;

            #region……分割面

            //根据已选择的要分割的要素的类型绘制分割线

            if (((IFeatureLayer)mLayer).FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)

            {//分割线的样式
                IScreenDisplay pScreenDisplay = pMapControl.ActiveView.ScreenDisplay;

                ISimpleLineSymbol pLineSymbol = new SimpleLineSymbolClass();

                IRgbColor pRgbColor = new RgbColorClass();

                pRgbColor.Red = 255;

                pLineSymbol.Color = pRgbColor;

                IRubberBand pRubberBand = new RubberLineClass();

                IPolyline pPolyline = (IPolyline)pRubberBand.TrackNew(pScreenDisplay, (ISymbol)pLineSymbol);

                pScreenDisplay.StartDrawing(pScreenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);

                pScreenDisplay.SetSymbol((ISymbol)pLineSymbol);

                pScreenDisplay.DrawPolyline(pPolyline);

                pScreenDisplay.FinishDrawing();



                //清理将被分割的要素

                ITopologicalOperator pTopoOpo;

                pTopoOpo = pPolyline as ITopologicalOperator;

                pTopoOpo.Simplify();//确保几何体的拓扑正确

                //开始编辑

                IFeatureLayer featureLayer  = mLayer as IFeatureLayer;
                IFeatureClass pFeatureClass = featureLayer.FeatureClass;


                IEngineEditor mEngineEditor = mEngineEditor = new EngineEditorClass();
                if (pFeatureClass.FeatureDataset != null)
                {
                    workspace = pFeatureClass.FeatureDataset.Workspace;
                    mEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
                    mEngineEditor.StartEditing(workspace, mMap);
                    ((IEngineEditLayers)mEngineEditor).SetTargetLayer(featureLayer, -1);
                    mEngineEditor.StartOperation();
                }



                //分割方法


                SplitPolygon(pFeatureClass, pPolyline);

                ReBackStates();//刷新返回修改工具

                pMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, pMapControl.ActiveView.Extent);
                //  mEngineEditor.StopEditing(true);
            }

            #endregion



            #region……鼠标画线分割线

            //根据分割要素的类型绘制分割线

            if (((IFeatureLayer)mLayer).FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)

            {
                IScreenDisplay pScreenDisplay = pMapControl.ActiveView.ScreenDisplay;

                ISimpleLineSymbol pLineSymbol = new SimpleLineSymbolClass();

                IRgbColor pRgbColor = new RgbColorClass();

                pRgbColor.Red = 255;

                pLineSymbol.Color = pRgbColor;

                IRubberBand pRubberBand = new RubberLineClass();

                IPolyline pPolyline = (IPolyline)pRubberBand.TrackNew(pScreenDisplay, (ISymbol)pLineSymbol);

                pScreenDisplay.StartDrawing(pScreenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);

                pScreenDisplay.SetSymbol((ISymbol)pLineSymbol);

                pScreenDisplay.DrawPolyline(pPolyline);

                pScreenDisplay.FinishDrawing();



                // mEngineEditor.StartOperation();//开启编辑

                IFeatureLayer featureLayer  = mLayer as IFeatureLayer;
                IFeatureClass pFeatureClass = featureLayer.FeatureClass;

                IEngineEditor mEngineEditor = mEngineEditor = new EngineEditorClass();
                if (pFeatureClass.FeatureDataset != null)
                {
                    workspace = pFeatureClass.FeatureDataset.Workspace;
                    mEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
                    mEngineEditor.StartEditing(workspace, mMap);
                    ((IEngineEditLayers)mEngineEditor).SetTargetLayer(featureLayer, -1);
                    mEngineEditor.StartOperation();
                }

                ISelectionSet pSelectionSet = pFeatureClass.Select(null, esriSelectionType.esriSelectionTypeIDSet, esriSelectionOption.esriSelectionOptionNormal, workspace);

                //分割方法

                SplitPolyline(pSelectionSet, pPolyline);



                ReBackStates();

                pMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, pMapControl.ActiveView.Extent);
            }

            #endregion
            if (workspace != null)
            {
                mEngineEditor.StopEditing(true);
            }

            //mEngineEditor.StopOperation("ControlToolsEditing_CreateNewFeatureTask");
        }
        private void EditMouseUp(IPoint pPnt)
        {
            IPolygon       pPolyResult;
            IPolyline      pPolylineResult;
            IFeatureCursor pFeatureCursor;
            IFeature       pFeature;
            IFeatureLayer  pFeatLyr = m_EngineEditLayers.TargetLayer;

            //检查编辑的地物
            if (m_editDispFeed != null)
            {
                switch (m_pHitElem.Geometry.GeometryType)
                {
                case esriGeometryType.esriGeometryLine:
                case esriGeometryType.esriGeometryPolyline:
                    pPolylineResult = m_polylineMvPtFeed.Stop();
                    //作有效性检查
                    if ((pPolylineResult != null))
                    {
                        //更新元素
                        m_pHitElem.Geometry = pPolylineResult;

                        //获取选中的地物
                        pFeatureCursor = MapManager.GetSelectedFeatures(pFeatLyr);
                        if (pFeatureCursor == null)
                        {
                            return;
                        }
                        pFeature = pFeatureCursor.NextFeature();
                        m_EngineEditor.StartOperation();
                        //更新要素形状
                        pFeature.Shape = pPolylineResult;
                        pFeature.Store();
                        //停止编辑
                        m_EngineEditor.StopOperation("MoveVertex");
                        EditVertexClass.ShowAllVertex(pFeatLyr);
                    }
                    break;

                case esriGeometryType.esriGeometryPolygon:
                case esriGeometryType.esriGeometryEnvelope:
                    //得到反馈的结果
                    pPolyResult = m_polyMvPtFeed.Stop();
                    //作有效性检查
                    if (pPolyResult != null)
                    {
                        //更新元素
                        m_pHitElem.Geometry = pPolyResult;
                        //获取选中的地物
                        pFeatureCursor = MapManager.GetSelectedFeatures(pFeatLyr);
                        if (pFeatureCursor == null)
                        {
                            return;
                        }
                        pFeature = pFeatureCursor.NextFeature();
                        m_EngineEditor.StartOperation();
                        //更新要素形状
                        pFeature.Shape = pPolyResult;
                        pFeature.Store();
                        //停止编辑
                        m_EngineEditor.StopOperation("MoveVertex");
                        if (pFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolygon ||
                            pFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline)
                        {
                            EditVertexClass.ShowAllVertex(pFeatLyr);
                        }
                    }
                    IFeature pTempParcel;
                    //定义存储多边形要素的局部变量
                    IPoint pDestPoint;
                    //定义节点移动的目标位置
                    pDestPoint = pPnt;
                    IZAware pZAware = pDestPoint as IZAware;
                    pZAware.ZAware = true;
                    pDestPoint.Z   = 0;
                    //所有包含该节点的多边形都进行操作
                    for (int i = 0; i <= EditVertexClass.m_featArray.Count - 1; i++)
                    {
                        pTempParcel = EditVertexClass.m_featArray.get_Element(i) as IFeature;
                        //记录节点序号
                        int pIndex = 0;
                        pIndex = EditVertexClass.GetVertexIndex(m_fromPoint, pTempParcel.Shape);
                        if (!(pIndex == -2))
                        {
                            ITopologicalOperator pTopoOpt         = default(ITopologicalOperator);
                            IPolygon             pPolygon         = default(IPolygon);
                            IPointCollection     pPolygonPointCol = default(IPointCollection);
                            pPolygonPointCol = pTempParcel.ShapeCopy as IPointCollection;
                            pPolygonPointCol.UpdatePoint(pIndex, pDestPoint);
                            pPolygon = pPolygonPointCol as IPolygon;
                            pPolygon.Close();
                            pTopoOpt = pPolygon as ITopologicalOperator;
                            pTopoOpt.Simplify();
                            pTempParcel.Shape = pPolygon;
                            pTempParcel.Store();
                        }
                    }
                    EditVertexClass.m_featArray.RemoveAll();
                    break;
                }

                //释放内存
                m_polyMvPtFeed     = null;
                m_polylineMvPtFeed = null;
                m_editDispFeed     = null;
                m_pHitElem         = null;
                //刷新地图
                m_activeView.Refresh();
            }
        }
Esempio n. 14
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            try
            {
                pt = ((m_hookHelper.ActiveView.ScreenDisplay).DisplayTransformation).ToMapPoint(X, Y);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            bool ddd = snapEnvironment.SnapPoint(pt);

            if (pMPfeedback != null)
            {
                pMPfeedback.Stop();
            }
            pMPfeedback = null;

            bool hasCut         = false;
            ISet newFeaturesSet = null;

            try
            {
                IFeatureSelection featureSelection = m_editLayer.TargetLayer as IFeatureSelection;
                ISelectionSet     selectionSet     = featureSelection.SelectionSet;
                IEnumIDs          enumIDs          = selectionSet.IDs;
                int iD = enumIDs.Next();
                while (iD != -1) //-1 is reutned after the last valid ID has been reached
                {
                    m_engineEditor.StartOperation();
                    IFeatureClass featureClass = m_editLayer.TargetLayer.FeatureClass;
                    IFeature      feature      = featureClass.GetFeature(iD);
                    // 判断点是否在线上,不是则跳过
                    ITopologicalOperator pto       = feature.Shape as ITopologicalOperator;
                    IGeometry            pgeometry = pto.Intersect(pt, esriGeometryDimension.esriGeometry0Dimension);
                    if (pgeometry.IsEmpty == true)
                    {
                        iD = enumIDs.Next();
                        continue;
                    }
                    IFeatureEdit featureedit = feature as IFeatureEdit;
                    /*ISet*/
                    newFeaturesSet = featureedit.Split(pgeometry);
                    if (newFeaturesSet != null)
                    {
                        newFeaturesSet.Reset();
                        hasCut = true;
                        break;
                    }
                    iD = enumIDs.Next();
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            if (hasCut)
            {
                //如果操作成功,选中切割的两条线
                //IFeatureSelection featureSelection = m_editLayer.TargetLayer as IFeatureSelection;
                //ISelectionSet selectionSet = featureSelection.SelectionSet;
                //for (int i = 0; i < newFeaturesSet.Count; i++)
                //{
                //    selectionSet.Add(((IFeature)newFeaturesSet.Next()).OID);
                //}
                //selectionSet.Refresh();

                //Refresh the display including modified layer and any previously selected component.
                IActiveView activeView = m_engineEditor.Map as IActiveView;
                activeView.PartialRefresh(esriViewDrawPhase.esriViewGeography | esriViewDrawPhase.esriViewGeoSelection, null, activeView.Extent);
                activeView.Refresh();
                //Complete the edit operation.
                m_engineEditor.StopOperation("Split a line");
                // 将当前工具设置为选择工具
                IToolbarControl toolbarctl = m_hookHelper.Hook as IToolbarControl;
                //ICommand com = new ControlsEditingEditToolClass();
                //com.OnCreate(m_mapControl.Object);
                //this.m_mapControl.CurrentTool = com as ITool;
                for (int i = 0; i < toolbarctl.Count; i++)
                {
                    IToolbarItem tbi = toolbarctl.GetItem(i);
                    if (tbi.Command != null && tbi.Command.Name.Equals("ControlToolsEditing_Edit"))
                    {
                        tbi.Command.OnClick();// = true;
                        toolbarctl.CurrentTool = tbi.Command as ITool;
                        IToolbarBuddy toolbarbuddy = (IToolbarBuddy)((IToolbarControl)m_hookHelper.Hook).Buddy;
                        break;
                    }
                }
                //  操作成功后将当前工具置为以前的工具
                //IToolbarBuddy toolbarbuddy = (IToolbarBuddy)((IToolbarControl)m_hookHelper.Hook).Buddy;
                //toolbarbuddy.CurrentTool = oldtool;
                //((IToolbarControl)m_hookHelper.Hook).SetBuddyControl(toolbarbuddy);
                this.Deactivate();
            }
            else
            {
                m_engineEditor.AbortOperation();
                MessageBox.Show("切割点不在线上,未能成功切割选择的线段");
                //重新开始选点
                this.OnClick();
            }
            base.OnMouseDown(Button, Shift, X, Y);
        }
        public void OnFinishSketch()
        {
            if (m_editSketch == null)
            {
                return;
            }

            bool hasCutPolygons = false;

            //Change the cursor to be hourglass shape.
            System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;

            try
            {
                //Get the geometry that performs the cut from the edit sketch.
                IGeometry cutGeometry = m_editSketch.Geometry;

                //The sketch geometry is simplified to deal with a multi-part sketch as well
                //as the case where the sketch loops back over itself.
                ITopologicalOperator2 topoOperator = cutGeometry as ITopologicalOperator2;
                topoOperator.IsKnownSimple_2 = false;
                topoOperator.Simplify();

                //Create the spatial filter to search for features in the target feature class.
                //The spatial relationship we care about is whether the interior of the line
                //intersects the interior of the polygon.
                ISpatialFilter spatialFilter = new SpatialFilterClass();
                spatialFilter.Geometry   = m_editSketch.Geometry;
                spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;

                //Find the polygon features that cross the sketch.
                IFeatureClass  featureClass  = m_editLayer.TargetLayer.FeatureClass;
                IFeatureCursor featureCursor = featureClass.Search(spatialFilter, false);

                //Only do work if there are features that intersect the edit sketch.
                IFeature origFeature = featureCursor.NextFeature();
                if (origFeature != null)
                {
                    //Check the first feature to see if it is ZAware and if it needs to make the
                    //cut geometry ZAware.
                    IZAware zAware = origFeature.Shape as IZAware;
                    if (zAware.ZAware)
                    {
                        zAware        = cutGeometry as IZAware;
                        zAware.ZAware = true;
                    }

                    ArrayList comErrors = new ArrayList();

                    //Start an edit operation so we can have undo/redo.
                    m_engineEditor.StartOperation();

                    //Cycle through the features, cutting with the sketch.
                    while (origFeature != null)
                    {
                        try
                        {
                            //Split the feature. Use the IFeatureEdit::Split method which ensures
                            //the attributes are correctly dealt with.
                            IFeatureEdit featureEdit = origFeature as IFeatureEdit;
                            //Set to hold the new features that are created by the Split.
                            ISet newFeaturesSet = featureEdit.Split(cutGeometry);

                            //New features have been created.
                            if (newFeaturesSet != null)
                            {
                                newFeaturesSet.Reset();
                                hasCutPolygons = true;
                            }
                        }
                        catch (COMException comExc)
                        {
                            comErrors.Add(String.Format("OID: {0}, Error: {1} , {2}", origFeature.OID.ToString(), comExc.ErrorCode, comExc.Message));
                        }
                        finally
                        {
                            //Continue to work on the next feature if it fails to split the current one.
                            origFeature = featureCursor.NextFeature();
                        }
                    }
                    //If any polygons were cut, refresh the display and stop the edit operation.
                    if (hasCutPolygons)
                    {
                        //Clear the map's selection.
                        m_engineEditor.Map.ClearSelection();

                        //Refresh the display including modified layer and any previously selected component.
                        IActiveView activeView = m_engineEditor.Map as IActiveView;
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGeography | esriViewDrawPhase.esriViewGeoSelection, null, activeView.Extent);

                        //Complete the edit operation.
                        m_engineEditor.StopOperation("Cut Polygons Without Selection");
                    }
                    else
                    {
                        m_engineEditor.AbortOperation();
                    }

                    //report any errors that have arisen while splitting features
                    if (comErrors.Count > 0)
                    {
                        StringBuilder stringBuilder = new StringBuilder("The following features could not be split: \n", 200);
                        foreach (string comError in comErrors)
                        {
                            stringBuilder.AppendLine(comError);
                        }

                        MessageBox.Show(stringBuilder.ToString(), "Cut Errors");
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Unable to perform the cut task.\n" + e.Message);
                m_engineEditor.AbortOperation();
            }
            finally
            {
                //Change the cursor shape to default.
                System.Windows.Forms.Cursor.Current = Cursors.Default;
            }
        }
Esempio n. 16
0
 private void AddVertexNode(IPoint pPnt)
 {
     try
     {
         IFeatureLayer pFeaturelayer = m_EngineEditLayers.TargetLayer;
         IActiveView   pActiveView   = m_activeView;
         IPoint        pPoint        = pPnt;
         if (pFeaturelayer.FeatureClass == null)
         {
             return;
         }
         //如果不是面状地物则退出
         if (pFeaturelayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryEnvelope &&
             pFeaturelayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolygon &&
             pFeaturelayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryLine &&
             pFeaturelayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolyline)
         {
             return;
         }
         IGeometry pGeo        = null;
         IFeature  pSelFeature = null;
         pSelFeature = EditVertexClass.GetSelectedFeature(pFeaturelayer);
         //是否有选中的几何体
         if (pSelFeature == null)
         {
             return;
         }
         //解决不带Z值的要素的编辑和Z值为空的要素的编辑问题
         IZAware pZAware = pPoint as IZAware;
         pZAware.ZAware = true;
         pPoint.Z       = 0;
         bool pInLine = false;
         ITopologicalOperator pTopoOpt      = default(ITopologicalOperator);
         IPolyline            pBoundaryLine = default(IPolyline);
         //最小的距离
         double             pMindis  = 0;
         IProximityOperator pProxOpt = default(IProximityOperator);
         //得到多边形的边界
         if (pFeaturelayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon ||
             pFeaturelayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryEnvelope)
         {
             //获取边界线
             pBoundaryLine = EditVertexClass.GetBoundary(pFeaturelayer);
         }
         else if (pFeaturelayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline ||
                  pFeaturelayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryLine)
         {
             pBoundaryLine = pSelFeature.ShapeCopy as IPolyline;
         }
         pTopoOpt = pPoint as ITopologicalOperator;
         IRelationalOperator pRelationalOperator = default(IRelationalOperator);
         pRelationalOperator = pPoint as IRelationalOperator;
         //判断点是否在边界上
         pInLine = pRelationalOperator.Within(pBoundaryLine);
         //如果不在边界上,判断是否小于容忍距离,如果大于容忍距离则退出程序
         if (pInLine == false)
         {
             pProxOpt = pPoint as IProximityOperator;
             pMindis  = pProxOpt.ReturnDistance(pBoundaryLine);
             if (pMindis > THE_POINT_TO_POINT_TOLERANCE)
             {
                 return;
             }
         }
         //判断是否增加的点刚好为节点
         IPointCollection pPolylinePointCol = pBoundaryLine as IPointCollection;
         IHitTest         pHitTest          = default(IHitTest);
         double           pHitDis           = 0;
         int    pSegIndex  = 0;
         int    pVerIndex  = 0;
         IPoint pHitPoint  = null;
         bool   bRightSide = true;
         pHitTest = pBoundaryLine as IHitTest;
         //增加的点为已有的节点则退出程序
         if (pHitTest.HitTest(pPoint, THE_POINT_TO_POINT_TOLERANCE * 10,
                              esriGeometryHitPartType.esriGeometryPartVertex, pHitPoint,
                              ref pHitDis, ref pSegIndex, ref pVerIndex, ref bRightSide) == true)
         {
             if (pHitDis < THE_POINT_TO_POINT_TOLERANCE)
             {
                 return;
             }
         }
         EditVertexClass.pHitPnt = pHitPoint;
         //为多边形增加节点
         ISegmentCollection pSegmentCollection = pBoundaryLine as ISegmentCollection;
         IPolyline          pSegPolyline       = null;
         int    pPointIndex = 0;
         ILine  pLine       = default(ILine);
         double pDis1       = 0;
         double pDis2       = 0;
         IPoint pVerTex     = default(IPoint);
         pMindis  = 100;
         pProxOpt = pPoint as IProximityOperator;
         for (int i = 0; i <= pSegmentCollection.SegmentCount - 1; i++)
         {
             //判断选中点是否在这个Segment上
             pLine = pSegmentCollection.get_Segment(i) as ILine;
             pDis1 = pProxOpt.ReturnDistance(pLine.FromPoint);
             pDis2 = pProxOpt.ReturnDistance(pLine.ToPoint);
             if (Math.Abs(pDis1 + pDis2 - pLine.Length) <= pMindis)
             {
                 pMindis = Math.Abs(pDis1 + pDis2 - pLine.Length);
                 pVerTex = pLine.ToPoint;
             }
         }
         //获取选中的几何特征
         pGeo = pSelFeature.Shape;
         //得到索引
         pPointIndex = EditVertexClass.GetVertexIndex(pVerTex, pGeo);
         //如果是首点,则设置为最后一个点
         if (pPointIndex == 0)
         {
             pPointIndex = pSegmentCollection.SegmentCount;
         }
         IPointCollection pPolygonPointCol = null;
         pPolygonPointCol = pSelFeature.ShapeCopy as IPointCollection;
         pPolygonPointCol.InsertPoints(pPointIndex, 1, ref pPoint);
         m_EngineEditor.StartOperation();
         //拓扑操作
         IPolygon  pPolygon = null;
         IPolyline pPlyline = null;
         if (pFeaturelayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon ||
             pFeaturelayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryEnvelope)
         {
             pPolygon = pPolygonPointCol as IPolygon;
             pPolygon.Close();
             pTopoOpt = pPolygon as ITopologicalOperator;
             pTopoOpt.Simplify();
             pSelFeature.Shape = pPolygon;
             pSelFeature.Store();
         }
         else if (pFeaturelayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline ||
                  pFeaturelayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryLine)
         {
             pPlyline = pPolygonPointCol as IPolyline;
             pTopoOpt = pPlyline as ITopologicalOperator;
             pTopoOpt.Simplify();
             pSelFeature.Shape = pPlyline;
             pSelFeature.Store();
         }
         //停止编辑
         m_EngineEditor.StopOperation("AddVertexTool");
         //显示顶点
         EditVertexClass.ShowAllVertex(pFeaturelayer);
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 17
0
        public override void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            if (Button != 1)
            {
                return;
            }
            //if (m_engineEditor.SelectionCount < 1) return;
            if (m_rotateTracker == null)
            {
                return;
            }

            IEnumFeature pEnumFeature;
            IFeature     pFeature;
            ITransform2D pTrans2D;
            bool         bChanged = m_rotateTracker.OnMouseUp();

            if (bChanged == false)
            {
                return;
            }

            try
            {
                if (this.DoubleCheck(m_rotateTracker) == false)
                {
                    return;
                }
                IEnvelope pSelEnvelope = null;
                pEnumFeature = m_hookHelper.ActiveView.Selection as IEnumFeature;
                pEnumFeature.Reset();
                pFeature = pEnumFeature.Next();
                m_engineEditor.StartOperation();
                while (pFeature != null)
                {
                    if (pSelEnvelope == null)
                    {
                        pSelEnvelope = pFeature.Extent;
                    }
                    else if (pFeature.Extent.IsEmpty == false)
                    {
                        pSelEnvelope.Union(pFeature.Extent);
                    }
                    //如果选中的是地物
                    if (pFeature.FeatureType == esriFeatureType.esriFTSimple || pFeature.FeatureType == esriFeatureType.esriFTDimension ||
                        pFeature.FeatureType == esriFeatureType.esriFTSimpleEdge || pFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                    {
                        pTrans2D = pFeature.ShapeCopy as ITransform2D;
                        //旋转要素
                        pTrans2D.Rotate(m_rotateTracker.Origin, m_rotateTracker.Angle);
                        pFeature.Shape = pTrans2D as IGeometry;
                        pFeature.Store();
                    }
                    if (pFeature.FeatureType == esriFeatureType.esriFTAnnotation)
                    {
                        double angle    = m_rotateTracker.Angle / Math.PI * 180;
                        int    i        = pFeature.Fields.FindField("Angle");
                        double oldAngle = (double)pFeature.get_Value(i);
                        double newAngle = oldAngle + angle;
                        if (newAngle > 360)
                        {
                            newAngle = angle - 360;
                        }
                        if (newAngle < -360)
                        {
                            newAngle = angle + 360;
                        }
                        pFeature.set_Value(i, newAngle);
                        pFeature.Store();
                    }
                    pFeature = pEnumFeature.Next();
                }
                m_engineEditor.StopOperation("Rotate Features");
                m_mapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                m_mapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, pSelEnvelope);
            }
            catch (Exception ex)
            {
                m_engineEditor.AbortOperation();
            }
            finally
            {
                pEnumFeature = null;
                pFeature     = null;
                pTrans2D     = null;
            }
        }
Esempio n. 18
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string saveString = comboBox1.Text;
                // 属性过滤
                IQueryFilter pQueryFilter = new QueryFilter();
                if (pItems.Count > 0)
                {
                    pQueryFilter.WhereClause = saveString;
                }
                else
                {
                    pQueryFilter.WhereClause = null;
                }



                // 要素游标

                //启动编辑
                IFeatureLayer pFeatureLayer = mLayer as IFeatureLayer;
                IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;

                IWorkspace workspace = null;
                IEngineEditor mEngineEditor = mEngineEditor = new EngineEditorClass();
                if (pFeatureClass.FeatureDataset != null)
                {

                    workspace = pFeatureClass.FeatureDataset.Workspace;
                    IMap mMap = mAxMapControl1.Map;
                    mEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
                    mEngineEditor.StartEditing(workspace, mMap);
                    ((IEngineEditLayers)mEngineEditor).SetTargetLayer(pFeatureLayer, -1);
                    mEngineEditor.StartOperation();

                }



                IFeatureCursor pFCursor = pFeatureClass.Search(pQueryFilter, false);
                IFeature pFeature = pFCursor.NextFeature();
                //todo
                string str = getQueryString();
                pFeature.Shape = GetMergeGeometry(str);

                pFeature.Store();
                //pFCursor.Flush();

                //删除语句
                pItems.Remove(saveString);
                for (int i = 0; i < pItems.Count; i++)
                {
                    delectSelectedCells(pItems[i]);
                }


                this.Close();
                if (workspace != null)
                {
                    mEngineEditor.StopEditing(true);
                }

                XtraMessageBox.Show("合并成功", "提示信息", MessageBoxButtons.OK);
                mAxMapControl1.Refresh();
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "合并失败", MessageBoxButtons.OK);
            }

        }