管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2024-07-19 170ca96f9a0b814b32896bfb128cfa3e1e4be189
1
已修改1个文件
43 ■■■■■ 文件已修改
SimuTools/Tools/Handle.cs 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/Tools/Handle.cs
@@ -35,7 +35,7 @@
            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);
@@ -216,7 +216,47 @@
        /// </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>
@@ -265,7 +305,6 @@
            destDs.Dispose();
        }
        #endregion
    }
}