├── .github └── workflows │ └── main.yml ├── .gitignore ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── NEWS ├── README.md ├── bootstrap ├── cmake-config.h.in ├── configure.ac ├── icons ├── accelerate.xpm ├── blank.xpm ├── decelerate.xpm ├── ff.xpm ├── go.xpm ├── live.xpm ├── minus.xpm ├── next_score.xpm ├── open.xpm ├── play.xpm ├── plus.xpm ├── prev_score.xpm ├── quit.xpm ├── rcss.icns ├── rcss.ico ├── rcss.xpm ├── rec.xpm ├── rev.xpm ├── rew.xpm └── stop.xpm ├── m4 ├── ax_boost_base.m4 ├── ax_boost_program_options.m4 ├── ax_boost_system.m4 ├── ax_check_zlib.m4 ├── ax_cxx_compile_stdcxx.m4 ├── ax_cxx_compile_stdcxx_14.m4 ├── ax_cxx_compile_stdcxx_17.m4 ├── ax_have_qt.m4 └── qt.m4 ├── rcss ├── CMakeLists.txt ├── Makefile.am └── rcg │ ├── CMakeLists.txt │ ├── Makefile.am │ ├── handler.cpp │ ├── handler.h │ ├── nlohmann │ └── json.hpp │ ├── parser.cpp │ ├── parser.h │ ├── parser_simdjson.cpp │ ├── parser_simdjson.h │ ├── parser_v1.cpp │ ├── parser_v1.h │ ├── parser_v2.cpp │ ├── parser_v2.h │ ├── parser_v3.cpp │ ├── parser_v3.h │ ├── parser_v4.cpp │ ├── parser_v4.h │ ├── simdjson │ ├── LICENSE │ ├── simdjson.cpp │ └── simdjson.h │ ├── types.cpp │ ├── types.h │ ├── util.cpp │ └── util.h ├── rcssmonitor.pro ├── src ├── CMakeLists.txt ├── Makefile.am ├── angle_deg.cpp ├── angle_deg.h ├── ball_painter.cpp ├── ball_painter.h ├── circle_2d.cpp ├── circle_2d.h ├── config_dialog.cpp ├── config_dialog.h ├── disp_holder.cpp ├── disp_holder.h ├── draw_info_painter.cpp ├── draw_info_painter.h ├── field_canvas.cpp ├── field_canvas.h ├── field_painter.cpp ├── field_painter.h ├── gzfstream.cpp ├── gzfstream.h ├── line_2d.cpp ├── line_2d.h ├── log_player.cpp ├── log_player.h ├── log_player_slider.cpp ├── log_player_slider.h ├── main.cpp ├── main_window.cpp ├── main_window.h ├── monitor_client.cpp ├── monitor_client.h ├── mouse_state.h ├── options.cpp ├── options.h ├── painter_interface.h ├── player_painter.cpp ├── player_painter.h ├── player_type_dialog.cpp ├── player_type_dialog.h ├── rcg_handler.cpp ├── rcg_handler.h ├── rcsslogplayer │ ├── gzfstream.cpp │ ├── gzfstream.h │ ├── handler.h │ ├── parser.cpp │ ├── parser.h │ ├── rcsslogplayer.pro │ ├── types.cpp │ ├── types.h │ ├── util.cpp │ └── util.h ├── rcssmonitor.rc ├── score_board_painter.cpp ├── score_board_painter.h ├── src.pro ├── team_graphic.cpp ├── team_graphic.h ├── team_graphic_painter.cpp ├── team_graphic_painter.h ├── vector_2d.cpp └── vector_2d.h └── utils └── appimage ├── Dockerfile.builder-2004 ├── build_appimage.sh ├── build_code.sh ├── create_release_note.py ├── docker-entrypoint.sh ├── rcssmonitor.desktop └── rcssmonitor.png /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: 4 | push: 5 | branches: 6 | - "*" 7 | tags: 8 | - "*" 9 | 10 | 11 | env: 12 | release-prefix: "rcssmonitor-" 13 | 14 | 15 | jobs: 16 | app-image: 17 | runs-on: ubuntu-latest 18 | name: Build AppImage 19 | steps: 20 | - uses: actions/checkout@v4 21 | 22 | - name: Create release folder 23 | run: | 24 | mkdir -p ${{ github.workspace }}/artifact 25 | 26 | - name: Find CMakeLists.txt version 27 | id: cmake_version 28 | run: | 29 | cmake_version=$(grep -oP 'project\(.* VERSION \K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt) 30 | echo "version=${cmake_version}" >> $GITHUB_OUTPUT 31 | 32 | - name: Create builder-image 33 | run: | 34 | docker build -t builder-image:2004 -f ./utils/appimage/Dockerfile.builder-2004 . 35 | 36 | 37 | # ------------------------------------------- Ubuntu 20.04 AppImage 38 | - name: Build app image on 20.04 39 | run: | 40 | docker run --privileged --name builder-2004 builder-image:2004 /rcssmonitor/utils/appimage/docker-entrypoint.sh 41 | 42 | docker cp builder-2004:/rcssmonitor/build/rcssmonitor-x86_64.AppImage \ 43 | ${{ github.workspace }}/artifact/rcssmonitor-${{ steps.cmake_version.outputs.version }}-x86_64.AppImage 44 | 45 | # ------------------------------------------- Artifact 46 | - name: Upload Artifact 47 | uses: actions/upload-artifact@v4 48 | with: 49 | name: rcssmonitor-x86_64 50 | path: ${{ github.workspace }}/artifact/* 51 | retention-days: 5 52 | 53 | - name: Check if there is no release with the same tag 54 | id: check_release 55 | run: | 56 | out=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ steps.cmake_version.outputs.version }}) 57 | echo "release_exists=${out}" >> $GITHUB_OUTPUT 58 | 59 | - name: Create release note 60 | if : ${{ steps.check_release.outputs.release_exists == '404' }} 61 | run: | 62 | export GITHUB_REPOSITORY=${{ github.repository }} 63 | python utils/appimage/create_release_note.py 64 | cp release_note.md ${{ github.workspace }}/artifact/release_note 65 | 66 | 67 | # ------------------------------------------- Release 68 | - name: Create Release 69 | if: ${{ steps.check_release.outputs.release_exists == '404' }} 70 | id: create_release 71 | uses: ncipollo/release-action@v1 72 | with: 73 | artifacts: "${{ github.workspace }}/artifact/rcssmonitor-${{ steps.cmake_version.outputs.version }}-x86_64.AppImage" 74 | token: ${{ secrets.GITHUB_TOKEN }} 75 | bodyFile: "${{ github.workspace }}/artifact/release_note" 76 | name: "${{ env.release-prefix }}${{ steps.cmake_version.outputs.version }}" 77 | tag: ${{ steps.cmake_version.outputs.version }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | build/ -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | The RoboCup Soccer Simulator Maintenance Committee 2 | https://github.com/rcsoccersim 3 | 4 | Please send bugs to 5 | https://github.com/rcsoccersim/rcssmonitor/issues 6 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | project(rcssmonitor VERSION 19.0.1) 4 | 5 | if(CMAKE_VERSION VERSION_LESS "3.7.0") 6 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 7 | endif() 8 | 9 | # compiler options 10 | set(CMAKE_CXX_STANDARD 17) 11 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 12 | 13 | if(NOT CMAKE_BUILD_TYPE) 14 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) 15 | endif() 16 | 17 | include(GNUInstallDirs) 18 | 19 | # check header files 20 | include(CheckIncludeFileCXX) 21 | if(WIN32) 22 | check_include_file("windows.h" HAVE_WINDOWS_H) 23 | endif() 24 | check_include_file_cxx("arpa/inet.h" HAVE_ARPA_INET_H) 25 | 26 | # check boost 27 | #find_package(Boost 1.38.0 COMPONENTS program_options system REQUIRED) 28 | #if(Boost_PROGRAM_OPTIONS_FOUND) 29 | # set(HAVE_BOOST_PROGRAM_OPTIONS TRUE) 30 | #endif() 31 | 32 | # check Qt 33 | find_package(Qt5 COMPONENTS Core Gui Widgets Network REQUIRED) 34 | if(NOT Qt5_FOUND) 35 | message(FATAL_ERROR "Qt5 not found!") 36 | endif() 37 | 38 | set(CMAKE_AUTOMOC ON) 39 | 40 | # check zlib 41 | find_package(ZLIB) 42 | if(ZLIB_FOUND) 43 | set(HAVE_LIBZ TRUE) 44 | endif() 45 | 46 | 47 | # generate config.h 48 | add_definitions(-DHAVE_CONFIG_H) 49 | configure_file( 50 | ${PROJECT_SOURCE_DIR}/cmake-config.h.in 51 | ${PROJECT_BINARY_DIR}/config.h 52 | ) 53 | 54 | # 55 | add_subdirectory(rcss) 56 | add_subdirectory(src) 57 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS=-I m4 2 | 3 | SUBDIRS = rcss src . 4 | 5 | EXTRA_DIST = \ 6 | README.md \ 7 | CMakeLists.txt \ 8 | cmake-config.h.in \ 9 | icons/accelerate.xpm \ 10 | icons/blank.xpm \ 11 | icons/decelerate.xpm \ 12 | icons/ff.xpm \ 13 | icons/go.xpm \ 14 | icons/live.xpm \ 15 | icons/minus.xpm \ 16 | icons/next_score.xpm \ 17 | icons/open.xpm \ 18 | icons/play.xpm \ 19 | icons/plus.xpm \ 20 | icons/prev_score.xpm \ 21 | icons/quit.xpm \ 22 | icons/rcss.icns \ 23 | icons/rcss.ico \ 24 | icons/rcss.xpm \ 25 | icons/rec.xpm \ 26 | icons/rev.xpm \ 27 | icons/rew.xpm \ 28 | icons/stop.xpm 29 | 30 | CLEANFILES = *~ 31 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | [19.0.1] 2 | * Fix defects in text drawing. 3 | 4 | [19.0.0] 5 | * Support new server parameters. 6 | 7 | * Reimplement a rcg parser library. A faster JSON parser is now 8 | avaiable. 9 | 10 | * Fix warnings that occur with Qt-5.15 11 | 12 | [18.0.0] 13 | * Support the changes of JSON-based protocol. To use the JSON-based 14 | monitor protocol, -1 is required for client-version. 15 | 16 | * Support the monitor protocol version 5 (RCG version 6). 17 | 18 | * Add options to draw the selected player's focus point. 19 | 20 | [17.0.0] 21 | * Remove dependency on Boost library. 22 | 23 | * Support the monitor protocol version 5 (RCG version 6), which is a 24 | JSON-based format. The parser implemented at this time is quite 25 | slow, so the default client version is set to the previous one. 26 | 27 | * Reimplement the RCG parser library. The installation destination 28 | of the library header files has been unified under PREFIX/include/rcss. 29 | 30 | [16.1.0] 31 | * Add a team graphic scaling option. Now, users can change the drawing 32 | scale of team graphic images. 33 | 34 | [16.0.0] 35 | * Support new server specifications, illegal defense and fixed 36 | teamname. The monitor visualize the state of illegal defense 37 | detection by emphasizing detected players. Both fixed team name 38 | and real team name are displayed on the score board. 39 | 40 | * Integrate a log player feature. Now, rcssmonitor can be used 41 | instead of rcsslogplayer. The user can open a game log file(.rcg) 42 | from GUI menu or the command line option. 43 | 44 | * Add a time shift replay feature. Now, rcssmonitor can replay the 45 | simulation during the game without disconnecting from rcssserver. 46 | 47 | * Remove the buffering mode feature. 48 | 49 | * Change the default tool kit to Qt5. Qt4 is still available, but 50 | depricated. 51 | 52 | * Support CMake. 53 | 54 | [15.2.1] 55 | * Fix a defect of Qt detection on Ubuntu 16.04. 56 | 57 | [15.2.0] 58 | * Update m4 macro files for boost. 59 | 60 | [15.1.1] 61 | * Fixed a locale bug. Thanks go to Sándor Nagy for reporting the 62 | detail and providing the patch. 63 | 64 | [15.1.0] 65 | * Fixed a defect of boost detection by updating autoconf macros. 66 | 67 | [15.0.0] 68 | * Supported new parameters of rcssserver-15.0.0. 69 | 70 | [14.1.1] 71 | * Disabled QtOpenGL by default. 72 | 73 | [14.1.0] 74 | * Added new command line options, "--auto-reconnect-mode" and 75 | "--auto-reconnect-wait". When auto-reconnect-mode is on, rcssmonitor 76 | will try to reconnect to rcssserver if rcssserver does not send 77 | information for auto-reconnect-wait(default:5) seconds. Note that 78 | auto-reconnect-mode overwrites auto-quit-mode. If 79 | auto-reconnect-mode is on, auto-quit-mode is always disabled. 80 | 81 | * Some parameters are renamed in '~/.rcssmonitor.conf'. It is highly 82 | recommended to delete the existing configuration file and 83 | regenerate new one. 84 | 85 | * Changed the policy of configuration file. Now, 'MainWindow' and 86 | 'Monitor' sections in '~/.rcssmonitor.conf' are not updated by 87 | rcssmonitor. Users have to edit these values manually or set by 88 | command line options every time. 89 | 90 | [14.0.1] 91 | * Changed the buffer recovering policy. Now, rcssmonitor tries to 92 | recover the buffer until filling up the default buffer size 93 | without advancing game status if the buffer becomes empty in 94 | the buffering mode. 95 | 96 | * Added a simple animation to show the buffer recovering status. 97 | 98 | * Fixed defects of default option value. 99 | 100 | * Fixed a bug of the red card action. 101 | 102 | [14.0.0] 103 | * Reimplemented rcssmonitor using Qt4. Please note that Qt 4.3.0 104 | or later is required to build the new monitor. The new monitor 105 | supports the qmake build system. If you have troubles with 106 | Makefile generated by the configure script, please try 107 | 'qmake && make'. 108 | 109 | * Supported QtOpenGL which render the data onto QGLWidget. If the 110 | performance is drastically decreased, please try 111 | `./configure --disable-gl' to disable QtOpenGL. 112 | 113 | * Supported Windows environment. 114 | 115 | * Supported new features in rcssserver version 14: 116 | - yellow/red card status. 117 | - new catch model. 118 | - foul success probability. 119 | - new heterogeneous parameters. 120 | 121 | * Supported buffering mode. Now, rcssmonitor can buffer packets from 122 | rcssserver and display them later. This feature will be useful 123 | under slow networks. But, note that rcssmonitor is still connected 124 | to rcssserver with UDP/IP connection. So, the buffering mode may 125 | not work successfully under unstable networks. This problem will 126 | be solved if TCP/IP is supported in the future version simulator. 127 | 128 | To enable buffering mode, you need to invoce rcssmonitor with the 129 | following option: 130 | 131 | $ rcssmonitor --buffering-mode on 132 | 133 | If you want to change the cache size(default value: 10), you need 134 | to add '--buffer-size' option to the command line: 135 | 136 | $ rcssmonitor --buffering-mode on --buffer-size 100 137 | 138 | * Added new interfaces for human referee: 139 | - playmode control. 140 | - yellow/red cards. 141 | 142 | * Almost all settings are written in ~/.rcssmonitor.conf (in Windows 143 | environment, this file is located under the working folder) with INI 144 | format. You can modify settings by editing this file. 145 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RoboCup Soccer Simulator Monitor 2 | [![GitHub license](https://img.shields.io/github/license/rcsoccersim/rcssmonitor)](https://github.com/rcsoccersim/rcssmonitor/blob/master/COPYING) 3 | 4 | ![Logo](https://user-images.githubusercontent.com/1832537/49242985-f69a3c00-f3ea-11e8-97f5-9b0bfdfc4e1c.png) 5 | 6 | **RoboCup Soccer Simulator Monitor** (rcssmonitor) is used to view the simulation as it takes place by connecting to the [RoboCup Soccer Simulator Server](https://github.com/rcsoccersim/rcssserver) (rcssserver) or to view the playback of a simulation by loading game log files. 7 | 8 | ## :soccer: Quick Start 9 | 10 | rcssmonitor is implemented by C++14 and depends [Qt5](https://www.qt.io/). At first, related tools have to be installed on the system. In the case of Ubuntu 22.04, execute the following command: 11 | ```bash 12 | sudo apt install build-essential automake autoconf libtool libboost-all-dev qtbase5-dev qt5-qmake libfontconfig1-dev libaudio-dev libxt-dev libglib2.0-dev libxi-dev libxrender-dev 13 | ``` 14 | In the case of Ubuntu 16.04 - 20.04, execute the following command: 15 | ```bash 16 | sudo apt install build-essential qt5-default libfontconfig1-dev libaudio-dev libxt-dev libglib2.0-dev libxi-dev libxrender-dev 17 | ``` 18 | 19 | Then, clone the repository. From its directory, execute commands: 20 | 21 | ```bash 22 | ./bootstrap 23 | ./configure 24 | make 25 | ``` 26 | 27 | Alternatively you can download the tarball from the [releases section](https://github.com/rcsoccersim/rcssmonitor/releases), extract it and run from its contents: 28 | 29 | ```bash 30 | tar xzvfp rcssmonitor-x.x.x.tar.gz 31 | cd rcssmonitor-x.x.x 32 | ./configure 33 | make 34 | ``` 35 | 36 | This will built the necessary binaries to get you up and running. `rcssmonitor/src/rcssmonitor` will be the binary for the monitor. 37 | 38 | The version 16.0.0 or later support [CMake](https://cmake.org/). If CMake is prefered or problems with the above procedure, try the following commands: 39 | 40 | ```bash 41 | mkdir build 42 | cd build 43 | cmake .. 44 | make 45 | ``` 46 | 47 | In this case, `rcssmonitor/build/rcssmonitor` will be the binary for the monitor. 48 | 49 | 50 | ## :hammer_and_wrench: Configuring & Building 51 | 52 | Before building rcssmonitor you will need to run the `configure` script located in the root of the distribution directory. 53 | 54 | The default configuration will set up to install the monitor components in the following location: 55 | 56 | `/usr/local/bin` for the executables 57 | 58 | You may need administrator privileges to install the monitor into the default location. This locations can be modified by using configure's `--prefix=DIR` and related options. See `configure --help` for more details. 59 | ```bash 60 | ./configure --prefix=YOUR_INSTALLATION_DIR 61 | ``` 62 | 63 | The monitor has several features that can be enabled or disabled at configure time by using the `--enable-FEATURE[=ARG]` or `--disable-FEATURE` parameters to `configure`. `--disable-FEATURE` is equivalent to `--enable-FEATURE=no` and `--enable-FEATURE` is equivlant to `--enable-FEATURE=yes`. The only valid values for `ARG` are `yes` and `no`. 64 | 65 | Once you have successfully configured the monitor, simply run `make` to build the sources. 66 | 67 | If CMake is chosen, `ccmake` command is available for the configuration: 68 | 69 | ```bash 70 | cd build 71 | ccmake .. 72 | ``` 73 | 74 | ## :package: Installing 75 | 76 | When you have completed building the monitor, it's components can be installed into their default locations or the locations specified during configuring by running 77 | ```bash 78 | make install 79 | ``` 80 | Depending on where you are installing the monitor, you may need special permissions. 81 | 82 | If you install the monitor under the location you specified, you may need to set the environment variable `PATH`. 83 | Otherwise, you have to enter the full path to the executable when you execute the monitor. 84 | In the case of Linux system, the recommended way is to add the following line at the bottom of `~/.profile`: 85 | ``` 86 | PATH="YOUR_INSTALLATION_DIR/bin:$PATH" 87 | ``` 88 | Then, log out and log in again. 89 | 90 | You may also need to set the library path before executing the monitor. 91 | In most Linux systems, you can modify the library path by editing `/etc/ld.so.conf` or the environment variable `LD_LIBRARY_PATH`. 92 | The recommended way is to use `LD_LIBRARY_PATH` because all users can edit this variable without extra privileges. 93 | Add the following line at the bottom of `~/.bashrc`: 94 | ``` 95 | LD_LIBRARY_PATH="YOUR_INSTALLATION_DIR/lib:$LD_LIBRARY_PATH" 96 | export LD_LIBRARY_PATH 97 | ``` 98 | Then, open a new terminal. 99 | 100 | ## :wastebasket: Uninstalling 101 | In the case of autotools, the monitor can also be easily removed by entering the distribution directory and running 102 | ```bash 103 | make uninstall 104 | ``` 105 | This will remove all the files that where installed, but not any directories that were created during the installation process. 106 | 107 | In the case of CMake, find `install_manifest.txt` under the build directory, then execute: 108 | ```bash 109 | xargs rm < install_manifest.txt 110 | ``` 111 | 112 | 113 | ## :play_or_pause_button: Using the Monitor 114 | 115 | To start the monitor either type 116 | 117 | ```bash 118 | ./rcssmonitor 119 | ``` 120 | 121 | from the directory containing the executable or 122 | 123 | ```bash 124 | rcssmonitor 125 | ``` 126 | 127 | If you invoke `rcssmonitor` with `--help` option, available options are displayed in your console. 128 | 129 | ## :incoming_envelope: Contributing 130 | 131 | For bug reports, feature requests and latest updates, please goto 132 | https://github.com/rcsoccersim/rcssmonitor and open an issue or a pull request. 133 | 134 | > The RoboCup Soccer Server Maintainance Group 135 | -------------------------------------------------------------------------------- /bootstrap: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | autoreconf -i -f 4 | -------------------------------------------------------------------------------- /cmake-config.h.in: -------------------------------------------------------------------------------- 1 | 2 | #define PACKAGE_NAME "rcssmonitor" 3 | 4 | #define VERSION "@rcssmonitor_VERSION@" 5 | 6 | #cmakedefine HAVE_LIBZ 7 | 8 | #cmakedefine HAVE_WINDOWS_H 9 | 10 | #cmakedefine HAVE_ARPA_INET_H 11 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | # -*- Autoconf -*- 2 | # Process this file with autoconf to produce a configure script. 3 | 4 | AC_PREREQ(2.61) 5 | AC_INIT([rcssmonitor],[19.0.1],[https://github.com/rcsoccersim/rcssmonitor]) 6 | 7 | #LT_PREREQ(2.2.4) 8 | 9 | #AM_INIT_AUTOMAKE([gnu 1.7.2 check-news dist-bzip2 dist-zip]) 10 | AM_INIT_AUTOMAKE([gnu 1.7.2 check-news foreign]) 11 | AC_CONFIG_SRCDIR([config.h.in]) 12 | AC_CONFIG_HEADERS([config.h]) 13 | AC_CONFIG_MACRO_DIR([m4]) 14 | 15 | ################################################## 16 | # libtool settings 17 | ################################################## 18 | 19 | LT_INIT([shared disable-static]) 20 | LT_LANG([C++]) 21 | AC_SUBST(LIBTOOL_DEPS) 22 | 23 | ################################################## 24 | # Checks for programs. 25 | ################################################## 26 | 27 | AC_PROG_CC 28 | AC_PROG_CPP 29 | AC_PROG_CXX 30 | 31 | ################################################## 32 | # Checks for libraries. 33 | ################################################## 34 | 35 | AC_CHECK_LIB([m], [cos], 36 | [LIBS="-lm $LIBS"], 37 | [AC_MSG_ERROR([*** -lm not found! ***])]) 38 | #AC_CHECK_LIB([z], [deflate]) 39 | AX_CHECK_ZLIB([], 40 | [AC_MSG_NOTICE(Zlib not found.)]) 41 | 42 | 43 | ################################################## 44 | # Checks for header files. 45 | ################################################## 46 | 47 | AC_CHECK_HEADERS([arpa/inet.h], 48 | break, 49 | [AC_MSG_ERROR([*** arpa/inet.h not found ***])]) 50 | 51 | ################################################## 52 | # Checks for typedefs, structures, and compiler characteristics. 53 | ################################################## 54 | 55 | AC_HEADER_STDBOOL 56 | AC_C_INLINE 57 | AC_C_CONST 58 | AC_TYPE_INT16_T 59 | AC_TYPE_INT32_T 60 | AC_TYPE_SIZE_T 61 | AC_HEADER_TIME 62 | AC_TYPE_UINT16_T 63 | AC_TYPE_UINT32_T 64 | 65 | ################################################## 66 | # Checks for library functions. 67 | ################################################## 68 | 69 | AC_FUNC_ERROR_AT_LINE 70 | AC_CHECK_FUNCS([memset rint strtol pow sqrt]) 71 | 72 | # ---------------------------------------------------------- 73 | # check Qt 74 | 75 | AX_HAVE_QT 76 | if test "x$have_qt" != "xyes"; then 77 | AC_MSG_ERROR([Qt not found.]) 78 | fi 79 | 80 | # ---------------------------------------------------------- 81 | # check C++ 82 | 83 | AX_CXX_COMPILE_STDCXX_17(noext) 84 | 85 | # ---------------------------------------------------------- 86 | # check boost 87 | 88 | #AX_BOOST_BASE([1.38.0]) 89 | #AX_BOOST_SYSTEM 90 | #AX_BOOST_PROGRAM_OPTIONS 91 | #CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" 92 | #LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" 93 | 94 | # ---------------------------------------------------------- 95 | AC_CONFIG_FILES([Makefile 96 | rcss/Makefile 97 | rcss/rcg/Makefile 98 | src/Makefile]) 99 | AC_OUTPUT 100 | -------------------------------------------------------------------------------- /icons/accelerate.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * accelerate_xpm[] = { 3 | "16 16 3 1", 4 | " c None", 5 | ". c #000000", 6 | "+ c #808080", 7 | " ", 8 | " ", 9 | " . ", 10 | " . ", 11 | " ..... ", 12 | " . ", 13 | " . . ", 14 | " ..+ ", 15 | " ....+ ", 16 | " .....+ ", 17 | " .......+ ", 18 | " .........+ ", 19 | " .........+ ", 20 | " ++++++++ ", 21 | " ", 22 | " "}; 23 | -------------------------------------------------------------------------------- /icons/blank.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * blank_xpm[] = { 3 | "16 16 2 1", 4 | " c #000000", 5 | ". c #FFFFFF", 6 | "................", 7 | "................", 8 | "... ... ......", 9 | ".... ... .....", 10 | " . ... . ", 11 | " .. ... . ", 12 | " . ... . ", 13 | " . ... . ", 14 | " . ... . ", 15 | " . ... . ", 16 | " . ... . ", 17 | " . ... . ", 18 | "..... ... ....", 19 | "...... ... ...", 20 | "................", 21 | "................"}; 22 | -------------------------------------------------------------------------------- /icons/decelerate.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * decelerate_xpm[] = { 3 | "16 16 3 1", 4 | " c None", 5 | ". c #000000", 6 | "+ c #808080", 7 | " ", 8 | " ", 9 | " ", 10 | " ", 11 | " .........+ ", 12 | " .........+ ", 13 | " .......+ ", 14 | " .....+ ", 15 | " ...+ ", 16 | " .+ ", 17 | " ", 18 | " ", 19 | " ..... ", 20 | " ", 21 | " ", 22 | " "}; 23 | -------------------------------------------------------------------------------- /icons/ff.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * ff_xpm[] = { 3 | "16 16 2 1", 4 | " c #000000", 5 | ". c #FFFFFF", 6 | "................", 7 | ". .. .......", 8 | ".. .. ......", 9 | "... .. .....", 10 | ".... .. ....", 11 | "..... .. ...", 12 | "...... .. ..", 13 | "....... .. .", 14 | "...... .. ..", 15 | "..... .. ...", 16 | ".... .. ....", 17 | "... .. .....", 18 | ".. .. ......", 19 | ". .. .......", 20 | "................", 21 | "................"}; 22 | -------------------------------------------------------------------------------- /icons/go.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * go_xpm[] = { 3 | "16 16 2 1", 4 | " c #000000", 5 | ". c #FFFFFF", 6 | "................", 7 | "................", 8 | "................", 9 | "................", 10 | ". . .. ..", 11 | " ... . .. .", 12 | " ... . .... ", 13 | " ... . .... ", 14 | ". .. .... ", 15 | " ....... .. .", 16 | ". ... ..", 17 | " .... ........", 18 | " .... ........", 19 | ". .........", 20 | "................", 21 | "................"}; 22 | -------------------------------------------------------------------------------- /icons/live.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * live_xpm[] = { 3 | "16 16 2 1", 4 | " c None", 5 | ". c #000000", 6 | " ", 7 | " ", 8 | " ", 9 | ".. .. .. .. ...", 10 | ".. .. .. .. ...", 11 | ".. .. .. .. . ", 12 | ".. .. .. .. . ", 13 | ".. .. .. .. ...", 14 | ".. .. .. .. ...", 15 | ".. .. ... . ", 16 | ".. .. ... . ", 17 | "... .. ... ...", 18 | "... .. . ...", 19 | " ", 20 | " ", 21 | " "}; 22 | -------------------------------------------------------------------------------- /icons/minus.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * minus_xpm[] = { 3 | "16 16 2 1", 4 | " c #000000", 5 | ". c #FFFFFF", 6 | "................", 7 | "...... .. . .", 8 | "..... .. . .", 9 | ".... ... . .", 10 | "... .... . .", 11 | ".. ..... . .", 12 | ". ...... . .", 13 | " ....... . .", 14 | ". ...... . .", 15 | ".. ..... . .", 16 | "... .... . .", 17 | ".... ... . .", 18 | "..... .. . .", 19 | "...... .. . .", 20 | "................", 21 | "................"}; 22 | -------------------------------------------------------------------------------- /icons/next_score.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * next_score_xpm[] = { 3 | "16 16 4 1", 4 | " c None", 5 | ". c #FFFFFF", 6 | "+ c #000000", 7 | "@ c #808080", 8 | "................", 9 | "................", 10 | "................", 11 | ".++.......+++.+.", 12 | ".+++.....++@@++@", 13 | ".++++...++@..@+@", 14 | ".+++++..++@...@@", 15 | ".++++++.++@.....", 16 | ".+++++@.++@.++++", 17 | ".++++@..++@..++@", 18 | ".+++@...@++..++@", 19 | ".++@.....@++++@.", 20 | ".@@.......@@@@..", 21 | "................", 22 | "................", 23 | "................"}; 24 | -------------------------------------------------------------------------------- /icons/open.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char *open_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 5 1", 5 | " c None", 6 | ". c Black", 7 | "X c Yellow", 8 | "o c Gray100", 9 | "O c #bfbf00", 10 | /* pixels */ 11 | " ", 12 | " ... ", 13 | " . . .", 14 | " ..", 15 | " ... ...", 16 | " .XoX....... ", 17 | " .oXoXoXoXo. ", 18 | " .XoXoXoXoX. ", 19 | " .oXoX..........", 20 | " .XoX.OOOOOOOOO.", 21 | " .oo.OOOOOOOOO. ", 22 | " .X.OOOOOOOOO. ", 23 | " ..OOOOOOOOO. ", 24 | " ........... ", 25 | " " 26 | }; 27 | -------------------------------------------------------------------------------- /icons/play.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * play_xpm[] = { 3 | "16 16 2 1", 4 | " c #000000", 5 | ". c #FFFFFF", 6 | "................", 7 | "..... ........", 8 | "..... .......", 9 | "..... ......", 10 | "..... .....", 11 | "..... ....", 12 | "..... ...", 13 | "..... ..", 14 | "..... ...", 15 | "..... ....", 16 | "..... .....", 17 | "..... ......", 18 | "..... .......", 19 | "..... ........", 20 | "................", 21 | "................"}; 22 | -------------------------------------------------------------------------------- /icons/plus.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * plus_xpm[] = { 3 | "16 16 2 1", 4 | " c #000000", 5 | ". c #FFFFFF", 6 | "................", 7 | ". . .. ......", 8 | ". . .. .....", 9 | ". . ... ....", 10 | ". . .... ...", 11 | ". . ..... ..", 12 | ". . ...... .", 13 | ". . ....... ", 14 | ". . ...... .", 15 | ". . ..... ..", 16 | ". . .... ...", 17 | ". . ... ....", 18 | ". . .. .....", 19 | ". . .. ......", 20 | "................", 21 | "................"}; 22 | -------------------------------------------------------------------------------- /icons/prev_score.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * prev_score_xpm[] = { 3 | "16 16 4 1", 4 | " c None", 5 | ". c #FFFFFF", 6 | "+ c #000000", 7 | "@ c #808080", 8 | "................", 9 | "................", 10 | "................", 11 | "....++@...+++.+.", 12 | "...+++@..++@@++@", 13 | "..++++@.++@..@+@", 14 | ".+++++@.++@...@@", 15 | "++++++@.++@.....", 16 | ".+++++@.++@.++++", 17 | "..++++@.++@..++@", 18 | "...+++@.@++..++@", 19 | "....++@..@++++@.", 20 | "....@@@...@@@@..", 21 | "................", 22 | "................", 23 | "................"}; 24 | -------------------------------------------------------------------------------- /icons/quit.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * quit_xpm[] = { 3 | "16 16 2 1", 4 | " c #000000", 5 | ". c #FFFFFF", 6 | "................", 7 | "................", 8 | "................", 9 | "................", 10 | "................", 11 | ".. ..", 12 | ".. ..", 13 | ".. ..", 14 | ".. ..", 15 | ".. ..", 16 | ".. ..", 17 | "................", 18 | "................", 19 | "................", 20 | "................", 21 | "................"}; 22 | -------------------------------------------------------------------------------- /icons/rcss.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rcsoccersim/rcssmonitor/42848cdee2cb230cd215ec9875dc06aa31f99aa9/icons/rcss.icns -------------------------------------------------------------------------------- /icons/rcss.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rcsoccersim/rcssmonitor/42848cdee2cb230cd215ec9875dc06aa31f99aa9/icons/rcss.ico -------------------------------------------------------------------------------- /icons/rec.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * rec_xpm[] = { 3 | "16 16 2 1", 4 | " c None", 5 | ". c #FF0000", 6 | " ", 7 | " ", 8 | " ", 9 | " . ", 10 | " ....... ", 11 | " ......... ", 12 | " ......... ", 13 | " ........... ", 14 | " ........... ", 15 | " ........... ", 16 | " ......... ", 17 | " ......... ", 18 | " ....... ", 19 | " . ", 20 | " ", 21 | " "}; 22 | -------------------------------------------------------------------------------- /icons/rev.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * rev_xpm[] = { 3 | "16 16 2 1", 4 | " c #000000", 5 | ". c #FFFFFF", 6 | "................", 7 | "........ .....", 8 | "....... .....", 9 | "...... .....", 10 | "..... .....", 11 | ".... .....", 12 | "... .....", 13 | ".. .....", 14 | "... .....", 15 | ".... .....", 16 | "..... .....", 17 | "...... .....", 18 | "....... .....", 19 | "........ .....", 20 | "................", 21 | "................"}; 22 | -------------------------------------------------------------------------------- /icons/rew.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * rew_xpm[] = { 3 | "16 16 2 1", 4 | " c #000000", 5 | ". c #FFFFFF", 6 | "................", 7 | "....... .. .", 8 | "...... .. ..", 9 | "..... .. ...", 10 | ".... .. ....", 11 | "... .. .....", 12 | ".. .. ......", 13 | ". .. .......", 14 | ".. .. ......", 15 | "... .. .....", 16 | ".... .. ....", 17 | "..... .. ...", 18 | "...... .. ..", 19 | "....... .. .", 20 | "................", 21 | "................"}; 22 | -------------------------------------------------------------------------------- /icons/stop.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * stop_xpm[] = { 3 | "16 16 2 1", 4 | " c #000000", 5 | ". c #FFFFFF", 6 | "................", 7 | "................", 8 | "................", 9 | "... ...", 10 | "... ...", 11 | "... ...... ...", 12 | "... ...... ...", 13 | "... ...... ...", 14 | "... ...... ...", 15 | "... ...... ...", 16 | "... ...... ...", 17 | "... ...", 18 | "... ...", 19 | "................", 20 | "................", 21 | "................"}; 22 | -------------------------------------------------------------------------------- /m4/ax_boost_program_options.m4: -------------------------------------------------------------------------------- 1 | # ============================================================================= 2 | # https://www.gnu.org/software/autoconf-archive/ax_boost_program_options.html 3 | # ============================================================================= 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_BOOST_PROGRAM_OPTIONS 8 | # 9 | # DESCRIPTION 10 | # 11 | # Test for program options library from the Boost C++ libraries. The macro 12 | # requires a preceding call to AX_BOOST_BASE. Further documentation is 13 | # available at . 14 | # 15 | # This macro calls: 16 | # 17 | # AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) 18 | # 19 | # And sets: 20 | # 21 | # HAVE_BOOST_PROGRAM_OPTIONS 22 | # 23 | # LICENSE 24 | # 25 | # Copyright (c) 2009 Thomas Porschberg 26 | # 27 | # Copying and distribution of this file, with or without modification, are 28 | # permitted in any medium without royalty provided the copyright notice 29 | # and this notice are preserved. This file is offered as-is, without any 30 | # warranty. 31 | 32 | #serial 26 33 | 34 | AC_DEFUN([AX_BOOST_PROGRAM_OPTIONS], 35 | [ 36 | AC_ARG_WITH([boost-program-options], 37 | AS_HELP_STRING([--with-boost-program-options@<:@=special-lib@:>@], 38 | [use the program options library from boost - it is possible to specify a certain library for the linker 39 | e.g. --with-boost-program-options=boost_program_options-gcc-mt-1_33_1 ]), 40 | [ 41 | if test "$withval" = "no"; then 42 | want_boost="no" 43 | elif test "$withval" = "yes"; then 44 | want_boost="yes" 45 | ax_boost_user_program_options_lib="" 46 | else 47 | want_boost="yes" 48 | ax_boost_user_program_options_lib="$withval" 49 | fi 50 | ], 51 | [want_boost="yes"] 52 | ) 53 | 54 | if test "x$want_boost" = "xyes"; then 55 | AC_REQUIRE([AC_PROG_CC]) 56 | export want_boost 57 | CPPFLAGS_SAVED="$CPPFLAGS" 58 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" 59 | export CPPFLAGS 60 | LDFLAGS_SAVED="$LDFLAGS" 61 | LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" 62 | export LDFLAGS 63 | AC_CACHE_CHECK([whether the Boost::Program_Options library is available], 64 | ax_cv_boost_program_options, 65 | [AC_LANG_PUSH(C++) 66 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include 67 | ]], 68 | [[boost::program_options::error err("Error message"); 69 | return 0;]])], 70 | ax_cv_boost_program_options=yes, ax_cv_boost_program_options=no) 71 | AC_LANG_POP([C++]) 72 | ]) 73 | if test "$ax_cv_boost_program_options" = yes; then 74 | AC_DEFINE(HAVE_BOOST_PROGRAM_OPTIONS,,[define if the Boost::PROGRAM_OPTIONS library is available]) 75 | BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` 76 | if test "x$ax_boost_user_program_options_lib" = "x"; then 77 | for libextension in `ls $BOOSTLIBDIR/libboost_program_options*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.dylib* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.dylib.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.a.*$;\1;'` ; do 78 | ax_lib=${libextension} 79 | AC_CHECK_LIB($ax_lib, exit, 80 | [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], 81 | [link_program_options="no"]) 82 | done 83 | if test "x$link_program_options" != "xyes"; then 84 | for libextension in `ls $BOOSTLIBDIR/boost_program_options*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_program_options.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/boost_program_options*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_program_options.*\)\.a.*$;\1;'` ; do 85 | ax_lib=${libextension} 86 | AC_CHECK_LIB($ax_lib, exit, 87 | [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], 88 | [link_program_options="no"]) 89 | done 90 | fi 91 | else 92 | for ax_lib in $ax_boost_user_program_options_lib boost_program_options-$ax_boost_user_program_options_lib; do 93 | AC_CHECK_LIB($ax_lib, main, 94 | [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], 95 | [link_program_options="no"]) 96 | done 97 | fi 98 | if test "x$ax_lib" = "x"; then 99 | AC_MSG_ERROR(Could not find a version of the Boost::Program_Options library!) 100 | fi 101 | if test "x$link_program_options" != "xyes"; then 102 | AC_MSG_ERROR([Could not link against [$ax_lib] !]) 103 | fi 104 | fi 105 | CPPFLAGS="$CPPFLAGS_SAVED" 106 | LDFLAGS="$LDFLAGS_SAVED" 107 | fi 108 | ]) 109 | -------------------------------------------------------------------------------- /m4/ax_boost_system.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_boost_system.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_BOOST_SYSTEM 8 | # 9 | # DESCRIPTION 10 | # 11 | # Test for System library from the Boost C++ libraries. The macro requires 12 | # a preceding call to AX_BOOST_BASE. Further documentation is available at 13 | # . 14 | # 15 | # This macro calls: 16 | # 17 | # AC_SUBST(BOOST_SYSTEM_LIB) 18 | # 19 | # And sets: 20 | # 21 | # HAVE_BOOST_SYSTEM 22 | # 23 | # LICENSE 24 | # 25 | # Copyright (c) 2008 Thomas Porschberg 26 | # Copyright (c) 2008 Michael Tindal 27 | # Copyright (c) 2008 Daniel Casimiro 28 | # 29 | # Copying and distribution of this file, with or without modification, are 30 | # permitted in any medium without royalty provided the copyright notice 31 | # and this notice are preserved. This file is offered as-is, without any 32 | # warranty. 33 | 34 | #serial 20 35 | 36 | AC_DEFUN([AX_BOOST_SYSTEM], 37 | [ 38 | AC_ARG_WITH([boost-system], 39 | AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@], 40 | [use the System library from boost - it is possible to specify a certain library for the linker 41 | e.g. --with-boost-system=boost_system-gcc-mt ]), 42 | [ 43 | if test "$withval" = "no"; then 44 | want_boost="no" 45 | elif test "$withval" = "yes"; then 46 | want_boost="yes" 47 | ax_boost_user_system_lib="" 48 | else 49 | want_boost="yes" 50 | ax_boost_user_system_lib="$withval" 51 | fi 52 | ], 53 | [want_boost="yes"] 54 | ) 55 | 56 | if test "x$want_boost" = "xyes"; then 57 | AC_REQUIRE([AC_PROG_CC]) 58 | AC_REQUIRE([AC_CANONICAL_BUILD]) 59 | CPPFLAGS_SAVED="$CPPFLAGS" 60 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" 61 | export CPPFLAGS 62 | 63 | LDFLAGS_SAVED="$LDFLAGS" 64 | LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" 65 | export LDFLAGS 66 | 67 | AC_CACHE_CHECK(whether the Boost::System library is available, 68 | ax_cv_boost_system, 69 | [AC_LANG_PUSH([C++]) 70 | CXXFLAGS_SAVE=$CXXFLAGS 71 | CXXFLAGS= 72 | 73 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], 74 | [[boost::system::error_category *a = 0;]])], 75 | ax_cv_boost_system=yes, ax_cv_boost_system=no) 76 | CXXFLAGS=$CXXFLAGS_SAVE 77 | AC_LANG_POP([C++]) 78 | ]) 79 | if test "x$ax_cv_boost_system" = "xyes"; then 80 | AC_SUBST(BOOST_CPPFLAGS) 81 | 82 | AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available]) 83 | BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` 84 | 85 | LDFLAGS_SAVE=$LDFLAGS 86 | if test "x$ax_boost_user_system_lib" = "x"; then 87 | for libextension in `ls -r $BOOSTLIBDIR/libboost_system* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do 88 | ax_lib=${libextension} 89 | AC_CHECK_LIB($ax_lib, exit, 90 | [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], 91 | [link_system="no"]) 92 | done 93 | if test "x$link_system" != "xyes"; then 94 | for libextension in `ls -r $BOOSTLIBDIR/boost_system* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do 95 | ax_lib=${libextension} 96 | AC_CHECK_LIB($ax_lib, exit, 97 | [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], 98 | [link_system="no"]) 99 | done 100 | fi 101 | 102 | else 103 | for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do 104 | AC_CHECK_LIB($ax_lib, exit, 105 | [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], 106 | [link_system="no"]) 107 | done 108 | 109 | fi 110 | if test "x$ax_lib" = "x"; then 111 | AC_MSG_ERROR(Could not find a version of the Boost::System library!) 112 | fi 113 | if test "x$link_system" = "xno"; then 114 | AC_MSG_ERROR(Could not link against $ax_lib !) 115 | fi 116 | fi 117 | 118 | CPPFLAGS="$CPPFLAGS_SAVED" 119 | LDFLAGS="$LDFLAGS_SAVED" 120 | fi 121 | ]) 122 | -------------------------------------------------------------------------------- /m4/ax_check_zlib.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_check_zlib.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CHECK_ZLIB([action-if-found], [action-if-not-found]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # This macro searches for an installed zlib library. If nothing was 12 | # specified when calling configure, it searches first in /usr/local and 13 | # then in /usr, /opt/local and /sw. If the --with-zlib=DIR is specified, 14 | # it will try to find it in DIR/include/zlib.h and DIR/lib/libz.a. If 15 | # --without-zlib is specified, the library is not searched at all. 16 | # 17 | # If either the header file (zlib.h) or the library (libz) is not found, 18 | # shell commands 'action-if-not-found' is run. If 'action-if-not-found' is 19 | # not specified, the configuration exits on error, asking for a valid zlib 20 | # installation directory or --without-zlib. 21 | # 22 | # If both header file and library are found, shell commands 23 | # 'action-if-found' is run. If 'action-if-found' is not specified, the 24 | # default action appends '-I${ZLIB_HOME}/include' to CPFLAGS, appends 25 | # '-L$ZLIB_HOME}/lib' to LDFLAGS, prepends '-lz' to LIBS, and calls 26 | # AC_DEFINE(HAVE_LIBZ). You should use autoheader to include a definition 27 | # for this symbol in a config.h file. Sample usage in a C/C++ source is as 28 | # follows: 29 | # 30 | # #ifdef HAVE_LIBZ 31 | # #include 32 | # #endif /* HAVE_LIBZ */ 33 | # 34 | # LICENSE 35 | # 36 | # Copyright (c) 2008 Loic Dachary 37 | # Copyright (c) 2010 Bastien Chevreux 38 | # 39 | # This program is free software; you can redistribute it and/or modify it 40 | # under the terms of the GNU General Public License as published by the 41 | # Free Software Foundation; either version 2 of the License, or (at your 42 | # option) any later version. 43 | # 44 | # This program is distributed in the hope that it will be useful, but 45 | # WITHOUT ANY WARRANTY; without even the implied warranty of 46 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 47 | # Public License for more details. 48 | # 49 | # You should have received a copy of the GNU General Public License along 50 | # with this program. If not, see . 51 | # 52 | # As a special exception, the respective Autoconf Macro's copyright owner 53 | # gives unlimited permission to copy, distribute and modify the configure 54 | # scripts that are the output of Autoconf when processing the Macro. You 55 | # need not follow the terms of the GNU General Public License when using 56 | # or distributing such scripts, even though portions of the text of the 57 | # Macro appear in them. The GNU General Public License (GPL) does govern 58 | # all other use of the material that constitutes the Autoconf Macro. 59 | # 60 | # This special exception to the GPL applies to versions of the Autoconf 61 | # Macro released by the Autoconf Archive. When you make and distribute a 62 | # modified version of the Autoconf Macro, you may extend this special 63 | # exception to the GPL to apply to your modified version as well. 64 | 65 | #serial 16 66 | 67 | AU_ALIAS([CHECK_ZLIB], [AX_CHECK_ZLIB]) 68 | AC_DEFUN([AX_CHECK_ZLIB], 69 | # 70 | # Handle user hints 71 | # 72 | [AC_MSG_CHECKING(if zlib is wanted) 73 | zlib_places="/usr/local /usr /opt/local /sw" 74 | AC_ARG_WITH([zlib], 75 | [ --with-zlib=DIR root directory path of zlib installation @<:@defaults to 76 | /usr/local or /usr if not found in /usr/local@:>@ 77 | --without-zlib to disable zlib usage completely], 78 | [if test "$withval" != no ; then 79 | AC_MSG_RESULT(yes) 80 | if test -d "$withval" 81 | then 82 | zlib_places="$withval $zlib_places" 83 | else 84 | AC_MSG_WARN([Sorry, $withval does not exist, checking usual places]) 85 | fi 86 | else 87 | zlib_places= 88 | AC_MSG_RESULT(no) 89 | fi], 90 | [AC_MSG_RESULT(yes)]) 91 | 92 | # 93 | # Locate zlib, if wanted 94 | # 95 | if test -n "${zlib_places}" 96 | then 97 | # check the user supplied or any other more or less 'standard' place: 98 | # Most UNIX systems : /usr/local and /usr 99 | # MacPorts / Fink on OSX : /opt/local respectively /sw 100 | for ZLIB_HOME in ${zlib_places} ; do 101 | if test -f "${ZLIB_HOME}/include/zlib.h"; then break; fi 102 | ZLIB_HOME="" 103 | done 104 | 105 | ZLIB_OLD_LDFLAGS=$LDFLAGS 106 | ZLIB_OLD_CPPFLAGS=$CPPFLAGS 107 | if test -n "${ZLIB_HOME}"; then 108 | LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib" 109 | CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include" 110 | fi 111 | AC_LANG_PUSH([C]) 112 | AC_CHECK_LIB([z], [inflateEnd], [zlib_cv_libz=yes], [zlib_cv_libz=no]) 113 | AC_CHECK_HEADER([zlib.h], [zlib_cv_zlib_h=yes], [zlib_cv_zlib_h=no]) 114 | AC_LANG_POP([C]) 115 | if test "$zlib_cv_libz" = "yes" && test "$zlib_cv_zlib_h" = "yes" 116 | then 117 | # 118 | # If both library and header were found, action-if-found 119 | # 120 | m4_ifblank([$1],[ 121 | CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include" 122 | LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib" 123 | LIBS="-lz $LIBS" 124 | AC_DEFINE([HAVE_LIBZ], [1], 125 | [Define to 1 if you have `z' library (-lz)]) 126 | ],[ 127 | # Restore variables 128 | LDFLAGS="$ZLIB_OLD_LDFLAGS" 129 | CPPFLAGS="$ZLIB_OLD_CPPFLAGS" 130 | $1 131 | ]) 132 | else 133 | # 134 | # If either header or library was not found, action-if-not-found 135 | # 136 | m4_default([$2],[ 137 | AC_MSG_ERROR([either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib]) 138 | ]) 139 | fi 140 | fi 141 | ]) 142 | -------------------------------------------------------------------------------- /m4/ax_cxx_compile_stdcxx_14.m4: -------------------------------------------------------------------------------- 1 | # ============================================================================= 2 | # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html 3 | # ============================================================================= 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CXX_COMPILE_STDCXX_14([ext|noext], [mandatory|optional]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check for baseline language coverage in the compiler for the C++14 12 | # standard; if necessary, add switches to CXX and CXXCPP to enable 13 | # support. 14 | # 15 | # This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX 16 | # macro with the version set to C++14. The two optional arguments are 17 | # forwarded literally as the second and third argument respectively. 18 | # Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for 19 | # more information. If you want to use this macro, you also need to 20 | # download the ax_cxx_compile_stdcxx.m4 file. 21 | # 22 | # LICENSE 23 | # 24 | # Copyright (c) 2015 Moritz Klammler 25 | # 26 | # Copying and distribution of this file, with or without modification, are 27 | # permitted in any medium without royalty provided the copyright notice 28 | # and this notice are preserved. This file is offered as-is, without any 29 | # warranty. 30 | 31 | #serial 5 32 | 33 | AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) 34 | AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [AX_CXX_COMPILE_STDCXX([14], [$1], [$2])]) 35 | -------------------------------------------------------------------------------- /m4/ax_cxx_compile_stdcxx_17.m4: -------------------------------------------------------------------------------- 1 | # ============================================================================= 2 | # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_17.html 3 | # ============================================================================= 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CXX_COMPILE_STDCXX_17([ext|noext], [mandatory|optional]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check for baseline language coverage in the compiler for the C++17 12 | # standard; if necessary, add switches to CXX and CXXCPP to enable 13 | # support. 14 | # 15 | # This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX 16 | # macro with the version set to C++17. The two optional arguments are 17 | # forwarded literally as the second and third argument respectively. 18 | # Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for 19 | # more information. If you want to use this macro, you also need to 20 | # download the ax_cxx_compile_stdcxx.m4 file. 21 | # 22 | # LICENSE 23 | # 24 | # Copyright (c) 2015 Moritz Klammler 25 | # Copyright (c) 2016 Krzesimir Nowak 26 | # 27 | # Copying and distribution of this file, with or without modification, are 28 | # permitted in any medium without royalty provided the copyright notice 29 | # and this notice are preserved. This file is offered as-is, without any 30 | # warranty. 31 | 32 | #serial 2 33 | 34 | AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) 35 | AC_DEFUN([AX_CXX_COMPILE_STDCXX_17], [AX_CXX_COMPILE_STDCXX([17], [$1], [$2])]) 36 | -------------------------------------------------------------------------------- /m4/qt.m4: -------------------------------------------------------------------------------- 1 | 2 | # SYNOPSIS 3 | # 4 | # AX_QT [--with-qt-moc=PATH] 5 | # 6 | # DESCRIPTION 7 | # 8 | # The following shell variable is set to either "yes" or "no": 9 | # 10 | # have_qt 11 | # 12 | # Additionally, the following variables are exported: 13 | # 14 | # QT_CFLAGS 15 | # QT_CXXFLAGS 16 | # QT_LDFLAGS 17 | # QT_LDADD 18 | # QT_MOC 19 | # 20 | 21 | AC_DEFUN([AX_QT], 22 | [ 23 | AC_REQUIRE([AC_PROG_CXX]) 24 | AC_REQUIRE([AC_PATH_X]) 25 | AC_REQUIRE([AC_PATH_XTRA]) 26 | 27 | QT_REQUIRED_VERSION=ifelse([$1], ,5.0.0,$1) 28 | QT_REQUIRED_MODULES=ifelse([$2], ,Qt5Core,"$2") 29 | 30 | QT_MAJOR_VERSION=`echo $QT_REQUIRED_VERSION | cut -d . -f 1` 31 | 32 | AC_MSG_NOTICE([set QT_REQUIRED_VERSION... $QT_REQUIRED_VERSION]) 33 | AC_MSG_NOTICE([set QT_MAJOR_VERSION... $QT_MAJOR_VERSION]) 34 | AC_MSG_NOTICE([set QT_REQUIRED_MODULES... $QT_REQUIRED_MODULES]) 35 | 36 | 37 | 38 | # if "x$QT_REQUIRED_MODULES" = "x" ; then 39 | # AC_MSG_ERROR([No Qt modules]) 40 | # fi 41 | 42 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) 43 | if test "x$PKG_CONFIG" = "xno"; then 44 | AC_MSG_ERROR(You have to install pkg-config to compile $PACKAGENAME-$VERSION.) 45 | fi 46 | 47 | for mod in $QT_REQUIRED_MODULES ; do 48 | AC_MSG_NOTICE(check $mod >= $QT_REQUIRED_VERSION) 49 | PKG_CHECK_MODULES(QT, 50 | $mod >= $QT_REQUIRED_VERSION, 51 | have_qt="yes", 52 | have_qt="no") 53 | if test "$have_qt" = "no"; then 54 | AC_MSG_ERROR( 55 | [The $mod library >= [$QT_REQUIRED_VERSION] could not be found.]) 56 | fi 57 | done 58 | 59 | QT_CFLAGS=$($PKG_CONFIG --cflags $QT_REQUIRED_MODULES) 60 | QT_CXXFLAGS="$QT_CFLAGS" 61 | QT_CPPFLAGS="" 62 | QT_LDFLAGS=$($PKG_CONFIG --static --libs-only-L $QT_REQUIRED_MODULES) 63 | QT_LDADD="$($PKG_CONFIG --static --libs-only-other $QT_REQUIRED_MODULES) $($PKG_CONFIG --static --libs-only-l $QT_REQUIRED_MODULES)" 64 | AC_MSG_NOTICE([set QT_CXXFLAGS... $QT_CXXFLAGS]) 65 | AC_MSG_NOTICE([set QT_LDFLAGS... $QT_LDFLAGS]) 66 | AC_MSG_NOTICE([set QT_LDADD... $QT_LDADD]) 67 | AC_SUBST(QT_CFLAGS) 68 | AC_SUBST(QT_CXXFLAGS) 69 | AC_SUBST(QT_CPPFLAGS) 70 | AC_SUBST(QT_LDFLAGS) 71 | AC_SUBST(QT_LDADD) 72 | 73 | # check the path to moc 74 | QT_MOC="" 75 | 76 | AC_ARG_WITH([qt-moc], 77 | [ --with-qt-moc=PATH Qt's moc utilitiy to be used (optional)]) 78 | 79 | if test x$with_qt_moc != x && test -x "$with_qt_moc" ; then 80 | QT_MOC="$with_qt_moc" 81 | else 82 | AC_CHECK_PROG(QT_MOC, [moc], [moc]) 83 | # mocmajorversion=`$QT_MOC -v 2>&1 | sed -r 's/^.*([0-9]+)\.[0-9]+\.[0-9]+.*$/\1/'` 84 | echo $mocmajorversion 2>&1 | sed -r 's/^.*([0-9]+)\.[0-9]+\.[0-9]+.*$/\1/' 85 | mocversion=`$QT_MOC -v 2>&1` 86 | mocversiongrep=`echo $mocversion | grep -E "Qt $QT_MAJOR_VERSION|moc $QT_MAJOR_VERSION"` 87 | # echo "mocversion $mocversion" 88 | # echo "mocversiongrep $mocversiongrep" 89 | 90 | if test x"$mocversiongrep" != x"$mocversion"; then 91 | AC_CHECK_TOOL(QTCHOOSER, [qtchooser]) 92 | QT_TOOLDIR=`qtchooser -qt=$QT_MAJOR_VERSION -print-env | grep QTTOOLDIR | cut -d '=' -f 2 | cut -d \" -f 2` 93 | QT_MOC="$QT_TOOLDIR/moc" 94 | mocversion=`$QT_MOC -v 2>&1` 95 | mocversiongrep=`echo $mocversion | grep -E "Qt $QT_MAJOR_VERSION|moc $QT_MAJOR_VERSION"` 96 | if test x"$mocversiongrep" != x"$mocversion" ; then 97 | QT_MOC="" 98 | fi 99 | fi 100 | fi 101 | 102 | if test x$QT_MOC = x ; then 103 | have_qt=no 104 | AC_MSG_ERROR([You need to specify the path to Qt's moc command.]) 105 | fi 106 | 107 | AC_MSG_NOTICE([set QT_MOC... $QT_MOC]) 108 | AC_SUBST(QT_MOC) 109 | ]) 110 | -------------------------------------------------------------------------------- /rcss/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_subdirectory(rcg) 3 | -------------------------------------------------------------------------------- /rcss/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | SUBDIRS = rcg . 3 | 4 | EXTRA_DIST = \ 5 | CMakeLists.txt 6 | 7 | CLEANFILES = *~ 8 | -------------------------------------------------------------------------------- /rcss/rcg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_library(rcssrcg SHARED 3 | simdjson/simdjson.cpp 4 | handler.cpp 5 | parser.cpp 6 | parser_v1.cpp 7 | parser_v2.cpp 8 | parser_v3.cpp 9 | parser_v4.cpp 10 | parser_simdjson.cpp 11 | util.cpp 12 | types.cpp 13 | ) 14 | 15 | target_include_directories(rcssrcg 16 | PUBLIC 17 | # ${Boost_INCLUDE_DIRS} 18 | PRIVATE 19 | ${PROJECT_SOURCE_DIR} 20 | ${PROJECT_BINARY_DIR} 21 | ) 22 | 23 | target_compile_options(rcssrcg 24 | PRIVATE 25 | -W -Wall 26 | ) 27 | 28 | 29 | set_target_properties(rcssrcg PROPERTIES 30 | VERSION 19.0.0 31 | SOVERSION 18 32 | ) 33 | 34 | install(TARGETS rcssrcg LIBRARY 35 | DESTINATION ${CMAKE_INSTALL_LIBDIR} 36 | COMPONENT Libraries 37 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE 38 | ) 39 | 40 | install(FILES 41 | handler.h 42 | parser.h 43 | parser_v1.h 44 | parser_v2.h 45 | parser_v3.h 46 | parser_v4.h 47 | parser_simdjson.h 48 | types.h 49 | util.h 50 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rcss/rcg 51 | ) 52 | -------------------------------------------------------------------------------- /rcss/rcg/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | AUTOMAKE_OPTIONS = subdir-objects 4 | 5 | lib_LTLIBRARIES = librcssrcg.la 6 | 7 | librcssrcg_la_SOURCES = \ 8 | simdjson/simdjson.cpp \ 9 | handler.cpp \ 10 | parser.cpp \ 11 | parser_v1.cpp \ 12 | parser_v2.cpp \ 13 | parser_v3.cpp \ 14 | parser_v4.cpp \ 15 | parser_simdjson.cpp \ 16 | types.cpp \ 17 | util.cpp 18 | 19 | librcssrcgincludedir = $(includedir)/rcss/rcg 20 | 21 | #pkginclude_HEADERS 22 | librcssrcginclude_HEADERS = \ 23 | handler.h \ 24 | parser.h \ 25 | parser_v1.h \ 26 | parser_v2.h \ 27 | parser_v3.h \ 28 | parser_v4.h \ 29 | parser_simdjson.h \ 30 | types.h \ 31 | util.h 32 | 33 | noinst_HEADERS = \ 34 | simdjson/simdjson.h 35 | 36 | librcssrcg_la_LDFLAGS = -version-info 19:0:0 37 | #libXXXX_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) 38 | # 1. Start with version information of `0:0:0' for each libtool library. 39 | # 40 | # 2. Update the version information only immediately before a public 41 | # release of your software. More frequent updates are unnecessary, 42 | # and only guarantee that the current interface number gets larger 43 | # faster. 44 | # 45 | # 3. If the library source code has changed at all since the last 46 | # update, then increment REVISION (`C:R:A' becomes `C:r+1:A'). 47 | # 48 | # 4. If any interfaces have been added, removed, or changed since the 49 | # last update, increment CURRENT, and set REVISION to 0. 50 | # 51 | # 5. If any interfaces have been added since the last public release, 52 | # then increment AGE. 53 | # 54 | # 6. If any interfaces have been removed since the last public release, 55 | # then set AGE to 0. 56 | 57 | AM_CPPFLAGS = -I$(top_srcdir) 58 | AM_CFLAGS = -Wall -W 59 | AM_CXXFLAGS = -Wall -W 60 | AM_LDFLAGS = 61 | 62 | EXTRA_DIST = \ 63 | CMakeLists.txt 64 | 65 | CLEANFILES = *~ 66 | -------------------------------------------------------------------------------- /rcss/rcg/handler.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file handler.cpp 5 | \brief rcg data handler Source File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa AKIYAMA 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 3 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifdef HAVE_CONFIG_H 33 | #include 34 | #endif 35 | 36 | #include "handler.h" 37 | 38 | #include "util.h" 39 | 40 | #ifdef HAVE_ARPA_INET_H 41 | #include 42 | #endif 43 | #ifdef HAVE_WINDOWS_H 44 | #include 45 | #endif 46 | 47 | #include 48 | 49 | namespace rcss { 50 | namespace rcg { 51 | 52 | /*-------------------------------------------------------------------*/ 53 | /*! 54 | 55 | */ 56 | Handler::Handler() 57 | : M_log_version( 0 ), 58 | M_read_time( 0 ) 59 | { 60 | 61 | } 62 | 63 | /*-------------------------------------------------------------------*/ 64 | /*! 65 | 66 | */ 67 | Handler::~Handler() 68 | { 69 | 70 | } 71 | 72 | /*-------------------------------------------------------------------*/ 73 | /*! 74 | 75 | */ 76 | bool 77 | Handler::handleDispInfo( const dispinfo_t & dinfo ) 78 | { 79 | handleLogVersion( REC_VERSION_2 ); 80 | 81 | switch ( ntohs( dinfo.mode ) ) { 82 | case SHOW_MODE: 83 | return handleShowInfo( dinfo.body.show ); 84 | break; 85 | case MSG_MODE: 86 | return handleMsg( M_read_time, 87 | ntohs( dinfo.body.msg.board ), 88 | std::string( dinfo.body.msg.message ) ); 89 | break; 90 | case DRAW_MODE: 91 | return handleDrawInfo( dinfo.body.draw ); 92 | break; 93 | default: 94 | std::cerr << __FILE__ << ':' << __LINE__ 95 | << " detect unsupported mode [" 96 | << static_cast< int >( ntohs( dinfo.mode ) ) << ']' 97 | << std::endl; 98 | break; 99 | } 100 | return false; 101 | } 102 | 103 | /*-------------------------------------------------------------------*/ 104 | /*! 105 | 106 | */ 107 | bool 108 | Handler::handleDispInfo2( const dispinfo_t2 & dinfo2 ) 109 | { 110 | handleLogVersion( REC_VERSION_3 ); 111 | 112 | switch ( ntohs( dinfo2.mode ) ) { 113 | case SHOW_MODE: 114 | return handleShowInfo2( dinfo2.body.show ); 115 | break; 116 | case MSG_MODE: 117 | return handleMsg( M_read_time, 118 | ntohs( dinfo2.body.msg.board ), 119 | std::string( dinfo2.body.msg.message ) ); 120 | break; 121 | case PT_MODE: 122 | return handlePlayerType( dinfo2.body.ptinfo ); 123 | break; 124 | case PARAM_MODE: 125 | return handleServerParam( dinfo2.body.sparams ); 126 | break; 127 | case PPARAM_MODE: 128 | return handlePlayerParam( dinfo2.body.pparams ); 129 | break; 130 | default: 131 | std::cerr << __FILE__ << ':' << __LINE__ 132 | << " detect unsupported mode [" 133 | << static_cast< int >( ntohs( dinfo2.mode ) ) << ']' 134 | << std::endl; 135 | break; 136 | } 137 | return false; 138 | } 139 | 140 | /*-------------------------------------------------------------------*/ 141 | /*! 142 | 143 | */ 144 | bool 145 | Handler::handleShowInfo( const showinfo_t & info ) 146 | { 147 | ShowInfoT show; 148 | convert( info, show ); 149 | 150 | M_read_time = static_cast< int >( show.time_ ); 151 | 152 | return ( handlePlayMode( info.pmode ) 153 | && handleTeamInfo( info.team[0], info.team[1] ) 154 | && handleShow( show ) ); 155 | } 156 | 157 | /*-------------------------------------------------------------------*/ 158 | /*! 159 | 160 | */ 161 | bool 162 | Handler::handleShowInfo2( const showinfo_t2 & info ) 163 | { 164 | ShowInfoT show; 165 | convert( info, show ); 166 | M_read_time = static_cast< int >( show.time_ ); 167 | 168 | return ( handlePlayMode( info.pmode ) 169 | && handleTeamInfo( info.team[0], info.team[1] ) 170 | && handleShow( show ) ); 171 | } 172 | 173 | /*-------------------------------------------------------------------*/ 174 | /*! 175 | 176 | */ 177 | bool 178 | Handler::handleShortShowInfo2( const short_showinfo_t2 & info ) 179 | { 180 | ShowInfoT show; 181 | convert( info, show ); 182 | 183 | M_read_time = static_cast< int >( show.time_ ); 184 | 185 | return handleShow( show ); 186 | } 187 | 188 | /*-------------------------------------------------------------------*/ 189 | /*! 190 | 191 | */ 192 | bool 193 | Handler::handleMsgInfo( const Int16 board, 194 | const std::string & msg ) 195 | { 196 | return handleMsg( M_read_time, board, msg ); 197 | } 198 | 199 | /*-------------------------------------------------------------------*/ 200 | /*! 201 | 202 | */ 203 | bool 204 | Handler::handleDrawInfo( const drawinfo_t & draw ) 205 | { 206 | return handleDraw( M_read_time, draw ); 207 | } 208 | 209 | /*-------------------------------------------------------------------*/ 210 | /*! 211 | 212 | */ 213 | bool 214 | Handler::handlePlayMode( char playmode ) 215 | { 216 | return handlePlayMode( M_read_time, static_cast< PlayMode >( playmode ) ); 217 | } 218 | 219 | /*-------------------------------------------------------------------*/ 220 | /*! 221 | 222 | */ 223 | bool 224 | Handler::handleTeamInfo( const team_t & team_left, 225 | const team_t & team_right ) 226 | { 227 | return handleTeam( M_read_time, TeamT( team_left ), TeamT( team_right ) ); 228 | } 229 | 230 | /*-------------------------------------------------------------------*/ 231 | /*! 232 | 233 | */ 234 | bool 235 | Handler::handlePlayerType( const player_type_t & type ) 236 | { 237 | return handlePlayerType( PlayerTypeT( type ) ); 238 | } 239 | 240 | /*-------------------------------------------------------------------*/ 241 | /*! 242 | 243 | */ 244 | bool 245 | Handler::handleServerParam( const server_params_t & param ) 246 | { 247 | return handleServerParam( ServerParamT( param ) ); 248 | } 249 | 250 | /*-------------------------------------------------------------------*/ 251 | /*! 252 | 253 | */ 254 | bool 255 | Handler::handlePlayerParam( const player_params_t & param ) 256 | { 257 | return handlePlayerParam( PlayerParamT( param ) ); 258 | } 259 | 260 | /*-------------------------------------------------------------------*/ 261 | bool 262 | Handler::handlePlayMode( const int time, 263 | const std::string & playmode ) 264 | { 265 | return handlePlayMode( time, to_playmode_enum( playmode ) ); 266 | } 267 | 268 | } // end namespace 269 | } // end namespace 270 | -------------------------------------------------------------------------------- /rcss/rcg/parser.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file parser.cpp 5 | \brief abstract rcg parser class Source File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa AKIYAMA 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 3 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifdef HAVE_CONFIG_H 33 | #include 34 | #endif 35 | 36 | #include "parser.h" 37 | 38 | #include "types.h" 39 | 40 | #include "parser_v1.h" 41 | #include "parser_v2.h" 42 | #include "parser_v3.h" 43 | #include "parser_v4.h" 44 | #include "parser_simdjson.h" 45 | 46 | #include 47 | #include 48 | 49 | namespace rcss { 50 | namespace rcg { 51 | 52 | /*-------------------------------------------------------------------*/ 53 | /*! 54 | 55 | */ 56 | Parser::Ptr 57 | Parser::create( std::istream & is ) 58 | { 59 | char header[5]; 60 | int version = REC_OLD_VERSION; 61 | 62 | is.read( header, 4 ); // read 'U', 'L', 'G', 63 | 64 | if ( is.gcount() != 4 ) 65 | { 66 | std::cerr << "(rcss::rcg::Parser::create) no header." << std::endl; 67 | return Parser::Ptr(); 68 | } 69 | 70 | if ( header[0] == '[' ) 71 | { 72 | version = REC_VERSION_JSON; 73 | } 74 | else if ( header[0] == 'U' 75 | && header[1] == 'L' 76 | && header[2] == 'G' ) 77 | { 78 | version = static_cast< int >( header[3] ); 79 | } 80 | 81 | std::cerr << "(rcss::rcg::Parser::create) rcg version = "; 82 | if ( version == -1 ) 83 | { 84 | std::cerr << "json"; 85 | } 86 | else 87 | { 88 | std::cerr << ( version == static_cast< int >( '0' ) + REC_VERSION_6 ? REC_VERSION_6 89 | : version == static_cast< int >( '0' ) + REC_VERSION_5 ? REC_VERSION_5 90 | : version == static_cast< int >( '0' ) + REC_VERSION_4 ? REC_VERSION_4 91 | : version ); 92 | } 93 | std::cerr << std::endl; 94 | 95 | Parser::Ptr ptr; 96 | 97 | if ( version == static_cast< int >( '0' ) + REC_VERSION_6 ) 98 | { 99 | ptr = Parser::Ptr( new ParserV4() ); 100 | } 101 | else if ( version == static_cast< int >( '0' ) + REC_VERSION_5 ) 102 | { 103 | ptr = Parser::Ptr( new ParserV4() ); 104 | } 105 | else if ( version == static_cast< int >( '0' ) + REC_VERSION_4 ) 106 | { 107 | ptr = Parser::Ptr( new ParserV4() ); 108 | } 109 | else if ( version == REC_VERSION_3 ) 110 | { 111 | ptr = Parser::Ptr( new ParserV3() ); 112 | } 113 | else if ( version == REC_VERSION_2 ) 114 | { 115 | ptr = Parser::Ptr( new ParserV2() ); 116 | } 117 | else if ( version == REC_OLD_VERSION ) 118 | { 119 | ptr = Parser::Ptr( new ParserV1() ); 120 | } 121 | else if ( version == REC_VERSION_JSON ) 122 | { 123 | ptr = Parser::Ptr( new ParserSimdJSON() ); 124 | } 125 | else 126 | { 127 | std::cerr << "(rcss::rcg::Parser::create) Unsupported version." << std::endl; 128 | } 129 | 130 | return ptr; 131 | } 132 | 133 | 134 | bool 135 | Parser::parse( const std::string & filepath, 136 | Handler & handler ) const 137 | { 138 | std::ifstream fin( filepath ); 139 | if ( ! fin ) 140 | { 141 | return false; 142 | } 143 | 144 | return parse( fin, handler ); 145 | } 146 | 147 | 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /rcss/rcg/parser.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file parser.h 5 | \brief abstract rcg parser class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa AKIYAMA 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 3 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifndef RCSS_RCG_PARSER_H 33 | #define RCSS_RCG_PARSER_H 34 | 35 | #include 36 | #include 37 | 38 | namespace rcss { 39 | namespace rcg { 40 | 41 | class Handler; 42 | 43 | ///////////////////////////////////////////////////////////////////// 44 | 45 | /*! 46 | \class Parser 47 | \brief rcg stream parser interface class 48 | */ 49 | class Parser { 50 | public: 51 | 52 | typedef std::shared_ptr< Parser > Ptr; //!< rcg parser pointer type 53 | typedef Ptr (*Creator)(); //!< rcg parser creator function 54 | 55 | /*! 56 | \brief create a suitable version parser instance depending on the input stream. 57 | \param is reference to the imput stream. 58 | \return smart pointer to the rcg parser instance 59 | 60 | poionted index of istream becomes 4. 61 | */ 62 | static 63 | Ptr create( std::istream & is ); 64 | 65 | protected: 66 | 67 | /*! 68 | \brief constructor is accessible only from the derived classes. 69 | */ 70 | Parser() = default; 71 | 72 | public: 73 | 74 | /*! 75 | \brief virtual destructor 76 | */ 77 | virtual 78 | ~Parser() 79 | { } 80 | 81 | /*! 82 | \brief (pure virtual) get log version 83 | \return version number 84 | */ 85 | virtual 86 | int version() const = 0; 87 | 88 | /*! 89 | \brief (pure virtual) analyze log data from input stream 90 | \param is reference to the imput stream (usually ifstream/gzifstream). 91 | \param handler reference to the rcg data handler. 92 | \retval true, if successfuly parsed. 93 | \retval false, if incorrect format is detected. 94 | */ 95 | virtual 96 | bool parse( std::istream & is, 97 | Handler & handler ) const = 0; 98 | 99 | virtual 100 | bool parse( const std::string & filepath, 101 | Handler & handler ) const; 102 | }; 103 | 104 | } // end of namespace 105 | } // end of namespace 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /rcss/rcg/parser_simdjson.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file parser_simdjson.h 5 | \brief rcg v6 (json) parser Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa AKIYAMA 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 3 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifndef RCSS_RCG_PARSER_SIMDJSON_H 33 | #define RCSS_RCG_PARSER_SIMDJSON_H 34 | 35 | #include 36 | #include 37 | 38 | #include 39 | #include 40 | 41 | namespace rcss { 42 | namespace rcg { 43 | 44 | 45 | /*! 46 | \class ParserSimdJSON 47 | \brief JSON rcg parser class 48 | */ 49 | class ParserSimdJSON 50 | : public Parser { 51 | private: 52 | struct Impl; 53 | std::shared_ptr< Impl > M_impl; 54 | 55 | public: 56 | 57 | /*! 58 | \brief create the Impl instance 59 | */ 60 | ParserSimdJSON(); 61 | 62 | /*! 63 | \brief get supported rcg version 64 | \return version number 65 | */ 66 | virtual 67 | int version() const override 68 | { 69 | return REC_VERSION_JSON; 70 | } 71 | 72 | /*! 73 | \brief parse input stream 74 | \param is reference to the imput stream (usually ifstream/gzifstream). 75 | \param handler reference to the rcg data handler. 76 | \retval true, if successfuly parsed. 77 | \retval false, if incorrect format is detected. 78 | */ 79 | bool parse( std::istream & is, 80 | Handler & handler ) const override; 81 | 82 | bool parse( const std::string & filepath, 83 | Handler & handler ) const override; 84 | 85 | 86 | /*! 87 | \brief assume to parse one monitor packet. 88 | \param input the data string 89 | \param handler reference to the rcg data handler. 90 | \retval true, if successfuly parsed. 91 | \retval false, if incorrect format is detected. 92 | 93 | First, check the type of data mode. 94 | Second, call each data item parsing method. 95 | */ 96 | bool parseData( const std::string & input, 97 | Handler & handler ) const; 98 | 99 | 100 | }; 101 | 102 | } 103 | } 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /rcss/rcg/parser_v1.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file parser_v1.cpp 5 | \brief rcg v1 parser Source File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa AKIYAMA 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 3 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifdef HAVE_CONFIG_H 33 | #include 34 | #endif 35 | 36 | #include "parser_v1.h" 37 | 38 | #include "handler.h" 39 | #include "types.h" 40 | #include 41 | 42 | namespace rcss { 43 | namespace rcg { 44 | 45 | /*-------------------------------------------------------------------*/ 46 | /*! 47 | 48 | */ 49 | bool 50 | ParserV1::parse( std::istream & is, 51 | Handler & handler ) const 52 | { 53 | // streampos must be the first point!!! 54 | is.seekg( 0 ); 55 | 56 | if ( ! is.good() ) 57 | { 58 | return false; 59 | } 60 | 61 | // register log version 62 | // Because rcg v1 does not contain version information, 63 | // REC_OLD_VERSION is set without reading. 64 | if ( ! handler.handleLogVersion( REC_OLD_VERSION ) ) 65 | { 66 | return false; 67 | } 68 | 69 | dispinfo_t info; 70 | while ( is.good() ) 71 | { 72 | is.read( reinterpret_cast< char* >( &info ), sizeof( dispinfo_t ) ); 73 | if ( is.gcount() != sizeof( dispinfo_t ) ) 74 | { 75 | if ( is.eof() ) 76 | { 77 | break; 78 | } 79 | //std::cerr << "failed to read dispinfo " << std::endl; 80 | return false; 81 | } 82 | 83 | // check cycle order and so on. 84 | if ( ! handler.handleDispInfo( info ) ) 85 | { 86 | return false; 87 | } 88 | } 89 | 90 | if ( is.eof() ) 91 | { 92 | return handler.handleEOF(); 93 | } 94 | 95 | return false; 96 | } 97 | 98 | } // end of namespace 99 | } // end of namespace 100 | -------------------------------------------------------------------------------- /rcss/rcg/parser_v1.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file parser_v1.h 5 | \brief rcg v1 parser Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa AKIYAMA 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 3 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifndef RCSS_RCG_PARSER_V1_H 33 | #define RCSS_RCG_PARSER_V1_H 34 | 35 | #include 36 | #include 37 | 38 | namespace rcss { 39 | namespace rcg { 40 | 41 | /*! 42 | \class ParserV1 43 | \brief rcg v1 parser class 44 | */ 45 | class ParserV1 46 | : public Parser { 47 | public: 48 | 49 | /*! 50 | \brief get supported rcg version 51 | \return version number 52 | */ 53 | int version() const override 54 | { 55 | return REC_OLD_VERSION; 56 | } 57 | 58 | /*! 59 | \brief parse input stream 60 | \param is reference to the imput stream (usually ifstream/gzifstream). 61 | \param handler reference to the rcg data handler. 62 | \retval true, if successfuly parsed. 63 | \retval false, if incorrect format is detected. 64 | */ 65 | bool parse( std::istream & is, 66 | Handler & handler ) const override; 67 | }; 68 | 69 | } // end of namespace 70 | } // end of namespace 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /rcss/rcg/parser_v2.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file parser_v2.cpp 5 | \brief rcg v2 parser Source File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa AKIYAMA 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 3 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifdef HAVE_CONFIG_H 33 | #include 34 | #endif 35 | 36 | #include "parser_v2.h" 37 | 38 | #include "handler.h" 39 | #include "types.h" 40 | 41 | #include 42 | #include 43 | 44 | #ifdef HAVE_ARPA_INET_H 45 | #include 46 | #endif 47 | #ifdef HAVE_WINDOWS_H 48 | #include 49 | #endif 50 | 51 | namespace rcss { 52 | namespace rcg { 53 | 54 | /*-------------------------------------------------------------------*/ 55 | /*! 56 | 57 | */ 58 | bool 59 | ParserV2::parse( std::istream & is, 60 | Handler & handler ) const 61 | { 62 | // streampos must be the first point!!! 63 | is.seekg( 0 ); 64 | 65 | if ( ! is.good() ) 66 | { 67 | return false; 68 | } 69 | 70 | // skip header 71 | char header[4]; 72 | is.read( header, 4 ); // read 'U', 'L', 'G', 73 | 74 | if ( static_cast< int >( header[3] ) != REC_VERSION_2 75 | || ! handler.handleLogVersion( REC_VERSION_2 ) ) 76 | { 77 | return false; 78 | } 79 | 80 | // main loop 81 | while ( is.good() ) 82 | { 83 | // read data 84 | if ( ! parseData( is, handler ) ) 85 | { 86 | return false; 87 | } 88 | } 89 | 90 | if ( is.eof() ) 91 | { 92 | return handler.handleEOF(); 93 | } 94 | 95 | return false; 96 | } 97 | 98 | /*-------------------------------------------------------------------*/ 99 | /*! 100 | 101 | */ 102 | bool 103 | ParserV2::parseData( std::istream & is, 104 | Handler & handler ) const 105 | { 106 | // chedk data mode. 107 | dispinfo_t info; 108 | is.read( reinterpret_cast< char * >( &info.mode ), sizeof( Int16 ) ); 109 | 110 | if ( ! is.good() ) 111 | { 112 | if ( is.eof() ) 113 | { 114 | return true; 115 | } 116 | return false; 117 | } 118 | 119 | // read each data block 120 | switch ( ntohs( info.mode ) ) { 121 | case NO_INFO: 122 | return true; 123 | case SHOW_MODE: 124 | is.read( reinterpret_cast< char* >( &info.body.show ), 125 | sizeof( showinfo_t ) ); 126 | if ( is.gcount() == sizeof( showinfo_t ) ) 127 | { 128 | return handler.handleShowInfo( info.body.show ); 129 | } 130 | break; 131 | case MSG_MODE: 132 | return parseMsgInfo( is, handler ); 133 | break; 134 | case DRAW_MODE: 135 | is.read( reinterpret_cast< char* >( &info.body.draw ), 136 | sizeof( drawinfo_t ) ); 137 | if ( is.gcount() == sizeof( drawinfo_t ) ) 138 | { 139 | return true; 140 | } 141 | break; 142 | default: 143 | std::cerr << __FILE__ << ':' << __LINE__ 144 | << " Unknown mode" << htons( info.mode ) 145 | << std::endl;; 146 | break; 147 | } 148 | 149 | return false; 150 | } 151 | 152 | /*-------------------------------------------------------------------*/ 153 | /*! 154 | 155 | */ 156 | bool 157 | ParserV2::parseMsgInfo( std::istream & is, 158 | Handler & handler ) const 159 | { 160 | bool result = false; 161 | 162 | Int16 board; 163 | is.read( reinterpret_cast< char* >( &board ), sizeof( Int16 ) ); 164 | if ( is.gcount() != sizeof( Int16 ) ) 165 | { 166 | return false; 167 | } 168 | board = ntohs( board ); 169 | 170 | Int16 len; 171 | is.read( reinterpret_cast< char* >( &len ), sizeof( Int16 ) ); 172 | if ( is.gcount() != sizeof( Int16 ) ) 173 | { 174 | return false; 175 | } 176 | len = ntohs( len ); 177 | 178 | char * msg = new char[len]; 179 | is.read( msg, len ); 180 | if ( is.gcount() == len ) 181 | { 182 | if ( msg[len - 1] == 0 ) 183 | { 184 | len = std::strlen( msg ); 185 | } 186 | 187 | result = handler.handleMsgInfo( board, std::string( msg, len ) ); 188 | } 189 | 190 | delete [] msg; 191 | return result; 192 | } 193 | 194 | } // end of namespace 195 | } // end of namespace 196 | -------------------------------------------------------------------------------- /rcss/rcg/parser_v2.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file parser_v2.h 5 | \brief rcg v2 parser Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa AKIYAMA 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 3 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifndef RCSS_RCG_PARSER_V2_H 33 | #define RCSS_RCG_PARSER_V2_H 34 | 35 | #include 36 | #include 37 | 38 | namespace rcss { 39 | namespace rcg { 40 | 41 | /*! 42 | \class ParserV2 43 | \brief rcg v2 parser 44 | */ 45 | class ParserV2 46 | : public Parser { 47 | public: 48 | 49 | /*! 50 | \brief get supported rcg version 51 | \return version number 52 | */ 53 | int version() const override 54 | { 55 | return REC_VERSION_2; 56 | } 57 | 58 | /*! 59 | \brief parse input stream. hander will handle each data block. 60 | \param is reference to the imput stream (usually ifstream). 61 | \param handler reference to the rcg data handler. 62 | \retval true if successfuly parsed. 63 | \retval false if incorrect format is detected. 64 | */ 65 | bool parse( std::istream & is, 66 | Handler & handler ) const override; 67 | 68 | private: 69 | /*! 70 | \brief parse data block. 71 | \param is reference to the imput stream (usually ifstream). 72 | \param handler reference to the rcg data handler. 73 | \retval true if successfuly parsed. 74 | \retval false if incorrect format is detected. 75 | 76 | This method is called in the loop of main parse() method. 77 | First, check the type of data mode. 78 | Second, call matched handler method. 79 | */ 80 | bool parseData( std::istream & is, 81 | Handler & handler ) const; 82 | 83 | /*! 84 | \brief parse MSG_MODE info(msg_info_t) 85 | \param is reference to the input stream 86 | \param handler reference to the data handler object 87 | \retval true if successfully parsed. 88 | \retval false if failed to parse. 89 | */ 90 | bool parseMsgInfo( std::istream & is, 91 | Handler & handler ) const; 92 | }; 93 | 94 | } // end of namespace 95 | } // end of namespace 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /rcss/rcg/parser_v3.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file parser_v3.h 5 | \brief rcg v3 parser Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa AKIYAMA 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 3 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifndef RCSS_RCG_PARSER_V3_H 33 | #define RCSS_RCG_PARSER_V3_H 34 | 35 | #include 36 | #include 37 | 38 | namespace rcss { 39 | namespace rcg { 40 | 41 | /*! 42 | \class ParserV3 43 | \brief rcg v3 parser class 44 | */ 45 | class ParserV3 46 | : public Parser { 47 | public: 48 | 49 | /*! 50 | \brief get supported rcg version 51 | \return version number 52 | */ 53 | int version() const override 54 | { 55 | return REC_VERSION_3; 56 | } 57 | 58 | /*! 59 | \brief parse input stream 60 | \param is reference to the imput stream (usually ifstream/gzifstream). 61 | \param handler reference to the rcg data handler. 62 | \retval true, if successfuly parsed. 63 | \retval false, if incorrect format is detected. 64 | */ 65 | bool parse( std::istream & is, 66 | Handler & handler ) const override; 67 | 68 | private: 69 | /*! 70 | \brief parse data block. 71 | \param is reference to the imput stream (usually ifstream). 72 | \param handler reference to the rcg data handler. 73 | \retval true, if successfuly parsed. 74 | \retval false, if incorrect format is detected. 75 | 76 | First, check the type of data mode. 77 | Second, call each data item parsing method. 78 | */ 79 | bool parseData( std::istream & is, 80 | Handler & handler ) const; 81 | 82 | /*! 83 | \brief parse SHOW_MODE inof, actually short_showinfo_t2 84 | \param is reference to the input stream 85 | \param handler reference to the data handler object 86 | \retval true if successfully parsed. 87 | \retval false if failed to parse. 88 | */ 89 | bool parseShowInfo( std::istream & is, 90 | Handler & handler ) const; 91 | 92 | /*! 93 | \brief parse MSG_MODE info(msg_info_t) 94 | \param is reference to the input stream 95 | \param handler reference to the data handler object 96 | \retval true if successfully parsed. 97 | \retval false if failed to parse. 98 | */ 99 | bool parseMsgInfo( std::istream & is, 100 | Handler & handler ) const; 101 | 102 | /*! 103 | \brief parse PM_MODE info(playmode) 104 | \param is reference to the input stream 105 | \param handler reference to the data handler object 106 | \retval true if successfully parsed. 107 | \retval false if failed to parse. 108 | */ 109 | bool parsePlayMode( std::istream & is, 110 | Handler & handler ) const; 111 | 112 | /*! 113 | \brief parse TEAM_MODE info(team_t * 2) 114 | \param is reference to the input stream 115 | \param handler reference to the data handler object 116 | \retval true if successfully parsed. 117 | \retval false if failed to parse. 118 | */ 119 | bool parseTeamInfo( std::istream & is, 120 | Handler & handler ) const; 121 | 122 | /*! 123 | \brief parse PT_MODE info(player_type_t) 124 | \param is reference to the input stream 125 | \param handler reference to the data handler object 126 | \retval true if successfully parsed. 127 | \retval false if failed to parse. 128 | */ 129 | bool parsePlayerType( std::istream & is, 130 | Handler & handler ) const; 131 | 132 | /*! 133 | \brief parse PARAM_MODE info(server_params_t) 134 | \param is reference to the input stream 135 | \param handler reference to the data handler object 136 | \retval true if successfully parsed. 137 | \retval false if failed to parse. 138 | */ 139 | bool parseServerParam( std::istream & is, 140 | Handler & handler ) const; 141 | 142 | /*! 143 | \brief parse PPARAM_MODE info(player_params_t) 144 | \param is reference to the input stream 145 | \param handler reference to the data handler object 146 | \retval true if successfully parsed. 147 | \retval false if failed to parse. 148 | */ 149 | bool parsePlayerParam( std::istream & is, 150 | Handler & handler ) const; 151 | }; 152 | 153 | } // end of namespace 154 | } // end of namespace 155 | 156 | #endif 157 | -------------------------------------------------------------------------------- /rcss/rcg/parser_v4.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file parser_v4.h 5 | \brief rcg v4 parser Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa AKIYAMA 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 3 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifndef RCSS_RCG_PARSER_V4_H 33 | #define RCSS_RCG_PARSER_V4_H 34 | 35 | #include 36 | #include 37 | 38 | #include 39 | 40 | namespace rcss { 41 | namespace rcg { 42 | 43 | /*! 44 | \class ParserV4 45 | \brief rcg v4 parser class 46 | */ 47 | class ParserV4 48 | : public Parser { 49 | public: 50 | 51 | /*! 52 | \brief get supported rcg version 53 | \return version number 54 | */ 55 | virtual 56 | int version() const override 57 | { 58 | return REC_VERSION_4; 59 | } 60 | 61 | /*! 62 | \brief parse input stream 63 | \param is reference to the imput stream (usually ifstream/gzifstream). 64 | \param handler reference to the rcg data handler. 65 | \retval true, if successfuly parsed. 66 | \retval false, if incorrect format is detected. 67 | */ 68 | virtual 69 | bool parse( std::istream & is, 70 | Handler & handler ) const override; 71 | 72 | /*! 73 | \brief parse data line. 74 | \param n_line the number of total read line 75 | \param line the data string 76 | \param handler reference to the rcg data handler. 77 | \retval true, if successfuly parsed. 78 | \retval false, if incorrect format is detected. 79 | 80 | First, check the type of data mode. 81 | Second, call each data item parsing method. 82 | */ 83 | bool parseLine( const int n_line, 84 | const std::string & line, 85 | Handler & handler ) const; 86 | 87 | protected: 88 | 89 | /*! 90 | \brief parse SHOW_MODE inof, actually short_showinfo_t2 91 | \param n_line the number of total read line 92 | \param line the data string 93 | \param handler reference to the data handler object 94 | \retval true if successfully parsed. 95 | \retval false if failed to parse. 96 | */ 97 | virtual 98 | bool parseShow( const int n_line, 99 | const std::string & line, 100 | Handler & handler ) const; 101 | 102 | /*! 103 | \brief parse MSG_MODE info(msg_info_t) 104 | \param n_line the number of total read line 105 | \param line the data string 106 | \param handler reference to the data handler object 107 | \retval true if successfully parsed. 108 | \retval false if failed to parse. 109 | */ 110 | bool parseMsg( const int n_line, 111 | const std::string & line, 112 | Handler & handler ) const; 113 | 114 | /*! 115 | \brief parse team_graphic information in msg 116 | \param msg message body in msg information 117 | \param handler handler object 118 | \return result status 119 | */ 120 | bool parseTeamGraphic( const int n_line, 121 | const std::string & msg, 122 | Handler & handler ) const; 123 | 124 | /*! 125 | \brief parse PM_MODE info(playmode) 126 | \param n_line the number of total read line 127 | \param line the data string 128 | \param handler reference to the data handler object 129 | \retval true if successfully parsed. 130 | \retval false if failed to parse. 131 | */ 132 | bool parsePlayMode( const int n_line, 133 | const std::string & line, 134 | Handler & handler ) const; 135 | 136 | /*! 137 | \brief parse TEAM_MODE info(team_t * 2) 138 | \param n_line the number of total read line 139 | \param line the data string 140 | \param handler reference to the data handler object 141 | \retval true if successfully parsed. 142 | \retval false if failed to parse. 143 | */ 144 | bool parseTeam( const int n_line, 145 | const std::string & line, 146 | Handler & handler ) const; 147 | 148 | /*! 149 | \brief parse PT_MODE info(player_type_t) 150 | \param n_line the number of total read line 151 | \param line the data string 152 | \param handler reference to the data handler object 153 | \retval true if successfully parsed. 154 | \retval false if failed to parse. 155 | */ 156 | bool parsePlayerType( const int n_line, 157 | const std::string & line, 158 | Handler & handler ) const; 159 | 160 | /*! 161 | \brief parse PARAM_MODE info(server_params_t) 162 | \param n_line the number of total read line 163 | \param line the data string 164 | \param handler reference to the data handler object 165 | \retval true if successfully parsed. 166 | \retval false if failed to parse. 167 | */ 168 | bool parseServerParam( const int n_line, 169 | const std::string & line, 170 | Handler & handler ) const; 171 | 172 | /*! 173 | \brief parse PPARAM_MODE info(player_params_t) 174 | \param n_line the number of total read line 175 | \param line the data string 176 | \param handler reference to the data handler object 177 | \retval true if successfully parsed. 178 | \retval false if failed to parse. 179 | */ 180 | bool parsePlayerParam( const int n_line, 181 | const std::string & line, 182 | Handler & handler ) const; 183 | }; 184 | 185 | } // end of namespace 186 | } // end of namespace 187 | 188 | #endif 189 | -------------------------------------------------------------------------------- /rcssmonitor.pro: -------------------------------------------------------------------------------- 1 | 2 | TEMPLATE = subdirs 3 | SUBDIRS = src 4 | 5 | # Input 6 | DISTFILES += \ 7 | icons/accelerate.xpm \ 8 | icons/blank.xpm \ 9 | icons/decelerate.xpm \ 10 | icons/ff.xpm \ 11 | icons/go.xpm \ 12 | icons/live.xpm \ 13 | icons/minus.xpm \ 14 | icons/next_score.xpm \ 15 | icons/open.xpm \ 16 | icons/play.xpm \ 17 | icons/plus.xpm \ 18 | icons/prev_score.xpm \ 19 | icons/quit.xpm \ 20 | icons/rcss.icns \ 21 | icons/rcss.ico \ 22 | icons/rcss.xpm \ 23 | icons/rec.xpm \ 24 | icons/rev.xpm \ 25 | icons/rew.xpm \ 26 | icons/stop.xpm 27 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_executable(rcssmonitor 3 | gzfstream.cpp 4 | angle_deg.cpp 5 | ball_painter.cpp 6 | circle_2d.cpp 7 | config_dialog.cpp 8 | disp_holder.cpp 9 | draw_info_painter.cpp 10 | field_canvas.cpp 11 | field_painter.cpp 12 | line_2d.cpp 13 | log_player.cpp 14 | log_player_slider.cpp 15 | main_window.cpp 16 | monitor_client.cpp 17 | options.cpp 18 | player_painter.cpp 19 | player_type_dialog.cpp 20 | rcg_handler.cpp 21 | score_board_painter.cpp 22 | team_graphic.cpp 23 | team_graphic_painter.cpp 24 | vector_2d.cpp 25 | main.cpp 26 | ) 27 | 28 | target_include_directories(rcssmonitor 29 | PUBLIC 30 | ${Qt5Core_INCLUDE_DIRS} 31 | ${Qt5Gui_INCLUDE_DIRS} 32 | ${Qt5Widgets_INCLUDE_DIRS} 33 | ${Qt5Network_INCLUDE_DIRS} 34 | # ${Boost_INCLUDE_DIRS} 35 | ${ZLIB_INCLUDE_DIRS} 36 | PRIVATE 37 | ${PROJECT_BINARY_DIR} 38 | ${PROJECT_SOURCE_DIR} 39 | ${PROJECT_SOURCE_DIR}/src 40 | ) 41 | 42 | target_link_libraries(rcssmonitor 43 | PRIVATE 44 | rcssrcg 45 | Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Network 46 | # Boost::program_options Boost::system 47 | ZLIB::ZLIB 48 | ) 49 | 50 | target_compile_definitions(rcssmonitor 51 | PUBLIC 52 | HAVE_CONFIG_H 53 | ) 54 | 55 | target_compile_options(rcssmonitor 56 | PRIVATE 57 | -W -Wall 58 | ) 59 | 60 | set_target_properties(rcssmonitor 61 | PROPERTIES 62 | RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} 63 | ) 64 | 65 | install(TARGETS rcssmonitor 66 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 67 | ) 68 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | AUTOMAKE_OPTIONS = subdir-objects 4 | 5 | bin_PROGRAMS = rcssmonitor 6 | 7 | rcssmonitor_SOURCES = \ 8 | gzfstream.cpp \ 9 | angle_deg.cpp \ 10 | ball_painter.cpp \ 11 | circle_2d.cpp \ 12 | config_dialog.cpp \ 13 | disp_holder.cpp \ 14 | draw_info_painter.cpp \ 15 | field_canvas.cpp \ 16 | field_painter.cpp \ 17 | line_2d.cpp \ 18 | log_player.cpp \ 19 | log_player_slider.cpp \ 20 | main_window.cpp \ 21 | monitor_client.cpp \ 22 | options.cpp \ 23 | player_painter.cpp \ 24 | player_type_dialog.cpp \ 25 | rcg_handler.cpp \ 26 | score_board_painter.cpp \ 27 | team_graphic.cpp \ 28 | team_graphic_painter.cpp \ 29 | vector_2d.cpp \ 30 | main.cpp 31 | 32 | nodist_rcssmonitor_SOURCES = \ 33 | moc_config_dialog.cpp \ 34 | moc_field_canvas.cpp \ 35 | moc_log_player.cpp \ 36 | moc_log_player_slider.cpp \ 37 | moc_main_window.cpp \ 38 | moc_monitor_client.cpp \ 39 | moc_player_type_dialog.cpp 40 | 41 | noinst_HEADERS = \ 42 | gzfstream.h \ 43 | angle_deg.h \ 44 | ball_painter.h \ 45 | circle_2d.h \ 46 | config_dialog.h \ 47 | disp_holder.h \ 48 | draw_info_painter.h \ 49 | field_canvas.h \ 50 | field_painter.h \ 51 | line_2d.h \ 52 | log_player.h \ 53 | log_player_slider.h \ 54 | main_window.h \ 55 | monitor_client.h \ 56 | mouse_state.h \ 57 | options.h \ 58 | painter_interface.h \ 59 | player_painter.h \ 60 | player_type_dialog.h \ 61 | rcg_handler.h \ 62 | score_board_painter.h \ 63 | team_graphic.h \ 64 | team_graphic_painter.h \ 65 | vector_2d.h 66 | 67 | 68 | rcssmonitor_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src $(QT_CPPFLAGS) 69 | rcssmonitor_CXXFLAGS = $(QT_CXXFLAGS) -W -Wall 70 | rcssmonitor_LDFLAGS = -L$(top_builddir)/rcss/rcg $(QT_LDFLAGS) 71 | rcssmonitor_LDADD = -lrcssrcg $(QT_LIBS) 72 | 73 | # source files from headers generated by Meta Object Compiler 74 | moc_%.cpp: %.h 75 | $(QT_MOC) $< -o $@ 76 | 77 | # rule to generate tranlation files 78 | ##%.qm: %.ts 79 | ## $(QT_LRELEASE) $< -qm $@ 80 | 81 | AM_CPPFLAGS = 82 | AM_CFLAGS = -W -Wall 83 | AM_CXXFLAGS = -W -Wall 84 | AM_LDFLAGS = 85 | 86 | EXTRA_DIST = \ 87 | CMakeLists.txt 88 | 89 | CLEANFILES = $(nodist_rcssmonitor_SOURCES) *~ 90 | -------------------------------------------------------------------------------- /src/angle_deg.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file angle_deg.cpp 5 | \brief Degree wrapper class Source File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa Akiyama 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 2.1 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifdef HAVE_CONFIG_H 33 | #include 34 | #endif 35 | 36 | #include "angle_deg.h" 37 | 38 | #ifndef M_PI 39 | //! PI value macro 40 | #define M_PI 3.14159265358979323846 41 | #endif 42 | 43 | const double AngleDeg::EPSILON = 1.0e-5; 44 | 45 | const double AngleDeg::DEG2RAD = M_PI / 180.0; 46 | const double AngleDeg::RAD2DEG = 180.0 / M_PI; 47 | -------------------------------------------------------------------------------- /src/ball_painter.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file ball_painter.cpp 5 | \brief ball painter class Source File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifdef HAVE_CONFIG_H 34 | #include 35 | #endif 36 | 37 | #include 38 | 39 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) 40 | #include 41 | #else 42 | #include 43 | #endif 44 | 45 | #include "ball_painter.h" 46 | 47 | #include "disp_holder.h" 48 | #include "options.h" 49 | #include "vector_2d.h" 50 | 51 | #include 52 | 53 | #include 54 | 55 | /*-------------------------------------------------------------------*/ 56 | /*! 57 | 58 | */ 59 | BallPainter::BallPainter( const DispHolder & disp_holder ) 60 | : M_disp_holder( disp_holder ) 61 | { 62 | 63 | } 64 | 65 | /*-------------------------------------------------------------------*/ 66 | /*! 67 | 68 | */ 69 | BallPainter::~BallPainter() 70 | { 71 | 72 | } 73 | 74 | /*-------------------------------------------------------------------*/ 75 | /*! 76 | 77 | */ 78 | void 79 | BallPainter::draw( QPainter & painter ) 80 | { 81 | const Options & opt = Options::instance(); 82 | 83 | if ( ! opt.showBall() ) 84 | { 85 | return; 86 | } 87 | 88 | DispConstPtr disp = M_disp_holder.currentDisp(); 89 | 90 | if ( ! disp ) 91 | { 92 | std::cerr << "no dispinfo" << std::endl; 93 | return; 94 | } 95 | 96 | const rcss::rcg::ServerParamT & SP = M_disp_holder.serverParam(); 97 | 98 | // decide radius 99 | const int ball_radius = ( opt.ballSize() >= 0.01 100 | ? opt.scale( opt.ballSize() ) 101 | : std::max( 1, opt.scale( SP.ball_size_ ) ) ); 102 | const int kickable_radius 103 | = std::max( 1, opt.scale( SP.player_size_ 104 | + SP.kickable_margin_ 105 | + SP.ball_size_ ) ); 106 | const int ix = opt.screenX( disp->show_.ball_.x_ ); 107 | const int iy = opt.screenY( disp->show_.ball_.y_ ); 108 | 109 | // draw ball body 110 | painter.setPen( Qt::NoPen ); 111 | painter.setBrush( opt.ballBrush() ); 112 | painter.drawEllipse( ix - ball_radius, 113 | iy - ball_radius, 114 | ball_radius * 2, 115 | ball_radius * 2 ); 116 | 117 | // draw kickable margin 118 | painter.setPen( opt.ballPen() ); 119 | painter.setBrush( Qt::NoBrush ); 120 | painter.drawEllipse( ix - kickable_radius, 121 | iy - kickable_radius, 122 | kickable_radius * 2, 123 | kickable_radius * 2 ); 124 | 125 | // draw future status 126 | if ( opt.ballVelCycle() > 0 127 | && disp->show_.ball_.hasVelocity() ) 128 | { 129 | drawVelocity( painter ); 130 | } 131 | } 132 | 133 | /*-------------------------------------------------------------------*/ 134 | /*! 135 | 136 | */ 137 | void 138 | BallPainter::drawVelocity( QPainter & painter ) const 139 | { 140 | const Options & opt = Options::instance(); 141 | 142 | if ( opt.antiAliasing() ) 143 | { 144 | painter.setRenderHint( QPainter::Antialiasing, false ); 145 | } 146 | 147 | const rcss::rcg::ServerParamT & SP = M_disp_holder.serverParam(); 148 | 149 | DispConstPtr disp = M_disp_holder.currentDisp(); 150 | 151 | const double bdecay = SP.ball_decay_; 152 | 153 | Vector2D bpos( disp->show_.ball_.x_, 154 | disp->show_.ball_.y_ ); 155 | Vector2D bvel( disp->show_.ball_.vx_, 156 | disp->show_.ball_.vy_ ); 157 | 158 | QPoint first_point( opt.screenX( bpos.x ), 159 | opt.screenY( bpos.y ) ); 160 | QPoint last_point = first_point; 161 | 162 | QPainterPath path; 163 | 164 | const int max_cycle = std::min( 100, Options::instance().ballVelCycle() ); 165 | for ( int i = 0; i < max_cycle; ++i ) 166 | { 167 | bpos += bvel; 168 | bvel *= bdecay; 169 | 170 | QPoint pt( opt.screenX( bpos.x ), 171 | opt.screenY( bpos.y ) ); 172 | if ( std::abs( last_point.x() - pt.x() ) < 1 173 | && std::abs( last_point.y() - pt.y() ) < 1 ) 174 | { 175 | break; 176 | } 177 | last_point = pt; 178 | path.addEllipse( pt.x() - 1, 179 | pt.y() - 1, 180 | 3, 181 | 3 ); 182 | } 183 | 184 | path.moveTo( first_point ); 185 | path.lineTo( last_point ); 186 | 187 | painter.setPen( opt.ballVelPen() ); 188 | painter.setBrush( Qt::NoBrush ); 189 | 190 | painter.drawPath( path ); 191 | 192 | if ( opt.antiAliasing() ) 193 | { 194 | painter.setRenderHint( QPainter::Antialiasing ); 195 | } 196 | } 197 | -------------------------------------------------------------------------------- /src/ball_painter.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file ball_painer.h 5 | \brief ball painter class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_BALL_PAINTER_H 34 | #define RCSSMONITOR_BALL_PAINTER_H 35 | 36 | #include "painter_interface.h" 37 | 38 | class DispHolder; 39 | 40 | class BallPainter 41 | : public PainterInterface { 42 | private: 43 | const DispHolder & M_disp_holder; 44 | 45 | // not used 46 | BallPainter() = delete; 47 | BallPainter( const BallPainter & ) = delete; 48 | const BallPainter & operator=( const BallPainter & ) = delete; 49 | public: 50 | 51 | BallPainter( const DispHolder & disp_holder ); 52 | ~BallPainter(); 53 | 54 | void draw( QPainter & painter ) override; 55 | 56 | private: 57 | 58 | void drawVelocity( QPainter & painter ) const; 59 | 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/circle_2d.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file circle_2d.cpp 5 | \brief 2D circle region Source File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa Akiyama 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 2.1 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifdef HAVE_CONFIG_H 33 | #include 34 | #endif 35 | 36 | #include "circle_2d.h" 37 | #include "line_2d.h" 38 | 39 | #include 40 | #include 41 | 42 | // available only this file 43 | namespace { 44 | 45 | /*-------------------------------------------------------------------*/ 46 | /*! 47 | \brief get squared value 48 | \param val input value 49 | \return squared value 50 | */ 51 | inline 52 | double 53 | SQUARE( const double & val ) 54 | { 55 | return val * val; 56 | } 57 | 58 | /*-------------------------------------------------------------------*/ 59 | /*! 60 | \brief solve quadratic fomula 61 | \param a fomula constant A 62 | \param b fomula constant B 63 | \param c fomula constant C 64 | \param sol1 reference to the result variable 65 | \param sol2 reference to the result variable 66 | \return number of solution 67 | */ 68 | inline 69 | int 70 | QUADRATIC_FOMULA( const double & a, 71 | const double & b, 72 | const double & c, 73 | double & sol1, 74 | double & sol2 ) 75 | { 76 | double d = SQUARE( b ) - 4.0 * a * c; 77 | // ignore small noise 78 | if ( std::fabs( d ) < 0.001 ) 79 | { 80 | sol1 = -b / (2.0 * a); 81 | return 1; 82 | } 83 | else if ( d < 0.0 ) 84 | { 85 | return 0; 86 | } 87 | else 88 | { 89 | d = std::sqrt( d ); 90 | sol1 = (-b + d) / (2.0 * a); 91 | sol2 = (-b - d) / (2.0 * a); 92 | return 2; 93 | } 94 | } 95 | 96 | } // end of namespace 97 | 98 | 99 | /*-------------------------------------------------------------------*/ 100 | 101 | 102 | const double Circle2D::EPSILON = 1.0e-5; 103 | 104 | /*-------------------------------------------------------------------*/ 105 | /*! 106 | 107 | */ 108 | int 109 | Circle2D::intersection( const Line2D & line, 110 | Vector2D * sol1, 111 | Vector2D * sol2 ) const 112 | { 113 | if ( std::fabs( line.a() ) < EPSILON ) 114 | { 115 | if ( std::fabs( line.b() ) < EPSILON ) 116 | { 117 | std::cerr << "Circle2D::intersection() illegal line." 118 | << std::endl; 119 | return 0; 120 | } 121 | 122 | // Line: By + C = 0 ---> y = -C/B 123 | // Circle: (x - cx)^2 + (y - cy)^2 = r^2 124 | // ---> 125 | double x1 = 0.0, x2 = 0.0; 126 | int n_sol 127 | = QUADRATIC_FOMULA( 1.0, 128 | -2.0 * center().x, 129 | ( SQUARE( center().x ) 130 | + SQUARE( line.c() / line.b() + center().y ) 131 | - SQUARE( radius() ) ), 132 | x1, 133 | x2 ); 134 | 135 | if ( n_sol > 0 ) 136 | { 137 | double y1 = -line.c() / line.b(); 138 | 139 | if ( sol1 ) 140 | { 141 | sol1->assign( x1, y1 ); 142 | } 143 | 144 | if ( n_sol > 1 && sol2 ) 145 | { 146 | sol2->assign( x2, y1 ); 147 | } 148 | } 149 | return n_sol; 150 | } 151 | else 152 | { 153 | // include (fabs(l.b()) < EPSILON) case 154 | // use line & circle formula 155 | // Ax + By + C = 0 156 | // (x - cx)^2 + (y - cy)^2 = r^2 157 | // make y's quadratic formula using these fomula. 158 | double m = line.b() / line.a(); 159 | double d = line.c() / line.a(); 160 | 161 | double a = 1.0 + m * m; 162 | double b = 2.0 * ( -center().y + ( d + center().x ) * m ); 163 | double c = SQUARE( d + center().x ) 164 | + SQUARE( center().y ) 165 | - SQUARE( radius() ); 166 | 167 | double y1 = 0.0, y2 = 0.0; 168 | int n_sol = QUADRATIC_FOMULA( a, b, c, 169 | y1, y2 ); 170 | 171 | if ( n_sol > 0 && sol1 ) 172 | { 173 | sol1->assign( line.getX( y1 ), y1 ); 174 | } 175 | 176 | if ( n_sol > 1 && sol2 ) 177 | { 178 | sol2->assign( line.getX( y2 ), y2 ); 179 | } 180 | 181 | return n_sol; 182 | } 183 | } 184 | 185 | /*-------------------------------------------------------------------*/ 186 | /*! 187 | 188 | */ 189 | int 190 | Circle2D::intersection( const Circle2D & circle, 191 | Vector2D * sol1, 192 | Vector2D * sol2 ) const 193 | { 194 | double rel_x = circle.center().x - this->center().x; 195 | double rel_y = circle.center().y - this->center().y; 196 | 197 | double center_dist2 = rel_x * rel_x + rel_y * rel_y; 198 | double center_dist = std::sqrt( center_dist2 ); 199 | 200 | if ( center_dist < std::fabs( this->radius() - circle.radius() ) 201 | || this->radius() + circle.radius() < center_dist ) 202 | { 203 | return 0; 204 | } 205 | 206 | // line that passes through the intersection points 207 | Line2D line( -2.0 * rel_x, 208 | -2.0 * rel_y, 209 | circle.center().r2() 210 | - circle.radius() * circle.radius() 211 | - this->center().r2() 212 | + this->radius() * this->radius() ); 213 | 214 | return this->intersection( line, sol1, sol2 ); 215 | } 216 | -------------------------------------------------------------------------------- /src/circle_2d.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file circle_2d.h 5 | \brief 2D circle region Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa Akiyama 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 2.1 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifndef RCSSMONITOR_CIRCLE2D_H 33 | #define RCSSMONITOR_CIRCLE2D_H 34 | 35 | #include "vector_2d.h" 36 | 37 | #include 38 | 39 | class Line2D; 40 | 41 | /*! 42 | \class Circle2D 43 | \brief 2d circle class 44 | */ 45 | class Circle2D { 46 | private: 47 | 48 | //! center point 49 | Vector2D M_center; 50 | 51 | //! radius of this circle 52 | double M_radius; 53 | 54 | static const double EPSILON; 55 | 56 | 57 | public: 58 | /*! 59 | \brief create a zero area circle at (0,0) 60 | */ 61 | Circle2D() 62 | : M_center( 0.0, 0.0 ) 63 | , M_radius( 0.0 ) 64 | { } 65 | 66 | /*! 67 | \brief constructor with all values 68 | \param c center point 69 | \param r radius value 70 | */ 71 | Circle2D( const Vector2D & c, 72 | const double & r ) 73 | : M_center( c ) 74 | , M_radius( r ) 75 | { 76 | if ( r < 0.0 ) 77 | { 78 | std::cerr << "Circle2D::Circle2D(). radius must be positive value." 79 | << std::endl; 80 | M_radius = 0.0; 81 | } 82 | } 83 | 84 | /*! 85 | \brief assign new value. 86 | \param c center point 87 | \param r radius value 88 | \return const reference to this 89 | */ 90 | const 91 | Circle2D & assign( const Vector2D & c, 92 | const double & r ) 93 | { 94 | M_center = c; 95 | M_radius = r; 96 | if ( r < 0.0 ) 97 | { 98 | std::cerr << "Circle2D::assign(). radius must be positive value." 99 | << std::endl; 100 | M_radius = 0.0; 101 | } 102 | return *this; 103 | } 104 | 105 | /*! 106 | \brief check if point is within this region 107 | \param point considered point 108 | \return true if point is contained by this circle 109 | */ 110 | bool contains( const Vector2D & point ) const 111 | { 112 | return M_center.dist2( point ) < M_radius * M_radius; 113 | } 114 | 115 | /*! 116 | \brief get the center point 117 | \return center point coordinate value 118 | */ 119 | const 120 | Vector2D & center() const 121 | { 122 | return M_center; 123 | } 124 | 125 | /*! 126 | \brief get the radius value 127 | \return radius value 128 | */ 129 | const 130 | double & radius() const 131 | { 132 | return M_radius; 133 | } 134 | 135 | /*! 136 | \brief caluclate the intersection with straight line 137 | \param line considerd line 138 | \param sol1 pointer to the 1st solution variable 139 | \param sol2 pointer to the 2nd solution variable 140 | \return the number of solution 141 | */ 142 | int intersection( const Line2D & line, 143 | Vector2D * sol1, 144 | Vector2D * sol2 ) const; 145 | 146 | /*! 147 | \brief calculate the intersection with another circle 148 | \param circle considerd circle 149 | \param sol1 pointer to the 1st solution variable 150 | \param sol2 pointer to the 2nd solution variable 151 | \return the number of solution 152 | */ 153 | int intersection( const Circle2D & circle, 154 | Vector2D * sol1, 155 | Vector2D * sol2 ) const; 156 | 157 | }; 158 | 159 | #endif 160 | -------------------------------------------------------------------------------- /src/disp_holder.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file disp_holder.h 5 | \brief display data holder class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 3, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_DISP_HOLDER_H 34 | #define RCSSMONITOR_DISP_HOLDER_H 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | #include "team_graphic.h" 43 | 44 | typedef std::shared_ptr< rcss::rcg::DispInfoT > DispPtr; 45 | typedef std::shared_ptr< const rcss::rcg::DispInfoT > DispConstPtr; 46 | typedef std::vector< DispConstPtr > DispCont; 47 | typedef std::unordered_map< int, std::vector< rcss::rcg::PointT > > PointCont; 48 | typedef std::unordered_map< int, std::vector< rcss::rcg::CircleT > > CircleCont; 49 | typedef std::unordered_map< int, std::vector< rcss::rcg::LineT > > LineCont; 50 | 51 | class DispHolder { 52 | public: 53 | static const size_t INVALID_INDEX; 54 | static const size_t MAX_SIZE; 55 | 56 | private: 57 | 58 | rcss::rcg::ServerParamT M_server_param; 59 | rcss::rcg::PlayerParamT M_player_param; 60 | rcss::rcg::PlayerTypeT M_default_player_type; 61 | std::unordered_map< int, rcss::rcg::PlayerTypeT > M_player_types; 62 | 63 | TeamGraphic M_team_graphic_left; 64 | TeamGraphic M_team_graphic_right; 65 | 66 | PointCont M_point_cont; 67 | CircleCont M_circle_cont; 68 | LineCont M_line_cont; 69 | 70 | rcss::rcg::PlayMode M_playmode; //!< last handled playmode 71 | rcss::rcg::TeamT M_teams[2]; //!< last handled team info 72 | 73 | //! the list of score changed data index 74 | std::vector< std::size_t > M_score_changed_index; 75 | 76 | //! the record of penalty score/miss, first: time, second: playmode 77 | std::vector< std::pair< int, rcss::rcg::PlayMode > > M_penalty_scores_left; 78 | std::vector< std::pair< int, rcss::rcg::PlayMode > > M_penalty_scores_right; 79 | 80 | DispPtr M_disp; //!< the last handled display data 81 | DispCont M_disp_cont; //!< the container of all display data 82 | 83 | size_t M_current_index; 84 | 85 | // not used 86 | DispHolder( const DispHolder & ) = delete; 87 | DispHolder operator=( const DispHolder & ) = delete; 88 | 89 | public: 90 | 91 | DispHolder(); 92 | ~DispHolder(); 93 | 94 | void clear(); 95 | 96 | const rcss::rcg::ServerParamT & serverParam() const { return M_server_param; } 97 | const rcss::rcg::PlayerParamT & playerParam() const { return M_player_param; } 98 | const std::unordered_map< int, rcss::rcg::PlayerTypeT > & playerTypes() const { return M_player_types; } 99 | const rcss::rcg::PlayerTypeT & playerType( const int id ) const; 100 | 101 | rcss::rcg::PlayMode playmode() const { return M_playmode; } 102 | 103 | const TeamGraphic & teamGraphicLeft() const { return M_team_graphic_left; } 104 | const TeamGraphic & teamGraphicRight() const { return M_team_graphic_right; } 105 | 106 | const std::vector< std::size_t > & scoreChangedIndex() const 107 | { 108 | return M_score_changed_index; 109 | } 110 | 111 | const std::vector< std::pair< int, rcss::rcg::PlayMode > > & penaltyScoresLeft() const 112 | { 113 | return M_penalty_scores_left; 114 | } 115 | const std::vector< std::pair< int, rcss::rcg::PlayMode > > & penaltyScoresRight() const 116 | { 117 | return M_penalty_scores_right; 118 | } 119 | 120 | const PointCont & pointCont() const { return M_point_cont; } 121 | const CircleCont & circleCont() const { return M_circle_cont; } 122 | const LineCont & lineCont() const { return M_line_cont; } 123 | 124 | size_t currentIndex() const { return M_current_index; } 125 | DispConstPtr currentDisp() const; 126 | const DispCont & dispCont() const { return M_disp_cont; } 127 | 128 | bool addDispInfoV1( const rcss::rcg::dispinfo_t & disp ); 129 | bool addDispInfoV2( const rcss::rcg::dispinfo_t2 & disp ); 130 | bool addDispInfoV3( const char * msg ); 131 | bool addJSON( const char * msg ); 132 | 133 | public: 134 | 135 | bool handleEOF(); 136 | 137 | bool handleShow( const rcss::rcg::ShowInfoT & show ); 138 | bool handleMsg( const int time, 139 | const int board, 140 | const std::string & msg ); 141 | bool handleDraw( const int time, 142 | const rcss::rcg::drawinfo_t & draw ); 143 | bool handlePlayMode( const int time, 144 | const rcss::rcg::PlayMode pmode ); 145 | bool handleTeam( const int time, 146 | const rcss::rcg::TeamT & team_l, 147 | const rcss::rcg::TeamT & team_r ); 148 | bool handleServerParam( const rcss::rcg::ServerParamT & sparam ); 149 | bool handlePlayerParam( const rcss::rcg::PlayerParamT & pparam ); 150 | bool handlePlayerType( const rcss::rcg::PlayerTypeT & ptype ); 151 | bool handleTeamGraphic( const char side, 152 | const int x, 153 | const int y, 154 | const std::vector< std::string > & xpm_data ); 155 | 156 | // 157 | // 158 | // 159 | 160 | bool handleDrawClear( const int time ); 161 | 162 | bool handleDrawPoint( const int time, 163 | const rcss::rcg::PointT & point ); 164 | 165 | bool handleDrawCircle( const int time, 166 | const rcss::rcg::CircleT & circle ); 167 | 168 | bool handleDrawLine( const int time, 169 | const rcss::rcg::LineT & line ); 170 | 171 | private: 172 | void analyzeTeamGraphic( const std::string & msg ); 173 | 174 | public: 175 | 176 | bool setIndexFirst(); 177 | bool setIndexLast(); 178 | bool setIndexStepBack(); 179 | bool setIndexStepForward(); 180 | bool setIndex( const size_t idx ); 181 | bool setCycle( const int cycle ); 182 | size_t getIndex( const int cycle ) const; 183 | 184 | 185 | }; 186 | 187 | #endif 188 | -------------------------------------------------------------------------------- /src/draw_info_painter.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file draw_info_painter.cpp 5 | \brief draw info painter class Source File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa Akiyama 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifdef HAVE_CONFIG_H 34 | #include 35 | #endif 36 | 37 | #include 38 | 39 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) 40 | #include 41 | #else 42 | #include 43 | #endif 44 | 45 | #include "draw_info_painter.h" 46 | 47 | #include "disp_holder.h" 48 | #include "options.h" 49 | 50 | #include 51 | 52 | /*-------------------------------------------------------------------*/ 53 | /*! 54 | 55 | */ 56 | DrawInfoPainter::DrawInfoPainter( const DispHolder & disp_holder ) 57 | : M_disp_holder( disp_holder ) 58 | , M_pen( QColor( 255, 255, 255 ), 0, Qt::SolidLine ) 59 | { 60 | 61 | } 62 | 63 | /*-------------------------------------------------------------------*/ 64 | /*! 65 | 66 | */ 67 | DrawInfoPainter::~DrawInfoPainter() 68 | { 69 | 70 | } 71 | 72 | /*-------------------------------------------------------------------*/ 73 | /*! 74 | 75 | */ 76 | void 77 | DrawInfoPainter::draw( QPainter & painter ) 78 | { 79 | const Options & opt = Options::instance(); 80 | 81 | if ( ! opt.showDrawInfo() ) 82 | { 83 | return; 84 | } 85 | 86 | DispConstPtr disp = M_disp_holder.currentDisp(); 87 | 88 | if ( ! disp ) 89 | { 90 | return; 91 | } 92 | 93 | const int current_time = disp->show_.time_; 94 | 95 | painter.setBrush( Qt::NoBrush ); 96 | 97 | // 98 | // draw point 99 | // 100 | { 101 | PointCont::const_iterator points = M_disp_holder.pointCont().find( current_time ); 102 | if ( points != M_disp_holder.pointCont().end() ) 103 | { 104 | for ( decltype( points->second )::const_reference & p : points->second ) 105 | { 106 | QColor col( p.color_.c_str() ); 107 | if ( col.isValid() ) 108 | { 109 | M_pen.setColor( col ); 110 | painter.setPen( M_pen ); 111 | painter.drawRect( opt.screenX( p.x_ ) - 1, 112 | opt.screenY( p.y_ ) - 1, 113 | 3, 3 ); 114 | } 115 | } 116 | } 117 | } 118 | 119 | // 120 | // draw circle 121 | // 122 | { 123 | CircleCont::const_iterator circles = M_disp_holder.circleCont().find( current_time ); 124 | if ( circles != M_disp_holder.circleCont().end() ) 125 | { 126 | for ( decltype( circles->second )::const_reference c : circles->second ) 127 | { 128 | QColor col( c.color_.c_str() ); 129 | if ( col.isValid() ) 130 | { 131 | M_pen.setColor( col ); 132 | painter.setPen( M_pen ); 133 | 134 | int r = opt.scale( c.r_ ); 135 | painter.drawEllipse( opt.screenX( c.x_ ) - r, 136 | opt.screenY( c.y_ ) - r, 137 | r * 2, 138 | r * 2 ); 139 | } 140 | } 141 | } 142 | } 143 | 144 | // 145 | // draw line 146 | // 147 | { 148 | LineCont::const_iterator lines = M_disp_holder.lineCont().find( current_time ); 149 | if ( lines != M_disp_holder.lineCont().end() ) 150 | { 151 | for ( decltype( lines->second )::const_reference l : lines->second ) 152 | { 153 | QColor col( l.color_.c_str() ); 154 | if ( col.isValid() ) 155 | { 156 | M_pen.setColor( col ); 157 | painter.setPen( M_pen ); 158 | 159 | painter.drawLine( opt.screenX( l.x1_ ), 160 | opt.screenY( l.y1_ ), 161 | opt.screenX( l.x2_ ), 162 | opt.screenY( l.y2_ ) ); 163 | } 164 | } 165 | } 166 | } 167 | 168 | } 169 | -------------------------------------------------------------------------------- /src/draw_info_painter.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file draw_info_painter.h 5 | \brief draw info painter class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa Akiyama 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_DRAW_INFO_PAINTER_H 34 | #define RCSSMONITOR_DRAW_INFO_PAINTER_H 35 | 36 | #include "painter_interface.h" 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | class DispHolder; 43 | 44 | class DrawInfoPainter 45 | : public PainterInterface { 46 | private: 47 | 48 | const DispHolder & M_disp_holder; 49 | 50 | QPen M_pen; 51 | 52 | // not used 53 | DrawInfoPainter() = delete; 54 | DrawInfoPainter( const DrawInfoPainter & ) = delete; 55 | const DrawInfoPainter & operator=( const DrawInfoPainter & ) = delete; 56 | public: 57 | 58 | explicit 59 | DrawInfoPainter( const DispHolder & disp_holder ); 60 | ~DrawInfoPainter(); 61 | 62 | void draw( QPainter & painter ) override; 63 | 64 | }; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/field_canvas.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file field_canvas.h 5 | \brief field canvas class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 3, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_FIELD_CANVAS_H 34 | #define RCSSMONITOR_FIELD_CANVAS_H 35 | 36 | #ifdef USE_GLWIDGET 37 | #include 38 | #else 39 | #include 40 | #endif 41 | 42 | #include 43 | #include 44 | 45 | #include "mouse_state.h" 46 | 47 | #include 48 | 49 | class QMenu; 50 | 51 | class DispHolder; 52 | class FieldPainter; 53 | class PainterInterface; 54 | 55 | class FieldCanvas 56 | : 57 | #ifdef USE_GLWIDGET 58 | public QGLWidget 59 | #else 60 | public QWidget 61 | #endif 62 | { 63 | 64 | Q_OBJECT 65 | 66 | private: 67 | 68 | DispHolder & M_disp_holder; 69 | 70 | QMenu * M_monitor_menu; 71 | 72 | std::shared_ptr< FieldPainter > M_field_painter; 73 | std::vector< std::shared_ptr< PainterInterface > > M_painters; 74 | 75 | //! 0: left, 1: middle, 2: right 76 | MouseState M_mouse_state[3]; 77 | 78 | const MouseState * M_focus_move_mouse; 79 | const MouseState * M_measure_mouse; 80 | const MouseState * M_menu_mouse; 81 | 82 | // not used 83 | FieldCanvas() = delete; 84 | FieldCanvas( const FieldCanvas & ) = delete; 85 | const FieldCanvas & operator=( const FieldCanvas & ) = delete; 86 | 87 | public: 88 | 89 | explicit 90 | FieldCanvas( DispHolder & disp_holder ); 91 | ~FieldCanvas(); 92 | 93 | QMenu * createPopupMenu(); 94 | 95 | private: 96 | 97 | void createPainters(); 98 | 99 | void updateFocus(); 100 | 101 | protected: 102 | 103 | // overrided methods 104 | void mouseDoubleClickEvent( QMouseEvent * event ); 105 | void mousePressEvent( QMouseEvent * event ); 106 | void mouseReleaseEvent( QMouseEvent * event ); 107 | void mouseMoveEvent( QMouseEvent * event ); 108 | 109 | void contextMenuEvent( QContextMenuEvent * event ); 110 | 111 | void paintEvent( QPaintEvent * ); 112 | 113 | private: 114 | 115 | void draw( QPainter & painter ); 116 | void drawMouseMeasure( QPainter & painter ); 117 | 118 | public slots: 119 | 120 | void dropBall(); 121 | void freeKickLeft(); 122 | void freeKickRight(); 123 | void changePlayMode( int mode ); 124 | 125 | signals: 126 | 127 | void dropBall( const QPoint & pos ); 128 | void freeKickLeft( const QPoint & pos ); 129 | void freeKickRight( const QPoint & pos ); 130 | void playModeChanged( int mode, 131 | const QPoint & pos ); 132 | 133 | // void playerMoved( const QPoint & point ); 134 | // void playerSelected( int number ); 135 | 136 | void focusChanged( const QPoint & point ); 137 | void mouseMoved( const QPoint & point ); 138 | 139 | }; 140 | 141 | #endif 142 | -------------------------------------------------------------------------------- /src/field_painter.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file field_painter.h 5 | \brief field painter class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | 13 | This code is free software; you can redistribute it and/or modify 14 | it under the terms of the GNU General Public License as published by 15 | the Free Software Foundation; either version 3, or (at your option) 16 | any later version. 17 | 18 | This code is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | GNU General Public License for more details. 22 | 23 | You should have received a copy of the GNU General Public License 24 | along with this code; see the file COPYING. If not, write to 25 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifndef RCSSMONITOR_FIELD_PAINTER_H 33 | #define RCSSMONITOR_FIELD_PAINTER_H 34 | 35 | #include "painter_interface.h" 36 | 37 | #include 38 | #include 39 | 40 | class DispHolder; 41 | 42 | class FieldPainter 43 | : public PainterInterface { 44 | private: 45 | 46 | const DispHolder & M_disp_holder; 47 | 48 | // not used 49 | FieldPainter() = delete; 50 | FieldPainter( const FieldPainter & ) = delete; 51 | const FieldPainter & operator=( const FieldPainter & ) = delete; 52 | public: 53 | 54 | FieldPainter( DispHolder & disp_holder ); 55 | ~FieldPainter(); 56 | 57 | void draw( QPainter & painter ) override; 58 | 59 | private: 60 | 61 | void drawBackGround( QPainter & painter ) const; 62 | void drawLines( QPainter & painter ) const; 63 | void drawPenaltyAreaLines( QPainter & painter ) const; 64 | void drawGoalAreaLines( QPainter & painter ) const; 65 | void drawGoals( QPainter & painter ) const; 66 | void drawFlags( QPainter & painter ) const; 67 | void drawGrid( QPainter & painter ) const; 68 | }; 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /src/line_2d.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file line_2d.cpp 5 | \brief 2D straight line class Source File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa Akiyama 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 2.1 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifdef HAVE_CONFIG_H 33 | #include 34 | #endif 35 | 36 | #include "line_2d.h" 37 | 38 | #include 39 | 40 | const double Line2D::EPSILON = 1.0e-5; 41 | const double Line2D::ERROR_VALUE = std::numeric_limits< double >::max(); 42 | -------------------------------------------------------------------------------- /src/line_2d.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file line_2d.h 5 | \brief 2D straight line Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa Akiyama 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 2.1 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifndef RCSSMONITOR_LINE2D_H 33 | #define RCSSMONITOR_LINE2D_H 34 | 35 | #include "vector_2d.h" 36 | 37 | #include 38 | 39 | /*! 40 | \class Line2D 41 | \brief 2d straight line class 42 | 43 | Line Fomula: aX + bY + c = 0 44 | */ 45 | class Line2D { 46 | public: 47 | 48 | static const double EPSILON; //! epsilon value 49 | static const double ERROR_VALUE; //! epsilon value 50 | 51 | private: 52 | 53 | double M_a; //!< line fomula A, coefficient for x 54 | double M_b; //!< line fomula B, coefficient for y 55 | double M_c; //!< line fomula constant C 56 | 57 | // never used 58 | Line2D(); 59 | 60 | public: 61 | /*! 62 | \brief construct directly 63 | \param a Line formula A, coefficient for x 64 | \param b Line formula B, coefficient for y 65 | \param c constant C 66 | */ 67 | Line2D( const double & a, 68 | const double & b, 69 | const double & c ) 70 | : M_a( a ) 71 | , M_b( b ) 72 | , M_c( c ) 73 | { } 74 | 75 | /*! 76 | \brief construct from 2 points 77 | \param p1 first point 78 | \param p2 second point 79 | */ 80 | Line2D( const Vector2D & p1, 81 | const Vector2D & p2 ) 82 | { 83 | assign( p1, p2 ); 84 | } 85 | 86 | /*! 87 | \brief construct from origin point + direction 88 | \param origin origin point 89 | \param linedir direction from origin point 90 | */ 91 | Line2D( const Vector2D & origin, 92 | const AngleDeg & linedir ) 93 | { 94 | assign( origin, linedir ); 95 | } 96 | 97 | /*! 98 | \brief construct from 2 points 99 | \param p1 first point 100 | \param p2 second point 101 | \return const reference to itself 102 | */ 103 | const 104 | Line2D & assign( const Vector2D & p1, 105 | const Vector2D & p2 ) 106 | { 107 | M_a = -( p2.y - p1.y ); 108 | M_b = p2.x - p1.x; 109 | M_c = -M_a * p1.x - M_b * p1.y; 110 | return *this; 111 | } 112 | 113 | /*! 114 | \brief construct from origin point + direction 115 | \param origin origin point 116 | \param linedir direction from origin point 117 | \return const reference to itself 118 | */ 119 | const 120 | Line2D & assign( const Vector2D & origin, 121 | const AngleDeg & linedir ) 122 | { 123 | M_a = - linedir.sin(); 124 | M_b = linedir.cos(); 125 | M_c = -M_a * origin.x - M_b * origin.y; 126 | return *this; 127 | } 128 | 129 | /*! 130 | \brief accessor 131 | \return coefficient 'A' of line formula 132 | */ 133 | const 134 | double & a() const 135 | { 136 | return M_a; 137 | } 138 | 139 | /*! 140 | \brief accessor 141 | \return coefficient 'B' of line formula 142 | */ 143 | const 144 | double & b() const 145 | { 146 | return M_b; 147 | } 148 | 149 | /*! 150 | \brief accessor 151 | \return coefficient 'C' of line formula 152 | */ 153 | const 154 | double & c() const 155 | { 156 | return M_c; 157 | } 158 | 159 | /*! 160 | \brief get X-coordinate correspond to 'y' 161 | \param y considered Y 162 | \return X coordinate 163 | */ 164 | double getX( const double & y ) const 165 | { 166 | if ( std::fabs( M_a ) < EPSILON ) 167 | { 168 | return ERROR_VALUE; 169 | } 170 | return -( M_b * y + M_c ) / M_a; 171 | } 172 | 173 | /*! 174 | \brief get Y-coordinate correspond to 'x' 175 | \param x considered X 176 | \return Y coordinate 177 | */ 178 | double getY( const double & x ) const 179 | { 180 | if ( std::fabs( M_b ) < EPSILON ) 181 | { 182 | return ERROR_VALUE; 183 | } 184 | 185 | return -( M_a * x + M_c ) / M_b; 186 | } 187 | 188 | }; 189 | 190 | #endif 191 | -------------------------------------------------------------------------------- /src/log_player.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file log_player.h 5 | \brief log player class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_LOG_PLAYER_H 34 | #define RCSSMONITOR_LOG_PLAYER_H 35 | 36 | #include 37 | 38 | class QTimer; 39 | 40 | class DispHolder; 41 | 42 | class LogPlayer 43 | : public QObject { 44 | 45 | Q_OBJECT 46 | 47 | private: 48 | 49 | DispHolder & M_disp_holder; 50 | 51 | QTimer * M_timer; 52 | 53 | bool M_live_mode; 54 | 55 | // not used 56 | LogPlayer() = delete; 57 | LogPlayer( const LogPlayer & ) = delete; 58 | const LogPlayer & operator=( const LogPlayer & ) = delete; 59 | public: 60 | 61 | LogPlayer( DispHolder & disp_holder, 62 | QObject * parent ); 63 | ~LogPlayer(); 64 | 65 | void clear(); 66 | 67 | bool isLiveMode() const { return M_live_mode; } 68 | 69 | void startTimer(); 70 | 71 | private: 72 | 73 | void stepBackwardImpl(); 74 | void stepForwardImpl(); 75 | 76 | 77 | private slots: 78 | 79 | void handleTimer(); 80 | 81 | public slots: 82 | 83 | void stepBackward(); 84 | void stepForward(); 85 | 86 | void playOrStop( bool play ); 87 | void stop(); 88 | 89 | void playBackward(); 90 | void playForward(); 91 | 92 | void decelerate(); 93 | void accelerate(); 94 | 95 | void goToPreviousScore(); 96 | void goToNextScore(); 97 | 98 | void goToFirst(); 99 | void goToLast(); 100 | 101 | void goToIndex( int index ); 102 | void goToCycle( int cycle ); 103 | 104 | void showLive(); 105 | void setLiveMode(); 106 | 107 | signals: 108 | 109 | void signalPlayOrStop( bool play ); 110 | // void updated(); 111 | void indexUpdated( size_t current, 112 | size_t maximum ); 113 | void quitRequested(); 114 | 115 | }; 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /src/log_player_slider.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file log_slider_tool_bar.cpp 5 | \brief log player slider tool bar class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifdef HAVE_CONFIG_H 34 | #include 35 | #endif 36 | 37 | #include 38 | 39 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) 40 | #include 41 | #else 42 | #include 43 | #endif 44 | 45 | 46 | #include "log_player_slider.h" 47 | 48 | #include 49 | 50 | 51 | /*-------------------------------------------------------------------*/ 52 | /*! 53 | 54 | */ 55 | LogPlayerSlider::LogPlayerSlider( QWidget * parent ) 56 | : QSlider( Qt::Horizontal, parent ) 57 | { 58 | this->setStatusTip( tr( "Cycle Slider." ) ); 59 | this->setToolTip( tr( "Cycle Slider" ) ); 60 | 61 | this->setInvertedControls( true ); 62 | 63 | this->setRange( 0, 0 ); 64 | this->setValue( 1 ); 65 | this->setTickInterval( 1 ); 66 | //M_cycle_slider->setMaximumSize( 640, 640 ); 67 | this->setMinimumWidth( 600 ); 68 | } 69 | 70 | 71 | /*-------------------------------------------------------------------*/ 72 | /*! 73 | 74 | */ 75 | void 76 | LogPlayerSlider::mousePressEvent( QMouseEvent * event ) 77 | { 78 | if ( event->button() == Qt::LeftButton ) 79 | { 80 | double rate = 0; 81 | if ( this->orientation() == Qt::Horizontal ) 82 | { 83 | rate = static_cast< double >( event->pos().x() ) 84 | / static_cast< double >( this->width() ); 85 | 86 | } 87 | else 88 | { 89 | rate = static_cast< double >( this->height() - event->pos().y() ) 90 | / static_cast< double >( this->height() ); 91 | } 92 | 93 | int val = this->minimum() 94 | + static_cast< int >( rint( ( this->maximum() - this->minimum() ) * rate ) ); 95 | 96 | this->setValue( val ); 97 | } 98 | 99 | QSlider::mousePressEvent( event ); 100 | } 101 | 102 | /*-------------------------------------------------------------------*/ 103 | /*! 104 | 105 | */ 106 | void 107 | LogPlayerSlider::changeOrientation( Qt::Orientation orientation ) 108 | { 109 | this->setOrientation( orientation ); 110 | 111 | if ( orientation == Qt::Vertical ) 112 | { 113 | this->setInvertedAppearance( true ); 114 | this->setMinimumSize( 16, 100 ); 115 | this->setMaximumSize( 16, 640 ); 116 | } 117 | else 118 | { 119 | this->setInvertedAppearance( false ); 120 | this->setMinimumSize( 200, 16 ); 121 | this->setMaximumSize( 640, 16 ); 122 | } 123 | } 124 | 125 | /*-------------------------------------------------------------------*/ 126 | /*! 127 | 128 | */ 129 | void 130 | LogPlayerSlider::updateIndex( size_t current, 131 | size_t maximum ) 132 | { 133 | // std::cerr << "Slider updateIndex " << current << " / " << maximum 134 | // << " / slider_pos " << this->sliderPosition() << std::endl; 135 | 136 | if ( this->maximum() != (int)maximum - 1 ) 137 | { 138 | this->setRange( 0, std::max( 1, (int)maximum - 1 ) ); 139 | } 140 | 141 | if ( current != size_t( -1 ) 142 | && this->sliderPosition() != (int)current ) 143 | { 144 | this->setSliderPosition( current ); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /src/log_player_slider.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file log_slider_tool_bar.h 5 | \brief log player slider tool bar class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_LOG_PLAYER_SLIDER_H 34 | #define RCSSMONITOR_LOG_PLAYER_SLIDER_H 35 | 36 | #include 37 | 38 | class LogPlayerSlider 39 | : public QSlider { 40 | 41 | Q_OBJECT 42 | 43 | public: 44 | 45 | LogPlayerSlider( QWidget * parent = 0 ); 46 | 47 | protected: 48 | 49 | void mousePressEvent( QMouseEvent * event ); 50 | 51 | public slots: 52 | 53 | void changeOrientation( Qt::Orientation orientation ); 54 | void updateIndex( size_t current, 55 | size_t maximum ); 56 | 57 | signals: 58 | 59 | void cycleChanged( int cycle ); 60 | 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file main.cpp 5 | \brief main function source file 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 3, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifdef HAVE_CONFIG_H 34 | #include 35 | #endif 36 | 37 | #include 38 | #include 39 | 40 | #include "main_window.h" 41 | #include "options.h" 42 | 43 | #include 44 | #include 45 | 46 | int 47 | main( int argc, 48 | char ** argv ) 49 | { 50 | std::cout << PACKAGE_NAME << "-" << VERSION << "\n\n" 51 | << "Copyright (C) 2009 - 2022 RoboCup Soccer Simulator Maintenance Group.\n" 52 | << std::endl; 53 | 54 | QApplication app( argc, argv ); 55 | QApplication::setApplicationName( PACKAGE_NAME ); 56 | QApplication::setApplicationVersion( VERSION ); 57 | 58 | std::locale::global( std::locale::classic() ); 59 | 60 | if ( ! Options::instance().parseCmdLine( argc, argv ) ) 61 | { 62 | return 1; 63 | } 64 | 65 | MainWindow win; 66 | win.show(); 67 | win.init(); 68 | 69 | return app.exec(); 70 | } 71 | -------------------------------------------------------------------------------- /src/main_window.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file main_window.h 5 | \brief main application window class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_MAIN_WINDOW_H 34 | #define RCSSMONITOR_MAIN_WINDOW_H 35 | 36 | #include 37 | #include 38 | 39 | #include "disp_holder.h" 40 | 41 | class QActionGroup; 42 | class QLabel; 43 | 44 | class ConfigDialog; 45 | class FieldCanvas; 46 | class LogPlayer; 47 | class LogPlayerSlider; 48 | class MonitorClient; 49 | class PlayerTypeDialog; 50 | 51 | class MainWindow 52 | : public QMainWindow { 53 | 54 | Q_OBJECT 55 | 56 | private: 57 | 58 | QString M_window_style; 59 | 60 | DispHolder M_disp_holder; 61 | 62 | QToolBar * M_log_player_tool_bar; 63 | 64 | PlayerTypeDialog * M_player_type_dialog; 65 | ConfigDialog * M_config_dialog; 66 | FieldCanvas * M_field_canvas; 67 | MonitorClient * M_monitor_client; 68 | LogPlayer * M_log_player; 69 | //LogPlayerSlider * M_log_player_slider; 70 | 71 | QLabel * M_position_label; 72 | 73 | // file actions 74 | QAction * M_open_act; 75 | QAction * M_exit_act; 76 | 77 | // monitor actions 78 | QAction * M_connect_monitor_act; 79 | QAction * M_connect_monitor_to_act; 80 | QAction * M_disconnect_monitor_act; 81 | 82 | // referee actions 83 | QAction * M_kick_off_act; 84 | QAction * M_yellow_card_act; 85 | QAction * M_red_card_act; 86 | QActionGroup * M_playmode_change_act_group; 87 | 88 | // logplayer actions 89 | QAction * M_live_mode_act; 90 | QAction * M_log_player_play_or_stop_act; 91 | QAction * M_log_player_step_backward_act; 92 | QAction * M_log_player_step_forward_act; 93 | QAction * M_log_player_decelerate_act; 94 | QAction * M_log_player_accelerate_act; 95 | QAction * M_log_player_previous_score_act; 96 | QAction * M_log_player_next_score_act; 97 | QAction * M_log_player_go_to_first_act; 98 | QAction * M_log_player_go_to_last_act; 99 | 100 | // view actions 101 | QAction * M_toggle_menu_bar_act; 102 | QAction * M_toggle_tool_bar_act; 103 | QAction * M_toggle_status_bar_act; 104 | QAction * M_full_screen_act; 105 | QAction * M_show_player_type_dialog_act; 106 | QActionGroup * M_style_act_group; 107 | QAction * M_show_config_dialog_act; 108 | 109 | // not used 110 | MainWindow( const MainWindow & ) = delete; 111 | const MainWindow & operator=( const MainWindow & ) = delete; 112 | 113 | public: 114 | 115 | MainWindow(); 116 | ~MainWindow(); 117 | 118 | void init(); 119 | 120 | private: 121 | 122 | void readSettings(); 123 | void writeSettings(); 124 | 125 | void createActions(); 126 | void createActionsFile(); 127 | void createActionsMonitor(); 128 | void createActionsReferee(); 129 | void createActionsLogPlayer(); 130 | void createActionsView(); 131 | void createActionsHelp(); 132 | 133 | void createMenus(); 134 | void createMenuFile(); 135 | void createMenuMonitor(); 136 | void createMenuReferee(); 137 | void createMenuView(); 138 | void createMenuHelp(); 139 | 140 | void createToolBars(); 141 | void createStatusBar(); 142 | 143 | void createFieldCanvas(); 144 | void createConfigDialog(); 145 | 146 | protected: 147 | 148 | // overrided methods 149 | void closeEvent( QCloseEvent * event ); 150 | // void resizeEvent( QResizeEvent * event ); 151 | void wheelEvent( QWheelEvent * event ); 152 | 153 | // void dragEnterEvent( QDragEnterEvent * event ); 154 | // void dropEvent( QDropEvent * event ); 155 | 156 | private: 157 | 158 | void openGameLogFile( const QString & filepath ); 159 | bool openGameLogFileImpl( const QString & filepath ); 160 | 161 | void connectMonitorTo( const char * hostname ); 162 | 163 | private slots: 164 | 165 | void about(); 166 | void printShortcutKeys(); 167 | 168 | void setQuitTimer(); 169 | 170 | // file menu action slots 171 | void openGameLogFile(); 172 | 173 | // monitor menu action slots 174 | void kickOff(); 175 | void connectMonitor(); // connect to the host given by command lien or localhost 176 | void connectMonitorTo(); // open host input dialog 177 | void disconnectMonitor(); 178 | void reconnectMonitor(); 179 | 180 | // view menu actions slots 181 | void toggleMenuBar( bool checked ); 182 | void toggleToolBar( bool checked ); 183 | void toggleStatusBar( bool checked ); 184 | void toggleFullScreen(); 185 | void showPlayerTypeDialog(); 186 | void changeStyle( bool checked ); 187 | void showConfigDialog(); 188 | void setFocusPoint( const QPoint & point ); 189 | 190 | // context menu action slots 191 | void dropBall( const QPoint & pos ); 192 | void freeKickLeft( const QPoint & pos ); 193 | void freeKickRight( const QPoint & pos ); 194 | void yellowCard( const char side, 195 | const int unum ); 196 | void redCard( const char side, 197 | const int unum ); 198 | void yellowCard(); 199 | void redCard(); 200 | void changePlayMode( const int mode ); 201 | void changePlayMode( const int mode, 202 | const QPoint & point ); 203 | 204 | // 205 | void receiveMonitorPacket(); 206 | void resizeCanvas( const QSize & size ); 207 | void updatePositionLabel( const QPoint & point ); 208 | 209 | // 210 | void setLiveMode(); 211 | void togglePlayOrStopIcon( bool checked ); 212 | 213 | signals: 214 | 215 | void viewUpdated(); 216 | 217 | }; 218 | 219 | #endif 220 | -------------------------------------------------------------------------------- /src/monitor_client.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file monitor_client.h 5 | \brief Monitor Client class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 3, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_MONITOR_CLIENT_H 34 | #define RCSSMONITOR_MONITOR_CLIENT_H 35 | 36 | #include 37 | #include 38 | 39 | #include 40 | 41 | class QHostInfo; 42 | class QTimer; 43 | class QUdpSocket; 44 | class DispHolder; 45 | 46 | class MonitorClient 47 | : public QObject { 48 | 49 | Q_OBJECT 50 | 51 | private: 52 | 53 | DispHolder & M_disp_holder; 54 | 55 | QHostAddress M_server_addr; 56 | quint16 M_server_port; 57 | QUdpSocket * M_socket; 58 | QTimer * M_timer; 59 | 60 | int M_version; //!< protocol version 61 | 62 | int M_waited_msec; 63 | 64 | 65 | //! not used 66 | MonitorClient() = delete; 67 | MonitorClient( const MonitorClient & ) = delete; 68 | MonitorClient & operator=( const MonitorClient & ) = delete; 69 | public: 70 | //! constructor 71 | MonitorClient( QObject * parent, 72 | DispHolder & disp_holder, 73 | const char * hostname, 74 | const int port, 75 | const int version ); 76 | 77 | ~MonitorClient(); 78 | 79 | void disconnect(); 80 | 81 | bool isConnected() const; 82 | 83 | private: 84 | 85 | void sendCommand( const std::string & com ); 86 | 87 | public: 88 | 89 | // monitor command 90 | 91 | void sendDispInit(); 92 | void sendDispBye(); 93 | void sendKickOff(); 94 | void sendFreeKick( const double & x, 95 | const double & y, 96 | const rcss::rcg::Side side ); 97 | void sendDropBall( const double & x, 98 | const double & y ) 99 | { 100 | sendFreeKick( x, y, rcss::rcg::NEUTRAL ); 101 | } 102 | void sendFreeKickLeft( const double & x, 103 | const double & y ) 104 | { 105 | sendFreeKick( x, y, rcss::rcg::LEFT ); 106 | } 107 | void sendFreeKickRight( const double & x, 108 | const double & y ) 109 | { 110 | sendFreeKick( x, y, rcss::rcg::RIGHT ); 111 | } 112 | 113 | void sendMove( const rcss::rcg::Side side, 114 | const int unum, 115 | const double & x, 116 | const double & y, 117 | const double & angle ); 118 | 119 | void sendDiscard( const rcss::rcg::Side side, 120 | const int unum ); 121 | 122 | void sendYellowCard( const rcss::rcg::Side side, 123 | const int unum ); 124 | void sendRedCard( const rcss::rcg::Side side, 125 | const int unum ); 126 | 127 | 128 | // trainer command 129 | 130 | void sendChangeMode( const rcss::rcg::PlayMode pmode ); 131 | 132 | void sendTrainerMoveBall( const double & x, 133 | const double & y ); 134 | 135 | void sendTrainerMoveBall( const double & x, 136 | const double & y, 137 | const double & vx, 138 | const double & vy ); 139 | 140 | void sendTrainerMovePlayer( const std::string & team_name, 141 | const int unum, 142 | const double & x, 143 | const double & y ); 144 | void sendTrainerMovePlayer( const std::string & team_name, 145 | const int unum, 146 | const double & x, 147 | const double & y, 148 | const double & angle ); 149 | void sendTrainerMovePlayer( const std::string & team_name, 150 | const int unum, 151 | const double & x, 152 | const double & y, 153 | const double & angle, 154 | const double & vx, 155 | const double & vy ); 156 | 157 | 158 | void sendRecover(); 159 | 160 | void sencChangePlayerType( const std::string & team_name, 161 | const int unum, 162 | const int type ); 163 | 164 | void sendCheckBal(); 165 | 166 | private slots: 167 | 168 | void handleReceive(); 169 | void handleTimer(); 170 | 171 | signals: 172 | 173 | void received(); 174 | void disconnectRequested(); 175 | void reconnectRequested(); 176 | 177 | }; 178 | 179 | #endif 180 | -------------------------------------------------------------------------------- /src/mouse_state.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file mouse_state.h 5 | \brief mouse state class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_MOUSE_STATE_H 34 | #define RCSSMONITOR_MOUSE_STATE_H 35 | 36 | #include 37 | 38 | #include 39 | 40 | class MouseState { 41 | private: 42 | 43 | bool M_pressed; 44 | bool M_menu_failed; 45 | QPoint M_pressed_point; 46 | QPoint M_dragged_point; 47 | 48 | public: 49 | MouseState() 50 | : M_pressed( false ) 51 | , M_menu_failed( false ) 52 | , M_pressed_point( 0, 0 ) 53 | , M_dragged_point( 0, 0 ) 54 | { } 55 | 56 | 57 | void pressed( const QPoint & point ) 58 | { 59 | M_pressed = true; 60 | M_pressed_point = M_dragged_point = point; 61 | } 62 | 63 | void released() 64 | { 65 | M_pressed = false; 66 | } 67 | 68 | void setMenuFailed( const bool value ) 69 | { 70 | M_menu_failed = value; 71 | } 72 | 73 | void moved( const QPoint & point ) 74 | { 75 | if ( M_pressed ) 76 | { 77 | M_dragged_point = point; 78 | } 79 | } 80 | 81 | bool isPressed() const 82 | { 83 | return M_pressed; 84 | } 85 | 86 | bool isMenuFailed() const 87 | { 88 | return M_menu_failed; 89 | } 90 | 91 | const 92 | QPoint & pressedPoint() const 93 | { 94 | return M_pressed_point; 95 | } 96 | 97 | const 98 | QPoint & draggedPoint() const 99 | { 100 | return M_dragged_point; 101 | } 102 | 103 | bool isDragged() const 104 | { 105 | return ( M_pressed 106 | && ( std::abs( M_pressed_point.x() - M_dragged_point.x() ) > 2 107 | || std::abs( M_pressed_point.y() - M_dragged_point.y() ) > 2 ) 108 | ); 109 | } 110 | 111 | }; 112 | 113 | #endif 114 | -------------------------------------------------------------------------------- /src/painter_interface.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file painer_interface.h 5 | \brief painter interface class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 3, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_PAINTER_INTERFADE_H 34 | #define RCSSMONITOR_PAINTER_INTERFADE_H 35 | 36 | class QPainter; 37 | 38 | class PainterInterface { 39 | protected: 40 | 41 | PainterInterface() 42 | { } 43 | 44 | virtual 45 | ~PainterInterface() 46 | { } 47 | 48 | public: 49 | 50 | virtual 51 | void draw( QPainter & painter ) = 0; 52 | 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/player_painter.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file player_painer.h 5 | \brief player painter class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_PLAYER_PAINTER_H 34 | #define RCSSMONITOR_PLAYER_PAINTER_H 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #include "painter_interface.h" 41 | 42 | #include 43 | 44 | class QPainter; 45 | class QPixmap; 46 | 47 | class DispHolder; 48 | 49 | class PlayerPainter 50 | : public PainterInterface { 51 | private: 52 | 53 | struct Param { 54 | int x_; //!< screen X coordinates 55 | int y_; //!< screen Y coordinates 56 | int body_radius_; //!< pixel body radius 57 | int kick_radius_; //!< pixel kick area radius 58 | int draw_radius_; //!< pixel main draw radius. 59 | //bool have_full_effort_; //!< flag to check effort value 60 | const rcss::rcg::PlayerT & player_; 61 | const rcss::rcg::BallT & ball_; 62 | const rcss::rcg::PlayerTypeT & player_type_; 63 | 64 | Param( const rcss::rcg::PlayerT & player, 65 | const rcss::rcg::BallT & ball, 66 | const rcss::rcg::ServerParamT & sparam, 67 | const rcss::rcg::PlayerTypeT & ptype ); 68 | private: 69 | //! not used 70 | Param() = delete; 71 | }; 72 | 73 | 74 | const DispHolder & M_disp_holder; 75 | 76 | // not used 77 | PlayerPainter() = delete; 78 | PlayerPainter( const PlayerPainter & ) = delete; 79 | const PlayerPainter operator=( const PlayerPainter & ) = delete; 80 | public: 81 | 82 | explicit 83 | PlayerPainter( const DispHolder & disp_holder ); 84 | 85 | ~PlayerPainter(); 86 | 87 | void draw( QPainter & dc ) override; 88 | 89 | private: 90 | 91 | void drawAll( QPainter & painter, 92 | const rcss::rcg::PlayerT & player, 93 | const rcss::rcg::BallT & ball ) const; 94 | void drawBody( QPainter & painter, 95 | const PlayerPainter::Param & param ) const; 96 | void drawDir( QPainter & painter, 97 | const PlayerPainter::Param & param ) const; 98 | void drawViewArea( QPainter & painter, 99 | const PlayerPainter::Param & param ) const; 100 | void drawFocusPoint( QPainter & painter, 101 | const PlayerPainter::Param & param ) const; 102 | void drawCatchArea( QPainter & painter, 103 | const PlayerPainter::Param & param ) const; 104 | void drawTackleArea( QPainter & painter, 105 | const PlayerPainter::Param & param ) const; 106 | void drawPointto( QPainter & painter, 107 | const PlayerPainter::Param & param ) const; 108 | void drawKickAccelArea( QPainter & painter, 109 | const PlayerPainter::Param & param ) const; 110 | void drawText( QPainter & painter, 111 | const PlayerPainter::Param & param ) const; 112 | 113 | void drawOffsideLine( QPainter & painter, 114 | const rcss::rcg::ShowInfoT & show ) const; 115 | 116 | }; 117 | 118 | #endif 119 | -------------------------------------------------------------------------------- /src/player_type_dialog.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file player_type_dialog.h 5 | \brief player type list dialog class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_PLAYER_TYPE_DIALOG_H 34 | #define RCSSMONITOR_PLAYER_TYPE_DIALOG_H 35 | 36 | #include 37 | 38 | class QAbstractItemModel; 39 | class QShowEvent; 40 | class QStandardItemModel; 41 | class QTableView; 42 | class QWheelEvent; 43 | 44 | class DispHolder; 45 | 46 | //! movable objects detail info dialog 47 | class PlayerTypeDialog 48 | : public QDialog { 49 | 50 | Q_OBJECT 51 | 52 | private: 53 | 54 | const DispHolder & M_disp_holder; 55 | 56 | QStandardItemModel * M_model; 57 | QTableView * M_item_view; 58 | 59 | // not used 60 | PlayerTypeDialog() = delete; 61 | PlayerTypeDialog( const PlayerTypeDialog & ) = delete; 62 | const PlayerTypeDialog & operator=( const PlayerTypeDialog & ) = delete; 63 | 64 | public: 65 | //! constructor 66 | PlayerTypeDialog( const DispHolder & disp_holder, 67 | QWidget * parent ); 68 | 69 | 70 | ~PlayerTypeDialog(); 71 | 72 | private: 73 | 74 | void createTable(); 75 | void createModel(); 76 | 77 | void adjustSize(); 78 | 79 | protected: 80 | 81 | void showEvent( QShowEvent * event ); 82 | void wheelEvent( QWheelEvent * event ); 83 | 84 | public slots: 85 | 86 | void updateData(); 87 | 88 | }; 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /src/rcg_handler.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file rcg_handler.cpp 5 | \brief display data holder class Source File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 3, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifdef HAVE_CONFIG_H 34 | #include 35 | #endif 36 | 37 | #include "rcg_handler.h" 38 | 39 | #include "rcss/rcg/util.h" 40 | #include "disp_holder.h" 41 | 42 | #include 43 | 44 | #include 45 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) 46 | #include 47 | #else 48 | #include 49 | #endif 50 | 51 | #ifdef HAVE_ARPA_INET_H 52 | #include 53 | #endif 54 | #ifdef HAVE_WINDOWS_H 55 | #include 56 | #endif 57 | 58 | /*-------------------------------------------------------------------*/ 59 | RCGHandler::RCGHandler( QWidget * parent, 60 | DispHolder & holder ) 61 | : M_holder( holder ), 62 | M_progress( nullptr ) 63 | 64 | { 65 | if ( parent ) 66 | { 67 | M_progress = new QProgressDialog( parent ); 68 | M_progress->setWindowTitle( QObject::tr( "parsing a game log file..." ) ); 69 | M_progress->setRange( 0, 6000 ); 70 | M_progress->setValue( 0 ); 71 | M_progress->setLabelText( QObject::tr( "Time: 0" ) ); 72 | M_progress->setCancelButton( 0 ); // no cancel button 73 | M_progress->setMinimumDuration( 0 ); // no duration 74 | } 75 | } 76 | 77 | /*-------------------------------------------------------------------*/ 78 | RCGHandler::~RCGHandler() 79 | { 80 | if ( M_progress ) 81 | { 82 | delete M_progress; 83 | M_progress = nullptr; 84 | } 85 | } 86 | 87 | /*-------------------------------------------------------------------*/ 88 | bool 89 | RCGHandler::handleEOF() 90 | { 91 | return M_holder.handleEOF(); 92 | } 93 | 94 | /*-------------------------------------------------------------------*/ 95 | bool 96 | RCGHandler::handleShow( const rcss::rcg::ShowInfoT & show ) 97 | { 98 | if ( M_progress ) 99 | { 100 | if ( show.time_ % 32 == 1 ) 101 | { 102 | if ( ! M_holder.dispCont().empty() ) 103 | { 104 | int time = M_holder.dispCont().back()->show_.time_; 105 | if ( time > M_progress->maximum() ) 106 | { 107 | M_progress->setMaximum( M_progress->maximum() + 6000 ); 108 | } 109 | M_progress->setValue( time ); 110 | M_progress->setLabelText( QString( "Time: %1" ).arg( time ) ); 111 | } 112 | } 113 | 114 | if ( show.time_ % 512 == 1 ) 115 | { 116 | qApp->processEvents(); 117 | std::fprintf( stdout, "parsing... %d\r", show.time_ ); 118 | std::fflush( stdout ); 119 | } 120 | } 121 | 122 | return M_holder.handleShow( show ); 123 | } 124 | 125 | /*-------------------------------------------------------------------*/ 126 | bool 127 | RCGHandler::handlePlayMode( const int time, 128 | const rcss::rcg::PlayMode pmode ) 129 | { 130 | return M_holder.handlePlayMode( time, pmode ); 131 | } 132 | 133 | /*-------------------------------------------------------------------*/ 134 | bool 135 | RCGHandler::handleTeam( const int time, 136 | const rcss::rcg::TeamT & team_l, 137 | const rcss::rcg::TeamT & team_r ) 138 | { 139 | return M_holder.handleTeam( time, team_l, team_r ); 140 | } 141 | 142 | /*-------------------------------------------------------------------*/ 143 | bool 144 | RCGHandler::handleMsg( const int time, 145 | const int board, 146 | const std::string & msg ) 147 | { 148 | return M_holder.handleMsg( time, board, msg ); 149 | } 150 | 151 | /*-------------------------------------------------------------------*/ 152 | bool 153 | RCGHandler::handleDraw( const int time, 154 | const rcss::rcg::drawinfo_t & draw ) 155 | { 156 | switch ( ntohs( draw.mode ) ) { 157 | case rcss::rcg::DrawClear: 158 | M_holder.handleDrawClear( time ); 159 | return true; 160 | 161 | case rcss::rcg::DrawPoint: 162 | M_holder.handleDrawPoint( time, 163 | rcss::rcg::PointT( rcss::rcg::nstohf( draw.object.pinfo.x ), 164 | rcss::rcg::nstohf( draw.object.pinfo.y ), 165 | draw.object.pinfo.color ) ); 166 | return true; 167 | case rcss::rcg::DrawCircle: 168 | M_holder.handleDrawCircle( time, 169 | rcss::rcg::CircleT( rcss::rcg::nstohf( draw.object.cinfo.x ), 170 | rcss::rcg::nstohf( draw.object.cinfo.y ), 171 | rcss::rcg::nstohf( draw.object.cinfo.r ), 172 | draw.object.cinfo.color ) ); 173 | return true; 174 | case rcss::rcg::DrawLine: 175 | M_holder.handleDrawLine( time, 176 | rcss::rcg::LineT( rcss::rcg::nstohf( draw.object.linfo.x1 ), 177 | rcss::rcg::nstohf( draw.object.linfo.y1 ), 178 | rcss::rcg::nstohf( draw.object.linfo.x2 ), 179 | rcss::rcg::nstohf( draw.object.linfo.y2 ), 180 | draw.object.linfo.color ) ); 181 | return true; 182 | default: 183 | std::cerr << "(RCGHandler::handleDraw) Unknown draw mode " << ntohs( draw.mode ) 184 | << std::endl; 185 | return false; 186 | } 187 | 188 | return true; 189 | } 190 | 191 | /*-------------------------------------------------------------------*/ 192 | bool 193 | RCGHandler::handleServerParam( const rcss::rcg::ServerParamT & sparam ) 194 | { 195 | return M_holder.handleServerParam( sparam ); 196 | } 197 | 198 | /*-------------------------------------------------------------------*/ 199 | bool 200 | RCGHandler::handlePlayerParam( const rcss::rcg::PlayerParamT & pparam ) 201 | { 202 | return M_holder.handlePlayerParam( pparam ); 203 | } 204 | 205 | /*-------------------------------------------------------------------*/ 206 | bool 207 | RCGHandler::handlePlayerType( const rcss::rcg::PlayerTypeT & ptype ) 208 | { 209 | return M_holder.handlePlayerType( ptype ); 210 | } 211 | 212 | /*-------------------------------------------------------------------*/ 213 | bool 214 | RCGHandler::handleTeamGraphic( const char side, 215 | const int x, 216 | const int y, 217 | const std::vector< std::string > & xpm_tile ) 218 | { 219 | return M_holder.handleTeamGraphic( side, x, y, xpm_tile ); 220 | } 221 | -------------------------------------------------------------------------------- /src/rcg_handler.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file rcg_handler.h 5 | \brief rcg handler class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 3, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_RCG_HANDLER_H 34 | #define RCSSMONITOR_RCG_HANDLER_H 35 | 36 | #include 37 | #include 38 | 39 | class QWidget; 40 | class QProgressDialog; 41 | class DispHolder; 42 | 43 | class RCGHandler 44 | : public rcss::rcg::Handler { 45 | private: 46 | 47 | DispHolder & M_holder; 48 | 49 | QProgressDialog * M_progress; 50 | 51 | // not used 52 | RCGHandler( const RCGHandler & ) = delete; 53 | RCGHandler operator=( const RCGHandler & ) = delete; 54 | 55 | public: 56 | 57 | RCGHandler( QWidget * parent, 58 | DispHolder & holder ); 59 | ~RCGHandler(); 60 | 61 | protected: 62 | 63 | bool handleEOF() override; 64 | bool handleShow( const rcss::rcg::ShowInfoT & show ) override; 65 | bool handlePlayMode( const int time, 66 | const rcss::rcg::PlayMode pmode ) override; 67 | bool handleTeam( const int time, 68 | const rcss::rcg::TeamT & team_l, 69 | const rcss::rcg::TeamT & team_r ) override; 70 | bool handleMsg( const int time, 71 | const int board, 72 | const std::string & msg ) override; 73 | bool handleDraw( const int time, 74 | const rcss::rcg::drawinfo_t & draw ) override; 75 | bool handleServerParam( const rcss::rcg::ServerParamT & sparam ) override; 76 | bool handlePlayerParam( const rcss::rcg::PlayerParamT & pparam ) override; 77 | bool handlePlayerType( const rcss::rcg::PlayerTypeT & ptype ) override; 78 | bool handleTeamGraphic( const char side, 79 | const int x, 80 | const int y, 81 | const std::vector< std::string > & xpm_data ) override; 82 | }; 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /src/rcsslogplayer/handler.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file handler.h 5 | \brief Class for handring rcg data 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or 15 | modify it under the terms of the GNU Lesser General Public 16 | License as published by the Free Software Foundation; either 17 | version 2.1 of the License, or (at your option) any later version. 18 | 19 | This library is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | Lesser General Public License for more details. 23 | 24 | You should have received a copy of the GNU Lesser General Public 25 | License along with this library; if not, write to the Free Software 26 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSLOGPLAYER_HANDLER_H 34 | #define RCSSLOGPLAYER_HANDLER_H 35 | 36 | #include 37 | 38 | #include 39 | 40 | namespace rcss { 41 | namespace rcg { 42 | 43 | /*! 44 | class Handler 45 | \brief abstract rcg data handler 46 | */ 47 | class Handler { 48 | protected: 49 | Handler() 50 | { } 51 | 52 | public: 53 | 54 | virtual 55 | ~Handler() 56 | { } 57 | 58 | private: 59 | friend class Parser; 60 | 61 | void handleLogVersion( int ver ) 62 | { 63 | doHandleLogVersion( ver ); 64 | } 65 | 66 | int getLogVersion() const 67 | { 68 | return doGetLogVersion(); 69 | } 70 | 71 | void handleShowInfo( const ShowInfoT & info ) 72 | { 73 | doHandleShowInfo( info ); 74 | } 75 | 76 | void handleMsgInfo( const int time, 77 | const int board, 78 | const std::string & msg ) 79 | { 80 | doHandleMsgInfo( time, board, msg ); 81 | } 82 | 83 | void handlePlayMode( const int time, 84 | const PlayMode playmode ) 85 | { 86 | doHandlePlayMode( time, playmode ); 87 | } 88 | 89 | void handleTeamInfo( const int time, 90 | const TeamT & team_l, 91 | const TeamT & team_r ) 92 | { 93 | doHandleTeamInfo( time, team_l, team_r ); 94 | } 95 | 96 | void handleDrawClear( const int time ) 97 | { 98 | doHandleDrawClear( time ); 99 | } 100 | 101 | void handleDrawPointInfo( const int time, 102 | const PointInfoT & p ) 103 | { 104 | doHandleDrawPointInfo( time, p ); 105 | } 106 | 107 | void handleDrawCircleInfo( const int time, 108 | const CircleInfoT & c ) 109 | { 110 | doHandleDrawCircleInfo( time, c ); 111 | } 112 | 113 | void handleDrawLineInfo( const int time, 114 | const LineInfoT & l ) 115 | { 116 | doHandleDrawLineInfo( time, l ); 117 | } 118 | 119 | void handleServerParam( const ServerParamT & param ) 120 | { 121 | doHandleServerParam( param ); 122 | } 123 | 124 | void handlePlayerParam( const PlayerParamT & param ) 125 | { 126 | doHandlePlayerParam( param ); 127 | } 128 | 129 | void handlePlayerType( const PlayerTypeT & type ) 130 | { 131 | doHandlePlayerType( type ); 132 | } 133 | 134 | void handleEOF() 135 | { 136 | doHandleEOF(); 137 | } 138 | 139 | protected: 140 | virtual 141 | void doHandleLogVersion( int ver ) = 0; 142 | 143 | virtual 144 | int doGetLogVersion() const = 0; 145 | 146 | virtual 147 | void doHandleShowInfo( const ShowInfoT & ) = 0; 148 | 149 | virtual 150 | void doHandleMsgInfo( const int, 151 | const int, 152 | const std::string & ) = 0; 153 | 154 | virtual 155 | void doHandlePlayMode( const int, 156 | const PlayMode ) = 0; 157 | 158 | virtual 159 | void doHandleTeamInfo( const int, 160 | const TeamT &, 161 | const TeamT & ) = 0; 162 | 163 | virtual 164 | void doHandleDrawClear( const int ) = 0; 165 | 166 | virtual 167 | void doHandleDrawPointInfo( const int, 168 | const PointInfoT & ) = 0; 169 | 170 | virtual 171 | void doHandleDrawCircleInfo( const int, 172 | const CircleInfoT & ) = 0; 173 | 174 | virtual 175 | void doHandleDrawLineInfo( const int, 176 | const LineInfoT & ) = 0; 177 | 178 | virtual 179 | void doHandleServerParam( const ServerParamT & ) = 0; 180 | 181 | virtual 182 | void doHandlePlayerParam( const PlayerParamT & ) = 0; 183 | 184 | virtual 185 | void doHandlePlayerType( const PlayerTypeT & ) = 0; 186 | 187 | virtual 188 | void doHandleEOF() = 0; 189 | 190 | }; 191 | 192 | } 193 | } 194 | 195 | #endif 196 | -------------------------------------------------------------------------------- /src/rcsslogplayer/parser.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file rcgparser.h 5 | \brief Class for parsing rcg files 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or 15 | modify it under the terms of the GNU Lesser General Public 16 | License as published by the Free Software Foundation; either 17 | version 2.1 of the License, or (at your option) any later version. 18 | 19 | This library is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | Lesser General Public License for more details. 23 | 24 | You should have received a copy of the GNU Lesser General Public 25 | License along with this library; if not, write to the Free Software 26 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSLOGPLAYER_RCG_PARSER_H 34 | #define RCSSLOGPLAYER_RCG_PARSER_H 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | 41 | namespace rcss { 42 | namespace rcg { 43 | 44 | class Handler; 45 | 46 | /*! 47 | class Parser 48 | \brief rcg parser 49 | */ 50 | class Parser { 51 | private: 52 | 53 | //! reference to the data handler instance 54 | Handler & M_handler; 55 | 56 | bool M_safe_mode; //!< if this variable is true, parser uses safety but slow algorithm. 57 | bool M_header_parsed; //!< flag to determin whether the header data is parsed or not 58 | int M_line_count; //!< total number of parsed line. This variable is used only for v4+ log. 59 | int M_time; //!< current time 60 | 61 | // not used 62 | Parser() = delete; 63 | Parser( const Parser & ) = delete; 64 | Parser & operator=( const Parser & ) = delete; 65 | 66 | public: 67 | /*! 68 | \brief construct parser object with data handler class 69 | \param handler reference to the handler class instance 70 | */ 71 | explicit 72 | Parser( Handler & handler ); 73 | 74 | /*! 75 | \brief destructor 76 | */ 77 | ~Parser() 78 | { } 79 | 80 | /*! 81 | \brief analyze rcg data from input stream 82 | \param is reference to the imput stream 83 | \return true if successfuly parsed. 84 | */ 85 | bool parse( std::istream & is ); 86 | 87 | /*! 88 | \brief set safety parsing mode. 89 | \param on if this value is true, parser uses safety but slow algorithm. 90 | */ 91 | void setSafeMode( const bool on ) 92 | { 93 | M_safe_mode = on; 94 | } 95 | 96 | private: 97 | 98 | bool parseHeader( std::istream & is ); 99 | 100 | // 101 | // version 3 or older 102 | // 103 | 104 | bool parseData( std::istream & is ); 105 | 106 | bool parseDispInfo( std::istream & is ); 107 | bool parseMode( std::istream & is ); 108 | bool parseItem( std::istream & is, 109 | const Int16 mode ); 110 | bool parseShowInfo( std::istream & is ); 111 | bool parseMsgInfo( std::istream & is ); 112 | bool parseDrawInfo( std::istream & is ); 113 | bool parseDrawInfo( const std::streampos pos, 114 | const drawinfo_t & draw ); 115 | bool parsePlayMode( std::istream & is ); 116 | bool parseTeamInfo( std::istream & is ); 117 | bool parsePlayerType( std::istream & is ); 118 | bool parsePlayerParam( std::istream & is ); 119 | bool parseServerParam( std::istream & is ); 120 | 121 | // 122 | // version 4 123 | // 124 | 125 | bool parseLine( std::istream & is ); 126 | public: 127 | // can be used by monitor client 128 | bool parseLine( const int n_line, 129 | const std::string & line ); 130 | private: 131 | bool parseShowLine( const int n_line, 132 | const std::string & line ); 133 | bool parseDrawLine( const int n_line, 134 | const std::string & line ); 135 | bool parseMsgLine( const int n_line, 136 | const std::string & line ); 137 | bool parsePlayModeLine( const int n_line, 138 | const std::string & line ); 139 | bool parseTeamLine( const int n_line, 140 | const std::string & line ); 141 | bool parsePlayerTypeLine( const int n_line, 142 | const std::string & line ); 143 | bool parsePlayerParamLine( const int n_line, 144 | const std::string & line ); 145 | bool parseServerParamLine( const int n_line, 146 | const std::string & line ); 147 | 148 | // 149 | // common 150 | // 151 | 152 | bool strmErr( std::istream & is ); 153 | 154 | }; 155 | 156 | } 157 | } 158 | 159 | #endif 160 | -------------------------------------------------------------------------------- /src/rcsslogplayer/rcsslogplayer.pro: -------------------------------------------------------------------------------- 1 | 2 | TEMPLATE = lib 3 | TARGET = rcssrcgparser 4 | DESTDIR = ../lib 5 | DEPENDPATH += . 6 | 7 | INCLUDEPATH += . .. 8 | win32 { 9 | INCLUDEPATH += ../../zlib123-dll/include 10 | INCLUDEPATH += ../../boost 11 | } 12 | unix { 13 | INCLUDEPATH += /opt/local/include 14 | } 15 | macx { 16 | INCLUDEPATH += /opt/local/include 17 | } 18 | 19 | LIBS += 20 | 21 | DEFINES += HAVE_LIBZ 22 | win32 { 23 | DEFINES += HAVE_WINDOWS_H 24 | } 25 | unix { 26 | DEFINES += HAVE_NETINET_IN_H 27 | } 28 | macx { 29 | DEFINES += HAVE_NETINET_IN_H 30 | } 31 | 32 | CONFIG += staticlib warn_on release 33 | 34 | #QMAKE_LFLAGS_DEBUG += -static 35 | #QMAKE_LFLAGS_DEBUG += -pg 36 | #QMAKE_CFLAGS_DEBUG += -pg -static -DQABSTRACTSOCKET_DEBUG 37 | #QMAKE_CXXFLAGS_DEBUG += -pg -static -DQABSTRACTSOCKET_DEBUG 38 | 39 | # Input 40 | HEADERS += \ 41 | gzfstream.h \ 42 | handler.h \ 43 | parser.h \ 44 | types.h \ 45 | util.h 46 | 47 | SOURCES += \ 48 | gzfstream.cpp \ 49 | parser.cpp \ 50 | types.cpp \ 51 | util.cpp 52 | -------------------------------------------------------------------------------- /src/rcssmonitor.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "../icons/rcss.ico" 2 | -------------------------------------------------------------------------------- /src/score_board_painter.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file score_board_painter.h 5 | \brief score board painter class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa Akiyama 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_SCORE_BOARD_PAINTER_H 34 | #define RCSSMONITOR_SCORE_BOARD_PAINTER_H 35 | 36 | #include "painter_interface.h" 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | class DispHolder; 43 | 44 | class ScoreBoardPainter 45 | : public PainterInterface { 46 | private: 47 | 48 | const DispHolder & M_disp_holder; 49 | 50 | // not used 51 | ScoreBoardPainter() = delete; 52 | ScoreBoardPainter( const ScoreBoardPainter & ) = delete; 53 | const ScoreBoardPainter & operator=( const ScoreBoardPainter & ) = delete; 54 | public: 55 | 56 | explicit 57 | ScoreBoardPainter( const DispHolder & disp_holder ); 58 | ~ScoreBoardPainter(); 59 | 60 | void draw( QPainter & painter ) override; 61 | 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/src.pro: -------------------------------------------------------------------------------- 1 | QT += core gui widgets network 2 | TEMPLATE = app 3 | TARGET = rcssmonitor 4 | DESTDIR = ../bin 5 | 6 | DEPENDPATH += . 7 | 8 | INCLUDEPATH += . .. 9 | win32 { 10 | INCLUDEPATH += c:/Qt/boost-include 11 | } 12 | unix { 13 | 14 | } 15 | macx-g++ { 16 | INCLUDEPATH += /opt/local/include 17 | } 18 | 19 | win32 { 20 | # LIBS += ../../zlib123-dll/zlib1.dll -lwsock32 21 | # LIBS += c:/MinGW/boost-lib/libboost_program_options-mgw34-mt.lib 22 | # LIBS += c:/Qt/boost-lib/boost_program_options-mgw44-mt-1_42.dll 23 | # LIBS += -lwsock3 24 | LIBS += C:/Qt/Tools/mingw730_64/x86_64-w64-mingw32/lib/libz.a 25 | } 26 | unix { 27 | LIBS += -lboost_program_options -lboost_system -lz 28 | } 29 | macx-g++ { 30 | LIBS += -L/opt/local/lib 31 | LIBS += -lboost_program_options-mt -lz 32 | } 33 | 34 | DEFINES += PACKAGE="\\\"rcssmonitor\\\"" 35 | DEFINES += PACKAGE_NAME="\\\"rcssmonitor\\\"" 36 | DEFINES += VERSION="\\\"16.0.0\\\"" 37 | 38 | DEFINES += HAVE_LIBZ 39 | win32 { 40 | 41 | } 42 | unix { 43 | DEFINES += HAVE_NETINET_IN_H 44 | DEFINES += HAVE_BOOST_PROGRAM_OPTIONS 45 | } 46 | macx-g++ { 47 | DEFINES += HAVE_NETINET_IN_H 48 | DEFINES += HAVE_BOOST_PROGRAM_OPTIONS 49 | } 50 | 51 | CONFIG += qt c++14 warn_on release 52 | win32 { 53 | CONFIG += windows 54 | } 55 | 56 | #QMAKE_LFLAGS_DEBUG += -static 57 | #QMAKE_LFLAGS_DEBUG += -pg 58 | #QMAKE_CFLAGS_DEBUG += -pg -static -DQABSTRACTSOCKET_DEBUG 59 | #QMAKE_CXXFLAGS += -static 60 | #QMAKE_CXXFLAGS_DEBUG += -pg -static -DQABSTRACTSOCKET_DEBUG 61 | 62 | # Input 63 | HEADERS += \ 64 | rcsslogplayer/gzfstream.h \ 65 | rcsslogplayer/handler.h \ 66 | rcsslogplayer/parser.h \ 67 | rcsslogplayer/types.h \ 68 | rcsslogplayer/util.h \ 69 | angle_deg.h \ 70 | ball_painter.h \ 71 | circle_2d.h \ 72 | config_dialog.h \ 73 | disp_holder.h \ 74 | draw_info_painter.h \ 75 | field_canvas.h \ 76 | field_painter.h \ 77 | line_2d.h \ 78 | log_player.h \ 79 | log_player_slider.h \ 80 | main_window.h \ 81 | monitor_client.h \ 82 | mouse_state.h \ 83 | options.h \ 84 | painter_interface.h \ 85 | player_painter.h \ 86 | player_type_dialog.h \ 87 | score_board_painter.h \ 88 | team_graphic.h \ 89 | team_graphic_painter.h \ 90 | vector_2d.h 91 | 92 | SOURCES += \ 93 | rcsslogplayer/gzfstream.cpp \ 94 | rcsslogplayer/parser.cpp \ 95 | rcsslogplayer/types.cpp \ 96 | rcsslogplayer/util.cpp \ 97 | angle_deg.cpp \ 98 | ball_painter.cpp \ 99 | circle_2d.cpp \ 100 | config_dialog.cpp \ 101 | disp_holder.cpp \ 102 | draw_info_painter.cpp \ 103 | field_canvas.cpp \ 104 | field_painter.cpp \ 105 | line_2d.cpp \ 106 | log_player.cpp \ 107 | log_player_slider.cpp \ 108 | main_window.cpp \ 109 | monitor_client.cpp \ 110 | options.cpp \ 111 | player_painter.cpp \ 112 | player_type_dialog.cpp \ 113 | score_board_painter.cpp \ 114 | team_graphic.cpp \ 115 | team_graphic_painter.cpp \ 116 | vector_2d.cpp \ 117 | main.cpp 118 | 119 | win32 { 120 | RC_FILE = rcssmonitor.rc 121 | } 122 | macx-g++ { 123 | ICON = ../icons/rcss.icns 124 | } 125 | -------------------------------------------------------------------------------- /src/team_graphic_painter.h: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file team_graphic_painter.h 5 | \brief team logo image painter class Header File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) The RoboCup Soccer Server Maintenance Group. 12 | Hidehisa AKIYAMA 13 | 14 | This code is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2, or (at your option) 17 | any later version. 18 | 19 | This code is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this code; see the file COPYING. If not, write to 26 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | 28 | *EndCopyright: 29 | */ 30 | 31 | ///////////////////////////////////////////////////////////////////// 32 | 33 | #ifndef RCSSMONITOR_TEAM_GRAPHIC_PAINTER_H 34 | #define RCSSMONITOR_TEAM_GRAPHIC_PAINTER_H 35 | 36 | #include "painter_interface.h" 37 | 38 | #include "team_graphic.h" 39 | 40 | #include 41 | 42 | #include 43 | 44 | class DispHolder; 45 | 46 | class TeamGraphicPainter 47 | : public PainterInterface { 48 | private: 49 | const DispHolder & M_disp_holder; 50 | 51 | std::set< TeamGraphic::Index > M_team_graphic_left_set; 52 | QPixmap M_team_graphic_pixmap_left; 53 | std::string M_team_name_left; 54 | 55 | std::set< TeamGraphic::Index > M_team_graphic_right_set; 56 | QPixmap M_team_graphic_pixmap_right; 57 | std::string M_team_name_right; 58 | 59 | // not used 60 | TeamGraphicPainter() = delete; 61 | public: 62 | 63 | explicit 64 | TeamGraphicPainter( const DispHolder & disp_holder ); 65 | 66 | void draw( QPainter & painter ) override; 67 | 68 | private: 69 | 70 | void copyTeamGraphic( QPixmap & dst_pixmap, 71 | std::set< TeamGraphic::Index > & index_set, 72 | const TeamGraphic & team_graphic ); 73 | void copyTeamGraphicXpmTile( QPixmap & dst_pixmap, 74 | const TeamGraphic::Index & index, 75 | const TeamGraphic::XpmTile & tile ); 76 | void copyTeamGraphicXpmTile( QPixmap & dst_pixmap, 77 | const int x, 78 | const int y, 79 | const char * const * xpm ); 80 | 81 | }; 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /src/vector_2d.cpp: -------------------------------------------------------------------------------- 1 | // -*-c++-*- 2 | 3 | /*! 4 | \file vector_2d.cpp 5 | \brief 2D vector class Source File. 6 | */ 7 | 8 | /* 9 | *Copyright: 10 | 11 | Copyright (C) Hidehisa AKIYAMA 12 | 13 | This code is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 2.1 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | 27 | *EndCopyright: 28 | */ 29 | 30 | ///////////////////////////////////////////////////////////////////// 31 | 32 | #ifdef HAVE_CONFIG_H 33 | #include 34 | #endif 35 | 36 | #include "vector_2d.h" 37 | 38 | #include 39 | 40 | const double Vector2D::ERROR_VALUE = std::numeric_limits< double >::max(); 41 | 42 | const Vector2D Vector2D::INVALIDATED( Vector2D::ERROR_VALUE, Vector2D::ERROR_VALUE ); 43 | -------------------------------------------------------------------------------- /utils/appimage/Dockerfile.builder-2004: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | RUN apt-get clean && apt-get update --allow-insecure-repositories && \ 4 | DEBIAN_FRONTEND="noninteractive" apt-get -y install \ 5 | tzdata \ 6 | gcc \ 7 | g++ \ 8 | wget \ 9 | libfl-dev \ 10 | flex \ 11 | bison \ 12 | libboost-all-dev \ 13 | automake \ 14 | make \ 15 | cmake \ 16 | iputils-ping \ 17 | build-essential \ 18 | libtool \ 19 | fuse \ 20 | tree \ 21 | libfuse-dev \ 22 | zlib1g-dev \ 23 | qt5-default \ 24 | libfontconfig1-dev \ 25 | libaudio-dev \ 26 | libxt-dev \ 27 | libglib2.0-dev \ 28 | libxi-dev \ 29 | libxrender-dev 30 | 31 | WORKDIR /rcssmonitor 32 | 33 | COPY . /rcssmonitor 34 | 35 | 36 | -------------------------------------------------------------------------------- /utils/appimage/build_appimage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | 5 | SCRIPT_DIR="$(pwd)/build" 6 | M_BUILD_PWD="$SCRIPT_DIR/monitor-bin" 7 | BIN_PATH="$M_BUILD_PWD/bin/rcssmonitor" 8 | APP_IMAGE_DIR="$SCRIPT_DIR/appimage" 9 | 10 | cd $SCRIPT_DIR 11 | 12 | wget -c "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" -O linuxdeploy-x86_64.AppImage 13 | wget -c "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" -O linuxdeploy-plugin-qt-x86_64.AppImage 14 | chmod +x linuxdeploy-x86_64.AppImage 15 | chmod +x linuxdeploy-plugin-qt-x86_64.AppImage 16 | 17 | 18 | rm -rf $APP_IMAGE_DIR || true 19 | mkdir -p $APP_IMAGE_DIR || true 20 | 21 | 22 | 23 | # ------ LIBRARIES 24 | LIBZ_PATH=$(ldd $BIN_PATH | grep libz.so | awk '{ print $3 }') 25 | LIBRCSSRCG_PATH=$(ldd $BIN_PATH | grep librcssrcg.so | awk '{ print $3 }') 26 | 27 | ./linuxdeploy-x86_64.AppImage --appdir $APP_IMAGE_DIR \ 28 | --plugin qt \ 29 | -l $LIBZ_PATH \ 30 | -l $LIBRCSSRCG_PATH \ 31 | --executable $M_BUILD_PWD/bin/rcssmonitor \ 32 | --desktop-file $SCRIPT_DIR/rcssmonitor.desktop \ 33 | --icon-file $SCRIPT_DIR/rcssmonitor.png \ 34 | --output appimage 35 | 36 | -------------------------------------------------------------------------------- /utils/appimage/build_code.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | WORKDIR="$(pwd)" 5 | 6 | BUILD_PWD="$WORKDIR/build" 7 | MONITOR_BIN_PATH="$BUILD_PWD/monitor-bin" 8 | mkdir -p $MONITOR_BIN_PATH 9 | autoreconf -i 10 | automake --add-missing 11 | $WORKDIR/configure --prefix="$MONITOR_BIN_PATH" 12 | make -j$(nproc) 13 | make install 14 | cp $WORKDIR/utils/appimage/rcssmonitor.desktop $BUILD_PWD 15 | cp $WORKDIR/utils/appimage/rcssmonitor.png $BUILD_PWD -------------------------------------------------------------------------------- /utils/appimage/create_release_note.py: -------------------------------------------------------------------------------- 1 | #/bin/python 2 | 3 | import os 4 | from urllib.request import urlopen 5 | import json 6 | 7 | 8 | repo = os.environ.get("GITHUB_REPOSITORY") 9 | 10 | 11 | def create_release_note(): 12 | release_notes = {} 13 | latest_version = "" 14 | with open("NEWS") as f: 15 | for line in f: 16 | if line.startswith("["): 17 | version = line.strip() 18 | version = version.replace("[", "") 19 | version = version.replace("]", "") 20 | version = version.strip() 21 | release_notes[version] = "" 22 | latest_version = version 23 | else: 24 | release_notes[latest_version]+= line.strip() + "\n" 25 | 26 | return release_notes 27 | 28 | def read_latest_release(): 29 | url = f"https://api.github.com/repos/{repo}/releases" 30 | print(url) 31 | response = urlopen(url) 32 | data = response.read() 33 | last_release = json.loads(data)[0] 34 | return last_release 35 | 36 | def current_version(): 37 | cmake_file = "" 38 | with open("CMakeLists.txt") as f: 39 | cmake_file = f.read() 40 | version = "" 41 | #project(rcssmonitor VERSION 42 | cmake_file = cmake_file.split("project(rcssmonitor VERSION")[1] 43 | version = cmake_file.split(")")[0] 44 | version = version.strip() 45 | return version 46 | 47 | def compare_version(version1, version2): 48 | version1 = version1.split(".") 49 | version2 = version2.split(".") 50 | for i in range(0, len(version1)): 51 | if int(version1[i]) > int(version2[i]): 52 | return 1 53 | elif int(version1[i]) < int(version2[i]): 54 | return -1 55 | return 0 56 | def release_note_until_last_release(release_notes, last_release): 57 | out = "" 58 | for key in release_notes: 59 | if compare_version(key, last_release) > 0: 60 | out+= f"[{key}]\n" 61 | out += release_notes[key] 62 | out += "\n\n" 63 | elif compare_version(key, last_release) == 0: 64 | break 65 | return out 66 | 67 | def get_release_from_github(latest_release): 68 | out = latest_release["tag_name"] 69 | out = out.replace("rcssmonitor-", "") 70 | return out 71 | 72 | 73 | def main(): 74 | 75 | release_notes = create_release_note() 76 | last_release_org = read_latest_release() 77 | last_release = get_release_from_github(last_release_org) 78 | curr_version = current_version() 79 | print(f"Current version: {curr_version}") 80 | print(f"Action release: {last_release}") 81 | release = release_note_until_last_release(release_notes, last_release) 82 | with open("release_note.md", "w") as f: 83 | if release == "": 84 | f.write("TBD") 85 | return 86 | f.write(release) 87 | 88 | if __name__ == "__main__": 89 | main() -------------------------------------------------------------------------------- /utils/appimage/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | cd /rcssmonitor 5 | 6 | bash /rcssmonitor/utils/appimage/build_code.sh 7 | bash /rcssmonitor/utils/appimage/build_appimage.sh -------------------------------------------------------------------------------- /utils/appimage/rcssmonitor.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | Name=rcssmonitor 5 | Comment=Robocup 2D Soccer Simulation Monitor 6 | TryExec=rcssmonitor 7 | Exec=rcssmonitor 8 | Icon=rcssmonitor 9 | MimeType=image/x-foo; 10 | Categories=Development; 11 | X-KDE-Library=librcssmonitor 12 | X-KDE-FactoryName=rcssmonitorfactory 13 | X-KDE-ServiceType=rcssmonitorService 14 | 15 | -------------------------------------------------------------------------------- /utils/appimage/rcssmonitor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rcsoccersim/rcssmonitor/42848cdee2cb230cd215ec9875dc06aa31f99aa9/utils/appimage/rcssmonitor.png --------------------------------------------------------------------------------