Fawkes API  Fawkes Development Version
field_view.h
1 
2 /***************************************************************************
3  * field_view.h - Draws the field and the robots on it
4  *
5  * Created: Wed April 09 20:58:20 2008
6  * Copyright 2008 Daniel Beck
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef __TOOL_WORLDINFO_VIEWER_FIELD_VIEW_H_
24 #define __TOOL_WORLDINFO_VIEWER_FIELD_VIEW_H_
25 
26 #include <gtkmm/drawingarea.h>
27 #include <map>
28 
29 namespace fawkes {
30  class WorldInfoDataContainer;
31 }
32 
33 class FieldView : public Gtk::DrawingArea
34 {
35  public:
37  bool show_pose = true,
38  bool show_ball = true,
39  bool show_opponents = false );
40  virtual ~FieldView();
41 
42  bool toggle_show_pose( Glib::ustring name );
43  bool toggle_show_ball( Glib::ustring name );
44  bool toggle_show_opponents( Glib::ustring name );
45 
46  void remove_host( Glib::ustring name );
47 
48  protected:
49  virtual bool on_draw(const Cairo::RefPtr<Cairo::Context> &context);
50 
51  private:
52  void draw_field_msl( Cairo::RefPtr<Cairo::Context> context );
53  void draw_robot( Cairo::RefPtr<Cairo::Context> context,
54  float x, float y, float ori,
55  Glib::ustring name );
56  void draw_obstacle( Cairo::RefPtr<Cairo::Context> context,
57  float x, float y, float extend );
58  void draw_ball( Cairo::RefPtr<Cairo::Context> context,
59  float ball_x, float ball_y, float bot_x, float bot_y );
60 
61  fawkes::WorldInfoDataContainer* m_data_container;
62 
63  std::map< Glib::ustring, bool > m_show_pose;
64  std::map< Glib::ustring, bool > m_show_ball;
65  std::map< Glib::ustring, bool > m_show_opponents;
66  bool m_show_pose_default;
67  bool m_show_ball_default;
68  bool m_show_opponents_default;
69 };
70 
71 #endif /* __TOOL_WORLDINFO_VIEWER_FIELD_VIEW_H_ */
Data container to store and exchange worldinfo data.
Fawkes library namespace.
Drawing widget that draws an (MSL-) soccer field with robots, opponents, and balls.
Definition: field_view.h:33