| | |
| | | string temp = Path.Combine(outPath, "temp"); |
| | | if (!Directory.Exists(temp)) Directory.CreateDirectory(temp); |
| | | |
| | | CopeTerrain(terrainFile, outPath, layer); |
| | | //CopeTerrain(terrainFile, outPath, layer); |
| | | CopeWater(waterPath, outPath, layer); |
| | | CopeFlow(flowPath, outPath, layer); |
| | | CopeLayerJson(outPath, layer); |
| | |
| | | /// </summary> |
| | | private static void CopeWater(string waterPath, string outPath, Domain.Layer layer) |
| | | { |
| | | string watersPath = Path.Combine(outPath, "waters"); |
| | | if (!Directory.Exists(watersPath)) Directory.CreateDirectory(watersPath); |
| | | |
| | | List<string> files = GetFiles(waterPath); |
| | | if (null == files || files.Count == 0) return; |
| | | |
| | | SetWaterData(layer, files); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取文件 |
| | | /// </summary> |
| | | private static List<String> GetFiles(string path) |
| | | { |
| | | string[] files = Directory.GetFiles(path, "*.tif?", SearchOption.TopDirectoryOnly); |
| | | if (null == files || files.Length == 0) return null; |
| | | |
| | | List<string> list = files.ToList(); |
| | | list.Sort(); |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置水面数据 |
| | | /// </summary> |
| | | private static void SetWaterData(Domain.Layer layer, List<string> files) |
| | | { |
| | | DateTime now = DateTime.Now; |
| | | long startTicks = new DateTime(1970, 1, 1, 0, 0, 0).Ticks; |
| | | |
| | | foreach (string file in files) |
| | | { |
| | | string fileName = Path.GetFileNameWithoutExtension(file); |
| | | int hour = Convert.ToInt32(fileName.Substring(0, 2)); |
| | | int minute = Convert.ToInt32(fileName.Substring(2, 2)); |
| | | int second = Convert.ToInt32(fileName.Substring(4, 2)); |
| | | |
| | | DateTime d = new DateTime(now.Year, now.Month, now.Day, hour, minute, second); |
| | | layer.waters.data.Add((d.Ticks - startTicks) / 10000); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | destDs.Dispose(); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |