Skip to content

triangle_strategy

TriangleDrawingStrategy

Bases: ShapeDrawingStrategy

Drawing strategy for Triangle shapes.

draw(dwg, triangle)

Draws a Triangle shape on the given Drawing object.

Parameters:

Name Type Description Default
dwg Drawing

The Drawing object to draw the shape on.

required
triangle Triangle

The Triangle shape to draw.

required

Returns:

Type Description
None
Source code in layerforge/svg/drawing/strategies/triangle_strategy.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
def draw(self, dwg: Drawing, triangle: Triangle) -> None:
    """Draws a Triangle shape on the given Drawing object.

    Parameters
    ----------
    dwg : Drawing
        The Drawing object to draw the shape on.
    triangle : Triangle
        The Triangle shape to draw.

    Returns
    -------
    None
    """
    # TODO: Get stroke and fill from the shape or config
    dwg.add(dwg.polygon(triangle.vertices, stroke='green', fill='none'))