@@ 169-194 (lines=26) @@ | ||
166 | bang_visualizer.__draw_block(ax, pair, block, density_scale) |
|
167 | ||
168 | ||
169 | @staticmethod |
|
170 | def __draw_block(ax, pair, block, density_scale): |
|
171 | """! |
|
172 | @brief Display BANG-block on the specified ax. |
|
173 | ||
174 | @param[in] ax (Axis): Axis where block should be displayed. |
|
175 | @param[in] pair (tuple): Pair of coordinate index that should be displayed. |
|
176 | @param[in] block (bang_block): BANG-block that should be displayed. |
|
177 | @param[in] density_scale (double): Max density to display density of the block by appropriate tone. |
|
178 | ||
179 | """ |
|
180 | max_corner, min_corner = bang_visualizer.__get_rectangle_description(block, pair) |
|
181 | ||
182 | belong_cluster = block.get_cluster() is not None |
|
183 | ||
184 | density_scale = bang_visualizer.__maximum_density_alpha * block.get_density() / density_scale |
|
185 | ||
186 | face_color = matplotlib.colors.to_rgba('blue', alpha=density_scale) |
|
187 | edge_color = matplotlib.colors.to_rgba('black', alpha=1.0) |
|
188 | ||
189 | rect = patches.Rectangle(min_corner, max_corner[0] - min_corner[0], max_corner[1] - min_corner[1], |
|
190 | fill=belong_cluster, |
|
191 | facecolor=face_color, |
|
192 | edgecolor=edge_color, |
|
193 | linewidth=0.5) |
|
194 | ax.add_patch(rect) |
|
195 | ||
196 | ||
197 | @staticmethod |
|
@@ 296-314 (lines=19) @@ | ||
293 | self.__level_blocks = self.__directory.get_level(self.__current_level) |
|
294 | ||
295 | ||
296 | def __draw_block(self, block, block_alpha=0.0): |
|
297 | """! |
|
298 | @brief Display single BANG block on axis. |
|
299 | ||
300 | @param[in] block (bang_block): BANG block that should be displayed. |
|
301 | @param[in] block_alpha (double): Transparency level - value of alpha. |
|
302 | ||
303 | """ |
|
304 | max_corner, min_corner = block.get_spatial_block().get_corners() |
|
305 | ||
306 | face_color = matplotlib.colors.to_rgba('blue', alpha=block_alpha) |
|
307 | edge_color = matplotlib.colors.to_rgba('black', alpha=1.0) |
|
308 | ||
309 | rect = patches.Rectangle(min_corner, max_corner[0] - min_corner[0], max_corner[1] - min_corner[1], |
|
310 | fill=True, |
|
311 | facecolor=face_color, |
|
312 | edgecolor=edge_color, |
|
313 | linewidth=0.5) |
|
314 | self.__ax.add_patch(rect) |
|
315 | ||
316 | ||
317 | def __draw_leaf_density(self): |