/// <summary> /// Add all points, which need to be in extent of region object, to point list. /// </summary> /// <param name="obj">Region object to get points.</param> /// <param name="points">Point list.</param> private static void _AddRegionToExtent(object obj, List <Point> points) { object geometry = (obj is Zone) ? (obj as Zone).Geometry : (obj as Barrier).Geometry; if (null != geometry) { ESRI.ArcLogistics.Geometry.Point?pointGeometry = geometry as ESRI.ArcLogistics.Geometry.Point?; if (pointGeometry != null) { points.Add(pointGeometry.Value); } else { Debug.Assert(geometry is ESRI.ArcLogistics.Geometry.PolyCurve); ESRI.ArcLogistics.Geometry.PolyCurve polyCurve = geometry as ESRI.ArcLogistics.Geometry.PolyCurve; for (int index = 0; index < polyCurve.Groups.Length; index++) { ESRI.ArcLogistics.Geometry.Point[] pointsArray = polyCurve.GetGroupPoints(index); foreach (ESRI.ArcLogistics.Geometry.Point point in pointsArray) { points.Add(point); } } } } }
/// <summary> /// Pan Geometry by edit marker. /// </summary> /// <param name="points">Geometry points.</param> /// <param name="dx">Pan dx.</param> /// <param name="dy">Pan dy.</param> /// <param name="polyCurve">Poly curve.</param> private void _PanByEditMarker(Point[] points, double dx, double dy, PolyCurve polyCurve) { Debug.Assert(points != null); Debug.Assert(_editedGraphic is EditMarkerGraphicObject); if (_editedGraphic is EditMarkerGraphicObject) { int index = _markersLayer.MapLayer.Graphics.IndexOf(_editedGraphic); // In case of pan marker for start or end point in ring(which has equal positions) // we need to pan both points. int groupStartIndex = 0; int groupEndIndex = 0; int maxIndexInGroup = 0; foreach (int groupSize in polyCurve.Groups) { if (maxIndexInGroup + groupSize > index) { groupStartIndex = maxIndexInGroup; groupEndIndex = groupStartIndex + groupSize - 1; break; } maxIndexInGroup += groupSize; } // In case of last point in ring in polygon. if (index == groupEndIndex && polyCurve is Polygon) index = groupStartIndex; double newX = points[index].X + dx; double newY = points[index].Y + dy; Point point = new Point(newX, newY); points[index] = point; // Move last point of polygon. if (index == groupStartIndex && polyCurve is Polygon) { index = groupEndIndex; double newLastX = points[index].X + dx; double newLastY = points[index].Y + dy; Point pointLast = new Point(newLastX, newLastY); points[index] = pointLast; } } }