pydetecdiv.domain.dso
Domain specific generic attributes and methods shared by domain objects. Other domain classes (except Project) should inherit from these classes according to their type.
- class pydetecdiv.domain.dso.DomainSpecificObject(project: Project = None, **kwargs)
Bases:
objectA business-logic class defining valid operations and attributes common to all domain-specific classes
- delete() None
Delete the current object
- check_validity() None
Checks the validity of the current object
- validate(updated: bool = True) DomainSpecificObject
Validate the current object and pass newly created and updated object to project for saving modifications. Sets the id of the object for new objects. This method should be called at the creation or at each modification of an object (i.e. in the __init__ and all setter methods)
- record(no_id=False) dict
Returns a record dictionary of the current DSO
- Returns:
record dictionary
- Return type:
dict
- class pydetecdiv.domain.dso.NamedDSO(name: str = None, **kwargs)
Bases:
DomainSpecificObjectA domain-specific class for objects with a name.
- property name: str
Returns the name of this object
- Returns:
the name of the current object
- Return type:
str
- class pydetecdiv.domain.dso.BoxedDSO(top_left: tuple[int, int] = None, bottom_right: tuple[int, int] = None, **kwargs)
Bases:
DomainSpecificObjectA domain-specific class for objects that can be represented as a rectangular box (i.e. having top left and bottom right corners).
- property box: Box
Returns a Box object that can represent the current object
- Returns:
a box with the same coordinates
- Return type:
- property top_left: tuple[int, int]
The top-left corner of the Box in the coordinate system
- Returns:
the coordinates of the top-left corner
- Return type:
a tuple of two int
- property bottom_right: tuple[int, int]
The bottom-right corner of the Box in the coordinate system
- Returns:
the coordinates of the bottom-right corner
- Return type:
a tuple of two int
- property size: tuple[int, int]
The size (dimension) of the object obtained from its associated box
- Returns:
the dimension of the boxed object
- Return type:
a tuple of two int