管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2024-07-18 7d63936dd4f69a46c88f641229640fb4d9195468
修改界面操作
已添加1个文件
已修改3个文件
171 ■■■■ 文件已修改
SimuTools/FrmMain.Designer.cs 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/FrmMain.cs 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/SimuTools.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/Tools/Handle.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/FrmMain.Designer.cs
@@ -38,6 +38,9 @@
            this.lblFlow = new System.Windows.Forms.Label();
            this.btnFlowPath = new System.Windows.Forms.Button();
            this.btnRun = new System.Windows.Forms.Button();
            this.txtOutPath = new System.Windows.Forms.TextBox();
            this.lblOut = new System.Windows.Forms.Label();
            this.btnOutPath = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // btnTerrainPath
@@ -45,9 +48,9 @@
            this.btnTerrainPath.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnTerrainPath.Location = new System.Drawing.Point(607, 27);
            this.btnTerrainPath.Name = "btnTerrainPath";
            this.btnTerrainPath.Size = new System.Drawing.Size(90, 26);
            this.btnTerrainPath.Size = new System.Drawing.Size(130, 26);
            this.btnTerrainPath.TabIndex = 47;
            this.btnTerrainPath.Text = "选择地形";
            this.btnTerrainPath.Text = "选择地形文件";
            this.btnTerrainPath.UseVisualStyleBackColor = true;
            this.btnTerrainPath.Click += new System.EventHandler(this.btnTerrainPath_Click);
            // 
@@ -57,7 +60,7 @@
            this.lblTerrain.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lblTerrain.Location = new System.Drawing.Point(24, 32);
            this.lblTerrain.Name = "lblTerrain";
            this.lblTerrain.Size = new System.Drawing.Size(80, 16);
            this.lblTerrain.Size = new System.Drawing.Size(79, 16);
            this.lblTerrain.TabIndex = 48;
            this.lblTerrain.Text = "地形数据:";
            // 
@@ -87,7 +90,7 @@
            this.lblWater.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lblWater.Location = new System.Drawing.Point(24, 81);
            this.lblWater.Name = "lblWater";
            this.lblWater.Size = new System.Drawing.Size(80, 16);
            this.lblWater.Size = new System.Drawing.Size(79, 16);
            this.lblWater.TabIndex = 51;
            this.lblWater.Text = "水面数据:";
            // 
@@ -96,16 +99,16 @@
            this.btnWaterPath.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnWaterPath.Location = new System.Drawing.Point(607, 76);
            this.btnWaterPath.Name = "btnWaterPath";
            this.btnWaterPath.Size = new System.Drawing.Size(90, 26);
            this.btnWaterPath.Size = new System.Drawing.Size(130, 26);
            this.btnWaterPath.TabIndex = 50;
            this.btnWaterPath.Text = "选择水面";
            this.btnWaterPath.Text = "选择水面目录";
            this.btnWaterPath.UseVisualStyleBackColor = true;
            this.btnWaterPath.Click += new System.EventHandler(this.btnWaterPath_Click);
            // 
            // txtFlowPath
            // 
            this.txtFlowPath.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtFlowPath.Location = new System.Drawing.Point(109, 125);
            this.txtFlowPath.Location = new System.Drawing.Point(109, 126);
            this.txtFlowPath.MaxLength = 2000;
            this.txtFlowPath.Name = "txtFlowPath";
            this.txtFlowPath.Size = new System.Drawing.Size(482, 26);
@@ -116,20 +119,20 @@
            // 
            this.lblFlow.AutoSize = true;
            this.lblFlow.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lblFlow.Location = new System.Drawing.Point(24, 130);
            this.lblFlow.Location = new System.Drawing.Point(24, 131);
            this.lblFlow.Name = "lblFlow";
            this.lblFlow.Size = new System.Drawing.Size(80, 16);
            this.lblFlow.Size = new System.Drawing.Size(79, 16);
            this.lblFlow.TabIndex = 54;
            this.lblFlow.Text = "流速流向:";
            // 
            // btnFlowPath
            // 
            this.btnFlowPath.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnFlowPath.Location = new System.Drawing.Point(607, 125);
            this.btnFlowPath.Location = new System.Drawing.Point(607, 126);
            this.btnFlowPath.Name = "btnFlowPath";
            this.btnFlowPath.Size = new System.Drawing.Size(90, 26);
            this.btnFlowPath.Size = new System.Drawing.Size(130, 26);
            this.btnFlowPath.TabIndex = 53;
            this.btnFlowPath.Text = "选择水面";
            this.btnFlowPath.Text = "选择流速目录";
            this.btnFlowPath.UseVisualStyleBackColor = true;
            this.btnFlowPath.Click += new System.EventHandler(this.btnFlowPath_Click);
            // 
@@ -137,19 +140,53 @@
            // 
            this.btnRun.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnRun.ForeColor = System.Drawing.SystemColors.Highlight;
            this.btnRun.Location = new System.Drawing.Point(27, 172);
            this.btnRun.Location = new System.Drawing.Point(27, 229);
            this.btnRun.Name = "btnRun";
            this.btnRun.Size = new System.Drawing.Size(670, 26);
            this.btnRun.Size = new System.Drawing.Size(710, 26);
            this.btnRun.TabIndex = 57;
            this.btnRun.Text = "运    è¡Œ";
            this.btnRun.UseVisualStyleBackColor = true;
            this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
            // 
            // txtOutPath
            //
            this.txtOutPath.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtOutPath.Location = new System.Drawing.Point(109, 178);
            this.txtOutPath.MaxLength = 2000;
            this.txtOutPath.Name = "txtOutPath";
            this.txtOutPath.Size = new System.Drawing.Size(482, 26);
            this.txtOutPath.TabIndex = 60;
            this.txtOutPath.Text = "D:\\simu\\out";
            //
            // lblOut
            //
            this.lblOut.AutoSize = true;
            this.lblOut.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lblOut.Location = new System.Drawing.Point(24, 183);
            this.lblOut.Name = "lblOut";
            this.lblOut.Size = new System.Drawing.Size(79, 16);
            this.lblOut.TabIndex = 59;
            this.lblOut.Text = "输出目录:";
            //
            // btnOutPath
            //
            this.btnOutPath.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnOutPath.Location = new System.Drawing.Point(607, 178);
            this.btnOutPath.Name = "btnOutPath";
            this.btnOutPath.Size = new System.Drawing.Size(130, 26);
            this.btnOutPath.TabIndex = 58;
            this.btnOutPath.Text = "选择输出目录";
            this.btnOutPath.UseVisualStyleBackColor = true;
            this.btnOutPath.Click += new System.EventHandler(this.btnOutPath_Click);
            //
            // FrmMain
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(735, 222);
            this.ClientSize = new System.Drawing.Size(751, 280);
            this.Controls.Add(this.txtOutPath);
            this.Controls.Add(this.lblOut);
            this.Controls.Add(this.btnOutPath);
            this.Controls.Add(this.btnRun);
            this.Controls.Add(this.txtFlowPath);
            this.Controls.Add(this.lblFlow);
@@ -182,6 +219,9 @@
        private System.Windows.Forms.Label lblFlow;
        private System.Windows.Forms.Button btnFlowPath;
        private System.Windows.Forms.Button btnRun;
        private System.Windows.Forms.TextBox txtOutPath;
        private System.Windows.Forms.Label lblOut;
        private System.Windows.Forms.Button btnOutPath;
    }
}
SimuTools/FrmMain.cs
@@ -1,18 +1,14 @@
using SimuTools.Tools;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Windows.Forms;
namespace SimuTools
{
    public partial class FrmMain : Form
    {
        private bool flag;
        public FrmMain()
        {
            InitializeComponent();
@@ -30,22 +26,93 @@
        private void btnTerrainPath_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "Tif files(*.tif)|*.tif|Tiff files (*.tiff)|*.tiff";
            dialog.RestoreDirectory = true;
            string path = this.txtTerrainPath.Text.Trim();
            if (File.Exists(path))
            {
                dialog.InitialDirectory = Path.GetDirectoryName(path);
            }
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                this.txtTerrainPath.Text = dialog.FileName;
            }
        }
        private void btnWaterPath_Click(object sender, EventArgs e)
        {
            selectFolder(this.txtWaterPath, "水面");
        }
        private void btnFlowPath_Click(object sender, EventArgs e)
        {
            selectFolder(this.txtFlowPath, "流速");
        }
        private void btnOutPath_Click(object sender, EventArgs e)
        {
            selectFolder(this.txtOutPath, "输出");
        }
        private void selectFolder(TextBox tb, string title)
        {
            using (FolderBrowserDialog dialog = new FolderBrowserDialog())
            {
                string path = tb.Text.Trim();
                if (Directory.Exists(path))
                {
                    dialog.SelectedPath = path;
                }
                dialog.Description = "请选择" + title + "目录...";
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    tb.Text = dialog.SelectedPath;
                }
            }
        }
        private void btnRun_Click(object sender, EventArgs e)
        {
            string terrainFile = this.txtTerrainPath.Text.Trim();
            string waterPath = this.txtWaterPath.Text.Trim();
            string flowPath = this.txtFlowPath.Text.Trim();
            string outPath = this.txtOutPath.Text.Trim();
            if (!File.Exists(terrainFile))
            {
                ShowErr("地形文件,要求必须存在!");
                return;
            }
            if (!Directory.Exists(waterPath) || !Directory.Exists(flowPath) || !Directory.Exists(outPath))
            {
                ShowErr("水面、流速和输出目录,要求必须存在!");
                return;
            }
            if (flag) return;
            try
            {
                flag = true;
                LogOut.Info("开始运行 >>");
                Tools.Handle.Run(terrainFile, waterPath, flowPath, outPath);
                LogOut.Info("运行结束 >>");
                flag = false;
            }
            catch (Exception ex)
            {
                flag = false;
                LogOut.Error(ex.StackTrace);
                ShowErr("运行出错:" + ex.Message);
            }
        }
        private void ShowErr(string message)
        {
            MessageBox.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
}
SimuTools/SimuTools.csproj
@@ -63,6 +63,7 @@
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Tools\Handle.cs" />
    <Compile Include="Tools\LogOut.cs" />
    <EmbeddedResource Include="FrmMain.resx">
      <DependentUpon>FrmMain.cs</DependentUpon>
SimuTools/Tools/Handle.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SimuTools.Tools
{
    public class Handle
    {
        public static void Run(string terrainFile, string waterPath, string flowPath, string outPath)
        {
            //
        }
    }
}