📄 smonitor_dev.h
字号:
/* * Copyright (c) 1999 - 2001, Artur Merke <amerke@ira.uka.de> * * This file is part of FrameView2d. * * FrameView2d is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * FrameView2d is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with FrameView2d; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */#ifndef _SMONITOR_DEV_H_#define _SMONITOR_DEV_H_#include "input_dev.h"#include "rgbcolor.h"#include "udpsocket.h"#include "object2d.h"#include "valueparser.h"#include <vector>#include <cstring>#define MAX_PLAYER 11std::ostream & operator<< (std::ostream & o, const RGBcolor & col);class VisualPlayersViewArea: public VisualObject2d { public: static const int LOW; static const int HIGH; static const int FEEL_RANGE; private: VisualCircleArc2d circlearc1; VisualCircle2d circle; VisualCircleArc2d circlearc2; RGBcolor c_exact; RGBcolor c_fuzzy; int view_quality; double view_width; public: VisualPlayersViewArea(); void init(int my_key, int my_layer, const RGBcolor & my_exact, const RGBcolor & my_fuzzy); virtual ~VisualPlayersViewArea() { } void draw(DisplayBase * disp, const Area2d & area, const Frame2d & p_frame, bool chg); void actualize(const Frame2d& f, bool chg); void set_view_mode( int quality, double width );};class VisualBall: public VisualObject2d { RGBcolor c_ball; RGBcolor c_line_until_ball_stops; RGBcolor c_line_markers; RGBcolor c_font; VisualPoint2d ball_point;; VisualCircle2d ball_circle; VisualCircle2d ball_margin; VisualLine2d line_until_ball_stops; VisualLines2d line_markers; VisualString2d label; Frame2d vel_frame; bool vel_frame_chg; double ball_decay; bool show_vel; bool show_vel_string; bool changed; static const int MAX_LINE_MARKERS_NUM; static const int MAX_LABEL_LEN; public: VisualBall(); void init(int my_key, int my_layer, double my_small_r, double my_large_r, const RGBcolor & my_c_ball, const RGBcolor & my_c_line_until_ball_stops, const RGBcolor & my_c_line_unitl_ball_out_of_field, const RGBcolor & my_c_font); virtual ~VisualBall() {} void draw(DisplayBase * disp, const Area2d & area, const Frame2d & p_frame, bool chg); void actualize(const Frame2d& f, bool chg); void unset_show_vel() { show_vel= false; } void set_show_vel(const Point2d & vel); void unset_show_vel_string() { show_vel_string= false; } void set_show_vel_string(const Point2d & vel); void set_label_pos(const Point2d & p) { label.rel= p; label.changed= true; } void set_ball_decay(double bdecay) { ball_decay= bdecay; //cout << "\nbdecay setting=" << bdecay << flush; }};class VisualPlayer: public VisualObject2d { RGBcolor c_invalid; RGBcolor c_player; RGBcolor c_goalie; RGBcolor c_font; RGBcolor c_black; RGBcolor c_white; RGBcolor c_red; RGBcolor c_blue; RGBcolor c_yellow; RGBcolor c_orange; RGBcolor c_pink; RGBcolor c_olive; VisualCircle2d body_bg; VisualCircle2d body; VisualCircle2d body_margin; VisualCircle2d body_margin_kick; VisualCircle2d body_margin_kick_fault; VisualCircle2d body_margin_tackle; VisualCircle2d body_margin_tackle_fault; VisualCircle2d body_margin_catch_fault; VisualCircle2d body_margin_ball_collision; VisualLine2d body_dir; VisualLine2d head_dir; VisualString2d label; Frame2d head_frame; bool head_frame_chg; bool use_number; bool show_kick; bool show_kick_fault; bool show_tackle; bool show_tackle_fault; bool show_catch_fault; bool ball_collision; bool is_active; bool is_goalie; bool changed; int type; static const int MAX_LABEL_LEN; public: VisualPlayer(); void init(int my_key, int my_layer, char p_char, const RGBcolor & my_c_invalid, const RGBcolor & my_c_player, const RGBcolor & my_c_goalie, const RGBcolor & my_c_font); virtual ~VisualPlayer() {} void draw(DisplayBase * disp, const Area2d & area, const Frame2d & p_frame, bool chg); void actualize(const Frame2d& f, bool chg); void set_type(int type); void set_head_angle( const Angle & a); void set_active(bool flag= true); void set_label(const char * lab); ///< copies the content of lab into his own label void set_use_number(bool flag= true) { use_number= flag; label.changed= true; } void set_goalie(bool flag= true); void set_kicking(bool flag= true) { show_kick= flag; } void set_kicking_fault( bool flag = true ) { show_kick_fault = flag; } void set_tackling( bool flag = true ) { show_tackle = flag; } void set_tackling_fault( bool flag = true ) { show_tackle_fault = flag; } void set_catching_fault( bool flag = true ) { show_catch_fault = flag; } void set_ball_collision( bool flag= true ) { ball_collision= flag; } void set_low_stamina_indicator(bool flag= true) { body.filled= flag; } void set_label_pos(const Point2d & p) { label.rel= p; label.changed= true; }};class VisualField: public VisualObject2d { static const double FIELD_LENGTH; static const double FIELD_WIDTH; //static const double FIELD_MARGIN; static const double FIELD_CENTER_CIRCLE_R; static const double FIELD_PENALTY_AREA_LENGTH; static const double FIELD_PENALTY_AREA_WIDTH; static const double FIELD_GOAL_AREA_LENGTH; static const double FIELD_GOAL_AREA_WIDTH; static const double FIELD_GOAL_WIDTH; static const double FIELD_GOAL_DEPTH; static const double FIELD_PENALTY_SPOT_DIST; static const double FIELD_CORNER_ARC_R; //static const double FIELD_CORNER_KICK_MARGIN; static const double HLEN; static const double HWID; static const double PEN_X; static const double PEN_Y; static const double GOAL_X; static const double GOAL_Y; static const double GPOST_RAD; RGBcolor c_line; RGBcolor c_goal; RGBcolor c_black; RGBcolor c_white; RGBcolor c_red; VisualPoints2d points; VisualLines2d lines; VisualCircleArcs2d circlearcs; VisualPolygon2d goal_l; VisualPolygon2d goal_r; VisualPolygon2d vertical_stripe; VisualCircles2d goal_posts; bool keepaway; double keepaway_length; double keepaway_width; VisualPolygon2d keep_area; bool changed; public: VisualField(); void init(int my_key, int my_layer, const RGBcolor & my_c_line, const RGBcolor & my_c_goal, bool my_keepaway, double my_keepaway_length, double my_keepaway_width); virtual ~VisualField() {} void draw(DisplayBase * disp, const Area2d & area, const Frame2d & p_frame, bool chg); void actualize(const Frame2d& f, bool chg); void set_goal_width(double width); void use_vertical_stripe(bool flag= true) { vertical_stripe.visible= flag; } void set_vertical_stripe(double x1, double x2) { vertical_stripe.changed= true; vertical_stripe.rel.tab[0].x= x1; vertical_stripe.rel.tab[1].x= x2; vertical_stripe.rel.tab[2].x= x2; vertical_stripe.rel.tab[3].x= x1; }};class SMonitorDevice: public InputDevice { UDPsocket server; //UDPsocket coach; bool timeover; enum { BUFFER_MAX_SIZE= 8192, STRING_MAX_SIZE= 512, }; char buffer1[BUFFER_MAX_SIZE]; char buffer2[BUFFER_MAX_SIZE]; static const int frame_canvas_left; static const int frame_canvas_right; static const int frame_ball; static const int frame_varea; static const int frame_shadow; static const int BUTTON_START; static const int BUTTON_RECONNECT; static const int BUTTON_SCALE_LEVEL; static const int BUTTON_INFO_LEVEL; static const int BUTTON_MODE; static const int BUTTON_UNZOOM;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -