public override void OnDblClick() { IGeometry pGeometry; if (m_newBezierCurveFeedback != null) { m_newBezierCurveFeedback.AddPoint(fPoint); } pGeometry = m_newBezierCurveFeedback.Stop(); IActiveView pActiveView = m_hookHelper.ActiveView; m_newBezierCurveFeedback = null; IPolyline polyline = new PolylineClass(); polyline = (IPolyline)pGeometry; //polyline = DataEditCommon.PDFX(polyline, "Bezier"); IPointCollection pointCollection = (IPointCollection)polyline; if (pointCollection.PointCount < 4) { MessageBox.Show("¹Ø¼üµã²»ÄÜСÓÚ3¸ö£¡"); return; } //DrawFeatureByShape(m_pCurrentLayer, pGeometry); CollapsePillarsEntering form = new CollapsePillarsEntering(pointCollection); form.ShowDialog(); }
public override void OnKeyDown(int keyCode, int Shift) { if (keyCode == (int)Keys.Escape) { m_newBezierCurveFeedback = null; m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); } }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { IPoint pt = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); pt = GIS.GraphicEdit.SnapSetting.getSnapPoint(pt); if (m_newBezierCurveFeedback == null) { m_newBezierCurveFeedback = new NewBezierCurveFeedbackClass(); m_newBezierCurveFeedback.Display = m_hookHelper.ActiveView.ScreenDisplay; m_newBezierCurveFeedback.Start(pt); } else { m_newBezierCurveFeedback.AddPoint(pt); } }
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.curveFeedback == null) { this.curveFeedback = new NewBezierCurveFeedback(); this.curveFeedback.Display = activeView.ScreenDisplay; this.curveFeedback.Start(point); } else { this.curveFeedback.AddPoint(point); } }
public override void OnDblClick() { IGeometry pGeometry; pGeometry = m_newBezierCurveFeedback.Stop(); IActiveView pActiveView = m_hookHelper.ActiveView; m_newBezierCurveFeedback = null; IFeatureLayer pFeatureLayer = m_pCurrentLayer as IFeatureLayer; IPolyline polyline = new PolylineClass(); polyline = (IPolyline)pGeometry; IFeature pFeature = DataEditCommon.CreateUndoRedoFeature(pFeatureLayer, polyline); m_hookHelper.FocusMap.SelectFeature(pFeatureLayer, pFeature); m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewBackground, null, null); }
private void Reset() { m_pActiveView.FocusMap.ClearSelection(); m_pActiveView.GraphicsContainer.DeleteAllElements(); m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, m_pEnvelope); //视图刷新 m_pStatusBarService.SetStateMessage("就绪"); m_bInUse = false; if (m_pLastPoint != null) { m_pLastPoint.SetEmpty(); } m_pUndoArray.RemoveAll(); //清空回退数组 m_pBezierCurveFeed = null; m_pLastLineFeed = null; m_bInputWindowCancel = true; m_pEnvelope = null; }
public override void OnDblClick() { if (this.curveFeedback == null) { return; } IPolyline polyline = this.curveFeedback.Stop(); this.curveFeedback = null; if (polyline.IsEmpty) { return; } IElement element = new LineElement { Geometry = polyline }; ISimpleLineSymbol symbol = new SimpleLineSymbol(); (element as ILineElement).Symbol = symbol; INewElementOperation operation = new NewElementOperation { ActiveView = this._context.ActiveView, Element = element, ContainHook = this.method_0() }; 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); //} }
public override void OnDblClick() { IGeometry pGeometry; pGeometry = m_newBezierCurveFeedback.Stop(); IActiveView pActiveView = m_hookHelper.ActiveView; m_newBezierCurveFeedback = null; IFeatureLayer pFeatureLayer = m_pCurrentLayer as IFeatureLayer; IPolyline polyline = new PolylineClass(); polyline = (IPolyline)pGeometry; IFeature pFeature= DataEditCommon.CreateUndoRedoFeature(pFeatureLayer, polyline); m_hookHelper.FocusMap.SelectFeature(pFeatureLayer, pFeature); m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewBackground, null, null); }
private void EndDrawBezierCurve() { IGeometry pGeom = null; IPolyline pPolyline; IPolygon pPolygon; IPointCollection pPointCollection; if (m_bInUse) { switch (((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType) { case esriGeometryType.esriGeometryPolyline: m_pBezierCurveFeed = (INewBezierCurveFeedback)m_pFeedback; m_pFeedback.MoveTo((IPoint)m_pUndoArray.get_Element(m_pUndoArray.Count - 1));; pPolyline = m_pBezierCurveFeed.Stop(); ((ITopologicalOperator)pPolyline).Simplify(); pPointCollection = (IPointCollection)pPolyline; if (pPointCollection.PointCount < 2) { MessageBox.Show("线上必须有两个点!"); } else { pGeom = (IGeometry)pPointCollection; } break; case esriGeometryType.esriGeometryPolygon: m_pBezierCurveFeed = (INewBezierCurveFeedback)m_pFeedback; m_pBezierCurveFeed.AddPoint((IPoint)m_pUndoArray.get_Element(0)); pPolyline = m_pBezierCurveFeed.Stop(); pPolygon = CommonFunction.PolylineToPolygon((IPolyline)pPolyline); ((ITopologicalOperator)pPolygon).Simplify(); pPointCollection = (IPointCollection)pPolygon; pGeom = (IGeometry)pPointCollection; if (pPointCollection.PointCount < 3) { MessageBox.Show("面上必须有三个点!"); } else { pGeom = (IGeometry)pPointCollection; } 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(); //复位 m_bInUse = false; }
private void DrawBezierCurveMouseDown(IPoint pPoint) { if (!m_bInUse) //如果命令没有使用 { m_bInUse = true; m_pUndoArray.Add(pPoint); CommonFunction.DrawPointSMSSquareSymbol(m_MapControl, pPoint); m_pFeedback = new NewBezierCurveFeedbackClass(); m_pBezierCurveFeed = (INewBezierCurveFeedback)m_pFeedback; m_pBezierCurveFeed.Start(pPoint); if (m_pFeedback != null) { m_pFeedback.Display = m_pActiveView.ScreenDisplay; } if (((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon) { //若当前图层是面层,则显示回馈开始点到鼠标点的线段 m_pLastFeedback = new NewLineFeedbackClass(); m_pLastLineFeed = (INewLineFeedback)m_pLastFeedback; m_pLastLineFeed.Start(pPoint); if (m_pLastFeedback != null) { m_pLastFeedback.Display = m_pActiveView.ScreenDisplay; } } } else //若果命令正使用中 { m_pBezierCurveFeed = (INewBezierCurveFeedback)m_pFeedback; m_pBezierCurveFeed.AddPoint(pPoint); IPoint tempPoint = new PointClass(); tempPoint.X = pPoint.X; tempPoint.Y = pPoint.Y; m_pUndoArray.Add(tempPoint); UpdataBezierCurveFeed(m_MapControl, ref m_pUndoArray); //刷新屏幕 if ((m_bFixLength == true) && (m_bFixDirection == false)) //可以给定一个长度值 { m_bFixLength = false; } else if ((m_bFixLength == false) && (m_bFixDirection == true)) //可以给定一个固定方向值 { m_bFixDirection = false; } else if ((m_bFixLength == true) && (m_bFixDirection == true)) { m_bFixLength = false; m_bFixDirection = false; } if (m_bFixLeftCorner) { m_bFixLeftCorner = false; } } m_pLastPoint = pPoint; if (m_bkeyCodeS == true) //直角结束 { m_bkeyCodeS = false; if (((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline) { m_pLastLineFeed.Stop(); } } m_pSegment = null; //清空捕捉到的片断 }
public override void OnDblClick() { IGeometry pGeometry; if (m_newBezierCurveFeedback != null) { m_newBezierCurveFeedback.AddPoint(fPoint); } pGeometry = m_newBezierCurveFeedback.Stop(); IActiveView pActiveView = m_hookHelper.ActiveView; m_newBezierCurveFeedback = null; IPolyline polyline = new PolylineClass(); polyline = (IPolyline)pGeometry; //polyline = DataEditCommon.PDFX(polyline, "Bezier"); IPointCollection pointCollection = (IPointCollection)polyline; if (pointCollection.PointCount < 4) { MessageBox.Show("�ؼ��㲻��С��3����"); return; } //DrawFeatureByShape(m_pCurrentLayer, pGeometry); CollapsePillarsEntering form = new CollapsePillarsEntering(pointCollection); form.ShowDialog(); }