1
0

landmark.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 "write-copy.h"
  10. #include "point.h"
  11. enum DIRECTION_TYPE{
  12. NODIRECTORY = 0,
  13. EAST = 1,
  14. SOURTH = 2,
  15. WEST = 3,
  16. NORTH = 4
  17. };
  18. struct LandmarkInfo:point
  19. {
  20. LandmarkInfo()
  21. :landmark_id(0)
  22. ,landmark_name("")
  23. ,map_id(0)
  24. ,area_id(0)
  25. {}
  26. LandmarkInfo(point &p,int id,std::string & n,int mapid, int areaid)
  27. :point(p)
  28. ,landmark_id(id)
  29. ,landmark_name(n)
  30. ,map_id(mapid)
  31. ,area_id(areaid)
  32. {}
  33. int landmark_id;
  34. std::string landmark_name;
  35. int map_id;
  36. int area_id;
  37. };
  38. struct map_direction
  39. {
  40. map_direction(int mapid,int angle)
  41. :map_id(mapid)
  42. ,north_angle(angle)
  43. {}
  44. int map_id;
  45. int north_angle;
  46. };
  47. struct Landmark_list:single_base<Landmark_list, int, std::shared_ptr<LandmarkInfo>>
  48. {
  49. //std::vector<std::shared_ptr<LandmarkInfo>> m_v;
  50. std::map<int,std::shared_ptr<map_direction>> m_map_direction;
  51. //static Landmark_list * instance();
  52. void init_from_db();
  53. void init_landmarkInfo(int id = -1);
  54. void init_mapDirection();
  55. //landmarkId landmark_direction landmark_dis
  56. std::tuple<int,int,double> get_landmark(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