管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2024-07-18 0f522b742699f0d81f23adc4cf517205cdf3d45c
开始执行运行方法
已添加1个文件
已修改9个文件
139 ■■■■ 文件已修改
SimuTools/Domain/Duration.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/Domain/Extension.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/Domain/Layer.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/Domain/Terrain.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/Domain/Water.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/FrmMain.Designer.cs 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/FrmMain.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/SimuTools.csproj 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/Tools/Handle.cs 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/dlls/Newtonsoft.Json.dll 补丁 | 查看 | 原始文档 | blame | 历史
SimuTools/Domain/Duration.cs
@@ -8,9 +8,9 @@
{
    public class Duration
    {
        private long start { set; get; }
        public long start { set; get; }
        private long end { set; get; }
        public long end { set; get; }
        public Duration() { }
SimuTools/Domain/Extension.cs
@@ -8,17 +8,17 @@
{
    public class Extension
    {
        private double minx { set; get; }
        public double minx { set; get; }
        private double miny { set; get; }
        public double miny { set; get; }
        private double maxx { set; get; }
        public double maxx { set; get; }
        private double maxy { set; get; }
        public double maxy { set; get; }
        private double minHeight { set; get; }
        public double minHeight { set; get; }
        private double maxHeight { set; get; }
        public double maxHeight { set; get; }
        public Extension() { }
SimuTools/Domain/Layer.cs
@@ -10,15 +10,15 @@
{
    public class Layer
    {
        private String version { set; get; }
        public String version { set; get; }
        private Duration duration { set; get; }
        public Duration duration { set; get; }
        private Extension extension { set; get; }
        public Extension extension { set; get; }
        private Terrain terrain { set; get; }
        public Terrain terrain { set; get; }
        private Water waters { set; get; }
        public Water waters { set; get; }
        public Layer()
        {
SimuTools/Domain/Terrain.cs
@@ -9,7 +9,7 @@
{
    public class Terrain
    {
        private List<int[]> size { set; get; }
        public List<int[]> size { set; get; }
        public Terrain()
        {
SimuTools/Domain/Water.cs
@@ -8,9 +8,12 @@
{
    public class Water
    {
        private List<long> data { set; get; }
        public List<long> data { set; get; }
        public Water() { }
        public Water()
        {
            data = new List<long>();
        }
        public Water(List<long> data)
        {
SimuTools/FrmMain.Designer.cs
@@ -41,12 +41,14 @@
            this.txtOutPath = new System.Windows.Forms.TextBox();
            this.lblOut = new System.Windows.Forms.Label();
            this.btnOutPath = new System.Windows.Forms.Button();
            this.txtServiceName = new System.Windows.Forms.TextBox();
            this.lblService = new System.Windows.Forms.Label();
            this.SuspendLayout();
            // 
            // btnTerrainPath
            // 
            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.Location = new System.Drawing.Point(616, 45);
            this.btnTerrainPath.Name = "btnTerrainPath";
            this.btnTerrainPath.Size = new System.Drawing.Size(130, 26);
            this.btnTerrainPath.TabIndex = 47;
@@ -58,7 +60,7 @@
            // 
            this.lblTerrain.AutoSize = true;
            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.Location = new System.Drawing.Point(33, 50);
            this.lblTerrain.Name = "lblTerrain";
            this.lblTerrain.Size = new System.Drawing.Size(79, 16);
            this.lblTerrain.TabIndex = 48;
@@ -67,7 +69,7 @@
            // txtTerrainPath
            // 
            this.txtTerrainPath.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtTerrainPath.Location = new System.Drawing.Point(109, 27);
            this.txtTerrainPath.Location = new System.Drawing.Point(118, 45);
            this.txtTerrainPath.MaxLength = 2000;
            this.txtTerrainPath.Name = "txtTerrainPath";
            this.txtTerrainPath.Size = new System.Drawing.Size(482, 26);
@@ -77,7 +79,7 @@
            // txtWaterPath
            // 
            this.txtWaterPath.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtWaterPath.Location = new System.Drawing.Point(109, 76);
            this.txtWaterPath.Location = new System.Drawing.Point(118, 94);
            this.txtWaterPath.MaxLength = 2000;
            this.txtWaterPath.Name = "txtWaterPath";
            this.txtWaterPath.Size = new System.Drawing.Size(482, 26);
@@ -88,7 +90,7 @@
            // 
            this.lblWater.AutoSize = true;
            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.Location = new System.Drawing.Point(33, 99);
            this.lblWater.Name = "lblWater";
            this.lblWater.Size = new System.Drawing.Size(79, 16);
            this.lblWater.TabIndex = 51;
@@ -97,7 +99,7 @@
            // btnWaterPath
            // 
            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.Location = new System.Drawing.Point(616, 94);
            this.btnWaterPath.Name = "btnWaterPath";
            this.btnWaterPath.Size = new System.Drawing.Size(130, 26);
            this.btnWaterPath.TabIndex = 50;
@@ -108,7 +110,7 @@
            // 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, 126);
            this.txtFlowPath.Location = new System.Drawing.Point(118, 144);
            this.txtFlowPath.MaxLength = 2000;
            this.txtFlowPath.Name = "txtFlowPath";
            this.txtFlowPath.Size = new System.Drawing.Size(482, 26);
@@ -119,7 +121,7 @@
            // 
            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, 131);
            this.lblFlow.Location = new System.Drawing.Point(33, 149);
            this.lblFlow.Name = "lblFlow";
            this.lblFlow.Size = new System.Drawing.Size(79, 16);
            this.lblFlow.TabIndex = 54;
@@ -128,7 +130,7 @@
            // 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, 126);
            this.btnFlowPath.Location = new System.Drawing.Point(616, 144);
            this.btnFlowPath.Name = "btnFlowPath";
            this.btnFlowPath.Size = new System.Drawing.Size(130, 26);
            this.btnFlowPath.TabIndex = 53;
@@ -140,9 +142,9 @@
            // 
            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, 229);
            this.btnRun.Location = new System.Drawing.Point(616, 248);
            this.btnRun.Name = "btnRun";
            this.btnRun.Size = new System.Drawing.Size(710, 26);
            this.btnRun.Size = new System.Drawing.Size(130, 26);
            this.btnRun.TabIndex = 57;
            this.btnRun.Text = "运    行";
            this.btnRun.UseVisualStyleBackColor = true;
@@ -151,7 +153,7 @@
            // 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.Location = new System.Drawing.Point(118, 196);
            this.txtOutPath.MaxLength = 2000;
            this.txtOutPath.Name = "txtOutPath";
            this.txtOutPath.Size = new System.Drawing.Size(482, 26);
@@ -162,7 +164,7 @@
            // 
            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.Location = new System.Drawing.Point(33, 201);
            this.lblOut.Name = "lblOut";
            this.lblOut.Size = new System.Drawing.Size(79, 16);
            this.lblOut.TabIndex = 59;
@@ -171,19 +173,40 @@
            // 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.Location = new System.Drawing.Point(616, 196);
            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);
            //
            // txtServiceName
            //
            this.txtServiceName.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtServiceName.Location = new System.Drawing.Point(118, 248);
            this.txtServiceName.MaxLength = 2000;
            this.txtServiceName.Name = "txtServiceName";
            this.txtServiceName.Size = new System.Drawing.Size(482, 26);
            this.txtServiceName.TabIndex = 62;
            this.txtServiceName.Text = "202407";
            //
            // lblService
            //
            this.lblService.AutoSize = true;
            this.lblService.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lblService.Location = new System.Drawing.Point(33, 253);
            this.lblService.Name = "lblService";
            this.lblService.Size = new System.Drawing.Size(79, 16);
            this.lblService.TabIndex = 61;
            this.lblService.Text = "服务名称:";
            // 
            // FrmMain
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(751, 280);
            this.ClientSize = new System.Drawing.Size(804, 324);
            this.Controls.Add(this.txtServiceName);
            this.Controls.Add(this.lblService);
            this.Controls.Add(this.txtOutPath);
            this.Controls.Add(this.lblOut);
            this.Controls.Add(this.btnOutPath);
@@ -222,6 +245,8 @@
        private System.Windows.Forms.TextBox txtOutPath;
        private System.Windows.Forms.Label lblOut;
        private System.Windows.Forms.Button btnOutPath;
        private System.Windows.Forms.TextBox txtServiceName;
        private System.Windows.Forms.Label lblService;
    }
}
SimuTools/FrmMain.cs
@@ -87,11 +87,17 @@
        private void btnRun_Click(object sender, EventArgs e)
        {
            string serviceName = this.txtServiceName.Text.Trim();
            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 (string.IsNullOrEmpty(serviceName))
            {
                ShowErr("服务名称,要求必填!");
                return;
            }
            if (!File.Exists(terrainFile))
            {
                ShowErr("地形文件,要求必须存在!");
@@ -109,10 +115,17 @@
                flag = true;
                LogOut.Info(">> 开始运行 >>");
                outPath = Path.Combine(outPath, serviceName);
                if (!Directory.Exists(outPath))
                {
                    Directory.CreateDirectory(outPath);
                }
                Tools.Handle.Run(terrainFile, waterPath, flowPath, outPath);
                LogOut.Info("<< 运行结束 <<");
                flag = false;
                LogOut.Info("<< 运行结束 <<");
                MessageBox.Show("运行结束!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
SimuTools/SimuTools.csproj
@@ -48,6 +48,10 @@
      <SpecificVersion>False</SpecificVersion>
      <HintPath>dlls\log4net4.dll</HintPath>
    </Reference>
    <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>dlls\Newtonsoft.Json.dll</HintPath>
    </Reference>
    <Reference Include="ogr_csharp, Version=3.5.2.0, Culture=neutral, PublicKeyToken=db5a52b08dc5b321, processorArchitecture=MSIL" />
    <Reference Include="osr_csharp, Version=3.5.2.0, Culture=neutral, PublicKeyToken=db5a52b08dc5b321, processorArchitecture=MSIL" />
    <Reference Include="System" />
@@ -562,6 +566,7 @@
    <Content Include="dlls\gdal_csharp.dll" />
    <Content Include="dlls\gdal_wrap.dll" />
    <Content Include="dlls\log4net4.dll" />
    <Content Include="dlls\Newtonsoft.Json.dll" />
    <Content Include="dlls\ogr_csharp.dll" />
    <Content Include="dlls\ogr_wrap.dll" />
    <Content Include="dlls\osr_csharp.dll" />
SimuTools/Tools/Handle.cs
@@ -1,9 +1,11 @@
using System;
using Newtonsoft.Json;
using SimuTools.Domain;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SimuTools.Tools
{
@@ -13,7 +15,26 @@
        public static void Run(string terrainFile, string waterPath, string flowPath, string outPath)
        {
            //
            Layer layer = new Layer();
            layer.terrain = new Terrain();
            layer.duration = new Duration(1719812810225L, 1719812810225L);
            layer.extension = new Extension();
            layer.waters = new Water();
            CreateLayerJson(outPath, layer);
        }
        private static void CreateLayerJson(string outPath, Layer layer)
        {
            if (null == layer) return;
            String json = JsonConvert.SerializeObject(layer);
            string filePath = Path.Combine(outPath, "layer.json");
            using (StreamWriter sw = new StreamWriter(filePath))
            {
                sw.Write(json);
            }
        }
    }
}
SimuTools/dlls/Newtonsoft.Json.dll
Binary files differ