Core - momapy

Skip to content

# Core

## `` momapy.core

Base classes for core components defining maps and their elements

Classes:

Name | Description
--- | ---
`Arc` | Base class for arcs
`DoubleHeadedArc` | Base class for double-headed arcs. A double-headed arc is formed of a path and two arrowheads, on at the beginning of the path and one at its end
`FrozendictBuilder` | Builder class for frozendicts
`FrozensetBuilder` | Builder class for frozensets
`GroupLayout` | Base class for group layouts. A group layout is a layout element grouping other layout elements.
`Layout` | Class for layouts
`LayoutElement` | Abstract base class for layout elements
`LayoutModelMapping` | Class for mappings between model elements and layout elements
`LayoutModelMappingBuilder` |
`Map` | Class for maps
`MapElement` | Base class for map elements
`Model` | Base class for models
`ModelElement` | Base class for model elements
`Node` | Class for nodes. A node is a layout element with a `position`, a `width`, a `height` and an optional `label`.
`Shape` | Class for basic shapes. The shape is the most simple layout element.
`SingleHeadedArc` | Base class for single-headed arcs. A single-headed arc is formed of a path and a unique arrowhead at its end
`TextLayout` | Class for text layouts
`TupleBuilder` | Builder class for tuples

Attributes:

Name | Type | Description
--- | --- | ---
`DoubleHeadedArcBuilder` |  | Base class for double-headed arc builders
`LayoutBuilder` |  | Base class for layout builders
`LayoutElementBuilder` |  | Base class for layout element builders
`MapBuilder` |  | Base class for map builders
`ModelBuilder` |  | Base class for model builders
`ModelElementBuilder` |  | Base class for model element builders
`NodeBuilder` |  | Base class for node builders
`SingleHeadedArcBuilder` |  | Base class for single-headed arc builders
`TextLayoutBuilder` |  | Class for text layout builders

### `` Arc `dataclass`

    Arc(
        *,
        id_: str = make_uuid4_as_str(),
        layout_elements: tuple[LayoutElement] = tuple(),
        group_fill: NoneValueType | Color | None = None,
        group_fill_rule: FillRule | None = None,
        group_filter: NoneValueType | Filter | None = None,
        group_font_family: str | None = None,
        group_font_size: float | None = None,
        group_font_style: FontStyle | None = None,
        group_font_weight: FontWeight | float | None = None,
        group_stroke: NoneValueType | Color | None = None,
        group_stroke_dasharray: tuple[float, ...] | None = None,
        group_stroke_dashoffset: float | None = None,
        group_stroke_width: float | None = None,
        group_text_anchor: TextAnchor | None = None,
        group_transform: NoneValueType
        | tuple[Transformation]
        | None = None,
        end_shorten: float = 0.0,
        fill: NoneValueType | Color | None = None,
        filter: NoneValueType | Filter | None = None,
        path_fill: NoneValueType | Color | None = None,
        path_filter: NoneValueType | Filter | None = None,
        path_stroke: NoneValueType | Color | None = None,
        path_stroke_dasharray: tuple[float, ...] | None = None,
        path_stroke_dashoffset: float | None = None,
        path_stroke_width: float | None = None,
        path_transform: NoneValueType
        | tuple[Transformation]
        | None = None,
        stroke: NoneValueType | Color | None = None,
        stroke_dasharray: NoneValueType
        | tuple[float]
        | None = None,
        stroke_dashoffset: float | None = None,
        stroke_width: float | None = None,
        segments: tuple[
            Segment | BezierCurve | EllipticalArc
        ] = tuple(),
        source: LayoutElement | None = None,
        start_shorten: float = 0.0,
        target: LayoutElement | None = None,
        transform: NoneValueType
        | tuple[Transformation]
        | None = None,
    )

Bases: `GroupLayout`

Base class for arcs

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`id_` | `str` | The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element | `'1a2dd683-7be7-4300-b2ca-f0958d35838c'`
`layout_elements` | `tuple[LayoutElement]` | The sub-layout elements of the group layout. These are part of the children of the group layout | `<dynamic>`
`group_fill` | `NoneValueType | Color | None` | The fill color of the group layout | `None`
`group_fill_rule` | `FillRule | None` | The fill rule of the group layout | `None`
`group_filter` | `NoneValueType | Filter | None` | The filter of the group layout | `None`
`group_font_family` | `str | None` | The font family of the group layout | `None`
`group_font_size` | `float | None` | The font size of the group layout | `None`
`group_font_style` | `FontStyle | None` | The font style of the group layout | `None`
`group_font_weight` | `FontWeight | float | None` | The font weight of the group layout | `None`
`group_stroke` | `NoneValueType | Color | None` | The stroke color of the group layout | `None`
`group_stroke_dasharray` | `tuple[float, ...] | None` | The stroke dasharray of the group layout | `None`
`group_stroke_dashoffset` | `float | None` | The stroke dashoffset of the group layout | `None`
`group_stroke_width` | `float | None` | The stroke width of the group layout | `None`
`group_text_anchor` | `TextAnchor | None` | The text anchor of the group layout | `None`
`group_transform` | `NoneValueType | tuple[Transformation] | None` | The transform of the group layout | `None`
`end_shorten` | `float` | The length the end of the arc will be shorten by | `0.0`
`fill` | `NoneValueType | Color | None` | The fill color of the arc | `None`
`filter` | `NoneValueType | Filter | None` | The fill filter of the arc | `None`
`path_fill` | `NoneValueType | Color | None` | The path fill color of the arc | `None`
`path_filter` | `NoneValueType | Filter | None` | The path filter of the arc | `None`
`path_stroke` | `NoneValueType | Color | None` | The path stroke color of the arc | `None`
`path_stroke_dasharray` | `tuple[float, ...] | None` | The path stroke dasharray of the arc | `None`
`path_stroke_dashoffset` | `float | None` | The path stroke dashoffset of the arc | `None`
`path_stroke_width` | `float | None` | The path stroke width of the arc | `None`
`path_transform` | `NoneValueType | tuple[Transformation] | None` | The path transform of the arc | `None`
`stroke` | `NoneValueType | Color | None` | The stroke color of the arc | `None`
`stroke_dasharray` | `NoneValueType | tuple[float] | None` | The stroke dasharray of the arc | `None`
`stroke_dashoffset` | `float | None` | The stroke dashoffset of the arc | `None`
`stroke_width` | `float | None` | The stroke width of the arc | `None`
`segments` | `tuple[Union[Segment, BezierCurve, EllipticalArc]]` | The path segments of the arc | `<dynamic>`
`source` | `LayoutElement | None` | The source of the arc | `None`
`start_shorten` | `float` | The length the start of the arc will be shorten by | `0.0`
`target` | `LayoutElement | None` | The target of the arc | `None`
`transform` | `NoneValueType | tuple[Transformation] | None` | The transform of the arc | `None`

Methods:

Name | Description
--- | ---
`anchor_point` | Return an anchor point of the layout element
`bbox` | Compute and return the bounding box of the group layout element
`childless` | Return a copy of the arc with no children
`children` | Return the children of the group layout.
`contains` | Return `true` if another layout element is a descendant of the layout element, `false` otherwise
`descendants` | Return the descendants of the layout element
`drawing_elements` | Return the drawing elements of the group layout.
`end_point` | Return the ending point of the arc
`equals` | Return `true` if the layout element is equal to another layout element, `false` otherwise
`flattened` | Return a list containing copy of the layout element with no children and all its descendants with no children
`fraction` | Return the position and angle on the arc at a given fraction (of the total arc length)
`length` | Return the total length of the arc path
`points` | Return the points of the arc path
`self_bbox` | Compute and return the bounding box of the self drawing element of the group layout
`self_children` | Return the self children of the arc
`self_drawing_elements` | Return the self drawing elements of the group layout
`self_to_shapely` | Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout
`start_point` | Return the starting point of the arc
`to_shapely` | Return a shapely collection of geometries reproducing the drawing elements of the layout element

#### `` anchor_point

    anchor_point(anchor_name: str) -> Point

Return an anchor point of the layout element

Source code in `src/momapy/core.py`

    130
    131
    132
    def anchor_point(self, anchor_name: str) -> momapy.geometry.Point:
        """Return an anchor point of the layout element"""
        return getattr(self, anchor_name)()

#### `` bbox

    bbox() -> Bbox

Compute and return the bounding box of the group layout element

Source code in `src/momapy/core.py`

    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    def bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the group layout element"""
        self_bbox = self.self_bbox()
        bboxes = [child.bbox() for child in self.children()]
        min_x = self_bbox.north_west().x
        min_y = self_bbox.north_west().y
        max_x = self_bbox.south_east().x
        max_y = self_bbox.south_east().y
        for bbox in bboxes:
            if bbox.north_west().x < min_x:
                min_x = bbox.north_west().x
            if bbox.north_west().y < min_y:
                min_y = bbox.north_west().y
            if bbox.south_east().x > max_x:
                max_x = bbox.south_east().x
            if bbox.south_east().y > max_y:
                max_y = bbox.south_east().y
        bbox = momapy.geometry.Bbox(
            momapy.geometry.Point(min_x / 2 + max_x / 2, min_y / 2 + max_y / 2),
            max_x - min_x,
            max_y - min_y,
        )
        return bbox

#### `` childless

    childless() -> Self

Return a copy of the arc with no children

Source code in `src/momapy/core.py`

    955
    956
    957
    def childless(self) -> typing.Self:
        """Return a copy of the arc with no children"""
        return dataclasses.replace(self, layout_elements=tuple([]))

#### `` children

    children() -> list[LayoutElement]

Return the children of the group layout. These are the self children of the group layout (returned by the `self_children` method) and the other children of the group layout (given by the `layout_elements` attribute)

Source code in `src/momapy/core.py`

    566
    567
    568
    569
    570
    def children(self) -> list[LayoutElement]:
        """Return the children of the group layout.
        These are the self children of the group layout (returned by the `self_children` method) and the other children of the group layout (given by the `layout_elements` attribute)
        """
        return self.self_children() + list(self.layout_elements)

#### `` contains

    contains(other: LayoutElement) -> bool

Return `true` if another layout element is a descendant of the layout element, `false` otherwise

Source code in `src/momapy/core.py`

    119
    120
    121
    def contains(self, other: "LayoutElement") -> bool:
        """Return `true` if another layout element is a descendant of the layout element, `false` otherwise"""
        return other in self.descendants()

#### `` descendants

    descendants() -> list[LayoutElement]

Return the descendants of the layout element

Source code in `src/momapy/core.py`

    90
    91
    92
    93
    94
    95
    96
    def descendants(self) -> list["LayoutElement"]:
        """Return the descendants of the layout element"""
        descendants = []
        for child in self.children():
            descendants.append(child)
            descendants += child.descendants()
        return descendants

#### `` drawing_elements

    drawing_elements() -> list[DrawingElement]

Return the drawing elements of the group layout. The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children

Source code in `src/momapy/core.py`

    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    def drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the drawing elements of the group layout.
        The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children
        """
        drawing_elements = self.self_drawing_elements()
        for child in self.children():
            if child is not None:
                drawing_elements += child.drawing_elements()
        group = momapy.drawing.Group(
            class_=f"{type(self).__name__}_group",
            elements=tuple(drawing_elements),
            id_=f"{self.id_}_group",
            fill=self.group_fill,
            fill_rule=self.group_fill_rule,
            filter=self.group_filter,
            font_family=self.group_font_family,
            font_size=self.group_font_size,
            font_style=self.group_font_style,
            font_weight=self.group_font_weight,
            stroke=self.group_stroke,
            stroke_dasharray=self.group_stroke_dasharray,
            stroke_dashoffset=self.group_stroke_dashoffset,
            stroke_width=self.group_stroke_width,
            text_anchor=self.group_text_anchor,
            transform=self.group_transform,
        )
        return [group]

#### `` end_point

    end_point() -> Point

Return the ending point of the arc

Source code in `src/momapy/core.py`

    951
    952
    953
    def end_point(self) -> momapy.geometry.Point:
        """Return the ending point of the arc"""
        return self.points()[-1]

#### `` equals

    equals(
        other: LayoutElement,
        flattened: bool = False,
        unordered: bool = False,
    ) -> bool

Return `true` if the layout element is equal to another layout element, `false` otherwise

Source code in `src/momapy/core.py`

    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    def equals(
        self, other: "LayoutElement", flattened: bool = False, unordered: bool = False
    ) -> bool:
        """Return `true` if the layout element is equal to another layout element, `false` otherwise"""
        if type(self) is type(other):
            if not flattened:
                return self == other
            else:
                if not unordered:
                    return self.flattened() == other.flattened()
                else:
                    return set(self.flattened()) == set(other.flattened())
        return False

#### `` flattened

    flattened() -> list[LayoutElement]

Return a list containing copy of the layout element with no children and all its descendants with no children

Source code in `src/momapy/core.py`

     98
     99
    100
    101
    102
    103
    def flattened(self) -> list["LayoutElement"]:
        """Return a list containing copy of the layout element with no children and all its descendants with no children"""
        flattened = [self.childless()]
        for child in self.children():
            flattened += child.flattened()
        return flattened

#### `` fraction

    fraction(fraction: float) -> tuple[Point, float]

Return the position and angle on the arc at a given fraction (of the total arc length)

Source code in `src/momapy/core.py`

    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    def fraction(self, fraction: float) -> tuple[momapy.geometry.Point, float]:
        """Return the position and angle on the arc at a given fraction (of the total arc length)"""
        current_length = 0
        length_to_reach = fraction * self.length()
        for segment in self.segments:
            current_length += segment.length()
            if current_length >= length_to_reach:
                break
        position, angle = segment.get_position_and_angle_at_fraction(fraction)
        return position, angle

#### `` length

    length()

Return the total length of the arc path

Source code in `src/momapy/core.py`

    943
    944
    945
    def length(self):
        """Return the total length of the arc path"""
        return sum([segment.length() for segment in self.segments])

#### `` points

    points() -> list[Point]

Return the points of the arc path

Source code in `src/momapy/core.py`

    935
    936
    937
    938
    939
    940
    941
    def points(self) -> list[momapy.geometry.Point]:
        """Return the points of the arc path"""
        points = []
        for segment in self.segments:
            points.append(segment.p1)
        points.append(segment.p2)
        return points

#### `` self_bbox

    self_bbox() -> Bbox

Compute and return the bounding box of the self drawing element of the group layout

Source code in `src/momapy/core.py`

    499
    500
    501
    502
    def self_bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the self drawing element of the group layout"""
        bounds = self.self_to_shapely().bounds
        return momapy.geometry.Bbox.from_bounds(bounds)

#### `` self_children

    self_children() -> list[LayoutElement]

Return the self children of the arc

Source code in `src/momapy/core.py`

    931
    932
    933
    def self_children(self) -> list[LayoutElement]:
        """Return the self children of the arc"""
        return []

#### `` self_drawing_elements `abstractmethod`

    self_drawing_elements() -> list[DrawingElement]

Return the self drawing elements of the group layout

Source code in `src/momapy/core.py`

    528
    529
    530
    531
    @abc.abstractmethod
    def self_drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the self drawing elements of the group layout"""
        pass

#### `` self_to_shapely

    self_to_shapely() -> GeometryCollection

Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout

Source code in `src/momapy/core.py`

    495
    496
    497
    def self_to_shapely(self) -> shapely.GeometryCollection:
        """Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout"""
        return momapy.drawing.drawing_elements_to_shapely(self.drawing_elements())

#### `` start_point

    start_point() -> Point

Return the starting point of the arc

Source code in `src/momapy/core.py`

    947
    948
    949
    def start_point(self) -> momapy.geometry.Point:
        """Return the starting point of the arc"""
        return self.points()[0]

#### `` to_shapely

    to_shapely(to_polygons: bool = False) -> GeometryCollection

Return a shapely collection of geometries reproducing the drawing elements of the layout element

Source code in `src/momapy/core.py`

    123
    124
    125
    126
    127
    128
    def to_shapely(self, to_polygons: bool = False) -> shapely.GeometryCollection:
        """Return a shapely collection of geometries reproducing the drawing elements of the layout element"""
        geom_collection = []
        for drawing_element in self.drawing_elements():
            geom_collection += drawing_element.to_shapely(to_polygons=to_polygons).geoms
        return shapely.GeometryCollection(geom_collection)

### `` DoubleHeadedArc `dataclass`

    DoubleHeadedArc(
        *,
        id_: str = make_uuid4_as_str(),
        layout_elements: tuple[LayoutElement] = tuple(),
        group_fill: NoneValueType | Color | None = None,
        group_fill_rule: FillRule | None = None,
        group_filter: NoneValueType | Filter | None = None,
        group_font_family: str | None = None,
        group_font_size: float | None = None,
        group_font_style: FontStyle | None = None,
        group_font_weight: FontWeight | float | None = None,
        group_stroke: NoneValueType | Color | None = None,
        group_stroke_dasharray: tuple[float, ...] | None = None,
        group_stroke_dashoffset: float | None = None,
        group_stroke_width: float | None = None,
        group_text_anchor: TextAnchor | None = None,
        group_transform: NoneValueType
        | tuple[Transformation]
        | None = None,
        end_shorten: float = 0.0,
        fill: NoneValueType | Color | None = None,
        filter: NoneValueType | Filter | None = None,
        path_fill: NoneValueType | Color | None = None,
        path_filter: NoneValueType | Filter | None = None,
        path_stroke: NoneValueType | Color | None = None,
        path_stroke_dasharray: tuple[float, ...] | None = None,
        path_stroke_dashoffset: float | None = None,
        path_stroke_width: float | None = None,
        path_transform: NoneValueType
        | tuple[Transformation]
        | None = None,
        stroke: NoneValueType | Color | None = None,
        stroke_dasharray: NoneValueType
        | tuple[float]
        | None = None,
        stroke_dashoffset: float | None = None,
        stroke_width: float | None = None,
        segments: tuple[
            Segment | BezierCurve | EllipticalArc
        ] = tuple(),
        source: LayoutElement | None = None,
        start_shorten: float = 0.0,
        target: LayoutElement | None = None,
        transform: NoneValueType
        | tuple[Transformation]
        | None = None,
        end_arrowhead_fill: NoneValueType | Color | None = None,
        end_arrowhead_filter: NoneValueType
        | Filter
        | None = None,
        end_arrowhead_stroke: NoneValueType
        | Color
        | None = None,
        end_arrowhead_stroke_dasharray: tuple[float, ...]
        | None = None,
        end_arrowhead_stroke_dashoffset: float | None = None,
        end_arrowhead_stroke_width: float | None = None,
        end_arrowhead_transform: NoneValueType
        | tuple[Transformation]
        | None = None,
        start_arrowhead_fill: NoneValueType
        | Color
        | None = None,
        start_arrowhead_filter: NoneValueType
        | Filter
        | None = None,
        start_arrowhead_stroke: NoneValueType
        | Color
        | None = None,
        start_arrowhead_stroke_dasharray: tuple[float, ...]
        | None = None,
        start_arrowhead_stroke_dashoffset: float | None = None,
        start_arrowhead_stroke_width: float | None = None,
        start_arrowhead_transform: NoneValueType
        | tuple[Transformation]
        | None = None,
    )

Bases: `Arc`

Base class for double-headed arcs. A double-headed arc is formed of a path and two arrowheads, on at the beginning of the path and one at its end

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`id_` | `str` | The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element | `'b51d946f-1c7a-4a97-babe-89274e099975'`
`layout_elements` | `tuple[LayoutElement]` | The sub-layout elements of the group layout. These are part of the children of the group layout | `<dynamic>`
`group_fill` | `NoneValueType | Color | None` | The fill color of the group layout | `None`
`group_fill_rule` | `FillRule | None` | The fill rule of the group layout | `None`
`group_filter` | `NoneValueType | Filter | None` | The filter of the group layout | `None`
`group_font_family` | `str | None` | The font family of the group layout | `None`
`group_font_size` | `float | None` | The font size of the group layout | `None`
`group_font_style` | `FontStyle | None` | The font style of the group layout | `None`
`group_font_weight` | `FontWeight | float | None` | The font weight of the group layout | `None`
`group_stroke` | `NoneValueType | Color | None` | The stroke color of the group layout | `None`
`group_stroke_dasharray` | `tuple[float, ...] | None` | The stroke dasharray of the group layout | `None`
`group_stroke_dashoffset` | `float | None` | The stroke dashoffset of the group layout | `None`
`group_stroke_width` | `float | None` | The stroke width of the group layout | `None`
`group_text_anchor` | `TextAnchor | None` | The text anchor of the group layout | `None`
`group_transform` | `NoneValueType | tuple[Transformation] | None` | The transform of the group layout | `None`
`end_shorten` | `float` | The length the end of the arc will be shorten by | `0.0`
`fill` | `NoneValueType | Color | None` | The fill color of the arc | `None`
`filter` | `NoneValueType | Filter | None` | The fill filter of the arc | `None`
`path_fill` | `NoneValueType | Color | None` | The path fill color of the arc | `None`
`path_filter` | `NoneValueType | Filter | None` | The path filter of the arc | `None`
`path_stroke` | `NoneValueType | Color | None` | The path stroke color of the arc | `None`
`path_stroke_dasharray` | `tuple[float, ...] | None` | The path stroke dasharray of the arc | `None`
`path_stroke_dashoffset` | `float | None` | The path stroke dashoffset of the arc | `None`
`path_stroke_width` | `float | None` | The path stroke width of the arc | `None`
`path_transform` | `NoneValueType | tuple[Transformation] | None` | The path transform of the arc | `None`
`stroke` | `NoneValueType | Color | None` | The stroke color of the arc | `None`
`stroke_dasharray` | `NoneValueType | tuple[float] | None` | The stroke dasharray of the arc | `None`
`stroke_dashoffset` | `float | None` | The stroke dashoffset of the arc | `None`
`stroke_width` | `float | None` | The stroke width of the arc | `None`
`segments` | `tuple[Union[Segment, BezierCurve, EllipticalArc]]` | The path segments of the arc | `<dynamic>`
`source` | `LayoutElement | None` | The source of the arc | `None`
`start_shorten` | `float` | The length the start of the arc will be shorten by | `0.0`
`target` | `LayoutElement | None` | The target of the arc | `None`
`transform` | `NoneValueType | tuple[Transformation] | None` | The transform of the arc | `None`
`end_arrowhead_fill` | `NoneValueType | Color | None` | The end arrowhead fill color of the arc | `None`
`end_arrowhead_filter` | `NoneValueType | Filter | None` | The end arrowhead filter of the arc | `None`
`end_arrowhead_stroke` | `NoneValueType | Color | None` | The end arrowhead stroke color of the arc | `None`
`end_arrowhead_stroke_dasharray` | `tuple[float, ...] | None` | The end arrowhead stroke dasharray of the arc | `None`
`end_arrowhead_stroke_dashoffset` | `float | None` | The end arrowhead stroke dashoffset of the arc | `None`
`end_arrowhead_stroke_width` | `float | None` | The end arrowhead stroke width of the arc | `None`
`end_arrowhead_transform` | `NoneValueType | tuple[Transformation] | None` | The end arrowhead transform of the arc | `None`
`start_arrowhead_fill` | `NoneValueType | Color | None` | The start arrowhead fill color of the arc | `None`
`start_arrowhead_filter` | `NoneValueType | Filter | None` | The start arrowhead filter of the arc | `None`
`start_arrowhead_stroke` | `NoneValueType | Color | None` | The start arrowhead stroke color of the arc | `None`
`start_arrowhead_stroke_dasharray` | `tuple[float, ...] | None` | The start arrowhead stroke dasharray of the arc | `None`
`start_arrowhead_stroke_dashoffset` | `float | None` | The start arrowhead stroke dashoffset of the arc | `None`
`start_arrowhead_stroke_width` | `float | None` | The start arrowhead stroke width of the arc | `None`
`start_arrowhead_transform` | `NoneValueType | tuple[Transformation] | None` | The start arrowhead transform of the arc | `None`

Methods:

Name | Description
--- | ---
`anchor_point` | Return an anchor point of the layout element
`bbox` | Compute and return the bounding box of the group layout element
`childless` | Return a copy of the arc with no children
`children` | Return the children of the group layout.
`contains` | Return `true` if another layout element is a descendant of the layout element, `false` otherwise
`descendants` | Return the descendants of the layout element
`drawing_elements` | Return the drawing elements of the group layout.
`end_arrowhead_base` | Return the base anchor point of the double-headed arc end arrowhead
`end_arrowhead_bbox` | Return the bounding box of the double-headed arc start arrowhead
`end_arrowhead_border` | Return the point at the intersection of the drawing elements of the double-headed arc end arrowhead and the line going through the center of these drawing elements and the given point.
`end_arrowhead_length` | Return the length of the double-headed arc end arrowhead
`end_arrowhead_tip` | Return the tip anchor point of the double-headed arc end arrowhead
`end_point` | Return the ending point of the arc
`equals` | Return `true` if the layout element is equal to another layout element, `false` otherwise
`flattened` | Return a list containing copy of the layout element with no children and all its descendants with no children
`fraction` | Return the position and angle on the arc at a given fraction (of the total arc length)
`length` | Return the total length of the arc path
`path_drawing_elements` | Return the drawing elements of the double-headed arc path
`points` | Return the points of the arc path
`self_bbox` | Compute and return the bounding box of the self drawing element of the group layout
`self_children` | Return the self children of the arc
`self_drawing_elements` | Return the self drawing elements of the double-headed arc. These include the drawing elements of the arc path, the start arrowhead, and the end arrowhead
`self_to_shapely` | Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout
`start_arrowhead_base` | Return the base anchor point of the double-headed arc start arrowhead
`start_arrowhead_bbox` | Return the bounding box of the double-headed arc start arrowhead
`start_arrowhead_border` | Return the point at the intersection of the drawing elements of the double-headed arc start arrowhead and the line going through the center of these drawing elements and the given point.
`start_arrowhead_drawing_elements` | Return the drawing elements of the double-headed arc start arrowhead
`start_arrowhead_length` | Return the length of the double-headed arc start arrowhead
`start_arrowhead_tip` | Return the tip anchor point of the double-headed arc start arrowhead
`start_point` | Return the starting point of the arc
`to_shapely` | Return a shapely collection of geometries reproducing the drawing elements of the layout element

#### `` anchor_point

    anchor_point(anchor_name: str) -> Point

Return an anchor point of the layout element

Source code in `src/momapy/core.py`

    130
    131
    132
    def anchor_point(self, anchor_name: str) -> momapy.geometry.Point:
        """Return an anchor point of the layout element"""
        return getattr(self, anchor_name)()

#### `` bbox

    bbox() -> Bbox

Compute and return the bounding box of the group layout element

Source code in `src/momapy/core.py`

    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    def bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the group layout element"""
        self_bbox = self.self_bbox()
        bboxes = [child.bbox() for child in self.children()]
        min_x = self_bbox.north_west().x
        min_y = self_bbox.north_west().y
        max_x = self_bbox.south_east().x
        max_y = self_bbox.south_east().y
        for bbox in bboxes:
            if bbox.north_west().x < min_x:
                min_x = bbox.north_west().x
            if bbox.north_west().y < min_y:
                min_y = bbox.north_west().y
            if bbox.south_east().x > max_x:
                max_x = bbox.south_east().x
            if bbox.south_east().y > max_y:
                max_y = bbox.south_east().y
        bbox = momapy.geometry.Bbox(
            momapy.geometry.Point(min_x / 2 + max_x / 2, min_y / 2 + max_y / 2),
            max_x - min_x,
            max_y - min_y,
        )
        return bbox

#### `` childless

    childless() -> Self

Return a copy of the arc with no children

Source code in `src/momapy/core.py`

    955
    956
    957
    def childless(self) -> typing.Self:
        """Return a copy of the arc with no children"""
        return dataclasses.replace(self, layout_elements=tuple([]))

#### `` children

    children() -> list[LayoutElement]

Return the children of the group layout. These are the self children of the group layout (returned by the `self_children` method) and the other children of the group layout (given by the `layout_elements` attribute)

Source code in `src/momapy/core.py`

    566
    567
    568
    569
    570
    def children(self) -> list[LayoutElement]:
        """Return the children of the group layout.
        These are the self children of the group layout (returned by the `self_children` method) and the other children of the group layout (given by the `layout_elements` attribute)
        """
        return self.self_children() + list(self.layout_elements)

#### `` contains

    contains(other: LayoutElement) -> bool

Return `true` if another layout element is a descendant of the layout element, `false` otherwise

Source code in `src/momapy/core.py`

    119
    120
    121
    def contains(self, other: "LayoutElement") -> bool:
        """Return `true` if another layout element is a descendant of the layout element, `false` otherwise"""
        return other in self.descendants()

#### `` descendants

    descendants() -> list[LayoutElement]

Return the descendants of the layout element

Source code in `src/momapy/core.py`

    90
    91
    92
    93
    94
    95
    96
    def descendants(self) -> list["LayoutElement"]:
        """Return the descendants of the layout element"""
        descendants = []
        for child in self.children():
            descendants.append(child)
            descendants += child.descendants()
        return descendants

#### `` drawing_elements

    drawing_elements() -> list[DrawingElement]

Return the drawing elements of the group layout. The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children

Source code in `src/momapy/core.py`

    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    def drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the drawing elements of the group layout.
        The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children
        """
        drawing_elements = self.self_drawing_elements()
        for child in self.children():
            if child is not None:
                drawing_elements += child.drawing_elements()
        group = momapy.drawing.Group(
            class_=f"{type(self).__name__}_group",
            elements=tuple(drawing_elements),
            id_=f"{self.id_}_group",
            fill=self.group_fill,
            fill_rule=self.group_fill_rule,
            filter=self.group_filter,
            font_family=self.group_font_family,
            font_size=self.group_font_size,
            font_style=self.group_font_style,
            font_weight=self.group_font_weight,
            stroke=self.group_stroke,
            stroke_dasharray=self.group_stroke_dasharray,
            stroke_dashoffset=self.group_stroke_dashoffset,
            stroke_width=self.group_stroke_width,
            text_anchor=self.group_text_anchor,
            transform=self.group_transform,
        )
        return [group]

#### `` end_arrowhead_base

    end_arrowhead_base() -> Point

Return the base anchor point of the double-headed arc end arrowhead

Source code in `src/momapy/core.py`

    1333
    1334
    1335
    1336
    1337
    1338
    1339
    1340
    1341
    1342
    1343
    def end_arrowhead_base(self) -> momapy.geometry.Point:
        """Return the base anchor point of the double-headed arc end arrowhead"""
        arrowhead_length = self.end_arrowhead_length()
        if arrowhead_length == 0:
            return self.end_point()
        segment = self.segments[-1]
        segment_length = segment.length()
        if segment_length == 0:
            return self.end_arrowhead_tip() - (arrowhead_length, 0)
        fraction = 1 - (arrowhead_length + self.end_shorten) / segment_length
        return segment.get_position_at_fraction(fraction)

#### `` end_arrowhead_bbox

    end_arrowhead_bbox()

Return the bounding box of the double-headed arc start arrowhead

Source code in `src/momapy/core.py`

    1345
    1346
    1347
    1348
    1349
    def end_arrowhead_bbox(self):
        """Return the bounding box of the double-headed arc start arrowhead"""
        return momapy.drawing.get_drawing_elements_bbox(
            self.end_arrowhead_drawing_elements()
        )

#### `` end_arrowhead_border

    end_arrowhead_border(point)

Return the point at the intersection of the drawing elements of the double-headed arc end arrowhead and the line going through the center of these drawing elements and the given point. When there are multiple intersection points, the one closest to the given point is returned

Source code in `src/momapy/core.py`

    1351
    1352
    1353
    1354
    1355
    1356
    1357
    1358
    1359
    1360
    1361
    def end_arrowhead_border(self, point):
        """Return the point at the intersection of the drawing elements of the double-headed arc end arrowhead and the line going through the center of these drawing elements and the given point.
        When there are multiple intersection points, the one closest to the given point is returned
        """

        point = momapy.drawing.get_drawing_elements_border(
            self.end_arrowhead_drawing_elements(), point
        )
        if point.isnan():
            return self.end_arrowhead_tip()
        return point

#### `` end_arrowhead_length

    end_arrowhead_length() -> float

Return the length of the double-headed arc end arrowhead

Source code in `src/momapy/core.py`

    1315
    1316
    1317
    1318
    1319
    1320
    1321
    1322
    def end_arrowhead_length(self) -> float:
        """Return the length of the double-headed arc end arrowhead"""
        bbox = momapy.drawing.get_drawing_elements_bbox(
            self._end_arrowhead_border_drawing_elements()
        )
        if math.isnan(bbox.width):
            return 0.0
        return bbox.east().x

#### `` end_arrowhead_tip

    end_arrowhead_tip() -> Point

Return the tip anchor point of the double-headed arc end arrowhead

Source code in `src/momapy/core.py`

    1324
    1325
    1326
    1327
    1328
    1329
    1330
    1331
    def end_arrowhead_tip(self) -> momapy.geometry.Point:
        """Return the tip anchor point of the double-headed arc end arrowhead"""
        segment = self.segments[-1]
        segment_length = segment.length()
        if segment_length == 0:
            return segment.p2
        fraction = 1 - self.end_shorten / segment_length
        return segment.get_position_at_fraction(fraction)

#### `` end_point

    end_point() -> Point

Return the ending point of the arc

Source code in `src/momapy/core.py`

    951
    952
    953
    def end_point(self) -> momapy.geometry.Point:
        """Return the ending point of the arc"""
        return self.points()[-1]

#### `` equals

    equals(
        other: LayoutElement,
        flattened: bool = False,
        unordered: bool = False,
    ) -> bool

Return `true` if the layout element is equal to another layout element, `false` otherwise

Source code in `src/momapy/core.py`

    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    def equals(
        self, other: "LayoutElement", flattened: bool = False, unordered: bool = False
    ) -> bool:
        """Return `true` if the layout element is equal to another layout element, `false` otherwise"""
        if type(self) is type(other):
            if not flattened:
                return self == other
            else:
                if not unordered:
                    return self.flattened() == other.flattened()
                else:
                    return set(self.flattened()) == set(other.flattened())
        return False

#### `` flattened

    flattened() -> list[LayoutElement]

Return a list containing copy of the layout element with no children and all its descendants with no children

Source code in `src/momapy/core.py`

     98
     99
    100
    101
    102
    103
    def flattened(self) -> list["LayoutElement"]:
        """Return a list containing copy of the layout element with no children and all its descendants with no children"""
        flattened = [self.childless()]
        for child in self.children():
            flattened += child.flattened()
        return flattened

#### `` fraction

    fraction(fraction: float) -> tuple[Point, float]

Return the position and angle on the arc at a given fraction (of the total arc length)

Source code in `src/momapy/core.py`

    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    def fraction(self, fraction: float) -> tuple[momapy.geometry.Point, float]:
        """Return the position and angle on the arc at a given fraction (of the total arc length)"""
        current_length = 0
        length_to_reach = fraction * self.length()
        for segment in self.segments:
            current_length += segment.length()
            if current_length >= length_to_reach:
                break
        position, angle = segment.get_position_and_angle_at_fraction(fraction)
        return position, angle

#### `` length

    length()

Return the total length of the arc path

Source code in `src/momapy/core.py`

    943
    944
    945
    def length(self):
        """Return the total length of the arc path"""
        return sum([segment.length() for segment in self.segments])

#### `` path_drawing_elements

    path_drawing_elements() -> list[Path]

Return the drawing elements of the double-headed arc path

Source code in `src/momapy/core.py`

    1451
    1452
    1453
    1454
    1455
    1456
    1457
    1458
    1459
    1460
    1461
    1462
    1463
    1464
    1465
    1466
    1467
    1468
    1469
    1470
    1471
    1472
    1473
    1474
    1475
    1476
    1477
    1478
    1479
    1480
    1481
    1482
    1483
    1484
    1485
    1486
    1487
    1488
    1489
    1490
    1491
    1492
    def path_drawing_elements(self) -> list[momapy.drawing.Path]:
        """Return the drawing elements of the double-headed arc path"""
        start_arrowhead_length = self.start_arrowhead_length()
        end_arrowhead_length = self.end_arrowhead_length()
        if len(self.segments) == 1:
            segment = (
                self.segments[0]
                .shortened(self.start_shorten + start_arrowhead_length, "start")
                .shortened(self.end_shorten + end_arrowhead_length, "end")
            )
            actions = [
                momapy.drawing.MoveTo(segment.p1),
                self._make_path_action_from_segment(segment),
            ]
        else:
            first_segment = self.segments[0].shortened(
                self.start_shorten + start_arrowhead_length, "start"
            )
            last_segment = self.segments[-1].shortened(
                self.end_shorten + end_arrowhead_length, "end"
            )
            actions = [
                momapy.drawing.MoveTo(first_segment.p1),
                self._make_path_action_from_segment(first_segment),
            ]
            for segment in self.segments[1:-1]:
                action = self._make_path_action_from_segment(segment)
                actions.append(action)
            actions.append(self._make_path_action_from_segment(last_segment))
        path = momapy.drawing.Path(
            actions=tuple(actions),
            class_=f"{type(self).__name__}_path",
            fill=self.path_fill,
            filter=self.path_filter,
            id_=f"{self.id_}_path",
            stroke=self.path_stroke,
            stroke_dasharray=self.path_stroke_dasharray,
            stroke_dashoffset=self.path_stroke_dashoffset,
            stroke_width=self.path_stroke_width,
            transform=self.path_transform,
        )
        return [path]

#### `` points

    points() -> list[Point]

Return the points of the arc path

Source code in `src/momapy/core.py`

    935
    936
    937
    938
    939
    940
    941
    def points(self) -> list[momapy.geometry.Point]:
        """Return the points of the arc path"""
        points = []
        for segment in self.segments:
            points.append(segment.p1)
        points.append(segment.p2)
        return points

#### `` self_bbox

    self_bbox() -> Bbox

Compute and return the bounding box of the self drawing element of the group layout

Source code in `src/momapy/core.py`

    499
    500
    501
    502
    def self_bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the self drawing element of the group layout"""
        bounds = self.self_to_shapely().bounds
        return momapy.geometry.Bbox.from_bounds(bounds)

#### `` self_children

    self_children() -> list[LayoutElement]

Return the self children of the arc

Source code in `src/momapy/core.py`

    931
    932
    933
    def self_children(self) -> list[LayoutElement]:
        """Return the self children of the arc"""
        return []

#### `` self_drawing_elements

    self_drawing_elements() -> list[DrawingElement]

Return the self drawing elements of the double-headed arc. These include the drawing elements of the arc path, the start arrowhead, and the end arrowhead

Source code in `src/momapy/core.py`

    1494
    1495
    1496
    1497
    1498
    1499
    1500
    1501
    1502
    1503
    1504
    1505
    1506
    1507
    1508
    1509
    1510
    1511
    1512
    1513
    1514
    def self_drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the self drawing elements of the double-headed arc. These include the drawing elements of the arc path, the start arrowhead, and the end arrowhead"""
        drawing_elements = (
            self.path_drawing_elements()
            + self.start_arrowhead_drawing_elements()
            + self.end_arrowhead_drawing_elements()
        )

        group = momapy.drawing.Group(
            class_=type(self).__name__,
            elements=tuple(drawing_elements),
            id_=self.id_,
            fill=self.fill,
            filter=self.filter,
            stroke=self.stroke,
            stroke_dasharray=self.stroke_dasharray,
            stroke_dashoffset=self.stroke_dashoffset,
            stroke_width=self.stroke_width,
            transform=self.transform,
        )
        return [group]

#### `` self_to_shapely

    self_to_shapely() -> GeometryCollection

Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout

Source code in `src/momapy/core.py`

    495
    496
    497
    def self_to_shapely(self) -> shapely.GeometryCollection:
        """Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout"""
        return momapy.drawing.drawing_elements_to_shapely(self.drawing_elements())

#### `` start_arrowhead_base

    start_arrowhead_base() -> Point

Return the base anchor point of the double-headed arc start arrowhead

Source code in `src/momapy/core.py`

    1285
    1286
    1287
    1288
    1289
    1290
    1291
    1292
    1293
    1294
    1295
    1296
    def start_arrowhead_base(self) -> momapy.geometry.Point:
        """Return the base anchor point of the double-headed arc start arrowhead"""
        arrowhead_length = self.start_arrowhead_length()
        if arrowhead_length == 0:
            return self.start_point()
        segment = self.segments[0]
        segment = momapy.geometry.Segment(segment.p2, segment.p1)
        segment_length = segment.length()
        if segment_length == 0:
            return self.start_arrowhead_tip() + (arrowhead_length, 0)
        fraction = 1 - (arrowhead_length + self.start_shorten) / segment_length
        return segment.get_position_at_fraction(fraction)

#### `` start_arrowhead_bbox

    start_arrowhead_bbox() -> Bbox

Return the bounding box of the double-headed arc start arrowhead

Source code in `src/momapy/core.py`

    1298
    1299
    1300
    1301
    1302
    def start_arrowhead_bbox(self) -> momapy.geometry.Bbox:
        """Return the bounding box of the double-headed arc start arrowhead"""
        return momapy.drawing.get_drawing_elements_bbox(
            self.start_arrowhead_drawing_elements()
        )

#### `` start_arrowhead_border

    start_arrowhead_border(point) -> Point

Return the point at the intersection of the drawing elements of the double-headed arc start arrowhead and the line going through the center of these drawing elements and the given point. When there are multiple intersection points, the one closest to the given point is returned

Source code in `src/momapy/core.py`

    1304
    1305
    1306
    1307
    1308
    1309
    1310
    1311
    1312
    1313
    def start_arrowhead_border(self, point) -> momapy.geometry.Point:
        """Return the point at the intersection of the drawing elements of the double-headed arc start arrowhead and the line going through the center of these drawing elements and the given point.
        When there are multiple intersection points, the one closest to the given point is returned
        """
        point = momapy.drawing.get_drawing_elements_border(
            self.start_arrowhead_drawing_elements(), point
        )
        if point.isnan():
            return self.start_arrowhead_tip()
        return point

#### `` start_arrowhead_drawing_elements

    start_arrowhead_drawing_elements() -> list[DrawingElement]

Return the drawing elements of the double-headed arc start arrowhead

Source code in `src/momapy/core.py`

    1394
    1395
    1396
    1397
    1398
    1399
    1400
    1401
    1402
    1403
    1404
    1405
    1406
    1407
    1408
    1409
    1410
    1411
    1412
    1413
    def start_arrowhead_drawing_elements(
        self,
    ) -> list[momapy.drawing.DrawingElement]:
        """Return the drawing elements of the double-headed arc start arrowhead"""
        drawing_elements = self._start_arrowhead_border_drawing_elements()
        group = momapy.drawing.Group(
            class_=f"{type(self).__name__}_start_arrowhead",
            elements=tuple(drawing_elements),
            id_=f"{self.id_}_start_arrowhead",
            fill=self.start_arrowhead_fill,
            filter=self.start_arrowhead_filter,
            stroke=self.start_arrowhead_stroke,
            stroke_dasharray=self.start_arrowhead_stroke_dasharray,
            stroke_dashoffset=self.start_arrowhead_stroke_dashoffset,
            stroke_width=self.start_arrowhead_stroke_width,
            transform=self.start_arrowhead_transform,
        )
        transformation = self._get_start_arrowhead_transformation()
        group = group.transformed(transformation)
        return [group]

#### `` start_arrowhead_length

    start_arrowhead_length() -> float

Return the length of the double-headed arc start arrowhead

Source code in `src/momapy/core.py`

    1266
    1267
    1268
    1269
    1270
    1271
    1272
    1273
    def start_arrowhead_length(self) -> float:
        """Return the length of the double-headed arc start arrowhead"""
        bbox = momapy.drawing.get_drawing_elements_bbox(
            self._start_arrowhead_border_drawing_elements()
        )
        if math.isnan(bbox.width):
            return 0.0
        return abs(bbox.west().x)

#### `` start_arrowhead_tip

    start_arrowhead_tip() -> Point

Return the tip anchor point of the double-headed arc start arrowhead

Source code in `src/momapy/core.py`

    1275
    1276
    1277
    1278
    1279
    1280
    1281
    1282
    1283
    def start_arrowhead_tip(self) -> momapy.geometry.Point:
        """Return the tip anchor point of the double-headed arc start arrowhead"""
        segment = self.segments[0]
        segment = momapy.geometry.Segment(segment.p2, segment.p1)
        segment_length = segment.length()
        if segment_length == 0:
            return segment.p2
        fraction = 1 - self.start_shorten / segment_length
        return segment.get_position_at_fraction(fraction)

#### `` start_point

    start_point() -> Point

Return the starting point of the arc

Source code in `src/momapy/core.py`

    947
    948
    949
    def start_point(self) -> momapy.geometry.Point:
        """Return the starting point of the arc"""
        return self.points()[0]

#### `` to_shapely

    to_shapely(to_polygons: bool = False) -> GeometryCollection

Return a shapely collection of geometries reproducing the drawing elements of the layout element

Source code in `src/momapy/core.py`

    123
    124
    125
    126
    127
    128
    def to_shapely(self, to_polygons: bool = False) -> shapely.GeometryCollection:
        """Return a shapely collection of geometries reproducing the drawing elements of the layout element"""
        geom_collection = []
        for drawing_element in self.drawing_elements():
            geom_collection += drawing_element.to_shapely(to_polygons=to_polygons).geoms
        return shapely.GeometryCollection(geom_collection)

### `` DoubleHeadedArcBuilder `module-attribute`

    DoubleHeadedArcBuilder = get_or_make_builder_cls(
        DoubleHeadedArc
    )

Base class for double-headed arc builders

### `` FrozendictBuilder `dataclass`

    FrozendictBuilder()

Bases: `dict`, `Builder`

Builder class for frozendicts

Methods:

Name | Description
--- | ---
`build` | Build and return an object from the builder object
`from_object` | Create and return a builder object from an object

#### `` build

    build(
        inside_collections: bool = True,
        builder_to_object: dict[int, Any] | None = None,
    )

Build and return an object from the builder object

Source code in `src/momapy/core.py`

    1750
    1751
    1752
    1753
    1754
    1755
    1756
    1757
    1758
    1759
    1760
    1761
    1762
    1763
    1764
    1765
    1766
    1767
    1768
    1769
    1770
    1771
    1772
    1773
    1774
    1775
    1776
    1777
    1778
    def build(
        self,
        inside_collections: bool = True,
        builder_to_object: dict[int, typing.Any] | None = None,
    ):
        if builder_to_object is not None:
            obj = builder_to_object.get(id(self))
            if obj is not None:
                return obj
        else:
            builder_to_object = {}
        obj = self._cls_to_build(
            [
                (
                    momapy.builder.object_from_builder(
                        builder=k,
                        inside_collections=inside_collections,
                        builder_to_object=builder_to_object,
                    ),
                    momapy.builder.object_from_builder(
                        builder=v,
                        inside_collections=inside_collections,
                        builder_to_object=builder_to_object,
                    ),
                )
                for k, v in self.items()
            ]
        )
        return obj

#### `` from_object `classmethod`

    from_object(
        obj,
        inside_collections: bool = True,
        omit_keys: bool = True,
        object_to_builder: dict[int, Builder] | None = None,
    )

Create and return a builder object from an object

Source code in `src/momapy/core.py`

    1780
    1781
    1782
    1783
    1784
    1785
    1786
    1787
    1788
    1789
    1790
    1791
    1792
    1793
    1794
    1795
    1796
    1797
    1798
    1799
    1800
    1801
    1802
    1803
    1804
    1805
    1806
    1807
    1808
    1809
    1810
    1811
    1812
    1813
    1814
    1815
    1816
    1817
    1818
    1819
    1820
    1821
    1822
    1823
    1824
    1825
    @classmethod
    def from_object(
        cls,
        obj,
        inside_collections: bool = True,
        omit_keys: bool = True,
        object_to_builder: dict[int, momapy.builder.Builder] | None = None,
    ):
        if object_to_builder is not None:
            builder = object_to_builder.get(id(obj))
            if builder is not None:
                return builder
        else:
            object_to_builder = {}
        builder = cls(
            [
                (
                    (
                        momapy.builder.builder_from_object(
                            obj=k,
                            inside_collections=inside_collections,
                            omit_keys=omit_keys,
                            object_to_builder=object_to_builder,
                        ),
                        momapy.builder.builder_from_object(
                            obj=v,
                            inside_collections=inside_collections,
                            omit_keys=omit_keys,
                            object_to_builder=object_to_builder,
                        ),
                    )
                    if not omit_keys
                    else (
                        k,
                        momapy.builder.builder_from_object(
                            obj=v,
                            inside_collections=inside_collections,
                            omit_keys=omit_keys,
                            object_to_builder=object_to_builder,
                        ),
                    )
                )
                for k, v in obj.items()
            ]
        )
        return builder

### `` FrozensetBuilder `dataclass`

    FrozensetBuilder()

Bases: `set`, `Builder`

Builder class for frozensets

Methods:

Name | Description
--- | ---
`build` | Build and return an object from the builder object
`from_object` | Create and return a builder object from an object

#### `` build

    build(
        inside_collections: bool = True,
        builder_to_object: dict[int, Any] | None = None,
    )

Build and return an object from the builder object

Source code in `src/momapy/core.py`

    1695
    1696
    1697
    1698
    1699
    1700
    1701
    1702
    1703
    1704
    1705
    1706
    1707
    1708
    1709
    1710
    1711
    1712
    1713
    1714
    1715
    1716
    def build(
        self,
        inside_collections: bool = True,
        builder_to_object: dict[int, typing.Any] | None = None,
    ):
        if builder_to_object is not None:
            obj = builder_to_object.get(id(self))
            if obj is not None:
                return obj
        else:
            builder_to_object = {}
        obj = self._cls_to_build(
            [
                momapy.builder.object_from_builder(
                    builder=e,
                    inside_collections=inside_collections,
                    builder_to_object=builder_to_object,
                )
                for e in self
            ]
        )
        return obj

#### `` from_object `classmethod`

    from_object(
        obj,
        inside_collections: bool = True,
        omit_keys: bool = True,
        object_to_builder: dict[int, Builder] | None = None,
    )

Create and return a builder object from an object

Source code in `src/momapy/core.py`

    1718
    1719
    1720
    1721
    1722
    1723
    1724
    1725
    1726
    1727
    1728
    1729
    1730
    1731
    1732
    1733
    1734
    1735
    1736
    1737
    1738
    1739
    1740
    1741
    1742
    @classmethod
    def from_object(
        cls,
        obj,
        inside_collections: bool = True,
        omit_keys: bool = True,
        object_to_builder: dict[int, momapy.builder.Builder] | None = None,
    ):
        if object_to_builder is not None:
            builder = object_to_builder.get(id(obj))
            if builder is not None:
                return builder
        else:
            object_to_builder = {}
        builder = cls(
            [
                momapy.builder.builder_from_object(
                    obj=e,
                    inside_collections=inside_collections,
                    object_to_builder=object_to_builder,
                )
                for e in obj
            ]
        )
        return builder

### `` GroupLayout `dataclass`

    GroupLayout(
        *,
        id_: str = make_uuid4_as_str(),
        layout_elements: tuple[LayoutElement] = tuple(),
        group_fill: NoneValueType | Color | None = None,
        group_fill_rule: FillRule | None = None,
        group_filter: NoneValueType | Filter | None = None,
        group_font_family: str | None = None,
        group_font_size: float | None = None,
        group_font_style: FontStyle | None = None,
        group_font_weight: FontWeight | float | None = None,
        group_stroke: NoneValueType | Color | None = None,
        group_stroke_dasharray: tuple[float, ...] | None = None,
        group_stroke_dashoffset: float | None = None,
        group_stroke_width: float | None = None,
        group_text_anchor: TextAnchor | None = None,
        group_transform: NoneValueType
        | tuple[Transformation]
        | None = None,
    )

Bases: `LayoutElement`

Base class for group layouts. A group layout is a layout element grouping other layout elements. It has its own drawing elements and set of children (called self drawing elements and self children, respectively). The drawing elements of a group layout is a group drawing element formed of its self drawing elements and those of its children

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`id_` | `str` | The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element | `'5182e3a4-2dcf-4d83-a421-f9749d92e4c2'`
`layout_elements` | `tuple[LayoutElement]` | The sub-layout elements of the group layout. These are part of the children of the group layout | `<dynamic>`
`group_fill` | `NoneValueType | Color | None` | The fill color of the group layout | `None`
`group_fill_rule` | `FillRule | None` | The fill rule of the group layout | `None`
`group_filter` | `NoneValueType | Filter | None` | The filter of the group layout | `None`
`group_font_family` | `str | None` | The font family of the group layout | `None`
`group_font_size` | `float | None` | The font size of the group layout | `None`
`group_font_style` | `FontStyle | None` | The font style of the group layout | `None`
`group_font_weight` | `FontWeight | float | None` | The font weight of the group layout | `None`
`group_stroke` | `NoneValueType | Color | None` | The stroke color of the group layout | `None`
`group_stroke_dasharray` | `tuple[float, ...] | None` | The stroke dasharray of the group layout | `None`
`group_stroke_dashoffset` | `float | None` | The stroke dashoffset of the group layout | `None`
`group_stroke_width` | `float | None` | The stroke width of the group layout | `None`
`group_text_anchor` | `TextAnchor | None` | The text anchor of the group layout | `None`
`group_transform` | `NoneValueType | tuple[Transformation] | None` | The transform of the group layout | `None`

Methods:

Name | Description
--- | ---
`anchor_point` | Return an anchor point of the layout element
`bbox` | Compute and return the bounding box of the group layout element
`childless` | Return a copy of the layout element with no children
`children` | Return the children of the group layout.
`contains` | Return `true` if another layout element is a descendant of the layout element, `false` otherwise
`descendants` | Return the descendants of the layout element
`drawing_elements` | Return the drawing elements of the group layout.
`equals` | Return `true` if the layout element is equal to another layout element, `false` otherwise
`flattened` | Return a list containing copy of the layout element with no children and all its descendants with no children
`self_bbox` | Compute and return the bounding box of the self drawing element of the group layout
`self_children` | Return the self children of the group layout
`self_drawing_elements` | Return the self drawing elements of the group layout
`self_to_shapely` | Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout
`to_shapely` | Return a shapely collection of geometries reproducing the drawing elements of the layout element

#### `` anchor_point

    anchor_point(anchor_name: str) -> Point

Return an anchor point of the layout element

Source code in `src/momapy/core.py`

    130
    131
    132
    def anchor_point(self, anchor_name: str) -> momapy.geometry.Point:
        """Return an anchor point of the layout element"""
        return getattr(self, anchor_name)()

#### `` bbox

    bbox() -> Bbox

Compute and return the bounding box of the group layout element

Source code in `src/momapy/core.py`

    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    def bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the group layout element"""
        self_bbox = self.self_bbox()
        bboxes = [child.bbox() for child in self.children()]
        min_x = self_bbox.north_west().x
        min_y = self_bbox.north_west().y
        max_x = self_bbox.south_east().x
        max_y = self_bbox.south_east().y
        for bbox in bboxes:
            if bbox.north_west().x < min_x:
                min_x = bbox.north_west().x
            if bbox.north_west().y < min_y:
                min_y = bbox.north_west().y
            if bbox.south_east().x > max_x:
                max_x = bbox.south_east().x
            if bbox.south_east().y > max_y:
                max_y = bbox.south_east().y
        bbox = momapy.geometry.Bbox(
            momapy.geometry.Point(min_x / 2 + max_x / 2, min_y / 2 + max_y / 2),
            max_x - min_x,
            max_y - min_y,
        )
        return bbox

#### `` childless `abstractmethod`

    childless() -> Self

Return a copy of the layout element with no children

Source code in `src/momapy/core.py`

    85
    86
    87
    88
    @abc.abstractmethod
    def childless(self) -> typing.Self:
        """Return a copy of the layout element with no children"""
        pass

#### `` children

    children() -> list[LayoutElement]

Return the children of the group layout. These are the self children of the group layout (returned by the `self_children` method) and the other children of the group layout (given by the `layout_elements` attribute)

Source code in `src/momapy/core.py`

    566
    567
    568
    569
    570
    def children(self) -> list[LayoutElement]:
        """Return the children of the group layout.
        These are the self children of the group layout (returned by the `self_children` method) and the other children of the group layout (given by the `layout_elements` attribute)
        """
        return self.self_children() + list(self.layout_elements)

#### `` contains

    contains(other: LayoutElement) -> bool

Return `true` if another layout element is a descendant of the layout element, `false` otherwise

Source code in `src/momapy/core.py`

    119
    120
    121
    def contains(self, other: "LayoutElement") -> bool:
        """Return `true` if another layout element is a descendant of the layout element, `false` otherwise"""
        return other in self.descendants()

#### `` descendants

    descendants() -> list[LayoutElement]

Return the descendants of the layout element

Source code in `src/momapy/core.py`

    90
    91
    92
    93
    94
    95
    96
    def descendants(self) -> list["LayoutElement"]:
        """Return the descendants of the layout element"""
        descendants = []
        for child in self.children():
            descendants.append(child)
            descendants += child.descendants()
        return descendants

#### `` drawing_elements

    drawing_elements() -> list[DrawingElement]

Return the drawing elements of the group layout. The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children

Source code in `src/momapy/core.py`

    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    def drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the drawing elements of the group layout.
        The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children
        """
        drawing_elements = self.self_drawing_elements()
        for child in self.children():
            if child is not None:
                drawing_elements += child.drawing_elements()
        group = momapy.drawing.Group(
            class_=f"{type(self).__name__}_group",
            elements=tuple(drawing_elements),
            id_=f"{self.id_}_group",
            fill=self.group_fill,
            fill_rule=self.group_fill_rule,
            filter=self.group_filter,
            font_family=self.group_font_family,
            font_size=self.group_font_size,
            font_style=self.group_font_style,
            font_weight=self.group_font_weight,
            stroke=self.group_stroke,
            stroke_dasharray=self.group_stroke_dasharray,
            stroke_dashoffset=self.group_stroke_dashoffset,
            stroke_width=self.group_stroke_width,
            text_anchor=self.group_text_anchor,
            transform=self.group_transform,
        )
        return [group]

#### `` equals

    equals(
        other: LayoutElement,
        flattened: bool = False,
        unordered: bool = False,
    ) -> bool

Return `true` if the layout element is equal to another layout element, `false` otherwise

Source code in `src/momapy/core.py`

    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    def equals(
        self, other: "LayoutElement", flattened: bool = False, unordered: bool = False
    ) -> bool:
        """Return `true` if the layout element is equal to another layout element, `false` otherwise"""
        if type(self) is type(other):
            if not flattened:
                return self == other
            else:
                if not unordered:
                    return self.flattened() == other.flattened()
                else:
                    return set(self.flattened()) == set(other.flattened())
        return False

#### `` flattened

    flattened() -> list[LayoutElement]

Return a list containing copy of the layout element with no children and all its descendants with no children

Source code in `src/momapy/core.py`

     98
     99
    100
    101
    102
    103
    def flattened(self) -> list["LayoutElement"]:
        """Return a list containing copy of the layout element with no children and all its descendants with no children"""
        flattened = [self.childless()]
        for child in self.children():
            flattened += child.flattened()
        return flattened

#### `` self_bbox

    self_bbox() -> Bbox

Compute and return the bounding box of the self drawing element of the group layout

Source code in `src/momapy/core.py`

    499
    500
    501
    502
    def self_bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the self drawing element of the group layout"""
        bounds = self.self_to_shapely().bounds
        return momapy.geometry.Bbox.from_bounds(bounds)

#### `` self_children `abstractmethod`

    self_children() -> list[LayoutElement]

Return the self children of the group layout

Source code in `src/momapy/core.py`

    533
    534
    535
    536
    @abc.abstractmethod
    def self_children(self) -> list[LayoutElement]:
        """Return the self children of the group layout"""
        pass

#### `` self_drawing_elements `abstractmethod`

    self_drawing_elements() -> list[DrawingElement]

Return the self drawing elements of the group layout

Source code in `src/momapy/core.py`

    528
    529
    530
    531
    @abc.abstractmethod
    def self_drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the self drawing elements of the group layout"""
        pass

#### `` self_to_shapely

    self_to_shapely() -> GeometryCollection

Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout

Source code in `src/momapy/core.py`

    495
    496
    497
    def self_to_shapely(self) -> shapely.GeometryCollection:
        """Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout"""
        return momapy.drawing.drawing_elements_to_shapely(self.drawing_elements())

#### `` to_shapely

    to_shapely(to_polygons: bool = False) -> GeometryCollection

Return a shapely collection of geometries reproducing the drawing elements of the layout element

Source code in `src/momapy/core.py`

    123
    124
    125
    126
    127
    128
    def to_shapely(self, to_polygons: bool = False) -> shapely.GeometryCollection:
        """Return a shapely collection of geometries reproducing the drawing elements of the layout element"""
        geom_collection = []
        for drawing_element in self.drawing_elements():
            geom_collection += drawing_element.to_shapely(to_polygons=to_polygons).geoms
        return shapely.GeometryCollection(geom_collection)

### `` Layout `dataclass`

    Layout(
        *,
        id_: str = make_uuid4_as_str(),
        layout_elements: tuple[LayoutElement] = tuple(),
        group_fill: NoneValueType | Color | None = None,
        group_fill_rule: FillRule | None = None,
        group_filter: NoneValueType | Filter | None = None,
        group_font_family: str | None = None,
        group_font_size: float | None = None,
        group_font_style: FontStyle | None = None,
        group_font_weight: FontWeight | float | None = None,
        group_stroke: NoneValueType | Color | None = None,
        group_stroke_dasharray: tuple[float, ...] | None = None,
        group_stroke_dashoffset: float | None = None,
        group_stroke_width: float | None = None,
        group_text_anchor: TextAnchor | None = None,
        group_transform: NoneValueType
        | tuple[Transformation]
        | None = None,
        fill: NoneValueType | Color | None = NoneValue,
        filter: NoneValueType | Filter | None = None,
        height: float,
        label: TextLayout | None = None,
        position: Point,
        stroke: NoneValueType | Color | None = None,
        stroke_dasharray: tuple[float, ...] | None = None,
        stroke_dashoffset: float | None = None,
        stroke_width: float | None = None,
        transform: NoneValueType
        | tuple[Transformation]
        | None = None,
        width: float,
    )

Bases: `Node`

Class for layouts

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`id_` | `str` | The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element | `'1741b7d2-c138-4c15-8dfb-f4c4b1702807'`
`layout_elements` | `tuple[LayoutElement]` | The sub-layout elements of the group layout. These are part of the children of the group layout | `<dynamic>`
`group_fill` | `NoneValueType | Color | None` | The fill color of the group layout | `None`
`group_fill_rule` | `FillRule | None` | The fill rule of the group layout | `None`
`group_filter` | `NoneValueType | Filter | None` | The filter of the group layout | `None`
`group_font_family` | `str | None` | The font family of the group layout | `None`
`group_font_size` | `float | None` | The font size of the group layout | `None`
`group_font_style` | `FontStyle | None` | The font style of the group layout | `None`
`group_font_weight` | `FontWeight | float | None` | The font weight of the group layout | `None`
`group_stroke` | `NoneValueType | Color | None` | The stroke color of the group layout | `None`
`group_stroke_dasharray` | `tuple[float, ...] | None` | The stroke dasharray of the group layout | `None`
`group_stroke_dashoffset` | `float | None` | The stroke dashoffset of the group layout | `None`
`group_stroke_width` | `float | None` | The stroke width of the group layout | `None`
`group_text_anchor` | `TextAnchor | None` | The text anchor of the group layout | `None`
`group_transform` | `NoneValueType | tuple[Transformation] | None` | The transform of the group layout | `None`
`fill` | `NoneValueType | Color | None` |  | `<momapy.drawing.NoneValueType object at 0x7fb32ae9f1d0>`
`filter` | `NoneValueType | Filter | None` | The filter of the node | `None`
`height` | `float` | The height of the node | required
`label` | `TextLayout | None` | The label of the node | `None`
`position` | `Point` | The position of the node | required
`stroke` | `NoneValueType | Color | None` | The stroke color of the node | `None`
`stroke_dasharray` | `tuple[float, ...] | None` | The stroke dasharray of the node | `None`
`stroke_dashoffset` | `float | None` | The stroke dashoffset of the node | `None`
`stroke_width` | `float | None` | The stroke width of the node | `None`
`transform` | `NoneValueType | tuple[Transformation] | None` | The transform of the node | `None`
`width` | `float` | The width width of the node | required

Methods:

Name | Description
--- | ---
`anchor_point` | Return an anchor point of the layout element
`angle` | Return the point on the border of the node that intersects the drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal.
`bbox` | Compute and return the bounding box of the group layout element
`border` | Return the point on the border of the node that intersects the drawing elements of the node with the line formed of the center anchor point of the node and the given point.
`center` | Return the center anchor of the node
`childless` | Return a copy of the node with no children
`children` | Return the children of the group layout.
`contains` | Return `true` if another layout element is a descendant of the layout element, `false` otherwise
`descendants` | Return the descendants of the layout element
`drawing_elements` | Return the drawing elements of the group layout.
`east` | Return the east anchor of the node
`east_north_east` | Return the east north east anchor of the node
`east_south_east` | Return the east south east west anchor of the node
`equals` | Return `true` if the layout element is equal to another layout element, `false` otherwise
`flattened` | Return a list containing copy of the layout element with no children and all its descendants with no children
`is_sublayout` | Return `true` if another given layout is a sublayout of the layout, `false` otherwise
`label_center` | Return the label center anchor of the node
`north` | Return the north anchor of the node
`north_east` | Return the north east anchor of the node
`north_north_east` | Return the north north east anchor of the node
`north_north_west` | Return the north north west anchor of the node
`north_west` | Return the north west anchor of the node
`self_angle` | Return the point on the border of the node that intersects the self drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal.
`self_bbox` | Compute and return the bounding box of the self drawing element of the group layout
`self_border` | Return the point on the border of the node that intersects the self drawing elements of the node with the line formed of the center anchor point of the node and the given point.
`self_children` | Return the self children of the node. A node has unique child that is its label
`self_drawing_elements` | Return the node's own drawing elements
`self_to_shapely` | Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout
`size` | Return the size of the node
`south` | Return the south anchor of the node
`south_east` | Return the south east anchor of the node
`south_south_east` | Return the south south east anchor of the node
`south_south_west` | Return the south south west anchor of the node
`south_west` | Return the south west anchor of the node
`to_shapely` | Return a shapely collection of geometries reproducing the drawing elements of the layout element
`west` | Return the west anchor of the node
`west_north_west` | Return the west north west anchor of the node
`west_south_west` | Return the west south west anchor of the node

Attributes:

Name | Type | Description
--- | --- | ---
`x` | `float` | Return the x coordinate of the node
`y` | `float` | Return the y coordinate of the node

#### `` anchor_point

    anchor_point(anchor_name: str) -> Point

Return an anchor point of the layout element

Source code in `src/momapy/core.py`

    130
    131
    132
    def anchor_point(self, anchor_name: str) -> momapy.geometry.Point:
        """Return an anchor point of the layout element"""
        return getattr(self, anchor_name)()

#### `` angle

    angle(
        angle: float,
        unit: Literal["degrees", "radians"] = "degrees",
    ) -> Point

Return the point on the border of the node that intersects the drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal.

Source code in `src/momapy/core.py`

    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    def angle(
        self,
        angle: float,
        unit: typing.Literal["degrees", "radians"] = "degrees",
    ) -> momapy.geometry.Point:
        """Return the point on the border of the node that intersects the drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal."""
        return momapy.drawing.get_drawing_elements_angle(
            drawing_elements=self.drawing_elements(),
            angle=angle,
            unit=unit,
            center=self.center(),
        )

#### `` bbox

    bbox() -> Bbox

Compute and return the bounding box of the group layout element

Source code in `src/momapy/core.py`

    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    def bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the group layout element"""
        self_bbox = self.self_bbox()
        bboxes = [child.bbox() for child in self.children()]
        min_x = self_bbox.north_west().x
        min_y = self_bbox.north_west().y
        max_x = self_bbox.south_east().x
        max_y = self_bbox.south_east().y
        for bbox in bboxes:
            if bbox.north_west().x < min_x:
                min_x = bbox.north_west().x
            if bbox.north_west().y < min_y:
                min_y = bbox.north_west().y
            if bbox.south_east().x > max_x:
                max_x = bbox.south_east().x
            if bbox.south_east().y > max_y:
                max_y = bbox.south_east().y
        bbox = momapy.geometry.Bbox(
            momapy.geometry.Point(min_x / 2 + max_x / 2, min_y / 2 + max_y / 2),
            max_x - min_x,
            max_y - min_y,
        )
        return bbox

#### `` border

    border(point: Point) -> Point

Return the point on the border of the node that intersects the drawing elements of the node with the line formed of the center anchor point of the node and the given point. When there are multiple intersection points, the one closest to the given point is returned

Source code in `src/momapy/core.py`

    794
    795
    796
    797
    798
    799
    800
    801
    802
    def border(self, point: momapy.geometry.Point) -> momapy.geometry.Point:
        """Return the point on the border of the node that intersects the drawing elements of the node with the line formed of the center anchor point of the node and the given point.
        When there are multiple intersection points, the one closest to the given point is returned
        """
        return momapy.drawing.get_drawing_elements_border(
            drawing_elements=self.drawing_elements(),
            point=point,
            center=self.center(),
        )

#### `` center

    center() -> Point

Return the center anchor of the node

Source code in `src/momapy/core.py`

    776
    777
    778
    def center(self) -> momapy.geometry.Point:
        """Return the center anchor of the node"""
        return self.position

#### `` childless

    childless() -> Self

Return a copy of the node with no children

Source code in `src/momapy/core.py`

    830
    831
    832
    def childless(self) -> typing.Self:
        """Return a copy of the node with no children"""
        return dataclasses.replace(self, label=None, layout_elements=tuple([]))

#### `` children

    children() -> list[LayoutElement]

Return the children of the group layout. These are the self children of the group layout (returned by the `self_children` method) and the other children of the group layout (given by the `layout_elements` attribute)

Source code in `src/momapy/core.py`

    566
    567
    568
    569
    570
    def children(self) -> list[LayoutElement]:
        """Return the children of the group layout.
        These are the self children of the group layout (returned by the `self_children` method) and the other children of the group layout (given by the `layout_elements` attribute)
        """
        return self.self_children() + list(self.layout_elements)

#### `` contains

    contains(other: LayoutElement) -> bool

Return `true` if another layout element is a descendant of the layout element, `false` otherwise

Source code in `src/momapy/core.py`

    119
    120
    121
    def contains(self, other: "LayoutElement") -> bool:
        """Return `true` if another layout element is a descendant of the layout element, `false` otherwise"""
        return other in self.descendants()

#### `` descendants

    descendants() -> list[LayoutElement]

Return the descendants of the layout element

Source code in `src/momapy/core.py`

    90
    91
    92
    93
    94
    95
    96
    def descendants(self) -> list["LayoutElement"]:
        """Return the descendants of the layout element"""
        descendants = []
        for child in self.children():
            descendants.append(child)
            descendants += child.descendants()
        return descendants

#### `` drawing_elements

    drawing_elements() -> list[DrawingElement]

Return the drawing elements of the group layout. The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children

Source code in `src/momapy/core.py`

    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    def drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the drawing elements of the group layout.
        The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children
        """
        drawing_elements = self.self_drawing_elements()
        for child in self.children():
            if child is not None:
                drawing_elements += child.drawing_elements()
        group = momapy.drawing.Group(
            class_=f"{type(self).__name__}_group",
            elements=tuple(drawing_elements),
            id_=f"{self.id_}_group",
            fill=self.group_fill,
            fill_rule=self.group_fill_rule,
            filter=self.group_filter,
            font_family=self.group_font_family,
            font_size=self.group_font_size,
            font_style=self.group_font_style,
            font_weight=self.group_font_weight,
            stroke=self.group_stroke,
            stroke_dasharray=self.group_stroke_dasharray,
            stroke_dashoffset=self.group_stroke_dashoffset,
            stroke_width=self.group_stroke_width,
            text_anchor=self.group_text_anchor,
            transform=self.group_transform,
        )
        return [group]

#### `` east

    east() -> Point

Return the east anchor of the node

Source code in `src/momapy/core.py`

    708
    709
    710
    def east(self) -> momapy.geometry.Point:
        """Return the east anchor of the node"""
        return self.self_angle(0)

#### `` east_north_east

    east_north_east() -> Point

Return the east north east anchor of the node

Source code in `src/momapy/core.py`

    700
    701
    702
    703
    704
    705
    706
    def east_north_east(self) -> momapy.geometry.Point:
        """Return the east north east anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (self.width / 2, -self.height / 4)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` east_south_east

    east_south_east() -> Point

Return the east south east west anchor of the node

Source code in `src/momapy/core.py`

    712
    713
    714
    715
    716
    717
    718
    def east_south_east(self) -> momapy.geometry.Point:
        """Return the east south east west anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (self.width / 2, self.height / 4)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` equals

    equals(
        other: LayoutElement,
        flattened: bool = False,
        unordered: bool = False,
    ) -> bool

Return `true` if the layout element is equal to another layout element, `false` otherwise

Source code in `src/momapy/core.py`

    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    def equals(
        self, other: "LayoutElement", flattened: bool = False, unordered: bool = False
    ) -> bool:
        """Return `true` if the layout element is equal to another layout element, `false` otherwise"""
        if type(self) is type(other):
            if not flattened:
                return self == other
            else:
                if not unordered:
                    return self.flattened() == other.flattened()
                else:
                    return set(self.flattened()) == set(other.flattened())
        return False

#### `` flattened

    flattened() -> list[LayoutElement]

Return a list containing copy of the layout element with no children and all its descendants with no children

Source code in `src/momapy/core.py`

     98
     99
    100
    101
    102
    103
    def flattened(self) -> list["LayoutElement"]:
        """Return a list containing copy of the layout element with no children and all its descendants with no children"""
        flattened = [self.childless()]
        for child in self.children():
            flattened += child.flattened()
        return flattened

#### `` is_sublayout

    is_sublayout(other, flattened=False, unordered=False)

Return `true` if another given layout is a sublayout of the layout, `false` otherwise

Source code in `src/momapy/core.py`

    1545
    1546
    1547
    1548
    1549
    1550
    1551
    1552
    1553
    1554
    1555
    1556
    1557
    1558
    1559
    1560
    1561
    1562
    1563
    1564
    1565
    1566
    1567
    1568
    1569
    1570
    1571
    1572
    1573
    1574
    1575
    1576
    1577
    1578
    1579
    def is_sublayout(self, other, flattened=False, unordered=False):
        """Return `true` if another given layout is a sublayout of the layout, `false` otherwise"""

        def _is_sublist(list1, list2, unordered=False) -> bool:
            if not unordered:
                i = 0
                for elem1 in list1:
                    elem2 = list2[i]
                    while elem2 != elem1 and i < len(list2) - 1:
                        i += 1
                        elem2 = list2[i]
                    if not elem2 == elem1:
                        return False
                    i += 1
            else:
                dlist1 = collections.defaultdict(int)
                dlist2 = collections.defaultdict(int)
                for elem1 in list1:
                    dlist1[elem1] += 1
                for elem2 in list2:
                    dlist2[elem2] += 1
                for elem in dlist1:
                    if dlist1[elem] > dlist2[elem]:
                        return False
            return True

        if self.childless() != other.childless():
            return False
        if flattened:
            return _is_sublist(
                self.flattened()[1:],
                other.flattened()[1:],
                unordered=unordered,
            )
        return _is_sublist(self.children(), other.children(), unordered=unordered)

#### `` label_center

    label_center() -> Point

Return the label center anchor of the node

Source code in `src/momapy/core.py`

    780
    781
    782
    def label_center(self) -> momapy.geometry.Point:
        """Return the label center anchor of the node"""
        return self.position

#### `` north

    north() -> Point

Return the north anchor of the node

Source code in `src/momapy/core.py`

    680
    681
    682
    def north(self) -> momapy.geometry.Point:
        """Return the north anchor of the node"""
        return self.self_angle(90)

#### `` north_east

    north_east() -> Point

Return the north east anchor of the node

Source code in `src/momapy/core.py`

    692
    693
    694
    695
    696
    697
    698
    def north_east(self) -> momapy.geometry.Point:
        """Return the north east anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (self.width / 2, -self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` north_north_east

    north_north_east() -> Point

Return the north north east anchor of the node

Source code in `src/momapy/core.py`

    684
    685
    686
    687
    688
    689
    690
    def north_north_east(self) -> momapy.geometry.Point:
        """Return the north north east anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (self.width / 4, -self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` north_north_west

    north_north_west() -> Point

Return the north north west anchor of the node

Source code in `src/momapy/core.py`

    672
    673
    674
    675
    676
    677
    678
    def north_north_west(self) -> momapy.geometry.Point:
        """Return the north north west anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() - (self.width / 4, self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` north_west

    north_west() -> Point

Return the north west anchor of the node

Source code in `src/momapy/core.py`

    664
    665
    666
    667
    668
    669
    670
    def north_west(self) -> momapy.geometry.Point:
        """Return the north west anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() - (self.width / 2, self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` self_angle

    self_angle(
        angle: float,
        unit: Literal["degrees", "radians"] = "degrees",
    ) -> Point

Return the point on the border of the node that intersects the self drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal.

Source code in `src/momapy/core.py`

    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    def self_angle(
        self,
        angle: float,
        unit: typing.Literal["degrees", "radians"] = "degrees",
    ) -> momapy.geometry.Point:
        """Return the point on the border of the node that intersects the self drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal."""
        return momapy.drawing.get_drawing_elements_angle(
            drawing_elements=self.self_drawing_elements(),
            angle=angle,
            unit=unit,
            center=self.center(),
        )

#### `` self_bbox

    self_bbox() -> Bbox

Compute and return the bounding box of the self drawing element of the group layout

Source code in `src/momapy/core.py`

    499
    500
    501
    502
    def self_bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the self drawing element of the group layout"""
        bounds = self.self_to_shapely().bounds
        return momapy.geometry.Bbox.from_bounds(bounds)

#### `` self_border

    self_border(point: Point) -> Point

Return the point on the border of the node that intersects the self drawing elements of the node with the line formed of the center anchor point of the node and the given point. When there are multiple intersection points, the one closest to the given point is returned

Source code in `src/momapy/core.py`

    784
    785
    786
    787
    788
    789
    790
    791
    792
    def self_border(self, point: momapy.geometry.Point) -> momapy.geometry.Point:
        """Return the point on the border of the node that intersects the self drawing elements of the node with the line formed of the center anchor point of the node and the given point.
        When there are multiple intersection points, the one closest to the given point is returned
        """
        return momapy.drawing.get_drawing_elements_border(
            drawing_elements=self.self_drawing_elements(),
            point=point,
            center=self.center(),
        )

#### `` self_children

    self_children() -> list[LayoutElement]

Return the self children of the node. A node has unique child that is its label

Source code in `src/momapy/core.py`

    654
    655
    656
    657
    658
    def self_children(self) -> list[LayoutElement]:
        """Return the self children of the node. A node has unique child that is its label"""
        if self.label is not None:
            return [self.label]
        return []

#### `` self_drawing_elements

    self_drawing_elements() -> list[DrawingElement]

Return the node's own drawing elements

Source code in `src/momapy/core.py`

    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    def self_drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the node's own drawing elements"""
        drawing_elements = self._border_drawing_elements()
        group = momapy.drawing.Group(
            class_=type(self).__name__,
            elements=tuple(drawing_elements),
            fill=self.fill,
            filter=self.filter,
            id_=self.id_,
            stroke=self.stroke,
            stroke_dasharray=self.stroke_dasharray,
            stroke_dashoffset=self.stroke_dashoffset,
            stroke_width=self.stroke_width,
            transform=self.transform,
        )
        return [group]

#### `` self_to_shapely

    self_to_shapely() -> GeometryCollection

Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout

Source code in `src/momapy/core.py`

    495
    496
    497
    def self_to_shapely(self) -> shapely.GeometryCollection:
        """Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout"""
        return momapy.drawing.drawing_elements_to_shapely(self.drawing_elements())

#### `` size

    size() -> tuple[float, float]

Return the size of the node

Source code in `src/momapy/core.py`

    660
    661
    662
    def size(self) -> tuple[float, float]:
        """Return the size of the node"""
        return (self.width, self.height)

#### `` south

    south() -> Point

Return the south anchor of the node

Source code in `src/momapy/core.py`

    736
    737
    738
    def south(self) -> momapy.geometry.Point:
        """Return the south anchor of the node"""
        return self.self_angle(270)

#### `` south_east

    south_east() -> Point

Return the south east anchor of the node

Source code in `src/momapy/core.py`

    720
    721
    722
    723
    724
    725
    726
    def south_east(self) -> momapy.geometry.Point:
        """Return the south east anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (self.width / 2, self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` south_south_east

    south_south_east() -> Point

Return the south south east anchor of the node

Source code in `src/momapy/core.py`

    728
    729
    730
    731
    732
    733
    734
    def south_south_east(self) -> momapy.geometry.Point:
        """Return the south south east anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (self.width / 4, self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` south_south_west

    south_south_west() -> Point

Return the south south west anchor of the node

Source code in `src/momapy/core.py`

    740
    741
    742
    743
    744
    745
    746
    def south_south_west(self) -> momapy.geometry.Point:
        """Return the south south west anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (-self.width / 4, self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` south_west

    south_west() -> Point

Return the south west anchor of the node

Source code in `src/momapy/core.py`

    748
    749
    750
    751
    752
    753
    754
    def south_west(self) -> momapy.geometry.Point:
        """Return the south west anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (-self.width / 2, self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` to_shapely

    to_shapely(to_polygons: bool = False) -> GeometryCollection

Return a shapely collection of geometries reproducing the drawing elements of the layout element

Source code in `src/momapy/core.py`

    123
    124
    125
    126
    127
    128
    def to_shapely(self, to_polygons: bool = False) -> shapely.GeometryCollection:
        """Return a shapely collection of geometries reproducing the drawing elements of the layout element"""
        geom_collection = []
        for drawing_element in self.drawing_elements():
            geom_collection += drawing_element.to_shapely(to_polygons=to_polygons).geoms
        return shapely.GeometryCollection(geom_collection)

#### `` west

    west() -> Point

Return the west anchor of the node

Source code in `src/momapy/core.py`

    764
    765
    766
    def west(self) -> momapy.geometry.Point:
        """Return the west anchor of the node"""
        return self.self_angle(180)

#### `` west_north_west

    west_north_west() -> Point

Return the west north west anchor of the node

Source code in `src/momapy/core.py`

    768
    769
    770
    771
    772
    773
    774
    def west_north_west(self) -> momapy.geometry.Point:
        """Return the west north west anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() - (self.width / 2, self.height / 4)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` west_south_west

    west_south_west() -> Point

Return the west south west anchor of the node

Source code in `src/momapy/core.py`

    756
    757
    758
    759
    760
    761
    762
    def west_south_west(self) -> momapy.geometry.Point:
        """Return the west south west anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (-self.width / 2, self.height / 4)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` x `property`

    x: float

Return the x coordinate of the node

#### `` y `property`

    y: float

Return the y coordinate of the node

### `` LayoutBuilder `module-attribute`

    LayoutBuilder = get_or_make_builder_cls(
        Layout,
        builder_namespace={
            "new_element": _layout_builder_new_element
        },
    )

Base class for layout builders

### `` LayoutElement `dataclass`

    LayoutElement(*, id_: str = make_uuid4_as_str())

Bases: `MapElement`, `ABC`

Abstract base class for layout elements

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`id_` | `str` | The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element | `'89610710-d90e-403c-b637-844c7a37898f'`

Methods:

Name | Description
--- | ---
`anchor_point` | Return an anchor point of the layout element
`bbox` | Compute and return the bounding box of the layout element
`childless` | Return a copy of the layout element with no children
`children` | Return the children of the layout element
`contains` | Return `true` if another layout element is a descendant of the layout element, `false` otherwise
`descendants` | Return the descendants of the layout element
`drawing_elements` | Return the drawing elements of the layout element
`equals` | Return `true` if the layout element is equal to another layout element, `false` otherwise
`flattened` | Return a list containing copy of the layout element with no children and all its descendants with no children
`to_shapely` | Return a shapely collection of geometries reproducing the drawing elements of the layout element

#### `` anchor_point

    anchor_point(anchor_name: str) -> Point

Return an anchor point of the layout element

Source code in `src/momapy/core.py`

    130
    131
    132
    def anchor_point(self, anchor_name: str) -> momapy.geometry.Point:
        """Return an anchor point of the layout element"""
        return getattr(self, anchor_name)()

#### `` bbox `abstractmethod`

    bbox() -> Bbox

Compute and return the bounding box of the layout element

Source code in `src/momapy/core.py`

    70
    71
    72
    73
    @abc.abstractmethod
    def bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the layout element"""
        pass

#### `` childless `abstractmethod`

    childless() -> Self

Return a copy of the layout element with no children

Source code in `src/momapy/core.py`

    85
    86
    87
    88
    @abc.abstractmethod
    def childless(self) -> typing.Self:
        """Return a copy of the layout element with no children"""
        pass

#### `` children `abstractmethod`

    children() -> list[LayoutElement]

Return the children of the layout element

Source code in `src/momapy/core.py`

    80
    81
    82
    83
    @abc.abstractmethod
    def children(self) -> list["LayoutElement"]:
        """Return the children of the layout element"""
        pass

#### `` contains

    contains(other: LayoutElement) -> bool

Return `true` if another layout element is a descendant of the layout element, `false` otherwise

Source code in `src/momapy/core.py`

    119
    120
    121
    def contains(self, other: "LayoutElement") -> bool:
        """Return `true` if another layout element is a descendant of the layout element, `false` otherwise"""
        return other in self.descendants()

#### `` descendants

    descendants() -> list[LayoutElement]

Return the descendants of the layout element

Source code in `src/momapy/core.py`

    90
    91
    92
    93
    94
    95
    96
    def descendants(self) -> list["LayoutElement"]:
        """Return the descendants of the layout element"""
        descendants = []
        for child in self.children():
            descendants.append(child)
            descendants += child.descendants()
        return descendants

#### `` drawing_elements `abstractmethod`

    drawing_elements() -> list[DrawingElement]

Return the drawing elements of the layout element

Source code in `src/momapy/core.py`

    75
    76
    77
    78
    @abc.abstractmethod
    def drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the drawing elements of the layout element"""
        pass

#### `` equals

    equals(
        other: LayoutElement,
        flattened: bool = False,
        unordered: bool = False,
    ) -> bool

Return `true` if the layout element is equal to another layout element, `false` otherwise

Source code in `src/momapy/core.py`

    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    def equals(
        self, other: "LayoutElement", flattened: bool = False, unordered: bool = False
    ) -> bool:
        """Return `true` if the layout element is equal to another layout element, `false` otherwise"""
        if type(self) is type(other):
            if not flattened:
                return self == other
            else:
                if not unordered:
                    return self.flattened() == other.flattened()
                else:
                    return set(self.flattened()) == set(other.flattened())
        return False

#### `` flattened

    flattened() -> list[LayoutElement]

Return a list containing copy of the layout element with no children and all its descendants with no children

Source code in `src/momapy/core.py`

     98
     99
    100
    101
    102
    103
    def flattened(self) -> list["LayoutElement"]:
        """Return a list containing copy of the layout element with no children and all its descendants with no children"""
        flattened = [self.childless()]
        for child in self.children():
            flattened += child.flattened()
        return flattened

#### `` to_shapely

    to_shapely(to_polygons: bool = False) -> GeometryCollection

Return a shapely collection of geometries reproducing the drawing elements of the layout element

Source code in `src/momapy/core.py`

    123
    124
    125
    126
    127
    128
    def to_shapely(self, to_polygons: bool = False) -> shapely.GeometryCollection:
        """Return a shapely collection of geometries reproducing the drawing elements of the layout element"""
        geom_collection = []
        for drawing_element in self.drawing_elements():
            geom_collection += drawing_element.to_shapely(to_polygons=to_polygons).geoms
        return shapely.GeometryCollection(geom_collection)

### `` LayoutElementBuilder `module-attribute`

    LayoutElementBuilder = get_or_make_builder_cls(
        LayoutElement
    )

Base class for layout element builders

### `` LayoutModelMapping

    LayoutModelMapping(*args, **kwargs)

Bases: `FrozenSurjectionDict`

Class for mappings between model elements and layout elements

Methods:

Name | Description
--- | ---
`is_submapping` | Return `true` if the mapping is a submapping of another `LayoutModelMapping`, `false` otherwise

Source code in `src/momapy/utils.py`

    40
    41
    42
    43
    44
    45
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        inverse = {}
        for key, value in self.items():
            inverse.setdefault(value, []).append(key)
        object.__setattr__(self, "_inverse", frozendict.frozendict(inverse))

#### `` is_submapping

    is_submapping(other) -> bool

Return `true` if the mapping is a submapping of another `LayoutModelMapping`, `false` otherwise

Source code in `src/momapy/core.py`

    1593
    1594
    1595
    def is_submapping(self, other) -> bool:
        """Return `true` if the mapping is a submapping of another `LayoutModelMapping`, `false` otherwise"""
        return self.items() <= other.items()

### `` LayoutModelMappingBuilder

    LayoutModelMappingBuilder(*args, **kwargs)

Bases: `SurjectionDict`, `Builder`

Methods:

Name | Description
--- | ---
`build` | Build and return an object from the builder object
`from_object` | Create and return a builder object from an object

Source code in `src/momapy/core.py`

    1896
    1897
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

#### `` build

    build(
        inside_collections: bool = True,
        builder_to_object: dict[int, Any] | None = None,
    )

Build and return an object from the builder object

Source code in `src/momapy/core.py`

    1921
    1922
    1923
    1924
    1925
    1926
    1927
    1928
    1929
    1930
    1931
    1932
    1933
    1934
    1935
    def build(
        self,
        inside_collections: bool = True,
        builder_to_object: dict[int, typing.Any] | None = None,
    ):
        return self._cls_to_build(
            {
                momapy.builder.object_from_builder(
                    key, builder_to_object=builder_to_object
                ): momapy.builder.object_from_builder(
                    value, builder_to_object=builder_to_object
                )
                for key, value in self.items()
            }
        )

#### `` from_object `classmethod`

    from_object(
        obj,
        inside_collections: bool = True,
        omit_keys: bool = True,
        object_to_builder: dict[int, Builder] | None = None,
    ) -> Self

Create and return a builder object from an object

Source code in `src/momapy/core.py`

    1937
    1938
    1939
    1940
    1941
    1942
    1943
    1944
    1945
    1946
    1947
    1948
    1949
    1950
    1951
    1952
    1953
    1954
    1955
    1956
    1957
    1958
    1959
    1960
    1961
    1962
    1963
    1964
    1965
    1966
    1967
    1968
    1969
    @classmethod
    def from_object(
        cls,
        obj,
        inside_collections: bool = True,
        omit_keys: bool = True,
        object_to_builder: dict[int, momapy.builder.Builder] | None = None,
    ) -> typing.Self:
        items = []
        for key, value in obj.items():
            new_key = momapy.builder.builder_from_object(
                key, object_to_builder=object_to_builder
            )
            if isinstance(value, tuple):
                new_value = tuple(
                    [
                        momapy.builder.builder_from_object(
                            element, object_to_builder=object_to_builder
                        )
                        for element in value
                    ]
                )
            else:
                new_value = momapy.builder.builder_from_object(
                    value, object_to_builder=object_to_builder
                )
            items.append(
                (
                    new_key,
                    new_value,
                )
            )
        return cls(items)

### `` Map `dataclass`

    Map(
        *,
        id_: str = make_uuid4_as_str(),
        model: Model | None = None,
        layout: Layout | None = None,
        layout_model_mapping: LayoutModelMapping | None = None,
    )

Bases: `MapElement`

Class for maps

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`id_` | `str` | The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element | `'eb675810-60b7-4e20-9c17-c912252cc8c1'`
`model` | `Model | None` | The model of the map | `None`
`layout` | `Layout | None` | The layout of the map | `None`
`layout_model_mapping` | `LayoutModelMapping | None` | The layout model mapping of the map | `None`

Methods:

Name | Description
--- | ---
`get_mapping` | Return the layout elements mapped to the given model element
`is_submap` | Return `true` if another given map is a submap of the `Map`, `false` otherwise

#### `` get_mapping

    get_mapping(
        map_element: MapElement
        | tuple[ModelElement, ModelElement],
    )

Return the layout elements mapped to the given model element

Source code in `src/momapy/core.py`

    1627
    1628
    1629
    1630
    1631
    1632
    def get_mapping(
        self,
        map_element: MapElement | tuple[ModelElement, ModelElement],
    ):
        """Return the layout elements mapped to the given model element"""
        return self.layout_model_mapping.get_mapping(map_element)

#### `` is_submap

    is_submap(other)

Return `true` if another given map is a submap of the `Map`, `false` otherwise

Source code in `src/momapy/core.py`

    1613
    1614
    1615
    1616
    1617
    1618
    1619
    1620
    1621
    1622
    1623
    1624
    1625
    def is_submap(self, other):
        """Return `true` if another given map is a submap of the `Map`, `false` otherwise"""
        if (
            self.model is None
            or self.layout is None
            or self.layout_model_mapping is None
        ):
            return False
        return (
            self.model.is_submodel(other.model)
            and self.layout.is_sublayout(other.layout)
            and self.layout_model_mapping.is_submapping(other.layout_model_mapping)
        )

### `` MapBuilder `module-attribute`

    MapBuilder = get_or_make_builder_cls(
        Map,
        builder_namespace={
            "new_model": _map_builder_new_model,
            "new_layout": _map_builder_new_layout,
            "new_layout_model_mapping": _map_builder_new_layout_model_mapping,
            "new_model_element": _map_builder_new_model_element,
            "new_layout_element": _map_builder_new_layout_element,
            "add_mapping": _map_builder_add_mapping,
        },
    )

Base class for map builders

### `` MapElement `dataclass`

    MapElement(*, id_: str = make_uuid4_as_str())

Base class for map elements

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`id_` | `str` | The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element | `'83e4db23-6742-478e-a813-f47e431e241b'`

### `` Model `dataclass`

    Model(*, id_: str = make_uuid4_as_str())

Bases: `MapElement`

Base class for models

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`id_` | `str` | The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element | `'a8e43313-9b87-4847-9d0b-da4e9fa0e4e7'`

### `` ModelBuilder `module-attribute`

    ModelBuilder = get_or_make_builder_cls(
        Model,
        builder_namespace={
            "new_element": _model_builder_new_element
        },
    )

Base class for model builders

### `` ModelElement `dataclass`

    ModelElement(*, id_: str = make_uuid4_as_str())

Bases: `MapElement`

Base class for model elements

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`id_` | `str` | The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element | `'cdef540d-2ce5-4191-b1e8-0edb27b5b692'`

### `` ModelElementBuilder `module-attribute`

    ModelElementBuilder = get_or_make_builder_cls(ModelElement)

Base class for model element builders

### `` Node `dataclass`

    Node(
        *,
        id_: str = make_uuid4_as_str(),
        layout_elements: tuple[LayoutElement] = tuple(),
        group_fill: NoneValueType | Color | None = None,
        group_fill_rule: FillRule | None = None,
        group_filter: NoneValueType | Filter | None = None,
        group_font_family: str | None = None,
        group_font_size: float | None = None,
        group_font_style: FontStyle | None = None,
        group_font_weight: FontWeight | float | None = None,
        group_stroke: NoneValueType | Color | None = None,
        group_stroke_dasharray: tuple[float, ...] | None = None,
        group_stroke_dashoffset: float | None = None,
        group_stroke_width: float | None = None,
        group_text_anchor: TextAnchor | None = None,
        group_transform: NoneValueType
        | tuple[Transformation]
        | None = None,
        fill: NoneValueType | Color | None = None,
        filter: NoneValueType | Filter | None = None,
        height: float,
        label: TextLayout | None = None,
        position: Point,
        stroke: NoneValueType | Color | None = None,
        stroke_dasharray: tuple[float, ...] | None = None,
        stroke_dashoffset: float | None = None,
        stroke_width: float | None = None,
        transform: NoneValueType
        | tuple[Transformation]
        | None = None,
        width: float,
    )

Bases: `GroupLayout`

Class for nodes. A node is a layout element with a `position`, a `width`, a `height` and an optional `label`.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`id_` | `str` | The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element | `'8d00c41b-17e4-45aa-8b0c-d07095080ad8'`
`layout_elements` | `tuple[LayoutElement]` | The sub-layout elements of the group layout. These are part of the children of the group layout | `<dynamic>`
`group_fill` | `NoneValueType | Color | None` | The fill color of the group layout | `None`
`group_fill_rule` | `FillRule | None` | The fill rule of the group layout | `None`
`group_filter` | `NoneValueType | Filter | None` | The filter of the group layout | `None`
`group_font_family` | `str | None` | The font family of the group layout | `None`
`group_font_size` | `float | None` | The font size of the group layout | `None`
`group_font_style` | `FontStyle | None` | The font style of the group layout | `None`
`group_font_weight` | `FontWeight | float | None` | The font weight of the group layout | `None`
`group_stroke` | `NoneValueType | Color | None` | The stroke color of the group layout | `None`
`group_stroke_dasharray` | `tuple[float, ...] | None` | The stroke dasharray of the group layout | `None`
`group_stroke_dashoffset` | `float | None` | The stroke dashoffset of the group layout | `None`
`group_stroke_width` | `float | None` | The stroke width of the group layout | `None`
`group_text_anchor` | `TextAnchor | None` | The text anchor of the group layout | `None`
`group_transform` | `NoneValueType | tuple[Transformation] | None` | The transform of the group layout | `None`
`fill` | `NoneValueType | Color | None` | The fill color of the node | `None`
`filter` | `NoneValueType | Filter | None` | The filter of the node | `None`
`height` | `float` | The height of the node | required
`label` | `TextLayout | None` | The label of the node | `None`
`position` | `Point` | The position of the node | required
`stroke` | `NoneValueType | Color | None` | The stroke color of the node | `None`
`stroke_dasharray` | `tuple[float, ...] | None` | The stroke dasharray of the node | `None`
`stroke_dashoffset` | `float | None` | The stroke dashoffset of the node | `None`
`stroke_width` | `float | None` | The stroke width of the node | `None`
`transform` | `NoneValueType | tuple[Transformation] | None` | The transform of the node | `None`
`width` | `float` | The width width of the node | required

Methods:

Name | Description
--- | ---
`anchor_point` | Return an anchor point of the layout element
`angle` | Return the point on the border of the node that intersects the drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal.
`bbox` | Compute and return the bounding box of the group layout element
`border` | Return the point on the border of the node that intersects the drawing elements of the node with the line formed of the center anchor point of the node and the given point.
`center` | Return the center anchor of the node
`childless` | Return a copy of the node with no children
`children` | Return the children of the group layout.
`contains` | Return `true` if another layout element is a descendant of the layout element, `false` otherwise
`descendants` | Return the descendants of the layout element
`drawing_elements` | Return the drawing elements of the group layout.
`east` | Return the east anchor of the node
`east_north_east` | Return the east north east anchor of the node
`east_south_east` | Return the east south east west anchor of the node
`equals` | Return `true` if the layout element is equal to another layout element, `false` otherwise
`flattened` | Return a list containing copy of the layout element with no children and all its descendants with no children
`label_center` | Return the label center anchor of the node
`north` | Return the north anchor of the node
`north_east` | Return the north east anchor of the node
`north_north_east` | Return the north north east anchor of the node
`north_north_west` | Return the north north west anchor of the node
`north_west` | Return the north west anchor of the node
`self_angle` | Return the point on the border of the node that intersects the self drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal.
`self_bbox` | Compute and return the bounding box of the self drawing element of the group layout
`self_border` | Return the point on the border of the node that intersects the self drawing elements of the node with the line formed of the center anchor point of the node and the given point.
`self_children` | Return the self children of the node. A node has unique child that is its label
`self_drawing_elements` | Return the node's own drawing elements
`self_to_shapely` | Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout
`size` | Return the size of the node
`south` | Return the south anchor of the node
`south_east` | Return the south east anchor of the node
`south_south_east` | Return the south south east anchor of the node
`south_south_west` | Return the south south west anchor of the node
`south_west` | Return the south west anchor of the node
`to_shapely` | Return a shapely collection of geometries reproducing the drawing elements of the layout element
`west` | Return the west anchor of the node
`west_north_west` | Return the west north west anchor of the node
`west_south_west` | Return the west south west anchor of the node

Attributes:

Name | Type | Description
--- | --- | ---
`x` | `float` | Return the x coordinate of the node
`y` | `float` | Return the y coordinate of the node

#### `` anchor_point

    anchor_point(anchor_name: str) -> Point

Return an anchor point of the layout element

Source code in `src/momapy/core.py`

    130
    131
    132
    def anchor_point(self, anchor_name: str) -> momapy.geometry.Point:
        """Return an anchor point of the layout element"""
        return getattr(self, anchor_name)()

#### `` angle

    angle(
        angle: float,
        unit: Literal["degrees", "radians"] = "degrees",
    ) -> Point

Return the point on the border of the node that intersects the drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal.

Source code in `src/momapy/core.py`

    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    def angle(
        self,
        angle: float,
        unit: typing.Literal["degrees", "radians"] = "degrees",
    ) -> momapy.geometry.Point:
        """Return the point on the border of the node that intersects the drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal."""
        return momapy.drawing.get_drawing_elements_angle(
            drawing_elements=self.drawing_elements(),
            angle=angle,
            unit=unit,
            center=self.center(),
        )

#### `` bbox

    bbox() -> Bbox

Compute and return the bounding box of the group layout element

Source code in `src/momapy/core.py`

    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    def bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the group layout element"""
        self_bbox = self.self_bbox()
        bboxes = [child.bbox() for child in self.children()]
        min_x = self_bbox.north_west().x
        min_y = self_bbox.north_west().y
        max_x = self_bbox.south_east().x
        max_y = self_bbox.south_east().y
        for bbox in bboxes:
            if bbox.north_west().x < min_x:
                min_x = bbox.north_west().x
            if bbox.north_west().y < min_y:
                min_y = bbox.north_west().y
            if bbox.south_east().x > max_x:
                max_x = bbox.south_east().x
            if bbox.south_east().y > max_y:
                max_y = bbox.south_east().y
        bbox = momapy.geometry.Bbox(
            momapy.geometry.Point(min_x / 2 + max_x / 2, min_y / 2 + max_y / 2),
            max_x - min_x,
            max_y - min_y,
        )
        return bbox

#### `` border

    border(point: Point) -> Point

Return the point on the border of the node that intersects the drawing elements of the node with the line formed of the center anchor point of the node and the given point. When there are multiple intersection points, the one closest to the given point is returned

Source code in `src/momapy/core.py`

    794
    795
    796
    797
    798
    799
    800
    801
    802
    def border(self, point: momapy.geometry.Point) -> momapy.geometry.Point:
        """Return the point on the border of the node that intersects the drawing elements of the node with the line formed of the center anchor point of the node and the given point.
        When there are multiple intersection points, the one closest to the given point is returned
        """
        return momapy.drawing.get_drawing_elements_border(
            drawing_elements=self.drawing_elements(),
            point=point,
            center=self.center(),
        )

#### `` center

    center() -> Point

Return the center anchor of the node

Source code in `src/momapy/core.py`

    776
    777
    778
    def center(self) -> momapy.geometry.Point:
        """Return the center anchor of the node"""
        return self.position

#### `` childless

    childless() -> Self

Return a copy of the node with no children

Source code in `src/momapy/core.py`

    830
    831
    832
    def childless(self) -> typing.Self:
        """Return a copy of the node with no children"""
        return dataclasses.replace(self, label=None, layout_elements=tuple([]))

#### `` children

    children() -> list[LayoutElement]

Return the children of the group layout. These are the self children of the group layout (returned by the `self_children` method) and the other children of the group layout (given by the `layout_elements` attribute)

Source code in `src/momapy/core.py`

    566
    567
    568
    569
    570
    def children(self) -> list[LayoutElement]:
        """Return the children of the group layout.
        These are the self children of the group layout (returned by the `self_children` method) and the other children of the group layout (given by the `layout_elements` attribute)
        """
        return self.self_children() + list(self.layout_elements)

#### `` contains

    contains(other: LayoutElement) -> bool

Return `true` if another layout element is a descendant of the layout element, `false` otherwise

Source code in `src/momapy/core.py`

    119
    120
    121
    def contains(self, other: "LayoutElement") -> bool:
        """Return `true` if another layout element is a descendant of the layout element, `false` otherwise"""
        return other in self.descendants()

#### `` descendants

    descendants() -> list[LayoutElement]

Return the descendants of the layout element

Source code in `src/momapy/core.py`

    90
    91
    92
    93
    94
    95
    96
    def descendants(self) -> list["LayoutElement"]:
        """Return the descendants of the layout element"""
        descendants = []
        for child in self.children():
            descendants.append(child)
            descendants += child.descendants()
        return descendants

#### `` drawing_elements

    drawing_elements() -> list[DrawingElement]

Return the drawing elements of the group layout. The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children

Source code in `src/momapy/core.py`

    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    def drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the drawing elements of the group layout.
        The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children
        """
        drawing_elements = self.self_drawing_elements()
        for child in self.children():
            if child is not None:
                drawing_elements += child.drawing_elements()
        group = momapy.drawing.Group(
            class_=f"{type(self).__name__}_group",
            elements=tuple(drawing_elements),
            id_=f"{self.id_}_group",
            fill=self.group_fill,
            fill_rule=self.group_fill_rule,
            filter=self.group_filter,
            font_family=self.group_font_family,
            font_size=self.group_font_size,
            font_style=self.group_font_style,
            font_weight=self.group_font_weight,
            stroke=self.group_stroke,
            stroke_dasharray=self.group_stroke_dasharray,
            stroke_dashoffset=self.group_stroke_dashoffset,
            stroke_width=self.group_stroke_width,
            text_anchor=self.group_text_anchor,
            transform=self.group_transform,
        )
        return [group]

#### `` east

    east() -> Point

Return the east anchor of the node

Source code in `src/momapy/core.py`

    708
    709
    710
    def east(self) -> momapy.geometry.Point:
        """Return the east anchor of the node"""
        return self.self_angle(0)

#### `` east_north_east

    east_north_east() -> Point

Return the east north east anchor of the node

Source code in `src/momapy/core.py`

    700
    701
    702
    703
    704
    705
    706
    def east_north_east(self) -> momapy.geometry.Point:
        """Return the east north east anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (self.width / 2, -self.height / 4)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` east_south_east

    east_south_east() -> Point

Return the east south east west anchor of the node

Source code in `src/momapy/core.py`

    712
    713
    714
    715
    716
    717
    718
    def east_south_east(self) -> momapy.geometry.Point:
        """Return the east south east west anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (self.width / 2, self.height / 4)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` equals

    equals(
        other: LayoutElement,
        flattened: bool = False,
        unordered: bool = False,
    ) -> bool

Return `true` if the layout element is equal to another layout element, `false` otherwise

Source code in `src/momapy/core.py`

    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    def equals(
        self, other: "LayoutElement", flattened: bool = False, unordered: bool = False
    ) -> bool:
        """Return `true` if the layout element is equal to another layout element, `false` otherwise"""
        if type(self) is type(other):
            if not flattened:
                return self == other
            else:
                if not unordered:
                    return self.flattened() == other.flattened()
                else:
                    return set(self.flattened()) == set(other.flattened())
        return False

#### `` flattened

    flattened() -> list[LayoutElement]

Return a list containing copy of the layout element with no children and all its descendants with no children

Source code in `src/momapy/core.py`

     98
     99
    100
    101
    102
    103
    def flattened(self) -> list["LayoutElement"]:
        """Return a list containing copy of the layout element with no children and all its descendants with no children"""
        flattened = [self.childless()]
        for child in self.children():
            flattened += child.flattened()
        return flattened

#### `` label_center

    label_center() -> Point

Return the label center anchor of the node

Source code in `src/momapy/core.py`

    780
    781
    782
    def label_center(self) -> momapy.geometry.Point:
        """Return the label center anchor of the node"""
        return self.position

#### `` north

    north() -> Point

Return the north anchor of the node

Source code in `src/momapy/core.py`

    680
    681
    682
    def north(self) -> momapy.geometry.Point:
        """Return the north anchor of the node"""
        return self.self_angle(90)

#### `` north_east

    north_east() -> Point

Return the north east anchor of the node

Source code in `src/momapy/core.py`

    692
    693
    694
    695
    696
    697
    698
    def north_east(self) -> momapy.geometry.Point:
        """Return the north east anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (self.width / 2, -self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` north_north_east

    north_north_east() -> Point

Return the north north east anchor of the node

Source code in `src/momapy/core.py`

    684
    685
    686
    687
    688
    689
    690
    def north_north_east(self) -> momapy.geometry.Point:
        """Return the north north east anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (self.width / 4, -self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` north_north_west

    north_north_west() -> Point

Return the north north west anchor of the node

Source code in `src/momapy/core.py`

    672
    673
    674
    675
    676
    677
    678
    def north_north_west(self) -> momapy.geometry.Point:
        """Return the north north west anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() - (self.width / 4, self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` north_west

    north_west() -> Point

Return the north west anchor of the node

Source code in `src/momapy/core.py`

    664
    665
    666
    667
    668
    669
    670
    def north_west(self) -> momapy.geometry.Point:
        """Return the north west anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() - (self.width / 2, self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` self_angle

    self_angle(
        angle: float,
        unit: Literal["degrees", "radians"] = "degrees",
    ) -> Point

Return the point on the border of the node that intersects the self drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal.

Source code in `src/momapy/core.py`

    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    def self_angle(
        self,
        angle: float,
        unit: typing.Literal["degrees", "radians"] = "degrees",
    ) -> momapy.geometry.Point:
        """Return the point on the border of the node that intersects the self drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal."""
        return momapy.drawing.get_drawing_elements_angle(
            drawing_elements=self.self_drawing_elements(),
            angle=angle,
            unit=unit,
            center=self.center(),
        )

#### `` self_bbox

    self_bbox() -> Bbox

Compute and return the bounding box of the self drawing element of the group layout

Source code in `src/momapy/core.py`

    499
    500
    501
    502
    def self_bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the self drawing element of the group layout"""
        bounds = self.self_to_shapely().bounds
        return momapy.geometry.Bbox.from_bounds(bounds)

#### `` self_border

    self_border(point: Point) -> Point

Return the point on the border of the node that intersects the self drawing elements of the node with the line formed of the center anchor point of the node and the given point. When there are multiple intersection points, the one closest to the given point is returned

Source code in `src/momapy/core.py`

    784
    785
    786
    787
    788
    789
    790
    791
    792
    def self_border(self, point: momapy.geometry.Point) -> momapy.geometry.Point:
        """Return the point on the border of the node that intersects the self drawing elements of the node with the line formed of the center anchor point of the node and the given point.
        When there are multiple intersection points, the one closest to the given point is returned
        """
        return momapy.drawing.get_drawing_elements_border(
            drawing_elements=self.self_drawing_elements(),
            point=point,
            center=self.center(),
        )

#### `` self_children

    self_children() -> list[LayoutElement]

Return the self children of the node. A node has unique child that is its label

Source code in `src/momapy/core.py`

    654
    655
    656
    657
    658
    def self_children(self) -> list[LayoutElement]:
        """Return the self children of the node. A node has unique child that is its label"""
        if self.label is not None:
            return [self.label]
        return []

#### `` self_drawing_elements

    self_drawing_elements() -> list[DrawingElement]

Return the node's own drawing elements

Source code in `src/momapy/core.py`

    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    def self_drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the node's own drawing elements"""
        drawing_elements = self._border_drawing_elements()
        group = momapy.drawing.Group(
            class_=type(self).__name__,
            elements=tuple(drawing_elements),
            fill=self.fill,
            filter=self.filter,
            id_=self.id_,
            stroke=self.stroke,
            stroke_dasharray=self.stroke_dasharray,
            stroke_dashoffset=self.stroke_dashoffset,
            stroke_width=self.stroke_width,
            transform=self.transform,
        )
        return [group]

#### `` self_to_shapely

    self_to_shapely() -> GeometryCollection

Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout

Source code in `src/momapy/core.py`

    495
    496
    497
    def self_to_shapely(self) -> shapely.GeometryCollection:
        """Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout"""
        return momapy.drawing.drawing_elements_to_shapely(self.drawing_elements())

#### `` size

    size() -> tuple[float, float]

Return the size of the node

Source code in `src/momapy/core.py`

    660
    661
    662
    def size(self) -> tuple[float, float]:
        """Return the size of the node"""
        return (self.width, self.height)

#### `` south

    south() -> Point

Return the south anchor of the node

Source code in `src/momapy/core.py`

    736
    737
    738
    def south(self) -> momapy.geometry.Point:
        """Return the south anchor of the node"""
        return self.self_angle(270)

#### `` south_east

    south_east() -> Point

Return the south east anchor of the node

Source code in `src/momapy/core.py`

    720
    721
    722
    723
    724
    725
    726
    def south_east(self) -> momapy.geometry.Point:
        """Return the south east anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (self.width / 2, self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` south_south_east

    south_south_east() -> Point

Return the south south east anchor of the node

Source code in `src/momapy/core.py`

    728
    729
    730
    731
    732
    733
    734
    def south_south_east(self) -> momapy.geometry.Point:
        """Return the south south east anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (self.width / 4, self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` south_south_west

    south_south_west() -> Point

Return the south south west anchor of the node

Source code in `src/momapy/core.py`

    740
    741
    742
    743
    744
    745
    746
    def south_south_west(self) -> momapy.geometry.Point:
        """Return the south south west anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (-self.width / 4, self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` south_west

    south_west() -> Point

Return the south west anchor of the node

Source code in `src/momapy/core.py`

    748
    749
    750
    751
    752
    753
    754
    def south_west(self) -> momapy.geometry.Point:
        """Return the south west anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (-self.width / 2, self.height / 2)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` to_shapely

    to_shapely(to_polygons: bool = False) -> GeometryCollection

Return a shapely collection of geometries reproducing the drawing elements of the layout element

Source code in `src/momapy/core.py`

    123
    124
    125
    126
    127
    128
    def to_shapely(self, to_polygons: bool = False) -> shapely.GeometryCollection:
        """Return a shapely collection of geometries reproducing the drawing elements of the layout element"""
        geom_collection = []
        for drawing_element in self.drawing_elements():
            geom_collection += drawing_element.to_shapely(to_polygons=to_polygons).geoms
        return shapely.GeometryCollection(geom_collection)

#### `` west

    west() -> Point

Return the west anchor of the node

Source code in `src/momapy/core.py`

    764
    765
    766
    def west(self) -> momapy.geometry.Point:
        """Return the west anchor of the node"""
        return self.self_angle(180)

#### `` west_north_west

    west_north_west() -> Point

Return the west north west anchor of the node

Source code in `src/momapy/core.py`

    768
    769
    770
    771
    772
    773
    774
    def west_north_west(self) -> momapy.geometry.Point:
        """Return the west north west anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() - (self.width / 2, self.height / 4)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` west_south_west

    west_south_west() -> Point

Return the west south west anchor of the node

Source code in `src/momapy/core.py`

    756
    757
    758
    759
    760
    761
    762
    def west_south_west(self) -> momapy.geometry.Point:
        """Return the west south west anchor of the node"""
        line = momapy.geometry.Line(
            self.center(), self.center() + (-self.width / 2, self.height / 4)
        )
        angle = -momapy.geometry.get_angle_to_horizontal_of_line(line)
        return self.self_angle(angle, unit="radians")

#### `` x `property`

    x: float

Return the x coordinate of the node

#### `` y `property`

    y: float

Return the y coordinate of the node

### `` NodeBuilder `module-attribute`

    NodeBuilder = get_or_make_builder_cls(Node)

Base class for node builders

### `` Shape `dataclass`

    Shape(*, id_: str = make_uuid4_as_str())

Bases: `LayoutElement`

Class for basic shapes. The shape is the most simple layout element. It has no children.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`id_` | `str` | The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element | `'b716bd42-375a-4b99-8551-9790edfda2dd'`

Methods:

Name | Description
--- | ---
`anchor_point` | Return an anchor point of the layout element
`bbox` | Compute and return the bounding box of the shape
`childless` | Return a copy of the shape with no children.
`children` | Return the children of the shape.
`contains` | Return `true` if another layout element is a descendant of the layout element, `false` otherwise
`descendants` | Return the descendants of the layout element
`drawing_elements` | Return the drawing elements of the layout element
`equals` | Return `true` if the layout element is equal to another layout element, `false` otherwise
`flattened` | Return a list containing copy of the layout element with no children and all its descendants with no children
`to_shapely` | Return a shapely collection of geometries reproducing the drawing elements of the layout element

#### `` anchor_point

    anchor_point(anchor_name: str) -> Point

Return an anchor point of the layout element

Source code in `src/momapy/core.py`

    130
    131
    132
    def anchor_point(self, anchor_name: str) -> momapy.geometry.Point:
        """Return an anchor point of the layout element"""
        return getattr(self, anchor_name)()

#### `` bbox

    bbox() -> Bbox

Compute and return the bounding box of the shape

Source code in `src/momapy/core.py`

    415
    416
    417
    418
    def bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the shape"""
        bounds = self.to_shapely().bounds
        return momapy.geometry.Bbox.from_bounds(bounds)

#### `` childless

    childless() -> Self

Return a copy of the shape with no children. A shape has no children, so return a copy of the shape

Source code in `src/momapy/core.py`

    405
    406
    407
    408
    def childless(self) -> typing.Self:
        """Return a copy of the shape with no children.
        A shape has no children, so return a copy of the shape"""
        return copy.deepcopy(self)

#### `` children

    children() -> list[LayoutElement]

Return the children of the shape. A shape has no children, so return an empty list

Source code in `src/momapy/core.py`

    410
    411
    412
    413
    def children(self) -> list[LayoutElement]:
        """Return the children of the shape.
        A shape has no children, so return an empty list"""
        return []

#### `` contains

    contains(other: LayoutElement) -> bool

Return `true` if another layout element is a descendant of the layout element, `false` otherwise

Source code in `src/momapy/core.py`

    119
    120
    121
    def contains(self, other: "LayoutElement") -> bool:
        """Return `true` if another layout element is a descendant of the layout element, `false` otherwise"""
        return other in self.descendants()

#### `` descendants

    descendants() -> list[LayoutElement]

Return the descendants of the layout element

Source code in `src/momapy/core.py`

    90
    91
    92
    93
    94
    95
    96
    def descendants(self) -> list["LayoutElement"]:
        """Return the descendants of the layout element"""
        descendants = []
        for child in self.children():
            descendants.append(child)
            descendants += child.descendants()
        return descendants

#### `` drawing_elements `abstractmethod`

    drawing_elements() -> list[DrawingElement]

Return the drawing elements of the layout element

Source code in `src/momapy/core.py`

    75
    76
    77
    78
    @abc.abstractmethod
    def drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the drawing elements of the layout element"""
        pass

#### `` equals

    equals(
        other: LayoutElement,
        flattened: bool = False,
        unordered: bool = False,
    ) -> bool

Return `true` if the layout element is equal to another layout element, `false` otherwise

Source code in `src/momapy/core.py`

    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    def equals(
        self, other: "LayoutElement", flattened: bool = False, unordered: bool = False
    ) -> bool:
        """Return `true` if the layout element is equal to another layout element, `false` otherwise"""
        if type(self) is type(other):
            if not flattened:
                return self == other
            else:
                if not unordered:
                    return self.flattened() == other.flattened()
                else:
                    return set(self.flattened()) == set(other.flattened())
        return False

#### `` flattened

    flattened() -> list[LayoutElement]

Return a list containing copy of the layout element with no children and all its descendants with no children

Source code in `src/momapy/core.py`

     98
     99
    100
    101
    102
    103
    def flattened(self) -> list["LayoutElement"]:
        """Return a list containing copy of the layout element with no children and all its descendants with no children"""
        flattened = [self.childless()]
        for child in self.children():
            flattened += child.flattened()
        return flattened

#### `` to_shapely

    to_shapely(to_polygons: bool = False) -> GeometryCollection

Return a shapely collection of geometries reproducing the drawing elements of the layout element

Source code in `src/momapy/core.py`

    123
    124
    125
    126
    127
    128
    def to_shapely(self, to_polygons: bool = False) -> shapely.GeometryCollection:
        """Return a shapely collection of geometries reproducing the drawing elements of the layout element"""
        geom_collection = []
        for drawing_element in self.drawing_elements():
            geom_collection += drawing_element.to_shapely(to_polygons=to_polygons).geoms
        return shapely.GeometryCollection(geom_collection)

### `` SingleHeadedArc `dataclass`

    SingleHeadedArc(
        *,
        id_: str = make_uuid4_as_str(),
        layout_elements: tuple[LayoutElement] = tuple(),
        group_fill: NoneValueType | Color | None = None,
        group_fill_rule: FillRule | None = None,
        group_filter: NoneValueType | Filter | None = None,
        group_font_family: str | None = None,
        group_font_size: float | None = None,
        group_font_style: FontStyle | None = None,
        group_font_weight: FontWeight | float | None = None,
        group_stroke: NoneValueType | Color | None = None,
        group_stroke_dasharray: tuple[float, ...] | None = None,
        group_stroke_dashoffset: float | None = None,
        group_stroke_width: float | None = None,
        group_text_anchor: TextAnchor | None = None,
        group_transform: NoneValueType
        | tuple[Transformation]
        | None = None,
        end_shorten: float = 0.0,
        fill: NoneValueType | Color | None = None,
        filter: NoneValueType | Filter | None = None,
        path_fill: NoneValueType | Color | None = None,
        path_filter: NoneValueType | Filter | None = None,
        path_stroke: NoneValueType | Color | None = None,
        path_stroke_dasharray: tuple[float, ...] | None = None,
        path_stroke_dashoffset: float | None = None,
        path_stroke_width: float | None = None,
        path_transform: NoneValueType
        | tuple[Transformation]
        | None = None,
        stroke: NoneValueType | Color | None = None,
        stroke_dasharray: NoneValueType
        | tuple[float]
        | None = None,
        stroke_dashoffset: float | None = None,
        stroke_width: float | None = None,
        segments: tuple[
            Segment | BezierCurve | EllipticalArc
        ] = tuple(),
        source: LayoutElement | None = None,
        start_shorten: float = 0.0,
        target: LayoutElement | None = None,
        transform: NoneValueType
        | tuple[Transformation]
        | None = None,
        arrowhead_fill: NoneValueType | Color | None = None,
        arrowhead_filter: NoneValueType | Filter | None = None,
        arrowhead_stroke: NoneValueType | Color | None = None,
        arrowhead_stroke_dasharray: tuple[float, ...]
        | None = None,
        arrowhead_stroke_dashoffset: float | None = None,
        arrowhead_stroke_width: float | None = None,
        arrowhead_transform: NoneValueType
        | tuple[Transformation]
        | None = None,
    )

Bases: `Arc`

Base class for single-headed arcs. A single-headed arc is formed of a path and a unique arrowhead at its end

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`id_` | `str` | The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element | `'0fee6211-c137-4ff9-8d44-b69687858bda'`
`layout_elements` | `tuple[LayoutElement]` | The sub-layout elements of the group layout. These are part of the children of the group layout | `<dynamic>`
`group_fill` | `NoneValueType | Color | None` | The fill color of the group layout | `None`
`group_fill_rule` | `FillRule | None` | The fill rule of the group layout | `None`
`group_filter` | `NoneValueType | Filter | None` | The filter of the group layout | `None`
`group_font_family` | `str | None` | The font family of the group layout | `None`
`group_font_size` | `float | None` | The font size of the group layout | `None`
`group_font_style` | `FontStyle | None` | The font style of the group layout | `None`
`group_font_weight` | `FontWeight | float | None` | The font weight of the group layout | `None`
`group_stroke` | `NoneValueType | Color | None` | The stroke color of the group layout | `None`
`group_stroke_dasharray` | `tuple[float, ...] | None` | The stroke dasharray of the group layout | `None`
`group_stroke_dashoffset` | `float | None` | The stroke dashoffset of the group layout | `None`
`group_stroke_width` | `float | None` | The stroke width of the group layout | `None`
`group_text_anchor` | `TextAnchor | None` | The text anchor of the group layout | `None`
`group_transform` | `NoneValueType | tuple[Transformation] | None` | The transform of the group layout | `None`
`end_shorten` | `float` | The length the end of the arc will be shorten by | `0.0`
`fill` | `NoneValueType | Color | None` | The fill color of the arc | `None`
`filter` | `NoneValueType | Filter | None` | The fill filter of the arc | `None`
`path_fill` | `NoneValueType | Color | None` | The path fill color of the arc | `None`
`path_filter` | `NoneValueType | Filter | None` | The path filter of the arc | `None`
`path_stroke` | `NoneValueType | Color | None` | The path stroke color of the arc | `None`
`path_stroke_dasharray` | `tuple[float, ...] | None` | The path stroke dasharray of the arc | `None`
`path_stroke_dashoffset` | `float | None` | The path stroke dashoffset of the arc | `None`
`path_stroke_width` | `float | None` | The path stroke width of the arc | `None`
`path_transform` | `NoneValueType | tuple[Transformation] | None` | The path transform of the arc | `None`
`stroke` | `NoneValueType | Color | None` | The stroke color of the arc | `None`
`stroke_dasharray` | `NoneValueType | tuple[float] | None` | The stroke dasharray of the arc | `None`
`stroke_dashoffset` | `float | None` | The stroke dashoffset of the arc | `None`
`stroke_width` | `float | None` | The stroke width of the arc | `None`
`segments` | `tuple[Union[Segment, BezierCurve, EllipticalArc]]` | The path segments of the arc | `<dynamic>`
`source` | `LayoutElement | None` | The source of the arc | `None`
`start_shorten` | `float` | The length the start of the arc will be shorten by | `0.0`
`target` | `LayoutElement | None` | The target of the arc | `None`
`transform` | `NoneValueType | tuple[Transformation] | None` | The transform of the arc | `None`
`arrowhead_fill` | `NoneValueType | Color | None` | The arrowhead fill color of the arc | `None`
`arrowhead_filter` | `NoneValueType | Filter | None` | The arrowhead filter of the arc | `None`
`arrowhead_stroke` | `NoneValueType | Color | None` | The arrowhead stroke color of the arc | `None`
`arrowhead_stroke_dasharray` | `tuple[float, ...] | None` | The arrowhead stroke dasharray of the arc | `None`
`arrowhead_stroke_dashoffset` | `float | None` | The arrowhead stroke dashoffset of the arc | `None`
`arrowhead_stroke_width` | `float | None` | The arrowhead stroke width of the arc | `None`
`arrowhead_transform` | `NoneValueType | tuple[Transformation] | None` | The arrowhead transform of the arc | `None`

Methods:

Name | Description
--- | ---
`anchor_point` | Return an anchor point of the layout element
`arrowhead_base` | Return the arrowhead base anchor point of the single-headed arc
`arrowhead_bbox` | Return the bounding box of the single-headed arc arrowhead
`arrowhead_border` | Return the point at the intersection of the drawing elements of the single-headed arc arrowhead and the line going through the center of these drawing elements and the given point.
`arrowhead_drawing_elements` | Return the drawing elements of the single-headed arc arrowhead
`arrowhead_length` | Return the length of the single-headed arc arrowhead
`arrowhead_tip` | Return the arrowhead tip anchor point of the single-headed arc
`bbox` | Compute and return the bounding box of the group layout element
`childless` | Return a copy of the arc with no children
`children` | Return the children of the group layout.
`contains` | Return `true` if another layout element is a descendant of the layout element, `false` otherwise
`descendants` | Return the descendants of the layout element
`drawing_elements` | Return the drawing elements of the group layout.
`end_point` | Return the ending point of the arc
`equals` | Return `true` if the layout element is equal to another layout element, `false` otherwise
`flattened` | Return a list containing copy of the layout element with no children and all its descendants with no children
`fraction` | Return the position and angle on the arc at a given fraction (of the total arc length)
`length` | Return the total length of the arc path
`path_drawing_elements` | Return the drawing elements of the single-headed arc path
`points` | Return the points of the arc path
`self_bbox` | Compute and return the bounding box of the self drawing element of the group layout
`self_children` | Return the self children of the arc
`self_drawing_elements` | Return the self drawing elements of the single-headed arc
`self_to_shapely` | Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout
`start_point` | Return the starting point of the arc
`to_shapely` | Return a shapely collection of geometries reproducing the drawing elements of the layout element

#### `` anchor_point

    anchor_point(anchor_name: str) -> Point

Return an anchor point of the layout element

Source code in `src/momapy/core.py`

    130
    131
    132
    def anchor_point(self, anchor_name: str) -> momapy.geometry.Point:
        """Return an anchor point of the layout element"""
        return getattr(self, anchor_name)()

#### `` arrowhead_base

    arrowhead_base() -> Point

Return the arrowhead base anchor point of the single-headed arc

Source code in `src/momapy/core.py`

    1058
    1059
    1060
    1061
    1062
    1063
    1064
    1065
    1066
    def arrowhead_base(self) -> momapy.geometry.Point:
        """Return the arrowhead base anchor point of the single-headed arc"""
        arrowhead_length = self.arrowhead_length()
        segment = self.segments[-1]
        segment_length = segment.length()
        if segment_length == 0:
            return self.arrowhead_tip() - (arrowhead_length, 0)
        fraction = 1 - (arrowhead_length + self.end_shorten) / segment_length
        return segment.get_position_at_fraction(fraction)

#### `` arrowhead_bbox

    arrowhead_bbox() -> Bbox

Return the bounding box of the single-headed arc arrowhead

Source code in `src/momapy/core.py`

    1068
    1069
    1070
    1071
    1072
    def arrowhead_bbox(self) -> momapy.geometry.Bbox:
        """Return the bounding box of the single-headed arc arrowhead"""
        return momapy.drawing.get_drawing_elements_bbox(
            self.arrowhead_drawing_elements()
        )

#### `` arrowhead_border

    arrowhead_border(point) -> Point

Return the point at the intersection of the drawing elements of the single-headed arc arrowhead and the line going through the center of these drawing elements and the given point. When there are multiple intersection points, the one closest to the given point is returned

Source code in `src/momapy/core.py`

    1074
    1075
    1076
    1077
    1078
    1079
    1080
    1081
    1082
    1083
    1084
    def arrowhead_border(self, point) -> momapy.geometry.Point:
        """Return the point at the intersection of the drawing elements of the single-headed arc arrowhead and the line going through the center of these drawing elements and the given point.
        When there are multiple intersection points, the one closest to the given point is returned
        """

        point = momapy.drawing.get_drawing_elements_border(
            self.arrowhead_drawing_elements(), point
        )
        if point is None:
            return self.arrowhead_tip()
        return point

#### `` arrowhead_drawing_elements

    arrowhead_drawing_elements() -> list[DrawingElement]

Return the drawing elements of the single-headed arc arrowhead

Source code in `src/momapy/core.py`

    1108
    1109
    1110
    1111
    1112
    1113
    1114
    1115
    1116
    1117
    1118
    1119
    1120
    1121
    1122
    1123
    1124
    1125
    1126
    1127
    def arrowhead_drawing_elements(
        self,
    ) -> list[momapy.drawing.DrawingElement]:
        """Return the drawing elements of the single-headed arc arrowhead"""
        drawing_elements = self._arrowhead_border_drawing_elements()
        group = momapy.drawing.Group(
            class_=f"{type(self).__name__}_arrowhead",
            elements=tuple(drawing_elements),
            fill=self.arrowhead_fill,
            filter=self.arrowhead_filter,
            id_=f"{self.id_}_arrowhead",
            stroke=self.arrowhead_stroke,
            stroke_dasharray=self.arrowhead_stroke_dasharray,
            stroke_dashoffset=self.arrowhead_stroke_dashoffset,
            stroke_width=self.arrowhead_stroke_width,
            transform=self.arrowhead_transform,
        )
        transformation = self._get_arrowhead_transformation()
        group = group.transformed(transformation)
        return [group]

#### `` arrowhead_length

    arrowhead_length() -> float

Return the length of the single-headed arc arrowhead

Source code in `src/momapy/core.py`

    1040
    1041
    1042
    1043
    1044
    1045
    1046
    1047
    def arrowhead_length(self) -> float:
        """Return the length of the single-headed arc arrowhead"""
        bbox = momapy.drawing.get_drawing_elements_bbox(
            self._arrowhead_border_drawing_elements()
        )
        if math.isnan(bbox.width):
            return 0.0
        return bbox.east().x

#### `` arrowhead_tip

    arrowhead_tip() -> Point

Return the arrowhead tip anchor point of the single-headed arc

Source code in `src/momapy/core.py`

    1049
    1050
    1051
    1052
    1053
    1054
    1055
    1056
    def arrowhead_tip(self) -> momapy.geometry.Point:
        """Return the arrowhead tip anchor point of the single-headed arc"""
        segment = self.segments[-1]
        segment_length = segment.length()
        if segment_length == 0:
            return segment.p2
        fraction = 1 - self.end_shorten / segment_length
        return segment.get_position_at_fraction(fraction)

#### `` bbox

    bbox() -> Bbox

Compute and return the bounding box of the group layout element

Source code in `src/momapy/core.py`

    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    def bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the group layout element"""
        self_bbox = self.self_bbox()
        bboxes = [child.bbox() for child in self.children()]
        min_x = self_bbox.north_west().x
        min_y = self_bbox.north_west().y
        max_x = self_bbox.south_east().x
        max_y = self_bbox.south_east().y
        for bbox in bboxes:
            if bbox.north_west().x < min_x:
                min_x = bbox.north_west().x
            if bbox.north_west().y < min_y:
                min_y = bbox.north_west().y
            if bbox.south_east().x > max_x:
                max_x = bbox.south_east().x
            if bbox.south_east().y > max_y:
                max_y = bbox.south_east().y
        bbox = momapy.geometry.Bbox(
            momapy.geometry.Point(min_x / 2 + max_x / 2, min_y / 2 + max_y / 2),
            max_x - min_x,
            max_y - min_y,
        )
        return bbox

#### `` childless

    childless() -> Self

Return a copy of the arc with no children

Source code in `src/momapy/core.py`

    955
    956
    957
    def childless(self) -> typing.Self:
        """Return a copy of the arc with no children"""
        return dataclasses.replace(self, layout_elements=tuple([]))

#### `` children

    children() -> list[LayoutElement]

Return the children of the group layout. These are the self children of the group layout (returned by the `self_children` method) and the other children of the group layout (given by the `layout_elements` attribute)

Source code in `src/momapy/core.py`

    566
    567
    568
    569
    570
    def children(self) -> list[LayoutElement]:
        """Return the children of the group layout.
        These are the self children of the group layout (returned by the `self_children` method) and the other children of the group layout (given by the `layout_elements` attribute)
        """
        return self.self_children() + list(self.layout_elements)

#### `` contains

    contains(other: LayoutElement) -> bool

Return `true` if another layout element is a descendant of the layout element, `false` otherwise

Source code in `src/momapy/core.py`

    119
    120
    121
    def contains(self, other: "LayoutElement") -> bool:
        """Return `true` if another layout element is a descendant of the layout element, `false` otherwise"""
        return other in self.descendants()

#### `` descendants

    descendants() -> list[LayoutElement]

Return the descendants of the layout element

Source code in `src/momapy/core.py`

    90
    91
    92
    93
    94
    95
    96
    def descendants(self) -> list["LayoutElement"]:
        """Return the descendants of the layout element"""
        descendants = []
        for child in self.children():
            descendants.append(child)
            descendants += child.descendants()
        return descendants

#### `` drawing_elements

    drawing_elements() -> list[DrawingElement]

Return the drawing elements of the group layout. The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children

Source code in `src/momapy/core.py`

    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    def drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the drawing elements of the group layout.
        The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children
        """
        drawing_elements = self.self_drawing_elements()
        for child in self.children():
            if child is not None:
                drawing_elements += child.drawing_elements()
        group = momapy.drawing.Group(
            class_=f"{type(self).__name__}_group",
            elements=tuple(drawing_elements),
            id_=f"{self.id_}_group",
            fill=self.group_fill,
            fill_rule=self.group_fill_rule,
            filter=self.group_filter,
            font_family=self.group_font_family,
            font_size=self.group_font_size,
            font_style=self.group_font_style,
            font_weight=self.group_font_weight,
            stroke=self.group_stroke,
            stroke_dasharray=self.group_stroke_dasharray,
            stroke_dashoffset=self.group_stroke_dashoffset,
            stroke_width=self.group_stroke_width,
            text_anchor=self.group_text_anchor,
            transform=self.group_transform,
        )
        return [group]

#### `` end_point

    end_point() -> Point

Return the ending point of the arc

Source code in `src/momapy/core.py`

    951
    952
    953
    def end_point(self) -> momapy.geometry.Point:
        """Return the ending point of the arc"""
        return self.points()[-1]

#### `` equals

    equals(
        other: LayoutElement,
        flattened: bool = False,
        unordered: bool = False,
    ) -> bool

Return `true` if the layout element is equal to another layout element, `false` otherwise

Source code in `src/momapy/core.py`

    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    def equals(
        self, other: "LayoutElement", flattened: bool = False, unordered: bool = False
    ) -> bool:
        """Return `true` if the layout element is equal to another layout element, `false` otherwise"""
        if type(self) is type(other):
            if not flattened:
                return self == other
            else:
                if not unordered:
                    return self.flattened() == other.flattened()
                else:
                    return set(self.flattened()) == set(other.flattened())
        return False

#### `` flattened

    flattened() -> list[LayoutElement]

Return a list containing copy of the layout element with no children and all its descendants with no children

Source code in `src/momapy/core.py`

     98
     99
    100
    101
    102
    103
    def flattened(self) -> list["LayoutElement"]:
        """Return a list containing copy of the layout element with no children and all its descendants with no children"""
        flattened = [self.childless()]
        for child in self.children():
            flattened += child.flattened()
        return flattened

#### `` fraction

    fraction(fraction: float) -> tuple[Point, float]

Return the position and angle on the arc at a given fraction (of the total arc length)

Source code in `src/momapy/core.py`

    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    def fraction(self, fraction: float) -> tuple[momapy.geometry.Point, float]:
        """Return the position and angle on the arc at a given fraction (of the total arc length)"""
        current_length = 0
        length_to_reach = fraction * self.length()
        for segment in self.segments:
            current_length += segment.length()
            if current_length >= length_to_reach:
                break
        position, angle = segment.get_position_and_angle_at_fraction(fraction)
        return position, angle

#### `` length

    length()

Return the total length of the arc path

Source code in `src/momapy/core.py`

    943
    944
    945
    def length(self):
        """Return the total length of the arc path"""
        return sum([segment.length() for segment in self.segments])

#### `` path_drawing_elements

    path_drawing_elements() -> list[Path]

Return the drawing elements of the single-headed arc path

Source code in `src/momapy/core.py`

    1129
    1130
    1131
    1132
    1133
    1134
    1135
    1136
    1137
    1138
    1139
    1140
    1141
    1142
    1143
    1144
    1145
    1146
    1147
    1148
    1149
    1150
    1151
    1152
    1153
    1154
    1155
    1156
    1157
    1158
    1159
    1160
    1161
    1162
    1163
    1164
    1165
    1166
    1167
    def path_drawing_elements(self) -> list[momapy.drawing.Path]:
        """Return the drawing elements of the single-headed arc path"""
        arrowhead_length = self.arrowhead_length()
        if len(self.segments) == 1:
            segment = (
                self.segments[0]
                .shortened(self.start_shorten, "start")
                .shortened(self.end_shorten + arrowhead_length, "end")
            )
            actions = [
                momapy.drawing.MoveTo(segment.p1),
                self._make_path_action_from_segment(segment),
            ]
        else:
            first_segment = self.segments[0].shortened(self.start_shorten, "start")
            last_segment = self.segments[-1].shortened(
                self.end_shorten + arrowhead_length, "end"
            )
            actions = [
                momapy.drawing.MoveTo(first_segment.p1),
                self._make_path_action_from_segment(first_segment),
            ]
            for segment in self.segments[1:-1]:
                action = self._make_path_action_from_segment(segment)
                actions.append(action)
            actions.append(self._make_path_action_from_segment(last_segment))
        path = momapy.drawing.Path(
            actions=tuple(actions),
            class_=f"{type(self).__name__}_path",
            fill=self.path_fill,
            filter=self.path_filter,
            id_=f"{self.id_}_path",
            stroke=self.path_stroke,
            stroke_dasharray=self.path_stroke_dasharray,
            stroke_dashoffset=self.path_stroke_dashoffset,
            stroke_width=self.path_stroke_width,
            transform=self.path_transform,
        )
        return [path]

#### `` points

    points() -> list[Point]

Return the points of the arc path

Source code in `src/momapy/core.py`

    935
    936
    937
    938
    939
    940
    941
    def points(self) -> list[momapy.geometry.Point]:
        """Return the points of the arc path"""
        points = []
        for segment in self.segments:
            points.append(segment.p1)
        points.append(segment.p2)
        return points

#### `` self_bbox

    self_bbox() -> Bbox

Compute and return the bounding box of the self drawing element of the group layout

Source code in `src/momapy/core.py`

    499
    500
    501
    502
    def self_bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the self drawing element of the group layout"""
        bounds = self.self_to_shapely().bounds
        return momapy.geometry.Bbox.from_bounds(bounds)

#### `` self_children

    self_children() -> list[LayoutElement]

Return the self children of the arc

Source code in `src/momapy/core.py`

    931
    932
    933
    def self_children(self) -> list[LayoutElement]:
        """Return the self children of the arc"""
        return []

#### `` self_drawing_elements

    self_drawing_elements() -> list[DrawingElement]

Return the self drawing elements of the single-headed arc

Source code in `src/momapy/core.py`

    1169
    1170
    1171
    1172
    1173
    1174
    1175
    1176
    1177
    1178
    1179
    1180
    1181
    1182
    1183
    1184
    1185
    1186
    def self_drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the self drawing elements of the single-headed arc"""
        drawing_elements = (
            self.path_drawing_elements() + self.arrowhead_drawing_elements()
        )
        group = momapy.drawing.Group(
            class_=type(self).__name__,
            elements=tuple(drawing_elements),
            fill=self.fill,
            filter=self.filter,
            id_=self.id_,
            stroke=self.stroke,
            stroke_dasharray=self.stroke_dasharray,
            stroke_dashoffset=self.stroke_dashoffset,
            stroke_width=self.stroke_width,
            transform=self.transform,
        )
        return [group]

#### `` self_to_shapely

    self_to_shapely() -> GeometryCollection

Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout

Source code in `src/momapy/core.py`

    495
    496
    497
    def self_to_shapely(self) -> shapely.GeometryCollection:
        """Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout"""
        return momapy.drawing.drawing_elements_to_shapely(self.drawing_elements())

#### `` start_point

    start_point() -> Point

Return the starting point of the arc

Source code in `src/momapy/core.py`

    947
    948
    949
    def start_point(self) -> momapy.geometry.Point:
        """Return the starting point of the arc"""
        return self.points()[0]

#### `` to_shapely

    to_shapely(to_polygons: bool = False) -> GeometryCollection

Return a shapely collection of geometries reproducing the drawing elements of the layout element

Source code in `src/momapy/core.py`

    123
    124
    125
    126
    127
    128
    def to_shapely(self, to_polygons: bool = False) -> shapely.GeometryCollection:
        """Return a shapely collection of geometries reproducing the drawing elements of the layout element"""
        geom_collection = []
        for drawing_element in self.drawing_elements():
            geom_collection += drawing_element.to_shapely(to_polygons=to_polygons).geoms
        return shapely.GeometryCollection(geom_collection)

### `` SingleHeadedArcBuilder `module-attribute`

    SingleHeadedArcBuilder = get_or_make_builder_cls(
        SingleHeadedArc
    )

Base class for single-headed arc builders

### `` TextLayout `dataclass`

    TextLayout(
        *,
        id_: str = make_uuid4_as_str(),
        text: str,
        font_family: str = get_initial_value("font_family"),
        font_size: float = get_initial_value("font_size"),
        font_style: FontStyle = get_initial_value("font_style"),
        font_weight: FontWeight | int = get_initial_value(
            "font_weight"
        ),
        position: Point,
        width: float | None = None,
        height: float | None = None,
        horizontal_alignment: HAlignment = LEFT,
        vertical_alignment: VAlignment = TOP,
        justify: bool = False,
        fill: NoneValueType | Color | None = None,
        filter: NoneValueType | Filter | None = None,
        stroke: NoneValueType | Color | None = None,
        stroke_dasharray: tuple[float] | None = None,
        stroke_dashoffset: float | None = None,
        stroke_width: float | None = None,
        text_anchor: TextAnchor | None = None,
        transform: NoneValueType
        | tuple[Transformation]
        | None = None,
    )

Bases: `LayoutElement`

Class for text layouts

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`id_` | `str` | The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element | `'a592f93d-9197-4d0e-80a3-e571d8874708'`
`text` | `str` | The text of the text layout | required
`font_family` | `str` | The font family of the text layout | `'Arial'`
`font_size` | `float` | The font size of the text layout | `16.0`
`font_style` | `FontStyle` | The font style of the text layout | `<FontStyle.NORMAL: 0>`
`font_weight` | `FontWeight | int` | The font weight of the text layout | `<FontWeight.NORMAL: 0>`
`position` | `Point` | The position of the text layout | required
`width` | `float | None` | The width of the text layout | `None`
`height` | `float | None` | The height of the text layout | `None`
`horizontal_alignment` | `HAlignment` | The horizontal alignment of the text layout | `<HAlignment.LEFT: 1>`
`vertical_alignment` | `VAlignment` | The vertical alignment of the text layout | `<VAlignment.TOP: 1>`
`justify` | `bool` | Whether to justify the text or not | `False`
`fill` | `NoneValueType | Color | None` | The text fill color of the text layout | `None`
`filter` | `NoneValueType | Filter | None` | The filter of the text layout | `None`
`stroke` | `NoneValueType | Color | None` | The text stroke color of the text layout | `None`
`stroke_dasharray` | `tuple[float] | None` | The text stroke dasharray of the text layout | `None`
`stroke_dashoffset` | `float | None` | The text stroke dashoffset of the text layout | `None`
`stroke_width` | `float | None` | The text stroke width of the text layout | `None`
`text_anchor` | `TextAnchor | None` | The text anchor of the text layout | `None`
`transform` | `NoneValueType | tuple[Transformation] | None` | The transform of the text layout | `None`

Methods:

Name | Description
--- | ---
`anchor_point` | Return an anchor point of the layout element
`bbox` | Compute and return the bounding box of the layout element
`childless` | Return a copy of the text layout with no children.
`children` | Return the children of the text layout.
`contains` | Return `true` if another layout element is a descendant of the layout element, `false` otherwise
`descendants` | Return the descendants of the layout element
`drawing_elements` | Return the drawing elements of the text layout
`east` | Return the east anchor of the text layout
`east_north_east` | Return the east north east anchor of the text layout
`east_south_east` | Return the east south east anchor of the text layout
`equals` | Return `true` if the layout element is equal to another layout element, `false` otherwise
`flattened` | Return a list containing copy of the layout element with no children and all its descendants with no children
`ink_bbox` | Return the ink bounding box of the text layout
`logical_bbox` | Return the logical bounding box of the text layout
`north` | Return the north anchor of the text layout
`north_east` | Return the north east anchor of the text layout
`north_north_east` | Return the north north east anchor of the text layout
`north_north_west` | Return the north north west anchor of the text layout
`north_west` | Return the north west anchor of the text layout
`south` | Return the south anchor of the text layout
`south_east` | Return the south east anchor of the text layout
`south_south_east` | Return the south south east anchor of the text layout
`south_south_west` | Return the south south west anchor of the text layout
`south_west` | Return the south west anchor of the text layout
`to_shapely` | Return a shapely collection of geometries reproducing the drawing elements of the layout element
`west` | Return the west anchor of the text layout
`west_north_west` | Return the west north west anchor of the text layout
`west_south_west` | Return the west south west anchor of the text layout

Attributes:

Name | Type | Description
--- | --- | ---
`x` | `float` | Return the y coordinate of the text layout
`y` | `float` | Return the y coordinate of the text layout

#### `` anchor_point

    anchor_point(anchor_name: str) -> Point

Return an anchor point of the layout element

Source code in `src/momapy/core.py`

    130
    131
    132
    def anchor_point(self, anchor_name: str) -> momapy.geometry.Point:
        """Return an anchor point of the layout element"""
        return getattr(self, anchor_name)()

#### `` bbox

    bbox() -> Bbox

Compute and return the bounding box of the layout element

Source code in `src/momapy/core.py`

    395
    396
    397
    def bbox(self) -> momapy.geometry.Bbox:
        """Compute and return the bounding box of the layout element"""
        return self.ink_bbox()

#### `` childless

    childless() -> Self

Return a copy of the text layout with no children. The text layout has no children, so return a copy of the text layout

Source code in `src/momapy/core.py`

    325
    326
    327
    328
    329
    def childless(self) -> typing.Self:
        """Return a copy of the text layout with no children.
        The text layout has no children, so return a copy of the text layout
        """
        return copy.deepcopy(self)

#### `` children

    children() -> list[LayoutElement]

Return the children of the text layout. The text layout has no children, so return an empty list

Source code in `src/momapy/core.py`

    320
    321
    322
    323
    def children(self) -> list[LayoutElement]:
        """Return the children of the text layout.
        The text layout has no children, so return an empty list"""
        return []

#### `` contains

    contains(other: LayoutElement) -> bool

Return `true` if another layout element is a descendant of the layout element, `false` otherwise

Source code in `src/momapy/core.py`

    119
    120
    121
    def contains(self, other: "LayoutElement") -> bool:
        """Return `true` if another layout element is a descendant of the layout element, `false` otherwise"""
        return other in self.descendants()

#### `` descendants

    descendants() -> list[LayoutElement]

Return the descendants of the layout element

Source code in `src/momapy/core.py`

    90
    91
    92
    93
    94
    95
    96
    def descendants(self) -> list["LayoutElement"]:
        """Return the descendants of the layout element"""
        descendants = []
        for child in self.children():
            descendants.append(child)
            descendants += child.descendants()
        return descendants

#### `` drawing_elements

    drawing_elements() -> list[DrawingElement]

Return the drawing elements of the text layout

Source code in `src/momapy/core.py`

    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    def drawing_elements(self) -> list[momapy.drawing.DrawingElement]:
        """Return the drawing elements of the text layout"""
        drawing_elements = []
        pango_layout = self._make_pango_layout()
        pango_layout_iter = pango_layout.get_iter()
        tx, ty = self._get_tx_and_ty(pango_layout)
        done = False
        while not done:
            pango_line = pango_layout_iter.get_line()
            line_text, pos = momapy._pango.get_pango_line_text_and_initial_pos(
                pango_layout, pango_layout_iter, pango_line
            )
            pos += (tx, ty)
            text = momapy.drawing.Text(
                text=line_text,
                point=pos,
                fill=self.fill,
                filter=self.filter,
                font_family=self.font_family,
                font_size=self.font_size,
                font_style=self.font_style,
                font_weight=self.font_weight,
                stroke=self.stroke,
                stroke_dasharray=self.stroke_dasharray,
                stroke_dashoffset=self.stroke_dashoffset,
                stroke_width=self.stroke_width,
                text_anchor=self.text_anchor,
                transform=self.transform,
            )
            drawing_elements.append(text)
            if pango_layout_iter.at_last_line():
                done = True
            else:
                pango_layout_iter.next_line()
        return drawing_elements

#### `` east

    east() -> Point

Return the east anchor of the text layout

Source code in `src/momapy/core.py`

    355
    356
    357
    def east(self) -> momapy.geometry.Point:
        """Return the east anchor of the text layout"""
        return self.bbox().east()

#### `` east_north_east

    east_north_east() -> Point

Return the east north east anchor of the text layout

Source code in `src/momapy/core.py`

    351
    352
    353
    def east_north_east(self) -> momapy.geometry.Point:
        """Return the east north east anchor of the text layout"""
        return self.bbox().east_north_east()

#### `` east_south_east

    east_south_east() -> Point

Return the east south east anchor of the text layout

Source code in `src/momapy/core.py`

    359
    360
    361
    def east_south_east(self) -> momapy.geometry.Point:
        """Return the east south east anchor of the text layout"""
        return self.bbox().east_south_east()

#### `` equals

    equals(
        other: LayoutElement,
        flattened: bool = False,
        unordered: bool = False,
    ) -> bool

Return `true` if the layout element is equal to another layout element, `false` otherwise

Source code in `src/momapy/core.py`

    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    def equals(
        self, other: "LayoutElement", flattened: bool = False, unordered: bool = False
    ) -> bool:
        """Return `true` if the layout element is equal to another layout element, `false` otherwise"""
        if type(self) is type(other):
            if not flattened:
                return self == other
            else:
                if not unordered:
                    return self.flattened() == other.flattened()
                else:
                    return set(self.flattened()) == set(other.flattened())
        return False

#### `` flattened

    flattened() -> list[LayoutElement]

Return a list containing copy of the layout element with no children and all its descendants with no children

Source code in `src/momapy/core.py`

     98
     99
    100
    101
    102
    103
    def flattened(self) -> list["LayoutElement"]:
        """Return a list containing copy of the layout element with no children and all its descendants with no children"""
        flattened = [self.childless()]
        for child in self.children():
            flattened += child.flattened()
        return flattened

#### `` ink_bbox

    ink_bbox() -> Bbox

Return the ink bounding box of the text layout

Source code in `src/momapy/core.py`

    278
    279
    280
    281
    282
    def ink_bbox(self) -> momapy.geometry.Bbox:
        """Return the ink bounding box of the text layout"""
        pango_layout = self._make_pango_layout()
        pango_layout_extents, _ = pango_layout.get_pixel_extents()
        return self._get_bbox(pango_layout, pango_layout_extents)

#### `` logical_bbox

    logical_bbox() -> Bbox

Return the logical bounding box of the text layout

Source code in `src/momapy/core.py`

    272
    273
    274
    275
    276
    def logical_bbox(self) -> momapy.geometry.Bbox:
        """Return the logical bounding box of the text layout"""
        pango_layout = self._make_pango_layout()
        _, pango_layout_extents = pango_layout.get_pixel_extents()
        return self._get_bbox(pango_layout, pango_layout_extents)

#### `` north

    north() -> Point

Return the north anchor of the text layout

Source code in `src/momapy/core.py`

    339
    340
    341
    def north(self) -> momapy.geometry.Point:
        """Return the north anchor of the text layout"""
        return self.bbox().north()

#### `` north_east

    north_east() -> Point

Return the north east anchor of the text layout

Source code in `src/momapy/core.py`

    347
    348
    349
    def north_east(self) -> momapy.geometry.Point:
        """Return the north east anchor of the text layout"""
        return self.bbox().north_east()

#### `` north_north_east

    north_north_east() -> Point

Return the north north east anchor of the text layout

Source code in `src/momapy/core.py`

    343
    344
    345
    def north_north_east(self) -> momapy.geometry.Point:
        """Return the north north east anchor of the text layout"""
        return self.bbox().north_north_east()

#### `` north_north_west

    north_north_west() -> Point

Return the north north west anchor of the text layout

Source code in `src/momapy/core.py`

    335
    336
    337
    def north_north_west(self) -> momapy.geometry.Point:
        """Return the north north west anchor of the text layout"""
        return self.bbox().north_north_west()

#### `` north_west

    north_west() -> Point

Return the north west anchor of the text layout

Source code in `src/momapy/core.py`

    331
    332
    333
    def north_west(self) -> momapy.geometry.Point:
        """Return the north west anchor of the text layout"""
        return self.bbox().north_west()

#### `` south

    south() -> Point

Return the south anchor of the text layout

Source code in `src/momapy/core.py`

    371
    372
    373
    def south(self) -> momapy.geometry.Point:
        """Return the south anchor of the text layout"""
        return self.bbox().south()

#### `` south_east

    south_east() -> Point

Return the south east anchor of the text layout

Source code in `src/momapy/core.py`

    363
    364
    365
    def south_east(self) -> momapy.geometry.Point:
        """Return the south east anchor of the text layout"""
        return self.bbox().south_east()

#### `` south_south_east

    south_south_east() -> Point

Return the south south east anchor of the text layout

Source code in `src/momapy/core.py`

    367
    368
    369
    def south_south_east(self) -> momapy.geometry.Point:
        """Return the south south east anchor of the text layout"""
        return self.bbox().south_south_east()

#### `` south_south_west

    south_south_west() -> Point

Return the south south west anchor of the text layout

Source code in `src/momapy/core.py`

    375
    376
    377
    def south_south_west(self) -> momapy.geometry.Point:
        """Return the south south west anchor of the text layout"""
        return self.bbox().south_south_west()

#### `` south_west

    south_west() -> Point

Return the south west anchor of the text layout

Source code in `src/momapy/core.py`

    379
    380
    381
    def south_west(self) -> momapy.geometry.Point:
        """Return the south west anchor of the text layout"""
        return self.bbox().south_west()

#### `` to_shapely

    to_shapely(to_polygons: bool = False) -> GeometryCollection

Return a shapely collection of geometries reproducing the drawing elements of the layout element

Source code in `src/momapy/core.py`

    123
    124
    125
    126
    127
    128
    def to_shapely(self, to_polygons: bool = False) -> shapely.GeometryCollection:
        """Return a shapely collection of geometries reproducing the drawing elements of the layout element"""
        geom_collection = []
        for drawing_element in self.drawing_elements():
            geom_collection += drawing_element.to_shapely(to_polygons=to_polygons).geoms
        return shapely.GeometryCollection(geom_collection)

#### `` west

    west() -> Point

Return the west anchor of the text layout

Source code in `src/momapy/core.py`

    387
    388
    389
    def west(self) -> momapy.geometry.Point:
        """Return the west anchor of the text layout"""
        return self.bbox().west()

#### `` west_north_west

    west_north_west() -> Point

Return the west north west anchor of the text layout

Source code in `src/momapy/core.py`

    391
    392
    393
    def west_north_west(self) -> momapy.geometry.Point:
        """Return the west north west anchor of the text layout"""
        return self.bbox().west_north_west()

#### `` west_south_west

    west_south_west() -> Point

Return the west south west anchor of the text layout

Source code in `src/momapy/core.py`

    383
    384
    385
    def west_south_west(self) -> momapy.geometry.Point:
        """Return the west south west anchor of the text layout"""
        return self.bbox().west_south_west()

#### `` x `property`

    x: float

Return the y coordinate of the text layout

#### `` y `property`

    y: float

Return the y coordinate of the text layout

### `` TextLayoutBuilder `module-attribute`

    TextLayoutBuilder = get_or_make_builder_cls(TextLayout)

Class for text layout builders

### `` TupleBuilder `dataclass`

    TupleBuilder()

Bases: `list`, `Builder`

Builder class for tuples

Methods:

Name | Description
--- | ---
`build` | Build and return an object from the builder object
`from_object` | Create and return a builder object from an object

#### `` build

    build(
        inside_collections: bool = True,
        builder_to_object: dict[int, Any] | None = None,
    )

Build and return an object from the builder object

Source code in `src/momapy/core.py`

    1640
    1641
    1642
    1643
    1644
    1645
    1646
    1647
    1648
    1649
    1650
    1651
    1652
    1653
    1654
    1655
    1656
    1657
    1658
    1659
    1660
    1661
    def build(
        self,
        inside_collections: bool = True,
        builder_to_object: dict[int, typing.Any] | None = None,
    ):
        if builder_to_object is not None:
            obj = builder_to_object.get(id(self))
            if obj is not None:
                return obj
        else:
            builder_to_object = {}
        obj = self._cls_to_build(
            [
                momapy.builder.object_from_builder(
                    builder=e,
                    inside_collections=inside_collections,
                    builder_to_object=builder_to_object,
                )
                for e in self
            ]
        )
        return obj

#### `` from_object `classmethod`

    from_object(
        obj,
        inside_collections: bool = True,
        omit_keys: bool = True,
        object_to_builder: dict[int, Builder] | None = None,
    )

Create and return a builder object from an object

Source code in `src/momapy/core.py`

    1663
    1664
    1665
    1666
    1667
    1668
    1669
    1670
    1671
    1672
    1673
    1674
    1675
    1676
    1677
    1678
    1679
    1680
    1681
    1682
    1683
    1684
    1685
    1686
    1687
    @classmethod
    def from_object(
        cls,
        obj,
        inside_collections: bool = True,
        omit_keys: bool = True,
        object_to_builder: dict[int, momapy.builder.Builder] | None = None,
    ):
        if object_to_builder is not None:
            builder = object_to_builder.get(id(obj))
            if builder is not None:
                return builder
        else:
            object_to_builder = {}
        builder = cls(
            [
                momapy.builder.builder_from_object(
                    obj=e,
                    inside_collections=inside_collections,
                    object_to_builder=object_to_builder,
                )
                for e in obj
            ]
        )
        return builder