ResultModel.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace MeterVision.model
  7. {
  8. public class ResultModel
  9. {
  10. //private static double divisor = 10000;
  11. public static Dictionary<uint,int> decimalPlaceMapping = new Dictionary<uint, int>
  12. {
  13. { 10000000, -3 }, // 100000 表示负 1 位小数,10000立方
  14. { 1000000, -2 }, // 100000 表示负 1 位小数,100立方
  15. { 100000, -1 }, // 100000 表示负 1 位小数,10立方
  16. { 10000, 0 }, // 10000 表示 0 位小数,即 1 立方
  17. { 1000, 1 }, // 1000 表示 1 位小数,即 0.1 立方
  18. { 100, 2 }, // 100 表示 2 位小数,即 0.01 立方
  19. { 10, 3 }, // 10 表示 3 位小数,即 0.001 立方
  20. { 1, 4 } // 1 表示 4 位小数,即 0.0001 立方
  21. };
  22. public string SrcImage { get; set; }
  23. //public string RunFlag { get; set; }
  24. //public string RunTime { get; set; }
  25. public string DstImage { get; set; }
  26. //仪表类型(0:不是水表图片,1:数字+指针,2:全指针 3:全数字)
  27. public int ResultMeter { get; set; }
  28. //public int DigitCount { get; set; }
  29. //public int PointerCount { get; set; }
  30. //小数尾数
  31. //public int DecimalPlaces
  32. //{
  33. // get
  34. // {
  35. // if(decimalPlaceMapping.TryGetValue(LastUnit, out int decimalPlaces))
  36. // {
  37. // return decimalPlaces;
  38. // }
  39. // return 0;
  40. // }
  41. //}
  42. //1DL单位
  43. //单位等级0x00 - 0x08(0.0001 - 10000m³)
  44. //public uint LastUnit { get; set; }
  45. //public string SLastUnit
  46. //{
  47. // get => GetSValueByIValue(LastUnit);
  48. //}
  49. public int ResultType { get; set; }
  50. public ulong RawValue { get; set; }
  51. //public string SRawValue
  52. //{
  53. // get => GetSValueByIValue(RawValue);
  54. //}
  55. public ulong FinalValue { get; set; }
  56. //public string sFinalValue
  57. //{
  58. // get => GetSValueByIValue(FinalValue);
  59. //}
  60. public ulong CompleteValue { get; set; }
  61. //public string sCompleteValue
  62. //{
  63. // get
  64. // {
  65. // return ((double)CompleteValue / divisor).ToString();
  66. // }
  67. //}
  68. public int ValueChanged { get; set; }
  69. public string AiVer { get; set; }
  70. public byte[] DebugInfoBytes { get; set; }
  71. public string LogPath { get; set; }
  72. public int CompressIndex { get; set; }
  73. public string MeterRegions { get; set; }
  74. public string FeatureRegions { get; set; }
  75. public ResultModel()
  76. {
  77. }
  78. //private string GetSValueByIValue(ulong iValue)
  79. //{
  80. // if (DecimalPlaces > 0)
  81. // {
  82. // double value = (double)iValue / divisor;
  83. // // 不进行四舍五入,使用 Math.Truncate 来截断小数部分
  84. // value = Math.Truncate(value * Math.Pow(10, DecimalPlaces)) / Math.Pow(10, DecimalPlaces);
  85. // return value.ToString($"F{DecimalPlaces}");
  86. // //return value.ToString($"F{DecimalPlaces}");
  87. // }
  88. // else
  89. // {
  90. // double value = (double)(iValue / divisor) * Math.Pow(10, Math.Abs(DecimalPlaces));
  91. // // 不进行四舍五入,使用 Math.Truncate 来截断小数部分
  92. // value = Math.Truncate(value);
  93. // return value.ToString("F0");
  94. // }
  95. //}
  96. //------------------------------------------------------
  97. }
  98. }