@@ -51,6 +51,12 @@ class MapParserConfig:
5151 show_background : bool = True
5252 """Whether to show the background of the map."""
5353
54+ show_walls : bool = True
55+ """Whether to show the walls of the map."""
56+
57+ show_rooms : bool = True
58+ """Whether to show the rooms of the map."""
59+
5460 map_scale : int = DEFAULT_MAP_SCALE
5561 """Scale factor for the map."""
5662
@@ -94,11 +100,22 @@ def parse(self, map_bytes: bytes) -> ParsedMapData | None:
94100
95101def _create_map_data_parser (config : MapParserConfig ) -> RoborockMapDataParser :
96102 """Create a RoborockMapDataParser based on the config entry."""
97- colors = ColorsPalette ()
103+ color_dicts = {}
104+ room_colors = {}
105+
98106 if not config .show_background :
99- colors = ColorsPalette ({SupportedColor .MAP_OUTSIDE : (0 , 0 , 0 , 0 )})
107+ color_dicts [SupportedColor .MAP_OUTSIDE ] = (0 , 0 , 0 , 0 )
108+
109+ if not config .show_walls :
110+ color_dicts [SupportedColor .GREY_WALL ] = (0 , 0 , 0 , 0 )
111+ color_dicts [SupportedColor .MAP_WALL ] = (0 , 0 , 0 , 0 )
112+ color_dicts [SupportedColor .MAP_WALL_V2 ] = (0 , 0 , 0 , 0 )
113+
114+ if not config .show_rooms :
115+ room_colors = {str (x ): (0 , 0 , 0 , 0 ) for x in range (1 , 32 )}
116+
100117 return RoborockMapDataParser (
101- colors ,
118+ ColorsPalette ( color_dicts if len ( color_dicts ) else None , room_colors if len ( room_colors ) else None ) ,
102119 Sizes ({k : v * config .map_scale for k , v in Sizes .SIZES .items () if k != Size .MOP_PATH_WIDTH }),
103120 config .drawables ,
104121 ImageConfig (scale = config .map_scale ),
0 commit comments