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 <geometry/hom_vector.h>
00028 #include <geometry/hom_point.h>
00029 #include <geometry/hom_pose.h>
00030 #include <map>
00031
00032 namespace fawkes {
00033 class WorldInfoDataContainer;
00034 }
00035
00036 class FieldView : public Gtk::DrawingArea
00037 {
00038 public:
00039 FieldView( fawkes::WorldInfoDataContainer* data,
00040 bool show_pose = true,
00041 bool show_ball = true,
00042 bool show_opponents = false );
00043 virtual ~FieldView();
00044
00045 bool toggle_show_pose( Glib::ustring name );
00046 bool toggle_show_ball( Glib::ustring name );
00047 bool toggle_show_opponents( Glib::ustring name );
00048
00049 void remove_host( Glib::ustring name );
00050
00051 protected:
00052 virtual bool on_expose_event(GdkEventExpose* event);
00053
00054 private:
00055 void draw_field_msl( Cairo::RefPtr<Cairo::Context> context );
00056 void draw_robot( Cairo::RefPtr<Cairo::Context> context,
00057 float x, float y, float ori,
00058 Glib::ustring name );
00059 void draw_obstacle( Cairo::RefPtr<Cairo::Context> context,
00060 float x, float y, float extend );
00061 void draw_ball( Cairo::RefPtr<Cairo::Context> context,
00062 float ball_x, float ball_y, float bot_x, float bot_y );
00063
00064 fawkes::WorldInfoDataContainer* m_data_container;
00065
00066 std::map< Glib::ustring, bool > m_show_pose;
00067 std::map< Glib::ustring, bool > m_show_ball;
00068 std::map< Glib::ustring, bool > m_show_opponents;
00069 bool m_show_pose_default;
00070 bool m_show_ball_default;
00071 bool m_show_opponents_default;
00072 };
00073
00074 #endif