public override void OnMouseUp(int button, int shift, int x, int y) { if (this._circleFeedback != null) { try { ICircularArc circularArc = this._circleFeedback.Stop(); if (circularArc == null || circularArc.IsEmpty) { this._circleFeedback = null; return; } this._circleFeedback = null; IPolygon polygon = new Polygon() as IPolygon; object value = Missing.Value; (polygon as ISegmentCollection).AddSegment(circularArc as ISegment, ref value, ref value); _plugin.FireFenceAdded(new FenceAddedArgs((IGeometry)polygon)); IActiveView activeView = this._context.FocusMap as IActiveView; activeView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, polygon.Envelope); } catch (Exception exception_) { //CErrorLog.writeErrorLog(this, exception_, ""); } } }
/// <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; }
private void ResetTool() { try { if (this._hookHelper.ActiveView.ScreenDisplay.hWnd == GetCapture()) { ReleaseCapture(); } this.mInUsing = false; if (this._feedback != null) { try { this._feedback.Stop(); this._feedback = null; } catch (Exception) { } } this._hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewForeground, null, null); } catch (Exception exception) { this.mErrOpt.ErrorOperate(this._mSubSysName, "ShapeEdit.Create2", "ResetTool", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", ""); } }
public override void OnMouseDown(int button, int Shift, int x, int y) { if (this._context.ActiveView is IPageLayout) { IPoint location = this._context.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y); IMap map = this._context.ActiveView.HitTestMap(location); if (map == null) { return; } if (map != this._context.FocusMap) { this._context.ActiveView.FocusMap = map; this._context.ActiveView.Refresh(); } } IPoint point = ((IActiveView)this._context.FocusMap).ScreenDisplay.DisplayTransformation.ToMapPoint(x, y); if (this._circleFeedback == null) { IActiveView activeView = (IActiveView)this._context.FocusMap; this._circleFeedback = new NewCircleFeedback(); this._circleFeedback.Display = activeView.ScreenDisplay; this._circleFeedback.Start(point); } }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { if (Button == 2) { return; } m_pPoint = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); m_pPoint = GIS.GraphicEdit.SnapSetting.getSnapPoint(m_pPoint); if (m_pNewCircleFeedback == null) { m_pNewCircleFeedback = new NewCircleFeedback(); m_pNewCircleFeedback.Display = m_pScrD; m_pNewCircleFeedback.Start(m_pPoint); } else { ICircularArc pCircuArc; pCircuArc = m_pNewCircleFeedback.Stop(); if (pCircuArc != null && pCircuArc.Radius > 0.001) { m_pCurrentLayer = DataEditCommon.g_pLayer; DrawCircleFeature(m_pCurrentLayer, pCircuArc, m_pScrD); } m_pNewCircleFeedback = null; } }
public override void OnKeyDown(int keyCode, int Shift) { if (keyCode == (int)Keys.Escape) { m_pNewCircleFeedback = null; m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); } }
public override void OnMouseUp(int Button, int Shift, int X, int Y) { IGeometry pGeo = null; pGeo = pCircleFeedback.Stop(); pCircleFeedback = null; CreateFeature(pGeo); }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { //获得鼠标在控件上点击的位置,产生一个点对象 IPoint pPt = m_ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); if (pCircleFeedback == null) { pCircleFeedback = new NewCircleFeedbackClass(); pCircleFeedback.Display = m_ActiveView.ScreenDisplay; pCircleFeedback.Start(pPt); } }
public override void OnMouseDown(int button, int Shift, int x, int y) { IActiveView activeView = this._context.ActiveView; IPoint point = activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y); if (this._circleFeedback == null) { this._circleFeedback = new NewCircleFeedback(); this._circleFeedback.Display = activeView.ScreenDisplay; this._circleFeedback.Start(point); } }
public override void OnMouseMove(int button, int shift, int x, int y, double mapX, double mapY) { // TODO: 添加 DrawCircle3P.OnMouseMove 实现 base.OnMouseMove(button, shift, x, y, mapX, mapY); m_pPoint = m_pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y); m_pAnchorPoint = m_pPoint; //+++++++++++++开始捕捉+++++++++++++++++++++ if (m_pLastPoint != null) { if (m_pLastPoint.IsEmpty) { bool flag = CommonFunction.Snap(m_MapControl, m_App.CurrentConfig.cfgSnapEnvironmentSet, null, m_pAnchorPoint); } } else { if (!m_pLastPoint.IsEmpty) { bool flag = CommonFunction.Snap(m_MapControl, m_App.CurrentConfig.cfgSnapEnvironmentSet, m_pLastPoint, m_pAnchorPoint); } } if (m_bFirst) //如果已经形成圆周上的两个点 { //########################平行尺######################## CommonFunction.ParallelRule(ref m_bKeyCodeP, m_pActiveView, m_dblTolerance, ref m_pSegment, m_pLastPoint, m_pPoint, ref m_pAnchorPoint); //&&&&&&&&&&&&&&&&&&&&&&&& 正 交 &&&&&&&&&&&&&&&&&&&&&&& CommonFunction.PositiveCross(m_pLastPoint, ref m_pAnchorPoint, m_App.CurrentConfig.cfgPositiveCross.IsPositiveCross); if (m_bSecond) { m_pCenterPoint = CommonFunction.GetCenter_P123(m_pPoint1, m_pPoint2, m_pAnchorPoint); m_pCircleFeed = (NewCircleFeedbackClass)m_pFeedback; m_pCircleFeed.Display = m_pActiveView.ScreenDisplay; m_pCircleFeed.Stop(); m_pCircleFeed.Start(m_pCenterPoint); m_pFeedback.MoveTo(m_pAnchorPoint); } } if (m_bFirst && !m_bSecond && !m_bThree) { m_pLineFeed.MoveTo(m_pAnchorPoint); } }
private void Reset(bool resetColor) { if (m_circleFeedBack != null) { m_circleFeedBack.Stop(); m_circleFeedBack = null; base.m_cursor = Cursors.Cross; if (resetColor) { //Reset symbol color to red IRgbColor solidColor = new RgbColorClass(); solidColor.Red = 255; m_feedbackSymbol.Color = solidColor; } } }
public override void OnMouseUp(int button, int shift, int x, int y) { if (this._circleFeedback != null) { try { ICircularArc circularArc = this._circleFeedback.Stop(); this._circleFeedback = null; IPolygon polygon = new Polygon() as IPolygon; object value = Missing.Value; (polygon as ISegmentCollection).AddSegment(circularArc as ISegment, ref value, ref value); IElement element = new CircleElement { Geometry = polygon }; INewElementOperation operation = new NewElementOperation { ActiveView = this._context.ActiveView, ContainHook = this.GetActiveView(), Element = element }; this._context.OperationStack.Do(operation); //if (this._context.Hook is IApplication) //{ // if ((this._context.Hook as IApplication).ContainerHook != null) // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).ContainerHook); // } // else // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).Hook); // } //} //else //{ // DocumentManager.DocumentChanged(this._context.Hook); //} } catch (Exception exception_) { //CErrorLog.writeErrorLog(this, exception_, ""); } } }
private void Reset() { m_bFirst = false; m_bSecond = false; m_bInputWindowCancel = true; m_pCircleFeed = null; m_pFeedback = null; if (m_pLastPoint != null) { m_pLastPoint.SetEmpty(); } ; m_pSegment = null; m_pActiveView.GraphicsContainer.DeleteAllElements(); m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, m_pEnvelope); //视图刷新 m_pEnvelope = null; m_pStatusBarService.SetStateMessage("就绪"); }
public void OnMouseDown(int button, int shift, int x, int y) { try { if (button == 1) { this.ResetTool(); IPoint point = this._hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y); this._feedback = new NewCircleFeedbackClass(); this._feedback.Display = this._hookHelper.ActiveView.ScreenDisplay; this._feedback.Start(point); this._isStarted = true; this.mInUsing = true; SetCapture(this._hookHelper.ActiveView.ScreenDisplay.hWnd); } } catch (Exception exception) { this.mErrOpt.ErrorOperate(this._mSubSysName, "ShapeEdit.Create2", "OnMouseDown", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", ""); } }
private void Reset() { m_bFixRadius = false; m_bInUse = false; m_bInputWindowCancel = true; m_pCircleFeed = null; if (m_pCenterPoint != null) { m_pCenterPoint.SetEmpty(); } m_pFeedback = null; if (m_pLastPoint != null) { m_pLastPoint.SetEmpty(); } m_pActiveView.GraphicsContainer.DeleteAllElements(); m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, m_pEnvelope); //视图刷新 m_App.Workbench.SetStatusInfo("就绪"); }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { if (Button != 1) //not the left mouse button, exit { return; } if (m_circleFeedBack == null) { m_circleFeedBack = new NewCircleFeedbackClass(); m_circleFeedBack.Symbol = (ISymbol)m_feedbackSymbol; //Use AppDisplay to work on both Data and PageLayout view IScreenDisplay disp = ((IMxApplication)m_application).Display; m_centerPoint = disp.DisplayTransformation.ToMapPoint(X, Y); m_circleFeedBack.Display = disp; m_circleFeedBack.Start(m_centerPoint); } else { Reset(false); } }
private void DrawCircle3PMouseDown(IPoint pPoint, int shift) { IGeometry pGeom = null; IPolyline pPolyline; IPolygon pPolygon; IPoint pCenterPoint = new PointClass(); if (!m_bFirst) //如果命令没有使用 { m_pPoint1 = pPoint; m_bFirst = true; m_bSecond = false; m_pFeedback = new NewLineFeedbackClass(); m_pLineFeed = (INewLineFeedback)m_pFeedback; m_pLineFeed.Display = m_pActiveView.ScreenDisplay; m_pLineFeed.Start(pPoint); CommonFunction.DrawPointSMSSquareSymbol(m_MapControl, m_pPoint1); } else if (!m_bSecond) //如果命令正在使用 { m_pPoint2 = pPoint; m_bSecond = true; m_bThree = false; CommonFunction.DrawPointSMSSquareSymbol(m_MapControl, m_pPoint2); m_pLineFeed.Stop(); m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, m_pEnvelope); m_pFeedback = new NewCircleFeedbackClass(); } else if (!m_bThree) { m_pPoint3 = m_pPoint; m_bFirst = false; m_bThree = true; m_pCenterPoint = CommonFunction.GetCenter_P123(m_pPoint1, m_pPoint2, pPoint); m_pCircleFeed = (NewCircleFeedbackClass)m_pFeedback; m_pCircleFeed.Display = m_pActiveView.ScreenDisplay; m_pCircleFeed.Stop(); m_pCircleFeed.Start(m_pCenterPoint); m_pFeedback.MoveTo(pPoint); ICircularArc pCircularArc = new CircularArcClass(); pCircularArc = m_pCircleFeed.Stop(); pCenterPoint = pCircularArc.CenterPoint; if (shift == 1) //若果按住shift健弹出对话框,让用户修改圆周上的坐标值 { frmCircle3P formCircle3P = new frmCircle3P(); formCircle3P.ShowDialog(); if (m_bModify) //修改坐标值了 { //计算圆心坐标 pCenterPoint = CommonFunction.GetCenter_P123(m_pPoint1, m_pPoint2, m_pPoint3); m_bModify = false; } } switch (((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType) { case esriGeometryType.esriGeometryPolyline: pPolyline = CommonFunction.ArcToPolyline(pCircularArc.FromPoint, pCircularArc.CenterPoint, pCircularArc.FromPoint, esriArcOrientation.esriArcClockwise); pGeom = pPolyline; break; case esriGeometryType.esriGeometryPolygon: pPolyline = CommonFunction.ArcToPolyline(pCircularArc.FromPoint, pCircularArc.CenterPoint, pCircularArc.FromPoint, esriArcOrientation.esriArcClockwise); pPolygon = CommonFunction.PolylineToPolygon(pPolyline); pGeom = pPolygon; break; default: break; } //end switch m_pEnvelope = pGeom.Envelope; if (m_pEnvelope != null && !m_pEnvelope.IsEmpty) { m_pEnvelope.Expand(10, 10, false); } ; CommonFunction.CreateFeature(m_App.Workbench, pGeom, m_FocusMap, m_CurrentLayer); Reset(); } // end if(!m_bThree) m_pLastPoint = pPoint; m_pSegment = null; }
public override void OnMouseDown(int button, int shift, int x, int y, double mapX, double mapY) { IGeometry Geom = null; if (!m_bInUse) { downPoint = m_pAnchorPoint; m_pRecordPointArray.Add(downPoint); m_pCircleFeed = new NewCircleFeedbackClass(); m_bInUse = true; m_pCircleFeed.Display = m_pActiveView.ScreenDisplay; m_pLineFeed = new NewLineFeedbackClass(); m_pLineFeed.Start(downPoint); m_pCircleFeed.Start(downPoint); } else //如果命令正在使用 { if (pGraphicsContainer != null) { pGraphicsContainer.DeleteAllElements(); } movePoint = m_pAnchorPoint; //画半径线 m_pRecordPointArray.Add(movePoint); IPolyline pPolyline; pPolyline = (IPolyline)CommonFunction.MadeSegmentCollection(ref m_pRecordPointArray); Geom = (IGeometry)pPolyline; CommonFunction.AddElement(m_pMapControl, Geom); m_radius = CommonFunction.GetDistance_P12(downPoint, movePoint); //半径 //m_radius = Math.Round( m_radius,1,MidpointRounding.AwayFromZero);//保留一位小数 //缓冲半径文本 ITextElement iTextElement = new TextElementClass(); iTextElement.Text = m_radius.ToString(".##") + "米"; ITextSymbol sce = new TextSymbolClass(); sce.Size = 15 /*SystemInfo.Instance.TextSize*/; Color color = ColorTranslator.FromHtml(SystemInfo.Instance.TextColor); IColor pColor = new RgbColorClass(); pColor.RGB = color.B * 65536 + color.G * 256 + color.R; sce.Color = pColor; iTextElement.Symbol = sce; IElement iElement = (IElement)iTextElement; iElement.Geometry = Geom; this.m_pMapControl.ActiveView.GraphicsContainer.AddElement(iElement, 0); this.m_pMapControl.ActiveView.Refresh(); //画圆 pSegmentCollection = new PolygonClass(); pSegmentCollection.SetCircle(downPoint, m_radius); pGeom = pSegmentCollection as IGeometry; if (pGeom != null) { AddCreateCircleElement(pGeom, this.m_pMapControl.ActiveView); this.m_pMapControl.ActiveView.Refresh(); GetPipeInfo(); } if (m_pRecordPointArray.Count != 0) { m_pRecordPointArray.RemoveAll(); } m_bInUse = false; } }
/// <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; }
//private void EndDrawCircleCentRadWihtShift() //{ // frmCentRad formCentRad = new frmCentRad(); // formCentRad.ShowDialog(); // if( m_bFixRadius ) // { // IGeometry pGeom = null; // IPolyline pPolyline; // IPolygon pPolygon; // IPoint pPoint = new PointClass(); // pPoint.X = m_pCenterPoint.X + m_dblRadius; // pPoint.Y = m_pCenterPoint.Y; // pPolyline = CommonFunction.ArcToPolyline(pPoint, m_pCenterPoint, pPoint,esriArcOrientation.esriArcClockwise); // switch (((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType) // { // case esriGeometryType.esriGeometryPolyline: // pGeom = pPolyline; // break; // case esriGeometryType.esriGeometryPolygon: // pPolygon = CommonFunction.PolylineToPolygon(pPolyline); // pGeom = pPolygon; // break; // default: // break; // }//end switch // m_pEnvelope = pGeom.Envelope; // if(m_pEnvelope != null &&!m_pEnvelope.IsEmpty ) m_pEnvelope.Expand(10,10,false);; // CommonFunction.CreateFeature(m_App.Workbench,pGeom, m_FocusMap, m_CurrentLayer); // m_App.Workbench.CommandBarManager.Tools["2dmap.DFEditorTool.Undo"].SharedProps.Enabled = true; // } // Reset(); //} private void DrawCircleCentRadMouseDown(IPoint pPoint, int shift) { Class.Common.DrawPointSMSSquareSymbol(m_MapControl, pPoint); if (!m_bInUse) //如果命令没有使用 { m_bInUse = true; m_pCenterPoint = pPoint; m_pFeedback = new NewCircleFeedbackClass(); m_pCircleFeed = (NewCircleFeedbackClass)m_pFeedback; m_pCircleFeed.Display = m_pActiveView.ScreenDisplay; m_pCircleFeed.Start(m_pCenterPoint); } else //如果命令已经使用使用 { IGeometry pGeom = null; IPolyline pPolyline; IPolygon pPolygon; ICircularArc pCircularArc = new CircularArcClass(); //if (shift == 1)//若果按住shift健弹出对话框,让用户修改圆周上的坐标值 //{ // EndDrawCircleCentRadWihtShift(); //} //else //{ m_pFeedback.MoveTo(pPoint); pCircularArc = m_pCircleFeed.Stop(); m_dblRadius = pCircularArc.Radius; switch (((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType) { case esriGeometryType.esriGeometryPolyline: pPolyline = Class.Common.ArcToPolyline(pCircularArc.FromPoint, pCircularArc.CenterPoint, pCircularArc.FromPoint, esriArcOrientation.esriArcClockwise); pGeom = pPolyline; break; case esriGeometryType.esriGeometryPolygon: pPolyline = Class.Common.ArcToPolyline(pCircularArc.FromPoint, pCircularArc.CenterPoint, pCircularArc.FromPoint, esriArcOrientation.esriArcClockwise); pPolygon = Class.Common.PolylineToPolygon(pPolyline); pGeom = pPolygon; break; default: break; } //end switch m_pEnvelope = pGeom.Envelope; if (m_pEnvelope != null && !m_pEnvelope.IsEmpty) { m_pEnvelope.Expand(10, 10, false); } Class.Common.CreateFeature(pGeom, m_FocusMap, m_CurrentLayer); m_App.Workbench.UpdateMenu(); Reset(); //} } m_pLastPoint = pPoint; }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { if (Button == 2) return; m_pPoint = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); m_pPoint = GIS.GraphicEdit.SnapSetting.getSnapPoint(m_pPoint); if (m_pNewCircleFeedback == null) { m_pNewCircleFeedback = new NewCircleFeedback(); m_pNewCircleFeedback.Display = m_pScrD; m_pNewCircleFeedback.Start(m_pPoint); } else { ICircularArc pCircuArc; pCircuArc = m_pNewCircleFeedback.Stop(); if (pCircuArc != null && pCircuArc.Radius > 0.001) { m_pCurrentLayer = DataEditCommon.g_pLayer; DrawCircleFeature(m_pCurrentLayer, pCircuArc, m_pScrD); } m_pNewCircleFeedback = null; } }
private void CircleFeedBackWhenMouseDown(IPoint pointCentre) { //开始追踪圆 if (m_CircleFeedback == null) { m_CircleFeedback = new NewCircleFeedbackClass(); m_CircleFeedback.Display = GlobeStatus.ActiveView.ScreenDisplay; m_CircleFeedback.Start(pointCentre); } }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { if (Button != 1) //not the left mouse button, exit return; if (m_circleFeedBack == null) { m_circleFeedBack = new NewCircleFeedbackClass(); m_circleFeedBack.Symbol = (ISymbol)m_feedbackSymbol; //Use AppDisplay to work on both Data and PageLayout view IScreenDisplay disp = ((IMxApplication)m_application).Display; m_centerPoint = disp.DisplayTransformation.ToMapPoint(X, Y); m_circleFeedBack.Display = disp; m_circleFeedBack.Start(m_centerPoint); } else { Reset(false); } }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { // TODO: Add ToolCreateCircle.OnMouseDown implementation if ((m_pMapCtl = ClsGlobal.GetMapControl(m_hookHelper)) == null) { return; } IPoint pPoint = m_pMapCtl.ToMapPoint(X, Y); if (Button == 1) { if (m_NewCircleFeedback == null) { m_NewCircleFeedback = new NewCircleFeedbackClass(); m_NewCircleFeedback.Display = m_pMapCtl.ActiveView.ScreenDisplay; m_NewCircleFeedback.Start(pPoint); m_CenterPoint = pPoint; } else { try { object Miss = Type.Missing; ICircularArc pArc = m_NewCircleFeedback.Stop(); //IGeometry geometry = new PolygonClass(); //geometry = m_pMapCtl.TrackCircle(); IPolygon pPolygon = new PolygonClass(); ISegment pArcC = pArc as ISegment; ISegmentCollection pArcP = pPolygon as ISegmentCollection; pArcP.AddSegment(pArcC, ref Miss, ref Miss); pPolygon.Close(); IFeature pFeature = m_FLayer.FeatureClass.CreateFeature(); pFeature.Shape = pPolygon; pFeature.Store(); m_pMapCtl.Refresh(); m_NewCircleFeedback = null; } catch (System.Exception ex) { } } } if (Button == 2) { double radius = Math.Sqrt((pPoint.X - m_CenterPoint.X) * (pPoint.X - m_CenterPoint.X) + (pPoint.Y - m_CenterPoint.Y) * (pPoint.Y - m_CenterPoint.Y)); FrmDrawCircle frm = new FrmDrawCircle(radius); IConstructCircularArc pArcConstruct = null; if (m_NewCircleFeedback == null) { return; } if (frm.ShowDialog() == DialogResult.OK) { try { pArcConstruct = new CircularArcClass(); pArcConstruct.ConstructCircle(m_CenterPoint, frm.m_radius, false); if (pArcConstruct != null) { IPolygon pPolygon = new PolygonClass(); ISegment pArcC = pArcConstruct as ISegment; ISegmentCollection pArcP = pPolygon as ISegmentCollection; pArcP.AddSegment(pArcC); pPolygon.Close(); IFeature pFeature = m_FLayer.FeatureClass.CreateFeature(); pFeature.Shape = pPolygon; pFeature.Store(); m_pMapCtl.Refresh(); m_NewCircleFeedback.Stop(); m_NewCircleFeedback = null; } } catch (System.Exception ex) { MessageBox.Show(ex.Message); if (m_NewCircleFeedback != null) { m_NewCircleFeedback.Stop(); } m_NewCircleFeedback = null; } } } }
private void CircleFeedbackWhenMouseUp(IPoint pointMouseUp) { if(m_CircleFeedback!=null) { m_CircleFeedback.Stop(); m_CircleFeedback = null; } }