From 5841423dd021e2d070cff5d3cbca8849ae89fa93 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期四, 18 七月 2024 14:36:52 +0800 Subject: [PATCH] 添加实体类 --- SimuTools/Domain/Layer.cs | 41 ++++++++++ SimuTools/Domain/Duration.cs | 23 +++++ SimuTools/SimuTools.csproj | 10 + SimuTools/Domain/Water.cs | 20 +++++ SimuTools/Domain/Terrain.cs | 37 +++++++++ SimuTools/App.config | 1 SimuTools/Domain/Extension.cs | 49 ++++++++++++ 7 files changed, 178 insertions(+), 3 deletions(-) diff --git a/SimuTools/App.config b/SimuTools/App.config index 57493a4..d53e0be 100644 --- a/SimuTools/App.config +++ b/SimuTools/App.config @@ -1,6 +1,7 @@ 锘�<?xml version="1.0"?> <configuration> <appSettings> + <add key="ver" value="0.1"/> <add key="sizes" value="64,128,256,512,1024,2048"/> </appSettings> <startup> diff --git a/SimuTools/Domain/Duration.cs b/SimuTools/Domain/Duration.cs new file mode 100644 index 0000000..9bb0b6e --- /dev/null +++ b/SimuTools/Domain/Duration.cs @@ -0,0 +1,23 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SimuTools.Domain +{ + public class Duration + { + private long start { set; get; } + + private long end { set; get; } + + public Duration() { } + + public Duration(long start, long end) + { + this.start = start; + this.end = end; + } + } +} diff --git a/SimuTools/Domain/Extension.cs b/SimuTools/Domain/Extension.cs new file mode 100644 index 0000000..ad2daed --- /dev/null +++ b/SimuTools/Domain/Extension.cs @@ -0,0 +1,49 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SimuTools.Domain +{ + public class Extension + { + private double minx { set; get; } + + private double miny { set; get; } + + private double maxx { set; get; } + + private double maxy { set; get; } + + private double minHeight { set; get; } + + private double maxHeight { set; get; } + + public Extension() { } + + public Extension(double minx, double miny, double maxx, double maxy) + { + this.minx = minx; + this.miny = miny; + this.maxx = maxx; + this.maxy = maxy; + } + + public Extension(double minHeight, double maxHeight) + { + this.minHeight = minHeight; + this.maxHeight = maxHeight; + } + + public Extension(double minx, double miny, double maxx, double maxy, double minHeight, double maxHeight) + { + this.minx = minx; + this.miny = miny; + this.maxx = maxx; + this.maxy = maxy; + this.minHeight = minHeight; + this.maxHeight = maxHeight; + } + } +} diff --git a/SimuTools/Domain/Layer.cs b/SimuTools/Domain/Layer.cs new file mode 100644 index 0000000..15d8c2f --- /dev/null +++ b/SimuTools/Domain/Layer.cs @@ -0,0 +1,41 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Net.NetworkInformation; +using System.Text; +using System.Threading.Tasks; + +namespace SimuTools.Domain +{ + public class Layer + { + private String version { set; get; } + + private Duration duration { set; get; } + + private Extension extension { set; get; } + + private Terrain terrain { set; get; } + + private Water waters { set; get; } + + public Layer() + { + string ver = ConfigurationManager.AppSettings["ver"]; + if (!string.IsNullOrEmpty(ver)) + { + this.version = ver; + } + } + + public Layer(string version, Duration duration, Extension extension, Terrain terrain, Water waters) + { + this.version = version; + this.duration = duration; + this.extension = extension; + this.terrain = terrain; + this.waters = waters; + } + } +} diff --git a/SimuTools/Domain/Terrain.cs b/SimuTools/Domain/Terrain.cs new file mode 100644 index 0000000..92fdd53 --- /dev/null +++ b/SimuTools/Domain/Terrain.cs @@ -0,0 +1,37 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SimuTools.Domain +{ + public class Terrain + { + private List<int[]> size { set; get; } + + public Terrain() + { + size = new List<int[]>(); + + string str = ConfigurationManager.AppSettings["sizes"]; + if (string.IsNullOrEmpty(str)) return; + + string[] strs = str.Split(','); + foreach (string s in strs) + { + int i; + if (int.TryParse(s, out i)) + { + size.Add(new int[] { i, i }); + } + } + } + + public Terrain(List<int[]> size) + { + this.size = size; + } + } +} diff --git a/SimuTools/Domain/Water.cs b/SimuTools/Domain/Water.cs new file mode 100644 index 0000000..577bac2 --- /dev/null +++ b/SimuTools/Domain/Water.cs @@ -0,0 +1,20 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SimuTools.Domain +{ + public class Water + { + private List<long> data { set; get; } + + public Water() { } + + public Water(List<long> data) + { + this.data = data; + } + } +} diff --git a/SimuTools/SimuTools.csproj b/SimuTools/SimuTools.csproj index 0a9e3ba..451acb4 100644 --- a/SimuTools/SimuTools.csproj +++ b/SimuTools/SimuTools.csproj @@ -38,6 +38,7 @@ <HintPath>dlls\log4net4.dll</HintPath> </Reference> <Reference Include="System" /> + <Reference Include="System.Configuration" /> <Reference Include="System.Core" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> @@ -49,6 +50,11 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="Domain\Duration.cs" /> + <Compile Include="Domain\Extension.cs" /> + <Compile Include="Domain\Layer.cs" /> + <Compile Include="Domain\Terrain.cs" /> + <Compile Include="Domain\Water.cs" /> <Compile Include="FrmMain.cs"> <SubType>Form</SubType> </Compile> @@ -98,9 +104,7 @@ <Content Include="dlls\osr_csharp.dll" /> <Content Include="dlls\osr_wrap.dll" /> </ItemGroup> - <ItemGroup> - <Folder Include="Domain\" /> - </ItemGroup> + <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. -- Gitblit v1.9.3