Esempio n. 1
0
        public ScreenRectangle(CoordinatePoligon coordinatePoligon, int level)
        {
            for (var i = 0; i < coordinatePoligon.Count; i++)
            {
                var pt = new ScreenCoordinate(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;
        }
Esempio n. 2
0
 public static ScreenCoordinate operator +(ScreenCoordinate Tile, ScreenCoordinate addon)
 {
     if (Tile.Level != addon.Level)
     {
         addon = new ScreenCoordinate(addon, Tile.Level);
     }
     return(new ScreenCoordinate(Tile.X + addon.X, Tile.Y + addon.Y, Tile.Level));
 }
Esempio n. 3
0
        /// <summary>
        /// Translate Y coordinate of the Tile level bitmap to latitude
        /// </summary>
        public static double GetLatitude(ScreenCoordinate Tile)
        {
            const double r2D = 180 / Math.PI;
            const double p2  = Math.PI / 2;
            var          z   = (Tile.Y - BitmapOrigo(Tile.Level)) / (-1 * PixelsPerRadian(Tile.Level));

            return(Math.Round((2 * Math.Atan(Math.Exp(z)) - p2) * r2D, 5));
        }
Esempio n. 4
0
        public ScreenRectangle(CoordinateRectangle coordinateRect, int level)
        {
            var pLeftTop     = new ScreenCoordinate(coordinateRect.LeftTop, level);
            var pRightBottom = new ScreenCoordinate(coordinateRect.RightBottom, level);

            Left   = pLeftTop.X;
            Top    = pLeftTop.Y;
            Right  = pRightBottom.X;
            Bottom = pRightBottom.Y;
            Level  = level;
        }
Esempio n. 5
0
 public ScreenRectangle(ScreenCoordinate pLeftTop, ScreenCoordinate pRightBottom)
 {
     if (pRightBottom.Level != pLeftTop.Level)
     {
         pRightBottom = new ScreenCoordinate(pRightBottom, pLeftTop.Level);
     }
     Left   = pLeftTop.X;
     Top    = pLeftTop.Y;
     Right  = pRightBottom.X;
     Bottom = pRightBottom.Y;
     Level  = pLeftTop.Level;
 }
Esempio n. 6
0
 /// <summary>
 /// Translate X coordinate of the Tile level bitmap to longitude
 /// </summary>
 public static double GetLongitude(ScreenCoordinate Tile)
 {
     return(Math.Round((Tile.X - BitmapOrigo(Tile.Level)) / PixelsPerDegree(Tile.Level), 5));
 }