his_location.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef __INCLUDE_HIS_LOCATION_HPP
  2. #define __INCLUDE_HIS_LOCATION_HPP
  3. #include <complex>
  4. #include <queue>
  5. #include "point.h"
  6. //速度
  7. //区域 地图变换
  8. //运动方向
  9. //路径变换
  10. struct location_card
  11. {
  12. location_card(uint32_t id,uint64_t type,uint32_t objid);
  13. uint32_t m_cardid;//卡id
  14. uint16_t m_type;//卡类型
  15. uint32_t m_objid;
  16. double m_arg;//运动方向角度值
  17. int m_areaid;//区域
  18. int m_mapid;//地图
  19. uint64_t m_timestamp;//入库后的时间
  20. point m_p;//入库后的点
  21. int m_direct_index;
  22. uint64_t last_timestamp;
  23. bool m_isInsert ; //是否
  24. static uint32_t m_difftime;//进入盲区得时长限制 时长
  25. static int m_distance;//进入盲区后,第一个点与之前得距离 像素距离
  26. struct mini_data
  27. {
  28. mini_data(const point &p,uint64_t t)
  29. :p(p)
  30. ,time(t)
  31. {}
  32. point p;
  33. uint64_t time;
  34. };
  35. std::queue<mini_data> m_d;
  36. void init();
  37. void init_att(const point &pt,uint64_t time);
  38. void set_invalid();
  39. //当前m_arg运动方向角度值 是否有效 0x12345678无效
  40. bool is_valid();
  41. //计算运动方向角度值
  42. double make_arg(const point &pt,const point &p);
  43. void set(const point &pt,uint64_t time);
  44. // 是否在路径上改变方向
  45. bool line_changed(const point &pt);//,int &df)
  46. // 判断速度变化
  47. bool is_speed_changed(const point& pt,uint64_t time);
  48. // 超时
  49. bool time_out(const point &p,uint64_t time);
  50. // 区域变化
  51. bool is_area_changed(int new_areaid);
  52. // 地图变化
  53. bool is_map_changed(int new_mapid);
  54. // 计算当前点是否需要记录到DB中
  55. void push(uint64_t timestamp,const point & p,int32_t areaid,int32_t mapid,bool bclose = false);
  56. void insert();
  57. void update(const point &p,uint64_t timestamp,int flag=0,int dflag=0);
  58. // 操作路径上点的集合
  59. std::vector<point> find_path(const point &p1,const point &p2);
  60. //virtual bool handle_message(const point &p,uint64_t timestamp)=0;
  61. bool handle_message(const point &p,uint64_t timestamp);
  62. // 处理获取到点的集合,在路径上
  63. bool handle_path(std::vector<point> &rc,uint64_t timestamp,bool flag);
  64. //升井后处理
  65. void deal_up_well();
  66. };
  67. #endif