diff --git a/src/py_to_uxf_core/model/class_implementation.py b/src/py_to_uxf_core/model/class_implementation.py index 428541d..0dbfb37 100644 --- a/src/py_to_uxf_core/model/class_implementation.py +++ b/src/py_to_uxf_core/model/class_implementation.py @@ -16,7 +16,7 @@ class ClassImplementation: return self._subclass def __str__(self): - return f'{self._subclass.name} -> {self._base.name}' + return f'<{self._subclass.name} -> {self._base.name}>' def __repr__(self): - return f'{self._subclass.name} -> {self._base.name}' + return f'<{self._subclass.name} -> {self._base.name}>' diff --git a/src/py_to_uxf_core/model/dimension.py b/src/py_to_uxf_core/model/dimension.py index 781a4ca..3e4a16b 100644 --- a/src/py_to_uxf_core/model/dimension.py +++ b/src/py_to_uxf_core/model/dimension.py @@ -21,7 +21,7 @@ class Dimension: self._height = value def __str__(self): - return f'(w:{self._width}, h:{self._height})' + return f'<{type(self).__name__} w:{self._width}, h:{self._height}>' def __repr__(self): - return f'(w:{self._width}, h:{self._height})' + return f'<{type(self).__name__} w:{self._width}, h:{self._height}>' diff --git a/src/py_to_uxf_core/model/position.py b/src/py_to_uxf_core/model/position.py index 7e8fbf2..c78eae7 100644 --- a/src/py_to_uxf_core/model/position.py +++ b/src/py_to_uxf_core/model/position.py @@ -21,7 +21,7 @@ class Position: self._y = value def __str__(self): - return f'(x:{self._x}, y:{self._y})' + return f'<{type(self).__name__} x:{self._x}, y:{self._y}>' def __repr__(self): - return f'(x:{self._x}, y:{self._y})' + return f'<{type(self).__name__} x:{self._x}, y:{self._y}>' diff --git a/src/py_to_uxf_core/model/python_class.py b/src/py_to_uxf_core/model/python_class.py index f15e1cc..ce67fe4 100644 --- a/src/py_to_uxf_core/model/python_class.py +++ b/src/py_to_uxf_core/model/python_class.py @@ -30,7 +30,7 @@ class PythonClass: self._attributes.append(attribute) def __str__(self): - return f'{self._name}' + return f'<{type(self).__name__} {self._name} a:{len(self._attributes)} f:{len(self._functions)}>' def __repr__(self): - return f'{self._name}' + return f'<{type(self).__name__} {self._name} a:{len(self._attributes)} f:{len(self._functions)}>' diff --git a/src/py_to_uxf_core/model/python_class_attribute.py b/src/py_to_uxf_core/model/python_class_attribute.py index a7686bd..132e021 100644 --- a/src/py_to_uxf_core/model/python_class_attribute.py +++ b/src/py_to_uxf_core/model/python_class_attribute.py @@ -21,7 +21,7 @@ class PythonClassAttribute: return self._type def __str__(self): - return f'{self._name}: {self._type}' + return f'<{type(self).__name__} {self._name}: {self._type}>' def __repr__(self): - return f'{self._name}: {self._type}' + return f'<{type(self).__name__} {self._name}: {self._type}>' diff --git a/src/py_to_uxf_core/model/python_function_argument.py b/src/py_to_uxf_core/model/python_function_argument.py index 0230ef0..301a114 100644 --- a/src/py_to_uxf_core/model/python_function_argument.py +++ b/src/py_to_uxf_core/model/python_function_argument.py @@ -13,7 +13,7 @@ class PythonFunctionArgument: return self._type def __str__(self): - return f'{self._name}: {self._type}' + return f'<{type(self).__name__} {self._name}: {self._type}>' def __repr__(self): - return f'{self._name}: {self._type}' + return f'<{type(self).__name__} {self._name}: {self._type}>' diff --git a/src/py_to_uxf_core/model/uml_class.py b/src/py_to_uxf_core/model/uml_class.py index 09f39a7..a9ea9be 100644 --- a/src/py_to_uxf_core/model/uml_class.py +++ b/src/py_to_uxf_core/model/uml_class.py @@ -44,10 +44,10 @@ class UMLClass: self._dimension = value def __str__(self): - return f'{self._cls}: {self._position} {self._dimension}' + return f'<{type(self).__name__} {self._cls}: {self._position} {self._dimension}>' def __repr__(self): - return f'{self._cls}: {self._position} {self._dimension}' + return f'<{type(self).__name__} {self._cls}: {self._position} {self._dimension}>' def implementation_as_xml(self, base_class: 'UMLClass') -> str: base_point = Position( diff --git a/src/py_to_uxf_core/service/umlet_creator_service.py b/src/py_to_uxf_core/service/umlet_creator_service.py index 5d17294..a0c24a1 100644 --- a/src/py_to_uxf_core/service/umlet_creator_service.py +++ b/src/py_to_uxf_core/service/umlet_creator_service.py @@ -78,7 +78,7 @@ class UmletCreatorService(UmletCreatorABC): cls.position.x = new_x last_base.x = cls.position.x + cls.dimension.width else: - last_base.x = 0 + last_base.x = self._padding last_base.y = highest_y + self._padding * 2 if cls.position.y + cls.dimension.height > highest_y: @@ -88,15 +88,11 @@ class UmletCreatorService(UmletCreatorABC): uml_classes = List(UMLClass) xml_classes = '' xml_relations = '' - default_width = 80 - default_height = 80 - next_x = self._padding for cls in classes: - uml_cls = UMLClass(cls, Position(next_x, self._padding), Dimension(default_width, default_height)) + uml_cls = UMLClass(cls, Position(0, self._padding), Dimension(80, 80)) # trigger xml generation to render coordinates uml_cls.create_xml_body() - next_x += round(uml_cls.dimension.width, -1) + self._padding uml_classes.append(uml_cls) self._sort_by_implementation(uml_classes, implementations)