| | |
| | | { |
| | | private static string pyFile; |
| | | |
| | | private static int terrainMaxLevel = 0; |
| | | |
| | | /// <summary> |
| | | /// 默认最大级别 |
| | | /// 地形最大级别 |
| | | /// </summary> |
| | | public static int DEFAULT_MAX_LEVEL = 16; |
| | | public static int TERRAIN_MAX_LEVEL |
| | | { |
| | | get |
| | | { |
| | | if (0 == terrainMaxLevel) |
| | | { |
| | | string str = Tools.GetSetting("terrainMaxLevel"); |
| | | if (!int.TryParse(str, out terrainMaxLevel)) |
| | | { |
| | | terrainMaxLevel = 14; |
| | | } |
| | | } |
| | | |
| | | return terrainMaxLevel; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 默认最大文件大小:5GB |
| | |
| | | else |
| | | { |
| | | //if (File.Exists(tifFile)) File.Delete(tifFile); |
| | | //WriteText(txtFile, metas, null); |
| | | WriteText(txtFile, metas, null); |
| | | if (File.Exists(tifFile)) return tifFile; |
| | | } |
| | | |
| | |
| | | private static int GetTerrainMaxLevel(XYZArgs args, string tifFile) |
| | | { |
| | | FileInfo fi = new FileInfo(tifFile); |
| | | if (fi.Length > DDEFAULT_MAX_SIZE) return DEFAULT_MAX_LEVEL; |
| | | if (fi.Length > DDEFAULT_MAX_SIZE) return TERRAIN_MAX_LEVEL; |
| | | |
| | | string ctbPath = Tools.GetSetting("ctbPath"); |
| | | string dirPath = GetTerrainPath(args.dircode); |
| | |
| | | Tools.ExecCmd(new List<string>() { gdal_data, createLayer }); |
| | | |
| | | string layerJson = Path.Combine(dirPath, "layer.json"); |
| | | if (!File.Exists(layerJson)) return DEFAULT_MAX_LEVEL; |
| | | if (!File.Exists(layerJson)) return TERRAIN_MAX_LEVEL; |
| | | |
| | | string[] lines = File.ReadAllLines(layerJson, Encoding.UTF8); |
| | | |
| | |
| | | } |
| | | if (File.Exists(layerJson)) File.Delete(layerJson); |
| | | |
| | | return level > DEFAULT_MAX_LEVEL ? DEFAULT_MAX_LEVEL : level; |
| | | return level > TERRAIN_MAX_LEVEL ? TERRAIN_MAX_LEVEL : level; |
| | | } |
| | | |
| | | /// <summary> |