cell_struct.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #pragma
  2. #ifndef YASERVER_CELL_STRUCT_H_
  3. #define YASERVER_CELL_STRUCT_H_
  4. #define CELL_WIDTH 0.3 //格子宽度,单位为米
  5. #define SEND_CELL_INTERVAL 500
  6. #define BRANCH_RANGE 6 //分支确认范围,单位为米
  7. #define LAST_V_POWER 0.7
  8. #define THIS_V_POWER 0.3
  9. #define MAX_CHANGE_DIR_COUNTS 5
  10. #define MAX_CELL_FORWARD_JUMP 20 //15
  11. #define MAX_IDLE_CELL_THRE 2 //怠速单员格阈值
  12. #define FIT_RELIABILITY 0.7 //拟合数据权限
  13. #define MAX_FIT_DATA_COUNTS 5 //最大拟合数据统计数
  14. #define MAX_IDLING_HISTORY_DATA_COUNTS 15 //最大历史数据队列, 用于怠速判断
  15. #define MAX_DIRECTION_COUNTS 5 //最大方向统计数
  16. struct point{
  17. double x;
  18. double y;
  19. point(){
  20. x = y = 0;
  21. }
  22. point& operator=(point& p){
  23. x = p.x;
  24. y = p.y;
  25. return *this;
  26. }
  27. };
  28. struct ReaderInfo{
  29. int reader_id;
  30. double x;
  31. double y;
  32. double z;
  33. ReaderInfo(){
  34. reader_id = 0;
  35. x = y = z =0;
  36. }
  37. ReaderInfo& operator=(ReaderInfo& v){
  38. reader_id = v.reader_id;
  39. x = v.x;
  40. y = v.y;
  41. z = v.z;
  42. return *this;
  43. }
  44. bool operator<(ReaderInfo& v) const{
  45. if (abs(x-v.x) < 1E-2)
  46. {
  47. if (y < v.y)
  48. {
  49. return true;
  50. }else{
  51. return false;
  52. }
  53. }else{
  54. if (x < v.x)
  55. {
  56. return true;
  57. }else{
  58. return false;
  59. }
  60. }
  61. }
  62. };
  63. //格子信息20170705
  64. class Cell{
  65. public:
  66. Cell(){
  67. strSubjectReader = "";
  68. strOriginReaderName = "";
  69. id = 0;
  70. nStep = 0;
  71. minReaderId = maxReaderId = 0;
  72. dataSource = 0;
  73. card_stamp_time = 0;
  74. isHasBranch = false;
  75. isFit = isOverThre = false;
  76. isChangePath = false;
  77. top.x = top.y = bottom.x = bottom.y = left.x = left.y = right.x = right.y = 0;
  78. originId = 0;
  79. ::GetLocalTime(&deal_time);
  80. ::GetLocalTime(&interval_time);
  81. }
  82. ~Cell(){}
  83. public:
  84. int id; //格子id
  85. int minReaderId; //此格子所属的分站路径中的最小分站
  86. int maxReaderId; //此格子所属的分站路径中的最大分站
  87. int originMinReaderId;
  88. int originMaxReaderId;
  89. int nStep; //距离上一次格子的步进
  90. //数据来源,0为未知,1为定位算法生成,2为定时器内生成, 3 算法调整值, 后续流程可能被替换为后续定义的具体值
  91. // 10以后算法定义
  92. // 10 剔除大跳野值后, 由线性拟合生成数据
  93. // 11 位置 position 求解失败, 多解求一解失败, 由线性拟合生成数据
  94. // 14 通过格子 id 判断运动方向是否相同, 不同, 判断回退次数是否小于10, 减速补值
  95. // 15 通过格子 id 判断运动方向是否相同, 相同后由线性拟合生成数据
  96. int dataSource;
  97. int originId; //原始定位坐标转换的原始格子id
  98. int card_stamp_time; //卡的ct号
  99. std::string strSubjectReader; //格子所属分站名称
  100. std::string strOriginReaderName; //原始格子所属分站名,通过原始格子号+此属性,可以唯一确定格子的中心点坐标
  101. point top,bottom,left,right; //格子的4个顶点位置
  102. bool isHasBranch; //此格子附近是否有分支
  103. bool isFit; //此格子是否是拟合出的结果
  104. bool isOverThre; //是否越界,或者大跳
  105. bool isChangePath; //是否切换分站
  106. SYSTEMTIME deal_time; //格子的处理时间
  107. SYSTEMTIME interval_time; //格子的0,500ms间隔时间
  108. int realId;
  109. public:
  110. double getX(){
  111. return (this->top.x + this->bottom.x)/2;
  112. }
  113. double getY(){
  114. return (this->top.y + this->bottom.y)/2;
  115. }
  116. public:
  117. Cell& operator=(Cell&c){
  118. id = c.id;
  119. nStep = c.nStep;
  120. minReaderId = c.minReaderId;
  121. maxReaderId = c.maxReaderId;
  122. originMinReaderId = c.originMinReaderId;
  123. originMaxReaderId = c.originMaxReaderId;
  124. strSubjectReader = c.strSubjectReader;
  125. dataSource = c.dataSource;
  126. top = c.top;
  127. bottom = c.bottom;
  128. left = c.left;
  129. right = c.right;
  130. isHasBranch = c.isHasBranch;
  131. isFit = c.isFit;
  132. card_stamp_time = c.card_stamp_time;
  133. isOverThre = c.isOverThre;
  134. isChangePath = c.isChangePath;
  135. deal_time = c.deal_time;
  136. originId = c.originId;
  137. strOriginReaderName = c.strOriginReaderName;
  138. realId = c.realId;
  139. return *this;
  140. }
  141. };
  142. #endif // !YASERVER_CELL_STRUCT_H_