Exemplo n.º 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));
        }
Exemplo n.º 2
0
 private static int GetXFromSquare(MapSquare square, double zoom)
 {
     return((int)Math.Round(((square.LeftLongitude + 180.0) / 360.0) * (double)zoom));
 }
Exemplo n.º 3
0
 public bool Contains(MapSquare otherSquare)
 {
     return(_topLatitude >= otherSquare.TopLatitude && _bottomLatitude <= otherSquare.BottomLatitude && _leftLongitude <= otherSquare.LeftLongitude && _rightLongitude >= otherSquare.RightLongitude);
 }
Exemplo n.º 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));
 }
Exemplo n.º 5
0
 public bool Intersects(MapSquare otherSquare)
 {
     return((_topLatitude <= otherSquare.BottomLatitude && _bottomLatitude >= otherSquare.TopLatitude) && (_rightLongitude <= otherSquare.LeftLongitude && _leftLongitude >= otherSquare.RightLongitude));
 }