|
@@ -27,9 +27,9 @@ public class StationData : IComparable
|
|
|
public string lttd; // 纬度
|
|
|
public string stcd; // 站码
|
|
|
|
|
|
- public float? upz; // 上水位
|
|
|
- public float? dwz; // 下水位
|
|
|
- public float? tgtq; // 流量
|
|
|
+ public string upz; // 上水位
|
|
|
+ public string dwz; // 下水位
|
|
|
+ public string tgtq; // 流量
|
|
|
public string tm; // 时间
|
|
|
|
|
|
public string swchrcd;
|
|
@@ -239,46 +239,73 @@ public class SWYJLayer : YZTRootLayer
|
|
|
title.text = "监测数据" + "(补元)";
|
|
|
int index1 = YZTLayer.FindIndexByHotPointName("套口(上)");
|
|
|
int index2 = YZTLayer.FindIndexByHotPointName("套口(下)");
|
|
|
- float value1 = GlobalData.swDatas[index1].upz ?? 0;
|
|
|
- float value2 = GlobalData.swDatas[index1].dwz ?? 0;
|
|
|
- if (value1 > 1000)
|
|
|
+
|
|
|
+ string value1 = GlobalData.swDatas[index1].upz;
|
|
|
+ string value2 = GlobalData.swDatas[index1].dwz;
|
|
|
+
|
|
|
+ float num1 = (value1 == "-") ? float.MinValue : float.Parse(value1);
|
|
|
+ float num2 = (value2 == "-") ? float.MinValue : float.Parse(value2);
|
|
|
+
|
|
|
+ float avgValue = 0f;
|
|
|
+
|
|
|
+ if (num1 == float.MinValue && num2 == float.MinValue)
|
|
|
{
|
|
|
- value1 = value1 / 100.0f;
|
|
|
+ _pingJunShuiWeiText.text = "-";
|
|
|
}
|
|
|
-
|
|
|
- if (value2 > 1000)
|
|
|
+ else if (num1 == float.MinValue)
|
|
|
+ {
|
|
|
+ _pingJunShuiWeiText.text = $"{num2.ToString("0.00")} <color=#A5BBE2>m</color>";
|
|
|
+ }
|
|
|
+ else if (num2 == float.MinValue)
|
|
|
+ {
|
|
|
+ _pingJunShuiWeiText.text = $"{num1.ToString("0.00")} <color=#A5BBE2>m</color>";
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- value2 = value2 / 100.0f;
|
|
|
+ avgValue = (num1 + num2) / 2;
|
|
|
+ _pingJunShuiWeiText.text = $"{avgValue.ToString("0.00")} <color=#A5BBE2>m</color>";
|
|
|
}
|
|
|
|
|
|
- _pingJunShuiWeiText.text = $"{((value1 + value2) / 2).ToString("0.00")} <color=#A5BBE2>m</color>";
|
|
|
_sheFangShuiWeiText.text = $"{GlobalData.threeLevelShuiWeiDatas[0].floodProtectionLevel} m";
|
|
|
_jingJieShuiWeiText.text = $"{GlobalData.threeLevelShuiWeiDatas[0].warningLevel} m";
|
|
|
_baoZhengShuiWeiText.text = $"{GlobalData.threeLevelShuiWeiDatas[0].guaranteeLevel} m";
|
|
|
- _shuiWeiText.text = $"{value1.ToString("0.00")}";
|
|
|
+ _shuiWeiText.text = $"{value1}";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
title.text = "监测数据" + "(套口)";
|
|
|
int index1 = YZTLayer.FindIndexByHotPointName("套口(上)");
|
|
|
int index2 = YZTLayer.FindIndexByHotPointName("套口(下)");
|
|
|
- float value1 = GlobalData.swDatas[index1].upz ?? 0;
|
|
|
- float value2 = GlobalData.swDatas[index1].dwz ?? 0;
|
|
|
- if (value1 > 1000)
|
|
|
+
|
|
|
+ string value1 = GlobalData.swDatas[index1].upz;
|
|
|
+ string value2 = GlobalData.swDatas[index1].dwz;
|
|
|
+
|
|
|
+ float num1 = (value1 == "-") ? float.MinValue : float.Parse(value1);
|
|
|
+ float num2 = (value2 == "-") ? float.MinValue : float.Parse(value2);
|
|
|
+
|
|
|
+ float avgValue = 0f;
|
|
|
+
|
|
|
+ if (num1 == float.MinValue && num2 == float.MinValue)
|
|
|
{
|
|
|
- value1 = value1 / 100.0f;
|
|
|
+ _pingJunShuiWeiText.text = "-";
|
|
|
}
|
|
|
-
|
|
|
- if (value2 > 1000)
|
|
|
+ else if (num1 == float.MinValue)
|
|
|
{
|
|
|
- value2 = value2 / 100.0f;
|
|
|
+ _pingJunShuiWeiText.text = $"{num2.ToString("0.00")} <color=#A5BBE2>m</color>";
|
|
|
+ }
|
|
|
+ else if (num2 == float.MinValue)
|
|
|
+ {
|
|
|
+ _pingJunShuiWeiText.text = $"{num1.ToString("0.00")} <color=#A5BBE2>m</color>";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ avgValue = (num1 + num2) / 2;
|
|
|
+ _pingJunShuiWeiText.text = $"{avgValue.ToString("0.00")} <color=#A5BBE2>m</color>";
|
|
|
}
|
|
|
-
|
|
|
- _pingJunShuiWeiText.text = $"{((value1 + value2) / 2).ToString("0.00")} <color=#A5BBE2>m</color>";
|
|
|
_sheFangShuiWeiText.text = $"{GlobalData.threeLevelShuiWeiDatas[1].floodProtectionLevel} m";
|
|
|
_jingJieShuiWeiText.text = $"{GlobalData.threeLevelShuiWeiDatas[1].warningLevel} m";
|
|
|
_baoZhengShuiWeiText.text = $"{GlobalData.threeLevelShuiWeiDatas[1].guaranteeLevel} m";
|
|
|
- _shuiWeiText.text = $"{value1.ToString("0.00")}";
|
|
|
+ _shuiWeiText.text = $"{value1}";
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -288,8 +315,8 @@ public class SWYJLayer : YZTRootLayer
|
|
|
{
|
|
|
if (currentDataType == 0)
|
|
|
{
|
|
|
- float? swUp = null;
|
|
|
- float? swDown = null;
|
|
|
+ string swUp = null;
|
|
|
+ string swDown = null;
|
|
|
string swUpName = "";
|
|
|
string swDownName = "";
|
|
|
for (int i = 0; i < GlobalData.swDatas.Count; i++)
|
|
@@ -323,8 +350,8 @@ public class SWYJLayer : YZTRootLayer
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- float? swUp = null;
|
|
|
- float? swDown = null;
|
|
|
+ string swUp = null;
|
|
|
+ string swDown = null;
|
|
|
string swUpName = "";
|
|
|
string swDownName = "";
|
|
|
for (int i = 0; i < GlobalData.swDatas.Count; i++)
|
|
@@ -425,8 +452,8 @@ public class SWYJLayer : YZTRootLayer
|
|
|
public string lgtd; // 经度
|
|
|
public string lttd; // 纬度
|
|
|
|
|
|
- public float? upz; // 上水位
|
|
|
- public float? dwz; // 下水位
|
|
|
+ public string upz; // 上水位
|
|
|
+ public string dwz; // 下水位
|
|
|
public float? tgtq; // 流量
|
|
|
}
|
|
|
|
|
@@ -490,9 +517,9 @@ public class SWYJLayer : YZTRootLayer
|
|
|
GameObject gameObject = Instantiate(sWHeightUnitPrefab);
|
|
|
SWHeightUnit swHUnit = gameObject.GetComponent<SWHeightUnit>();
|
|
|
swHUnit.transform.SetParent(miniMapSWContent.transform);
|
|
|
- float upz = stationDataLib[key].upz ?? 0;
|
|
|
- float dwz = stationDataLib[key].dwz ?? 0;
|
|
|
- swHUnit.Init(stationDataLib[key].lgtd, stationDataLib[key].lttd, stationDataLib[key].stnm, upz.ToString("0.00"), dwz.ToString("0.00"));
|
|
|
+ string upz = stationDataLib[key].upz;
|
|
|
+ string dwz = stationDataLib[key].dwz;
|
|
|
+ swHUnit.Init(stationDataLib[key].lgtd, stationDataLib[key].lttd, stationDataLib[key].stnm, upz, dwz);
|
|
|
sWHeightUnits.Add(swHUnit);
|
|
|
|
|
|
swHUnit.bingObj = Instantiate(runtimePointObj).gameObject;
|
|
@@ -511,9 +538,9 @@ public class SWYJLayer : YZTRootLayer
|
|
|
int i = 0;
|
|
|
foreach (var key in stationDataLib.Keys)
|
|
|
{
|
|
|
- float upz = stationDataLib[key].upz ?? 0;
|
|
|
- float dwz = stationDataLib[key].dwz ?? 0;
|
|
|
- sWHeightUnits[i].Init(stationDataLib[key].lgtd, stationDataLib[key].lttd, stationDataLib[key].stnm, upz.ToString("0.00"), dwz.ToString("0.00"));
|
|
|
+ string upz = stationDataLib[key].upz;
|
|
|
+ string dwz = stationDataLib[key].dwz;
|
|
|
+ sWHeightUnits[i].Init(stationDataLib[key].lgtd, stationDataLib[key].lttd, stationDataLib[key].stnm, upz, dwz);
|
|
|
i += 0;
|
|
|
}
|
|
|
}
|
|
@@ -569,6 +596,7 @@ public class SWYJLayer : YZTRootLayer
|
|
|
endDateStr = today.ToString("yyyy-MM-dd");
|
|
|
|
|
|
var chartJsonStr = await HttpHelper._Instance.GetWaterTrend_Chart(_stcd, startDateStr, endDateStr);
|
|
|
+ //Debug.Log(chartJsonStr);
|
|
|
WaterTrendData_Chart tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<WaterTrendData_Chart>(chartJsonStr);
|
|
|
|
|
|
if (tempData != null)
|
|
@@ -582,7 +610,7 @@ public class SWYJLayer : YZTRootLayer
|
|
|
}
|
|
|
|
|
|
var tempSeries = shuiWeiBianHua.series;
|
|
|
- tempSeries[0].serieName = "水位(m)";
|
|
|
+ tempSeries[1].serieName = "水位(m)";
|
|
|
SerieData[] tempDatas = new SerieData[tempData.data.Count];
|
|
|
for (int i = 0; i < tempDatas.Length; i++)
|
|
|
{
|
|
@@ -600,8 +628,8 @@ public class SWYJLayer : YZTRootLayer
|
|
|
tempDatas[i].data.Add(tempValue);
|
|
|
}
|
|
|
|
|
|
- tempSeries[0].data.Clear();
|
|
|
- tempSeries[0].data.AddRange(tempDatas);
|
|
|
+ tempSeries[1].data.Clear();
|
|
|
+ tempSeries[1].data.AddRange(tempDatas);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -629,7 +657,24 @@ public class SWYJLayer : YZTRootLayer
|
|
|
obj.transform.SetParent(zdpmParent.transform);
|
|
|
obj.transform.localScale = Vector3.one;
|
|
|
obj.transform.GetChild(1).GetComponent<Text>().text = stationDatas[i].stnm;
|
|
|
- float max = MathF.Max(stationDatas[i].upz ?? 0, stationDatas[i].dwz ?? 0);
|
|
|
+
|
|
|
+ string max = "";
|
|
|
+
|
|
|
+ string valueUpz = stationDatas[i].upz;
|
|
|
+ string valueDwz = stationDatas[i].dwz;
|
|
|
+
|
|
|
+ if (valueUpz == "-" && valueDwz == "-")
|
|
|
+ {
|
|
|
+ max = "-";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ float parsedUpz = (valueUpz == "-") ? float.MinValue : float.Parse(valueUpz);
|
|
|
+ float parsedDwz = (valueDwz == "-") ? float.MinValue : float.Parse(valueDwz);
|
|
|
+
|
|
|
+ max = MathF.Max(parsedUpz, parsedDwz).ToString("0.00");
|
|
|
+ }
|
|
|
+
|
|
|
//if (i == 0)
|
|
|
// obj.transform.GetChild(0).GetChild(0).GetComponent<Text>().text = "1";
|
|
|
//else if (i == 1)
|
|
@@ -645,13 +690,23 @@ public class SWYJLayer : YZTRootLayer
|
|
|
{
|
|
|
string name = stationDatas[i].stnm;
|
|
|
zdpmObjs[i].transform.GetChild(1).GetComponent<Text>().text = stationDatas[i].stnm;
|
|
|
- float max = MathF.Max(stationDatas[i].upz ?? 0, stationDatas[i].dwz ?? 0);
|
|
|
- if (i == 0)
|
|
|
- zdpmObjs[i].transform.GetChild(0).GetChild(0).GetComponent<Text>().text = "1";
|
|
|
- else if (i == 1)
|
|
|
- zdpmObjs[i].transform.GetChild(0).GetChild(0).GetComponent<Text>().text = "2";
|
|
|
+ string max = "";
|
|
|
+
|
|
|
+ string valueUpz = stationDatas[i].upz;
|
|
|
+ string valueDwz = stationDatas[i].dwz;
|
|
|
+
|
|
|
+ if (valueUpz == "-" && valueDwz == "-")
|
|
|
+ {
|
|
|
+ max = "-";
|
|
|
+ }
|
|
|
else
|
|
|
- zdpmObjs[i].transform.GetChild(0).GetChild(0).GetComponent<Text>().text = i + "";
|
|
|
+ {
|
|
|
+ float parsedUpz = (valueUpz == "-") ? float.MinValue : float.Parse(valueUpz);
|
|
|
+ float parsedDwz = (valueDwz == "-") ? float.MinValue : float.Parse(valueDwz);
|
|
|
+
|
|
|
+ max = MathF.Max(parsedUpz, parsedDwz).ToString("0.00");
|
|
|
+ }
|
|
|
+ zdpmObjs[i].transform.GetChild(0).GetChild(0).GetComponent<Text>().text = i + 1 + "";
|
|
|
zdpmObjs[i].transform.GetChild(1).GetChild(0).GetComponent<Text>().text =
|
|
|
$"{max} <size=14><color=#A5BBE2>m</color></size>";
|
|
|
}
|