field_view.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __TOOL_WORLDINFO_VIEWER_FIELD_VIEW_H_
00024 #define __TOOL_WORLDINFO_VIEWER_FIELD_VIEW_H_
00025
00026 #include <gtkmm/drawingarea.h>
00027 #include <map>
00028
00029 namespace fawkes {
00030 class WorldInfoDataContainer;
00031 }
00032
00033 class FieldView : public Gtk::DrawingArea
00034 {
00035 public:
00036 FieldView( fawkes::WorldInfoDataContainer* data,
00037 bool show_pose = true,
00038 bool show_ball = true,
00039 bool show_opponents = false );
00040 virtual ~FieldView();
00041
00042 bool toggle_show_pose( Glib::ustring name );
00043 bool toggle_show_ball( Glib::ustring name );
00044 bool toggle_show_opponents( Glib::ustring name );
00045
00046 void remove_host( Glib::ustring name );
00047
00048 protected:
00049 virtual bool on_expose_event(GdkEventExpose* event);
00050
00051 private:
00052 void draw_field_msl( Cairo::RefPtr<Cairo::Context> context );
00053 void draw_robot( Cairo::RefPtr<Cairo::Context> context,
00054 float x, float y, float ori,
00055 Glib::ustring name );
00056 void draw_obstacle( Cairo::RefPtr<Cairo::Context> context,
00057 float x, float y, float extend );
00058 void draw_ball( Cairo::RefPtr<Cairo::Context> context,
00059 float ball_x, float ball_y, float bot_x, float bot_y );
00060
00061 fawkes::WorldInfoDataContainer* m_data_container;
00062
00063 std::map< Glib::ustring, bool > m_show_pose;
00064 std::map< Glib::ustring, bool > m_show_ball;
00065 std::map< Glib::ustring, bool > m_show_opponents;
00066 bool m_show_pose_default;
00067 bool m_show_ball_default;
00068 bool m_show_opponents_default;
00069 };
00070
00071 #endif