- Add visitor support to content rectangle - Refactor box unpacking to happen by applying visitor pattern
14 lines
435 B
Python
14 lines
435 B
Python
from cv_analysis.utils.rectangle import Rectangle
|
|
|
|
|
|
class ContentRectangle(Rectangle):
|
|
def __init__(self, x1, y1, x2, y2, content=None):
|
|
super().__init__(x1, y1, x2, y2)
|
|
self.content = content
|
|
|
|
def __repr__(self):
|
|
return f"{self.__class__.__name__}({self.x1}, {self.y1}, {self.x2}, {self.y2}, content={self.content})"
|
|
|
|
def accept(self, visitor):
|
|
return visitor.visit_content_rectangle(self)
|