Example #1
0
        public GoogleRectangle(CoordinatePoligon coordinatePoligon, int level)
        {
            for (var i = 0; i < coordinatePoligon.Count; i++)
            {
                var pt = new GoogleCoordinate(coordinatePoligon.Coordinates[i], level);
                if (i == 0)
                {
                    Left   = pt.X;
                    Right  = pt.X;
                    Top    = pt.Y;
                    Bottom = pt.Y;
                }
                else
                {
                    if (pt.X < Left)
                    {
                        Left = pt.X;
                    }
                    if (pt.X > Right)
                    {
                        Right = pt.X;
                    }
                    if (pt.Y < Top)
                    {
                        Top = pt.Y;
                    }
                    if (pt.Y > Bottom)
                    {
                        Bottom = pt.Y;
                    }
                }
            }

            Level = level;
        }
Example #2
0
        /// <summary>
        /// Translate Y coordinate of the google level bitmap to latitude
        /// </summary>
        public static double GetLatitude(GoogleCoordinate google)
        {
            const double r2D = 180 / Math.PI;
            const double p2  = Math.PI / 2;
            var          z   = (google.Y - BitmapOrigo(google.Level)) / (-1 * PixelsPerRadian(google.Level));

            return(Math.Round((2 * Math.Atan(Math.Exp(z)) - p2) * r2D, 5));
        }
Example #3
0
 public static GoogleCoordinate operator +(GoogleCoordinate google, GoogleCoordinate addon)
 {
     if (google.Level != addon.Level)
     {
         addon = new GoogleCoordinate(addon, google.Level);
     }
     return(new GoogleCoordinate(google.X + addon.X, google.Y + addon.Y, google.Level));
 }
 public static GoogleCoordinate operator + (GoogleCoordinate google, GoogleCoordinate addon)
 {
     if (google.Level != addon.Level)
     {
         addon = new GoogleCoordinate(addon, google.Level);
     }
     return new GoogleCoordinate(google.X + addon.X, google.Y + addon.Y, google.Level);
 }
 public GoogleRectangle(CoordinateRectangle coordinateRect, int level)
 {
     var pLeftTop = new GoogleCoordinate(coordinateRect.LeftTop, level);
     var pRightBottom = new GoogleCoordinate(coordinateRect.RightBottom, level);
     Left = pLeftTop.X;
     Top = pLeftTop.Y;
     Right = pRightBottom.X;
     Bottom = pRightBottom.Y;
     Level = level;
 }
Example #6
0
        public GoogleRectangle(CoordinateRectangle coordinateRect, int level)
        {
            var pLeftTop     = new GoogleCoordinate(coordinateRect.LeftTop, level);
            var pRightBottom = new GoogleCoordinate(coordinateRect.RightBottom, level);

            Left   = pLeftTop.X;
            Top    = pLeftTop.Y;
            Right  = pRightBottom.X;
            Bottom = pRightBottom.Y;
            Level  = level;
        }
 public GoogleRectangle(GoogleCoordinate pLeftTop, GoogleCoordinate pRightBottom)
 {
     if (pRightBottom.Level != pLeftTop.Level)
     {
         pRightBottom = new GoogleCoordinate(pRightBottom, pLeftTop.Level);
     }
     Left = pLeftTop.X;
     Top = pLeftTop.Y;
     Right = pRightBottom.X;
     Bottom = pRightBottom.Y;
     Level = pLeftTop.Level;
 }
Example #8
0
 public GoogleRectangle(GoogleCoordinate pLeftTop, GoogleCoordinate pRightBottom)
 {
     if (pRightBottom.Level != pLeftTop.Level)
     {
         pRightBottom = new GoogleCoordinate(pRightBottom, pLeftTop.Level);
     }
     Left   = pLeftTop.X;
     Top    = pLeftTop.Y;
     Right  = pRightBottom.X;
     Bottom = pRightBottom.Y;
     Level  = pLeftTop.Level;
 }
 public GoogleRectangle(CoordinatePoligon coordinatePoligon, int level)
 {
     for (var i = 0; i < coordinatePoligon.Count; i++)
     {
         var pt = new GoogleCoordinate(coordinatePoligon.Coordinates[i], level);
         if (i == 0)
         {
             Left = pt.X;
             Right = pt.X;
             Top = pt.Y;
             Bottom = pt.Y;
         }
         else
         {
             if (pt.X < Left) Left = pt.X;
             if (pt.X > Right) Right = pt.X;
             if (pt.Y < Top) Top = pt.Y;
             if (pt.Y > Bottom) Bottom = pt.Y;
         }
     }
         
     Level = level;
 }
Example #10
0
 /// <summary>
 /// Translate X coordinate of the google level bitmap to longitude
 /// </summary>
 public static double GetLongitude(GoogleCoordinate google)
 {
     return(Math.Round((google.X - BitmapOrigo(google.Level)) / PixelsPerDegree(google.Level), 5));
 }
 /// <summary>
 /// Translate Y coordinate of the google level bitmap to latitude
 /// </summary>
 public static double GetLatitude(GoogleCoordinate google)
 {
     const double r2D = 180 / Math.PI; 
     const double p2 = Math.PI / 2;
     var z = (google.Y - BitmapOrigo(google.Level)) / (-1 * PixelsPerRadian(google.Level));
     return Math.Round((2 * Math.Atan(Math.Exp(z)) - p2) * r2D, 5);
 }
 /// <summary>
 /// Translate X coordinate of the google level bitmap to longitude
 /// </summary>
 public static double GetLongitude(GoogleCoordinate google)
 {
     return Math.Round((google.X - BitmapOrigo(google.Level)) / PixelsPerDegree(google.Level), 5);
 }