| | |
| | | } |
| | | } |
| | | |
| | | // http://localhost/ExportMap/tile0/12/3338/1671.png?path=2d\tiles\0102 |
| | | private static byte[] _emptyPng; |
| | | |
| | | public static byte[] EmptyPng |
| | |
| | | } |
| | | } |
| | | |
| | | // http://127.0.0.1/ExportMap/terra0/12/6822/2744.terrain?v=1.1.0&path=3d\terrain\dem\t |
| | | private static byte[] _emptyTerrain; |
| | | |
| | | public static byte[] EmptyTerrain |
| | |
| | | /// </summary> |
| | | public static HttpResponseMessage GetTile(HttpRequestMessage Request, string path, int z, int x, int y) |
| | | { |
| | | string basePath = Path.Combine(LFData, path); |
| | | string basePath = Path.Combine(LFData, path, z.ToString()); |
| | | if (!Directory.Exists(basePath)) |
| | | { |
| | | throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.BadRequest, "路径不存在!")); |
| | | throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, "路径不存在!")); |
| | | } |
| | | |
| | | string file = basePath + "\\" + z + "\\" + x + "\\" + y + ".png"; |
| | | string file = basePath + "\\" + x + "\\" + y + ".png"; |
| | | if (!File.Exists(file)) |
| | | { |
| | | throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, "文件不存在!")); |
| | |
| | | /// </summary> |
| | | public static HttpResponseMessage GetTile0(HttpRequestMessage Request, string path, int z, int x, int y) |
| | | { |
| | | string basePath = Path.Combine(LFData, path); |
| | | string basePath = Path.Combine(LFData, path, z.ToString()); |
| | | if (!Directory.Exists(basePath)) |
| | | { |
| | | throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.BadRequest, "路径不存在!")); |
| | | throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, "路径不存在!")); |
| | | } |
| | | |
| | | string file = basePath + "\\" + z + "\\" + x + "\\" + y + ".png"; |
| | | string file = basePath + "\\" + x + "\\" + y + ".png"; |
| | | if (!File.Exists(file)) |
| | | { |
| | | return DownloadFile(EmptyPng, y + ".png", "image/png"); |