00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _SIM_MAP_H
00021 #define _SIM_MAP_H
00022 #include <FL/Fl_Scrollbar.H>
00023 #include <FL/Fl.H>
00024 #include <FL/Fl_Box.H>
00025 #include <FL/Fl_Value_Output.H>
00026 #include <FL/Fl_Value_Slider.H>
00027 #include <FL/Fl_Slider.H>
00028 #include <FL/Fl_Window.H>
00029 #include <FL/Fl_Input.H>
00030 #include <FL/Fl_Tabs.H>
00031 #include <pose_chain.h>
00032 #include <FL/Fl_Double_Window.H>
00033 #include <FL/Fl_Counter.H>
00034 #include <FL/Fl_Browser.H>
00035 #include <FL/Fl_Output.H>
00036 #include <FL/Fl_Choice.H>
00037 #include <FL/Fl_Check_Button.H>
00038 #include <FL/Fl_Value_Input.H>
00039 #include <point.h>
00040 #include <host/invariant.h>
00041 #include <host/color.h>
00042 #include <host/importtype.h>
00043 #include <types.h>
00044 #include <host/playback_reader.h>
00045 #define OOMRM_STATIC static
00046 using namespace std;
00047 class Star;
00048 class OGrid;
00049 class Drawing_Window;
00050
00052 struct label_t
00053 {
00054 char version[80];
00055 char fn[80];
00056 char refresh[2];
00057 bool dirty;
00058 };
00059
00060 struct OOMRM_CAMERA_WIDGETS
00061 {
00062 Fl_Value_Slider* exposure;
00063 Fl_Value_Input* horizontal;
00064 Fl_Value_Input* vertical;
00065 Fl_Choice* resolution;
00066 Fl_Choice* color_type;
00067 Fl_Choice* picture_type;
00068 Fl_Choice* snapshot_type;
00069 Fl_Check_Button* snapshot;
00070 };
00071
00072 struct OOMRM_POSITION_WIDGETS
00073 {
00074 Fl_Browser* browser;
00075 Fl_Value_Input* x;
00076 Fl_Value_Input* y;
00077 Fl_Value_Input* angle;
00078 Fl_Value_Input* speed;
00079 Fl_Value_Input* function;
00080 Fl_Input* name;
00081 };
00082
00083
00085
00091 class Drawing_Area : public Fl_Box
00092 {
00093 public:
00094
00095 friend void vs_cb(Fl_Scrollbar* vs, void*);
00096 friend void hs_cb(Fl_Scrollbar* vs, void*);
00097 friend void mapsize_cb(Fl_Counter*, void*);
00098 static void map_reset(short iwidth, short iheight);
00099 Drawing_Area(int x,int y,int w,int h);
00100 OOMRM_STATIC void initialize(void);
00101 int step_through(int mapx, int mapy, int radius, RADIAN radian);
00102
00103 int real_time(int&, int&, float&, int irec);
00104 OOMRM_STATIC void mapsize(int ms);
00105 static int W;
00106 static int H;
00107 static short _map_width;
00108 static short _map_height;
00109
00111 OOMRM_STATIC bool transformxy(int ix, int iy, float& sx, float& sy, float UNIT);
00113 void new_display();
00115 OOMRM_STATIC void circle(int,int,int, CPixel* const, COLOR);
00117 OOMRM_STATIC void line(int cx, int cy, int radius, RADIAN radian,CPixel* const buffer, COLOR color=BLACK);
00119 OOMRM_STATIC void user_updates(short int,short int,int,int);
00121 OOMRM_STATIC void update3x5(const pose_chain& cc);
00123 static void destination(int dx, int dy, int length, RADIAN radian);
00124 void print_path(CPixel* const buffer, int width, int height);
00126 void resize(int,int,int,int);
00128 int idle(int,int,int, RADIAN);
00129 OOMRM_STATIC void Refresh(void);
00130 static float local_unit();
00131
00133
00134 OOMRM_STATIC Fl_Tabs* tabs(void);
00135 OOMRM_STATIC void tabs(Fl_Tabs* o);
00136 OOMRM_STATIC void map(Fl_Group* o);
00137 OOMRM_STATIC Fl_Group* MapTab(void);
00138 OOMRM_STATIC void MapTab(Fl_Group* imap);
00139 OOMRM_STATIC Fl_Group* Map_Window(void);
00140 OOMRM_STATIC bool Resize(void);
00141 OOMRM_STATIC void reload_waypoints(void);
00142 OOMRM_STATIC OOMRM_POSITION_WIDGETS Position;
00143 OOMRM_STATIC OOMRM_CAMERA_WIDGETS Camera_Settings;
00144 OOMRM_STATIC label_t mylabel;
00145 OOMRM_STATIC Fl_Output* response;
00146 OOMRM_STATIC void playback_fn(const char* const fn);
00147 OOMRM_STATIC const char* const playback_fn(void);
00148 private:
00149
00150
00151
00152 void OOMRM_STATIC fill_cell(int ix, int iy,CPixel* const buffer,COLOR terrain, LINETYPE line, float UNIT);
00153 void world_walls(CPixel* const buffer, int width, int height);
00154 void robot_walls(CPixel* const buffer, int width, int height);
00155 void gridlines(CPixel* const buffer);
00156 void draw();
00157 int handle(int);
00158 OOMRM_STATIC point cards[];
00159 OOMRM_STATIC int cardtop;
00160 OOMRM_STATIC OGrid* _rgrid;
00161
00162 static pose _orgin;
00163 static int _travel_distance;
00164 OOMRM_STATIC bool _dirty;
00165 float map_scale_factor;
00166 CPixel* Pbuffer;
00167 float t2;
00168 float t1;
00169 OOMRM_STATIC Fl_Tabs* WINDOW_TAB;
00170 OOMRM_STATIC Fl_Group* MAP_GROUP;
00171 OOMRM_STATIC Fl_Group* MAP_WINDOW;
00172 protected:
00173 static playback_reader _reader;
00174 OOMRM_STATIC float GLOBAL_UNIT;
00175 OOMRM_STATIC float LOCAL_UNIT;
00176 static int startx;
00177 static int starty;
00178
00179
00180
00181
00182
00183
00184
00185
00186 };
00187
00188 #endif