/// <summary> /// Initialize our coordinate suggestion /// </summary> /// <param name="BaseElement"></param> /// <param name="Coordinates"></param> public MM_Coordinate_Suggestion(MM_Element BaseElement, MM_Coordinates Coordinates) { this.BaseElement = BaseElement; if (BaseSubstation != null) { OriginalCoordinates = new PointF[] { BaseSubstation.LngLat }; SuggestedCoordinates = new PointF[] { BaseSubstation.LngLat }; SuggestedCoordinatesXY = new Point[] { MM_Coordinates.LngLatToXY(BaseSubstation.LngLat, Coordinates.ZoomLevel) }; } else if (BaseLine != null) { OriginalCoordinates = (PointF[])BaseLine.Coordinates.ToArray(); SuggestedCoordinates = BaseLine.Coordinates.ToArray(); List <Point> InflectionPoints = new List <Point>(); foreach (PointF pt in SuggestedCoordinates) { InflectionPoints.Add(MM_Coordinates.LngLatToXY(pt, Coordinates.ZoomLevel)); } SuggestedCoordinatesXY = InflectionPoints.ToArray(); } }
/// <summary> /// Convert a latitude/longitude to screen point /// </summary> /// <param name="inPoint">The point to convert</param> /// <returns></returns> public Point ConvertPoint(PointF inPoint) { Point xyPoint = MM_Coordinates.LngLatToXY(inPoint, ZoomLevel); return(new Point(xyPoint.X + TopLeftXY.X, xyPoint.Y + TopLeftXY.Y)); }