neoscore.interface.positioned_object_interface

class neoscore.interface.positioned_object_interface.PositionedObjectInterface[source]

Bases: object

Interface for a generic graphic object.

All graphic interfaces for renderable objects should descend from this and also be immutable dataclasses.

pos: Point

The position of the object.

If a parent is provided, this position is relative to that interface. Otherwise it is in absolute document coordinates.

parent: Optional[PositionedObjectInterface]

The object’s parent, if any.

If a parent interface is provided, it must be rendered before this interface.

scale: float

A scaling factor, where 1 is no scaling.

This occurs relative to transform_origin.

Scaling is inherited from parents to children along the interface tree.

rotation: float

Rotation angle in degrees, where 0 is no rotation.

This occurs relative to transform_origin.

Rotation is inherited from parents to children along the interface tree.

__init__(pos: Point, parent: Optional[PositionedObjectInterface], scale: float, rotation: float, transform_origin: Point) None
transform_origin: Point

The origin point for rotation and scaling transforms

render()[source]

Render the object to the scene.

This is typically done by constructing a QGraphicsItem subclass and calling _register_qt_object with it. Do not manually assign the Qt object’s parent or add it to the Qt scene.