Go to the documentation of this file.00001 #ifndef _MAP_TEST_H
00002 #define _MAP_TEST_H
00003
00004 #include "../../src/core/maps/grid_map.h"
00005 #include "../../src/tiny_slam/tiny_grid_cells.h"
00006
00007 class MapParams {
00008 public:
00009 MapParams (int height = 0, int width = 0, int map_center_x = 0, int map_center_y = 0) :
00010 _height(height), _width(width),
00011 _map_center_x(map_center_x), _map_center_y(map_center_y) {}
00012
00013 friend bool operator==(const MapParams &left, const MapParams &right);
00014
00015 int _height;
00016 int _width;
00017 int _map_center_x;
00018 int _map_center_y;
00019 };
00020
00021 bool operator==(const MapParams &left, const MapParams &right) {
00022 return (left._height == right._height) && (left._map_center_x == right._map_center_x)
00023 &&(left._width == right._width) && (left._map_center_y == right._map_center_y);
00024 }
00025
00026 bool test_CellValueNotChange(GridMap map) {
00027 bool is_center_x_shifted = (map.map_center_x() == 0),
00028 is_center_y_shifted = (map.map_center_y() == 0);
00029
00030 int x0 = is_center_x_shifted ? 0 :
00031 (map.map_center_x() - 1 - map.width());
00032 int y0 = is_center_y_shifted ? 0 :
00033 (map.map_center_y() - 1 - map.height());
00034 int i = 0, j = 0;
00035
00036 for (i = x0; i < map.width(); ++i) {
00037 for (j = y0; j < map.height(); ++j) {
00038 if (map.cell_value({i, j}) != 0.5) {
00039 return false;
00040 }
00041 }
00042 }
00043
00044 return true;
00045 }
00046
00047 #endif