Positioning
momapy.positioning
Functions for positioning layout elements and related objects relatively to other objects
Functions:
| Name | Description |
|---|---|
above_left_of |
Compute and return the point above left of the given object at a given distance |
above_of |
Compute and return the point above of the given object at a given distance |
above_right_of |
Compute and return the point above right of the given object at a given distance |
below_left_of |
Compute and return the point below left of the given object at a given distance |
below_of |
Compute and return the point below of the given object at a given distance |
below_right_of |
Compute and return the point below right of the given object at a given distance |
fit |
Compute and return the bounding box fitting a collection of objects, with given margins |
fraction_of |
Return the position on an arc at a given fraction and the angle formed of the tangant of the arc at that position and the horizontal |
left_of |
Compute and return the point left of the given object at a given distance |
right_of |
Compute and return the point right of the given object at a given distance |
set_above_left_of |
Set the position of a given builder object above left of another given object at a given distance |
set_above_of |
Set the position of a given builder object above of another given object at a given distance |
set_above_right_of |
Set the position of a given builder object above right of another given object at a given distance |
set_below_left_of |
Set the position of a given builder object below left of another given object at a given distance |
set_below_of |
Set the position of a given builder object below of another given object at a given distance |
set_below_right_of |
Set the position of a given builder object below right of another given object at a given distance |
set_fit |
Set the position, width and height of a given builder object to fit a given collection of other objects |
set_fraction_of |
Set the position and rotation of a given builder object to lay at a given fraction of a given arc |
set_left_of |
Set the position of a given builder object left of another given object at a given distance |
set_position |
Set the position of a given builder object |
set_right_of |
Set the position of a given builder object right of another given object at a given distance |
above_left_of
above_left_of(
obj: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance1: float,
distance2: float | None = None,
) -> Point
Compute and return the point above left of the given object at a given distance
Source code in src/momapy/positioning.py
above_of
above_of(
obj: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance: float,
) -> Point
Compute and return the point above of the given object at a given distance
Source code in src/momapy/positioning.py
above_right_of
above_right_of(
obj: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance1: float,
distance2: float | None = None,
) -> Point
Compute and return the point above right of the given object at a given distance
Source code in src/momapy/positioning.py
below_left_of
below_left_of(
obj: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance1: float,
distance2: float | None = None,
) -> Point
Compute and return the point below left of the given object at a given distance
Source code in src/momapy/positioning.py
below_of
below_of(
obj: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance: float,
) -> Point
Compute and return the point below of the given object at a given distance
Source code in src/momapy/positioning.py
below_right_of
below_right_of(
obj: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance1: float,
distance2: float | None = None,
) -> Point
Compute and return the point below right of the given object at a given distance
Source code in src/momapy/positioning.py
fit
fit(
elements: Collection[
LayoutElement
| LayoutElementBuilder
| Bbox
| BboxBuilder
| Point
| PointBuilder
],
xsep: float = 0,
ysep: float = 0,
) -> Bbox
Compute and return the bounding box fitting a collection of objects, with given margins
Source code in src/momapy/positioning.py
fraction_of
fraction_of(
arc_layout_element: SingleHeadedArc | DoubleHeadedArc,
fraction: float,
) -> tuple[Point, float]
Return the position on an arc at a given fraction and the angle formed of the tangant of the arc at that position and the horizontal
Source code in src/momapy/positioning.py
left_of
left_of(
obj: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance: float,
) -> Point
Compute and return the point left of the given object at a given distance
Source code in src/momapy/positioning.py
right_of
right_of(
obj: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance: float,
) -> Point
Compute and return the point right of the given object at a given distance
Source code in src/momapy/positioning.py
set_above_left_of
set_above_left_of(
obj1: NodeBuilder | BboxBuilder,
obj2: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance1: float,
distance2: float | None = None,
anchor: str | None = None,
)
Set the position of a given builder object above left of another given object at a given distance
Source code in src/momapy/positioning.py
set_above_of
set_above_of(
obj1: NodeBuilder | BboxBuilder,
obj2: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance: float,
anchor: str | None = None,
)
Set the position of a given builder object above of another given object at a given distance
Source code in src/momapy/positioning.py
set_above_right_of
set_above_right_of(
obj1: NodeBuilder | BboxBuilder,
obj2: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance1: float,
distance2: float | None = None,
anchor: str | None = None,
)
Set the position of a given builder object above right of another given object at a given distance
Source code in src/momapy/positioning.py
set_below_left_of
set_below_left_of(
obj1: NodeBuilder | BboxBuilder,
obj2: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance1: float,
distance2: float | None = None,
anchor: str | None = None,
)
Set the position of a given builder object below left of another given object at a given distance
Source code in src/momapy/positioning.py
set_below_of
set_below_of(
obj1: NodeBuilder | BboxBuilder,
obj2: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance: float,
anchor: str | None = None,
)
Set the position of a given builder object below of another given object at a given distance
Source code in src/momapy/positioning.py
set_below_right_of
set_below_right_of(
obj1: NodeBuilder | BboxBuilder,
obj2: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance1: float,
distance2: float | None = None,
anchor: str | None = None,
)
Set the position of a given builder object below right of another given object at a given distance
Source code in src/momapy/positioning.py
set_fit
set_fit(
obj: NodeBuilder | BboxBuilder,
elements: Collection[
Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder
],
xsep: float = 0,
ysep: float = 0,
anchor: str | None = None,
)
Set the position, width and height of a given builder object to fit a given collection of other objects
Source code in src/momapy/positioning.py
set_fraction_of
set_fraction_of(
obj: NodeBuilder,
arc_layout_element: SingleHeadedArc | DoubleHeadedArc,
fraction: float,
anchor: str | None = None,
)
Set the position and rotation of a given builder object to lay at a given fraction of a given arc
Source code in src/momapy/positioning.py
set_left_of
set_left_of(
obj1: NodeBuilder | BboxBuilder,
obj2: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance: float,
anchor: str | None = None,
)
Set the position of a given builder object left of another given object at a given distance
Source code in src/momapy/positioning.py
set_position
set_position(
obj: NodeBuilder | BboxBuilder,
position: Point | PointBuilder,
anchor: str | None = None,
)
Set the position of a given builder object
Source code in src/momapy/positioning.py
set_right_of
set_right_of(
obj1: NodeBuilder | BboxBuilder,
obj2: Point
| PointBuilder
| Bbox
| BboxBuilder
| LayoutElement
| LayoutElementBuilder,
distance: float,
anchor: str | None = None,
)
Set the position of a given builder object right of another given object at a given distance