|
@@ 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
|
|
@@ 256-267 (lines=12) @@
|
| 253 |
|
self.__level_blocks = self.__directory.get_level(self.__current_level)
|
| 254 |
|
|
| 255 |
|
|
| 256 |
|
def __draw_block(self, block, block_alpha=0.0):
|
| 257 |
|
max_corner, min_corner = block.get_spatial_block().get_corners()
|
| 258 |
|
|
| 259 |
|
face_color = matplotlib.colors.to_rgba('blue', alpha=block_alpha)
|
| 260 |
|
edge_color = matplotlib.colors.to_rgba('black', alpha=1.0)
|
| 261 |
|
|
| 262 |
|
rect = patches.Rectangle(min_corner, max_corner[0] - min_corner[0], max_corner[1] - min_corner[1],
|
| 263 |
|
fill=True,
|
| 264 |
|
facecolor=face_color,
|
| 265 |
|
edgecolor=edge_color,
|
| 266 |
|
linewidth=0.5)
|
| 267 |
|
self.__ax.add_patch(rect)
|
| 268 |
|
|
| 269 |
|
|
| 270 |
|
def __draw_leaf_density(self):
|