Main Page   Hardware Class Hierarchy   Hardware API     Mapping Class Hierarchy  Mapping API 

drawing_area.h

Go to the documentation of this file.
00001 /*
00002 Object Oriented Mobile Robot Model (OOMRM) C++  Library Copyright (C) 2002-2005  Derek Jones
00003 
00004 This library is free software; you can redistribute it  and/or
00005 modify it under the terms of the GNU Lesser General Public
00006 License  as published by the Free Software Foundation; either
00007 version 2.1 of the  License, or (at your option) any later version.
00008 
00009 This library is  distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY;  without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A  PARTICULAR PURPOSE.  See the GNU
00012 Lesser General Public License for more  details.
00013 
00014 You should have received a copy of the GNU Lesser General  Public
00015 License along with this library; if not, write to the Free  Software
00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   02111-1307  USA
00017 
00018 $Id: drawing_area.h,v 1.6 2007/09/26 05:12:58 derek Exp $ 
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]; // Version number of OOMRM to dsiplay
00055   char fn[80];      // filename of scene file being edited or last opened.
00056   char refresh[2];  // whether scene file has been updated.
00057   bool dirty;       // whether to redisplay label next time.
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 //#include "fl_map.h"
00085 
00091 class Drawing_Area :   public Fl_Box
00092 {
00093 public:
00094 //  friend void OOMRM_Simulator::Rulers_update(void);
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 //  int real_time(int mapx, int mapy, int radius, RADIAN radian);
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 //  static void acquire_map(Star* Amap); //, int ms=60);
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 //  OOMRM_STATIC char scene_fn[];  ///< Filename of scene file to save or open.
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   // top left corner (ix,iy) [screen coordinates] using buffer fill with terrain and 
00150   // draw grid lines.  
00151   // NOTE: only fill with grid lines if lineonly true. i.e., no obstacle.
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;     // number of cards on map.
00160   OOMRM_STATIC OGrid* _rgrid;
00161 //  static Star* _Amap;
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; // internal to idle.
00168   float t1;
00169   OOMRM_STATIC Fl_Tabs* WINDOW_TAB;
00170   OOMRM_STATIC Fl_Group* MAP_GROUP;
00171   OOMRM_STATIC Fl_Group* MAP_WINDOW; // only the map portion.
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 //  OOMRM_STATIC Fl_Group* _diagnostics_group;
00181 //  OOMRM_STATIC Fl_Double_Window* map_window; // moved to OOMRM_Simulator
00182 /*  OOMRM_STATIC Fl_Double_Window* _window;
00183   OOMRM_STATIC oDiagnostics _diag;
00184 */
00185 
00186 };
00187 
00188 #endif

Generated on Mon Oct 8 19:32:18 2007 for OOMRM Mapping API by doxygen1.3