private void method_3(IDisplay idisplay_0, esriViewDrawPhase esriViewDrawPhase_0) { if ((CmdSelectTopology.m_TopologyGraph == null ? false : this.Enabled)) { IEnumTopologyEdge edgeSelection = CmdSelectTopology.m_TopologyGraph.EdgeSelection; edgeSelection.Reset(); ITopologyEdge topologyEdge = edgeSelection.Next(); object value = Missing.Value; if (topologyEdge != null) { IGeometryCollection polylineClass = new Polyline() as IGeometryCollection; while (topologyEdge != null) { polylineClass.AddGeometryCollection((IGeometryCollection)topologyEdge.Geometry); topologyEdge = edgeSelection.Next(); } idisplay_0.SetSymbol((ISymbol)this.ilineSymbol_0); idisplay_0.DrawPolyline((IGeometry)polylineClass); } IEnumTopologyNode nodeSelection = CmdSelectTopology.m_TopologyGraph.NodeSelection; nodeSelection.Reset(); ITopologyNode topologyNode = nodeSelection.Next(); if (topologyNode != null) { IPointCollection multipointClass = new Multipoint(); while (topologyNode != null) { multipointClass.AddPoint((IPoint)topologyNode.Geometry, ref value, ref value); topologyNode = nodeSelection.Next(); } idisplay_0.SetSymbol((ISymbol)this.imarkerSymbol_0); idisplay_0.DrawMultipoint((IGeometry)multipointClass); } } }
public static void EndSketch(bool bool_0, IActiveView iactiveView_0, IFeatureLayer ifeatureLayer_0) { INewLineFeedback feedback; IPointCollection pointCollection; IGeometryCollection mLastPartGeometry; try { if (SketchToolAssist.m_pPointColn != null) { SketchToolAssist.m_pPointColn.RemovePoints(0, SketchToolAssist.m_pPointColn.PointCount); } IPoint mPAnchorPoint = null; if (SketchToolAssist.Feedback != null) { if (SketchToolAssist.IsDrawTempLine == DrawTempGeometry.Line) { feedback = (INewLineFeedback)SketchToolAssist.Feedback; mPAnchorPoint = SketchShareEx.m_pAnchorPoint; if (bool_0) { feedback.AddPoint(mPAnchorPoint); } SketchToolAssist.TempLine = feedback.Stop(); SketchShareEx.m_bInUse = false; if (SketchToolAssist.CurrentTask != null) { SketchToolAssist.CurrentTask.Excute(); } SketchToolAssist.Feedback = null; return; } else if (SketchToolAssist.IsDrawTempLine == DrawTempGeometry.Fill) { INewPolygonFeedbackEx newPolygonFeedbackEx = (INewPolygonFeedbackEx)SketchToolAssist.Feedback; mPAnchorPoint = SketchShareEx.m_pAnchorPoint; if (bool_0) { newPolygonFeedbackEx.AddPoint(mPAnchorPoint); } SketchToolAssist.TempLine = newPolygonFeedbackEx.Stop(); SketchShareEx.m_bInUse = false; if (SketchToolAssist.CurrentTask != null) { SketchToolAssist.CurrentTask.Excute(); } SketchToolAssist.Feedback = null; return; } else if (SketchToolAssist.IsDrawTempLine != DrawTempGeometry.Point) { mPAnchorPoint = SketchShareEx.m_pAnchorPoint; IGeometry mPPointCollection = null; if (SketchToolAssist.Feedback is INewMultiPointFeedback) { ((INewMultiPointFeedback)SketchToolAssist.Feedback).Stop(); mPPointCollection = (IGeometry)SketchShareEx.m_pPointCollection; } else if (SketchToolAssist.Feedback is INewLineFeedback) { feedback = (INewLineFeedback)SketchToolAssist.Feedback; if (bool_0) { feedback.AddPoint(mPAnchorPoint); } IPolyline polyline = feedback.Stop(); if (polyline != null) { pointCollection = (IPointCollection)polyline; if (pointCollection.PointCount >= 2) { mPPointCollection = (IGeometry)pointCollection; if (SketchShareEx.m_LastPartGeometry != null && SketchShareEx.m_LastPartGeometry is IPolyline) { mLastPartGeometry = SketchShareEx.m_LastPartGeometry as IGeometryCollection; mLastPartGeometry.AddGeometryCollection(polyline as IGeometryCollection); mPPointCollection = mLastPartGeometry as IGeometry; SketchShareEx.m_LastPartGeometry = null; } } SketchShareEx.m_pLastPoint1 = null; SketchShareEx.m_pEndPoint1 = null; SketchShareEx.m_totalLength = 0; if ((mPPointCollection == null ? false : SketchShareEx.IsCreateParrel)) { object value = Missing.Value; object constructOffset = SketchShareEx.ConstructOffset; IConstructCurve polylineClass = new Polyline() as IConstructCurve; polylineClass.ConstructOffset(mPPointCollection as IPolycurve, SketchShareEx.m_offset, ref constructOffset, ref value); IGeometryCollection geometryCollection = new Polyline() as IGeometryCollection; geometryCollection.AddGeometryCollection(polylineClass as IGeometryCollection); polylineClass = new Polyline() as IConstructCurve; polylineClass.ConstructOffset(mPPointCollection as IPolycurve, -SketchShareEx.m_offset, ref constructOffset, ref value); geometryCollection.AddGeometryCollection(polylineClass as IGeometryCollection); mPPointCollection = geometryCollection as IGeometry; } } } else if (SketchToolAssist.Feedback is INewPolygonFeedback) { INewPolygonFeedback newPolygonFeedback = (INewPolygonFeedback)SketchToolAssist.Feedback; if (bool_0) { newPolygonFeedback.AddPoint(mPAnchorPoint); } IPolygon polygon = newPolygonFeedback.Stop(); if (polygon != null) { pointCollection = (IPointCollection)polygon; if (pointCollection.PointCount >= 3) { mPPointCollection = (IGeometry)pointCollection; if (!(mPPointCollection as ITopologicalOperator).IsSimple) { (mPPointCollection as ITopologicalOperator).Simplify(); } if (SketchShareEx.m_LastPartGeometry != null && SketchShareEx.m_LastPartGeometry is IPolygon) { mLastPartGeometry = SketchShareEx.m_LastPartGeometry as IGeometryCollection; mLastPartGeometry.AddGeometryCollection(polygon as IGeometryCollection); mPPointCollection = mLastPartGeometry as IGeometry; SketchShareEx.m_LastPartGeometry = null; } } SketchToolAssist.m_pPointColn = null; } } CreateFeatureTool.CreateFeature(mPPointCollection, iactiveView_0, ifeatureLayer_0); } else { SketchToolAssist.TempLine = SketchShareEx.m_pAnchorPoint; SketchShareEx.m_bInUse = false; if (SketchToolAssist.CurrentTask != null) { SketchToolAssist.CurrentTask.Excute(); } SketchToolAssist.Feedback = null; return; } } } catch (COMException cOMException1) { COMException cOMException = cOMException1; if (cOMException.ErrorCode != -2147220936) { Logger.Current.Error("", cOMException, ""); } else { MessageBox.Show("坐标值或量测值超出范围!", "创建要素", MessageBoxButtons.OK, MessageBoxIcon.Hand); } iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGeography, ifeatureLayer_0, null); } catch (Exception exception1) { Exception exception = exception1; iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGeography, ifeatureLayer_0, null); Logger.Current.Error("", exception, ""); } SketchShareEx.m_bInUse = false; SketchShareEx.LastPoint = null; SketchToolAssist.Feedback = null; SketchShareEx.PointCount = 0; SketchShareEx.m_bSnapSuccessful = false; SketchToolAssist.m_pAP = null; }
public static void EndSketch(IGeometry igeometry_0, IActiveView iactiveView_0, IFeatureLayer ifeatureLayer_0) { IGeometryCollection mLastPartGeometry; try { if (igeometry_0.GeometryType == esriGeometryType.esriGeometryPolyline) { IPolyline igeometry0 = igeometry_0 as IPolyline; if (SketchShareEx.m_LastPartGeometry != null && SketchShareEx.m_LastPartGeometry is IPolyline) { mLastPartGeometry = SketchShareEx.m_LastPartGeometry as IGeometryCollection; mLastPartGeometry.AddGeometryCollection(igeometry0 as IGeometryCollection); igeometry_0 = mLastPartGeometry as IGeometry; SketchShareEx.m_LastPartGeometry = null; } SketchShareEx.m_pLastPoint1 = null; SketchShareEx.m_pEndPoint1 = null; SketchShareEx.m_totalLength = 0; if ((igeometry_0 == null ? false : SketchShareEx.IsCreateParrel)) { object value = Missing.Value; object constructOffset = SketchShareEx.ConstructOffset; IConstructCurve polylineClass = new Polyline() as IConstructCurve; polylineClass.ConstructOffset(igeometry_0 as IPolycurve, SketchShareEx.m_offset, ref constructOffset, ref value); IGeometryCollection geometryCollection = new Polyline() as IGeometryCollection; geometryCollection.AddGeometryCollection(polylineClass as IGeometryCollection); polylineClass = new Polyline() as IConstructCurve; polylineClass.ConstructOffset(igeometry_0 as IPolycurve, -SketchShareEx.m_offset, ref constructOffset, ref value); geometryCollection.AddGeometryCollection(polylineClass as IGeometryCollection); igeometry_0 = geometryCollection as IGeometry; } } else if (igeometry_0.GeometryType == esriGeometryType.esriGeometryPolygon) { IPolygon polygon = igeometry_0 as IPolygon; if (SketchShareEx.m_LastPartGeometry != null && SketchShareEx.m_LastPartGeometry is IPolygon) { mLastPartGeometry = SketchShareEx.m_LastPartGeometry as IGeometryCollection; mLastPartGeometry.AddGeometryCollection(polygon as IGeometryCollection); igeometry_0 = mLastPartGeometry as IGeometry; SketchShareEx.m_LastPartGeometry = null; } SketchToolAssist.m_pPointColn = null; } CreateFeatureTool.CreateFeature(igeometry_0, iactiveView_0, ifeatureLayer_0); } catch (COMException cOMException1) { COMException cOMException = cOMException1; if (cOMException.ErrorCode != -2147220936) { Logger.Current.Error("", cOMException, ""); } else { MessageBox.Show("坐标值或量测值超出范围!", "创建要素", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } catch (Exception exception) { Logger.Current.Error("", exception, ""); } iactiveView_0.Refresh(); SketchShareEx.m_bInUse = false; SketchShareEx.LastPoint = null; SketchToolAssist.Feedback = null; SketchShareEx.PointCount = 0; SketchShareEx.m_pAnchorPoint = null; }