using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Hydro.MapView { [Serializable] public class TankViewModel:NodeViewModel { [Category("计算参数")] [DisplayName("初始水位(m)")] public float InitLevel { get; set; } = 5; [Category("计算参数")] [DisplayName("最低水位(m)")] public float MinLevel { get; set; } = 0; [Category("计算参数")] [DisplayName("最高水位(m)")] public float MaxLevel { get; set; } = 10; [Category("计算参数")] [DisplayName("直径(mm)")] [Browsable(false)] public float Diameter { get; set; } = 10; [Category("计算参数")] [DisplayName("池底面积")] public double Area { get { return Math.PI * Math.Pow(Diameter, 2) / 4; } set { Diameter = (float)Math.Pow(value / Math.PI, 0.5) * 2; } } [Category("计算参数")] [DisplayName("最小容积")] public float MinVol { get; set; } = 0; [Category("计算参数")] [DisplayName("容积曲线")] public string VolCurve { get; set; } = ""; [Category("计算参数")] [DisplayName("是否允许溢流")] public string Overflow { get; set; } = ""; public TankViewModel() { } public TankViewModel(string id, string elevation, string initlevel, string minlevel, string maxlevel, string diameter, string minvol, string volcurve, string overflow) { ID = id; Elev = float.Parse(elevation); float d = 0; float.TryParse(initlevel, out d); InitLevel = d; float.TryParse(minlevel, out d); MinLevel = d; float.TryParse(maxlevel, out d); MaxLevel = d; float.TryParse(diameter, out d); Diameter = d; float.TryParse(minvol, out d); MinVol = d; VolCurve = ""; //float.TryParse(overflow, out d ); Overflow = ""; } public override string ToString() { VolCurve = ""; Overflow = ""; return $"{ID}\t{Elev}\t{InitLevel}\t{MinLevel}\t{MaxLevel}\t{Diameter}\t{MinVol}\t{VolCurve}\t{Overflow}\t;\t"; } } }