From 38ab580897dd25f84742a4c11d3033853f1513d6 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期六, 20 七月 2024 08:36:24 +0800 Subject: [PATCH] 1 --- SimuTools/Tools/Handle.cs | 24 +++++++++++++++--------- 1 files changed, 15 insertions(+), 9 deletions(-) diff --git a/SimuTools/Tools/Handle.cs b/SimuTools/Tools/Handle.cs index 7ada463..1ea8f07 100644 --- a/SimuTools/Tools/Handle.cs +++ b/SimuTools/Tools/Handle.cs @@ -36,9 +36,9 @@ if (!Directory.Exists(temp)) Directory.CreateDirectory(temp); CopeTerrain(terrainFile, outPath, layer); - CopeWater(waterPath, outPath, layer); + //CopeWater(waterPath, outPath, layer); CopeFlow(flowPath, outPath, layer); - //CopeLayerJson(outPath, layer); + CopeLayerJson(outPath, layer); if (Directory.Exists(temp)) Directory.Delete(temp, true); } @@ -56,7 +56,7 @@ if (null == ds || 0 == ds.RasterCount || null == ds.GetSpatialRef()) return; SetTerrainInfo(ds, layer); - CreateTerrainPng(ds, layer, outPath); + //CreateTerrainPng(ds, layer, outPath); } finally { @@ -181,8 +181,8 @@ { for (int y = 0; y < height; y++) { - int offset = x + y * height; - if (float.IsNaN(buffer[offset]) || buffer[offset] == -9999) + int offset = x + y * width; + if (float.IsNaN(buffer[offset]) || buffer[offset] < -999) { //image.SetPixel(x, y, Color.Transparent); continue; @@ -388,20 +388,26 @@ Graphics graphic = Graphics.FromImage(image); graphic.Clear(Color.Transparent); // 濉厖閫忔槑鑹� + // 鐢� R閫氶亾琛ㄧず锛屾祦鍚戜负褰掍竴鍖栫殑浜岀淮鍚戦噺锛坸,y锛夛紝G閫氶亾琛ㄧず涓� x *255 , B閫氶亾琛ㄧず涓� y * 255 for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { - //int offset = x + y * height; - //if (float.IsNaN(vxBuffer[offset]) || vxBuffer[offset] == -9999) continue; + int offset = x + y * width; + if (float.IsNaN(vxBuffer[offset]) || vxBuffer[offset] < -999 || + float.IsNaN(vyBuffer[offset]) || vyBuffer[offset] < -999) continue; + float vx = vxBuffer[offset], vy = vyBuffer[offset]; //int val = Convert.ToInt32(vxBuffer[offset] * 100); //int r = val / 65536; //int g = (val - r * 65536) / 256; //int b = val % 256; + int r = 0; + int g = 0; + int b = 0; - //Color color = Color.FromArgb(127, r, g, b); - //image.SetPixel(x, y, color); + Color color = Color.FromArgb(127, r, g, b); + image.SetPixel(x, y, color); } } -- Gitblit v1.9.3