using System.Collections.Generic;
|
|
namespace IStation.Model
|
{
|
/// <summary>
|
/// 曲线点列表组
|
/// </summary>
|
public class FeatCurvePointGroup
|
{
|
public FeatCurvePointGroup() { }
|
public FeatCurvePointGroup(FeatCurveExpressGroup grp)
|
{
|
this.PointQH = IStation.Common.FitCurveHelper.GetFitPoints(grp.CurveQH, 10);
|
this.PointQE = IStation.Common.FitCurveHelper.GetFitPoints(grp.CurveQE, 10);
|
this.PointQP = IStation.Common.FitCurveHelper.GetFitPoints(grp.CurveQP, 10);
|
}
|
public FeatCurvePointGroup(List<CurvePoint> qh, List<CurvePoint> qe, List<CurvePoint> qp)
|
{
|
this.PointQH = qh;
|
this.PointQE = qe;
|
this.PointQP = qp;
|
}
|
public FeatCurvePointGroup(string dsString)
|
{
|
if (string.IsNullOrEmpty(dsString))
|
return;
|
var dict = JsonHelper.Json2Object<Dictionary<string, string>>(dsString);
|
if (dict.ContainsKey("PointQH"))
|
this.PointQH = CurvePoint.ToList(dict["PointQH"]);
|
if (dict.ContainsKey("PointQE"))
|
this.PointQE = CurvePoint.ToList(dict["PointQE"]);
|
if (dict.ContainsKey("PointQP"))
|
this.PointQP = CurvePoint.ToList(dict["PointQP"]);
|
}
|
|
/// <summary>
|
/// 流量扬程点列表
|
/// </summary>
|
public List<CurvePoint> PointQH { get; set; }
|
|
/// <summary>
|
/// 流量效率点列表
|
/// </summary>
|
public List<CurvePoint> PointQE { get; set; }
|
|
/// <summary>
|
/// 流量功率点列表
|
/// </summary>
|
public List<CurvePoint> PointQP { get; set; }
|
|
|
/// <summary>
|
/// To保存字符串
|
/// </summary>
|
public string ToDsString()
|
{
|
var dict = new Dictionary<string, string>();
|
if (this.PointQH != null && this.PointQH.Count > 0)
|
{
|
dict.Add("PointQH", this.PointQH.ToDsString());
|
}
|
|
if (this.PointQE != null && this.PointQE.Count > 0)
|
{
|
dict.Add("PointQE", this.PointQE.ToDsString());
|
}
|
|
if (this.PointQP != null && this.PointQP.Count > 0)
|
{
|
dict.Add("PointQP", this.PointQP.ToDsString());
|
}
|
|
if (dict.Count < 1)
|
return string.Empty;
|
|
return JsonHelper.Object2Json(dict);
|
}
|
|
/// <summary>
|
/// TO Model
|
/// </summary>
|
public static FeatCurvePointGroup ToModel(string dsString)
|
{
|
if (string.IsNullOrEmpty(dsString))
|
return default;
|
var dict = JsonHelper.Json2Object<Dictionary<string, string>>(dsString);
|
var model = new FeatCurvePointGroup();
|
if (dict.ContainsKey("PointQH"))
|
model.PointQH = CurvePoint.ToList(dict["PointQH"]);
|
if (dict.ContainsKey("PointQE"))
|
model.PointQE = CurvePoint.ToList(dict["PointQE"]);
|
if (dict.ContainsKey("PointQP"))
|
model.PointQP = CurvePoint.ToList(dict["PointQP"]);
|
return model;
|
}
|
|
|
|
|
}
|
|
|
|
}
|