landmark.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef __LAND_MARK_HPP__
  2. #define __LAND_MARK_HPP__
  3. #include <string>
  4. #include <vector>
  5. #include <mutex>
  6. #include <map>
  7. #include <memory>
  8. #include <tuple>
  9. #include "point.h"
  10. enum DIRECTION_TYPE{
  11. NODIRECTORY = 0,
  12. EAST = 1,
  13. SOURTH = 2,
  14. WEST = 3,
  15. NORTH = 4
  16. };
  17. struct LandmarkInfo:point
  18. {
  19. LandmarkInfo()
  20. :landmark_id(0)
  21. ,landmark_name("")
  22. ,map_id(0)
  23. ,area_id(0)
  24. {}
  25. LandmarkInfo(point &p,int id,std::string & n,int mapid, int areaid)
  26. :point(p)
  27. ,landmark_id(id)
  28. ,landmark_name(n)
  29. ,map_id(mapid)
  30. ,area_id(areaid)
  31. {}
  32. int landmark_id;
  33. std::string landmark_name;
  34. int map_id;
  35. int area_id;
  36. };
  37. struct map_direction
  38. {
  39. map_direction(int mapid,int angle)
  40. :map_id(mapid)
  41. ,north_angle(angle)
  42. {}
  43. int map_id;
  44. int north_angle;
  45. };
  46. struct Landmark_list
  47. {
  48. std::vector<std::shared_ptr<LandmarkInfo>> m_v;
  49. std::map<int,std::shared_ptr<map_direction>> m_map;
  50. static Landmark_list * instance();
  51. void init_from_db();
  52. void init_landmarkInfo(int id = -1);
  53. void remove_landmarkInfo(int id);
  54. void init_mapDirection();
  55. //landmarkId landmark_direction landmark_dis
  56. std::tuple<int,int,double> get(int mapid,int areaid,const point &pt);
  57. DIRECTION_TYPE GetDirectionType(point card_point, point landmark_point, int map_id);
  58. std::mutex m_mutex;
  59. };
  60. #endif