Пример #1
0
 /// <summary>
 /// Convert Lng/Lat points to Screen Coordinates
 /// </summary>
 /// <param name="lngLats">Lng/Lat Points</param>
 /// <param name="zoomLevel">ZoomLevel</param>
 /// <returns></returns>
 public static IEnumerable <Vector2> ConvertPoints(IEnumerable <PointF> lngLats, int zoomLevel)
 {
     foreach (var lngLat in lngLats)
     {
         yield return(MM_Coordinates.LngLatToScreenVector2(lngLat, zoomLevel));
     }
 }
 /// <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();
     }
 }
Пример #3
0
        /// <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));
        }