00001 // Copyright (C) 2007 University of Louisiana at Lafayette 00002 // Authors: Daro Eghagha 00003 00004 #ifndef CAJUN_DRAW_MAP_H 00005 #define CAJUN_DRAW_MAP_H 00006 00007 #include <list> 00008 00009 #include "conf.H" 00010 #include "map_view.H" 00011 00012 #include "component_interface.H" 00013 00014 #ifdef VR_JUGGLER 00015 #include <vrj/Draw/OGL/GlContextData.h> 00016 #endif 00017 00018 namespace cajun 00019 { 00020 #define MAX_TEXTURES 50 00021 class draw_map_t: public component_interface_t 00022 { 00023 public: 00024 draw_map_t (double cbviz_origin[3], conf_t &conf, 00025 const char *geotiff_dir_, world_state_t *ws_, 00026 rndf_t const *rndf_); 00027 virtual ~draw_map_t(); 00028 void dynamic_data (); 00029 void update_data (double bot_pos_[3]); 00030 void display(double bot_pos[3]); 00031 void toggle_display (); 00032 void move_map_x (int dir); 00033 void move_map_y (int dir); 00034 private: 00035 struct tfw_data_t // hold data from tfw file format 00036 { 00037 tfw_data_t () : is_loaded (false) {} 00038 std::string filename; 00039 double res_x;//x resolution 00040 double res_y;//negative of y resolution 00041 double utm_x, utm_y;// top left utm coord 00042 bool is_loaded; 00043 }; 00044 00045 bool load_map_buffer (double bot_pos[3]); 00046 bool load_map_texture (); 00047 std::list<tfw_data_t>::iterator find_tile (double bot_pos[3]); 00048 void find_geotiffs (const char *geotiff_dir_); 00049 void index_geotiff (char *filename); 00050 00051 std::list <tfw_data_t> m_tfw_data; 00052 00053 struct map_info_t 00054 { 00055 #ifdef VR_JUGGLER 00056 vrj::GlContextData <GLuint> m_texture; 00057 #else 00058 GLuint m_texture; 00059 #endif 00060 bool m_loaded; 00061 double m_top_left_x; 00062 double m_top_left_y; 00063 double m_bottom_right_x; 00064 double m_bottom_right_y; 00065 double m_offset_y; 00066 double m_offset_x; 00067 }; 00068 00069 map_info_t m_map_info[MAX_TEXTURES]; 00070 00071 map_view_t m_map; 00072 00073 int m_num_tiles; 00074 double m_cbviz_origin[3]; 00075 double m_off_x; 00076 double m_off_y; 00077 }; 00078 }; 00079 #endif