Exemple #1
0
        /// <summary>
        /// Calculates the location in tile coordinates from a location in world coordinates.
        /// </summary>
        public System.Point GetTileLocationFromWorldLocation(System.Double WorldLocationX, System.Double WorldLocationY)
        {
            var Result = new System.Point();

            Result.X = (0.5 + WorldLocationX) * System.Math.Pow(2.0, _Zoom);
            Result.Y = (0.5 - WorldLocationY) * System.Math.Pow(2.0, _Zoom);

            return(Result);
        }
Exemple #2
0
        /// <summary>
        /// Calculates the location in world coordinates from a location in tile coordinates.
        /// </summary>
        public System.Point GetWorldLocationFromTileLocation(System.Double TileLocationX, System.Double TileLocationY)
        {
            var Result = new System.Point();

            Result.X = TileLocationX / System.Math.Pow(2.0, _Zoom) - 0.5;
            Result.Y = 0.5 - TileLocationY / System.Math.Pow(2.0, _Zoom);

            return(Result);
        }
Exemple #3
0
        /// <summary>
        /// Calculates the location in world coordinates from a location in geo coordinates.
        /// </summary>
        public System.Point GetWorldLocationFromGeoLocation(System.Double GeoLocationX, System.Double GeoLocationY)
        {
            var Result = new System.Point();

            Result.X = GeoLocationX / 2.0 / System.Math.PI;
            Result.Y = (Math.Log(Math.Tan(GeoLocationY) + 1.0 / Math.Cos(GeoLocationY)) / Math.PI) / 2.0;

            return(Result);
        }
Exemple #4
0
        /// <summary>
        /// Calculates the location in geo coordinates from a location in world coordinates.
        /// </summary>
        public System.Point GetGeoLocationFromWorldLocation(System.Double WorldLocationX, System.Double WorldLocationY)
        {
            var Result = new System.Point();

            Result.X = WorldLocationX * System.Math.PI * 2.0;
            Result.Y = System.Math.Atan(System.Math.Sinh(2.0 * System.Math.PI * WorldLocationY));

            return(Result);
        }
Exemple #5
0
        /// <summary>
        /// Calculates the location in tile coordinates from a location in pixel coordinates.
        /// </summary>
        public System.Point GetTileLocationFromPixelLocation(System.Int32 PixelLocationX, System.Int32 PixelLocationY)
        {
            var Result = new System.Point();

            if (_MapProvider != null)
            {
                Result.X = PixelLocationX / System.Convert.ToDouble(_MapProvider.GetTileSize());
                Result.Y = PixelLocationY / System.Convert.ToDouble(_MapProvider.GetTileSize());
            }

            return(Result);
        }
Exemple #6
0
        /// <summary>
        /// Calculates the location in pixel coordinates from a location in tile coordinates.
        /// </summary>
        public System.Drawing.Point GetPixelLocationFromTileLocation(System.Point TileLocation)
        {
            var Result = new System.Drawing.Point();

            if (_MapProvider != null)
            {
                Result.X = System.Convert.ToInt32(TileLocation.X * _MapProvider.GetTileSize());
                Result.Y = System.Convert.ToInt32(TileLocation.Y * _MapProvider.GetTileSize());
            }

            return(Result);
        }
Exemple #7
0
 /// <summary>
 /// Calculates the location in geo coordinates from a location in world coordinates.
 /// </summary>
 public System.Point GetGeoLocationFromWorldLocation(System.Point WorldLocation)
 {
     return(GetGeoLocationFromWorldLocation(WorldLocation.X, WorldLocation.Y));
 }
Exemple #8
0
 /// <summary>
 /// Calculates the location in world coordinates from a location in tile coordinates.
 /// </summary>
 public System.Point GetWorldLocationFromTileLocation(System.Point TileLocation)
 {
     return(GetWorldLocationFromTileLocation(TileLocation.X, TileLocation.Y));
 }
Exemple #9
0
 /// <summary>
 /// Calculates the location in screen coordinates from a location in geo coordinates.
 /// </summary>
 public System.Drawing.Point GetScreenLocationFromGeoLocation(System.Point GeoLocation)
 {
     return(GetScreenLocationFromPixelLocation(GetPixelLocationFromGeoLocation(GeoLocation)));
 }
Exemple #10
0
 /// <summary>
 /// Calculates the location in pixel coordinates from a location in world coordinates.
 /// </summary>
 public System.Drawing.Point GetPixelLocationFromWorldLocation(System.Point WorldLocation)
 {
     return(GetPixelLocationFromTileLocation(GetTileLocationFromWorldLocation(WorldLocation)));
 }