From a55f5510720c2eda302c771021e84c7bd2ee47c3 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期二, 23 七月 2024 11:19:21 +0800
Subject: [PATCH] 1

---
 SimuTools/Tools/Handle.cs |  106 +++++++++++++++++++++++++++-------------------------
 1 files changed, 55 insertions(+), 51 deletions(-)

diff --git a/SimuTools/Tools/Handle.cs b/SimuTools/Tools/Handle.cs
index 2c60f97..579d7a8 100644
--- a/SimuTools/Tools/Handle.cs
+++ b/SimuTools/Tools/Handle.cs
@@ -15,6 +15,7 @@
 {
     public class Handle
     {
+        #region 鎴愬憳鍙橀噺
         public static readonly int MAX = 256 * 256;
 
         public static readonly double WaterHeightOffset = 1.0;
@@ -22,6 +23,7 @@
         public static readonly string BaseDir = AppDomain.CurrentDomain.BaseDirectory;
 
         public static readonly string GdalPath = ConfigurationManager.AppSettings["gdalPath"];
+        #endregion
 
         /// <summary>
         /// 杩愯
@@ -147,57 +149,6 @@
 
             Dataset destDs = Gdal.Warp(dest, new Dataset[] { ds }, warpAppOptions, null, null);
             destDs.Dispose();
-        }
-
-        /// <summary>
-        /// 閲嶉噰鏍� *
-        /// </summary>
-        private static void Resample(string source, string dest, int width, int height)
-        {
-            // https://blog.51cto.com/u_16099346/6691820
-            string cmd = string.Format("{0}gdalwarp.exe -t_srs {1} -ts {2} {3} -r {4} -of GTiff \"{5}\" \"{6}\"", GdalPath, "EPSG:4326", width, height, "bilinear", source, dest);
-            string err = ExecExe(cmd);
-        }
-
-        /// <summary>
-        /// 鎵ц鍛戒护
-        /// </summary>
-        public static string ExecExe(string cmd)
-        {
-            string str = null;
-            Process p = null;
-            try
-            {
-                p = new Process();
-                p.StartInfo.FileName = "cmd.exe";
-                p.StartInfo.UseShellExecute = false;
-                p.StartInfo.CreateNoWindow = true;
-                p.StartInfo.RedirectStandardInput = true;
-                p.StartInfo.RedirectStandardOutput = true;
-                p.StartInfo.RedirectStandardError = true;
-                p.Start();
-
-                StreamWriter si = p.StandardInput;
-                StreamReader se = p.StandardError;
-
-                si.AutoFlush = true;
-                si.WriteLine(cmd);
-                si.WriteLine("exit");
-
-                str = se.ReadToEnd();
-                se.Close();
-                si.Close();
-            }
-            catch (Exception ex)
-            {
-                LogOut.Error(ex.Message + "\r\n" + ex.StackTrace);
-                str = ex.Message;
-            }
-            finally
-            {
-                if (p != null) p.Close();
-            }
-            return str;
         }
 
         /// <summary>
@@ -606,5 +557,58 @@
             }
         }
         #endregion
+
+        #region 鏆傛椂涓嶇敤
+        /// <summary>
+        /// 閲嶉噰鏍� *
+        /// </summary>
+        private static void Resample(string source, string dest, int width, int height)
+        {
+            // https://blog.51cto.com/u_16099346/6691820
+            string cmd = string.Format("{0}gdalwarp.exe -t_srs {1} -ts {2} {3} -r {4} -of GTiff \"{5}\" \"{6}\"", GdalPath, "EPSG:4326", width, height, "bilinear", source, dest);
+            string err = ExecExe(cmd);
+        }
+
+        /// <summary>
+        /// 鎵ц鍛戒护
+        /// </summary>
+        public static string ExecExe(string cmd)
+        {
+            string str = null;
+            Process p = null;
+            try
+            {
+                p = new Process();
+                p.StartInfo.FileName = "cmd.exe";
+                p.StartInfo.UseShellExecute = false;
+                p.StartInfo.CreateNoWindow = true;
+                p.StartInfo.RedirectStandardInput = true;
+                p.StartInfo.RedirectStandardOutput = true;
+                p.StartInfo.RedirectStandardError = true;
+                p.Start();
+
+                StreamWriter si = p.StandardInput;
+                StreamReader se = p.StandardError;
+
+                si.AutoFlush = true;
+                si.WriteLine(cmd);
+                si.WriteLine("exit");
+
+                str = se.ReadToEnd();
+                se.Close();
+                si.Close();
+            }
+            catch (Exception ex)
+            {
+                LogOut.Error(ex.Message + "\r\n" + ex.StackTrace);
+                str = ex.Message;
+            }
+            finally
+            {
+                if (p != null) p.Close();
+            }
+            return str;
+        }
+        #endregion
     }
 }

--
Gitblit v1.9.3