Fawkes API Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * field_view.h - Draws the field and the robots on it 00004 * 00005 * Created: Wed April 09 20:58:20 2008 00006 * Copyright 2008 Daniel Beck 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * Read the full text in the LICENSE.GPL file in the doc directory. 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 /* __TOOL_WORLDINFO_VIEWER_FIELD_VIEW_H_ */