public int GetNumTilesAcross(int zoom) { int x, y; TMDLLWrapper.GetNumTiles(zoom, out x, out y); return(x); }
public int GetNumTilesDown(int zoom) { int x, y; TMDLLWrapper.GetNumTiles(zoom, out x, out y); return(y); }
//gets the height public int GetTileHeight() { int h, w; TMDLLWrapper.GetTileSize(out w, out h); return(h); }
public int GetTileHeight() { int width, height; TMDLLWrapper.GetTileSize(out width, out height); return(height); }
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 the width public int GetTileWidth() { int h, w; TMDLLWrapper.GetTileSize(out w, out h); return(w); }
//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); }
public byte[] LoadTile(int zoom, int x, int y) { int iBufSize, iRetSize; byte[] newBuf; //Buffer to hold the raw JPEG data. iBufSize = GetTileWidth() * GetTileHeight() * 3; newBuf = new byte[iBufSize]; //Allocating enough size for the buffer to hold the JPEG tile. if (TMDLLWrapper.GetTileImageAsRawJPG(zoom, x, y, newBuf, iBufSize, out iRetSize) == 0) //checks whether any fault has occured in loading the tile.if fault occurs 0 is returned else 1. { throw new FaultException("Could not get tile -zoom , x or y are probably out of range"); } return(newBuf); }
public byte[] LoadTile(int zoom, int x, int y) { int h; int w; TMDLLWrapper.GetTileSize(out w, out h); byte[] imageBuf; int jpgSize; int buffsize = w * h * 3; imageBuf = new byte[buffsize]; TMDLLWrapper.GetTileImageAsRawJPG(zoom, x, y, imageBuf, buffsize, out jpgSize); return(imageBuf); }
/// <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")); } }
public byte[] LoadTile(int zoom, int x, int y) { int h, w, jpgSize; byte[] imageBuf; //gets the size of the tile TMDLLWrapper.GetTileSize(out w, out h); int buffsize = w * h * 3; imageBuf = new byte[buffsize]; //gets the raw jpg file TMDLLWrapper.GetTileImageAsRawJPG(zoom, x, y, imageBuf, buffsize, out jpgSize); return(imageBuf); }
//To get the width of the tile selected public int GetTileWidth() { int width = 0; int height; try { TMDLLWrapper.GetTileSize(out width, out height); } //If cannot access the dll function catch (DllNotFoundException) { System.Console.WriteLine("Unable to serve client - Could not find the dll"); } return(width); }
//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); }
//This methods selects the particular tile at a partcular zoom level and coordinates. //Then puts the image in a buffer and returns it. public byte[] LoadTiles(int zoom, int x, int y) { int buffSize, imgSize; int height = 0; int width = 0; try { TMDLLWrapper.GetTileSize(out width, out height); } //If cannot access the dll function catch (DllNotFoundException) { System.Console.WriteLine("Unable to serve client - Could not find the dll"); } //Overestimating buffer size to make sure it's big enough to hold tile buffSize = width * height * 3; //Creating a buffer to holf raw JPEG data byte[] rawJPEG = new byte[buffSize]; try { if (TMDLLWrapper.GetTileImageAsRawJPG(zoom, x, y, rawJPEG, buffSize, out imgSize) == 0) { System.Console.WriteLine("Possible navigation for tiles out of range detected"); } } //If cannot access the dll function catch (DllNotFoundException) { System.Console.WriteLine("Unable to serve client - Could not find the dll"); } return(rawJPEG); }