1 #ifndef SLAM_CTOR_UTILS_DG_MAP_PRIMITIVES_INCLUDED 2 #define SLAM_CTOR_UTILS_DG_MAP_PRIMITIVES_INCLUDED 10 #include "../../core/geometry_utils.h" 22 virtual std::istream&
to_stream()
const = 0;
27 static constexpr
char Completely_Occupied_Marker =
'+';
28 static constexpr
char Completely_Free_Marker =
' ';
29 static constexpr
char Row_End_Marker =
'\n';
32 return _stream_pin = std::stringstream{text_raster()};
35 virtual std::string text_raster()
const = 0;
70 : _width{w}, _height{h}, _bnd_pos{bnd_pos} {
72 assert(0 < _width && 0 < _height);
73 bool is_bnd_horiz = _bnd_pos == BoundPosition::Top ||
74 _bnd_pos == BoundPosition::Bot;
76 _raw_cecum = generate_horizontally_bounded_cecum(_bnd_pos);
78 _raw_cecum = generate_vertically_bounded_cecum(_bnd_pos);
82 int width()
const override {
return _width; };
83 int height()
const override {
return _height; };
89 case BoundPosition::Top:
91 case BoundPosition::Bot:
93 case BoundPosition::Left:
95 case BoundPosition::Right:
105 assert(bnd_pos == BoundPosition::Top || bnd_pos == BoundPosition::Bot);
108 for (
int row_i = 0; row_i <
height(); ++row_i) {
109 if ((row_i == 0 && bnd_pos == BoundPosition::Top) ||
110 (row_i ==
height() - 1 && bnd_pos == BoundPosition::Bot)) {
112 cecum += std::string(
width(), Completely_Occupied_Marker);
113 cecum += Row_End_Marker;
115 cecum += Completely_Occupied_Marker;
116 for (
int col_i = 1; col_i <
width(); ++col_i) {
117 cecum += col_i ==
width() - 1 ? Completely_Occupied_Marker
118 : Completely_Free_Marker;
120 cecum += Row_End_Marker;
127 assert(bnd_pos == BoundPosition::Left || bnd_pos == BoundPosition::Right);
129 std::string cecum(
width(), Completely_Occupied_Marker);
130 cecum += Row_End_Marker;
131 for (
int row_i = 1; row_i <
height(); ++row_i) {
132 if (row_i ==
height() - 1) {
133 cecum += std::string(
width(), Completely_Occupied_Marker);
137 for (
int col_i = 0; col_i <
width(); ++col_i) {
138 bool is_occ =
width() == 1 ||
139 (col_i == 0 && bnd_pos == BoundPosition::Left) ||
140 (col_i ==
width() - 1 && bnd_pos == BoundPosition::Right);
142 cecum += is_occ ? Completely_Occupied_Marker : Completely_Free_Marker;
144 cecum += Row_End_Marker;
146 cecum += Row_End_Marker;
virtual std::vector< Rectangle > free_space() const
virtual int width() const
static constexpr int Unknown_Value
virtual std::istream & to_stream() const =0
virtual int height() const