QMplRenderer#

class QMplRenderer(canvas: PlotCanvas, design: QDesign, logger: Logger)[source]#

Matplotlib handle all rendering of an axis. The axis is given in the function render. Access:

self = gui.canvas.metal_renderer

Parameters:
  • canvas (PlotCanvas) – The canvas

  • design (QDesign) – The design

  • logger (logging.Logger) – The logger

Attributes

qgeometry#

Return the qgeometry of the design.

styles = {'JJ': {'base': {'alpha': 0.2, 'edgecolors': 'k', 'linewidth': 1}, 'non-subtracted': {}, 'subtracted': {'color': 'gray', 'linestyle': '--'}}, 'path': {'base': {'alpha': 0.5, 'linewidth': 2}, 'non-subtracted': {}, 'subtracted': {}}, 'poly': {'base': {'alpha': 0.5, 'edgecolors': 'k', 'linewidth': 1}, 'non-subtracted': {}, 'subtracted': {'color': 'gray', 'linestyle': '--'}}}#

Styles

Methods

clear_options()[source]#

Clear all options.

fillet_path(row)[source]#

Output the filleted path. :param row: Row to fillet. :type row: DataFrame

Returns:

Polygon of the new filleted path.

get_color_num(num: int) str[source]#

Get the color from the given number. :param num: number :type num: int

Returns:

color

Return type:

str

get_mask(table: DataFrame) Series[source]#

Gets the mask. :param table: dataframe :type table: pd.DataFrame

Returns:

return pandas index series with boolen mask - i.e., which are not hidden or otherwise

Return type:

pd.Series

get_style(element_type: str, subtracted=False, layer=None, extra=None)[source]#

Get the style. :param element_type: The type of element. :type element_type: str :param subtracted: True to subtract the key. Defaults to False. :type subtracted: bool :param layer: The layer. Defaults to None. :type layer: layer :param extra: Extra stuff to add. Defaults to None. :type extra: dict

Returns:

Style dictionary

Return type:

dict

hide_component(name)[source]#

Hide the component with the given name. :param name: Component name :type name: str

hide_layer(name)[source]#

Hide the layer with the given name. :param name: Layer name :type name: str

render(ax: Axes)[source]#

Assumes that the axis has been cleared already and so on. :param ax: mpl axis to draw on :type ax: matplotlib.axes.Axes

render_fillet(table)[source]#

Renders fillet path. :param table: Table of elements with fillets :type table: DataFrame

Returns:

DataFrame table with geometry field updated with a polygon filleted path.

render_junction(table: DataFrame, ax: Axes, subtracted: bool = False, extra_kw: dict | None = None)[source]#

Render a table of junction geometry. A junction is basically drawn like a path with finite width and no fillet. :param table: Element table :type table: DataFrame :param ax: Axis to render on :type ax: matplotlib.axes.Axes :param extra_kw: Style params :type extra_kw: dict

render_path(table: DataFrame, ax: Axes, subtracted: bool = False, extra_kw: dict | None = None)[source]#

Render a table of path geometry. :param table: Element table :type table: DataFrame :param ax: Axis to render on :type ax: matplotlib.axes.Axes :param kw: Style params :type kw: dict

render_poly(table: DataFrame, ax: Axes, subtracted: bool = False, extra_kw: dict | None = None)[source]#

Render a table of poly geometry. :param table: Element table :type table: DataFrame :param ax: Axis to render on :type ax: matplotlib.axes.Axes :param kw: Style params :type kw: dict

render_tables(ax: Axes)[source]#

Render the tables. :param ax: The axes :type ax: Axes

set_design(design: QDesign)[source]#

Set the design. :param design: The design :type design: QDesign

show_component(name)[source]#

Show the component with the given name. :param name: Component name :type name: str

show_layer(name)[source]#

Show the layer with the given name. :param name: Layer name :type name: str