public override void OnClick() { if (SketchShareEx.m_pAnchorPoint != null) { IPoint point = new Point(); point.PutCoords(SketchShareEx.m_pAnchorPoint.X, SketchShareEx.m_pAnchorPoint.Y); point.SpatialReference = _context.FocusMap.SpatialReference; double snapTolerance = _context.Config.EngineSnapEnvironment.SnapTolerance; IFeature feature; Yutai.ArcGIS.Common.Editor.Editor.GetClosesFeature(_context.FocusMap, point, snapTolerance, out feature); if (feature != null) { IGeometry shapeCopy = feature.ShapeCopy; double num = 0.0; int num2 = 0; int num3 = 0; bool flag = false; IPoint point2 = new Point(); point2.PutCoords(0.0, 0.0); if ((shapeCopy.GeometryType == esriGeometryType.esriGeometryPolygon || shapeCopy.GeometryType == esriGeometryType.esriGeometryPolyline) && (shapeCopy as IHitTest).HitTest(point, 4.0, esriGeometryHitPartType.esriGeometryPartBoundary, point2, ref num, ref num2, ref num3, ref flag)) { SketchShareEx.m_pAnchorPoint.PutCoords(point2.X, point2.Y); SketchShareEx.SketchMouseDown(SketchShareEx.m_pAnchorPoint, _context.ActiveView, Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer); } } } }
public override void OnMouseMove(int Button, int Shift, int int_2, int int_3) { IActiveView focusMap = (IActiveView)_context.FocusMap; IPoint mapPoint = focusMap.ScreenDisplay.DisplayTransformation.ToMapPoint(int_2, int_3); SketchShareEx.SketchMouseMove(mapPoint, _context.FocusMap, _context.Config.EngineSnapEnvironment); //base.OnMouseMove(Button, Shift, int_2, int_3); }
private void ParseInput(double x, double y) { SketchShareEx.m_pAnchorPoint.PutCoords(x, y); SketchShareEx.SketchMouseDown(SketchShareEx.m_pAnchorPoint, _context.ActiveView, Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer); SketchShareEx.IsFixDirection = false; SketchShareEx.IsFixLength = false; }
public override void OnClick() { if (SketchShareEx.m_pAnchorPoint != null) { IPoint point = new Point(); point.PutCoords(SketchShareEx.m_pAnchorPoint.X, SketchShareEx.m_pAnchorPoint.Y); point.SpatialReference = _context.FocusMap.SpatialReference; double snapTolerance = _context.Config.EngineSnapEnvironment.SnapTolerance; IFeature feature; Yutai.ArcGIS.Common.Editor.Editor.GetClosesFeature(_context.FocusMap, point, snapTolerance, out feature); if (feature != null) { IGeometry shapeCopy = feature.ShapeCopy; double num = 0.0; int index = 0; int i = 0; bool flag = false; IPoint point2 = new Point(); point2.PutCoords(0.0, 0.0); if (shapeCopy.GeometryType == esriGeometryType.esriGeometryPolygon || shapeCopy.GeometryType == esriGeometryType.esriGeometryPolyline) { if ((shapeCopy as IHitTest).HitTest(point, 4.0, esriGeometryHitPartType.esriGeometryPartBoundary, point2, ref num, ref index, ref i, ref flag)) { ISegmentCollection segmentCollection = (shapeCopy as IGeometryCollection).get_Geometry(index) as ISegmentCollection; ISegment segment = segmentCollection.get_Segment(i); ILine line = new Line(); line.SpatialReference = _context.FocusMap.SpatialReference; line.PutCoords(point2, segment.FromPoint); double length = line.Length; line.PutCoords(point2, segment.ToPoint); double length2 = line.Length; if (length < length2) { SketchShareEx.m_pAnchorPoint.PutCoords(segment.FromPoint.X, segment.FromPoint.Y); } else { SketchShareEx.m_pAnchorPoint.PutCoords(segment.ToPoint.X, segment.ToPoint.Y); } SketchShareEx.SketchMouseDown(SketchShareEx.m_pAnchorPoint, _context.ActiveView, Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer); } } else if ((shapeCopy.GeometryType == esriGeometryType.esriGeometryMultipoint || shapeCopy.GeometryType == esriGeometryType.esriGeometryPoint) && (shapeCopy as IHitTest).HitTest(point, 4.0, esriGeometryHitPartType.esriGeometryPartVertex, point2, ref num, ref index, ref i, ref flag)) { SketchShareEx.m_pAnchorPoint.PutCoords(point2.X, point2.Y); SketchShareEx.SketchMouseDown(SketchShareEx.m_pAnchorPoint, _context.ActiveView, Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer); } } } }
public override void OnClick() { SketchShareEx.EndSketch(false, _context.FocusMap as IActiveView, Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer); SketchToolAssist.Feedback = null; SketchShareEx.PointCount = 0; SketchShareEx.m_bInUse = false; SketchShareEx.m_pSketchCommandFolw.Reset(); }
private void ActiveViewEvent_AfterDraw(IDisplay idisplay_0, esriViewDrawPhase esriViewDrawPhase_0) { if (this.Enabled && esriViewDrawPhase_0 == esriViewDrawPhase.esriViewForeground) { SketchShareEx.Draw(idisplay_0); if (SketchToolAssist.Feedback != null) { SketchToolAssist.Feedback.Refresh(0); } } }
private void ParseInput(double x, double y) { x = SketchShareEx.LastPoint.X + x; y = SketchShareEx.LastPoint.Y + y; IPoint point = new Point(); SketchShareEx.m_pAnchorPoint.PutCoords(x, y); point.X = x; point.Y = y; SketchShareEx.SketchMouseDown(point, _context.ActiveView, Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer); SketchShareEx.IsFixDirection = false; SketchShareEx.IsFixLength = false; }
private void ParseInput(double angle, double length) { angle = angle * 3.1415926535897931 / 180.0; double num = length * Math.Cos(angle); double num2 = length * Math.Sin(angle); num = SketchShareEx.LastPoint.X + num; num2 = SketchShareEx.LastPoint.Y + num2; SketchShareEx.m_pAnchorPoint.PutCoords(num, num2); SketchShareEx.SketchMouseDown(SketchShareEx.m_pAnchorPoint, _context.ActiveView, Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer); SketchShareEx.IsFixDirection = false; SketchShareEx.IsFixLength = false; }
private void FixLength(double length) { SketchShareEx.FixLength = length; SketchShareEx.IsFixLength = true; if (SketchShareEx.IsFixDirection) { double num = SketchShareEx.FixLength * Math.Cos(SketchShareEx.FixDirection * 3.1415926535897931 / 180.0); double num2 = SketchShareEx.FixLength * Math.Sin(SketchShareEx.FixDirection * 3.1415926535897931 / 180.0); num = SketchShareEx.LastPoint.X + num; num2 = SketchShareEx.LastPoint.Y + num2; SketchShareEx.m_pAnchorPoint.PutCoords(num, num2); SketchShareEx.SketchMouseDown(SketchShareEx.m_pAnchorPoint, _context.ActiveView, Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer); SketchShareEx.IsFixDirection = false; SketchShareEx.IsFixLength = false; } }
public override void OnDblClick() { if (SketchToolAssist.Feedback != null) { if (SketchToolAssist.CurrentTask == null) { SketchShareEx.EndSketch(false, _context.FocusMap as IActiveView, Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer); _context.ShowCommandString("完成", CommandTipsType.CTTInput); this.pCommandFlow.Reset(); Yutai.ArcGIS.Common.Editor.Editor.EnableUndoRedo = true; _context.UpdateUI(); } else { SketchShareEx.EndSketch(false, _context.FocusMap as IActiveView, null); } } }
public void EndSketch() { ISpatialReference spatialReference = (Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer as IGeoDataset).SpatialReference; IGeometry geometry = null; if (SketchToolAssist.Feedback is INewPolylineFeedback) { geometry = (SketchToolAssist.Feedback as INewPolylineFeedback).SquareAndFinish(spatialReference); } else if (SketchToolAssist.Feedback is INewPolygonFeedbackEx) { geometry = (SketchToolAssist.Feedback as INewPolygonFeedbackEx).SquareAndFinish(spatialReference); } if (geometry != null) { SketchShareEx.EndSketch(geometry, _context.ActiveView, Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer); SketchToolAssist.Feedback = null; SketchShareEx.PointCount = 0; SketchShareEx.m_bInUse = false; } }
public override void OnClick() { if (SketchShareEx.m_pAnchorPoint != null) { IPoint point = new Point(); point.PutCoords(SketchShareEx.m_pAnchorPoint.X, SketchShareEx.m_pAnchorPoint.Y); point.SpatialReference = _context.FocusMap.SpatialReference; double snapTolerance = _context.Config.EngineSnapEnvironment.SnapTolerance; IFeature feature; Yutai.ArcGIS.Common.Editor.Editor.GetClosesFeature(_context.FocusMap, point, snapTolerance, out feature); if (feature != null) { IGeometry shapeCopy = feature.ShapeCopy; double num = 0.0; int num2 = 0; int num3 = 0; bool flag = false; IPoint point2 = new Point(); point2.PutCoords(0.0, 0.0); if (shapeCopy.GeometryType == esriGeometryType.esriGeometryPolyline || shapeCopy.GeometryType == esriGeometryType.esriGeometryPolygon) { if ((shapeCopy as IHitTest).HitTest(point, 4.0, esriGeometryHitPartType.esriGeometryPartBoundary, point2, ref num, ref num2, ref num3, ref flag)) { double num4 = 0.0; ISegmentCollection segmentCollection; for (int i = 0; i < num2; i++) { segmentCollection = ((shapeCopy as IGeometryCollection).get_Geometry(i) as ISegmentCollection); num4 += (segmentCollection as ICurve).Length; } segmentCollection = ((shapeCopy as IGeometryCollection).get_Geometry(num2) as ISegmentCollection); ISegment segment; for (int i = 0; i < num3; i++) { segment = segmentCollection.get_Segment(i); num4 += segment.Length; } segment = segmentCollection.get_Segment(num3); ILine line = new Line(); line.SpatialReference = _context.FocusMap.SpatialReference; line.PutCoords(point2, segment.FromPoint); num4 += line.Length; line.PutCoords(point2, segment.ToPoint); double num5 = line.Length; for (int i = num3 + 1; i < segmentCollection.SegmentCount; i++) { segment = segmentCollection.get_Segment(i); num5 += segment.Length; } for (int i = num2 + 1; i < (shapeCopy as IGeometryCollection).GeometryCount; i++) { segmentCollection = ((shapeCopy as IGeometryCollection).get_Geometry(i) as ISegmentCollection); num5 += (segmentCollection as ICurve).Length; } IPoint point3; if (num4 < num5) { point3 = (shapeCopy as IPointCollection).get_Point((shapeCopy as IPointCollection).PointCount); } else { point3 = (shapeCopy as IPointCollection).get_Point((shapeCopy as IPointCollection).PointCount); } SketchShareEx.m_pAnchorPoint.PutCoords(point3.X, point3.Y); SketchShareEx.SketchMouseDown(SketchShareEx.m_pAnchorPoint, _context.ActiveView, Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer); } } else if ((shapeCopy.GeometryType == esriGeometryType.esriGeometryMultipoint || shapeCopy.GeometryType == esriGeometryType.esriGeometryPoint) && (shapeCopy as IHitTest).HitTest(point, 4.0, esriGeometryHitPartType.esriGeometryPartVertex, point2, ref num, ref num2, ref num3, ref flag)) { SketchShareEx.m_pAnchorPoint.PutCoords(point2.X, point2.Y); SketchShareEx.SketchMouseDown(SketchShareEx.m_pAnchorPoint, _context.ActiveView, Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer); } } } }
public override void OnMouseMove(int Button, int Shift, int X, int Y) { double x; double y; double num; IActiveView focusMap = (IActiveView)_context.FocusMap; IPoint mapPoint = focusMap.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); if (SketchToolAssist.CurrentTask != null) { SketchShareEx.SketchMouseMove(mapPoint, _context.FocusMap, _context.Config.EngineSnapEnvironment); } else if (this.bool_1) { double searchTolerance = 8; searchTolerance = (double)_context.Config.SelectionEnvironment.SearchTolerance; searchTolerance = Common.ConvertPixelsToMapUnits((IActiveView)_context.FocusMap, searchTolerance); bool flag = false; if (SketchToolAssist.Feedback is NewPolylineFeedback) { flag = (SketchToolAssist.Feedback as NewPolylineFeedback).HitTest(mapPoint, searchTolerance, out this.ipoint_1); } else if (SketchToolAssist.Feedback is NewPolygonFeedbackEx) { flag = (SketchToolAssist.Feedback as NewPolygonFeedbackEx).HitTest(mapPoint, searchTolerance, out this.ipoint_1); } if (!flag) { this.m_cursor.Dispose(); this.m_cursor = new Cursor(new MemoryStream(Resource.Digitise)); } else { this.m_cursor.Dispose(); this.m_cursor = new Cursor( base.GetType() .Assembly.GetManifestResourceStream( "Yutai.Plugins.Editor.Resources.Cursor.DeleteVertex.cur")); } } else if ((!SketchShareEx.m_bInStreaming ? true : !this.ValidateLayer(Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer))) { if (SketchShareEx.IsFixDirection) { x = mapPoint.X - SketchShareEx.LastPoint.X; y = mapPoint.Y - SketchShareEx.LastPoint.Y; num = Common.azimuth(SketchShareEx.LastPoint, mapPoint); double num1 = Math.Sqrt(x * x + y * y); double num2 = num1 * Math.Cos(SketchShareEx.FixDirection * 3.14159265358979 / 180); double num3 = num1 * Math.Sin(SketchShareEx.FixDirection * 3.14159265358979 / 180); if (!(SketchShareEx.FixDirection < 0 ? true : SketchShareEx.FixDirection >= 90)) { if ((num < 90 + SketchShareEx.FixDirection ? false : num < 270 + SketchShareEx.FixDirection)) { num2 = -num2; num3 = -num3; } } else if (!(SketchShareEx.FixDirection < 90 ? true : SketchShareEx.FixDirection >= 270)) { if ((num < SketchShareEx.FixDirection - 90 ? true : num >= SketchShareEx.FixDirection + 90)) { num2 = -num2; num3 = -num3; } } else if ((num < SketchShareEx.FixDirection - 270 ? false : num < SketchShareEx.FixDirection - 90)) { num2 = -num2; num3 = -num3; } x = SketchShareEx.LastPoint.X + num2; y = SketchShareEx.LastPoint.Y + num3; mapPoint.PutCoords(x, y); } else if (SketchShareEx.IsFixLength) { num = Common.azimuth(SketchShareEx.LastPoint, mapPoint); x = SketchShareEx.FixLength * Math.Cos(num * 3.14159265358979 / 180); y = SketchShareEx.FixLength * Math.Sin(num * 3.14159265358979 / 180); x = SketchShareEx.LastPoint.X + x; y = SketchShareEx.LastPoint.Y + y; mapPoint.PutCoords(x, y); } string str = SketchShareEx.SketchMouseMove(mapPoint, _context.FocusMap, _context.Config.EngineSnapEnvironment); if (this.bool_0) { _context.SetStatus(str); } } else if (Common.distance(mapPoint, SketchShareEx.LastPoint) > SketchShareEx.m_MinDis) { string str1 = SketchShareEx.m_pAnchorPoint.X.ToString(); double y1 = SketchShareEx.m_pAnchorPoint.Y; string str2 = string.Concat(str1, ",", y1.ToString()); _context.ShowCommandString(str2, CommandTipsType.CTTInput); this.ShowCommandLine(); string str3 = SketchShareEx.SketchMouseDown(mapPoint, _context.ActiveView, Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer); if (this.bool_0) { _context.SetStatus(str3); } } }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { string str; if (Button == 1) { IActiveView focusMap = (IActiveView)_context.FocusMap; if (SketchToolAssist.CurrentTask == null) { this.ipoint_0 = focusMap.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); if (SketchToolAssist.Feedback == null) { this.bool_1 = false; } if (this.bool_1) { bool point = false; if (this.ipoint_1 != null) { if (SketchToolAssist.Feedback is NewPolylineFeedback) { point = (SketchToolAssist.Feedback as NewPolylineFeedback).UndoToPoint(this.ipoint_1); } else if (SketchToolAssist.Feedback is NewPolygonFeedbackEx) { point = (SketchToolAssist.Feedback as NewPolygonFeedbackEx).UndoToPoint(this.ipoint_1); } } if (point) { this.bool_1 = false; this.m_cursor.Dispose(); this.m_cursor = new Cursor(new MemoryStream(Resource.Digitise)); } } else if ((!SketchShareEx.m_bInStreaming ? true : !this.ValidateLayer(Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer))) { string str1 = SketchShareEx.m_pAnchorPoint.X.ToString(); double y = SketchShareEx.m_pAnchorPoint.Y; string str2 = string.Concat(str1, ",", y.ToString()); _context.ShowCommandString(str2, CommandTipsType.CTTInput); if (SketchToolAssist.CurrentTask == null) { if (this.pCommandFlow == null) { str = SketchShareEx.SketchMouseDown(SketchShareEx.m_pAnchorPoint, focusMap, Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer); if (this.bool_0) { _context.SetStatus(str); } } else { Yutai.ArcGIS.Common.Editor.Editor.EnableUndoRedo = false; this.pCommandFlow.HandleCommand(str2); } _context.UpdateUI(); } else { str = SketchShareEx.SketchMouseDown(SketchShareEx.m_pAnchorPoint, focusMap, null); } } } else { SketchShareEx.SketchMouseDown(SketchShareEx.m_pAnchorPoint, focusMap, null); } } }