|
14 | 14 | from vacuum_map_parser_base.config.color import ColorsPalette, SupportedColor |
15 | 15 | from vacuum_map_parser_base.config.drawable import Drawable |
16 | 16 | from vacuum_map_parser_base.config.image_config import ImageConfig |
17 | | -from vacuum_map_parser_base.map_data import ImageData, MapData, Path, Point, Room |
| 17 | +from vacuum_map_parser_base.map_data import Area, ImageData, MapData, Path, Point, Room |
18 | 18 |
|
19 | 19 | from roborock.exceptions import RoborockException |
20 | 20 | from roborock.map.proto.b01_scmap_pb2 import RobotMap # type: ignore[attr-defined] |
|
29 | 29 |
|
30 | 30 | _B01_DRAWABLES = [ |
31 | 31 | Drawable.CHARGER, |
| 32 | + Drawable.NO_GO_AREAS, |
32 | 33 | Drawable.PATH, |
33 | 34 | Drawable.ROOM_NAMES, |
34 | 35 | Drawable.VACUUM_POSITION, |
@@ -164,6 +165,17 @@ def _place_poses(map_data: MapData, parsed: RobotMap, projector: _WorldToPixel) |
164 | 165 | # A saved map carries no live pose; show the robot at its dock. |
165 | 166 | map_data.vacuum_position = Point(map_data.charger.x, map_data.charger.y, map_data.charger.a) |
166 | 167 |
|
| 168 | + areas = [ |
| 169 | + Area(*(coord for point in area.points for coord in projector.to_pixel(point.x, point.y))) |
| 170 | + for area in parsed.areaInfo |
| 171 | + if len(area.points) == 4 |
| 172 | + ] |
| 173 | + if areas: |
| 174 | + # areaInfo type semantics are not yet mapped per zone kind; render all |
| 175 | + # restricted areas through the no-go drawable for now. |
| 176 | + map_data.no_go_areas = areas |
| 177 | + has_drawables = True |
| 178 | + |
167 | 179 | if parsed.HasField("historyPose"): |
168 | 180 | pixels = [ |
169 | 181 | Point(*projector.to_pixel(point.x, point.y)) |
|
0 commit comments