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 |
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
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 |
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 |
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
bbox
bbox() -> Bbox
Compute and return the bounding box of the group layout element
Source code in src/momapy/core.py
childless
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
contains
contains(other: LayoutElement) -> bool
Return true
if another layout element is a descendant of the layout element, false
otherwise
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
end_point
end_point() -> Point
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
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
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
length
points
points() -> list[Point]
self_bbox
self_bbox() -> Bbox
Compute and return the bounding box of the self drawing element of the group layout
self_children
self_children() -> list[LayoutElement]
self_drawing_elements
abstractmethod
self_drawing_elements() -> list[DrawingElement]
self_to_shapely
Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout
start_point
start_point() -> Point
to_shapely
Return a shapely collection of geometries reproducing the drawing elements of the layout element
Source code in src/momapy/core.py
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
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 |
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 |
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
bbox
bbox() -> Bbox
Compute and return the bounding box of the group layout element
Source code in src/momapy/core.py
childless
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
contains
contains(other: LayoutElement) -> bool
Return true
if another layout element is a descendant of the layout element, false
otherwise
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
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
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. When there are multiple intersection points, the one closest to the given point is returned
Source code in src/momapy/core.py
end_arrowhead_length
Return the length of the double-headed arc end arrowhead
Source code in src/momapy/core.py
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
end_point
end_point() -> Point
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
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
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
length
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
points
points() -> list[Point]
self_bbox
self_bbox() -> Bbox
Compute and return the bounding box of the self drawing element of the group layout
self_children
self_children() -> list[LayoutElement]
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
self_to_shapely
Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout
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
start_arrowhead_bbox
start_arrowhead_bbox() -> Bbox
Return the bounding box of the double-headed arc start arrowhead
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
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
start_arrowhead_length
Return the length of the double-headed arc start arrowhead
Source code in src/momapy/core.py
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
start_point
start_point() -> Point
to_shapely
Return a shapely collection of geometries reproducing the drawing elements of the layout element
Source code in src/momapy/core.py
DoubleHeadedArcBuilder
module-attribute
DoubleHeadedArcBuilder = get_or_make_builder_cls(DoubleHeadedArc)
Base class for double-headed arc builders
FrozendictBuilder
dataclass
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 and return an object from the builder object
Source code in src/momapy/core.py
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
FrozensetBuilder
dataclass
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 and return an object from the builder object
Source code in src/momapy/core.py
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
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
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 |
descendants |
Return the descendants of the layout element |
drawing_elements |
Return the drawing elements of the group layout. |
equals |
Return |
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
bbox
bbox() -> Bbox
Compute and return the bounding box of the group layout element
Source code in src/momapy/core.py
childless
abstractmethod
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
contains
contains(other: LayoutElement) -> bool
Return true
if another layout element is a descendant of the layout element, false
otherwise
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
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
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
self_bbox
self_bbox() -> Bbox
Compute and return the bounding box of the self drawing element of the group layout
self_children
abstractmethod
self_children() -> list[LayoutElement]
self_drawing_elements
abstractmethod
self_drawing_elements() -> list[DrawingElement]
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
Source code in src/momapy/core.py
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
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 |
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 |
flattened |
Return a list containing copy of the layout element with no children and all its descendants with no children |
is_sublayout |
Return |
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
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
bbox
bbox() -> Bbox
Compute and return the bounding box of the group layout element
Source code in src/momapy/core.py
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. When there are multiple intersection points, the one closest to the given point is returned
Source code in src/momapy/core.py
center
center() -> Point
childless
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
contains
contains(other: LayoutElement) -> bool
Return true
if another layout element is a descendant of the layout element, false
otherwise
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
east
east() -> Point
east_north_east
east_north_east() -> Point
Return the east north east anchor of the node
Source code in src/momapy/core.py
east_south_east
east_south_east() -> Point
Return the east south east west anchor of the node
Source code in src/momapy/core.py
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
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
is_sublayout
Return true
if another given layout is a sublayout of the layout, false
otherwise
Source code in src/momapy/core.py
label_center
label_center() -> Point
north
north() -> Point
north_east
north_east() -> Point
Return the north east anchor of the node
Source code in src/momapy/core.py
north_north_east
north_north_east() -> Point
Return the north north east anchor of the node
Source code in src/momapy/core.py
north_north_west
north_north_west() -> Point
Return the north north west anchor of the node
Source code in src/momapy/core.py
north_west
north_west() -> Point
Return the north west anchor of the node
Source code in src/momapy/core.py
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
self_bbox
self_bbox() -> 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. When there are multiple intersection points, the one closest to the given point is returned
Source code in src/momapy/core.py
self_children
self_children() -> list[LayoutElement]
Return the self children of the node. A node has unique child that is its label
self_drawing_elements
self_drawing_elements() -> list[DrawingElement]
Return the node's own drawing elements
Source code in src/momapy/core.py
self_to_shapely
Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout
size
south
south() -> Point
south_east
south_east() -> Point
Return the south east anchor of the node
Source code in src/momapy/core.py
south_south_east
south_south_east() -> Point
Return the south south east anchor of the node
Source code in src/momapy/core.py
south_south_west
south_south_west() -> Point
Return the south south west anchor of the node
Source code in src/momapy/core.py
south_west
south_west() -> Point
Return the south west anchor of the node
Source code in src/momapy/core.py
to_shapely
Return a shapely collection of geometries reproducing the drawing elements of the layout element
Source code in src/momapy/core.py
west
west() -> Point
west_north_west
west_north_west() -> Point
Return the west north west anchor of the node
Source code in src/momapy/core.py
west_south_west
west_south_west() -> Point
Return the west south west anchor of the node
Source code in src/momapy/core.py
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
Bases: MapElement
, ABC
Abstract base class for layout elements
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 |
descendants |
Return the descendants of the layout element |
drawing_elements |
Return the drawing elements of the layout element |
equals |
Return |
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
bbox
abstractmethod
bbox() -> Bbox
childless
abstractmethod
children
abstractmethod
children() -> list[LayoutElement]
contains
contains(other: LayoutElement) -> bool
Return true
if another layout element is a descendant of the layout element, false
otherwise
drawing_elements
abstractmethod
drawing_elements() -> list[DrawingElement]
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
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
to_shapely
Return a shapely collection of geometries reproducing the drawing elements of the layout element
Source code in src/momapy/core.py
LayoutElementBuilder
module-attribute
LayoutElementBuilder = get_or_make_builder_cls(LayoutElement)
Base class for layout element builders
LayoutModelMapping
Bases: FrozenSurjectionDict
Class for mappings between model elements and layout elements
Methods:
Name | Description |
---|---|
is_submapping |
Return |
Source code in src/momapy/utils.py
is_submapping
Return true
if the mapping is a submapping of another LayoutModelMapping
, false
otherwise
LayoutModelMappingBuilder
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
build
Build and return an object from the builder object
Source code in src/momapy/core.py
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
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
Methods:
Name | Description |
---|---|
get_mapping |
Return the layout elements mapped to the given model element |
is_submap |
Return |
get_mapping
get_mapping(map_element: MapElement | tuple[ModelElement, ModelElement])
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
Source code in src/momapy/core.py
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
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
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
.
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 |
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 |
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
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
bbox
bbox() -> Bbox
Compute and return the bounding box of the group layout element
Source code in src/momapy/core.py
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. When there are multiple intersection points, the one closest to the given point is returned
Source code in src/momapy/core.py
center
center() -> Point
childless
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
contains
contains(other: LayoutElement) -> bool
Return true
if another layout element is a descendant of the layout element, false
otherwise
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
east
east() -> Point
east_north_east
east_north_east() -> Point
Return the east north east anchor of the node
Source code in src/momapy/core.py
east_south_east
east_south_east() -> Point
Return the east south east west anchor of the node
Source code in src/momapy/core.py
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
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
label_center
label_center() -> Point
north
north() -> Point
north_east
north_east() -> Point
Return the north east anchor of the node
Source code in src/momapy/core.py
north_north_east
north_north_east() -> Point
Return the north north east anchor of the node
Source code in src/momapy/core.py
north_north_west
north_north_west() -> Point
Return the north north west anchor of the node
Source code in src/momapy/core.py
north_west
north_west() -> Point
Return the north west anchor of the node
Source code in src/momapy/core.py
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
self_bbox
self_bbox() -> 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. When there are multiple intersection points, the one closest to the given point is returned
Source code in src/momapy/core.py
self_children
self_children() -> list[LayoutElement]
Return the self children of the node. A node has unique child that is its label
self_drawing_elements
self_drawing_elements() -> list[DrawingElement]
Return the node's own drawing elements
Source code in src/momapy/core.py
self_to_shapely
Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout
size
south
south() -> Point
south_east
south_east() -> Point
Return the south east anchor of the node
Source code in src/momapy/core.py
south_south_east
south_south_east() -> Point
Return the south south east anchor of the node
Source code in src/momapy/core.py
south_south_west
south_south_west() -> Point
Return the south south west anchor of the node
Source code in src/momapy/core.py
south_west
south_west() -> Point
Return the south west anchor of the node
Source code in src/momapy/core.py
to_shapely
Return a shapely collection of geometries reproducing the drawing elements of the layout element
Source code in src/momapy/core.py
west
west() -> Point
west_north_west
west_north_west() -> Point
Return the west north west anchor of the node
Source code in src/momapy/core.py
west_south_west
west_south_west() -> Point
Return the west south west anchor of the node
Source code in src/momapy/core.py
NodeBuilder
module-attribute
NodeBuilder = get_or_make_builder_cls(Node)
Base class for node builders
Shape
dataclass
Bases: LayoutElement
Class for basic shapes. The shape is the most simple layout element. It has no children.
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 |
descendants |
Return the descendants of the layout element |
drawing_elements |
Return the drawing elements of the layout element |
equals |
Return |
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
bbox
bbox() -> Bbox
childless
Return a copy of the shape with no children. A shape has no children, so return a copy of the shape
children
children() -> list[LayoutElement]
contains
contains(other: LayoutElement) -> bool
Return true
if another layout element is a descendant of the layout element, false
otherwise
drawing_elements
abstractmethod
drawing_elements() -> list[DrawingElement]
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
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
to_shapely
Return a shapely collection of geometries reproducing the drawing elements of the layout element
Source code in src/momapy/core.py
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
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 |
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 |
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
arrowhead_base
arrowhead_base() -> Point
Return the arrowhead base anchor point of the single-headed arc
Source code in src/momapy/core.py
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
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
arrowhead_length
Return the length of the single-headed arc arrowhead
Source code in src/momapy/core.py
arrowhead_tip
arrowhead_tip() -> Point
Return the arrowhead tip anchor point of the single-headed arc
Source code in src/momapy/core.py
bbox
bbox() -> Bbox
Compute and return the bounding box of the group layout element
Source code in src/momapy/core.py
childless
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
contains
contains(other: LayoutElement) -> bool
Return true
if another layout element is a descendant of the layout element, false
otherwise
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
end_point
end_point() -> Point
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
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
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
length
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
points
points() -> list[Point]
self_bbox
self_bbox() -> Bbox
Compute and return the bounding box of the self drawing element of the group layout
self_children
self_children() -> list[LayoutElement]
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
self_to_shapely
Compute and return a shapely collection of geometries reproducing the self drawing elements of the group layout
start_point
start_point() -> Point
to_shapely
Return a shapely collection of geometries reproducing the drawing elements of the layout element
Source code in src/momapy/core.py
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
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 |
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 |
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
bbox
bbox() -> Bbox
childless
Return a copy of the text layout with no children. The text layout has no children, so return a copy of the text layout
children
children() -> list[LayoutElement]
Return the children of the text layout. The text layout has no children, so return an empty list
contains
contains(other: LayoutElement) -> bool
Return true
if another layout element is a descendant of the layout element, false
otherwise
drawing_elements
drawing_elements() -> list[DrawingElement]
Return the drawing elements of the text layout
Source code in src/momapy/core.py
east
east() -> Point
east_north_east
east_north_east() -> Point
east_south_east
east_south_east() -> Point
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
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
ink_bbox
ink_bbox() -> Bbox
Return the ink bounding box of the text layout
Source code in src/momapy/core.py
logical_bbox
logical_bbox() -> Bbox
Return the logical bounding box of the text layout
Source code in src/momapy/core.py
north
north() -> Point
north_east
north_east() -> Point
north_north_east
north_north_east() -> Point
north_north_west
north_north_west() -> Point
north_west
north_west() -> Point
south
south() -> Point
south_east
south_east() -> Point
south_south_east
south_south_east() -> Point
south_south_west
south_south_west() -> Point
south_west
south_west() -> Point
to_shapely
Return a shapely collection of geometries reproducing the drawing elements of the layout element
Source code in src/momapy/core.py
west
west() -> Point
west_north_west
west_north_west() -> Point
west_south_west
west_south_west() -> Point
TextLayoutBuilder
module-attribute
TextLayoutBuilder = get_or_make_builder_cls(TextLayout)
Class for text layout builders
TupleBuilder
dataclass
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 and return an object from the builder object
Source code in src/momapy/core.py
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