Пример #1
0
        private static int GetYFromSquare(MapSquare square, double zoom)
        {
            double latitude = square.BottomLatitude * Math.PI / 180.0;

            return((int)Math.Round((1.0f - (System.Math.Log(System.Math.Tan(latitude) + (1.0f / System.Math.Cos(latitude)))) / System.Math.PI) / 2f * (double)zoom));
        }
Пример #2
0
 private static int GetXFromSquare(MapSquare square, double zoom)
 {
     return((int)Math.Round(((square.LeftLongitude + 180.0) / 360.0) * (double)zoom));
 }
Пример #3
0
 public bool Contains(MapSquare otherSquare)
 {
     return(_topLatitude >= otherSquare.TopLatitude && _bottomLatitude <= otherSquare.BottomLatitude && _leftLongitude <= otherSquare.LeftLongitude && _rightLongitude >= otherSquare.RightLongitude);
 }
Пример #4
0
 public MapTile(MapSquare square, double zoom)
 {
     _zoom    = GetTileZoom(zoom);
     _xNumber = GetXFromSquare(square, Math.Pow(2, _zoom));
     _yNumber = GetYFromSquare(square, Math.Pow(2, _zoom));
 }
Пример #5
0
 public bool Intersects(MapSquare otherSquare)
 {
     return((_topLatitude <= otherSquare.BottomLatitude && _bottomLatitude >= otherSquare.TopLatitude) && (_rightLongitude <= otherSquare.LeftLongitude && _leftLongitude >= otherSquare.RightLongitude));
 }