JavaCode/FrmMain.Designer.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
JavaCode/FrmMain.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
JavaCode/JavaCode.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
JavaCode/cs/TerrainHelper.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
JavaCode/FrmMain.Designer.cs
@@ -31,6 +31,7 @@ this.btnSys = new System.Windows.Forms.Button(); this.btnMybatis = new System.Windows.Forms.Button(); this.btnQGis = new System.Windows.Forms.Button(); this.btnTerrain = new System.Windows.Forms.Button(); this.SuspendLayout(); // // btnSys @@ -66,11 +67,23 @@ this.btnQGis.UseVisualStyleBackColor = true; this.btnQGis.Click += new System.EventHandler(this.btnQGis_Click); // // btnTerrain // this.btnTerrain.Font = new System.Drawing.Font("å®ä½", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnTerrain.Location = new System.Drawing.Point(143, 197); this.btnTerrain.Name = "btnTerrain"; this.btnTerrain.Size = new System.Drawing.Size(183, 25); this.btnTerrain.TabIndex = 16; this.btnTerrain.Text = "å° å½¢ æ ä»¶ å¤ ç"; this.btnTerrain.UseVisualStyleBackColor = true; this.btnTerrain.Click += new System.EventHandler(this.btnTerrain_Click); // // FrmMain // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(484, 261); this.Controls.Add(this.btnTerrain); this.Controls.Add(this.btnQGis); this.Controls.Add(this.btnMybatis); this.Controls.Add(this.btnSys); @@ -86,5 +99,6 @@ private System.Windows.Forms.Button btnSys; private System.Windows.Forms.Button btnMybatis; private System.Windows.Forms.Button btnQGis; private System.Windows.Forms.Button btnTerrain; } } JavaCode/FrmMain.cs
@@ -34,5 +34,10 @@ { QGisHelper.Create(); } private void btnTerrain_Click(object sender, EventArgs e) { TerrainHelper.RemoveTerrain(); } } } JavaCode/JavaCode.csproj
@@ -78,6 +78,7 @@ <Compile Include="cs\PostgreHelper.cs" /> <Compile Include="cs\QGisHelper.cs" /> <Compile Include="cs\TabInfo.cs" /> <Compile Include="cs\TerrainHelper.cs" /> <Compile Include="FrmMain.cs"> <SubType>Form</SubType> </Compile> JavaCode/cs/TerrainHelper.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,77 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace JavaCode.cs { public class TerrainHelper { public static void RemoveTerrain() { char[] chars = new char[] { ',' }; string folder = @"E:\data\35.ty\terrain"; string[] strs = File.ReadAllLines(folder + "\\layer.json"); int i = -1; foreach (string str in strs) { if (!str.Contains("[ {")) continue; i++; if (i < 5 || i > 12) continue; // ,[ { "startX": 6604, "startY": 2834, "endX": 6702, "endY": 2975 } ] string[] vals = str.Replace("startX", "").Replace("startY", "").Replace("endX", "").Replace("endY", "").Replace("[ {", "").Replace("} ]", "").Replace("\"", "").Replace(":", "").Replace(" ", "").Split(chars, StringSplitOptions.RemoveEmptyEntries); int startX = int.Parse(vals[0]), startY = int.Parse(vals[1]), endX = int.Parse(vals[2]), endY = int.Parse(vals[3]); RemoveFiles(folder, i, startX, endX, startY, endY); } } private static void RemoveFiles(string folder, int level, int startX, int endX, int startY, int endY) { string path = Path.Combine(folder, level.ToString()); if (!Directory.Exists(path)) return; string[] dirs = Directory.GetDirectories(path, "*", SearchOption.TopDirectoryOnly); foreach (string dir in dirs) { string dirName = Path.GetFileName(dir); int d = 0; if (!int.TryParse(dirName, out d)) { Directory.Delete(dir, true); continue; } if (d < startX || d > endX) { Directory.Delete(dir, true); continue; } string[] files = Directory.GetFiles(dir); foreach (string file in files) { string fileName = Path.GetFileName(file).Replace(".terrain", ""); int f= 0; if (!int.TryParse(fileName, out f)) { File.Delete(file); continue; } if (f < startY || f > endY) { File.Delete(file); } } } } } }