예제 #1
0
        public int GetNumTilesAcross(int zoom)
        {
            int x, y;

            TMDLLWrapper.GetNumTiles(zoom, out x, out y);
            return(x);
        }
예제 #2
0
        public int GetNumTilesDown(int zoom)
        {
            int x, y;

            TMDLLWrapper.GetNumTiles(zoom, out x, out y);
            return(y);
        }
        public byte[] LoadTile(int zoom, int x, int y)
        {
            int size;

            byte[] array = null;
            try
            {
                if (TMDLLWrapper.GetTileSize(out int width, out int height) != 1)
                {
                    throw new FaultException <DataServerFault>(new DataServerFault("Error in Function 'DGDataController.LoadTile'", "Returned error"));
                }

                size  = width * height * 3; // determine size
                array = new byte[size];     // allocate buffer

                if (TMDLLWrapper.GetNumTiles(zoom, out int across, out int down) != 1)
                {
                    throw new FaultException <DataServerFault>(new DataServerFault("Error in Function 'DGDataController.LoadTile'", "Invalid Zoom Parameter"));
                }

                if (x < across && y < down)// check if coordinates are valid
                {
                    if (TMDLLWrapper.GetTileImageAsRawJPG(zoom, x, y, array, size, ref size) != 1)
                    {
                        throw new FaultException <DataServerFault>(new DataServerFault("Error in Function 'DGDataController.LoadTile'", "Error retrieving tiles"));
                    }
                }
            }
            catch (DllNotFoundException e)
            {
                Console.WriteLine(e.Message);
                throw new FaultException <DataServerFault>(new DataServerFault("Error in Function 'DGDataController.LoadTile'", "TrueMarbleDLL.dll is missing"));
            }
            return(array);   // will be null if failure
        }
        //gets max vertical tiles
        public int GetNumTilesDown(int zoom)
        {
            int x, y;

            TMDLLWrapper.GetNumTiles(zoom, out x, out y);
            Console.WriteLine("Max valY for zoom {0} is {1}", zoom, y);
            return(y);
        }
        //gets the max horizontal tiles
        public int GetNumTilesAcross(int zoom)
        {
            int x, y;

            TMDLLWrapper.GetNumTiles(zoom, out x, out y);
            Console.WriteLine("Max valX for zoom {0} is {1}", zoom, x);
            return(x);
        }
 /// <summary>
 /// GetNumTilesAcross
 /// returns number of tiles across depending on the level of zoom
 /// </summary>
 /// <param name="zoom"></param>
 /// <returns>
 /// returns across or -1 if error
 /// aswell as a error message via reference
 /// </returns>
 public int GetNumTilesAcross(int zoom)
 {
     try
     {
         if (TMDLLWrapper.GetNumTiles(zoom, out int across, out int down) != 1)
         {
             throw new FaultException <DataServerFault>(new DataServerFault("Error in Function 'DGDataController.GetNumTilesAcross'", "Invalid Zoom Parameter"));
         }
         return(across);
     }
     catch (DllNotFoundException e)
     {
         Console.WriteLine(e.Message);
         throw new FaultException <DataServerFault>(new DataServerFault("Error in Function 'DGDataController.GetNumTilesAcross'", "TrueMarbleDLL.dll is missing"));
     }
 }
예제 #7
0
        //Requires when the slider value is changed - Tells how many tiles are available at the particular zoom level(vertically)
        public int GetNumTilesDown(int zoom)
        {
            int TilesAcross;
            int TilesDown = 0;

            try
            {
                TMDLLWrapper.GetNumTiles(zoom, out TilesAcross, out TilesDown);
            }
            //If cannot access the dll function
            catch (DllNotFoundException)
            {
                System.Console.WriteLine("Unable to serve client - Could not find the dll");
            }

            return(TilesDown);
        }