DrawVectorLine Module.
This module defines the base class for creating vector line components
used in drawing creation. The main class, DrawVectorLine, represents
a vector line defined by its start and end positions and width.
DrawVectorLine
Bases: DrawCommand
Represents a vector line component used in drawing creation.
This class is defined by its start position, end position, and width.
Source code in src/pygerber/backend/abstract/draw_commands/draw_vector_line.py
| class DrawVectorLine(DrawCommand):
"""Represents a vector line component used in drawing creation.
This class is defined by its start position, end position, and width.
"""
start_position: Vector2D
end_position: Vector2D
width: Offset
def __init__( # noqa: PLR0913
self,
backend: Backend,
polarity: Polarity,
start_position: Vector2D,
end_position: Vector2D,
width: Offset,
) -> None:
"""Initialize draw command."""
super().__init__(backend, polarity)
self.start_position = start_position
self.end_position = end_position
self.width = width
def get_bounding_box(self) -> BoundingBox:
"""Return bounding box of draw operation."""
vertex_box = BoundingBox.from_diameter(self.width)
return (vertex_box + self.start_position) + (vertex_box + self.end_position)
|
__init__
__init__(
backend: Backend,
polarity: Polarity,
start_position: Vector2D,
end_position: Vector2D,
width: Offset,
) -> None
Initialize draw command.
Source code in src/pygerber/backend/abstract/draw_commands/draw_vector_line.py
| def __init__( # noqa: PLR0913
self,
backend: Backend,
polarity: Polarity,
start_position: Vector2D,
end_position: Vector2D,
width: Offset,
) -> None:
"""Initialize draw command."""
super().__init__(backend, polarity)
self.start_position = start_position
self.end_position = end_position
self.width = width
|
get_bounding_box
get_bounding_box() -> BoundingBox
Return bounding box of draw operation.
Source code in src/pygerber/backend/abstract/draw_commands/draw_vector_line.py
| def get_bounding_box(self) -> BoundingBox:
"""Return bounding box of draw operation."""
vertex_box = BoundingBox.from_diameter(self.width)
return (vertex_box + self.start_position) + (vertex_box + self.end_position)
|